From 908fce5bf3d60b94c87aa46ec8d65ad0edd71444 Mon Sep 17 00:00:00 2001 From: "1054425342@qq.com" <1054425342@qq.com> Date: Thu, 4 Sep 2025 14:47:39 +0800 Subject: [PATCH] =?UTF-8?q?=E5=88=B0=E5=BA=97=E6=A0=B8=E9=94=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- static/js/request.js | 4 +- subPackages/orderQy/confrim.vue | 2 +- subPackages/orderQy/confrimWriteOff.vue | 209 +++++++++++++----------- subPackages/orderQy/detail.vue | 141 +++++++++++----- subPackages/orderQy/list.vue | 134 +++++++++------ subPackages/orderQy/writeOffCode.vue | 149 +++++++++-------- 6 files changed, 383 insertions(+), 256 deletions(-) diff --git a/static/js/request.js b/static/js/request.js index 98bdcb1..64a8552 100644 --- a/static/js/request.js +++ b/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.new.js-dyyj.com'; 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 = 'https://des.js-dyyj.com/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 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 getToken = () => { diff --git a/subPackages/orderQy/confrim.vue b/subPackages/orderQy/confrim.vue index 2cf8a21..a85308a 100644 --- a/subPackages/orderQy/confrim.vue +++ b/subPackages/orderQy/confrim.vue @@ -482,7 +482,7 @@ contactId: this.address.id, bookDeliveryTime: this.selectedDate, remark: this.note, - childId: this.orderChildId, + orderChildId: this.orderChildId, // totalAmount: this.totalAmount, orderExchangeDetailBoList: this.specifications .filter((spec) => spec.selectedSpec).map(item => { diff --git a/subPackages/orderQy/confrimWriteOff.vue b/subPackages/orderQy/confrimWriteOff.vue index adcc026..0b51bbd 100644 --- a/subPackages/orderQy/confrimWriteOff.vue +++ b/subPackages/orderQy/confrimWriteOff.vue @@ -9,7 +9,7 @@ 此商品需要提前{{ goodsInfo.reservationDays }}天预约此商品需要提前{{ goodsInfo.bookDay }}天预约 @@ -18,6 +18,7 @@ type="date" :clear-icon="false" :start="minDate" + :end="expiryDate" placeholder="请选择预约日期" @change="onDateChange" > @@ -65,6 +66,24 @@ + + + + 到期时间 + + + + 有效期至 + {{ expiryDate }} + + + 到期后将自动退款至原支付账户,请及时使用 + + + + @@ -162,80 +181,22 @@ export default { data() { return { // 选中的日期 - selectedDate: "2025-01-03", // 假设今天是2024-12-27,7天后是2025-01-03 + selectedDate: "", + // 到期时间 + expiryDate: "", // 商品信息 - 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, // 预约天数,0表示不需要预约,7表示需要提前7天预约 - orderChildNum: 2, - }, + goodsInfo: {}, // 备注 note: "", // 是否需要预约 - needReservation: true, + needReservation: false, // 最小可选日期 minDate: "", // SKU选择相关 currentSpecIndex: -1, currentGoods: {}, selectedSkuIndex: -1, - 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", - }, - }, - ], + specifications: [], orderChildId: "order001", }; }, @@ -245,9 +206,6 @@ export default { if (options.goodsId) { this.orderChildId = options.orderChildId; this.loadGoodsInfo(options.goodsId, options.orderChildId); - } else { - // 使用假数据时,设置预约日期逻辑 - this.initReservationLogic(); } if (options.goodsName) { this.goodsInfo.name = decodeURIComponent(options.goodsName); @@ -261,23 +219,6 @@ export default { 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) { try { @@ -294,14 +235,16 @@ export default { 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.expiryDate = res.data.expireTime; // 设置最小可选日期 if (this.needReservation) { const today = new Date(); today.setDate(today.getDate() + reservationDays); this.minDate = today.toISOString().split("T")[0]; + console.log(this.minDate); + this.selectedDate = this.minDate; } // 初始化规格选择数组 @@ -425,10 +368,11 @@ export default { // 构建订单数据 const orderData = { goodsId: this.goodsInfo.goodsId, - bookDeliveryTime: this.selectedDate, + reservationTime: this.selectedDate, remark: this.note, - childId: this.orderChildId, - orderExchangeDetailBoList: this.specifications + expireTime: this.expiryDate, + orderChildId: this.orderChildId, + orderReservationDetails: this.specifications .filter((spec) => spec.selectedSpec) .map((item) => { 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); // 直接跳转到核销码展示页面,传递订单信息 - uni.redirectTo({ - url: `/subPackages/orderQy/writeOffCode?orderId=123456&goodsInfo=${encodeURIComponent( - JSON.stringify(this.goodsInfo) - )}&specifications=${encodeURIComponent( - JSON.stringify( - this.specifications.filter((spec) => spec.selectedSpec) - ) - )}&selectedDate=${this.selectedDate}`, - }); + // uni.redirectTo({ + // url: `/subPackages/orderQy/writeOffCode?orderId=123456&goodsInfo=${encodeURIComponent( + // JSON.stringify(this.goodsInfo) + // )}&specifications=${encodeURIComponent( + // JSON.stringify( + // this.specifications.filter((spec) => spec.selectedSpec) + // ) + // )}&selectedDate=${this.selectedDate}`, + // }); }, }, }; @@ -579,6 +550,46 @@ $bg-light: #f7fafc; 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 { margin-bottom: 24rpx; diff --git a/subPackages/orderQy/detail.vue b/subPackages/orderQy/detail.vue index 66a1bc4..c6a4566 100644 --- a/subPackages/orderQy/detail.vue +++ b/subPackages/orderQy/detail.vue @@ -31,7 +31,7 @@ class="goods-status-badge" :class="[getGoodsStatusClass(goods.status)]" > - {{ getGoodsStatusText(goods.status) }} + {{ getGoodsStatusText(goods.status, goods) }} @@ -66,31 +66,44 @@ class="action-btn" @click="handleGoodsAction(goods)" > - {{ getGoodsActionText(goods.type) }} + {{ getGoodsActionText(goods) }} @@ -242,7 +255,9 @@ class="status-badge-popup" :class="[getGoodsStatusClass(currentGoodsInfo.status)]" > - {{ getGoodsStatusText(currentGoodsInfo.status) }} + {{ + getGoodsStatusText(currentGoodsInfo.status, currentGoodsInfo) + }} @@ -426,12 +441,14 @@ export default { onLoad(options) { if (options.id) { this.orderId = options.id; - this.loadOrderDetail(); } else { // 如果没有传入订单ID,使用假数据进行渲染 this.loadMockData(); } }, + onShow() { + this.loadOrderDetail(); + }, methods: { // 加载订单详情 async loadOrderDetail() { @@ -496,21 +513,43 @@ export default { }, // 获取商品操作按钮文本 - getGoodsActionText(type) { - const textMap = { - 1: "去查看", - 2: "预约发货", - 3: "去使用", - }; - return textMap[type] || "去查看"; + getGoodsActionText(goods) { + if (goods.type == 2) { + if (goods.isVerify == 1) { + //到店核销 + return goods.bookDay == 0 ? "去使用" : "预约核销"; + } else { + return "预约发货"; + } + } else { + const textMap = { + 1: "查看", + 3: "去使用", + }; + return textMap[goods.type] || "操作"; + } }, - getGoodsActionTexted(type) { - const textMap = { - 1: "去查看", - 2: "查看物流", - 3: "已使用", + getGoodsActionTexted(goods) { + const typeList = { + 3: { + 1: "待核销", + 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) { if (!img) return; @@ -554,14 +593,25 @@ export default { }, // 获取商品状态文本 - getGoodsStatusText(status) { - const statusMap = { - 1: "待使用", - 2: "待发货", - 3: "已发货", - 4: "已完成", - 5: "售后", - }; + getGoodsStatusText(status, goods) { + let statusMap; + if (goods.isVerify == 0) { + statusMap = { + 1: "待使用", + 2: "待发货", + 3: "已发货", + 4: "已完成", + 5: "售后", + }; + } else { + statusMap = { + 1: "待预约", + 2: "待核销", + 3: "已发货", + 4: "已完成", + 5: "售后", + }; + } return statusMap[status] || "未知状态"; }, @@ -576,6 +626,11 @@ export default { }; return classMap[status] || "goods-status-default"; }, + toShowCode(goods) { + uni.navigateTo({ + url: `/subPackages/orderQy/writeOffCode?goodsId=${goods.goodsId}&orderChildId=${goods.childId}`, + }); + }, // 复制订单号 copyOrderNo() { @@ -618,7 +673,7 @@ export default { // 查看数字资产 viewDigitalAsset(goods) { // 跳转到数字资产详情页面 - + uni.navigateTo({ url: "/subPackages/memorialAlbum/detail?id=" + goods.childId, }); @@ -639,7 +694,9 @@ export default { // 使用门票 useTicket(goods) { // 处理使用门票逻辑 - this.toJdszWx('pages/user/order/sceneOrderInfo/index??id='+goods.thirdOrderId) + this.toJdszWx( + "pages/user/order/sceneOrderInfo/index??id=" + goods.thirdOrderId + ); }, // 显示物流信息 diff --git a/subPackages/orderQy/list.vue b/subPackages/orderQy/list.vue index 763c079..217492e 100644 --- a/subPackages/orderQy/list.vue +++ b/subPackages/orderQy/list.vue @@ -59,7 +59,7 @@ class="goods-status-badge" :class="[getGoodsStatusClass(goods.status)]" > - {{ getGoodsStatusText(goods.status) }} + {{ getGoodsStatusText(goods.status, goods) }} @@ -95,19 +95,16 @@ @@ -230,6 +227,9 @@ export default { if (e.status) { this.currentTab = e.status; } + }, + onShow() { + this.resetList(); this.loadOrderList(); }, methods: { @@ -345,14 +345,26 @@ export default { }, // 获取商品状态文本 - getGoodsStatusText(status) { - const statusMap = { - 1: "待使用", - 2: "待发货", - 3: "已发货", - 4: "已完成", - 5: "售后", - }; + getGoodsStatusText(status, goods) { + let statusMap; + if (goods.isVerify == 0) { + statusMap = { + 1: "待使用", + 2: "待发货", + 3: "已发货", + 4: "已完成", + 5: "售后", + }; + } else { + // 到店核销 + statusMap = { + 1: goods.bookDay == 0 ? "待使用" : "待预约", + 2: "待核销", + 3: "已发货", + 4: "已完成", + 5: "售后", + }; + } return statusMap[status] || "未知状态"; }, @@ -367,33 +379,48 @@ export default { }; return classMap[status] || "goods-status-default"; }, - - // 获取操作按钮文本 - getActionBtnText(type) { - const textMap = { - 1: "查看", - 2: "预约发货", - 3: "去使用", - }; - return textMap[type] || "操作"; - }, - getActionBtnTexted(type) { - const textMap = { - 1: "查看", - 2: "查看物流", - 3: "已使用", - }; - return textMap[type] || "操作"; + // 状态为1的时候的文字描述 + getActionBtnText(goods) { + if (goods.type == 2) { + if (goods.isVerify == 1) { + //到店核销 + return goods.bookDay == 0 ? "去使用" : "预约核销"; + } else { + return "预约发货"; + } + } else { + const textMap = { + 1: "查看", + 3: "去使用", + }; + return textMap[goods.type] || "操作"; + } }, - - // 获取操作按钮样式类 - getActionBtnClass(type) { - const classMap = { - 1: "btn-view", - 2: "btn-reserve", - 3: "btn-use", + // 门票订单状态:1.待核销 2.已核销 3.售后 + // 数字资产:1.待使用 2.已使用 + // 资产商品(快递):1.待使用2.待发货3.已发货4.已完成5.售后 + // 状态不为1的时候的文字描述 + getActionBtnTexted(goods) { + const typeList = { + 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) { // 跳转到确认订单页面 if (goods.status == 1) { - uni.navigateTo({ - url: `/subPackages/orderQy/confrim?goodsId=${goods.goodsId}&orderChildId=${goods.childId}`, - }); + if (goods.isVerify == 0) { + 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 { - uni.navigateTo({ - url: `/subPackages/orderQy/detail?id=${goods.orderId}`, - }); + if (goods.isVerify == 1 && goods.status == 2) { + //核销 + uni.navigateTo({ + url: `/subPackages/orderQy/writeOffCode?goodsId=${goods.goodsId}&orderChildId=${goods.childId}`, + }); + } else { + uni.navigateTo({ + url: `/subPackages/orderQy/detail?id=${goods.orderId}`, + }); + } } }, // 使用门票 useTicket(goods) { // 处理使用门票逻辑 - this.toJdszWx('pages/user/order/sceneOrderInfo/index??id='+goods.thirdOrderId) + this.toJdszWx( + "pages/user/order/sceneOrderInfo/index??id=" + goods.thirdOrderId + ); }, // 跳转到订单详情页面 diff --git a/subPackages/orderQy/writeOffCode.vue b/subPackages/orderQy/writeOffCode.vue index 2edc86c..ce8ed2c 100644 --- a/subPackages/orderQy/writeOffCode.vue +++ b/subPackages/orderQy/writeOffCode.vue @@ -9,12 +9,17 @@ - + + 兑换码 - {{ exchangeCode }} + {{ + (goodsInfo.orderVerification && + goodsInfo.orderVerification.verifyCode) || + "" + }} 复制 @@ -23,42 +28,50 @@ + + + + 预约信息 + + + + 预约核销日期 + {{ + goodsInfo.reservationTime + }} + + + + 商品信息 - + {{ goodsInfo.goodsName || "--" }} 第{{ index + 1 }}份规格: - {{ spec.selectedSpec }} + {{ spec.specValueOne }}/{{ spec.specValueTwo }} - - - - 预约信息 - - - - 预约日期 - {{ selectedDate }} - - - - @@ -66,15 +79,25 @@ - 1. 请在预约时间内到店核销 + 1. + 有效期至{{ + goodsInfo.expireTime || "" + }},到期后将自动退款至原支付账户 + + + 2. 请在预约时间内到店核销 2. 出示此页面或提供兑换码给工作人员3. 出示此页面或提供兑换码给工作人员 - 3. 核销后商品不可退换 + 4. 核销后商品不可退换 @@ -95,40 +118,20 @@ import QRCode from "@/static/js/weapp-qrcode.js"; export default { data() { return { - orderId: "WO202412250001", - exchangeCode: "EX8A9B2C3D", - goodsInfo: { - name: "精品咖啡体验券", - image: "https://via.placeholder.com/300x200/4A90E2/FFFFFF?text=Coffee", - description: "享受一杯精心调制的手冲咖啡,感受咖啡豆的独特香气", - }, - selectedSpecs: { - size: "大杯", - type: "美式咖啡", - temperature: "热饮", - }, - reservationDate: "2024-12-28 14:30", + orderId: "", + goodsInfo: {}, }; }, onLoad(options) { // 接收页面参数 - if (options.orderId) { - this.orderId = options.orderId; - 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; + if (options.orderChildId) { + this.orderChildId = options.orderChildId; } }, + onShow() { + this.generateExchangeCode(); + }, onReady() { // 生成二维码 @@ -136,22 +139,25 @@ export default { }, methods: { - // 生成兑换码 generateExchangeCode() { - // 生成8位随机兑换码 - const chars = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ"; - let code = ""; - for (let i = 0; i < 8; i++) { - code += chars.charAt(Math.floor(Math.random() * chars.length)); - } - this.exchangeCode = code; + this.Post( + { + orderChildId: this.orderChildId, + }, + "/framework/orderReservation/getCanByOrderChildId", + "DES" + ).then((res) => { + if (res.code == 200) { + this.goodsInfo = res.data; + } + }); }, // 生成二维码 generateQRCode() { const qrData = JSON.stringify({ orderId: this.orderId, - exchangeCode: this.exchangeCode, + exchangeCode: this.goodsInfo.exchangeCode, type: "writeOff", }); @@ -171,7 +177,7 @@ export default { // 复制兑换码 copyCode() { uni.setClipboardData({ - data: this.exchangeCode, + data: this.goodsInfo.orderVerification.verifyCode, success: () => { uni.showToast({ title: "兑换码已复制", @@ -202,9 +208,9 @@ export default { this.Post( { - orderId: this.orderId, + orderChildId: this.orderChildId, }, - "/framework/order/cancel", + "/framework/orderReservation/cancel", "DES" ) .then((res) => { @@ -215,10 +221,8 @@ export default { icon: "success", }); setTimeout(() => { - uni.redirectTo({ - url: "/subPackages/orderQy/list", - }); - }, 1500); + uni.navigateBack(); + }, 800); } else { uni.showToast({ title: res.msg || "取消失败", @@ -261,6 +265,7 @@ $bg-light: #f7fafc; .content-scroll { flex: 1; padding: 20rpx; + width: 710rpx; } .section-title { @@ -292,8 +297,8 @@ $bg-light: #f7fafc; } .qr-code { - width: 200rpx; - height: 200rpx; + width: 250rpx; + height: 250rpx; border: 2rpx solid $border-color; border-radius: 8rpx; } @@ -412,6 +417,11 @@ $bg-light: #f7fafc; display: flex; justify-content: space-between; align-items: center; + padding: 8rpx 0; + + &:not(:last-child) { + border-bottom: 1rpx solid $border-color; + } } .reservation-label { @@ -451,8 +461,15 @@ $bg-light: #f7fafc; line-height: 1.5; } +.expiry-highlight { + color: #ff6b35; + font-weight: 500; +} + .bottom-space { height: 120rpx; + padding-bottom: calc(24rpx + env(safe-area-inset-bottom)); + box-sizing: content-box; } // 底部操作区域