From 6880c8f45e5c7cd33ea231b539256bfb436adba0 Mon Sep 17 00:00:00 2001 From: huliyong <2783385703@qq.com> Date: Tue, 15 Apr 2025 00:26:33 +0800 Subject: [PATCH] =?UTF-8?q?refactor(=E8=AE=A2=E5=8D=95=E7=AE=A1=E7=90=86):?= =?UTF-8?q?=20=E4=BC=98=E5=8C=96=E8=AE=A2=E5=8D=95=E8=AF=A6=E6=83=85?= =?UTF-8?q?=E9=A1=B5=E5=92=8C=E5=88=97=E8=A1=A8=E9=A1=B5=E7=9A=84=E6=98=BE?= =?UTF-8?q?=E7=A4=BA=E9=80=BB=E8=BE=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 简化日期格式化逻辑,统一使用 `MM-DD` 格式 - 修复订单详情页金额和分成比例的显示问题 - 添加文本溢出处理样式,提升用户体验 --- otherPages/orderTakingManage/detail/index.vue | 102 +++++++++++++++++++++----- pages/orderTakingManage/components/list.vue | 10 ++- pages/orderTakingManage/index.vue | 18 +++-- utils/getUrl.js | 2 +- 4 files changed, 102 insertions(+), 30 deletions(-) diff --git a/otherPages/orderTakingManage/detail/index.vue b/otherPages/orderTakingManage/detail/index.vue index 998b71a..23ad55d 100644 --- a/otherPages/orderTakingManage/detail/index.vue +++ b/otherPages/orderTakingManage/detail/index.vue @@ -6,29 +6,31 @@ 本单客户支付金额 - ¥ 45 + ¥ {{ orderDetail.order?.h5OrderVO?.payAmount }} X 您的分成比例 - 20% + + {{ orderDetail.pet_payment_bcs[userInfo.userBcsRole - 1].paramValueText }} = 本单酬劳 - ¥ 9 + ¥ {{ orderDetail.pet_payment_bcs[userInfo.userBcsRole - 1].paramValueNo * orderDetail.order?.h5OrderVO?.payAmount }} - 订单为系统派发,请确认订单信息后再抢单 + + {{ typeInfo[orderDetail.order.type].content }} - 系统派单 + {{ typeInfo[orderDetail.order.type].title }} @@ -41,8 +43,8 @@ 服务日期 - - 12-0,12-08 + + {{ getTextList() }} @@ -68,31 +70,31 @@ - + - + - {{ pet.nickName }} + {{ pet.breed }} - {{ pet.type }} + {{ pet.type }}{{ pet.bodyType }} - - 12-14 - 专业喂养 + + {{ it.time }} + {{ it.name }} 上门1次 - + @@ -101,7 +103,7 @@ 合计 - ¥ {{ orderDetail.order?.price }} + ¥ {{ orderDetail.order?.payAmount }} @@ -116,7 +118,7 @@ 订单编号: - fe34521532513256 + {{ orderDetail.order.id }} @@ -263,6 +265,8 @@ import { useStore } from "vuex" + + import dayjs from "dayjs"; onLoad((options) => { orderId.value = options.id || null; @@ -289,6 +293,21 @@ const rushToBuyAnOrder = () => { open() } + + const typeInfo = [ + { + title : '系统派单', + content : '订单为系统派发,请确认订单信息后再抢单', + }, + { + title : '个人订单', + content : '订单为系统派发,请确认订单信息后再抢单', + }, + { + title : '流失订单', + content : '订单为系统派发,请确认订单信息后再抢单', + }, + ] // 查看宠物信息 const petInfo = () => { @@ -334,13 +353,58 @@ }); if (response.code == 200 && response.data) { orderDetail.value = response.data; + orderDetail.value.order.h5OrderVO.petVOList.forEach(pet => { + + pet.productNameText = getProductNameText(pet.id, orderDetail.value.order.h5OrderVO.orderItemList, + orderDetail.value.order.h5OrderVO.orderServiceList) + }) } } + + function getOrderServiceText(petId, orderServiceList){ + + let YYYY = undefined + + return orderServiceList + .filter(service => service.petId == petId)//过滤 + .map(service => dayjs(service.serviceDate))//转成时间 + .sort((a, b) => a.valueOf() - b.valueOf())//排序 + .map((service, i) => { + // if(YYYY && YYYY.format('YYYY-MM') == service.format('YYYY-MM')){ + // return service.format('DD') + // } + // if(YYYY && YYYY.format('YYYY') == service.format('YYYY')){ + // return service.format('MM-DD') + // } + // YYYY = service + return service.format('MM-DD') + }) + } + function getProductNameText(petId, productList, orderServiceList){ + + let orderService = orderServiceList.filter(service => service.petId == petId) + + return productList + .filter(product => orderService.filter(service => service.id == product.orderServiceId).length > 0) + .map(product => { + return { + time : dayjs(orderService.filter(service => service.id == product.orderServiceId) + .serviceDate).format('MM-DD'), + name : product.productName, + } + }) + } + + function getTextList(){ + return orderDetail.value.order?.h5OrderVO + .orderServiceList.map(item => + dayjs(item.serviceDate).format('MM-DD')).join(',') + } \ No newline at end of file diff --git a/pages/orderTakingManage/index.vue b/pages/orderTakingManage/index.vue index cc1aee8..72620f3 100644 --- a/pages/orderTakingManage/index.vue +++ b/pages/orderTakingManage/index.vue @@ -79,6 +79,8 @@ import dayjs from "dayjs"; if (response.code == 200 && response.data) { orderlist.value = response.data.rows; + list[current.value].badge.value = response.data.total + orderlist.value.forEach(item => { item.h5OrderVO.petVOList.forEach(pet => { pet.orderServiceText = getOrderServiceText(pet.id, item.h5OrderVO.orderServiceList) @@ -97,14 +99,14 @@ import dayjs from "dayjs"; .map(service => dayjs(service.serviceDate))//转成时间 .sort((a, b) => a.valueOf() - b.valueOf())//排序 .map((service, i) => { - if(YYYY && YYYY.format('YYYY-MM') == service.format('YYYY-MM')){ - return service.format('DD') - } - if(YYYY && YYYY.format('YYYY') == service.format('YYYY')){ - return service.format('MM-DD') - } - YYYY = service - return service.format('YYYY-MM-DD') + // if(YYYY && YYYY.format('YYYY-MM') == service.format('YYYY-MM')){ + // return service.format('DD') + // } + // if(YYYY && YYYY.format('YYYY') == service.format('YYYY')){ + // return service.format('MM-DD') + // } + // YYYY = service + return service.format('MM-DD') }) } function getProductNameText(petId, productList, orderServiceList){ diff --git a/utils/getUrl.js b/utils/getUrl.js index 7932bbd..06456b1 100644 --- a/utils/getUrl.js +++ b/utils/getUrl.js @@ -3,7 +3,7 @@ const accountInfo = wx.getAccountInfoSync(); current = accountInfo.miniProgram.envVersion; const api = { - develop:"http://h5.xzaiyp.top/prod-api", + develop:"http://h5.xzaiyp.top", // develop: "http://youyi-test.natapp1.cc/prod-api", // 开发 trial: "https://pet-admin.hhlm1688.com/prod-api", //测试 release: "https://pet-admin.hhlm1688.com/api/prod-api", // 线上