Browse Source

refactor(订单管理): 优化订单详情页和列表页的显示逻辑

- 简化日期格式化逻辑,统一使用 `MM-DD` 格式
- 修复订单详情页金额和分成比例的显示问题
- 添加文本溢出处理样式,提升用户体验
master
前端-胡立永 1 month ago
parent
commit
6880c8f45e
4 changed files with 102 additions and 30 deletions
  1. +83
    -19
      otherPages/orderTakingManage/detail/index.vue
  2. +8
    -2
      pages/orderTakingManage/components/list.vue
  3. +10
    -8
      pages/orderTakingManage/index.vue
  4. +1
    -1
      utils/getUrl.js

+ 83
- 19
otherPages/orderTakingManage/detail/index.vue View File

@ -6,29 +6,31 @@
<view> <view>
本单客户支付金额 本单客户支付金额
<view class="vertically_center text1"> <view class="vertically_center text1">
¥ 45
¥ {{ orderDetail.order?.h5OrderVO?.payAmount }}
</view> </view>
</view> </view>
X X
<view> <view>
您的分成比例 您的分成比例
<view class="vertically_center text1"> <view class="vertically_center text1">
20%
<!-- 20% -->
{{ orderDetail.pet_payment_bcs[userInfo.userBcsRole - 1].paramValueText }}
</view> </view>
</view> </view>
= =
<view> <view>
本单酬劳 本单酬劳
<view class="vertically_center text1"> <view class="vertically_center text1">
¥ 9
¥ {{ orderDetail.pet_payment_bcs[userInfo.userBcsRole - 1].paramValueNo * orderDetail.order?.h5OrderVO?.payAmount }}
</view> </view>
</view> </view>
</view> </view>
<view class="top_bottom"> <view class="top_bottom">
订单为系统派发请确认订单信息后再抢单
<!-- 订单为系统派发请确认订单信息后再抢单 -->
{{ typeInfo[orderDetail.order.type].content }}
</view> </view>
<view class="top-button" :style="{ borderRadius: '27rpx' }"> <view class="top-button" :style="{ borderRadius: '27rpx' }">
系统派单
{{ typeInfo[orderDetail.order.type].title }}
</view> </view>
</view> </view>
<view class="information box-size" :style="{ borderRadius: '16rpx' }"> <view class="information box-size" :style="{ borderRadius: '16rpx' }">
@ -41,8 +43,8 @@
<view> <view>
服务日期 服务日期
</view> </view>
<view >
12-012-08
<view v-if="orderDetail.order">
{{ getTextList() }}
</view> </view>
</view> </view>
<view class="line1"> <view class="line1">
@ -68,31 +70,31 @@
</view> </view>
<view class="line1"> <view class="line1">
</view> </view>
<view v-for="pet in orderDetail.petList" :key="pet.id" class="pet_information box-size">
<view v-for="pet in orderDetail.order.h5OrderVO.petVOList" :key="pet.id" class="pet_information box-size">
<view class="flex pet_item box-size"> <view class="flex pet_item box-size">
<view class="img" :style="{borderRadius:'100rpx'}"> <view class="img" :style="{borderRadius:'100rpx'}">
<image :src="pet.headImage" mode=""></image>
<image :src="pet.photo" mode=""></image>
</view> </view>
<view > <view >
<view class="flex name"> <view class="flex name">
<view class="name_text"> <view class="name_text">
{{ pet.nickName }}
{{ pet.breed }}
</view> </view>
<image src="" mode=""></image> <image src="" mode=""></image>
</view> </view>
{{ pet.type }}
{{ pet.type }}{{ pet.bodyType }}
</view> </view>
</view> </view>
<view class="pet- level">
12-14
<text>专业喂养</text>
<view class="pet-level" v-for="(it, i) in pet.productNameText">
{{ it.time }}
<text>{{ it.name }}</text>
上门1次 上门1次
</view> </view>
<view class="pet- level">
<!-- <view class="pet-level">
12-15 12-15
<text>专业喂养</text> <text>专业喂养</text>
上门1次 上门1次
</view>
</view> -->
</view> </view>
<view class="line1"> <view class="line1">
</view> </view>
@ -101,7 +103,7 @@
合计 合计
</view> </view>
<view class="money_text"> <view class="money_text">
¥&nbsp;{{ orderDetail.order?.price }}
¥&nbsp;{{ orderDetail.order?.payAmount }}
</view> </view>
</view> </view>
</view> </view>
@ -116,7 +118,7 @@
订单编号 订单编号
</view> </view>
<view> <view>
fe34521532513256
{{ orderDetail.order.id }}
</view> </view>
</view> </view>
<view class="line1"> <view class="line1">
@ -263,6 +265,8 @@
import { import {
useStore useStore
} from "vuex" } from "vuex"
import dayjs from "dayjs";
onLoad((options) => { onLoad((options) => {
orderId.value = options.id || null; orderId.value = options.id || null;
@ -289,6 +293,21 @@
const rushToBuyAnOrder = () => { const rushToBuyAnOrder = () => {
open() open()
} }
const typeInfo = [
{
title : '系统派单',
content : '订单为系统派发,请确认订单信息后再抢单',
},
{
title : '个人订单',
content : '订单为系统派发,请确认订单信息后再抢单',
},
{
title : '流失订单',
content : '订单为系统派发,请确认订单信息后再抢单',
},
]
// //
const petInfo = () => { const petInfo = () => {
@ -334,13 +353,58 @@
}); });
if (response.code == 200 && response.data) { if (response.code == 200 && response.data) {
orderDetail.value = 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(',')
}
</script> </script>
<style scoped lang="scss"> <style scoped lang="scss">
@import "index"; @import "index";
.line1 { .line1 {
position: relative; position: relative;
margin: 10rpx 0 20rpx 0; margin: 10rpx 0 20rpx 0;


+ 8
- 2
pages/orderTakingManage/components/list.vue View File

@ -15,7 +15,7 @@
<up-image style="flex-shrink:0" class="mr20" width="70px" height="70px" :src="pet.photo" <up-image style="flex-shrink:0" class="mr20" width="70px" height="70px" :src="pet.photo"
shape="circle"></up-image> shape="circle"></up-image>
<view> <view>
<view class="font28 col3">服务天数: {{ pet.orderServiceText.length }} I {{ pet.orderServiceText.join(',') }}</view>
<view class="font28 col3 text-ellipsis">服务天数: {{ pet.orderServiceText.length }} I {{ pet.orderServiceText.join('') }}</view>
<!-- <view class="font28 col3">服务天数: {{ item.h5OrderVO.orderServiceList.length }} I <!-- <view class="font28 col3">服务天数: {{ item.h5OrderVO.orderServiceList.length }} I
<text v-for="itemService in item.h5OrderVO.orderServiceList" :key="itemService.id"> <text v-for="itemService in item.h5OrderVO.orderServiceList" :key="itemService.id">
@ -25,7 +25,7 @@
</view> --> </view> -->
<!-- <view style="margin: 18rpx 0">期望上门时间{{itemService.expectServiceTime}}</view> --> <!-- <view style="margin: 18rpx 0">期望上门时间{{itemService.expectServiceTime}}</view> -->
<view>{{ pet.breed }} | {{ pet.productNameText.join(',') }}
<view class="text-ellipsis">{{ pet.breed }}{{ pet.bodyType }} | {{ pet.productNameText.join('') }}
<!-- <text v-for="itemPet in item.h5OrderVO.orderItemList" :key="itemPet.id"> <!-- <text v-for="itemPet in item.h5OrderVO.orderItemList" :key="itemPet.id">
{{ itemPet.productName }} {{ itemPet.productName }}
@ -168,4 +168,10 @@ const noneOrder = async () => {
text-align: center; text-align: center;
padding: 25rpx 0rpx; padding: 25rpx 0rpx;
} }
.text-ellipsis{
overflow:hidden;
white-space: nowrap;
text-overflow: ellipsis;
-o-text-overflow:ellipsis;
}
</style> </style>

+ 10
- 8
pages/orderTakingManage/index.vue View File

@ -79,6 +79,8 @@ import dayjs from "dayjs";
if (response.code == 200 && response.data) { if (response.code == 200 && response.data) {
orderlist.value = response.data.rows; orderlist.value = response.data.rows;
list[current.value].badge.value = response.data.total
orderlist.value.forEach(item => { orderlist.value.forEach(item => {
item.h5OrderVO.petVOList.forEach(pet => { item.h5OrderVO.petVOList.forEach(pet => {
pet.orderServiceText = getOrderServiceText(pet.id, item.h5OrderVO.orderServiceList) pet.orderServiceText = getOrderServiceText(pet.id, item.h5OrderVO.orderServiceList)
@ -97,14 +99,14 @@ import dayjs from "dayjs";
.map(service => dayjs(service.serviceDate))// .map(service => dayjs(service.serviceDate))//
.sort((a, b) => a.valueOf() - b.valueOf())// .sort((a, b) => a.valueOf() - b.valueOf())//
.map((service, i) => { .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){ function getProductNameText(petId, productList, orderServiceList){


+ 1
- 1
utils/getUrl.js View File

@ -3,7 +3,7 @@ const accountInfo = wx.getAccountInfoSync();
current = accountInfo.miniProgram.envVersion; current = accountInfo.miniProgram.envVersion;
const api = { const api = {
develop:"http://h5.xzaiyp.top/prod-api",
develop:"http://h5.xzaiyp.top",
// develop: "http://youyi-test.natapp1.cc/prod-api", // 开发 // develop: "http://youyi-test.natapp1.cc/prod-api", // 开发
trial: "https://pet-admin.hhlm1688.com/prod-api", //测试 trial: "https://pet-admin.hhlm1688.com/prod-api", //测试
release: "https://pet-admin.hhlm1688.com/api/prod-api", // 线上 release: "https://pet-admin.hhlm1688.com/api/prod-api", // 线上


Loading…
Cancel
Save