From b3d74ff76b93af75831a6b1040588479d50a0a44 Mon Sep 17 00:00:00 2001 From: hly <2783385703@qq.com> Date: Tue, 12 Aug 2025 14:36:47 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E5=AE=9E=E7=8E=B0=E8=AE=A2=E5=8D=95?= =?UTF-8?q?=E7=8A=B6=E6=80=81=E7=BB=9F=E4=B8=80=E7=AE=A1=E7=90=86=E5=8F=8A?= =?UTF-8?q?=E6=94=AF=E4=BB=98=E7=B1=BB=E5=9E=8B=E6=98=BE=E7=A4=BA=E4=BC=98?= =?UTF-8?q?=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 重构订单状态显示逻辑,将分散在各组件的状态文本和步骤列表提取到公共工具类中 优化支付类型显示,统一为"先付后试用"和"先试用后支付"两种表述 添加对不同支付类型下订单状态流程的支持 --- components/order-status/index.vue | 41 ++++++----- pages/order/component/enterprise.vue | 8 +- pages/order/component/master.vue | 7 +- pages_subpack/hire/order-list.vue | 21 ++---- pages_subpack/job-hunt/order-list.vue | 22 ++---- pages_subpack/job-order-detail/index.vue | 71 +++++++++++++++++- pages_subpack/master-detail/index.vue | 4 +- pages_subpack/order-detail/boss.vue | 82 +++++++++++++++++++-- pages_subpack/order-detail/index.vue | 38 +++++++++- pages_subpack/work-detail/index.vue | 5 +- utils/statusText.js | 122 +++++++++++++++++++++++++++++++ 11 files changed, 357 insertions(+), 64 deletions(-) create mode 100644 utils/statusText.js diff --git a/components/order-status/index.vue b/components/order-status/index.vue index 3cb80cc..45face0 100644 --- a/components/order-status/index.vue +++ b/components/order-status/index.vue @@ -10,16 +10,17 @@ - {{ statusText }} + {{ statusText() }} - + - + @@ -40,17 +41,19 @@ pageType: { type: String, default: 'job-order' // 'job-order' 或 'order' - } + }, }, computed: { - stepsIndex() { + }, + methods: { + getStepsIndex() { return this.orderData.status || 0; }, statusText() { const statusTextMap = { '0' : {//先付后用 'job-order': { - 0: '等待师傅确认',//师傅操作 + 0: '待待师傅确认',//师傅操作 1: '企业待支付',//企业操作 2: '订单进行中',//师傅操作 3: '试工完成',//企业操作 @@ -59,8 +62,8 @@ 6: '订单已取消' }, default: { - 0: '等待企业确认并支付',//企业操作 - 1: '',//暂无 + 0: '等待企业确认',//企业操作 + 1: '企业待支付',//暂无 2: '订单进行中',//师傅操作 3: '试工完成',//企业操作 4: '',//暂无 @@ -92,7 +95,7 @@ let i = this.orderData ? this.orderData.payType : '1'; let statusTextMapItem = statusTextMap[i] || statusTextMap[1]; const pageTypeMap = statusTextMapItem[this.pageType] || statusTextMapItem.default; - return pageTypeMap[this.stepsIndex] || '未知状态'; + return pageTypeMap[this.getStepsIndex()] || '未知状态'; }, statusImage() { const statusImageMap = { @@ -104,25 +107,26 @@ 5: '/static/images/order/46525.png', 6: '/static/images/order/46525.png' }; - return statusImageMap[this.stepsIndex] || '/static/images/order/46524.png'; + return statusImageMap[this.getStepsIndex()] || '/static/images/order/46524.png'; }, stepsList() { const stepsListMap = { 0 : {//先付后用 'job-order': [ { title: "师傅确认", date: "" }, + { title: "企业支付", date: "" }, { title: "进行", date: "" }, { title: "试工完成", date: "" }, - { title: "企业支付", date: "" }, + // { title: "企业确认", date: "" }, { title: "订单完成", date: "" } ], default: [ { title: "接单", date: "" }, + { title: "企业支付", date: "" }, { title: "进行", date: "" }, { title: "试工完成", date: "" }, - { title: "企业确认", date: "" }, - { title: "企业支付", date: "" }, - { title: "企业完成", date: "" } + // { title: "企业确认", date: "" }, + { title: "订单完成", date: "" } ] }, 1 : {//试用以后支付 @@ -130,6 +134,7 @@ { title: "师傅确认", date: "" }, { title: "进行", date: "" }, { title: "试工完成", date: "" }, + { title: "企业确认", date: "" }, { title: "企业支付", date: "" }, { title: "订单完成", date: "" } ], @@ -139,15 +144,15 @@ { title: "试工完成", date: "" }, { title: "企业确认", date: "" }, { title: "企业支付", date: "" }, - { title: "企业完成", date: "" } + { title: "订单完成", date: "" } ] }, }; let i = this.orderData ? this.orderData.payType : '1'; let stepsListMapItem = stepsListMap[i] || stepsListMap[1]; return stepsListMapItem[this.pageType] || stepsListMapItem.default; - } - } + }, + } } diff --git a/pages/order/component/enterprise.vue b/pages/order/component/enterprise.vue index 535c0c4..3348464 100644 --- a/pages/order/component/enterprise.vue +++ b/pages/order/component/enterprise.vue @@ -19,7 +19,7 @@ - {{items.status_dictText}} + {{ getStatusText(items) }} @@ -57,6 +57,10 @@ import { bossOrderList } from "@/common/api.js" + import { + getStatusText + } from "@/utils/statusText.js" + export default { components: { @@ -107,6 +111,8 @@ this.onOrder(); }, methods: { + getStatusText, + onReach() { this.pageNo = this.pageNo + 1 this.onOrder() diff --git a/pages/order/component/master.vue b/pages/order/component/master.vue index 9cfa7bd..3ac4171 100644 --- a/pages/order/component/master.vue +++ b/pages/order/component/master.vue @@ -21,7 +21,7 @@ - {{ item.status_dictText }} + {{ getStatusText(item) }} @@ -59,6 +59,10 @@ import { bossOrderList } from "@/common/api.js" + import { + getStatusText + } from "@/utils/statusText.js" + export default { components: { @@ -110,6 +114,7 @@ this.onOrder() }, methods: { + getStatusText, onReach() { this.pageNo = this.pageNo + 1 this.onOrder() diff --git a/pages_subpack/hire/order-list.vue b/pages_subpack/hire/order-list.vue index f5b946c..224051e 100644 --- a/pages_subpack/hire/order-list.vue +++ b/pages_subpack/hire/order-list.vue @@ -41,7 +41,7 @@ - {{getStatusText(item.status)}} + {{ getStatusText(item) }} @@ -67,7 +67,10 @@ import { getTaskById } from "@/common/api.js" - + import { + getStatusText + } from "@/utils/statusText.js" + export default { data() { return { @@ -128,6 +131,8 @@ this.getJobDetail(); }, methods: { + getStatusText, + getJobDetail() { getTaskById({ id: this.jobId }).then(response => { if (response.success) { @@ -151,18 +156,6 @@ }); }); }, - getStatusText(status) { - const statusMap = { - 0: '待聘用', - 1: '进行中', - 2: '试工完成', - 3: '企业确认', - 4: '已支付', - 5: '已完成', - 6: '已取消' - }; - return statusMap[status] || '未知状态'; - }, onOrderDetail(order) { uni.navigateTo({ url: `/pages_subpack/order-detail/boss?orderId=${order.id}&type=true` diff --git a/pages_subpack/job-hunt/order-list.vue b/pages_subpack/job-hunt/order-list.vue index 9f03289..a62a7c1 100644 --- a/pages_subpack/job-hunt/order-list.vue +++ b/pages_subpack/job-hunt/order-list.vue @@ -47,7 +47,8 @@ - {{getStatusText(item.status)}} + {{ getStatusText(item) }} + @@ -84,7 +85,10 @@ import { querySeekById } from "@/common/api.js" - + import { + getStatusText + } from "@/utils/statusText.js" + export default { data() { return { @@ -145,6 +149,8 @@ this.getSeekDetail(); }, methods: { + getStatusText, + getSeekDetail() { querySeekById({ id: this.seekId }).then(response => { if (response.success) { @@ -168,18 +174,6 @@ }); }); }, - getStatusText(status) { - const statusMap = { - 0: '待确认', - 1: '进行中', - 2: '试工完成', - 3: '企业确认', - 4: '已支付', - 5: '已完成', - 6: '已取消' - }; - return statusMap[status] || '未知状态'; - }, onOrderDetail(order) { uni.navigateTo({ url: `/pages_subpack/job-order-detail/index?orderId=${order.id}&type=true` diff --git a/pages_subpack/job-order-detail/index.vue b/pages_subpack/job-order-detail/index.vue index e300cb6..baabad6 100644 --- a/pages_subpack/job-order-detail/index.vue +++ b/pages_subpack/job-order-detail/index.vue @@ -1,11 +1,74 @@