From 124beb066671b8b0baaabb1ce63656b50483f3b4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=88=9D=E5=BF=83?= <13773726377@163.com> Date: Wed, 8 Apr 2026 16:11:18 +0800 Subject: [PATCH] 1 --- src/api/login.js | 5 +- src/page-reser/reservation/index.vue | 108 +++++++++++++++--- src/pages/client/index/index.vue | 9 +- .../client/order/components/OrderItem.vue | 31 +++-- 4 files changed, 126 insertions(+), 27 deletions(-) diff --git a/src/api/login.js b/src/api/login.js index af0988b..44c45c1 100644 --- a/src/api/login.js +++ b/src/api/login.js @@ -164,10 +164,11 @@ export const getDonationSummary = () => { }; // 抖音审核 -export const getdouyReview = () => { +export const getdouyReview = (data) => { return request({ url: DOUY_REVIEW, - method: "GET" + method: "POST", + data, }); }; diff --git a/src/page-reser/reservation/index.vue b/src/page-reser/reservation/index.vue index 0ec8f0d..246dd2c 100644 --- a/src/page-reser/reservation/index.vue +++ b/src/page-reser/reservation/index.vue @@ -96,7 +96,7 @@ --> - 核销 + 预约 @@ -147,6 +147,12 @@ export default { components: { InfoCell, }, + props: { + orderId: { + type: [String, Number], + default: null + } + }, data() { return { imgPrefix, @@ -156,7 +162,7 @@ export default { ORDER_TYPE_RESERVATION, ORDER_TYPE_SITE, orderType: ORDER_TYPE_RESERVATION, - selectedPetType: PET_TYPE_CAT, // 默认选中“猫” + selectedPetType: PET_TYPE_CAT, // 默认选中"猫" petInfo: {}, // 兼容下游,取 selectedPets[0] selectedPets: [], // 多选宠物列表 parkState: "", @@ -168,11 +174,24 @@ export default { address: null, catHtmlData: "", dogHtmlData: "", - tip: '' + tip: '', + localOrderId: null, // 本地存储的 orderId }; }, mounted() { this.initData(); + // 如果有传入的 orderId,保存到本地 + if (this.orderId) { + this.localOrderId = this.orderId; + } + }, + watch: { + // 监听 orderId 变化 + orderId(newVal) { + if (newVal) { + this.localOrderId = newVal; + } + } }, computed: { // 展示价格:discount_price 数组相加的总和 @@ -186,26 +205,87 @@ export default { } }, methods: { + // 用于接收从父页面传递的数据 + onShowFun(orderId) { + if (orderId) { + this.localOrderId = orderId; + } + }, // 核销按钮点击处理 async writeOff () { - const data = { - goods_order_id:1, //抖音商品订单id(整数) - order_date:'2026-03-01', //预约日期(‘2026-03-01’格式) - period_id:1, //预约时间段id(整数) - address_id:1, //地址id(整数) - recipient_name:'用户姓名', //用户姓名 - phone:123, //用户手机 - park_desc:123, //停车描述 - note:'哈哈' // 备注 + // 校验必填项 + if (Object.keys(this.reservationTime).length === 0) { + uni.showToast({ + title: "请选择预约时间", + icon: "none", + }); + return; + } + if (!this.address) { + uni.showToast({ + title: "请选择服务地址", + icon: "none", + }); + return; + } + if (!this.parkState) { + uni.showToast({ + title: "请选择停车状况", + icon: "none", + }); + return; + } + if (!this.localOrderId) { + uni.showToast({ + title: "订单ID缺失", + icon: "none", + }); + return; + } + + const data = { + goods_order_id: Number(this.localOrderId), //抖音商品订单id(整数) + order_date: this.reservationTime.date, //预约日期('2026-03-01'格式) + period_id: Number(this.reservationTime.id), //预约时间段id(整数) + address_id: Number(this.address.id), //地址id(整数) + recipient_name: this.address.name || '用户姓名', //用户姓名 + phone: this.address.phone || '', //用户手机 + park_desc: this.otherParkState || this.parkState || '', //停车描述 + note: '' // 备注 }; + + uni.showLoading({ + title: "处理中", + mask: true, + }); + getdouyReview(data).then((res) => { + uni.hideLoading(); if (res.code == 0) { uni.showToast({ title: "预约成功", icon: "none", }); - } - }); + // 预约成功后清空数据并跳转 + setTimeout(() => { + uni.reLaunch({ + url: "/pages/client/index/index?activePageId=homePage", + }); + }, 1500); + } else { + uni.showToast({ + title: res.msg || "预约失败", + icon: "none", + }); + } + }).catch((err) => { + uni.hideLoading(); + console.error("预约失败:", err); + uni.showToast({ + title: "预约失败,请重试", + icon: "none", + }); + }); }, getPetShortName(pet) { diff --git a/src/pages/client/index/index.vue b/src/pages/client/index/index.vue index a5c3dc3..3f7a026 100644 --- a/src/pages/client/index/index.vue +++ b/src/pages/client/index/index.vue @@ -21,6 +21,7 @@ 立即预约 @@ -335,16 +335,27 @@ export default { data: { outOrderNo: "DYG177556196373493862814838179", refundInfo: { - reason:["计划有变,暂时不需要了"], - reasonCode:[401], - }, - goodsList: [ - { goodsId: "7625832097692813354", goodsType: 1, quantity: 1 }, - ], + reason: ["计划有变,暂时不需要了"] + }, + // refundInfo: { + // reason:["计划有变,暂时不需要了"], + // reasonCode:[401], + // }, + itemOrderList:[ + { + "itemOrderId": "1093391915337944382", + "refundAmount": 9000 + }], + // goodsList: [ + // { goodsId: "7625832097692813354", goodsType: 1, quantity: 1 }, + // ], }, }; + // console.log('applyRefund options', JSON.stringify(options)) + console.log(res1.data,'??') plugin.applyRefund({ - goodsList: res1.data.goodsList, + itemOrderList:res1.data.itemOrderList, + // goodsList: res1.data.goodsList, outOrderNo: res1.data.outOrderNo, refundInfo: res1.data.refundInfo, success: (res) => { @@ -453,9 +464,9 @@ export default { jumpToDetails() { this.$emit("jumpToDetails", this.data); }, - jumpToReservation() { + jumpToReservation(orderId) { uni.reLaunch({ - url: "/pages/client/index/index?activePageId=reservationPage", + url: `/pages/client/index/index?activePageId=reservationPage&orderId=${orderId}`, }); }, },