添加获取二维码图片

This commit is contained in:
wangxiaowei 2024-08-04 23:22:14 +08:00
parent de18853f8a
commit bfbe37397d

@ -2,6 +2,9 @@
<view class="content">
<view class="basic-info">
<image :src="pay_image" class="qrcode"></image>
<view class="load" @click="reloadImage">
重新获取
</view>
</view>
<view v-if="pay_image" class="submit-btn">
<button class="btn-style" @click="saveQrcode()">保存二维码</button>
@ -11,17 +14,22 @@
<script>
import {
localStorePayImage
localStorePayImage,
getLocalShopById
} from '@/api/shop.js'
export default {
data() {
return {
orderList: [],
pay_image: ''
pay_image: '',
lstore_id: 0
};
},
onLoad() {
onLoad(e) {
if (e?.lstore_id) {
this.lstore_id = e.lstore_id
}
this.getPayImage()
},
methods: {
@ -31,12 +39,28 @@
data,
code,
msg
} = await localStorePayImage()
} = await getLocalShopById({id: this.lstore_id})
if (code == 1) {
this.pay_image = data.pay_image
}
},
async reloadImage() {
uni.showLoading({
title: '重新获取中...'
})
const {
data,
code,
msg
} = await localStorePayImage({lstore_id: this.lstore_id})
if (code == 1) {
this.pay_image = data.pay_image
}
uni.hideLoading()
},
// 保存二维码图片
saveQrcode() {
// #ifndef H5
@ -106,6 +130,13 @@
width: 400rpx;
height: 400rpx;
}
.load {
font-weight: bold;
text-align: center;
text-decoration: underline;
margin-top: 20rpx;
}
}
.submit-btn {