Commit f29f06d9 by liimin

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

- 更新积分商城名称
- 修复物流信息显示逻辑
- 优化订单详情页面布局
- 调整订单列表组件样式
- 重构订单相关数据处理方法
- 优化用户信息展示页面
1 parent f53d5b06
......@@ -153,4 +153,4 @@
<!-- <block wx:if="{{showComponent&&!isGH}}">
<coupons-list bind:getCoupons="getCouponsItem" couponsId="{{query.couponId}}" show="{{showCoupons}}" goodsId="{{curentGoodsItem.id}}"></coupons-list>
</block> -->
<glsx-privacy appletName="海马刀"></glsx-privacy>
\ No newline at end of file
<glsx-privacy appletName="积分商城"></glsx-privacy>
\ No newline at end of file
......@@ -8,4 +8,4 @@
</block>
</view>
<authorize scopeType="userLocation" bindfail="authFail" bindsuccess="authSuccess" show="{{showAuth}}"></authorize>
<glsx-privacy appletName="海马刀"></glsx-privacy>
\ No newline at end of file
<glsx-privacy appletName="积分商城"></glsx-privacy>
\ No newline at end of file
......@@ -39,4 +39,4 @@
</view>
<glsx-privacy appletName="海马刀"></glsx-privacy>
<glsx-privacy appletName="积分商城"></glsx-privacy>
......@@ -26,4 +26,4 @@
</block>
</view>
<glsx-privacy appletName="海马刀"></glsx-privacy>
\ No newline at end of file
<glsx-privacy appletName="积分商城"></glsx-privacy>
\ No newline at end of file
import { getAfterSaleDetail } from "~/packageMine/pages/order/utils";
import {
ORDER_STATUS,
OrderStatusEnum,
} from "~/constants/mine.js";
Page({
/**
* 页面的初始数据
......@@ -78,13 +82,6 @@ Page({
// console.log('this.button', this.data.button)
this[this.data.button.handler]()
},
toAfterSale(){
const { orderInfo } = this.data;
wx.p.router.go(
"/packageMine/pages/order/afterSale_step_two/afterSale_step_two",
orderInfo
);
},
/**撤销申请 */
cancelSaleApply() {
const { orderInfo } = this.data;
......@@ -104,7 +101,9 @@ Page({
wx.hideLoading();
if (res) {
wx.p.wxApi.showToast("撤销成功");
wx.p.router.back();
wx.p.router.go("/packageMine/pages/order/index/index", {
tab: ORDER_STATUS[OrderStatusEnum.COMPLETED],
});
}
});
}
......
import { afterSaleMixin } from "~/mixins/index";
import { RefundReason, GoodsSource } from "~/constants/mine.js";
import {
RefundReason,
GoodsSource,
ORDER_STATUS,
OrderStatusEnum,
} from "~/constants/mine.js";
const Methods = {
[GoodsSource.YZH]: wx.p.api.shopmallApi.afterSalesPlatform,
[GoodsSource.SELF]: wx.p.api.shopmallApi.afterSale,
......@@ -11,17 +16,18 @@ Page({
*/
data: {
RefundReason: Object.freeze(RefundReason),
method:null,
method: null,
},
/**
* 生命周期函数--监听页面加载
*/
onLoad: function (options) {
wx.p.router.getRouterParams(options).then((orderObj) => {
orderObj.returnType = 1001
console.log("🚀 ~ orderObj:", orderObj)
orderObj.returnType = 1001;
this.setData({
orderObj,
method:Methods[orderObj.goodsSource],
method: Methods[orderObj.goodsSource],
// maxRefundCount: orderObj.refundCount,
});
});
......@@ -113,10 +119,12 @@ Page({
if (code == "0") {
wx.p.wxApi.showToast("申请成功!");
setTimeout(() => {
wx.p.router.back((prevPage) => {
console.log(prevPage);
prevPage.clearData && prevPage.clearData();
}, 2);
// wx.p.router.back((prevPage) => {
// prevPage.clearAndGetList && prevPage.clearAndGetList();
// }, 1);
wx.p.router.reLaunch("/packageMine/pages/order/index/index", {
tab: ORDER_STATUS[OrderStatusEnum.AFTER_SALE],
});
}, 1.5 * 1000);
} else {
wx.p.wxApi.showToast(message);
......
......@@ -3,7 +3,7 @@
<!-- <view class="type text-center"> -->
<afterSale_step_one bindreturnType="changeReturnType"/>
<!-- </view> -->
<view class="title">申请退货退款</view>
<view class="title">申请<text wx:if="{{orderObj.returnType===1001}}">退货</text>退款</view>
<!-- 退款信息组件 -->
<refund-info-box
orderObj="{{orderObj}}"
......@@ -31,4 +31,4 @@
<view class="btn text-center" bindtap="submit">提交</view>
</view>
<glsx-privacy appletName="海马刀"></glsx-privacy>
\ No newline at end of file
<glsx-privacy appletName="积分商城"></glsx-privacy>
\ No newline at end of file
const LOGISTICS_STATUS = {
1000: '待揽件',
1001: '已揽件',
1002: '运输中',
1003: '已签收',
1004: '拒收'
1000: "待揽件",
1001: "已揽件",
1002: "运输中",
1003: "已签收",
1004: "拒收",
};
Component({
properties: {
......@@ -11,15 +11,13 @@ Component({
type: Object,
value: {},
observer: function (val) {
console.log("🚀 ~ val:", val)
this.setData({
logisticsData: this.processExpressInfo(val)
})
}
if (!val) return;
this.processExpressInfo(val);
},
},
showExpress: {
type: Boolean,
value: false
value: false,
},
// height: {
// type: String,
......@@ -60,80 +58,90 @@ Component({
methods: {
processShipmentTrack(shipmentTrack, logisticsStatus) {
if (!this.data.showExpress) {
shipmentTrack = shipmentTrack ? shipmentTrack.slice(0, 2) : []
shipmentTrack = shipmentTrack ? shipmentTrack.slice(0, 2) : [];
}
return shipmentTrack.map((track, index) => {
let status = 1000;
let statusDesc = '待揽件';
const content = track.content;
const operateTime = track.operateTime;
const isLast = index === 0;
// 根据内容判断状态
if (content.includes('已签收') || content.includes('签收人')) {
status = 1003;
statusDesc = '已签收';
} else if (content.includes('拒收') || content.includes('退回')) {
status = 1004;
statusDesc = '拒收';
} else if (content.includes('派件') || content.includes('驿站') || content.includes('暂存')) {
status = 1002;
statusDesc = '运输中';
} else if (content.includes('转运中心') || content.includes('发往') || content.includes('到达')) {
status = 1002;
statusDesc = '运输中';
} else if (content.includes('已收件') || content.includes('揽收')) {
status = 1001;
statusDesc = '已揽件';
} else if (content.includes('已发往')) {
status = 1001;
statusDesc = '已揽件';
}
return shipmentTrack
.map((track, index) => {
let status = 1000;
let statusDesc = "待揽件";
const content = track.content;
const operateTime = track.operateTime;
const isLast = index === 0;
// 根据内容判断状态
if (content.includes("已签收") || content.includes("签收人")) {
status = 1003;
statusDesc = "已签收";
} else if (content.includes("拒收") || content.includes("退回")) {
status = 1004;
statusDesc = "拒收";
} else if (
content.includes("派件") ||
content.includes("驿站") ||
content.includes("暂存")
) {
status = 1002;
statusDesc = "运输中";
} else if (
content.includes("转运中心") ||
content.includes("发往") ||
content.includes("到达")
) {
status = 1002;
statusDesc = "运输中";
} else if (content.includes("已收件") || content.includes("揽收")) {
status = 1001;
statusDesc = "已揽件";
} else if (content.includes("已发往")) {
status = 1001;
statusDesc = "已揽件";
}
// 根据整体物流状态进行最终调整
if (logisticsStatus < status) {
// 如果整体状态低于当前轨迹状态,说明该轨迹尚未完成
statusDesc = LOGISTICS_STATUS[logisticsStatus] + '(进行中)';
}
// 根据整体物流状态进行最终调整
if (logisticsStatus < status) {
// 如果整体状态低于当前轨迹状态,说明该轨迹尚未完成
statusDesc = LOGISTICS_STATUS[logisticsStatus] + "(进行中)";
}
return {
...track,
type: isLast ? 'active' : 'small',
status,
statusDesc
};
}).filter(track => {
// 根据整体物流状态过滤轨迹
switch (logisticsStatus) {
case 1000: // 待揽件 - 只显示收件相关记录
return track.status === 1000;
case 1001: // 已揽件 - 显示揽件和发往记录
return track.status <= 1001;
case 1002: // 运输中 - 显示所有运输中的记录
return track.status <= 1002;
case 1003: // 已签收 - 显示所有记录
return track.status <= 1003;
case 1004: // 拒收 - 显示所有记录
return track.status <= 1004;
default:
return true;
}
});
return {
...track,
type: isLast ? "active" : "small",
status,
statusDesc,
};
})
.filter((track) => {
// 根据整体物流状态过滤轨迹
switch (logisticsStatus) {
case 1000: // 待揽件 - 只显示收件相关记录
return track.status === 1000;
case 1001: // 已揽件 - 显示揽件和发往记录
return track.status <= 1001;
case 1002: // 运输中 - 显示所有运输中的记录
return track.status <= 1002;
case 1003: // 已签收 - 显示所有记录
return track.status <= 1003;
case 1004: // 拒收 - 显示所有记录
return track.status <= 1004;
default:
return true;
}
});
},
processExpressInfo(expressInfo) {
const {
logisticsStatus,
const { logisticsStatus, shipmentTrack, ...rest } = expressInfo;
const processedTrack = this.processShipmentTrack(
shipmentTrack,
...rest
} = expressInfo;
const processedTrack = this.processShipmentTrack(shipmentTrack, logisticsStatus);
return {
logisticsStatus
);
const logisticsData = {
...rest,
logisticsStatus,
logisticsStatusDesc: LOGISTICS_STATUS[logisticsStatus],
shipmentTrack: processedTrack
shipmentTrack: processedTrack,
};
}
}
});
\ No newline at end of file
this.setData({
logisticsData,
});
},
},
});
Component({
options: {
addGlobalClass: true,
},
properties: {
orderInfo: {
type: Object,
......@@ -13,13 +10,14 @@ Component({
},
methods: {
compute(info) {
let { freightAmount = 0, sellQty, redeemPoints } = info;
console.log("🚀 ~ compute ~ freightAmount = 0, sellQty, redeemPoints:", freightAmount, sellQty, redeemPoints)
const total = +redeemPoints * +sellQty + +freightAmount;
let { freightAmount = 0, sellQty,applyQty, redeemPoints } = info;
const total = +redeemPoints * +(sellQty||applyQty) + +freightAmount;
this.setData({
total,
freightAmount
freightAmount,
info
})
console.log(this.data.orderInfo)
}
}
})
\ No newline at end of file
......@@ -5,7 +5,7 @@
.wait-icon {
width: 32px;
height: 32px;
margin-right: 10rpx;
margin-right: 20rpx;
}
.dispatched-txt {
......
import {
orderMixin
} from "~/mixins/index";
import {
OrderStatus
} from "~/constants/mine.js";
Page({
behaviors: [orderMixin],
/**
* 页面的初始数据
*/
data: {
OrderStatus,
expressInfo: {
"orderCode": "295057717192728657",
"expressCode": "yuantong",
......@@ -112,9 +116,9 @@ Page({
//用来获取发货信息
this.getOrderDetail(params.item.subOrderCode);
}
this.setData({
Status: OrderStatus[this.data.orderInfo.orderStatus],
});
// this.setData({
// Status: OrderStatus[this.data.orderInfo.orderStatus],
// });
});
},
queryLogistics() {
......@@ -127,7 +131,7 @@ Page({
wx.p.api.shopmallApi.queryLogistics(params).then((data) => {
console.log(data, '物流信息')
this.setData({
// expressInfo: data
expressInfo: data
})
})
},
......@@ -151,6 +155,7 @@ Page({
} = data.receiveAddress
this.setData({
orderInfo: {
...data,
...orderInfo,
receiveAddress: provinceName + cityName + countyName + address,
receviveInfo: receiveName + receiveMobile
......
......@@ -5,8 +5,10 @@
</BlockBox> -->
<!-- 云中鹤的有物流信息 -->
<BlockBox wx:if="{{orderInfo.goodsSource==1||!orderInfo.goodsSource}}">
<view class="express-box" bindtap="showExpressPop" wx:if="{{expressInfo}}">
<view class="express-detail">物流详情 <mp-icon icon="arrow" color="var(--btnColor)" size="{{11}}"></mp-icon>
<view class="express-box" bindtap="showExpressPop" wx:if="{{expressInfo &&expressInfo.shipmentTrack&&expressInfo.shipmentTrack.length}}">
<view class="express-detail">
物流详情
<mp-icon icon="arrow" color="var(--btnColor)" size="{{11}}"></mp-icon>
</view>
<Express expressInfo="{{expressInfo}}" />
</view>
......@@ -14,7 +16,7 @@
</BlockBox>
<!-- 自营商品展示快递信息 -->
<BlockBox wx:if="{{orderInfo.goodsSource==2}}">
<Expressage expressInfo="{{expressInfo}}" wx:if="{{expressInfo}}"></Expressage>
<Expressage expressInfo="{{expressInfo}}" wx:if="{{expressInfo && expressInfo.shipmentTrack&&expressInfo.shipmentTrack.length}}"></Expressage>
<WaitDeliver wx:else></WaitDeliver>
</BlockBox>
<BlockBox>
......@@ -26,7 +28,6 @@
<!-- <BlockBox>
<content item="{{orderInfo}}" />
</BlockBox> -->
<Expresspop showExpress="{{isShowExpressPop}}" expressInfo="{{expressInfo}}" />
</view>
</block>
\ No newline at end of file
......@@ -9,8 +9,8 @@ Component({
value: {},
observer: function (v) {
this.compute(v);
}
}
},
},
},
/**
......@@ -18,13 +18,13 @@ Component({
*/
methods: {
compute(item) {
let { applyQty, sellQty, redeemPoints } = item;
let { applyQty, sellQty, redeemPoints, freightAmount = 0 } = item;
const total = sellQty || applyQty || 0;
let sum = redeemPoints * total;
let sum = redeemPoints * total + +freightAmount;
this.setData({
sum,
total
})
}
}
})
\ No newline at end of file
total,
});
},
},
});
......@@ -13,37 +13,4 @@ Component({
value: false
}
},
/**
* 组件的初始数据
*/
data: {
},
/**
* 组件的方法列表
*/
methods: {
// 查看评价
onLookEvaluate(e) {
this.triggerEvent('lookEvaluate', {
item: e.currentTarget.dataset.item
});
},
// 获取用户信息
onGetUserProfile(e) {
this.triggerEvent('getUserProfile', {
item: e.currentTarget.dataset.item
});
},
// 立即评价
onEvaluate(e) {
this.triggerEvent('evaluate', {
item: e.currentTarget.dataset.item
});
}
}
})
\ No newline at end of file
......@@ -140,15 +140,16 @@ Component({
// 售后
onAfterSale(e) {
let { subOrderCode, redeemPoints, goodsSource, sellQty,goodsSkuCode } =
let { subOrderCode, redeemPoints, goodsSource, sellQty,applyQty,goodsSkuCode } =
this.data.order;
console.log(this.data.order)
wx.p.router.go(
"/packageMine/pages/order/afterSale_step_two/afterSale_step_two",
{
subOrderCode,
refundPoints: redeemPoints,
goodsSource,
applyQty: sellQty,
applyQty: applyQty || sellQty,
goodsSkuCode
}
);
......
......@@ -289,14 +289,7 @@ Page({
}
);
},
/**
* 刷新订单列表
*/
onRefresh() {
// 调用混入中的方法获取订单列表
if (this.getOrderList && typeof this.getOrderList === "function") {
this.getOrderList();
}
onPullDownRefresh: function () {
this.clearAndGetList()
},
});
......@@ -3,5 +3,8 @@
"usingComponents": {
"tab": "/components/Tab/Tab",
"OrderCard": "./components/OrderCard/OrderCard"
}
},
"onReachBottomDistance": 10,
"backgroundTextStyle": "dark",
"enablePullDownRefresh": true
}
\ No newline at end of file
// pages/tab/mine/index.js
import commonApi from '~/api/module/common'
import {
ToolList
} from "~/constants/index";
import commonApi from "~/api/module/common";
import { ToolList } from "~/constants/index";
Page({
/**
* 页面的初始数据
......@@ -10,21 +8,22 @@ Page({
data: {
navStyle: "background-color: transparent;",
scoreSummary: {
currentScore: '-', //当前积分
bankCardSize: '-',
totalGoodExchangeScore: '-', //累计兑换积分
totalRewardScore: '-', //累计收益积分
totalWithdrawalScore: '-', //累计提现积分
currentScore: "-", //当前积分
bankCardSize: "-",
totalGoodExchangeScore: "-", //累计兑换积分
totalRewardScore: "-", //累计收益积分
totalWithdrawalScore: "-", //累计提现积分
},
toolList: ToolList,
guideList: [{
key: 'currentScore',
leftIcon: 'logo'
}, {
key: 'bankCardSize',
text: '银行卡'
}
guideList: [
{
key: "currentScore",
leftIcon: "logo",
},
{
key: "bankCardSize",
text: "银行卡",
},
],
},
......@@ -32,55 +31,50 @@ Page({
* 生命周期函数--监听页面加载
*/
onLoad(options) {
let userInfo = wx.p.storage.get('userInfo')
let userInfo = wx.p.storage.get("userInfo");
this.setData({
userInfo
})
this.searchScoreSummaryData()
userInfo,
});
this.searchScoreSummaryData();
// this.getMemberCardData();
},
searchScoreSummaryData() {
const {
phone,
channelSource
} = this.data.userInfo
wx.p.api.withdrawalApi.searchScoreSummary({
staffPhone:phone,
channelSource //1.阳光激励 2.续保用户 3.管理层
}).then(res => {
if (res.code == 0) {
this.setData({
scoreSummary: res.data
})
}
}).catch((err) => {
wx.p.wxApi.showToast(JSON.stringify(err))
})
const { phone, channelSource } = this.data.userInfo;
wx.p.api.withdrawalApi
.searchScoreSummary({
staffPhone: phone,
channelSource, //1.阳光激励 2.续保用户 3.管理层
})
.then((res) => {
if (res.code == 0) {
this.setData({
scoreSummary: res.data,
});
}
})
.catch((err) => {
wx.p.wxApi.showToast(JSON.stringify(err));
});
},
go(e) {
console.log(e)
const thisPage = wx.p.router.getPageInstance()
let {
index
} = e.currentTarget.dataset
console.log(e);
const thisPage = wx.p.router.getPageInstance();
let { index } = e.currentTarget.dataset;
let arr = [
() => {
wx.p.router.go('/packageIndex/pages/integral/index/index')
wx.p.router.go("/packageIndex/pages/integral/index/index");
},
() => {
wx.p.router.go('/packageIndex/pages/bankAccount/list/list')
}
]
arr[index]()
wx.p.router.go("/packageIndex/pages/bankAccount/list/list");
},
];
arr[index]();
},
navbarReady(e) {
let {
height
} = e.detail;
let { height } = e.detail;
this.setData({
navHeight: height
})
navHeight: height,
});
},
login() {
wx.p.router.go("/pages/Login/Login");
......@@ -89,13 +83,11 @@ Page({
wx.p.router.go("/packageMine/pages/setting/index");
},
jump(e) {
const {
url
} = e.currentTarget.dataset;
const { url } = e.currentTarget.dataset;
wx.p.router.go(url);
},
async getOrderNumberList() {
const loginStatus = !wx.p.isLogin
const loginStatus = !wx.p.isLogin;
if (loginStatus) return;
wx.p.api.mineApi.getOrderNumberList().then((res) => {
this.setData({
......@@ -111,23 +103,31 @@ Page({
// 切换门店
changeMerchant() {
// 获取门店接口 门店数量大于1跳转切换,否则不需切换
let {userInfo} = this.data
commonApi.getMerchantData({staffPhone: userInfo?.phone, channelSource: userInfo?.channelSource}).then(res => {
let {code, data, message} = res
if (code == 0) {
if (data?.length > 1) {
wx.p.router.go('/pages/chooseMerchant/index', {loginData: userInfo, merchantList: data})
let { userInfo } = this.data;
commonApi
.getMerchantData({
staffPhone: userInfo?.phone,
channelSource: userInfo?.channelSource,
})
.then((res) => {
let { code, data, message } = res;
if (code == 0) {
if (data?.length > 1) {
wx.p.router.go("/pages/chooseMerchant/index", {
loginData: userInfo,
merchantList: data,
});
}
} else {
wx.p.wxApi.showToast(message);
}
} else {
wx.p.wxApi.showToast(message)
}
})
});
},
/**
* 生命周期函数--监听页面显示
*/
onShow() {
// this.getOrderNumberList();
this.getOrderNumberList();
// this.toCheckMember();
},
});
\ No newline at end of file
});
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!