Commit ef1c62c9 by liimin

refactor(售后): 重构售后相关页面和组件

- 修改了多个组件的样式和布局
- 优化了部分组件的属性和数据结构
- 调整了接口调用方式和参数
- 统一了按钮样式和交互逻辑
1 parent a2e3e68b
Showing 29 changed files with 544 additions and 395 deletions
...@@ -132,15 +132,13 @@ queryExpressList(data={}){ ...@@ -132,15 +132,13 @@ queryExpressList(data={}){
}, },
/** 确认收货 */ /** 确认收货 */
confirmReceipt(orderCode) { confirmReceipt(subOrderCode) {
return api.post({ return api.post({
method: `scrm.api.shopmall.weapp.order.confirmReceipt`, method: `scrm.api.shopmall.platform.confirm.receipt`,
orderCode subOrderCode
}) })
}, },
/**平台商城接口---取消售后 */ /**平台商城接口---取消售后 */
platformEditSale(data) { platformEditSale(data) {
return api.post({ return api.post({
......
export const ToolList = Object.freeze([{ export const ToolList = Object.freeze([
text: "我的地址", {
icon: "myAddress", text: "我的地址",
url: "/packageMine/pages/address/index/index", icon: "myAddress",
}, ]); url: "/packageMine/pages/address/index/index",
},
]);
export const OrderStatusEnum = { export const OrderStatusEnum = {
ALL: "0", ALL: "0",
...@@ -16,9 +18,16 @@ export const OrderStatusEnum = { ...@@ -16,9 +18,16 @@ export const OrderStatusEnum = {
AFTER_SALE_REJECTED: "10007", //售后审核不通过 AFTER_SALE_REJECTED: "10007", //售后审核不通过
AFTER_SALE_REFUNDED: "10008", //已退款 AFTER_SALE_REFUNDED: "10008", //已退款
AFTER_SALE_REFUNDED_FAILED: "10009", //退款失败 AFTER_SALE_REFUNDED_FAILED: "10009", //退款失败
AFTER_SALE_REVEAL: "10010" //所有其他状态 AFTER_SALE_REVEAL: "10010", //所有其他状态
};
export const AfterSaleStatusEnum = {
PENDING_REVIEW: "20000",
PENDING_REVIEW_PASSED: "20001",
PENDING_REVIEW_REJECTED: "20002",
SUCCESS: "20003",
FAILD: "20004",
DEFAULT:'22222'
}; };
export const OrderStatusTypes = { export const OrderStatusTypes = {
QUERY_TAB: "QUERY_TAB", // 查询订单列表TAB项 QUERY_TAB: "QUERY_TAB", // 查询订单列表TAB项
MY_ORDER: "MY_ORDER", // 我的 页面 我的订单 显示的项目 MY_ORDER: "MY_ORDER", // 我的 页面 我的订单 显示的项目
...@@ -86,8 +95,9 @@ export const ORDER_STATUS = { ...@@ -86,8 +95,9 @@ export const ORDER_STATUS = {
requestType: 6, // 查询订单列表TAB查询参数 requestType: 6, // 查询订单列表TAB查询参数
type: OrderStatusTypes.MY_ORDER, //我的 页面 我的订单 显示的项目 type: OrderStatusTypes.MY_ORDER, //我的 页面 我的订单 显示的项目
buttons: { buttons: {
[GoodsSource.SELF]: [ //自营商品 在商品列表对应的按钮 [GoodsSource.SELF]: [
OrderActionButtons.CONFIRM_RECEIVE //自营商品 在商品列表对应的按钮
OrderActionButtons.CONFIRM_RECEIVE,
], ],
}, },
}, },
...@@ -99,11 +109,13 @@ export const ORDER_STATUS = { ...@@ -99,11 +109,13 @@ export const ORDER_STATUS = {
requestType: 1, // 查询订单列表TAB查询参数 requestType: 1, // 查询订单列表TAB查询参数
type: OrderStatusTypes.MY_ORDER, //我的 页面 我的订单 显示的项目 type: OrderStatusTypes.MY_ORDER, //我的 页面 我的订单 显示的项目
buttons: { buttons: {
[GoodsSource.SELF]: [ //自营商品 在商品列表对应的按钮 [GoodsSource.SELF]: [
//自营商品 在商品列表对应的按钮
OrderActionButtons.CONFIRM_RECEIVE, OrderActionButtons.CONFIRM_RECEIVE,
// OrderActionButtons.SHOW_EXPRESS, // OrderActionButtons.SHOW_EXPRESS,
], ],
[GoodsSource.YZH]: [ //云中鹤商品 在商品列表对应的按钮 [GoodsSource.YZH]: [
//云中鹤商品 在商品列表对应的按钮
OrderActionButtons.CONFIRM_RECEIVE, OrderActionButtons.CONFIRM_RECEIVE,
// OrderActionButtons.SHOW_EXPRESS, // OrderActionButtons.SHOW_EXPRESS,
], ],
...@@ -116,11 +128,13 @@ export const ORDER_STATUS = { ...@@ -116,11 +128,13 @@ export const ORDER_STATUS = {
requestType: 4, // 查询订单列表TAB查询参数 requestType: 4, // 查询订单列表TAB查询参数
type: OrderStatusTypes.QUERY_TAB, // 查询订单列表显示的TAB项 type: OrderStatusTypes.QUERY_TAB, // 查询订单列表显示的TAB项
buttons: { buttons: {
[GoodsSource.SELF]: [ //自营商品 在商品列表对应的按钮 [GoodsSource.SELF]: [
//自营商品 在商品列表对应的按钮
// OrderActionButtons.SHOW_EXPRESS, // OrderActionButtons.SHOW_EXPRESS,
OrderActionButtons.AFTER_SALE, OrderActionButtons.AFTER_SALE,
], ],
[GoodsSource.YZH]: [ //云中鹤商品 在商品列表对应的按钮 [GoodsSource.YZH]: [
//云中鹤商品 在商品列表对应的按钮
// OrderActionButtons.SHOW_EXPRESS, // OrderActionButtons.SHOW_EXPRESS,
OrderActionButtons.AFTER_SALE, OrderActionButtons.AFTER_SALE,
], ],
...@@ -162,8 +176,14 @@ export const ORDER_STATUS = { ...@@ -162,8 +176,14 @@ export const ORDER_STATUS = {
tips: "您可以尝试再次提交退款申请", //售后详情提示语 tips: "您可以尝试再次提交退款申请", //售后详情提示语
image: "mine/order/error.png", //售后详情页面显示的状态图标 image: "mine/order/error.png", //售后详情页面显示的状态图标
buttons: { buttons: {
[GoodsSource.SELF]: [OrderActionButtons.AFTER_SALE, OrderActionButtons.AFTER_SALE_REJECTED], //自营商品 在商品列表对应的按钮 [GoodsSource.SELF]: [
[GoodsSource.YZH]: [OrderActionButtons.AFTER_SALE, OrderActionButtons.AFTER_SALE_REJECTED], //云中鹤商品 在商品列表对应的按钮 OrderActionButtons.AFTER_SALE,
// OrderActionButtons.AFTER_SALE_REJECTED,
], //自营商品 在商品列表对应的按钮
[GoodsSource.YZH]: [
OrderActionButtons.AFTER_SALE,
// OrderActionButtons.AFTER_SALE_REJECTED,
], //云中鹤商品 在商品列表对应的按钮
}, },
}, },
[OrderStatusEnum.AFTER_SALE_REFUNDED]: { [OrderStatusEnum.AFTER_SALE_REFUNDED]: {
...@@ -198,7 +218,82 @@ export const ORDER_STATUS = { ...@@ -198,7 +218,82 @@ export const ORDER_STATUS = {
}, },
}; };
export const RefundReason = [{ export const AfterSaleActionButtons = {
CANCLE_AFTER_SALE: {
text: "撤销申请",
class: "default-btn",
handler: "cancelSaleApply",
},
RE_SEND: {
text: "重新申请",
type: "confirmReceive",
class: "default-btn",
handler: "toAfterSale",
},
REVIEW_REJECTED: {
text: "审核不通过",
type: "after_sale_rejected",
class: "default-btn",
handler: "toAfterSale",
},
};
export const AFTER_SALE_STATUS = {
[AfterSaleStatusEnum.PENDING_REVIEW]: {
text: "售后中",
status: AfterSaleStatusEnum.PENDING_REVIEW,
tips: "等待平台处理",
image: "status/loading.png",
buttons: {
[GoodsSource.SELF]: [AfterSaleActionButtons.CANCLE_AFTER_SALE], //自营商品 在商品列表对应的按钮
[GoodsSource.YZH]: [AfterSaleActionButtons.CANCLE_AFTER_SALE], //云中鹤商品 在商品列表对应的按钮
},
},
[AfterSaleStatusEnum.PENDING_REVIEW_PASSED]: {
text: "售后中",
status: AfterSaleStatusEnum.PENDING_REVIEW_PASSED,
tips: "等待平台处理", //售后详情提示语
image: "status/loading.png", //售后详情页面显示的状态图标
buttons: null,
},
[AfterSaleStatusEnum.PENDING_REVIEW_REJECTED]: {
text: "审核不通过",
status: AfterSaleStatusEnum.PENDING_REVIEW_REJECTED,
tips: "等待平台处理", //售后详情提示语
image: "status/error.png", //售后详情页面显示的状态图标
buttons: {
[GoodsSource.SELF]: [AfterSaleActionButtons.RE_SEND], //自营商品 在商品列表对应的按钮
[GoodsSource.YZH]: [AfterSaleActionButtons.RE_SEND], //云中鹤商品 在商品列表对应的按钮
},
},
[AfterSaleStatusEnum.SUCCESS]: {
text: "已退款",
status: OrderStatusEnum.AFTER_SALE_WAIT_RECEIVE,
tips: "钱款已退回至原账户", //售后详情提示语
image: "status/success.png", //售后详情页面显示的状态图标
buttons: null,
},
[AfterSaleStatusEnum.FAILD]: {
text: "退款失败",
status: OrderStatusEnum.AFTER_SALE_REJECTED,
tips: "您可以尝试再次提交退款申请", //售后详情提示语
image: "mine/order/error.png", //售后详情页面显示的状态图标
buttons: {
[GoodsSource.SELF]: [AfterSaleActionButtons.RE_SEND], //自营商品 在商品列表对应的按钮
[GoodsSource.YZH]: [AfterSaleActionButtons.RE_SEND], //云中鹤商品 在商品列表对应的按钮
},
},
[AfterSaleStatusEnum.DEFAULT]: {
text: "售后中",
status: AfterSaleStatusEnum.DEFAULT,
tips: "等待平台处理", //售后详情提示语
image: "status/loading.png", //售后详情页面显示的状态图标
buttons: null,
},
};
export const RefundReason = [
{
text: "商品无货", text: "商品无货",
value: 1001, value: 1001,
}, },
...@@ -264,70 +359,71 @@ export const RefundReason = [{ ...@@ -264,70 +359,71 @@ export const RefundReason = [{
}, },
]; ];
export const RefundReasonKeyList = { export const RefundReasonKeyList = {
1001: "商品无货", 1001: "商品无货",
1002: "发货时间问题", 1002: "发货时间问题",
1003: "不想要了/不喜欢", 1003: "不想要了/不喜欢",
1004: "商品信息填写错误", 1004: "商品信息填写错误",
1005: "地址信息填写错误", 1005: "地址信息填写错误",
1006: "商品降价", 1006: "商品降价",
1007: "其他", 1007: "其他",
1008: "尺码不合适", 1008: "尺码不合适",
1009: "无理由退货", 1009: "无理由退货",
1010: "发票问题", 1010: "发票问题",
1011: "商品与页面描述不符", 1011: "商品与页面描述不符",
1012: "发错货", 1012: "发错货",
1013: "质量问题", 1013: "质量问题",
1014: "买错尺码/颜色/型号", 1014: "买错尺码/颜色/型号",
1015: "商品缺少或破损", 1015: "商品缺少或破损",
1016: "买错了" 1016: "买错了",
}; };
export const RefundStatus = [{ export const RefundStatus = [
status: 1, {
title: "待处理", status: 1,
tips: "等待平台处理", title: "待处理",
image: "status/loading.png", tips: "等待平台处理",
}, image: "status/loading.png",
{ },
status: 2, {
title: "待发货", status: 2,
tips: "等待平台处理", title: "待发货",
image: "status/loading.png", tips: "等待平台处理",
}, image: "status/loading.png",
{ },
status: 3, {
title: "待确认收到退货", status: 3,
tips: "等待平台处理", title: "待确认收到退货",
image: "status/loading.png", tips: "等待平台处理",
}, image: "status/loading.png",
{ },
status: 4, {
title: "退款中", status: 4,
tips: "等待平台处理", title: "退款中",
image: "status/loading.png", tips: "等待平台处理",
}, image: "status/loading.png",
{ },
status: 5, {
title: "已退款", status: 5,
tips: "钱款已退回至原账户", title: "已退款",
image: "status/success.png", tips: "钱款已退回至原账户",
}, image: "status/success.png",
{ },
status: 6, {
title: "退款失败", status: 6,
tips: "您可以尝试再次提交退款申请", title: "退款失败",
image: "status/fail.png", tips: "您可以尝试再次提交退款申请",
}, image: "status/fail.png",
{ },
status: 7, {
title: "审核不通过", status: 7,
tips: "您可以尝试再次提交退款申请", title: "审核不通过",
image: "status/fail.png", tips: "您可以尝试再次提交退款申请",
}, image: "status/fail.png",
]; },
];
export const ExpressList = [{ export const ExpressList = [
{
value: 0, value: 0,
text: "圆通快递", text: "圆通快递",
}, },
...@@ -361,20 +457,21 @@ export const ExpressList = [{ ...@@ -361,20 +457,21 @@ export const ExpressList = [{
}, },
]; ];
export const AfterSaleObj = [{ export const AfterSaleObj = [
{
title: "退款原因", title: "退款原因",
key: "returnReasonType", key: "returnReasonType",
enum: RefundReasonKeyList enum: RefundReasonKeyList,
}, },
{ {
title: "退款金额", title: "退款金额",
key: "refundPoints", key: "refundPoints",
unit: '积分' unit: "积分",
}, },
{ {
title: "退款数量", title: "退款数量",
key: "applyQty", key: "applyQty",
unit: '件' unit: "件",
}, },
{ {
title: "售后编号", title: "售后编号",
...@@ -390,7 +487,8 @@ export const AfterSaleObj = [{ ...@@ -390,7 +487,8 @@ export const AfterSaleObj = [{
}, },
]; ];
export const AddressInfo = [{ export const AddressInfo = [
{
title: "地址", title: "地址",
key: "address", key: "address",
}, },
...@@ -403,7 +501,8 @@ export const AddressInfo = [{ ...@@ -403,7 +501,8 @@ export const AddressInfo = [{
key: "phone", key: "phone",
}, },
]; ];
export const OrderStatus = [{ export const OrderStatus = [
{
title: "待付款", title: "待付款",
value: "1", value: "1",
image: "mine/order-wait.png", image: "mine/order-wait.png",
...@@ -463,4 +562,4 @@ export const OrderStatus = [{ ...@@ -463,4 +562,4 @@ export const OrderStatus = [{
image: "mine/order-close.png", image: "mine/order-close.png",
tips: "售后完成", tips: "售后完成",
}, },
];
\ No newline at end of file \ No newline at end of file
];
import { getAfterSaleDetail } from "~/packageMine/pages/order/utils";
Page({ Page({
/** /**
* 页面的初始数据 * 页面的初始数据
...@@ -6,107 +7,108 @@ Page({ ...@@ -6,107 +7,108 @@ Page({
order: { order: {
express_no: "", express_no: "",
}, },
// Mock数据用于页面展示 orderInfo: {},
orderInfo: {}
}, },
/** /**
* 生命周期函数--监听页面加载 * 生命周期函数--监听页面加载
*/ */
onLoad: function (options) { onLoad: function (options) {
wx.p.router.getRouterParams(options).then(params => { wx.p.router.getRouterParams(options).then((params) => {
if (params) { if (params) {
this.setData({ this.setData({
...params ...params,
}) });
this.getOrderAfterSaleDetail(params.subOrderCode) this.getOrderAfterSaleDetail(params.subOrderCode);
} }
});
})
}, },
submitlogistics() { submitlogistics() {
this.getOrderAfterSaleDetail() this.getOrderAfterSaleDetail();
}, },
getOrderAfterSaleDetail() { getOrderAfterSaleDetail() {
wx.p.wxApi.showLoading("加载中..."); wx.p.wxApi.showLoading("加载中...");
let { let { goodsSource, tparReturnOrderCode, subOrderCode } = this.data,
goodsSource, Methods = goodsSource == 2 ? "afterSaleDetail" : "platformSaleDetail";
tparReturnOrderCode,
subOrderCode
} = this.data,
Methods = goodsSource == 2 ? 'afterSaleDetail' : 'platformSaleDetail'
wx.p.api.shopmallApi[Methods]({ wx.p.api.shopmallApi[Methods]({
subOrderCode, subOrderCode,
tparReturnOrderCode tparReturnOrderCode,
}).then((res) => { }).then((res) => {
wx.hideLoading(); 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
} else if (res.returnOrderStatus == 1003 && res.outRefundType == 0) { // } else if (res.returnOrderStatus == 1003 && res.outRefundType == 0) {
status = 1 // status = 1
} 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
} // }
let str = '' const { returnOrderStatus } = res;
const status = getAfterSaleDetail({ returnOrderStatus });
const button = status.buttons?.[goodsSource][0]
// button.action = this[this.button.handler]
let str = "";
if (res.sendbackAddressModel) { if (res.sendbackAddressModel) {
const { const { sendbackAddressModel } = res;
sendbackAddressModel str = `${sendbackAddressModel.provinceName}${sendbackAddressModel.cityName}${sendbackAddressModel.countyName}${sendbackAddressModel.address}`;
} = res
str = `${sendbackAddressModel.provinceName}${sendbackAddressModel.cityName}${sendbackAddressModel.countyName}${sendbackAddressModel.address}`
} }
res.addressInfo = str res.addressInfo = str;
this.setData({ this.setData({
orderInfo: res, orderInfo: res,
status, status,
button
}); });
}); });
}, },
confirm() { confirm() {
const { // const { status, orderInfo } = this.data;
status, // if (status == 0) {
orderInfo // this.cancelSaleApply();
} = this.data // } else if (status == 2) {
if (status == 0) { // wx.p.router.go(
this.cancelSaleApply() // "/packageMine/pages/order/afterSale_step_two/afterSale_step_two",
} else if (status == 2) { // orderInfo
wx.p.router.go( // );
// }
// this.cancelSaleApply()
this[this.button.handler]()
},
toAfterSale(){
const { orderInfo } = this.data;
wx.p.router.go(
"/packageMine/pages/order/afterSale_step_two/afterSale_step_two", "/packageMine/pages/order/afterSale_step_two/afterSale_step_two",
orderInfo orderInfo
) );
}
}, },
/**撤销申请 */ /**撤销申请 */
cancelSaleApply() { cancelSaleApply() {
const { const { orderInfo } = this.data;
orderInfo
} = this.data
let para = { let para = {
tparReturnOrderCode: orderInfo.tparReturnOrderCode tparReturnOrderCode: orderInfo.tparReturnOrderCode,
} };
wx.showModal({ wx.showModal({
title: '提示', title: "提示",
content: `请确认是否撤销申请`, content: `请确认是否撤销申请`,
confirmColor: '#F13C3D' confirmColor: "#F13C3D",
}).then((res) => {
if (res.confirm) {
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.back()
}
})
}
}).catch(() => {
wx.p.wxApi.showToast('已取消')
}) })
.then((res) => {
if (res.confirm) {
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.back();
}
});
}
})
.catch(() => {
wx.p.wxApi.showToast("已取消");
});
}, },
previewImage(e) { previewImage(e) {
let params = e.detail; // 从组件传递的数据 let params = e.detail; // 从组件传递的数据
...@@ -114,9 +116,7 @@ Page({ ...@@ -114,9 +116,7 @@ Page({
}, },
onExpressNoInput(e) { onExpressNoInput(e) {
const { const { value } = e.detail;
value
} = e.detail;
this.setData({ this.setData({
"order.express_no": value, "order.express_no": value,
}); });
...@@ -126,4 +126,4 @@ Page({ ...@@ -126,4 +126,4 @@ Page({
// 提交物流信息的处理逻辑 // 提交物流信息的处理逻辑
console.log("提交物流信息"); console.log("提交物流信息");
}, },
});
\ No newline at end of file \ No newline at end of file
});
<block wx:if="{{orderInfo}}"> <block wx:if="{{orderInfo}}">
<view class="layout isFullSucreen"> <view class="layout isFullSucreen">
<!-- 退款状态组件 --> <!-- 退款状态组件 -->
<refund-status refundStatus="{{status}}"></refund-status> <refund-status status="{{status}}"></refund-status>
<!-- 退货地址和物流信息组件 --> <!-- 退货地址和物流信息组件 -->
<block wx:if="{{orderInfo.returnType==1001}}"> <block wx:if="{{orderInfo.returnType==1001}}">
<return-address-box order-info="{{orderInfo}}" bindsubmitlogistics="submitlogistics"/> <return-address-box order-info="{{orderInfo}}"/>
</block> </block>
<!-- 售后信息组件 --> <!-- 售后信息组件 -->
<after-sale-info-box order-info="{{orderInfo}}"></after-sale-info-box> <after-sale-info-box order-info="{{orderInfo}}"></after-sale-info-box>
<!-- 重新提交按钮组件 --> <!-- 重新提交按钮组件 -->
<re-submit-button wx:if="{{status!=1}}" bindresubmit="confirm" status="{{status}}"></re-submit-button> <re-submit-button wx:if="{{button}}" bindresubmit="confirm" button="{{button}}"></re-submit-button>
</view> </view>
</block> </block>
\ No newline at end of file \ No newline at end of file
...@@ -2,20 +2,22 @@ ...@@ -2,20 +2,22 @@
<view class="text-box"> <view class="text-box">
<view class="title">售后信息</view> <view class="title">售后信息</view>
<content item="{{orderInfo.orderGoods}}" /> <content item="{{orderInfo.orderGoods}}" />
<block wx:for="{{afterSaleObj}}" wx:key="index"> <view style="margin-top: 32rpx;">
<view class="item"> <block wx:for="{{afterSaleObj}}" wx:key="index">
<view class="label">{{item.title}}:</view> <view class="item">
<view class="value"> <view class="label">{{item.title}}:</view>
<block wx:if="{{item.enum}}">{{item.enum[orderInfo[item.key]]}}</block> <view class="value">
<block wx:elif="{{item.isArray}}"> <block wx:if="{{item.enum}}">{{item.enum[orderInfo[item.key]]}}</block>
<block wx:for="{{orderInfo[item.key]}}" wx:key="index" wx:for-item="i"> <block wx:elif="{{item.isArray}}">
<text>{{i}};</text> <block wx:for="{{orderInfo[item.key]}}" wx:key="index" wx:for-item="i">
<text>{{i}};</text>
</block>
</block> </block>
</block> <block wx:else>{{orderInfo[item.key] || ''}}<text>{{item.unit}}</text></block>
<block wx:else>{{orderInfo[item.key] || ''}}<text>{{item.unit}}</text></block> </view>
</view> </view>
</view> </block>
</block> </view>
</view> </view>
<block wx:if="{{orderInfo.imgUrls && orderInfo.imgUrls.length}}"> <block wx:if="{{orderInfo.imgUrls && orderInfo.imgUrls.length}}">
<view class="photo-box"> <view class="photo-box">
......
...@@ -12,6 +12,7 @@ ...@@ -12,6 +12,7 @@
font-weight: 600; font-weight: 600;
font-size: 32rpx; font-size: 32rpx;
color: #282829; color: #282829;
margin-bottom: 24rpx;
} }
.text-box .item { .text-box .item {
......
Component({ Component({
properties: { properties: {
status: { button: {
type: String, type: Object,
value: "" value: {}
}, },
}, },
methods: { methods: {
......
<view class="default-btn" bindtap="onReSubmit"> {{status==2?'重新申请':'撤销申请'}}</view>
\ No newline at end of file \ No newline at end of file
<view class="{{button.class}}" bindtap="onReSubmit"> {{button.text}}</view>
\ No newline at end of file \ No newline at end of file
import { RefundStatus } from "~/constants/mine.js"; // import { RefundStatus } from "~/constants/mine.js";
Component({ Component({
properties: { properties: {
refundStatus: { status: {
type: String, type: Object,
value: "", value: {},
observer: function (status) { observer: function (status) {
this.updateStatus(status); console.log("🚀 ~ status:", status)
// this.updateStatus(status);
}, },
}, },
}, },
data: { data: {
refund: {}, // refund: {},
}, },
methods: { methods: {
updateStatus(status) { // updateStatus(status) {
this.setData({ // this.setData({
refund: RefundStatus[status], // refund: RefundStatus[status],
}); // });
}, // },
}, },
}); });
<view class="status-box"> <view class="status-box">
<Status image="{{refund.image}}" title="{{refund.title}}" tips="{{refund.tips}}"/> <Status image="{{status.image}}" title="{{status.text}}" tips="{{status.tips}}"/>
</view> </view>
import { import { AddressInfo } from "~/constants/mine.js";
ExpressList,
AddressInfo
} from "~/constants/mine.js";
Component({ Component({
properties: { properties: {
orderInfo: { orderInfo: {
type: Object, type: Object,
value: {}, value: {}
observer(n) {
console.log('退货物流')
}
}, },
}, },
data: { data: {
isShowExpressSelector: false, isShowExpressSelector: false,
express: { express: {
expressName: '', expressName: "",
expressNo: '' expressNo: "",
}, },
expressList: ExpressList, expressList: [],
address: Object.freeze(AddressInfo), address: Object.freeze(AddressInfo),
addressInfo: {
name: "张三",
phone: "12345678901",
address: "广东省深圳市南山区",
},
}, },
attached() { attached() {
this.queryExpressList() this.queryExpressList();
}, },
methods: { methods: {
queryExpressList() { queryExpressList() {
wx.p.api.shopmallApi.queryExpressList().then(res => { wx.p.api.shopmallApi.queryExpressList().then((res) => {
let arr = [] let arr = [];
if (res) { if (res) {
arr = res.map(el => { arr = res.map((el) => {
return { return {
text: el.expressName, text: el.expressName,
value: el.expressCode value: el.expressCode,
} };
}) });
} }
this.setData({ this.setData({
expressList: arr || [] expressList: arr || [],
}) });
}) });
}, },
onShowExpressSelector() { onShowExpressSelector() {
this.setData({ this.setData({
...@@ -55,50 +43,42 @@ Component({ ...@@ -55,50 +43,42 @@ Component({
}, },
onSubmitLogistics() { onSubmitLogistics() {
const { const { express, orderInfo } = this.data;
express,
orderInfo
} = this.data
let para = { let para = {
tparReturnOrderCode: orderInfo.tparReturnOrderCode, tparReturnOrderCode: orderInfo.tparReturnOrderCode,
expressCode: express.expressCode, expressCode: express.expressCode,
expressName: express.expressName, expressName: express.expressName,
expressNo: express.expressNo, expressNo: express.expressNo,
} };
wx.p.wxApi.showLoading('提交中') wx.p.wxApi.showLoading("提交中");
wx.p.api.shopmallApi.addDelivery(para).then((res) => {
wx.p.api.shopmallApi.addDelivery(para).then(res => {
wx.p.wxApi.hideLoading(); wx.p.wxApi.hideLoading();
if (res) { if (res) {
wx.p.wxApi.showToast('提交成功') wx.p.wxApi.showToast("提交成功");
this.triggerEvent("submitlogistics"); this.triggerEvent("submitlogistics");
} }
}) });
}, },
onExpressNoInput(e) { onExpressNoInput(e) {
this.setData({ this.setData({
'express.expressNo': e.detail.value "express.expressNo": e.detail.value,
}) });
}, },
onSelectExpress(e) { onSelectExpress(e) {
this.setData({ this.setData({
isShowExpressSelector: false, isShowExpressSelector: false,
}); });
const { const { expressList } = this.data;
expressList
} = this.data;
const expressListUpdated = expressList.map((item) => { const expressListUpdated = expressList.map((item) => {
if (item.value == e.detail.value) { if (item.value == e.detail.value) {
item.type = "warn"; item.type = "warn";
console.log(item) console.log(item);
this.setData({ this.setData({
express: { express: {
...this.data.express, ...this.data.express,
expressName: item.text, expressName: item.text,
expressCode: item.value, expressCode: item.value,
}, },
}); });
} else { } else {
...@@ -112,4 +92,4 @@ Component({ ...@@ -112,4 +92,4 @@ Component({
}); });
}, },
}, },
});
\ No newline at end of file \ No newline at end of file
});
...@@ -2,6 +2,8 @@ ...@@ -2,6 +2,8 @@
"component": true, "component": true,
"usingComponents": { "usingComponents": {
"mp-actionSheet": "weui-miniprogram/actionsheet/actionsheet", "mp-actionSheet": "weui-miniprogram/actionsheet/actionsheet",
"Copy": "../../../components/Copy/Copy" "Copy": "../../../components/Copy/Copy",
"mp-cells": "weui-miniprogram/cells/cells",
"mp-cell": "weui-miniprogram/cell/cell"
} }
} }
\ No newline at end of file \ No newline at end of file
...@@ -41,7 +41,7 @@ ...@@ -41,7 +41,7 @@
} }
.item .label { .item .label {
width: 140rpx; width: 200rpx;
} }
.item .value { .item .value {
......
...@@ -8,13 +8,13 @@ ...@@ -8,13 +8,13 @@
<view class="item"> <view class="item">
<view class="label">{{item.title}}:</view> <view class="label">{{item.title}}:</view>
<view class="value"> <view class="value">
<view>{{orderInfo.addressInfo[item.key]||'-'}}</view> <view>{{orderInfo.sendbackAddressModel[item.key]||'-'}}</view>
</view> </view>
</view> </view>
</block> </block>
<!-- 判断是否有快递单号 --> <!-- 判断是否有快递单号 -->
<block wx:if="{{!orderInfo.expressNo}}"> <block wx:if="{{!orderInfo.expressNo}}">
<view class="title">请填写退货物流</view> <view class="title" style="padding-top:32rpx;">请填写退货物流</view>
<view class="form"> <view class="form">
<view class="item"> <view class="item">
<view class="label">物流公司:</view> <view class="label">物流公司:</view>
......
import { import { afterSaleMixin } from "~/mixins/index";
afterSaleMixin import { RefundReason, GoodsSource } from "~/constants/mine.js";
} from "~/mixins/index"; const Methods = {
import { [GoodsSource.YZH]: wx.p.api.shopmallApi.afterSalesPlatform,
RefundReason [GoodsSource.SELF]: wx.p.api.shopmallApi.afterSale,
} from "~/constants/mine.js"; };
Page({ Page({
behaviors: [afterSaleMixin], behaviors: [afterSaleMixin],
/** /**
* 页面的初始数据 * 页面的初始数据
*/ */
data: { data: {
imgUrls: [],
RefundReason: Object.freeze(RefundReason), RefundReason: Object.freeze(RefundReason),
method:null,
}, },
/** /**
* 生命周期函数--监听页面加载 * 生命周期函数--监听页面加载
*/ */
onLoad: function (options) { onLoad: function (options) {
let imgUrls = []; wx.p.router.getRouterParams(options).then((orderObj) => {
wx.p.router.getRouterParams(options).then((params) => { orderObj.returnType = 1001
if (params.imgUrls) imgUrls = params.imgUrls;
this.setData({ this.setData({
orderObj: { orderObj,
...params, method:Methods[orderObj.goodsSource],
returnType:1001//数据初始化 // maxRefundCount: orderObj.refundCount,
},
imgUrls,
maxRefundCount: params.refundCount,
}); });
}); });
}, },
...@@ -38,44 +33,37 @@ Page({ ...@@ -38,44 +33,37 @@ Page({
}, },
changeRefundCount(e) { changeRefundCount(e) {
this.setData({ this.setData({
"orderObj.applyQty": e.detail.value "orderObj.applyQty": e.detail.value,
}); });
}, },
radioChange(e) { radioChange(e) {
console.log(e) const value = e.detail.value;
const value = e.detail.value
this.setData({ this.setData({
"orderObj.returnReasonType": value, "orderObj.returnReasonType": value,
}); });
}, },
changeReturnType(e) { changeReturnType(e) {
const returnType = e.detail.returnType const returnType = e.detail.returnType;
this.setData({ this.setData({
"orderObj.returnType": returnType, "orderObj.returnType": returnType,
}); });
}, },
showRefundCount() { showRefundCount() {
this.setData({ // this.setData({
showRefundCount: true, // showRefundCount: true,
}); // });
}, },
del(e) { del(e) {
let { let { index } = e.detail;
index let { imgUrls } = this.data.orderObj;
} = e.detail;
let {
imgUrls
} = this.data;
imgUrls.splice(index, 1); imgUrls.splice(index, 1);
this.setData({ this.setData({
imgUrls, "orderObj.imgUrls": imgUrls,
}); });
}, },
upLoad() { upLoad() {
let _this = this; let _this = this;
let { let { imgUrls = [] } = this.data.orderObj;
imgUrls
} = this.data;
wx.chooseImage({ wx.chooseImage({
count: 1, count: 1,
}).then((res) => { }).then((res) => {
...@@ -93,11 +81,10 @@ Page({ ...@@ -93,11 +81,10 @@ Page({
}) })
.then((img) => { .then((img) => {
wx.p.wxApi.hideLoading(); wx.p.wxApi.hideLoading();
console.log(img);
imgUrls.push(img); imgUrls.push(img);
_this.setData({ _this.setData({
imgUrls, imgUrls,
'orderObj.imgUrls': imgUrls "orderObj.imgUrls": imgUrls,
}); });
}); });
}, },
...@@ -106,38 +93,28 @@ Page({ ...@@ -106,38 +93,28 @@ Page({
}, },
check() { check() {
let obj = { let obj = {
returnReasonType: '请选择退款原因' returnReasonType: "请选择退款原因",
}, },
{ { orderObj } = this.data;
orderObj Object.keys(obj).forEach((key) => {
} = this.data;
Object.keys(obj).forEach(key => {
if (!orderObj[key]) { if (!orderObj[key]) {
wx.p.wxApi.showToast(obj[key]) wx.p.wxApi.showToast(obj[key]);
return return;
} }
}) });
}, },
submit() { submit() {
let { this.check();
orderObj, const orderObj = this.data.orderObj;
imgUrls if (orderObj.goodsSource === GoodsSource.YZH) {
} = this.data, delete orderObj.refundPoints;
Methods = orderObj.goodsSource == 2 ? 'afterSale' : 'afterSalesPlatform'; }
orderObj.imgUrls = imgUrls, this.data.method(orderObj).then(({ code, data, message }) => {
// orderObj.subOrderCode='GLS960387803345330176'
this.check()
wx.p.api.shopmallApi[Methods](orderObj).then(({
code,
data,
message
}) => {
if (code == "0") { if (code == "0") {
wx.p.wxApi.showToast("申请成功!"); wx.p.wxApi.showToast("申请成功!");
setTimeout(() => { setTimeout(() => {
wx.p.router.back((prevPage) => { wx.p.router.back((prevPage) => {
console.log(prevPage) console.log(prevPage);
prevPage.clearData && prevPage.clearData(); prevPage.clearData && prevPage.clearData();
}, 2); }, 2);
}, 1.5 * 1000); }, 1.5 * 1000);
...@@ -146,4 +123,4 @@ Page({ ...@@ -146,4 +123,4 @@ Page({
} }
}); });
}, },
});
\ No newline at end of file \ No newline at end of file
});
...@@ -8,7 +8,7 @@ ...@@ -8,7 +8,7 @@
<!-- 退款信息组件 --> <!-- 退款信息组件 -->
<refund-info-box <refund-info-box
orderObj="{{orderObj}}" orderObj="{{orderObj}}"
refund-count="{{orderObj.applyQty}}" refund-count="{{orderObj.applyQty||orderObj.sellQty}}"
max-refund-count="{{maxRefundCount}}" max-refund-count="{{maxRefundCount}}"
refund-price="{{orderObj.refundPoints}}" refund-price="{{orderObj.refundPoints}}"
show-refund-count="{{showRefundCount}}" show-refund-count="{{showRefundCount}}"
...@@ -27,7 +27,7 @@ ...@@ -27,7 +27,7 @@
<view class="title">上传图片</view> <view class="title">上传图片</view>
<!-- 图片上传组件 --> <!-- 图片上传组件 -->
<image-upload-box img-urls="{{imgUrls}}" bindpreviewimage="previewImage" binddel="del" bindupload="upLoad"></image-upload-box> <image-upload-box img-urls="{{orderObj.imgUrls}}" bindpreviewimage="previewImage" binddel="del" bindupload="upLoad"></image-upload-box>
<view class="btn text-center" bindtap="submit">提交</view> <view class="btn text-center" bindtap="submit">提交</view>
</view> </view>
......
...@@ -15,7 +15,7 @@ ...@@ -15,7 +15,7 @@
<view class="price">{{refundCount}}件</view> <view class="price">{{refundCount}}件</view>
修改数量 修改数量
</view> </view>
<Stepper wx:else count="{{refundCount}}" min="1" max="10" bindchange="onChangeRefundCount" data-index="{{index}}"></Stepper> <!-- <Stepper wx:else count="{{refundCount}}" min="1" max="10" bindchange="onChangeRefundCount" data-index="{{index}}"></Stepper> -->
</view> </view>
</view> </view>
<view class="box-item"> <view class="box-item">
......
const {
mockDeliveryInfoData
} = require("./mock.js");
const LOGISTICS_STATUS = { const LOGISTICS_STATUS = {
1000: '待揽件', 1000: '待揽件',
1001: '已揽件', 1001: '已揽件',
......
...@@ -17,6 +17,6 @@ ...@@ -17,6 +17,6 @@
</block> </block>
</view> </view>
<view class="order-bottom"> <view class="order-bottom">
<order-action-buttons item="{{orderInfo}}" /> <order-action-buttons order="{{orderInfo}}" />
</view> </view>
</view> </view>
\ No newline at end of file \ No newline at end of file
...@@ -3,5 +3,5 @@ ...@@ -3,5 +3,5 @@
共{{item.sellQty||item.applyQty}}件,实付款 共{{item.sellQty||item.applyQty}}件,实付款
<text class="price">{{item.redeemPoints||'--'}}积分</text> <text class="price">{{item.redeemPoints||'--'}}积分</text>
</view> </view>
<order-action-buttons item="{{item}}" has-user-info="{{hasUserInfo}}" /> <order-action-buttons order="{{item}}" has-user-info="{{hasUserInfo}}" />
</view> </view>
\ No newline at end of file \ No newline at end of file
...@@ -2,10 +2,10 @@ ...@@ -2,10 +2,10 @@
<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}}" data-item="{{orderItem}}">{{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-index="{{index}}" data-item="{{orderItem}}">{{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
...@@ -33,7 +33,6 @@ Component({ ...@@ -33,7 +33,6 @@ Component({
methods: { methods: {
// 跳转到订单详情 // 跳转到订单详情
onJump(e) { onJump(e) {
console.log(e)
let { let {
item, item,
} = e.currentTarget.dataset; } = e.currentTarget.dataset;
......
<view class="item" catchtap="onJump" data-item="{{item}}"> <view class="item" catchtap="onJump" data-item="{{item}}">
<top item="{{item}}" after-sale-status="{{afterSaleStatus}}" status-enum="{{statusEnum}}"></top> <top item="{{item}}"></top>
<content item="{{item}}"></content> <content item="{{item}}"></content>
<bottom item="{{item}}" /> <bottom item="{{item}}" />
</view> </view>
\ No newline at end of file \ No newline at end of file
// packageMine/pages/order/index/components/top/top.js // packageMine/pages/order/index/components/top/top.js
import { getOrder } from "~/packageMine/pages/order/utils";
Component({ Component({
/** /**
* 组件的属性列表 * 组件的属性列表
...@@ -6,29 +7,51 @@ Component({ ...@@ -6,29 +7,51 @@ Component({
properties: { properties: {
item: { item: {
type: Object, type: Object,
value: {} value: {},
observer: function (v) {
v && this.getStatus();
},
}, },
afterSaleStatus: { afterSaleStatus: {
type: Object, type: Object,
value: {} value: {},
}, },
statusEnum: { statusEnum: {
type: Object, type: Object,
value: {} value: {},
} },
}, },
/** /**
* 组件的初始数据 * 组件的初始数据
*/ */
data: { data: {
status: "",
}, },
/** /**
* 组件的方法列表 * 组件的方法列表
*/ */
methods: { methods: {
getStatus() {
let {
orderStatus,
cancelStatus,
returnStatus,
refundStatus,
returnOrderStatus,
} = this.data.item;
const _order = getOrder({
orderStatus,
cancelStatus,
returnStatus,
refundStatus,
returnOrderStatus,
});
console.log(_order);
this.setData({
status: _order.text,
});
},
} }
})
\ No newline at end of file \ No newline at end of file
});
<view class="top"> <view class="top">
<view class="name">订单编号:{{item.subOrderCode}}</view> <view class="name">订单编号:{{item.subOrderCode}}</view>
<!-- 订单状态 orderStatus(订单状态(1001:待支付 1002:待审核,1003:审核不通过,1004:已取消(交易失败) ,1005:订单异常,1006:待处理,1007: 待发货,1008:已发货,1009:已完成(交易成功),1010:售后处理中,1012 订单关闭) <view class="status">{{status}}</view>
售后订单状态 afterSaleStatus(1:待审核;2:审核通过;3:审核不通过;4:待确认收到退货;5:退款中;6:已退款;7:退款失败)
-->
<view class="status">{{item.orderStatus ?statusEnum[item.orderStatus]: afterSaleStatus[item.returnOrderStatus]
}}</view>
</view> </view>
\ No newline at end of file \ No newline at end of file
// packageMine/pages/order/index/index.js // packageMine/pages/order/index/index.js
import { import { orderMixin } from "~/mixins/index";
orderMixin import { ORDER_STATUS, OrderStatusTypes } from "~/constants/mine.js";
} from "~/mixins/index";
import {
ORDER_STATUS,
OrderStatusTypes
} from "~/constants/mine.js";
Page({ Page({
behaviors: [orderMixin], behaviors: [orderMixin],
/** /**
...@@ -15,7 +10,13 @@ Page({ ...@@ -15,7 +10,13 @@ Page({
pageNum: 1, pageNum: 1,
requestType: 0, requestType: 0,
tab: Object.freeze( tab: Object.freeze(
Object.values(ORDER_STATUS).filter(item => item.type === OrderStatusTypes.QUERY_TAB || item.type === OrderStatusTypes.MY_ORDER).map(item => item.text) Object.values(ORDER_STATUS)
.filter(
(item) =>
item.type === OrderStatusTypes.QUERY_TAB ||
item.type === OrderStatusTypes.MY_ORDER
)
.map((item) => item.text)
), ),
list: [], list: [],
...@@ -32,11 +33,7 @@ Page({ ...@@ -32,11 +33,7 @@ Page({
}, },
jump(e) { jump(e) {
let { let {
item: { item: { orderStatus, orderCode, orderSource },
orderStatus,
orderCode,
orderSource
},
} = e.currentTarget.dataset; } = e.currentTarget.dataset;
if (orderSource == 5 && (orderStatus == 2 || orderStatus == 7)) return; if (orderSource == 5 && (orderStatus == 2 || orderStatus == 7)) return;
let url = "/packageMine/pages/order/detail/detail"; let url = "/packageMine/pages/order/detail/detail";
...@@ -47,36 +44,32 @@ Page({ ...@@ -47,36 +44,32 @@ Page({
afterSaleDetail(e) { afterSaleDetail(e) {
let url = "/packageMine/pages/order/afterSaleDetail/afterSaleDetail"; let url = "/packageMine/pages/order/afterSaleDetail/afterSaleDetail";
let { let {
item: { item: { orderCode },
orderCode
},
} = e.currentTarget.dataset; } = e.currentTarget.dataset;
wx.p.router.go(url, { wx.p.router.go(url, {
orderCode, orderCode,
}); });
}, },
back() { back() {
let { let { length } = getCurrentPages();
length
} = getCurrentPages();
if (length == 1) wx.p.router.switchTab("/pages/tab/mine/index"); if (length == 1) wx.p.router.switchTab("/pages/tab/mine/index");
else wx.p.router.back(); else wx.p.router.back();
}, },
changeTab(e) { changeTab(e) {
let index = e.detail.count, let index = e.detail.count,
requestType = this.getRequestType(index); requestType = this.getRequestType(index);
console.log(index, e)
this.setData({ this.setData({
tabIndex: index, tabIndex: index,
requestType requestType,
}); });
this.getOrderList() this.getOrderList();
}, },
getRequestType(index) { getRequestType(index) {
// index = index ? index : 0 // index = index ? index : 0
let item = Object.values(ORDER_STATUS).find(item => item.index == (index || 0)) let item = Object.values(ORDER_STATUS).find(
console.log(item) (item) => item.index == (index || 0)
return item ? item.requestType : '0' );
return item ? item.requestType : "0";
}, },
/** /**
* 生命周期函数--监听页面加载 * 生命周期函数--监听页面加载
...@@ -87,15 +80,15 @@ Page({ ...@@ -87,15 +80,15 @@ Page({
requestType = this.getRequestType(index); requestType = this.getRequestType(index);
this.setData({ this.setData({
tabIndex: index, tabIndex: index,
requestType requestType,
}); });
// this.getOrderList() this.getOrderList();
this.clearData(); // 注释掉实际的API调用,使用硬编码数据 // this.clearData(); // 注释掉实际的API调用,使用硬编码数据
}); });
}, },
onShow() { onShow() {
if (this.refresh) this.clearData(); if (this.refresh) this.clearData();
// if (this.refresh) this.getOrderList(); if (this.refresh) this.getOrderList();
}, },
onHide() { onHide() {
this.refresh = true; this.refresh = true;
...@@ -105,18 +98,18 @@ Page({ ...@@ -105,18 +98,18 @@ Page({
if (res) return; if (res) return;
this.setData({ this.setData({
listFlag: false, listFlag: false,
// list: [], // 注释掉清空列表,保持硬编码数据 list: [], // 注释掉清空列表,保持硬编码数据
nothing: false, nothing: false,
pageNum: 1, pageNum: 1,
}); });
this.getOrderList(); // 注释掉实际的API调用,使用硬编码数据 // this.getOrderList(); // 注释掉实际的API调用,使用硬编码数据
this.setData({ // this.setData({
listFlag: true, // listFlag: true,
}); // });
}, },
search() { search() {
// this.getOrderList()
this.clearData(); this.clearData();
this.getOrderList();
}, },
clear() { clear() {
this.setData({ this.setData({
...@@ -129,31 +122,27 @@ Page({ ...@@ -129,31 +122,27 @@ Page({
}); });
}, },
blur() { blur() {
let { let { keyword } = this.data;
keyword
} = this.data;
this.setData({ this.setData({
keyword, keyword,
}); });
}, },
getOrderList() { getOrderList() {
wx.p.wxApi.showLoading("加载中..."); wx.p.wxApi.showLoading("加载中...");
let { let { requestType, pageNum, keyword, tabIndex } = this.data;
requestType, const userInfo = wx.p.storage.get("userInfo") || {};
pageNum, let { merchantId } = userInfo;
keyword,
tabIndex
} = this.data;
let obj = { let obj = {
requestType, requestType,
currentPage: pageNum merchantId,
currentPage: pageNum,
}; };
if (keyword) { if (keyword) {
keyword = keyword.replace(/\ /g, ""); keyword = keyword.replace(/\ /g, "");
if (keyword.length) obj.keyword = keyword; if (keyword.length) obj.keyword = keyword;
} }
let Method = tabIndex == 5 ? 'getSalesOrderList' : 'getOrderList'; let Method = tabIndex == 5 ? "getSalesOrderList" : "getOrderList";
let list = []; let list = [];
wx.p.api.mineApi[Method](obj).then((data) => { wx.p.api.mineApi[Method](obj).then((data) => {
wx.hideLoading(); wx.hideLoading();
...@@ -188,7 +177,6 @@ Page({ ...@@ -188,7 +177,6 @@ Page({
}); });
wx.hideLoading(); wx.hideLoading();
}); });
}, },
requestSubscribeMessage() { requestSubscribeMessage() {
wx.p.router.go("/packageMine/pages/order/complete/complete", { wx.p.router.go("/packageMine/pages/order/complete/complete", {
...@@ -217,26 +205,20 @@ Page({ ...@@ -217,26 +205,20 @@ Page({
}, },
// 查看卡券 // 查看卡券
toCheckCard(e) { toCheckCard(e) {
const { const { item } = e.currentTarget.dataset;
item
} = e.currentTarget.dataset;
wx.p.router.go("/packageEquity/pages/kaqDetail/kaqDetail", { wx.p.router.go("/packageEquity/pages/kaqDetail/kaqDetail", {
orderCode: item.orderCode, orderCode: item.orderCode,
}); });
}, },
// 卡卷 申请售后 // 卡卷 申请售后
toSaleApplyPage(e) { toSaleApplyPage(e) {
let { let { item } = e.currentTarget.dataset;
item
} = e.currentTarget.dataset;
item.pageFrom = "coupons"; item.pageFrom = "coupons";
wx.p.router.go("/packageEquity/pages/saleApply/saleApply", item); wx.p.router.go("/packageEquity/pages/saleApply/saleApply", item);
}, },
// 卡卷 确认收货 // 卡卷 确认收货
toComfirmPage(e) { toComfirmPage(e) {
let { let { item } = e.currentTarget.dataset;
item
} = e.currentTarget.dataset;
let para = { let para = {
orderCode: item.orderCode, orderCode: item.orderCode,
}; };
...@@ -260,37 +242,30 @@ Page({ ...@@ -260,37 +242,30 @@ Page({
}, },
// 套餐申请售后 // 套餐申请售后
toSaleApplyPackage(e) { toSaleApplyPackage(e) {
let { let { item } = e.currentTarget.dataset;
item
} = e.currentTarget.dataset;
item.pageFrom = "package"; item.pageFrom = "package";
wx.p.router.go("/packageEquity/pages/saleApply/saleApply", item); wx.p.router.go("/packageEquity/pages/saleApply/saleApply", item);
}, },
// 套餐售后详情 // 套餐售后详情
toPackageDetail(e) { toPackageDetail(e) {
const { const { item } = e.currentTarget.dataset;
item
} = e.currentTarget.dataset;
wx.p.router.go("/packageEquity/pages/packageDetail/packageDetail", { wx.p.router.go("/packageEquity/pages/packageDetail/packageDetail", {
orderCode: item.orderCode, orderCode: item.orderCode,
}); });
}, },
// 套餐查看卡包 // 套餐查看卡包
toCheckPackage(e) { toCheckPackage(e) {
const { const { item } = e.currentTarget.dataset;
item
} = e.currentTarget.dataset;
wx.p.router.go("/packageEquity/pages/packageDetail/packageDetail", { wx.p.router.go("/packageEquity/pages/packageDetail/packageDetail", {
orderCode: item.orderCode, orderCode: item.orderCode,
}); });
}, },
// 精品订单跳转页面 // 精品订单跳转页面
boutiqueJump(e) { boutiqueJump(e) {
let { let { orderCode } = e.currentTarget.dataset;
orderCode
} = e.currentTarget.dataset;
wx.p.router.go( wx.p.router.go(
"/packageMine/pages/boutiquePages/boutiqueOrder/boutiqueOrder", { "/packageMine/pages/boutiquePages/boutiqueOrder/boutiqueOrder",
{
orderCode, orderCode,
type: 2, type: 2,
} }
...@@ -306,4 +281,4 @@ Page({ ...@@ -306,4 +281,4 @@ Page({
this.getOrderList(); this.getOrderList();
} }
}, },
});
\ No newline at end of file \ No newline at end of file
});
import {
OrderStatusEnum,
ORDER_STATUS,
AFTER_SALE_STATUS,
AfterSaleStatusEnum,
} from "~/constants/mine.js";
export function getOrderStatus({
orderStatus,
cancelStatus,
returnStatus,
refundStatus,
returnOrderStatus,
} = {}) {
//订单状态 orderStatus (1001:待支付 1002:待审核,1003:审核不通过,1004:已取消(交易失败) ,1005:订单异常,1006:待处理,1007: 待发货,1008:已发货,1009:已完成(交易成功),1010:售后处理中,1012 订单关闭
//退换货状态 returnStatus (1000:待审核,1001:待收货,1002:已收货,1003:已退款,1004:已生成新订单,1005:已取消,1006:退款异常,1007:商品退回,1008:审核不通过,1010:换货新订单待收货,1011:换货新订单已签收)
//退款状态 refundStatus (1000:待审核,1001:待退款,1002:已退款,1003:已取消,1004:退款异常,1005:审核不通过)
//订单取消状态 cancelStatus(1000:取消成功,1010:取消审核中)
//退款状态 returnOrderStatus(1000:待审核,1001:审核通过,1002:已收货,1003:已退款,1004:已生成新订单,1005:审核不通过)
//goodsSource 1.云中鹤 2.平台商品
//订单状态 orderStatus (1001:待支付 1002:待审核,1003:审核不通过,1004:已取消(交易失败) ,1005:订单异常,1006:待处理,1007: 待发货,1008:已发货,1009:已完成(交易成功),1010:售后处理中,1012 订单关闭
if (
[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)
) {
// 确认收货,查看物流
return OrderStatusEnum.WAIT_RECEIVE; //待收货 order_status属于(1008)且cancel_status不存在或者审核中(1010)
} else if (orderStatus == 1009 && (!cancelStatus || cancelStatus == 1010)) {
//按钮:查看物流、售后
return OrderStatusEnum.COMPLETED; //已完成 order_status属于(1009)且cancel_status不存在或者审核中(1010)
} else if (
(returnOrderStatus == 1000 && returnStatus == 1000) ||
(returnOrderStatus == 1000 && refundStatus == 1000)
) {
// 按钮:售后详情
return OrderStatusEnum.AFTER_SALE_PENDING_REVIEW; //售后---待审核 退款退货的return_order_status:1000:待审批且return_status退换货状态(1000:待审核) 仅退款的return_order_status:1000:待审批且refund_status 退款状态(1000:待审核
} else if (returnOrderStatus == 1001 && returnStatus == 1001) {
// 按钮:售后详情
return OrderStatusEnum.AFTER_SALE_WAIT_RECEIVE; //售后---待收货(审核通过) 退款退货的return_order_status:1001:审核通过 且return_status退换货状态(1001:待收货),仅退款的直接到退款完成/退款失败
} else if (
(returnOrderStatus == 1005 && returnStatus == 1008) ||
(returnOrderStatus == 1005 && refundStatus == 1008)
) {
// 状态:售后前的状态(云中鹤不同意售后申请)按钮:售后、售后详情
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)
) {
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)
) {
return OrderStatusEnum.AFTER_SALE_REFUNDED_FAILED; // 退款失败 退款退货的return_order_status:1003:已退款 return_status退换货状态(1006:退款异常 ,,仅退款的return_order_status:1003:已退款 且refund_status 退款状态,1004:退款异常
} else {
return OrderStatusEnum.AFTER_SALE_REVEAL; //其他兜底的状态
}
}
export function getOrder(orderStatus) {
//判断orderStatus 是否为对象类型
let _status_ = orderStatus;
if (typeof orderStatus === "object") {
_status_ = getOrderStatus(orderStatus);
}
return ORDER_STATUS[_status_] || {};
}
export function getAfterSaleStatus({ returnOrderStatus } = {}) {
if (returnOrderStatus == 1000) {
// 按钮:售后详情
return AfterSaleStatusEnum.PENDING_REVIEW; //售后---待审核 退款退货的return_order_status:1000:待审批且return_status退换货状态(1000:待审核) 仅退款的return_order_status:1000:待审批且refund_status 退款状态(1000:待审核
} else if (returnOrderStatus == 1001) {
// 按钮:售后详情
return AfterSaleStatusEnum.PENDING_REVIEW_PASSED; //售后---待收货(审核通过) 退款退货的return_order_status:1001:审核通过 且return_status退换货状态(1001:待收货),仅退款的直接到退款完成/退款失败
} else if (returnOrderStatus == 1005) {
// 状态:售后前的状态(云中鹤不同意售后申请)按钮:售后、售后详情
return AfterSaleStatusEnum.PENDING_REVIEW_REJECTED; //售后 -- 审核不通过 退款退货的return_order_status:1005:审核不通过且return_status退换货状态(1008:审核不通过), 仅退款的return_order_status:1005 且refund_status 退款状态(1008:审核不通过
} else if (returnOrderStatus == 1004) {
return AfterSaleStatusEnum.SUCCESS; // 已退款 退款退货的订单return_order_status:1003:已退款且return_status退换货状态(1002:已收货,1003:已退款),仅退款订单 return_order_status:1003:已退款且refund_status 退款状态1002:已退款,
} else if (returnOrderStatus == 1006) {
return AfterSaleStatusEnum.FAILED; // 退款失败 退款退货的return_order_status:1003:已退款 return_status退换货状态(1006:退款异常 ,,仅退款的return_order_status:1003:已退款 且refund_status 退款状态,1004:退款异常
}else{
return AfterSaleStatusEnum.DEFAULT;
}
}
export function getAfterSaleDetail(status) {
let _status_ = status;
if (typeof status === "object") {
_status_ = getAfterSaleStatus(status);
}
return AFTER_SALE_STATUS[_status_] || {};
}
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!