|
|
@ -23,6 +23,9 @@ |
|
|
|
<view class="info-header">核销信息</view> |
|
|
|
<view class="flex flex-column info-content"> |
|
|
|
<image class="info-qr" :src="orderDetail.qrCodeImgUrl" mode="widthFix"></image> |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<view class="info-no">{{ `订单号:${orderDetail.id}` }}</view> |
|
|
|
<view class="info-desc">{{ `有效时间:${orderDetail.startTime}至${orderDetail.endTime}` }}</view> |
|
|
|
</view> |
|
|
@ -31,7 +34,7 @@ |
|
|
|
|
|
|
|
<!-- 下单 --> |
|
|
|
<view class="flex bar"> |
|
|
|
<button plain class="btn btn-plain" @click="overOrder">核销</button> |
|
|
|
<!-- <button plain class="btn btn-plain" @click="overOrder">核销</button> --> |
|
|
|
<button plain class="btn btn-plain" @click="onRefund">申请退款</button> |
|
|
|
<button plain class="btn" @click="onBuyAgain">再次购买</button> |
|
|
|
</view> |
|
|
@ -42,6 +45,8 @@ |
|
|
|
<script> |
|
|
|
import productCard from '@/components/product/productCard.vue' |
|
|
|
|
|
|
|
import QRCode from 'qrcode'; |
|
|
|
|
|
|
|
export default { |
|
|
|
components: { |
|
|
|
productCard, |
|
|
@ -49,6 +54,8 @@ |
|
|
|
data() { |
|
|
|
return { |
|
|
|
orderDetail: {}, |
|
|
|
qrCodeData: '', // 用于存放生成的二维码图片的base64字符串 |
|
|
|
|
|
|
|
} |
|
|
|
}, |
|
|
|
onLoad(args) { |
|
|
@ -58,6 +65,10 @@ |
|
|
|
onPullDownRefresh() { |
|
|
|
this.fetchOrderDetail() |
|
|
|
}, |
|
|
|
onReady() { |
|
|
|
this.generateQRCode(); // 页面加载完成后生成二维码 |
|
|
|
}, |
|
|
|
|
|
|
|
methods: { |
|
|
|
async fetchOrderDetail() { |
|
|
|
try { |
|
|
@ -71,6 +82,20 @@ |
|
|
|
uni.stopPullDownRefresh() |
|
|
|
}, |
|
|
|
|
|
|
|
|
|
|
|
async generateQRCode() { |
|
|
|
try { |
|
|
|
// 订单标识,例如:'order_12345' |
|
|
|
const orderId = 'order_12345'; |
|
|
|
// 生成二维码并获取base64字符串 |
|
|
|
const qrCode = await QRCode.toDataURL(orderId); |
|
|
|
this.qrCodeData = qrCode; // 将生成的二维码数据保存到data中 |
|
|
|
} catch (err) { |
|
|
|
console.error('生成二维码失败', err); |
|
|
|
} |
|
|
|
}, |
|
|
|
|
|
|
|
|
|
|
|
overOrder(){ |
|
|
|
uni.showModal({ |
|
|
|
title: '确认核销订单吗?', |
|
|
|