| | |
| | | <view class="pickup-card"> |
| | | <text class="pickup-title">自提码</text> |
| | | <view class="qrcode-box"> |
| | | <image class="qrcode-image" src="" mode="aspectFit"></image> |
| | | <canvas canvas-id="qrcodeCanvas" id="qrcodeCanvas"></canvas> |
| | | <image class="qrcode-image" :src="qrcodeImage" mode="aspectFit"></image> |
| | | </view> |
| | | <text class="pickup-code">38389</text> |
| | | <text class="pickup-code">{{ orderDetail.memberVerifyCode }}</text> |
| | | <text class="pickup-tip" @tap="copyCode">点击复制自提码</text> |
| | | </view> |
| | | </view> |
| | |
| | | </template> |
| | | |
| | | <script> |
| | | import drawQrcode from 'weapp-qrcode' |
| | | |
| | | export default { |
| | | data() { |
| | | return { |
| | | orderId: '', |
| | | orderDetail: null, |
| | | qrcodeImage: '' |
| | | } |
| | | }, |
| | | onLoad(options) { |
| | | this.orderId = options.orderId |
| | | uni.setNavigationBarTitle({ |
| | | title: '支付成功' |
| | | }) |
| | | this.getOrderDetail() |
| | | }, |
| | | methods: { |
| | | async getOrderDetail() { |
| | | const res = await this.$u.api.getOrderDetail(this.orderId) |
| | | if (res.code === 200) { |
| | | this.orderDetail = res.data |
| | | if (this.orderDetail.memberVerifyCode) { |
| | | this.generateQrcode(this.orderDetail.memberVerifyCode) |
| | | } |
| | | } |
| | | }, |
| | | generateQrcode(code) { |
| | | drawQrcode({ |
| | | canvasId: 'qrcodeCanvas', |
| | | text: code, |
| | | width: 200, |
| | | height: 200, |
| | | correctLevel: drawQrcode.CorrectLevel.H |
| | | }) |
| | | setTimeout(() => { |
| | | uni.canvasToTempFilePath({ |
| | | canvasId: 'qrcodeCanvas', |
| | | success: (res) => { |
| | | this.qrcodeImage = res.tempFilePath |
| | | } |
| | | }, this) |
| | | }, 100) |
| | | }, |
| | | goHome() { |
| | | uni.switchTab({ |
| | | url: '/pages/index/index' |
| | | }) |
| | | }, |
| | | viewOrder() { |
| | | uni.switchTab({ |
| | | url: '/pages/itinerary/itinerary' |
| | | uni.redirectTo({ |
| | | url: '/pages/itinerary/itinerary?orderId=' + this.orderId |
| | | }) |
| | | }, |
| | | copyCode() { |
| | | if (!this.orderDetail || !this.orderDetail.memberVerifyCode) { |
| | | return |
| | | } |
| | | uni.setClipboardData({ |
| | | data: '38389', |
| | | data: this.orderDetail.memberVerifyCode, |
| | | success: () => { |
| | | uni.showToast({ |
| | | title: '已复制自提码', |