|
|
@ -19,18 +19,18 @@ |
|
|
|
|
|
|
|
<!-- 景点、美食二维码 --> |
|
|
|
<view v-if="isQrcode" style="margin-top: -66rpx;"> |
|
|
|
<view class="qrcode-remain" v-if="!info.order_child[0].extract_id">还剩<span>{{remainNum}}</span>张未核销</view> |
|
|
|
<!-- <view class="qrcode-remain" v-if="!info.order_child[0].extract_id">还剩<span>{{remainNum}}</span>张未核销</view> --> |
|
|
|
|
|
|
|
<swiper class="qrcode-box" :circular="false" previous-margin="120rpx" next-margin="120rpx" :duration="800" |
|
|
|
:current="current" @change="swiperChange"> |
|
|
|
<swiper-item v-for="(item, index) in info.order_child" :key="index" class="flex-center"> |
|
|
|
<swiper-item v-for="(item, index) in qrCodeImgs" :key="index" class="flex-center"> |
|
|
|
<view class="qrcode-item flex-column"> |
|
|
|
<view class="qrcode-title">{{item.specifications_name}}</view> |
|
|
|
<image :src="item.qrcodeimg" style="width: 300rpx;height: 300rpx;" mode="aspectFill"></image> |
|
|
|
<canvas :id="'qrcodeT'+index" :canvas-id="'qrcodeT'+index" |
|
|
|
style="width:150px;height:150px;z-index: -20;bottom: -500px;position: absolute;"></canvas> |
|
|
|
<view class="qrcode-subtitle">核销码:{{item.third_order_id||item.child_id}}</view> |
|
|
|
|
|
|
|
<!-- <view class="qrcode-subtitle">核销码:{{item.third_order_id||item.child_id}}</view> --> |
|
|
|
<view class="qrcode-subtitle">核销码:{{item.code}}</view> |
|
|
|
<view class="complete-text flex-center" |
|
|
|
v-if="['WAIT_REFUND','REFUND_SUCCESS','WAIT_COMMENT','COMPLETE'].includes(item.status)"> |
|
|
|
<view class="flex-center" v-if="item.status == 'WAIT_COMMENT'"> |
|
|
@ -432,7 +432,8 @@ |
|
|
|
isQrcode: false, |
|
|
|
remainNum: 0, |
|
|
|
maskShow: false, |
|
|
|
postInfo: [] |
|
|
|
postInfo: [], |
|
|
|
qrCodeImgs: [], |
|
|
|
} |
|
|
|
}, |
|
|
|
onLoad(option) { |
|
|
@ -478,29 +479,66 @@ |
|
|
|
.includes(this.info.status)) { |
|
|
|
this.isQrcode = true |
|
|
|
for (let i = 0; i < this.info.order_child.length; i++) { |
|
|
|
// 有third_order_id 优先用third_order_id |
|
|
|
let orderChildItem = this.info.order_child[i] |
|
|
|
// 有third_order_id 优先用third_order_id 此getCodeImg生成的不用 用setQRCodeImgs |
|
|
|
this.getCodeImg(this.info.order_child[i].third_order_id||this.info.order_child[i].child_id, i); |
|
|
|
|
|
|
|
this.setQRCodeImgs(this.info.order_child[i].third_order_id||this.info.order_child[i].child_id, |
|
|
|
{specifications_name:orderChildItem.specifications_name, status:orderChildItem.status}) |
|
|
|
// 未核销数量 |
|
|
|
if (this.info.order_child[i].status == 'SUCCESS') this.remainNum += 1 |
|
|
|
} |
|
|
|
} else if (!['WAIT_PAYMENT', 'CLOSED'].includes(this.info.status)) { |
|
|
|
for (let i = 0; i < this.info.order_child.length; i++) { |
|
|
|
let orderChildItem = this.info.order_child[i] |
|
|
|
if (this.info.order_child[i].is_display_order_qrcode) { |
|
|
|
this.isQrcode = true |
|
|
|
//此getCodeImg生成的不用 |
|
|
|
this.getCodeImg(this.info.order_child[i].third_order_id||this.info.order_child[i].child_id, i); |
|
|
|
|
|
|
|
this.setQRCodeImgs(this.info.order_child[i].third_order_id||this.info.order_child[i].child_id, |
|
|
|
{specifications_name:orderChildItem.specifications_name, status:orderChildItem.status}) |
|
|
|
// 未核销数量 |
|
|
|
if (this.info.order_child[i].status == 'SUCCESS') this.remainNum += 1 |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
for (let i = 0;i<this.qrCodeImgs.length;i++) { |
|
|
|
this.getCodeImgNew(this.qrCodeImgs[i],i) |
|
|
|
} |
|
|
|
} |
|
|
|
setTimeout(() => { |
|
|
|
console.log(this.info.order_child) |
|
|
|
}, 1000) |
|
|
|
}) |
|
|
|
}, |
|
|
|
// 二维码数组分割 |
|
|
|
setQRCodeImgs(codeStr, otherParam) { |
|
|
|
if (codeStr) { |
|
|
|
let arrCode = codeStr.split(',').map(v=> {return {code: v, qrcodeimg: '', ...otherParam}}) |
|
|
|
this.qrCodeImgs = this.qrCodeImgs.concat(arrCode) |
|
|
|
} |
|
|
|
}, |
|
|
|
// 新生成二维码 |
|
|
|
getCodeImgNew(item,index) { |
|
|
|
console.log(item) |
|
|
|
new QRCode('qrcodeT'+index, { |
|
|
|
text: item.code, |
|
|
|
width: 150, |
|
|
|
height: 150, |
|
|
|
padding: 2, |
|
|
|
colorDark: 'rgb(0,0,0)', |
|
|
|
colorLight: 'rgb(255,255,255)', |
|
|
|
correctLevel: QRCode.CorrectLevel.M, // 二维码可辨识度 |
|
|
|
callback: res => { |
|
|
|
console.log('callback') |
|
|
|
this.$set(item, 'qrcodeimg', res.path); |
|
|
|
item.qrcodeimg = res.path |
|
|
|
this.$forceUpdate(); |
|
|
|
} |
|
|
|
}); |
|
|
|
}, |
|
|
|
|
|
|
|
|
|
|
|
// 生成二维码 |
|
|
|
getCodeImg(code, index) { |
|
|
|
new QRCode('qrcodeT' + index, { |
|
|
|