diff --git a/package1/buyFood/buyFood.vue b/package1/buyFood/buyFood.vue index 22f38ff..f0b9e8c 100644 --- a/package1/buyFood/buyFood.vue +++ b/package1/buyFood/buyFood.vue @@ -643,7 +643,7 @@ if (!this.currentOrderId || !this.backendTotalAmount) return; let amountInCents = Math.round(this.backendTotalAmount * 100); - let payDesc = this.isGroupBuy ? '拼团订单' : '商城订单'; + let payDesc = '商城订单'; this.tui.request("/api/wechat/pay/unified-order", "POST", { openid: uni.getStorageSync('miniProgramOpenid') || 'test-openid', diff --git a/package1/group/groupBuySingle.vue b/package1/group/groupBuySingle.vue index 13a7ee4..d5ef0e1 100644 --- a/package1/group/groupBuySingle.vue +++ b/package1/group/groupBuySingle.vue @@ -1020,6 +1020,12 @@ } let packageFee = parseFloat(this.currentItem.lunchBox || 0); + this.currentItem.moreBuyData = [] + for(let i = 0;i 0){ + this.currentItem.moreBuyData.push(this.moreBuyData[i]) + } + } if (this.groupId && this.isFaceToFaceGroup) { // Direct face-to-face pay path this.submitFTFJoinPay(specChoices); @@ -1027,12 +1033,7 @@ } // Pack data for checkout - this.currentItem.moreBuyData = [] - for(let i = 0;i 0){ - this.currentItem.moreBuyData.push(this.moreBuyData[i]) - } - } + let goData = { item: this.currentItem, groupRule: this.selectedGroupRule, @@ -1279,7 +1280,7 @@ this.tui.request("/api/wechat/pay/unified-order", "POST", { openid: uni.getStorageSync('miniProgramOpenid') || 'test-openid', amount: amountInCents, - description: '拼团参与订单', + description: '商城订单', outTradeNo: this.currentOrderId }, false, false).then((res) => { if (res.code == 200) { diff --git a/package1/order/orderDetail.vue b/package1/order/orderDetail.vue index af7ca60..c398e1d 100644 --- a/package1/order/orderDetail.vue +++ b/package1/order/orderDetail.vue @@ -114,7 +114,7 @@ 待消费 配送员已取货 订单已完成 - 等待商家同意退款 + 等待同意退款 订单已取消 订单已退款 售后中 @@ -264,7 +264,7 @@ 配送员 - + {{orderDetail.deliveryInfo.workerName != null ? orderDetail.deliveryInfo.workerName : ''}} - + 配送员接单时间 @@ -286,19 +286,19 @@ 商家出餐时间 - + {{orderDetail.shopMakeTime ? orderDetail.shopMakeTime : '' | formatTime}} - + 配送员到店时间 - + {{orderDetail.deliveryInfo.arriveTime ? orderDetail.deliveryInfo.arriveTime : '' | formatTime}} - + 配送员取货时间 @@ -310,7 +310,7 @@ 送达时间 - + {{orderDetail.deliveryInfo.finishTime ? orderDetail.deliveryInfo.finishTime : '尽快送达' | formatTime}} @@ -327,11 +327,36 @@ + + + + + + 选择退款原因 + + + + 全额退款(商家原因) + + + + 全额退款(配送员原因) + + + + 全额退款(商家+配送员原因) + + + + 确定要取消订单吗 - 取消订单需要商家同意 - 本单商家备餐时长共计{{payData | shopTime}} 配送员配送时长共计{{payData | peisongTime}} + 取消订单需要商家同意 + + 商家还未出餐 + 本单商家备餐时长共计{{shopTime}} 配送员配送时长共计{{peisongTime}} + 确认取消 @@ -346,7 +371,12 @@ data() { return { pintuan:false, + sellTime:2, menuButtonInfo: {}, + refundType:3, + refundTypeStatus:4, + shopTime:'', + peisongTime:'', orderId:'', payData:{}, orderDetail:{}, @@ -399,52 +429,6 @@ // 拼接格式:年-月-日 时:分:秒 return `${year}-${month}-${day} ${hour}:${minute}:${second}`; - }, - shopTime(item){ - if(item.shopMakeTime == null){ - return '商家还未出餐'; - } - const date1 = new Date(item.deliveryInfo.acceptTime); - const date2 = new Date(item.shopMakeTime); - - // 2. 计算毫秒差值 (取绝对值,防止结果为负数) - let diffMs = Math.abs(date2 - date1); - - // 3. 数学换算 - // 1秒 = 1000毫秒 - // 1分 = 60秒 - // 1时 = 60分 - const seconds = Math.floor((diffMs / 1000) % 60); - const minutes = Math.floor((diffMs / (1000 * 60)) % 60); - const hours = Math.floor(diffMs / (1000 * 60 * 60)); - - // 4. 格式化输出 (可选:补零操作,例如 9秒 -> 09秒) - const fmt = (num) => num.toString().padStart(2, '0'); - - return `${fmt(hours)}时${fmt(minutes)}分${fmt(seconds)}秒`; - }, - peisongTime(item){ - if(item.shopMakeTime == null){ - return '商家还未出餐'; - } - const date1 = new Date(item.shopMakeTime); - const date2 = new Date(); - - // 2. 计算毫秒差值 (取绝对值,防止结果为负数) - let diffMs = Math.abs(date2 - date1); - - // 3. 数学换算 - // 1秒 = 1000毫秒 - // 1分 = 60秒 - // 1时 = 60分 - const seconds = Math.floor((diffMs / 1000) % 60); - const minutes = Math.floor((diffMs / (1000 * 60)) % 60); - const hours = Math.floor(diffMs / (1000 * 60 * 60)); - - // 4. 格式化输出 (可选:补零操作,例如 9秒 -> 09秒) - const fmt = (num) => num.toString().padStart(2, '0'); - - return `${fmt(hours)}时${fmt(minutes)}分${fmt(seconds)}秒`; } }, onLoad(option) { @@ -460,6 +444,22 @@ openCode(){ this.$refs.imgPopup.open() }, + checkSellTime(type){ + this.sellTime = type; + if(this.sellTime == 2){ + //this.returnData.refundAmount = this.orderDetail.totalAmount + this.refundType = 3 + this.refundTypeStatus = 1 + }else if(this.sellTime == 3){ + //this.returnData.refundAmount = this.orderDetail.totalAmount + this.refundType = 3 + this.refundTypeStatus = 2 + }else{ + //this.returnData.refundAmount = this.orderDetail.totalAmount + this.refundType = 3 + this.refundTypeStatus = 3 + } + }, makeCall(phone){ uni.makePhoneCall({ phoneNumber: phone @@ -473,13 +473,48 @@ }, returnPopupProp(item){ this.payData = item; + if(this.payData.shopMakeTime != null){ + const date1 = new Date(this.payData.deliveryInfo.acceptTime); + const date2 = new Date(this.payData.shopMakeTime); + + // 2. 计算毫秒差值 (取绝对值,防止结果为负数) + let diffMs = Math.abs(date2 - date1); + + // 3. 数学换算 + // 1秒 = 1000毫秒 + // 1分 = 60秒 + // 1时 = 60分 + const seconds = Math.floor((diffMs / 1000) % 60); + const minutes = Math.floor((diffMs / (1000 * 60)) % 60); + const hours = Math.floor(diffMs / (1000 * 60 * 60)); + + // 4. 格式化输出 (可选:补零操作,例如 9秒 -> 09秒) + const fmt = (num) => num.toString().padStart(2, '0'); + + this.shopTime = `${fmt(hours)}时${fmt(minutes)}分${fmt(seconds)}秒`; + + const date3 = new Date(); + + // 2. 计算毫秒差值 (取绝对值,防止结果为负数) + let diffMs1 = Math.abs(date3 - date2); + + // 3. 数学换算 + // 1秒 = 1000毫秒 + // 1分 = 60秒 + // 1时 = 60分 + const seconds1 = Math.floor((diffMs1 / 1000) % 60); + const minutes1 = Math.floor((diffMs1 / (1000 * 60)) % 60); + const hours1 = Math.floor(diffMs1 / (1000 * 60 * 60)); + + this.peisongTime = `${fmt(hours1)}时${fmt(minutes1)}分${fmt(seconds1)}秒`; + } this.$refs.returnPopup.open('bottom'); }, returnOrder(){ this.$refs.returnPopup.close(); let item = this.payData let that = this - that.tui.request("/mall/order/cancel", "POST", {orderId:item.id,userId:uni.getStorageSync('id')}, false, true).then((res) => { + that.tui.request("/mall/order/cancel", "POST", {refundType:this.refundType,refundTypeStatus:this.refundTypeStatus,orderId:item.id,userId:uni.getStorageSync('id')}, false, true).then((res) => { if (res.code == 200) { that.tui.toast("取消订单成功"); that.getOrderDetail(item.id) @@ -501,6 +536,7 @@ }); }, getOrderDetail(id){ + this.pintuan = false; let that = this that.tui.request("/mall/order/detail/"+id, "GET", {}, false, true).then((res) => { if (res.code == 200) { diff --git a/package1/order/orderList.vue b/package1/order/orderList.vue index e0e5b7f..0070bf1 100644 --- a/package1/order/orderList.vue +++ b/package1/order/orderList.vue @@ -113,7 +113,7 @@ 已取消 - 待商家同意退款 + 待同意退款 已退款 @@ -184,9 +184,9 @@ - + 去支付 @@ -247,11 +247,36 @@ + + + + + + 选择退款原因 + + + + 全额退款(商家原因) + + + + 全额退款(配送员原因) + + + + 全额退款(商家+配送员原因) + + + + 确定要取消订单吗 - 取消订单需要商家同意 - 本单商家备餐时长共计{{payData | shopTime}} 配送员配送时长共计{{payData | peisongTime}} + 取消订单需要商家同意 + + 商家还未出餐 + 本单商家备餐时长共计{{shopTime}} 配送员配送时长共计{{peisongTime}} + 确认取消 @@ -273,6 +298,11 @@ tab2Checked: 10, totalPages: 1, pageNum:1, + shopTime:'', + peisongTime:'', + sellTime:2, + refundType:2, + refundTypeStatus:1, payData:{}, orderList:[], searchForm:{ @@ -335,52 +365,6 @@ // 拼接格式:年-月-日 时:分:秒 return `${year}-${month}-${day} ${hour}:${minute}:${second}`; - }, - shopTime(item){ - if(item.shopMakeTime == null){ - return '商家还未出餐'; - } - const date1 = new Date(item.deliveryInfo.acceptTime); - const date2 = new Date(item.shopMakeTime); - - // 2. 计算毫秒差值 (取绝对值,防止结果为负数) - let diffMs = Math.abs(date2 - date1); - - // 3. 数学换算 - // 1秒 = 1000毫秒 - // 1分 = 60秒 - // 1时 = 60分 - const seconds = Math.floor((diffMs / 1000) % 60); - const minutes = Math.floor((diffMs / (1000 * 60)) % 60); - const hours = Math.floor(diffMs / (1000 * 60 * 60)); - - // 4. 格式化输出 (可选:补零操作,例如 9秒 -> 09秒) - const fmt = (num) => num.toString().padStart(2, '0'); - - return `${fmt(hours)}时${fmt(minutes)}分${fmt(seconds)}秒`; - }, - peisongTime(item){ - if(item.shopMakeTime == null){ - return '商家还未出餐'; - } - const date1 = new Date(item.shopMakeTime); - const date2 = new Date(); - - // 2. 计算毫秒差值 (取绝对值,防止结果为负数) - let diffMs = Math.abs(date2 - date1); - - // 3. 数学换算 - // 1秒 = 1000毫秒 - // 1分 = 60秒 - // 1时 = 60分 - const seconds = Math.floor((diffMs / 1000) % 60); - const minutes = Math.floor((diffMs / (1000 * 60)) % 60); - const hours = Math.floor(diffMs / (1000 * 60 * 60)); - - // 4. 格式化输出 (可选:补零操作,例如 9秒 -> 09秒) - const fmt = (num) => num.toString().padStart(2, '0'); - - return `${fmt(hours)}时${fmt(minutes)}分${fmt(seconds)}秒`; } }, onLoad(option) { @@ -404,6 +388,22 @@ this.searchForm.pageNum = 1 this.getOrderList() }, + checkSellTime(type){ + this.sellTime = type; + if(this.sellTime == 2){ + //this.returnData.refundAmount = this.orderDetail.totalAmount + this.refundType = 3 + this.refundTypeStatus = 1 + }else if(this.sellTime == 3){ + //this.returnData.refundAmount = this.orderDetail.totalAmount + this.refundType = 3 + this.refundTypeStatus = 2 + }else{ + //this.returnData.refundAmount = this.orderDetail.totalAmount + this.refundType = 3 + this.refundTypeStatus = 3 + } + }, goSearch(){ this.searchForm.pageNum = 1 this.getOrderList() @@ -417,7 +417,7 @@ this.tui.request("/api/wechat/pay/unified-order", "POST", { openid: uni.getStorageSync('miniProgramOpenid') || 'test-openid', amount: amountInCents, - description: '拼团参与订单', + description: '商城订单', outTradeNo: this.payData.id }, false, false).then((res) => { if (res.code == 200) { @@ -493,14 +493,49 @@ }).catch((res) => {}); }, returnPopupProp(item){ - this.payData = item; - this.$refs.returnPopup.open('bottom'); + this.payData = item; + if(this.payData.shopMakeTime != null){ + const date1 = new Date(this.payData.deliveryInfo.acceptTime); + const date2 = new Date(this.payData.shopMakeTime); + + // 2. 计算毫秒差值 (取绝对值,防止结果为负数) + let diffMs = Math.abs(date2 - date1); + + // 3. 数学换算 + // 1秒 = 1000毫秒 + // 1分 = 60秒 + // 1时 = 60分 + const seconds = Math.floor((diffMs / 1000) % 60); + const minutes = Math.floor((diffMs / (1000 * 60)) % 60); + const hours = Math.floor(diffMs / (1000 * 60 * 60)); + + // 4. 格式化输出 (可选:补零操作,例如 9秒 -> 09秒) + const fmt = (num) => num.toString().padStart(2, '0'); + + this.shopTime = `${fmt(hours)}时${fmt(minutes)}分${fmt(seconds)}秒`; + + const date3 = new Date(); + + // 2. 计算毫秒差值 (取绝对值,防止结果为负数) + let diffMs1 = Math.abs(date3 - date2); + + // 3. 数学换算 + // 1秒 = 1000毫秒 + // 1分 = 60秒 + // 1时 = 60分 + const seconds1 = Math.floor((diffMs1 / 1000) % 60); + const minutes1 = Math.floor((diffMs1 / (1000 * 60)) % 60); + const hours1 = Math.floor(diffMs1 / (1000 * 60 * 60)); + + this.peisongTime = `${fmt(hours1)}时${fmt(minutes1)}分${fmt(seconds1)}秒`; + } + this.$refs.returnPopup.open('bottom'); }, returnOrder(){ this.$refs.returnPopup.close(); let item = this.payData let that = this - that.tui.request("/mall/order/cancel", "POST", {orderId:item.id,userId:uni.getStorageSync('id')}, false, true).then((res) => { + that.tui.request("/mall/order/cancel", "POST", {refundType:this.refundType,refundTypeStatus:this.refundTypeStatus,orderId:item.id,userId:uni.getStorageSync('id')}, false, true).then((res) => { if (res.code == 200) { that.tui.toast("取消订单成功"); that.searchForm.pageNum = 1 diff --git a/package1/order/returnOrder.vue b/package1/order/returnOrder.vue index 16aeab0..0a4c2dd 100644 --- a/package1/order/returnOrder.vue +++ b/package1/order/returnOrder.vue @@ -411,14 +411,17 @@ this.returnData.orderId = this.orderDetail.id this.returnData.userId = this.orderDetail.userId this.returnData.shopId = this.orderDetail.shopId + + this.returnData.goodsAmount = this.orderDetail.goodsAmount + this.returnData.packageFee = this.orderDetail.packageFee if(this.orderDetail.deliveryInfo){ this.returnData.workerId = this.orderDetail.deliveryInfo.workerId + this.returnData.deliveryFee = this.orderDetail.deliveryFee } this.returnData.items = []; for(let i = 0; i< this.orderDetail.goodsList.length;i++){ if(this.orderDetail.goodsList[i].returnCount){ this.orderDetail.goodsList[i].quantity = this.orderDetail.goodsList[i].returnCount - console.log(this.orderDetail.goodsList[i]) this.orderDetail.goodsList[i].price = Number(this.orderDetail.goodsList[i].price) + Number(this.orderDetail.goodsList[i].packageFee) this.returnData.items.push(this.orderDetail.goodsList[i]) }