Commit ab7042cc by liimin

refactor(order): 重构订单相关页面和组件

- 移除了订单列表和售后订单列表中的 pageSize 参数
- 更新了 Popup 组件,增加了 showConfirm 属性
- 重构了订单状态和售后状态的处理逻辑
- 优化了订单详情和售后详情页面的结构
- 统一了物流信息的展示方式
- 调整了订单状态的样式
1 parent c6fa382a
...@@ -5,7 +5,6 @@ module.exports = { ...@@ -5,7 +5,6 @@ module.exports = {
getOrderList(data) { getOrderList(data) {
return api.post({ return api.post({
method: `scrm.api.shopmall.platform.order.page`, method: `scrm.api.shopmall.platform.order.page`,
pageSize: 99999,
...data ...data
}) })
}, },
...@@ -13,7 +12,6 @@ module.exports = { ...@@ -13,7 +12,6 @@ module.exports = {
getSalesOrderList(data) { getSalesOrderList(data) {
return api.post({ return api.post({
method: `scrm.api.shopmall.platform.after.sales.order.page`, method: `scrm.api.shopmall.platform.after.sales.order.page`,
pageSize: 99999,
...data ...data
}) })
}, },
......
...@@ -50,6 +50,10 @@ Component({ ...@@ -50,6 +50,10 @@ Component({
type: String, type: String,
value: '' value: ''
}, },
showConfirm:{
type: Boolean,
value: true
}
}, },
/** /**
......
...@@ -13,7 +13,7 @@ ...@@ -13,7 +13,7 @@
</view> </view>
<view class="popup-footer isFullSucreen" wx:if="{{showFooter}}"> <view class="popup-footer isFullSucreen" wx:if="{{showFooter}}">
<view class="cancel btn text-center" wx:if="{{only}}" bindtap="hidePopup">取消</view> <view class="cancel btn text-center" wx:if="{{only}}" bindtap="hidePopup">取消</view>
<view class="confirm {{only?'btn':'doubtn'}} text-center" bindtap="confirm">确定</view> <view class="confirm {{only?'btn':'doubtn'}} text-center" wx:if="{{showConfirm}}" bindtap="confirm">确定</view>
</view> </view>
</view> </view>
</view> </view>
\ No newline at end of file \ No newline at end of file
import { import {
getAfterSaleDetail, getAfterSaleDetail,
calcOrderProp, calcOrderProp,
getOrder,
API_Methods,
APIS,
} from "~/packageMine/pages/order/utils"; } from "~/packageMine/pages/order/utils";
import { ORDER_STATUS, OrderStatusEnum } from "~/constants/mine.js"; import { ORDER_STATUS, OrderStatusEnum } from "~/constants/mine.js";
Page({ Page({
...@@ -33,9 +36,9 @@ Page({ ...@@ -33,9 +36,9 @@ Page({
getOrderAfterSaleDetail() { getOrderAfterSaleDetail() {
wx.p.wxApi.showLoading("加载中..."); wx.p.wxApi.showLoading("加载中...");
let { goodsSource, tparReturnOrderCode, subOrderCode, goodsSkuCode } = let { goodsSource, tparReturnOrderCode, subOrderCode, goodsSkuCode } =
this.data, this.data;
Methods = goodsSource == 2 ? "afterSaleDetail" : "platformSaleDetail"; // Methods = goodsSource == 2 ? "afterSaleDetail" : "platformSaleDetail";
wx.p.api.shopmallApi[Methods]({ API_Methods[goodsSource][APIS.AFTER_SALE_DETAIL]({
subOrderCode, subOrderCode,
tparReturnOrderCode, tparReturnOrderCode,
goodsSkuCode, goodsSkuCode,
...@@ -49,9 +52,9 @@ Page({ ...@@ -49,9 +52,9 @@ Page({
// } else if (res.returnOrderStatus == 1005 || (res.returnOrderStatus == 1003 && res.outRefundType == 3) || (res.returnOrderStatus == 1003 && res.outRefundType == 1)) { // } else if (res.returnOrderStatus == 1005 || (res.returnOrderStatus == 1003 && res.outRefundType == 3) || (res.returnOrderStatus == 1003 && res.outRefundType == 1)) {
// status = 2 // status = 2
// } // }
const { returnOrderStatus } = res; // const { returnOrderStatus } = res;
const status = getAfterSaleDetail({ returnOrderStatus }); const status = getOrder(res); //getAfterSaleDetail({ returnOrderStatus });
const button = status.buttons?.[goodsSource][0]; const button = status.detail.buttons?.[goodsSource][0]; //status.buttons?.[goodsSource][0];
// button.action = this[button.handler] // button.action = this[button.handler]
let str = ""; let str = "";
if (res.sendbackAddressModel) { if (res.sendbackAddressModel) {
...@@ -81,13 +84,13 @@ Page({ ...@@ -81,13 +84,13 @@ Page({
// } // }
// this.cancelSaleApply() // this.cancelSaleApply()
// console.log('this.button', this.data.button) // console.log('this.button', this.data.button)
this[this.data.button.handler]() this[this.data.button.handler]();
// this.toAfterSale(); // this.toAfterSale();
}, },
toAfterSale() { toAfterSale() {
const { orderInfo } = this.data; const { orderInfo } = this.data;
const { orderGoods, imgUrlList,...rest } = orderInfo; const { orderGoods, imgUrlList, ...rest } = orderInfo;
const order = Object.assign({imgList:imgUrlList}, orderGoods, rest); const order = Object.assign({ imgList: imgUrlList }, orderGoods, rest);
wx.p.router.go( wx.p.router.go(
"/packageMine/pages/order/afterSale_step_two/afterSale_step_two", "/packageMine/pages/order/afterSale_step_two/afterSale_step_two",
order order
......
<block wx:if="{{orderInfo}}"> <block wx:if="{{orderInfo}}">
<view class="layout isFullSucreen"> <view class="layout isFullSucreen">
<!-- 退款状态组件 --> <!-- 退款状态组件 -->
<refund-status status="{{status}}"></refund-status> <refund-status status="{{status.detail}}"></refund-status>
<!-- 退货地址和物流信息组件 --> <!-- 退货地址和物流信息组件 -->
<block wx:if="{{orderInfo.returnOrderStatus==1001}}"> <block wx:if="{{orderInfo.returnOrderStatus==1001}}">
<return-address-box order-info="{{orderInfo}}"/> <return-address-box order-info="{{orderInfo}}"/>
......
...@@ -55,5 +55,7 @@ ...@@ -55,5 +55,7 @@
</view> </view>
</view> </view>
<mp-actionSheet bindactiontap="onSelectExpress" show="{{isShowExpressSelector}}" actions="{{expressList}}" ext-class="express-wrap" title="选择快递公司">
</mp-actionSheet>
\ No newline at end of file \ No newline at end of file
<!-- <mp-actionSheet bindactiontap="onSelectExpress" show-cancel="{{true}}" show="{{isShowExpressSelector}}" actions="{{expressList}}" ext-class="express-wrap" title="选择快递公司">
</mp-actionSheet> -->
<popup show="{{isShowExpressSelector}}" show-close-button="{{true}}" showConfirm="{{false}}" showFooter="{{true}}" headerColor="#F7F7F7" title="选择快递公司">
</popup>
\ No newline at end of file \ No newline at end of file
...@@ -5,11 +5,7 @@ import { ...@@ -5,11 +5,7 @@ import {
ORDER_STATUS, ORDER_STATUS,
OrderStatusEnum, OrderStatusEnum,
} from "~/constants/mine.js"; } from "~/constants/mine.js";
import { calcOrderProp } from "~/packageMine/pages/order/utils"; import { calcOrderProp,API_Methods,APIS } from "~/packageMine/pages/order/utils";
const Methods = {
[GoodsSource.YZH]: wx.p.api.shopmallApi.afterSalesPlatform,
[GoodsSource.SELF]: wx.p.api.shopmallApi.afterSale,
};
Page({ Page({
behaviors: [afterSaleMixin], behaviors: [afterSaleMixin],
/** /**
...@@ -18,7 +14,7 @@ Page({ ...@@ -18,7 +14,7 @@ Page({
data: { data: {
RefundReason: Object.freeze(RefundReason), RefundReason: Object.freeze(RefundReason),
method: null, method: null,
imagesMax: 9, imagesMax: 5,
}, },
/** /**
* 生命周期函数--监听页面加载 * 生命周期函数--监听页面加载
...@@ -29,7 +25,7 @@ Page({ ...@@ -29,7 +25,7 @@ Page({
const { goodsSource, tparReturnOrderCode, subOrderCode, goodsSkuCode } = const { goodsSource, tparReturnOrderCode, subOrderCode, goodsSkuCode } =
orderObj; orderObj;
this.setData({ this.setData({
method: Methods[orderObj.goodsSource], method: API_Methods[orderObj.goodsSource][APIS.AFTER_SALE],
}); });
if (tparReturnOrderCode) { if (tparReturnOrderCode) {
this.getOrderAfterSaleDetail( this.getOrderAfterSaleDetail(
...@@ -157,8 +153,8 @@ Page({ ...@@ -157,8 +153,8 @@ Page({
cb cb
) { ) {
wx.p.wxApi.showLoading("加载中..."); wx.p.wxApi.showLoading("加载中...");
const Methods = goodsSource == 2 ? "afterSaleDetail" : "platformSaleDetail"; // const Methods = goodsSource == 2 ? "afterSaleDetail" : "platformSaleDetail";
wx.p.api.shopmallApi[Methods]({ API_Methods[goodsSource][APIS.AFTER_SALE_DETAIL]({
subOrderCode, subOrderCode,
tparReturnOrderCode, tparReturnOrderCode,
goodsSkuCode, goodsSkuCode,
......
...@@ -15,7 +15,7 @@ Component({ ...@@ -15,7 +15,7 @@ Component({
this.processExpressInfo(val); this.processExpressInfo(val);
}, },
}, },
showExpress: { showAll: {
type: Boolean, type: Boolean,
value: false, value: false,
}, },
...@@ -57,9 +57,11 @@ Component({ ...@@ -57,9 +57,11 @@ Component({
}, },
methods: { methods: {
processShipmentTrack(shipmentTrack, logisticsStatus) { processShipmentTrack(shipmentTrack, logisticsStatus) {
if (!this.data.showExpress) { if (!shipmentTrack || !shipmentTrack.length) return;
shipmentTrack = shipmentTrack ? shipmentTrack.slice(0, 2) : []; if (!this.data.showAll) {
shipmentTrack = shipmentTrack.slice(0, 2);
} }
console.log("🚀 ~ processShipmentTrack ~ shipmentTrack:", shipmentTrack);
return shipmentTrack return shipmentTrack
.map((track, index) => { .map((track, index) => {
let status = 1000; let status = 1000;
......
...@@ -2,6 +2,6 @@ ...@@ -2,6 +2,6 @@
<view class="popup-content"> <view class="popup-content">
<Expressage expressInfo="{{expressInfo}}"></Expressage> <Expressage expressInfo="{{expressInfo}}"></Expressage>
<view class="line"></view> <view class="line"></view>
<Express expressInfo="{{expressInfo}}" showExpress="{{showExpress}}" /> <Express expressInfo="{{expressInfo}}" showAll="{{true}}" />
</view> </view>
</popup> </popup>
\ No newline at end of file \ No newline at end of file
...@@ -6,8 +6,8 @@ ...@@ -6,8 +6,8 @@
} }
.status-box .icon { .status-box .icon {
width: 80rpx; width: 64rpx;
height: 80rpx; height: 64rpx;
} }
.status-box .box-info .title { .status-box .box-info .title {
...@@ -17,7 +17,7 @@ ...@@ -17,7 +17,7 @@
} }
.status-box .box-info .tips { .status-box .box-info .tips {
font-size: 28rpx; font-size: 24rpx;
font-weight: 400; font-weight: 400;
color: #656566; color: #656566;
} }
\ No newline at end of file \ No newline at end of file
import { import { orderMixin } from "~/mixins/index";
orderMixin // import { OrderStatus } from "~/constants/mine.js";
} from "~/mixins/index"; import { getOrder } from "~/packageMine/pages/order/utils";
import {
OrderStatus
} from "~/constants/mine.js";
Page({ Page({
behaviors: [orderMixin], behaviors: [orderMixin],
/** /**
* 页面的初始数据 * 页面的初始数据
*/ */
data: { data: {
OrderStatus, // OrderStatus,
expressInfo: { expressInfo: {
"orderCode": "295057717192728657",
"expressCode": "yuantong",
"expressName": "圆通速递",
"shipmentCode": "1231231231dfsdgs",
"logisticsStatus": 1003,
"shipmentItems": [{
"goodsSkuCode": "1125899906842634",
"goodsSkuName": "松下家用微电脑电饭煲SR-MGT108可预约1-4人多功能煮饭电饭锅3L SR-MGT108 银色 ",
"qty": 1
}],
"shipmentTrack": [{
"content": "已签收,签收人凭取货码签收。",
"operateTime": "2019-10-21 17:59:18",
"operator": "Operator"
},
{
"content": "快件已暂存至武汉世界城加州阳光步行街店菜鸟驿站,如有疑问请联系18771141749",
"operateTime": "2019-10-21 13:12:02",
"operator": "Operator"
},
{
"content": "湖北武汉关南公司-朱杰(15172337939,027-59401618)-派件中",
"operateTime": "2019-10-21 11:14:08",
"operator": "Operator"
},
{
"content": "已到达-湖北武汉关南公司",
"operateTime": "2019-10-21 10:29:08",
"operator": "Operator"
},
{
"content": "已到达-湖北武汉关南公司",
"operateTime": "2019-10-21 06:54:16",
"operator": "Operator"
},
{
"content": "湖北武昌转运中心-已发往-湖北武汉关南公司",
"operateTime": "2019-10-20 23:16:43",
"operator": "Operator"
},
{
"content": "已到达-湖北武昌转运中心",
"operateTime": "2019-10-20 23:03:58",
"operator": "Operator"
},
{
"content": "广东深圳福田转运中心-已装袋发往-湖北武昌转运中心",
"operateTime": "2019-10-20 01:29:50",
"operator": "Operator"
},
{
"content": "广东深圳福田转运中心-已进行装车扫描",
"operateTime": "2019-10-20 01:29:50",
"operator": "Operator"
},
{
"content": "广东深圳福田转运中心-已发往-湖北武昌转运中心",
"operateTime": "2019-10-19 23:40:20",
"operator": "Operator"
},
{
"content": "广东深圳福田转运中心-已进行装袋扫描",
"operateTime": "2019-10-19 23:40:20",
"operator": "Operator"
},
{
"content": "已到达-广东深圳福田转运中心",
"operateTime": "2019-10-19 23:22:17",
"operator": "Operator"
},
{
"content": "广东宝安凤凰营业厅-已发往-广东深圳福田转运中心",
"operateTime": "2019-10-19 21:00:33",
"operator": "Operator"
},
{
"content": "广东宝安凤凰营业厅-冯凯(时光漫步)-已收件",
"operateTime": "2019-10-19 20:57:56",
"operator": "Operator"
}
]
}, //物流信息 }, //物流信息
isShowExpressPop: false, isShowExpressPop: false,
deliveryStatus: { deliveryStatus: {
...@@ -105,45 +22,34 @@ Page({ ...@@ -105,45 +22,34 @@ Page({
* 生命周期函数--监听页面加载 * 生命周期函数--监听页面加载
*/ */
onLoad: function (options) { onLoad: function (options) {
wx.p.router.getRouterParams(options).then(params => { wx.p.router.getRouterParams(options).then((params) => {
if (params.item) { const orderObj = params.item;
if (orderObj) {
//物流信息
this.queryLogistics(orderObj.subOrderCode);
this.getOrderDetail(orderObj.subOrderCode);
const order = getOrder(orderObj);
// 订单信息 // 订单信息
this.setData({ this.setData({
orderInfo: params.item orderInfo: orderObj,
}) Status: order.detail,
//物流信息 });
this.queryLogistics()
//用来获取发货信息
this.getOrderDetail(params.item.subOrderCode);
} }
// this.setData({
// Status: OrderStatus[this.data.orderInfo.orderStatus],
// });
}); });
}, },
queryLogistics() { queryLogistics(subOrderCode) {
let { wx.p.api.shopmallApi.queryLogistics({ subOrderCode }).then((data) => {
subOrderCode console.log(data, "物流信息");
} = this.data.orderInfo
let params = {
subOrderCode,
}
wx.p.api.shopmallApi.queryLogistics(params).then((data) => {
console.log(data, '物流信息')
this.setData({ this.setData({
expressInfo: data expressInfo: data,
}) });
}) });
}, },
getOrderDetail(orderCode) { getOrderDetail(subOrderCode) {
let {
orderInfo
} = this.data;
wx.p.wxApi.showLoading("加载中..."); wx.p.wxApi.showLoading("加载中...");
let params = { wx.p.api.shopmallApi.getOrderDetail({ subOrderCode }).then((data) => {
subOrderCode: orderCode console.log("🚀 ~ getOrderDetail ~ this.data.orderInfo:", this.data.orderInfo)
} console.log("🚀 ~ getOrderDetail ~ data:", data)
wx.p.api.shopmallApi.getOrderDetail(params).then((data) => {
wx.hideLoading(); wx.hideLoading();
let { let {
provinceName, provinceName,
...@@ -151,21 +57,21 @@ Page({ ...@@ -151,21 +57,21 @@ Page({
countyName, countyName,
address, address,
receiveName, receiveName,
receiveMobile receiveMobile,
} = data.receiveAddress } = data.receiveAddress;
this.setData({ this.setData({
orderInfo: { orderInfo: {
...data, ...data,
...orderInfo, ...this.data.orderInfo,
receiveAddress: provinceName + cityName + countyName + address, receiveAddress: provinceName + cityName + countyName + address,
receviveInfo: receiveName + receiveMobile receviveInfo: receiveName + receiveMobile,
} },
}) });
}); });
}, },
showExpressPop() { showExpressPop() {
this.setData({ this.setData({
isShowExpressPop: true, isShowExpressPop: true,
}); });
}
});
\ No newline at end of file \ No newline at end of file
},
});
<block wx:if="{{orderInfo}}"> <block wx:if="{{orderInfo}}">
<view class="layout"> <view class="layout">
<!-- <BlockBox> <BlockBox>
<Status title="{{Status.title}}" image="{{Status.image}}" tips="{{Status.tips}}"></Status> <Status title="{{Status.text}}" image="{{Status.image}}" tips="{{Status.tips}}"></Status>
</BlockBox> --> </BlockBox>
<!-- 云中鹤的有物流信息 --> <!-- 云中鹤的有物流信息 -->
<BlockBox wx:if="{{orderInfo.goodsSource==1||!orderInfo.goodsSource}}"> <BlockBox wx:if="{{(orderInfo.goodsSource==1||!orderInfo.goodsSource) && expressInfo &&expressInfo.shipmentTrack&&expressInfo.shipmentTrack.length}}">
<view class="express-box" bindtap="showExpressPop" wx:if="{{expressInfo &&expressInfo.shipmentTrack&&expressInfo.shipmentTrack.length}}"> <view class="express-box" bindtap="showExpressPop">
<view class="express-detail"> <view class="express-detail">
物流详情 物流详情
<mp-icon icon="arrow" color="var(--btnColor)" size="{{11}}"></mp-icon> <mp-icon icon="arrow" color="var(--btnColor)" size="{{11}}"></mp-icon>
</view> </view>
<Express expressInfo="{{expressInfo}}" /> <Express expressInfo="{{expressInfo}}" showAll="{{false}}" />
</view> </view>
<WaitDeliver wx:else></WaitDeliver>
</BlockBox> </BlockBox>
<!-- 自营商品展示快递信息 --> <!-- 自营商品展示快递信息 -->
<BlockBox wx:if="{{orderInfo.goodsSource==2}}"> <BlockBox wx:if="{{orderInfo.goodsSource==2 && expressInfo}}">
<Expressage expressInfo="{{expressInfo}}" wx:if="{{expressInfo && expressInfo.shipmentTrack&&expressInfo.shipmentTrack.length}}"></Expressage> <Expressage expressInfo="{{expressInfo}}"></Expressage>
<WaitDeliver wx:else></WaitDeliver>
</BlockBox> </BlockBox>
<BlockBox> <BlockBox>
<DeliveryInfo orderInfo="{{orderInfo}}" deliveryStatus="{{deliveryStatus}}"></DeliveryInfo> <DeliveryInfo orderInfo="{{orderInfo}}" deliveryStatus="{{deliveryStatus}}"></DeliveryInfo>
......
...@@ -152,11 +152,13 @@ Page({ ...@@ -152,11 +152,13 @@ Page({
keyword, keyword,
} = this.data; } = this.data;
const userInfo = wx.p.storage.get("userInfo") || {}; const userInfo = wx.p.storage.get("userInfo") || {};
let { merchantId } = userInfo; let { merchantId,channelSource } = userInfo;
let obj = { let obj = {
requestType, requestType,
merchantId, merchantId,
pageSize: 99999,
currentPage: pageNum, currentPage: pageNum,
scoreSource:channelSource
}; };
if (keyword) { if (keyword) {
keyword = keyword.replace(/\ /g, ""); keyword = keyword.replace(/\ /g, "");
......
...@@ -3,6 +3,7 @@ import { ...@@ -3,6 +3,7 @@ import {
ORDER_STATUS, ORDER_STATUS,
AFTER_SALE_STATUS, AFTER_SALE_STATUS,
AfterSaleStatusEnum, AfterSaleStatusEnum,
GoodsSource,
} from "~/constants/mine.js"; } from "~/constants/mine.js";
export function getOrderStatus({ export function getOrderStatus({
orderStatus, orderStatus,
...@@ -72,32 +73,32 @@ export function getOrder(orderStatus) { ...@@ -72,32 +73,32 @@ export function getOrder(orderStatus) {
return ORDER_STATUS[_status_] || {}; return ORDER_STATUS[_status_] || {};
} }
export function getAfterSaleStatus({ returnOrderStatus } = {}) { // export function getAfterSaleStatus({ returnOrderStatus } = {}) {
if (returnOrderStatus == 1000) { // if (returnOrderStatus == 1000) {
// 按钮:售后详情 // // 按钮:售后详情
return AfterSaleStatusEnum.PENDING_REVIEW; //售后---待审核 退款退货的return_order_status:1000:待审批且return_status退换货状态(1000:待审核) 仅退款的return_order_status:1000:待审批且refund_status 退款状态(1000:待审核 // return AfterSaleStatusEnum.PENDING_REVIEW; //售后---待审核 退款退货的return_order_status:1000:待审批且return_status退换货状态(1000:待审核) 仅退款的return_order_status:1000:待审批且refund_status 退款状态(1000:待审核
} else if (returnOrderStatus == 1001) { // } else if (returnOrderStatus == 1001) {
// 按钮:售后详情 // // 按钮:售后详情
return AfterSaleStatusEnum.PENDING_REVIEW_PASSED; //售后---待收货(审核通过) 退款退货的return_order_status:1001:审核通过 且return_status退换货状态(1001:待收货),仅退款的直接到退款完成/退款失败 // return AfterSaleStatusEnum.PENDING_REVIEW_PASSED; //售后---待收货(审核通过) 退款退货的return_order_status:1001:审核通过 且return_status退换货状态(1001:待收货),仅退款的直接到退款完成/退款失败
} else if (returnOrderStatus == 1005) { // } else if (returnOrderStatus == 1005) {
// 状态:售后前的状态(云中鹤不同意售后申请)按钮:售后、售后详情 // // 状态:售后前的状态(云中鹤不同意售后申请)按钮:售后、售后详情
return AfterSaleStatusEnum.PENDING_REVIEW_REJECTED; //售后 -- 审核不通过 退款退货的return_order_status:1005:审核不通过且return_status退换货状态(1008:审核不通过), 仅退款的return_order_status:1005 且refund_status 退款状态(1008:审核不通过 // return AfterSaleStatusEnum.PENDING_REVIEW_REJECTED; //售后 -- 审核不通过 退款退货的return_order_status:1005:审核不通过且return_status退换货状态(1008:审核不通过), 仅退款的return_order_status:1005 且refund_status 退款状态(1008:审核不通过
} else if (returnOrderStatus == 1003) { // } else if (returnOrderStatus == 1003) {
return AfterSaleStatusEnum.SUCCESS; // 已退款 退款退货的订单return_order_status:1003:已退款且return_status退换货状态(1002:已收货,1003:已退款),仅退款订单 return_order_status:1003:已退款且refund_status 退款状态1002:已退款, // return AfterSaleStatusEnum.SUCCESS; // 已退款 退款退货的订单return_order_status:1003:已退款且return_status退换货状态(1002:已收货,1003:已退款),仅退款订单 return_order_status:1003:已退款且refund_status 退款状态1002:已退款,
} else if (returnOrderStatus == 1006) { // } else if (returnOrderStatus == 1006) {
return AfterSaleStatusEnum.FAILED; // 退款失败 退款退货的return_order_status:1003:已退款 return_status退换货状态(1006:退款异常 ,,仅退款的return_order_status:1003:已退款 且refund_status 退款状态,1004:退款异常 // return AfterSaleStatusEnum.FAILED; // 退款失败 退款退货的return_order_status:1003:已退款 return_status退换货状态(1006:退款异常 ,,仅退款的return_order_status:1003:已退款 且refund_status 退款状态,1004:退款异常
} else { // } else {
return AfterSaleStatusEnum.DEFAULT; // return AfterSaleStatusEnum.DEFAULT;
} // }
} // }
export function getAfterSaleDetail(status) { // export function getAfterSaleDetail(status) {
let _status_ = status; // let _status_ = status;
if (typeof status === "object") { // if (typeof status === "object") {
_status_ = getAfterSaleStatus(status); // _status_ = getAfterSaleStatus(status);
} // }
return AFTER_SALE_STATUS[_status_] || {}; // return AFTER_SALE_STATUS[_status_] || {};
} // }
export function calcOrderProp(order){ export function calcOrderProp(order){
const { applyQty, sellQty, redeemPoints, freightAmount = 0 } = order; const { applyQty, sellQty, redeemPoints, freightAmount = 0 } = order;
...@@ -106,3 +107,18 @@ export function calcOrderProp(order){ ...@@ -106,3 +107,18 @@ export function calcOrderProp(order){
const ___totalPrice = (redeemPoints || 0) * ___qty + +freightAmount; const ___totalPrice = (redeemPoints || 0) * ___qty + +freightAmount;
return {___qty, ___price, ___totalPrice}; return {___qty, ___price, ___totalPrice};
} }
export const APIS = {
AFTER_SALE_DETAIL: "AFTER_SALE_DETAIL",
AFTER_SALE: "AFTER_SALE",
};
export const API_Methods = {
[GoodsSource.YZH]: {
[APIS.AFTER_SALE_DETAIL]:wx.p.api.shopmallApi.platformSaleDetail, //售后详情
[APIS.AFTER_SALE]:wx.p.api.shopmallApi.afterSalesPlatform// 售后
},
[GoodsSource.SELF]: {
[APIS.AFTER_SALE_DETAIL]:wx.p.api.shopmallApi.afterSaleDetail,//售后详情
[APIS.AFTER_SALE]:wx.p.api.shopmallApi.afterSale// 售后
}
};
...@@ -37,21 +37,31 @@ Component({ ...@@ -37,21 +37,31 @@ Component({
// 直接使用 ORDER_LIST 中的索引作为 tabIndex // 直接使用 ORDER_LIST 中的索引作为 tabIndex
const item = e.currentTarget.dataset.item; const item = e.currentTarget.dataset.item;
wx.p.router.go("/packageMine/pages/order/index/index", { wx.p.router.go("/packageMine/pages/order/index/index", {
tab:item, tab: item,
}); });
}, },
getOrderNumberList() { getOrderNumberList() {
const loginStatus = !wx.p.isLogin; const loginStatus = !wx.p.isLogin;
if (loginStatus) return; if (loginStatus) return;
wx.p.api.mineApi.getOrderNumberList().then((res) => { const userInfo = wx.p.storage.get("userInfo") || {};
this.setData({ let { merchantId, channelSource } = userInfo;
orderNumberList: [ const params = {
res.unPayCount, merchantId,
res.unShippedCount, pageSize: 1,
res.unReceivedCount, currentPage: 1,
res.unServiceCount, scoreSource: channelSource,
], };
const orderList = this.data.orderList;
orderList.forEach((item) => {
const p = { ...params, requestType: item.requestType };
wx.p.api.mineApi[item.requestMethod](p).then((data) => {
if(data.total){
item.___count = data.total;
this.setData({
orderList,
});
}
}); });
}); });
}, },
......
...@@ -16,7 +16,7 @@ ...@@ -16,7 +16,7 @@
<glsx-image webp src="/mine/{{item.image}}.png"></glsx-image> <glsx-image webp src="/mine/{{item.image}}.png"></glsx-image>
</view> </view>
<text class="order-content">{{item.my_order_text||item.text}}</text> <text class="order-content">{{item.my_order_text||item.text}}</text>
<text class="order-number" wx:if="{{orderNumberList[index] != 0 && orderNumberList}}">{{orderNumberList[index]}}</text> <text class="order-number" wx:if="{{item.___count}}">{{item.___count}}</text>
</view> </view>
</view> </view>
</view> </view>
......
...@@ -89,20 +89,6 @@ Page({ ...@@ -89,20 +89,6 @@ Page({
const { url } = e.currentTarget.dataset; const { url } = e.currentTarget.dataset;
wx.p.router.go(url); wx.p.router.go(url);
}, },
async getOrderNumberList() {
const loginStatus = !wx.p.isLogin;
if (loginStatus) return;
wx.p.api.mineApi.getOrderNumberList().then((res) => {
this.setData({
orderNumberList: [
res.unPayCount,
res.unShippedCount,
res.unReceivedCount,
res.unServiceCount,
],
});
});
},
// 切换门店 // 切换门店
changeMerchant() { changeMerchant() {
// 获取门店接口 门店数量大于1跳转切换,否则不需切换 // 获取门店接口 门店数量大于1跳转切换,否则不需切换
...@@ -126,11 +112,8 @@ Page({ ...@@ -126,11 +112,8 @@ Page({
} }
}); });
}, },
/** onShow:function() {
* 生命周期函数--监听页面显示 // this.getOrderNumberList();
*/
onShow() {
this.getOrderNumberList();
// this.toCheckMember(); // this.toCheckMember();
}, },
}); });
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!