Browse Source

到店核销

dev_des
1054425342@qq.com 2 months ago
parent
commit
908fce5bf3
  1. 4
      static/js/request.js
  2. 2
      subPackages/orderQy/confrim.vue
  3. 209
      subPackages/orderQy/confrimWriteOff.vue
  4. 141
      subPackages/orderQy/detail.vue
  5. 134
      subPackages/orderQy/list.vue
  6. 149
      subPackages/orderQy/writeOffCode.vue

4
static/js/request.js

@ -8,8 +8,8 @@ const DEV_API_URL = 'https://epic.new.js-dyyj.com';
// const PROD_API_URL = 'https://epic.js-dyyj.com'; // const PROD_API_URL = 'https://epic.js-dyyj.com';
const PROD_API_URL = 'https://epic.new.js-dyyj.com'; const PROD_API_URL = 'https://epic.new.js-dyyj.com';
const NEWAPIURL = process.env.NODE_ENV === 'development' ? DEV_API_URL : PROD_API_URL; const NEWAPIURL = process.env.NODE_ENV === 'development' ? DEV_API_URL : PROD_API_URL;
// const DEV_API_URL_DES = 'http://192.168.124.177:8083/xcx'; const DEV_API_URL_DES = 'http://192.168.124.177:8083/xcx';
const DEV_API_URL_DES = 'https://des.js-dyyj.com/xcx'; // const DEV_API_URL_DES = 'https://des.js-dyyj.com/xcx';
const PROD_API_URL_DES = 'https://des.js-dyyj.com/xcx'; const PROD_API_URL_DES = 'https://des.js-dyyj.com/xcx';
const NEWAPIURL_DES = process.env.NODE_ENV === 'development' ? DEV_API_URL_DES : PROD_API_URL_DES; const NEWAPIURL_DES = process.env.NODE_ENV === 'development' ? DEV_API_URL_DES : PROD_API_URL_DES;
const getToken = () => { const getToken = () => {

2
subPackages/orderQy/confrim.vue

@ -482,7 +482,7 @@
contactId: this.address.id, contactId: this.address.id,
bookDeliveryTime: this.selectedDate, bookDeliveryTime: this.selectedDate,
remark: this.note, remark: this.note,
childId: this.orderChildId, orderChildId: this.orderChildId,
// totalAmount: this.totalAmount, // totalAmount: this.totalAmount,
orderExchangeDetailBoList: this.specifications orderExchangeDetailBoList: this.specifications
.filter((spec) => spec.selectedSpec).map(item => { .filter((spec) => spec.selectedSpec).map(item => {

209
subPackages/orderQy/confrimWriteOff.vue

@ -9,7 +9,7 @@
</view> </view>
<view class="reservation-desc"> <view class="reservation-desc">
<text class="desc-text" <text class="desc-text"
>此商品需要提前{{ goodsInfo.reservationDays }}天预约</text >此商品需要提前{{ goodsInfo.bookDay }}天预约</text
> >
</view> </view>
<view class="date-picker-container"> <view class="date-picker-container">
@ -18,6 +18,7 @@
type="date" type="date"
:clear-icon="false" :clear-icon="false"
:start="minDate" :start="minDate"
:end="expiryDate"
placeholder="请选择预约日期" placeholder="请选择预约日期"
@change="onDateChange" @change="onDateChange"
> >
@ -65,6 +66,24 @@
</view> </view>
</view> </view>
<!-- 到期时间 -->
<view class="expiry-section">
<view class="section-title">
<text>到期时间</text>
</view>
<view class="expiry-card">
<view class="expiry-item">
<text class="expiry-label">有效期至</text>
<text class="expiry-value">{{ expiryDate }}</text>
</view>
<view class="expiry-desc">
<text class="desc-text"
>到期后将自动退款至原支付账户请及时使用</text
>
</view>
</view>
</view>
<!-- 备注 --> <!-- 备注 -->
<view class="note-section"> <view class="note-section">
<view class="section-row"> <view class="section-row">
@ -162,80 +181,22 @@ export default {
data() { data() {
return { return {
// //
selectedDate: "2025-01-03", // 2024-12-2772025-01-03 selectedDate: "",
//
expiryDate: "",
// //
goodsInfo: { goodsInfo: {},
id: "goods001",
name: "精品咖啡体验券",
goodsName: "精品咖啡体验券",
desc: "享受一杯精心调制的手冲咖啡,感受咖啡豆的独特香气",
price: "58.00",
image: "https://via.placeholder.com/300x200/4A90E2/FFFFFF?text=Coffee",
specCombinations: [
{
specCombinationId: "spec001",
specValueOne: "大杯",
specValueTwo: "美式咖啡",
salePrice: "58.00",
quantity: 10,
skuCode: "COFFEE-L-AM",
},
{
specCombinationId: "spec002",
specValueOne: "中杯",
specValueTwo: "拿铁咖啡",
salePrice: "48.00",
quantity: 5,
skuCode: "COFFEE-M-LT",
},
{
specCombinationId: "spec003",
specValueOne: "大杯",
specValueTwo: "卡布奇诺",
salePrice: "55.00",
quantity: 8,
skuCode: "COFFEE-L-CP",
},
],
reservationDays: 7, // 077
orderChildNum: 2,
},
// //
note: "", note: "",
// //
needReservation: true, needReservation: false,
// //
minDate: "", minDate: "",
// SKU // SKU
currentSpecIndex: -1, currentSpecIndex: -1,
currentGoods: {}, currentGoods: {},
selectedSkuIndex: -1, selectedSkuIndex: -1,
specifications: [ specifications: [],
{
selectedSpec: "大杯 美式咖啡",
selectedSkuIndex: 0,
selectedSku: {
specCombinationId: "spec001",
specValueOne: "大杯",
specValueTwo: "美式咖啡",
salePrice: "58.00",
quantity: 10,
skuCode: "COFFEE-L-AM",
},
},
{
selectedSpec: "中杯 拿铁咖啡",
selectedSkuIndex: 1,
selectedSku: {
specCombinationId: "spec002",
specValueOne: "中杯",
specValueTwo: "拿铁咖啡",
salePrice: "48.00",
quantity: 5,
skuCode: "COFFEE-M-LT",
},
},
],
orderChildId: "order001", orderChildId: "order001",
}; };
}, },
@ -245,9 +206,6 @@ export default {
if (options.goodsId) { if (options.goodsId) {
this.orderChildId = options.orderChildId; this.orderChildId = options.orderChildId;
this.loadGoodsInfo(options.goodsId, options.orderChildId); this.loadGoodsInfo(options.goodsId, options.orderChildId);
} else {
// 使
this.initReservationLogic();
} }
if (options.goodsName) { if (options.goodsName) {
this.goodsInfo.name = decodeURIComponent(options.goodsName); this.goodsInfo.name = decodeURIComponent(options.goodsName);
@ -261,23 +219,6 @@ export default {
console.log("选择的日期:", date); console.log("选择的日期:", date);
}, },
//
initReservationLogic() {
//
const reservationDays = this.goodsInfo.reservationDays || 0;
this.needReservation = reservationDays > 0;
//
if (this.needReservation) {
const today = new Date();
today.setDate(today.getDate() + reservationDays);
this.minDate = today.toISOString().split("T")[0];
//
this.selectedDate = this.minDate;
}
},
// //
async loadGoodsInfo(goodsId, orderChildId) { async loadGoodsInfo(goodsId, orderChildId) {
try { try {
@ -294,14 +235,16 @@ export default {
this.goodsInfo.image = res.data.mainUrl.split(",")[0]; this.goodsInfo.image = res.data.mainUrl.split(",")[0];
// //
const reservationDays = res.data.reservationDays || 0; const reservationDays = res.data.bookDay || 0;
this.needReservation = reservationDays > 0; this.needReservation = reservationDays > 0;
this.expiryDate = res.data.expireTime;
// //
if (this.needReservation) { if (this.needReservation) {
const today = new Date(); const today = new Date();
today.setDate(today.getDate() + reservationDays); today.setDate(today.getDate() + reservationDays);
this.minDate = today.toISOString().split("T")[0]; this.minDate = today.toISOString().split("T")[0];
console.log(this.minDate);
this.selectedDate = this.minDate;
} }
// //
@ -425,10 +368,11 @@ export default {
// //
const orderData = { const orderData = {
goodsId: this.goodsInfo.goodsId, goodsId: this.goodsInfo.goodsId,
bookDeliveryTime: this.selectedDate, reservationTime: this.selectedDate,
remark: this.note, remark: this.note,
childId: this.orderChildId, expireTime: this.expiryDate,
orderExchangeDetailBoList: this.specifications orderChildId: this.orderChildId,
orderReservationDetails: this.specifications
.filter((spec) => spec.selectedSpec) .filter((spec) => spec.selectedSpec)
.map((item) => { .map((item) => {
return { return {
@ -440,19 +384,46 @@ export default {
}; };
}), }),
}; };
this.Post(
{
...orderData,
method: "post",
},
"/framework/orderReservation/add",
"DES"
).then((res) => {
if (res.code == 200) {
uni.hideLoading();
uni.showToast({
title: "预约成功",
icon: "none",
});
setTimeout(() => {
uni.redirectTo({
url: `/subPackages/orderQy/writeOffCode?orderChildId=${this.orderChildId}`,
});
}, 800);
} else {
uni.hideLoading();
uni.showToast({
title: res.msg,
icon: "none",
});
}
});
console.log("订单数据:", orderData); console.log("订单数据:", orderData);
// //
uni.redirectTo({ // uni.redirectTo({
url: `/subPackages/orderQy/writeOffCode?orderId=123456&goodsInfo=${encodeURIComponent( // url: `/subPackages/orderQy/writeOffCode?orderId=123456&goodsInfo=${encodeURIComponent(
JSON.stringify(this.goodsInfo) // JSON.stringify(this.goodsInfo)
)}&specifications=${encodeURIComponent( // )}&specifications=${encodeURIComponent(
JSON.stringify( // JSON.stringify(
this.specifications.filter((spec) => spec.selectedSpec) // this.specifications.filter((spec) => spec.selectedSpec)
) // )
)}&selectedDate=${this.selectedDate}`, // )}&selectedDate=${this.selectedDate}`,
}); // });
}, },
}, },
}; };
@ -579,6 +550,46 @@ $bg-light: #f7fafc;
line-height: 1.4; line-height: 1.4;
} }
//
.expiry-section {
margin-bottom: 24rpx;
}
.expiry-card {
background-color: #ffffff;
border-radius: 16rpx;
padding: 24rpx 30rpx;
}
.expiry-item {
display: flex;
justify-content: space-between;
align-items: center;
margin-bottom: 16rpx;
}
.expiry-label {
font-size: 26rpx;
color: $text-secondary;
}
.expiry-value {
font-size: 26rpx;
color: $text-primary;
font-weight: 600;
}
.expiry-desc {
padding-top: 12rpx;
border-top: 1rpx solid $border-color;
.desc-text {
font-size: 24rpx;
color: $warning-color;
line-height: 1.5;
}
}
// //
.note-section { .note-section {
margin-bottom: 24rpx; margin-bottom: 24rpx;

141
subPackages/orderQy/detail.vue

@ -31,7 +31,7 @@
class="goods-status-badge" class="goods-status-badge"
:class="[getGoodsStatusClass(goods.status)]" :class="[getGoodsStatusClass(goods.status)]"
> >
{{ getGoodsStatusText(goods.status) }} {{ getGoodsStatusText(goods.status, goods) }}
</view> </view>
</view> </view>
</view> </view>
@ -66,31 +66,44 @@
class="action-btn" class="action-btn"
@click="handleGoodsAction(goods)" @click="handleGoodsAction(goods)"
> >
{{ getGoodsActionText(goods.type) }} {{ getGoodsActionText(goods) }}
</button> </button>
<template v-else> <template v-else>
<template v-if="goods.type == 2"> <template v-if="goods.type == 2">
<button <!-- 快递发货 -->
v-if="goods.type == 2 && goods.status == 3" <template v-if="goods.isVerify == 0">
class="action-btn confirm-btn" <button
@click="confirmReceipt(goods)" v-if="goods.type == 2 && goods.status == 3"
> class="action-btn confirm-btn"
确认收货 @click="confirmReceipt(goods)"
</button> >
<button 确认收货
v-if="goods.type == 2 && goods.status != 1" </button>
class="action-btn" <button
@click="showLogisticsInfo(goods)" v-if="goods.type == 2 && goods.status != 1"
> class="action-btn"
查看物流 @click="showLogisticsInfo(goods)"
</button> >
查看物流
</button>
</template>
<!-- 到店核销 -->
<template v-if="goods.isVerify == 1">
<button
v-if="goods.status == 2"
class="action-btn"
@click="toShowCode(goods)"
>
去核销
</button>
</template>
</template> </template>
<button <button
v-else v-else
class="action-btn" class="action-btn"
@click="handleGoodsAction(goods)" @click="handleGoodsAction(goods)"
> >
{{ getGoodsActionTexted(goods.type) }} {{ getGoodsActionTexted(goods) }}
</button> </button>
</template> </template>
</view> </view>
@ -242,7 +255,9 @@
class="status-badge-popup" class="status-badge-popup"
:class="[getGoodsStatusClass(currentGoodsInfo.status)]" :class="[getGoodsStatusClass(currentGoodsInfo.status)]"
> >
{{ getGoodsStatusText(currentGoodsInfo.status) }} {{
getGoodsStatusText(currentGoodsInfo.status, currentGoodsInfo)
}}
</view> </view>
</view> </view>
</view> </view>
@ -426,12 +441,14 @@ export default {
onLoad(options) { onLoad(options) {
if (options.id) { if (options.id) {
this.orderId = options.id; this.orderId = options.id;
this.loadOrderDetail();
} else { } else {
// ID使 // ID使
this.loadMockData(); this.loadMockData();
} }
}, },
onShow() {
this.loadOrderDetail();
},
methods: { methods: {
// //
async loadOrderDetail() { async loadOrderDetail() {
@ -496,21 +513,43 @@ export default {
}, },
// //
getGoodsActionText(type) { getGoodsActionText(goods) {
const textMap = { if (goods.type == 2) {
1: "去查看", if (goods.isVerify == 1) {
2: "预约发货", //
3: "去使用", return goods.bookDay == 0 ? "去使用" : "预约核销";
}; } else {
return textMap[type] || "去查看"; return "预约发货";
}
} else {
const textMap = {
1: "查看",
3: "去使用",
};
return textMap[goods.type] || "操作";
}
}, },
getGoodsActionTexted(type) { getGoodsActionTexted(goods) {
const textMap = { const typeList = {
1: "去查看", 3: {
2: "查看物流", 1: "待核销",
3: "已使用", 2: "已核销",
3: "售后",
},
2: {
1: "待使用",
2: goods.isVerify == 0 ? "待发货" : "去核销",
3: "已发货",
4: "已完成",
5: "售后",
},
1: {
1: "待使用",
2: "已使用",
},
}; };
return textMap[type] || "去查看"; const type = typeList[goods.type][goods.status];
return type;
}, },
showImgJdsz(img) { showImgJdsz(img) {
if (!img) return; if (!img) return;
@ -554,14 +593,25 @@ export default {
}, },
// //
getGoodsStatusText(status) { getGoodsStatusText(status, goods) {
const statusMap = { let statusMap;
1: "待使用", if (goods.isVerify == 0) {
2: "待发货", statusMap = {
3: "已发货", 1: "待使用",
4: "已完成", 2: "待发货",
5: "售后", 3: "已发货",
}; 4: "已完成",
5: "售后",
};
} else {
statusMap = {
1: "待预约",
2: "待核销",
3: "已发货",
4: "已完成",
5: "售后",
};
}
return statusMap[status] || "未知状态"; return statusMap[status] || "未知状态";
}, },
@ -576,6 +626,11 @@ export default {
}; };
return classMap[status] || "goods-status-default"; return classMap[status] || "goods-status-default";
}, },
toShowCode(goods) {
uni.navigateTo({
url: `/subPackages/orderQy/writeOffCode?goodsId=${goods.goodsId}&orderChildId=${goods.childId}`,
});
},
// //
copyOrderNo() { copyOrderNo() {
@ -618,7 +673,7 @@ export default {
// //
viewDigitalAsset(goods) { viewDigitalAsset(goods) {
// //
uni.navigateTo({ uni.navigateTo({
url: "/subPackages/memorialAlbum/detail?id=" + goods.childId, url: "/subPackages/memorialAlbum/detail?id=" + goods.childId,
}); });
@ -639,7 +694,9 @@ export default {
// 使 // 使
useTicket(goods) { useTicket(goods) {
// 使 // 使
this.toJdszWx('pages/user/order/sceneOrderInfo/index??id='+goods.thirdOrderId) this.toJdszWx(
"pages/user/order/sceneOrderInfo/index??id=" + goods.thirdOrderId
);
}, },
// //

134
subPackages/orderQy/list.vue

@ -59,7 +59,7 @@
class="goods-status-badge" class="goods-status-badge"
:class="[getGoodsStatusClass(goods.status)]" :class="[getGoodsStatusClass(goods.status)]"
> >
{{ getGoodsStatusText(goods.status) }} {{ getGoodsStatusText(goods.status, goods) }}
</view> </view>
</view> </view>
<view class="goods-info"> <view class="goods-info">
@ -95,19 +95,16 @@
<button <button
v-if="goods.status == 1" v-if="goods.status == 1"
class="action-btn" class="action-btn"
:class="[getActionBtnClass(goods.status)]"
@click.stop="handleGoodsAction(goods)" @click.stop="handleGoodsAction(goods)"
> >
{{ getActionBtnText(goods.type) }} {{ getActionBtnText(goods) }}
</button> </button>
<template v-else> <template v-else>
<button <button
v-if="!(goods.type == 2 && goods.status == 2)"
class="action-btn" class="action-btn"
:class="[getActionBtnClass(goods.status)]"
@click.stop="handleGoodsAction(goods)" @click.stop="handleGoodsAction(goods)"
> >
{{ getActionBtnTexted(goods.type) }} {{ getActionBtnTexted(goods) }}
</button> </button>
</template> </template>
</view> </view>
@ -230,6 +227,9 @@ export default {
if (e.status) { if (e.status) {
this.currentTab = e.status; this.currentTab = e.status;
} }
},
onShow() {
this.resetList();
this.loadOrderList(); this.loadOrderList();
}, },
methods: { methods: {
@ -345,14 +345,26 @@ export default {
}, },
// //
getGoodsStatusText(status) { getGoodsStatusText(status, goods) {
const statusMap = { let statusMap;
1: "待使用", if (goods.isVerify == 0) {
2: "待发货", statusMap = {
3: "已发货", 1: "待使用",
4: "已完成", 2: "待发货",
5: "售后", 3: "已发货",
}; 4: "已完成",
5: "售后",
};
} else {
//
statusMap = {
1: goods.bookDay == 0 ? "待使用" : "待预约",
2: "待核销",
3: "已发货",
4: "已完成",
5: "售后",
};
}
return statusMap[status] || "未知状态"; return statusMap[status] || "未知状态";
}, },
@ -367,33 +379,48 @@ export default {
}; };
return classMap[status] || "goods-status-default"; return classMap[status] || "goods-status-default";
}, },
// 1
// getActionBtnText(goods) {
getActionBtnText(type) { if (goods.type == 2) {
const textMap = { if (goods.isVerify == 1) {
1: "查看", //
2: "预约发货", return goods.bookDay == 0 ? "去使用" : "预约核销";
3: "去使用", } else {
}; return "预约发货";
return textMap[type] || "操作"; }
}, } else {
getActionBtnTexted(type) { const textMap = {
const textMap = { 1: "查看",
1: "查看", 3: "去使用",
2: "查看物流", };
3: "已使用", return textMap[goods.type] || "操作";
}; }
return textMap[type] || "操作";
}, },
// :1. 2. 3.
// // 1.使 2.使
getActionBtnClass(type) { // (1.使2.3.4.5.
const classMap = { // 1
1: "btn-view", getActionBtnTexted(goods) {
2: "btn-reserve", const typeList = {
3: "btn-use", 3: {
1: "待核销",
2: "已核销",
3: "售后",
},
2: {
1: "待使用",
2: goods.isVerify == 0 ? "待发货" : "去核销",
3: "已发货",
4: "已完成",
5: "售后",
},
1: {
1: "待使用",
2: "已使用",
},
}; };
return classMap[type] || ""; const type = typeList[goods.type][goods.status];
return type;
}, },
// //
@ -427,20 +454,35 @@ export default {
reserveDelivery(goods) { reserveDelivery(goods) {
// //
if (goods.status == 1) { if (goods.status == 1) {
uni.navigateTo({ if (goods.isVerify == 0) {
url: `/subPackages/orderQy/confrim?goodsId=${goods.goodsId}&orderChildId=${goods.childId}`, uni.navigateTo({
}); url: `/subPackages/orderQy/confrim?goodsId=${goods.goodsId}&orderChildId=${goods.childId}`,
});
} else {
uni.navigateTo({
url: `/subPackages/orderQy/confrimWriteOff?goodsId=${goods.goodsId}&orderChildId=${goods.childId}`,
});
}
} else { } else {
uni.navigateTo({ if (goods.isVerify == 1 && goods.status == 2) {
url: `/subPackages/orderQy/detail?id=${goods.orderId}`, //
}); uni.navigateTo({
url: `/subPackages/orderQy/writeOffCode?goodsId=${goods.goodsId}&orderChildId=${goods.childId}`,
});
} else {
uni.navigateTo({
url: `/subPackages/orderQy/detail?id=${goods.orderId}`,
});
}
} }
}, },
// 使 // 使
useTicket(goods) { useTicket(goods) {
// 使 // 使
this.toJdszWx('pages/user/order/sceneOrderInfo/index??id='+goods.thirdOrderId) this.toJdszWx(
"pages/user/order/sceneOrderInfo/index??id=" + goods.thirdOrderId
);
}, },
// //

149
subPackages/orderQy/writeOffCode.vue

@ -9,12 +9,17 @@
<view class="code-card"> <view class="code-card">
<!-- 二维码 --> <!-- 二维码 -->
<view class="qr-code-container"> <view class="qr-code-container">
<canvas canvas-id="qrcode" class="qr-code"></canvas> <img :src="goodsInfo.orderVerification.qrCodeUrl" class="qr-code" />
<!-- <canvas canvas-id="qrcode" class="qr-code"></canvas> -->
</view> </view>
<!-- 兑换码 --> <!-- 兑换码 -->
<view class="exchange-code"> <view class="exchange-code">
<text class="code-label">兑换码</text> <text class="code-label">兑换码</text>
<text class="code-value">{{ exchangeCode }}</text> <text class="code-value">{{
(goodsInfo.orderVerification &&
goodsInfo.orderVerification.verifyCode) ||
""
}}</text>
<view class="copy-btn" @click="copyCode"> <view class="copy-btn" @click="copyCode">
<uni-icons type="copy" size="16" color="#667eea" /> <uni-icons type="copy" size="16" color="#667eea" />
<text>复制</text> <text>复制</text>
@ -23,42 +28,50 @@
</view> </view>
</view> </view>
<!-- 预约信息 -->
<view class="reservation-section" v-if="goodsInfo.reservationTime">
<view class="section-title">
<text>预约信息</text>
</view>
<view class="reservation-card">
<view class="reservation-item">
<text class="reservation-label">预约核销日期</text>
<text class="reservation-value">{{
goodsInfo.reservationTime
}}</text>
</view>
</view>
</view>
<!-- 商品信息 --> <!-- 商品信息 -->
<view class="goods-section"> <view class="goods-section">
<view class="section-title"> <view class="section-title">
<text>商品信息</text> <text>商品信息</text>
</view> </view>
<view class="goods-card"> <view class="goods-card">
<image class="goods-image" :src="goodsInfo.image" mode="aspectFill" /> <image
class="goods-image"
:src="goodsInfo.goodsImage.split(',')[0]"
mode="aspectFill"
/>
<view class="goods-info"> <view class="goods-info">
<text class="goods-name">{{ goodsInfo.goodsName || "--" }}</text> <text class="goods-name">{{ goodsInfo.goodsName || "--" }}</text>
<view class="specs-info"> <view class="specs-info">
<view <view
class="spec-item" class="spec-item"
v-for="(spec, index) in selectedSpecs" v-for="(spec, index) in goodsInfo.orderReservationDetails"
:key="index" :key="index"
> >
<text class="spec-label">{{ index + 1 }}份规格</text> <text class="spec-label">{{ index + 1 }}份规格</text>
<text class="spec-value">{{ spec.selectedSpec }}</text> <text class="spec-value"
>{{ spec.specValueOne }}/{{ spec.specValueTwo }}</text
>
</view> </view>
</view> </view>
</view> </view>
</view> </view>
</view> </view>
<!-- 预约信息 -->
<view class="reservation-section" v-if="selectedDate">
<view class="section-title">
<text>预约信息</text>
</view>
<view class="reservation-card">
<view class="reservation-item">
<text class="reservation-label">预约日期</text>
<text class="reservation-value">{{ selectedDate }}</text>
</view>
</view>
</view>
<!-- 使用说明 --> <!-- 使用说明 -->
<view class="instruction-section"> <view class="instruction-section">
<view class="section-title"> <view class="section-title">
@ -66,15 +79,25 @@
</view> </view>
<view class="instruction-card"> <view class="instruction-card">
<view class="instruction-item"> <view class="instruction-item">
<text class="instruction-text">1. 请在预约时间内到店核销</text> <text class="instruction-text"
>1.
<text class="expiry-highlight"
>有效期至{{
goodsInfo.expireTime || ""
}}到期后将自动退款至原支付账户</text
></text
>
</view>
<view class="instruction-item">
<text class="instruction-text">2. 请在预约时间内到店核销</text>
</view> </view>
<view class="instruction-item"> <view class="instruction-item">
<text class="instruction-text" <text class="instruction-text"
>2. 出示此页面或提供兑换码给工作人员</text >3. 出示此页面或提供兑换码给工作人员</text
> >
</view> </view>
<view class="instruction-item"> <view class="instruction-item">
<text class="instruction-text">3. 核销后商品不可退换</text> <text class="instruction-text">4. 核销后商品不可退换</text>
</view> </view>
</view> </view>
</view> </view>
@ -95,40 +118,20 @@ import QRCode from "@/static/js/weapp-qrcode.js";
export default { export default {
data() { data() {
return { return {
orderId: "WO202412250001", orderId: "",
exchangeCode: "EX8A9B2C3D", goodsInfo: {},
goodsInfo: {
name: "精品咖啡体验券",
image: "https://via.placeholder.com/300x200/4A90E2/FFFFFF?text=Coffee",
description: "享受一杯精心调制的手冲咖啡,感受咖啡豆的独特香气",
},
selectedSpecs: {
size: "大杯",
type: "美式咖啡",
temperature: "热饮",
},
reservationDate: "2024-12-28 14:30",
}; };
}, },
onLoad(options) { onLoad(options) {
// //
if (options.orderId) { if (options.orderChildId) {
this.orderId = options.orderId; this.orderChildId = options.orderChildId;
this.generateExchangeCode();
}
if (options.goodsInfo) {
this.goodsInfo = JSON.parse(decodeURIComponent(options.goodsInfo));
}
if (options.specifications) {
this.selectedSpecs = JSON.parse(
decodeURIComponent(options.specifications)
);
}
if (options.selectedDate) {
this.selectedDate = options.selectedDate;
} }
}, },
onShow() {
this.generateExchangeCode();
},
onReady() { onReady() {
// //
@ -136,22 +139,25 @@ export default {
}, },
methods: { methods: {
//
generateExchangeCode() { generateExchangeCode() {
// 8 this.Post(
const chars = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ"; {
let code = ""; orderChildId: this.orderChildId,
for (let i = 0; i < 8; i++) { },
code += chars.charAt(Math.floor(Math.random() * chars.length)); "/framework/orderReservation/getCanByOrderChildId",
} "DES"
this.exchangeCode = code; ).then((res) => {
if (res.code == 200) {
this.goodsInfo = res.data;
}
});
}, },
// //
generateQRCode() { generateQRCode() {
const qrData = JSON.stringify({ const qrData = JSON.stringify({
orderId: this.orderId, orderId: this.orderId,
exchangeCode: this.exchangeCode, exchangeCode: this.goodsInfo.exchangeCode,
type: "writeOff", type: "writeOff",
}); });
@ -171,7 +177,7 @@ export default {
// //
copyCode() { copyCode() {
uni.setClipboardData({ uni.setClipboardData({
data: this.exchangeCode, data: this.goodsInfo.orderVerification.verifyCode,
success: () => { success: () => {
uni.showToast({ uni.showToast({
title: "兑换码已复制", title: "兑换码已复制",
@ -202,9 +208,9 @@ export default {
this.Post( this.Post(
{ {
orderId: this.orderId, orderChildId: this.orderChildId,
}, },
"/framework/order/cancel", "/framework/orderReservation/cancel",
"DES" "DES"
) )
.then((res) => { .then((res) => {
@ -215,10 +221,8 @@ export default {
icon: "success", icon: "success",
}); });
setTimeout(() => { setTimeout(() => {
uni.redirectTo({ uni.navigateBack();
url: "/subPackages/orderQy/list", }, 800);
});
}, 1500);
} else { } else {
uni.showToast({ uni.showToast({
title: res.msg || "取消失败", title: res.msg || "取消失败",
@ -261,6 +265,7 @@ $bg-light: #f7fafc;
.content-scroll { .content-scroll {
flex: 1; flex: 1;
padding: 20rpx; padding: 20rpx;
width: 710rpx;
} }
.section-title { .section-title {
@ -292,8 +297,8 @@ $bg-light: #f7fafc;
} }
.qr-code { .qr-code {
width: 200rpx; width: 250rpx;
height: 200rpx; height: 250rpx;
border: 2rpx solid $border-color; border: 2rpx solid $border-color;
border-radius: 8rpx; border-radius: 8rpx;
} }
@ -412,6 +417,11 @@ $bg-light: #f7fafc;
display: flex; display: flex;
justify-content: space-between; justify-content: space-between;
align-items: center; align-items: center;
padding: 8rpx 0;
&:not(:last-child) {
border-bottom: 1rpx solid $border-color;
}
} }
.reservation-label { .reservation-label {
@ -451,8 +461,15 @@ $bg-light: #f7fafc;
line-height: 1.5; line-height: 1.5;
} }
.expiry-highlight {
color: #ff6b35;
font-weight: 500;
}
.bottom-space { .bottom-space {
height: 120rpx; height: 120rpx;
padding-bottom: calc(24rpx + env(safe-area-inset-bottom));
box-sizing: content-box;
} }
// //

Loading…
Cancel
Save