From 2efe5ab21829bcc21b9eadacb8f8d5c9895bf3f3 Mon Sep 17 00:00:00 2001 From: tianyi <13521030702@163.com> Date: Wed, 20 May 2026 14:51:39 +0800 Subject: [PATCH] 1 --- pages/shop/orderDetail.vue | 59 +++++++++++++++++++++++++++++--------- 1 file changed, 45 insertions(+), 14 deletions(-) diff --git a/pages/shop/orderDetail.vue b/pages/shop/orderDetail.vue index f34c57f..dd41eba 100644 --- a/pages/shop/orderDetail.vue +++ b/pages/shop/orderDetail.vue @@ -13,9 +13,9 @@ - {{'#'+data.numberCode}} - 期望送达 - 明天 06:30 + {{'#'+data.numberCode}} + 期望送达 + {{formattedMustFinishTime}} {{data.status == 0?'待支付':data.status == 2?'待配送员接单':(data.status == 3 && data.deliveryType == 1 && data.shopMakeTime == null) || (data.status == 3 && data.deliveryType == 2 && data.userRequireMake == 1)?'待出餐':(data.status == 3 && data.deliveryType == 1 && data.shopMakeTime != null)?'待取货':(data.status == 3 && data.deliveryType == 2)?'待消费':data.status == 4?'待送达':data.status == 5?'已完成':data.status == 7?'待同意退款':data.status == 8?'已退款':data.status == 6?'已取消':data.status == 11?'售后中':data.status == 12?'已售后':""}} @@ -91,7 +91,7 @@ 平台服务费 - ¥{{(data.chouyong).toFixed(2)}} + ¥{{data.chouyong ?data.chouyong:0}} @@ -155,11 +155,11 @@ - {{data.groupInfo.targetMembers}}人团/已拼{{data.groupInfo.currentMembers}}人 + {{data.groupInfo?data.groupInfo.targetMembers:0}}人团/已拼{{data.groupInfo?data.groupInfo.currentMembers:0}}人 - + @@ -171,7 +171,7 @@ - + + @@ -211,6 +211,38 @@ this.shopId = option.id this.getDetail() }, + computed: { + // 计算属性:格式化后的完成时间 + formattedMustFinishTime() { + // 1. 安全判断:deliveryInfo 存在且有 mustFinishTime 字段 + const deliveryInfo = this.data.deliveryInfo; + if (!deliveryInfo || !deliveryInfo.mustFinishTime) { + return ''; + } + + // 2. 获取原始时间字符串 (例如: "2026-05-19T17:40:11.000+08:00") + let rawTime = deliveryInfo.mustFinishTime; + + // 3. 关键:安卓对 ISO 日期中的 "-" 解析可能不兼容,先替换为 "/" + // 同时处理可能的时区后缀,直接截取前19个字符(标准格式 "YYYY-MM-DDTHH:mm:ss") + rawTime = rawTime.replace(/-/g, '/'); + // 去掉时区部分,仅保留 "YYYY/MM/DD HH:mm:ss" 格式 + rawTime = rawTime.replace('T', ' ').split('.')[0]; + + // 4. 解析为 Date 对象 + const date = new Date(Date.parse(rawTime)); + + // 5. 格式化输出,例如 "2026-05-19 17:40:11" + const year = date.getFullYear(); + const month = (date.getMonth() + 1).toString().padStart(2, '0'); + const day = date.getDate().toString().padStart(2, '0'); + const hours = date.getHours().toString().padStart(2, '0'); + const minutes = date.getMinutes().toString().padStart(2, '0'); + const seconds = date.getSeconds().toString().padStart(2, '0'); + + return `${year}-${month}-${day} ${hours}:${minutes}:${seconds}`; + } + }, methods: { getDetail(){ let that = this @@ -218,19 +250,18 @@ if (res.code == 200) { that.data = res.result - //商家预计收入的计算 + //商家预计收入的计算1 let price = that.data.goodsAmount+that.data.packageFee if(that.data.orderType == 1){ - that.data.chouyong = price/100 * uni.getStorageSync('shopTakeaway').commissionRateOne - that.data.yujishouru = price - that.data.chouyong + that.data.chouyong = (price/100 * uni.getStorageSync('shopTakeaway').commissionRateOne).toFixed(2) + that.data.yujishouru = (price - that.data.chouyong).toFixed(2) }else{ - that.data.chouyong = price/100 * uni.getStorageSync('shopTakeaway').commissionRateMore - that.data.yujishouru = price - that.data.chouyong + that.data.chouyong = (price/100 * uni.getStorageSync('shopTakeaway').commissionRateMore).toFixed(2) + that.data.yujishouru = (price - that.data.chouyong).toFixed(2) } - if(that.data.groupInfo != null){ + if(that.data.groupInfo != null && that.data.groupInfo != undefined){ that.data.groupInfo.groupIdList = that.data.groupInfo.groupOrderIds.split(','); } - that.data.goodsNum = 0 for(let m=0;m