Commit b6a940a4 by liimin

refactor(order): 优化订单相关页面和组件

- 修改订单状态文本和逻辑
- 优化物流信息展示和复制功能
- 调整订单详情页面布局和数据处理
- 移除不必要的组件和代码
- 统一订单相关页面的样式和交互
1 parent cb8c21fe
...@@ -214,7 +214,7 @@ export const ORDER_STATUS = { ...@@ -214,7 +214,7 @@ export const ORDER_STATUS = {
}, },
}, },
[OrderStatusEnum.AFTER_SALE_WAIT_RECEIVE]: { [OrderStatusEnum.AFTER_SALE_WAIT_RECEIVE]: {
text: "售后中", text: "审核通过",
status: OrderStatusEnum.AFTER_SALE_WAIT_RECEIVE, //售后审核通过 status: OrderStatusEnum.AFTER_SALE_WAIT_RECEIVE, //售后审核通过
detail:{ detail:{
text:"审核通过", text:"审核通过",
......
...@@ -52,8 +52,9 @@ Page({ ...@@ -52,8 +52,9 @@ Page({
this.setData({ this.setData({
addressList: data, addressList: data,
}); });
wx.hideLoading();
if (showTips) wx.p.wxApi.showToast(showTips); if (showTips) wx.p.wxApi.showToast(showTips);
}).finally(() => {
wx.hideLoading();
}); });
}, },
chooseDefault(e) { chooseDefault(e) {
......
...@@ -43,7 +43,6 @@ Page({ ...@@ -43,7 +43,6 @@ Page({
tparReturnOrderCode, tparReturnOrderCode,
goodsSkuCode, goodsSkuCode,
}).then((res) => { }).then((res) => {
wx.hideLoading();
// let status = 0 // let status = 0
// if (res.returnOrderStatus == 1000 || res.returnOrderStatus == 1002 || res.returnOrderStatus == 1001 || res.returnOrderStatus == 1004 || (res.returnOrderStatus == 1003 && res.outRefundType == 2)) { // if (res.returnOrderStatus == 1000 || res.returnOrderStatus == 1002 || res.returnOrderStatus == 1001 || res.returnOrderStatus == 1004 || (res.returnOrderStatus == 1003 && res.outRefundType == 2)) {
// status = 0 // status = 0
...@@ -69,6 +68,8 @@ Page({ ...@@ -69,6 +68,8 @@ Page({
status, status,
button, button,
}); });
}).finally(() => {
wx.hideLoading();
}); });
}, },
...@@ -112,7 +113,6 @@ Page({ ...@@ -112,7 +113,6 @@ Page({
wx.p.wxApi.showLoading("提交中"); wx.p.wxApi.showLoading("提交中");
const URLNAME = "platformEditSale"; const URLNAME = "platformEditSale";
wx.p.api.shopmallApi[URLNAME](para).then((res) => { wx.p.api.shopmallApi[URLNAME](para).then((res) => {
wx.hideLoading();
if (res) { if (res) {
wx.p.wxApi.showToast("撤销成功"); wx.p.wxApi.showToast("撤销成功");
wx.p.router.go("/packageMine/pages/order/index/index", { wx.p.router.go("/packageMine/pages/order/index/index", {
...@@ -124,6 +124,8 @@ Page({ ...@@ -124,6 +124,8 @@ Page({
}) })
.catch(() => { .catch(() => {
wx.p.wxApi.showToast("已取消"); wx.p.wxApi.showToast("已取消");
}).finally(() => {
wx.hideLoading();
}); });
}, },
previewImage(e) { previewImage(e) {
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
<view class="text-box"> <view class="text-box">
<view class="header"> <view class="header">
<view class="title">商品寄回地址</view> <view class="title">商品寄回地址</view>
<Copy /> <Copy content="{{orderInfo.sendbackAddressModel.address||''}}"/>
</view> </view>
<block wx:for="{{address}}" wx:key="index"> <block wx:for="{{address}}" wx:key="index">
<view class="item"> <view class="item">
......
...@@ -159,12 +159,13 @@ Page({ ...@@ -159,12 +159,13 @@ Page({
tparReturnOrderCode, tparReturnOrderCode,
goodsSkuCode, goodsSkuCode,
}).then((res) => { }).then((res) => {
wx.hideLoading();
const { orderGoods, imgUrlList, ...rest } = res; const { orderGoods, imgUrlList, ...rest } = res;
const order = Object.assign({ imgList: imgUrlList }, orderGoods, rest); const order = Object.assign({ imgList: imgUrlList }, orderGoods, rest);
const { ___qty, ___price, ___totalPrice } = calcOrderProp(order); const { ___qty, ___price, ___totalPrice } = calcOrderProp(order);
Object.assign(order, { ___qty, ___price, ___totalPrice }); Object.assign(order, { ___qty, ___price, ___totalPrice });
cb(order); cb(order);
}).finally(() => {
wx.hideLoading();
}); });
}, },
}); });
// packageMine/pages/order/components/Copy/Copy.js Component({
Page({ properties: {
content: {
/** type: String,
* 页面的初始数据 value: "",
*/
data: {
}, },
/**
* 生命周期函数--监听页面加载
*/
onLoad(options) {
}, },
methods: {
/** copy() {
* 生命周期函数--监听页面初次渲染完成 wx.p.wxApi.setCopyData(this.data.content, () => {
*/ wx.p.wxApi.showToast('复制成功')
onReady() { })
}, },
/**
* 生命周期函数--监听页面显示
*/
onShow() {
}, },
/**
* 生命周期函数--监听页面隐藏
*/
onHide() {
},
/**
* 生命周期函数--监听页面卸载
*/
onUnload() {
},
/**
* 页面相关事件处理函数--监听用户下拉动作
*/
onPullDownRefresh() {
},
/**
* 页面上拉触底事件的处理函数
*/
onReachBottom() {
},
/**
* 用户点击右上角分享
*/
onShareAppMessage() {
}
})
\ No newline at end of file \ No newline at end of file
});
<!--packageMine/pages/order/components/Copy/Copy.wxml--> <!--packageMine/pages/order/components/Copy/Copy.wxml-->
<view class="copy">复制</view>
\ No newline at end of file \ No newline at end of file
<view class="copy" bindtap="copy">复制</view>
\ No newline at end of file \ No newline at end of file
// packageMine/pages/order/components/Expressage/Expressage.js // packageMine/pages/order/components/Expressage/Expressage.js
Component({ Component({
/** /**
* 组件的属性列表 * 组件的属性列表
*/ */
...@@ -10,18 +9,4 @@ Component({ ...@@ -10,18 +9,4 @@ Component({
value: {} value: {}
} }
}, },
/**
* 组件的初始数据
*/
data: {
},
/**
* 组件的方法列表
*/
methods: {
}
}) })
\ No newline at end of file \ No newline at end of file
<view class="express-info"> <view class="express-info">
<view class="express-info-item"> <view class="express-info-item">
<view class="logo"> <view class="logo" wx:if="{{expressInfo.logo}}">
<glsx-image src="{{expressInfo.logo||'https://picsum.photos/200/200'}}" /> <glsx-image src="{{expressInfo.logo}}" />
</view> </view>
<text>{{expressInfo.expressName||"顺丰快递"}}</text> <text>{{expressInfo.expressName}}</text>
<text>{{expressInfo.shipmentCode||'SF12222222222222'}}</text> <text>{{expressInfo.shipmentCode}}</text>
</view> </view>
<view class="express-info-item"> <view class="express-info-item">
<Copy /> <Copy content="{{expressInfo.expressName+ '' + expressInfo.shipmentCode}}"/>
</view>
</view> </view>
</view>
\ No newline at end of file \ No newline at end of file
import { RefundStatus } from "~/constants/mine.js";
Component({ Component({
properties: { properties: {
title: { title: {
......
import { orderMixin } from "~/mixins/index"; import { orderMixin } from "~/mixins/index";
// import { OrderStatus } from "~/constants/mine.js"; import { GoodsSource } from "~/constants/mine.js";
import { getOrder } from "~/packageMine/pages/order/utils"; import { getOrder } from "~/packageMine/pages/order/utils";
Page({ Page({
behaviors: [orderMixin], behaviors: [orderMixin],
...@@ -8,9 +8,7 @@ Page({ ...@@ -8,9 +8,7 @@ Page({
*/ */
data: { data: {
// OrderStatus, // OrderStatus,
expressInfo: { expressInfo: null, //物流信息
}, //物流信息
isShowExpressPop: false, isShowExpressPop: false,
deliveryStatus: { deliveryStatus: {
1: "待发货", 1: "待发货",
...@@ -26,7 +24,9 @@ Page({ ...@@ -26,7 +24,9 @@ Page({
const orderObj = params.item; const orderObj = params.item;
if (orderObj) { if (orderObj) {
//物流信息 //物流信息
if (orderObj.goodsSource == GoodsSource.YZH) {
this.queryLogistics(orderObj.subOrderCode); this.queryLogistics(orderObj.subOrderCode);
}
this.getOrderDetail(orderObj.subOrderCode); this.getOrderDetail(orderObj.subOrderCode);
const order = getOrder(orderObj); const order = getOrder(orderObj);
// 订单信息 // 订单信息
...@@ -39,7 +39,6 @@ Page({ ...@@ -39,7 +39,6 @@ Page({
}, },
queryLogistics(subOrderCode) { queryLogistics(subOrderCode) {
wx.p.api.shopmallApi.queryLogistics({ subOrderCode }).then((data) => { wx.p.api.shopmallApi.queryLogistics({ subOrderCode }).then((data) => {
console.log(data, "物流信息");
this.setData({ this.setData({
expressInfo: data, expressInfo: data,
}); });
...@@ -47,10 +46,9 @@ Page({ ...@@ -47,10 +46,9 @@ Page({
}, },
getOrderDetail(subOrderCode) { getOrderDetail(subOrderCode) {
wx.p.wxApi.showLoading("加载中..."); wx.p.wxApi.showLoading("加载中...");
wx.p.api.shopmallApi.getOrderDetail({ subOrderCode }).then((data) => { wx.p.api.shopmallApi
console.log("🚀 ~ getOrderDetail ~ this.data.orderInfo:", this.data.orderInfo) .getOrderDetail({ subOrderCode })
console.log("🚀 ~ getOrderDetail ~ data:", data) .then((data) => {
wx.hideLoading();
let { let {
provinceName, provinceName,
cityName, cityName,
...@@ -67,6 +65,17 @@ Page({ ...@@ -67,6 +65,17 @@ Page({
receviveInfo: receiveName + receiveMobile, receviveInfo: receiveName + receiveMobile,
}, },
}); });
if (data.expressName) {
this.setData({
expressInfo: {
expressName: data.expressName,
shipmentCode: data.expressNo,
},
});
}
})
.finally(() => {
wx.hideLoading();
}); });
}, },
showExpressPop() { showExpressPop() {
......
...@@ -131,13 +131,6 @@ Component({ ...@@ -131,13 +131,6 @@ Component({
// }); // });
// }, // },
// 查看详情
onToGoldDetail(e) {
wx.p.router.go("/packageEquity/pages/kaqDetail/orderDetail", {
orderCode: this.data.order.orderCode,
});
},
// 售后 // 售后
onAfterSale(e) { onAfterSale(e) {
let { subOrderCode, redeemPoints, goodsSource,goodsSkuCode,___qty, tparReturnOrderCode } = let { subOrderCode, redeemPoints, goodsSource,goodsSkuCode,___qty, tparReturnOrderCode } =
......
<!-- 订单操作按钮组件 --> <!-- 订单操作按钮组件 -->
<view class="btn-box"> <view class="btn-box">
<block wx:for="{{buttons}}" wx:key="index"> <block wx:for="{{buttons}}" wx:key="index">
<block wx:if="{{item.type === 'getUserProfile'}}"> <!-- <block wx:if="{{item.type === 'getUserProfile'}}">
<button catchtap="onGetUserProfile" class="{{item.class}}">{{item.text}}</button> <button catchtap="onGetUserProfile" class="{{item.class}}">{{item.text}}</button>
</block> </block> -->
<block wx:else> <!-- <block wx:else> -->
<view class="{{item.class}}" catchtap="onButtonClick" data-handler="{{item.handler}}">{{item.text}}</view> <view class="{{item.class}}" catchtap="onButtonClick" data-handler="{{item.handler}}">{{item.text}}</view>
</block> <!-- </block> -->
</block> </block>
</view> </view>
\ No newline at end of file \ No newline at end of file
...@@ -166,7 +166,6 @@ Page({ ...@@ -166,7 +166,6 @@ Page({
} }
let list = []; let list = [];
wx.p.api.mineApi[requestMethod](obj).then((data) => { wx.p.api.mineApi[requestMethod](obj).then((data) => {
wx.hideLoading();
data?.list?.forEach((e) => { data?.list?.forEach((e) => {
const {___qty,___price,___totalPrice} =calcOrderProp(e) const {___qty,___price,___totalPrice} =calcOrderProp(e)
list.push({ list.push({
...@@ -180,6 +179,7 @@ Page({ ...@@ -180,6 +179,7 @@ Page({
list, list,
listFlag: true, listFlag: true,
}); });
}).finally(() => {
wx.hideLoading(); wx.hideLoading();
}); });
}, },
......
...@@ -20,14 +20,12 @@ export function getOrderStatus({ ...@@ -20,14 +20,12 @@ export function getOrderStatus({
//goodsSource 1.云中鹤 2.平台商品 //goodsSource 1.云中鹤 2.平台商品
//订单状态 orderStatus (1001:待支付 1002:待审核,1003:审核不通过,1004:已取消(交易失败) ,1005:订单异常,1006:待处理,1007: 待发货,1008:已发货,1009:已完成(交易成功),1010:售后处理中,1012 订单关闭 //订单状态 orderStatus (1001:待支付 1002:待审核,1003:审核不通过,1004:已取消(交易失败) ,1005:订单异常,1006:待处理,1007: 待发货,1008:已发货,1009:已完成(交易成功),1010:售后处理中,1012 订单关闭
if ( if (
[1002, 1006, 1007].includes(orderStatus) && [1002, 1006, 1007].includes(orderStatus) && (!cancelStatus || cancelStatus == 1010)
(!cancelStatus || cancelStatus == 1010)
) { ) {
// 按钮:售后(去掉) // 按钮:售后(去掉)
return OrderStatusEnum.WAIT_DELIVER; //待发货 order_status属于(1002,1006,1007)且cancel_status不存在或者审核中(1010) return OrderStatusEnum.WAIT_DELIVER; //待发货 order_status属于(1002,1006,1007)且cancel_status不存在或者审核中(1010)
} else if ( } else if (
[1008].includes(orderStatus) && [1008].includes(orderStatus) && (!cancelStatus || cancelStatus == 1010)
(!cancelStatus || cancelStatus == 1010)
) { ) {
// 确认收货,查看物流 // 确认收货,查看物流
return OrderStatusEnum.WAIT_RECEIVE; //待收货 order_status属于(1008)且cancel_status不存在或者审核中(1010) return OrderStatusEnum.WAIT_RECEIVE; //待收货 order_status属于(1008)且cancel_status不存在或者审核中(1010)
...@@ -35,8 +33,9 @@ export function getOrderStatus({ ...@@ -35,8 +33,9 @@ export function getOrderStatus({
//按钮:查看物流、售后 //按钮:查看物流、售后
return OrderStatusEnum.COMPLETED; //已完成 order_status属于(1009)且cancel_status不存在或者审核中(1010) return OrderStatusEnum.COMPLETED; //已完成 order_status属于(1009)且cancel_status不存在或者审核中(1010)
} else if ( } else if (
(returnOrderStatus == 1000 && returnStatus == 1000) || // (returnOrderStatus == 1000 && returnStatus == 1000) ||
(returnOrderStatus == 1000 && refundStatus == 1000) // (returnOrderStatus == 1000 && refundStatus == 1000)
returnOrderStatus == 1000 && (returnStatus == 1000 || refundStatus == 1000)
) { ) {
// 按钮:售后详情 // 按钮:售后详情
return OrderStatusEnum.AFTER_SALE_PENDING_REVIEW; //售后---待审核 退款退货的return_order_status:1000:待审批且return_status退换货状态(1000:待审核) 仅退款的return_order_status:1000:待审批且refund_status 退款状态(1000:待审核 return OrderStatusEnum.AFTER_SALE_PENDING_REVIEW; //售后---待审核 退款退货的return_order_status:1000:待审批且return_status退换货状态(1000:待审核) 仅退款的return_order_status:1000:待审批且refund_status 退款状态(1000:待审核
...@@ -44,19 +43,22 @@ export function getOrderStatus({ ...@@ -44,19 +43,22 @@ export function getOrderStatus({
// 按钮:售后详情 // 按钮:售后详情
return OrderStatusEnum.AFTER_SALE_WAIT_RECEIVE; //售后---待收货(审核通过) 退款退货的return_order_status:1001:审核通过 且return_status退换货状态(1001:待收货),仅退款的直接到退款完成/退款失败 return OrderStatusEnum.AFTER_SALE_WAIT_RECEIVE; //售后---待收货(审核通过) 退款退货的return_order_status:1001:审核通过 且return_status退换货状态(1001:待收货),仅退款的直接到退款完成/退款失败
} else if ( } else if (
(returnOrderStatus == 1005 && returnStatus == 1008) || // (returnOrderStatus == 1005 && returnStatus == 1008) ||
(returnOrderStatus == 1005 && refundStatus == 1008) // (returnOrderStatus == 1005 && refundStatus == 1005)
returnOrderStatus == 1005 && (returnStatus == 1008 || refundStatus == 1005)
) { ) {
// 状态:售后前的状态(云中鹤不同意售后申请)按钮:售后、售后详情 // 状态:售后前的状态(云中鹤不同意售后申请)按钮:售后、售后详情
return OrderStatusEnum.AFTER_SALE_REJECTED; //售后 -- 审核不通过 退款退货的return_order_status:1005:审核不通过且return_status退换货状态(1008:审核不通过), 仅退款的return_order_status:1005 且refund_status 退款状态(1008:审核不通过 return OrderStatusEnum.AFTER_SALE_REJECTED; //售后 -- 审核不通过 退款退货的return_order_status:1005:审核不通过且return_status退换货状态(1008:审核不通过), 仅退款的return_order_status:1005 且refund_status 退款状态(1008:审核不通过
} else if ( } else if (
(returnOrderStatus == 1003 && [1002, 1003].includes(returnStatus)) || // (returnOrderStatus == 1003 && [1002, 1003].includes(returnStatus)) ||
(returnOrderStatus == 1003 && refundStatus == 1002) // (returnOrderStatus == 1003 && refundStatus == 1002)
returnOrderStatus == 1003 && ([1002, 1003].includes(returnStatus) || refundStatus == 1002)
) { ) {
return OrderStatusEnum.AFTER_SALE_REFUNDED; // 已退款 退款退货的订单return_order_status:1003:已退款且return_status退换货状态(1002:已收货,1003:已退款),仅退款订单 return_order_status:1003:已退款且refund_status 退款状态1002:已退款, return OrderStatusEnum.AFTER_SALE_REFUNDED; // 已退款 退款退货的订单return_order_status:1003:已退款且return_status退换货状态(1002:已收货,1003:已退款),仅退款订单 return_order_status:1003:已退款且refund_status 退款状态1002:已退款,
} else if ( } else if (
(returnOrderStatus == 1003 && returnStatus == 1006) || // (returnOrderStatus == 1003 && returnStatus == 1006) ||
(returnOrderStatus == 1003 && refundStatus == 1004) // (returnOrderStatus == 1003 && refundStatus == 1004)
[1001, 1002].includes(returnOrderStatus) && refundStatus ==1004
) { ) {
return OrderStatusEnum.AFTER_SALE_REFUNDED_FAILED; // 退款失败 退款退货的return_order_status:1003:已退款 return_status退换货状态(1006:退款异常 ,,仅退款的return_order_status:1003:已退款 且refund_status 退款状态,1004:退款异常 return OrderStatusEnum.AFTER_SALE_REFUNDED_FAILED; // 退款失败 退款退货的return_order_status:1003:已退款 return_status退换货状态(1006:退款异常 ,,仅退款的return_order_status:1003:已退款 且refund_status 退款状态,1004:退款异常
} else { } else {
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!