Commit b6a940a4 by liimin

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

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