From 2d6cfdf53bd58b60f9ddf2f06e6a9f9022caf814 Mon Sep 17 00:00:00 2001 From: YunaiV Date: Thu, 14 Dec 2023 19:44:01 +0800 Subject: [PATCH] =?UTF-8?q?=E2=9C=A8=20=E5=94=AE=E5=90=8E=E5=88=97?= =?UTF-8?q?=E8=A1=A8=E3=80=81=E8=AF=A6=E6=83=85=EF=BC=9A=E5=AE=8C=E6=88=90?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pages/order/aftersale/detail.vue | 190 +++--- pages/order/aftersale/list.vue | 165 ++---- pages/order/detail.vue | 976 ++++++++++++++++--------------- sheep/api/order.js | 18 +- sheep/api/trade/afterSale.js | 20 + sheep/hooks/useGoods.js | 81 +++ 6 files changed, 766 insertions(+), 684 deletions(-) diff --git a/pages/order/aftersale/detail.vue b/pages/order/aftersale/detail.vue index ddd8269c..775e4e45 100644 --- a/pages/order/aftersale/detail.vue +++ b/pages/order/aftersale/detail.vue @@ -3,26 +3,22 @@ - - - + + :class="state.active >= index ? 'activity-color' : 'info-color'" /> - + {{ item.title }} @@ -32,28 +28,33 @@ - + + 退款总额 - ¥{{ state.info.refundPrice/100 }} + ¥{{ fen2yuan(state.info.refundPrice) }} - - + @@ -71,7 +72,7 @@ 售后类型: - {{ status2[state.info.way] }} + {{ state.info.way === 10 ? '仅退款' : '退款退货' }} 申请原因: @@ -83,114 +84,97 @@ + + - + + - --> + diff --git a/pages/order/aftersale/list.vue b/pages/order/aftersale/list.vue index 4cf824b0..1201386b 100644 --- a/pages/order/aftersale/list.vue +++ b/pages/order/aftersale/list.vue @@ -3,92 +3,73 @@ - + - - + - 服务单号:{{ order.no }} - {{ status[order.status] }} + {{ formatAfterSaleStatus(order) }} - + - - {{ status2[order.way] }} - - {{ order.applyReason }} + {{ order.way === 10 ? '仅退款' : '退款退货' }} + {{ formatAfterSaleStatusDescription(order) }} - + v-if="order?.buttons.includes('cancel')">取消申请 - - - - --> + + }" @tap="loadMore" /> diff --git a/pages/order/detail.vue b/pages/order/detail.vue index bded7924..ee179ec4 100644 --- a/pages/order/detail.vue +++ b/pages/order/detail.vue @@ -1,568 +1,626 @@ + + + + + - - - - - - 订单编号: - {{ state.orderInfo.no }} - - - - - 下单时间: - + + + + + + 订单编号: + {{ state.orderInfo.no }} + + + + + 下单时间: + {{ sheep.$helper.timeFormat(state.orderInfo.createTime, 'yyyy-mm-dd hh:MM:ss') }} - - - 支付时间: - + + + 支付时间: + {{ sheep.$helper.timeFormat(state.orderInfo.payTime, 'yyyy-mm-dd hh:MM:ss') }} - - - 支付方式: - {{ state.orderInfo.payChannelName || '-' }} - - - + + + 支付方式: + {{ state.orderInfo.payChannelName || '-' }} + + + - - - - 商品总额 - - ¥{{ fen2yuan(state.orderInfo.totalPrice) }} - - - - 运费 - ¥{{ fen2yuan(state.orderInfo.deliveryPrice) }} - + + + + 商品总额 + + ¥{{ fen2yuan(state.orderInfo.totalPrice) }} + + + + 运费 + ¥{{ fen2yuan(state.orderInfo.deliveryPrice) }} + - - 优惠金额 - ¥{{ fen2yuan(state.orderInfo.discountPrice) }} - - - {{ state.orderInfo.payStatus ? '已付款' : '需付款' }} - ¥{{ fen2yuan(state.orderInfo.payPrice) }} - - - 已退款 - ¥{{ fen2yuan(state.orderInfo.refundPrice) }} - - + + 优惠金额 + ¥{{ fen2yuan(state.orderInfo.discountPrice) }} + + + {{ state.orderInfo.payStatus ? '已付款' : '需付款' }} + ¥{{ fen2yuan(state.orderInfo.payPrice) }} + + + 已退款 + ¥{{ fen2yuan(state.orderInfo.refundPrice) }} + + - - - - - - - - + - - - - - + + + \ No newline at end of file + .pay-btn { + width: 160rpx; + height: 60rpx; + font-size: 26rpx; + border-radius: 30rpx; + font-weight: 500; + color: #fff; + } + } + diff --git a/sheep/api/order.js b/sheep/api/order.js index 1bcf9817..e3ce1546 100644 --- a/sheep/api/order.js +++ b/sheep/api/order.js @@ -129,13 +129,6 @@ export default { }), // 售后 aftersale: { - // 申请售后 - apply: (data) => - request({ - url: 'order/aftersale', - method: 'POST', - data, - }), list: (params) => request({ url: '/app-api/trade/after-sale/page', @@ -145,15 +138,6 @@ export default { showLoading: false, }, }), - // list: (params) => - // request({ - // url: 'order/aftersale', - // method: 'GET', - // params, - // custom: { - // showLoading: false, - // }, - // }), //取消售后 cancel: (id) => request({ @@ -166,7 +150,7 @@ export default { url: 'order/aftersale/' + id, method: 'DELETE', }), - // 售后详情 + // 售后详情 DONE detail: (id) => request({ url: '/app-api/trade/after-sale/get?id=' + id, diff --git a/sheep/api/trade/afterSale.js b/sheep/api/trade/afterSale.js index 25aa31cc..82079453 100644 --- a/sheep/api/trade/afterSale.js +++ b/sheep/api/trade/afterSale.js @@ -10,6 +10,26 @@ const AfterSaleApi = { data, }); }, + // 获得售后 + getAfterSale: (id) => { + return request2({ + url: `/app-api/trade/after-sale/get`, + method: 'GET', + params: { + id, + }, + }); + }, + // 取消售后 + cancelAfterSale: (id) => { + return request2({ + url: `/app-api/trade/after-sale/cancel`, + method: 'DELETE', + params: { + id, + }, + }); + } }; export default AfterSaleApi; diff --git a/sheep/hooks/useGoods.js b/sheep/hooks/useGoods.js index 1a98b087..eb13a471 100644 --- a/sheep/hooks/useGoods.js +++ b/sheep/hooks/useGoods.js @@ -182,6 +182,87 @@ export function handleOrderButtons(order) { } } +/** + * 格式化售后状态 + * + * @param afterSale 售后 + */ +export function formatAfterSaleStatus(afterSale) { + if (afterSale.status === 10) { + return '申请售后'; + } + if (afterSale.status === 20) { + return '商品待退货'; + } + if (afterSale.status === 30) { + return '商家待收货'; + } + if (afterSale.status === 40) { + return '等待退款'; + } + if (afterSale.status === 50) { + return '退款成功'; + } + if (afterSale.status === 61) { + return '买家取消'; + } + if (afterSale.status === 62) { + return '商家拒绝'; + } + if (afterSale.status === 63) { + return '商家拒收货'; + } + return '未知状态'; +} + +/** + * 格式化售后状态的描述 + * + * @param afterSale 售后 + */ +export function formatAfterSaleStatusDescription(afterSale) { + if (afterSale.status === 10) { + return '退款申请待商家处理'; + } + if (afterSale.status === 20) { + return '请退货并填写物流信息'; + } + if (afterSale.status === 30) { + return '退货退款申请待商家处理'; + } + if (afterSale.status === 40) { + return '等待退款'; + } + if (afterSale.status === 50) { + return '退款成功'; + } + if (afterSale.status === 61) { + return '退款关闭'; + } + if (afterSale.status === 62) { + return `商家不同意退款申请,拒绝原因:${afterSale.auditReason}`; + } + if (afterSale.status === 63) { + return `商家拒绝收货,不同意退款,拒绝原因:${afterSale.auditReason}`; + } + return '未知状态'; +} + +/** + * 处理售后的 button 操作按钮数组 + * + * @param afterSale 售后 + */ +export function handleAfterSaleButtons(afterSale) { + afterSale.buttons = []; + if ([10, 20, 30].includes(afterSale.status)) { // 取消订单 + afterSale.buttons.push('cancel'); + } + if (afterSale.status === 20) { // 退货信息 + afterSale.buttons.push('delivery'); + } +} + /** * 倒计时 * @param toTime 截止时间