Commit 07e819c0 by Jaxon

Merge branch 'feature/optimize-refund-flow-' into 'SAAS+V5.7.9'

Feature/optimize refund flow

See merge request !522
2 parents b9c2229a 68e245c1
// tabWorkOrder/components/applyRefundBtn/applyRefundBtn.js
import api from '~/api/api'
import api from "~/api/api";
import qs from "~/utils/lib/qs";
Component({
/**
* 组件的属性列表
*/
properties: {
orderInfo: Object,
showRefundBtn: Boolean,
updateFlag: Boolean
},
/**
* 组件的属性列表
*/
properties: {
orderInfo: Object,
showRefundBtn: Boolean,
updateFlag: Boolean,
},
/**
* 组件的初始数据
*/
data: {
moreSelectData: [],
showSelect: false,
moreSelectIndex: null,
areaOperationsFlag: false
},
/**
* 组件的初始数据
*/
data: {
moreSelectData: [],
showSelect: false,
moreSelectIndex: null,
areaOperationsFlag: false,
},
/**
* 组件的方法列表
*/
methods: {
// 点击更多按钮
selectTap() {
let { orderInfo } = this.data
let allOptions = []
if (orderInfo.selectPayType == 2) {
// 门店收款订单查询退款可展示按钮
allOptions = ['标记退款', '退款详情']
// 查询订单可展示按钮
api.getMoreBtnAPI({ orderCode: orderInfo.orderCode }).then(res => {
let { code, data } = res
if (code == 0) {
this.setData({
moreSelectData: this.filterMoreSelectData(
data.refundApplyButton,
data.refundApplyDetailButton,
allOptions,
1
),
showSelect: !this.data.showSelect
})
}
})
} else {
allOptions = ['申请退款', '退款详情']
// 查询订单可展示按钮
api.getMoreBtnAPI({ orderCode: orderInfo.orderCode }).then(res => {
let { code, data } = res
if (code == 0) {
this.setData({
moreSelectData: this.filterMoreSelectData(
data.refundApplyButton,
data.refundApplyDetailButton,
allOptions,
2
),
showSelect: !this.data.showSelect
})
}
})
}
},
/**
* 组件的方法列表
*/
methods: {
// 点击更多按钮
selectTap() {
let { orderInfo } = this.data;
let allOptions = [];
if (orderInfo.selectPayType == 2) {
// 门店收款订单查询退款可展示按钮
allOptions = ["标记退款", "退款详情"];
// 查询订单可展示按钮
api.getMoreBtnAPI({ orderCode: orderInfo.orderCode }).then((res) => {
let { code, data } = res;
if (code == 0) {
this.setData({
moreSelectData: this.filterMoreSelectData(data.refundApplyButton, data.refundApplyDetailButton, allOptions, 1),
showSelect: !this.data.showSelect,
});
}
});
} else {
allOptions = ["申请退款", "退款详情"];
// 查询订单可展示按钮
api.getMoreBtnAPI({ orderCode: orderInfo.orderCode }).then((res) => {
let { code, data } = res;
if (code == 0) {
this.setData({
moreSelectData: this.filterMoreSelectData(data.refundApplyButton, data.refundApplyDetailButton, allOptions, 2),
showSelect: !this.data.showSelect,
});
}
});
}
},
filterMoreSelectData(
refundApplyButton,
refundApplyDetailButton,
allOptions,
num
) {
const buttonType = num === 2 ? '申请退款' : '标记退款'
const conditions = {
[buttonType]: refundApplyButton === 'Y',
退款详情: refundApplyDetailButton === 'Y'
}
return allOptions.filter(option => conditions[option])
},
filterMoreSelectData(refundApplyButton, refundApplyDetailButton, allOptions, num) {
const buttonType = num === 2 ? "申请退款" : "标记退款";
const conditions = {
[buttonType]: refundApplyButton === "Y",
退款详情: refundApplyDetailButton === "Y",
};
return allOptions.filter((option) => conditions[option]);
},
closeSelect() {
this.setData({
showSelect: false,
moreSelectIndex: null
})
},
tapConstruction() {
this.closeSelect()
let thisPage = wx.$router.getPageInstance()
thisPage.setData({
sublistVisible: true
})
},
optionTap(e) {
let { index, item } = e.currentTarget.dataset
let { orderInfo } = this.data
let userInfo = wx.$util.getUserInfo()
if (item == '申请退款' || item == '标记退款') {
// 申请退款点击埋点
if (item == '申请退款')
wx.$track.setTrackData(0, 'apply_refund_page', {}, '', 1)
// 退款申请时区域运营查询
api
.areaSupervisionExistsAPI({
merchantId: userInfo.shopMerchantId,
sceneType: userInfo.sceneType
})
.then(res => {
let { code, data, message } = res
if (code == 0) {
if (!data) {
return this.setData({
areaOperationsFlag: true,
showSelect: !this.data.showSelect
})
} else {
wx.navigateTo({
url: `/tabWorkOrder/pages/refundApply/refundApply?orderCode=${
orderInfo.orderCode
}&shopMerchantName=${orderInfo.merchantName}&shopMerchantId=${
orderInfo.merchantId
}&refundPayType=${orderInfo.selectPayType == 2 ? 2 : 1}`
})
this.closeSelect()
}
} else {
return wx.$util.showToast(message)
}
})
} else {
// 退款详情点击埋点
if (orderInfo?.selectPayType != 2)
wx.$track.setTrackData(0, 'refund_detail_page', {}, '', 1)
// 点击退款详情,判断是否存在多条退款申请记录,存在跳转列表页,不存在直接跳转详情页
api
.getRefundDetailListAPI({ orderCode: orderInfo.orderCode })
.then(res => {
let { code, data } = res
if (code == 0) {
if (data?.length > 1) {
wx.navigateTo({
url: `/tabWorkOrder/pages/refundDetailList/refundDetailList?orderCode=${orderInfo.orderCode}`
})
} else if (data.length == 1) {
wx.navigateTo({
url: `/tabWorkOrder/pages/refundApply/refundApply?applyCode=${
data[0].applyCode
}&refundPayType=${orderInfo.selectPayType == 2 ? 2 : 1}`
})
}
this.closeSelect()
}
})
}
closeSelect() {
this.setData({
showSelect: false,
moreSelectIndex: null,
});
},
tapConstruction() {
this.closeSelect();
let thisPage = wx.$router.getPageInstance();
thisPage.setData({
sublistVisible: true,
});
},
optionTap(e) {
let { index, item } = e.currentTarget.dataset;
let { orderInfo } = this.data;
let userInfo = wx.$util.getUserInfo();
if (item == "申请退款" || item == "标记退款") {
// 申请退款点击埋点
if (item == "申请退款") wx.$track.setTrackData(0, "apply_refund_page", {}, "", 1);
// 退款申请时区域运营查询
api.areaSupervisionExistsAPI({
merchantId: userInfo.shopMerchantId,
sceneType: userInfo.sceneType,
}).then((res) => {
let { code, data, message } = res;
if (code == 0) {
if (!data) {
return this.setData({
areaOperationsFlag: true,
showSelect: !this.data.showSelect,
});
} else {
wx.navigateTo({
url:
"/tabWorkOrder/pages/refundApply/refundApply?" +
qs.stringify({
orderCode: orderInfo.orderCode,
shopMerchantName: orderInfo.merchantName,
shopMerchantId: orderInfo.merchantId,
refundPayType: orderInfo.selectPayType == 2 ? 2 : 1,
refundName: orderInfo.customerName,
}),
});
this.closeSelect();
}
} else {
return wx.$util.showToast(message);
}
});
} else {
// 退款详情点击埋点
if (orderInfo?.selectPayType != 2) wx.$track.setTrackData(0, "refund_detail_page", {}, "", 1);
// 点击退款详情,判断是否存在多条退款申请记录,存在跳转列表页,不存在直接跳转详情页
api.getRefundDetailListAPI({ orderCode: orderInfo.orderCode }).then((res) => {
let { code, data } = res;
if (code == 0) {
if (data?.length > 1) {
wx.navigateTo({
url: `/tabWorkOrder/pages/refundDetailList/refundDetailList?orderCode=${orderInfo.orderCode}`,
});
} else if (data.length == 1) {
wx.navigateTo({
url: `/tabWorkOrder/pages/refundApply/refundApply?applyCode=${data[0].applyCode}&refundPayType=${orderInfo.selectPayType == 2 ? 2 : 1}`,
});
}
this.closeSelect();
}
});
}
this.setData({
moreSelectIndex: index
// showSelect: !this.data.showSelect
})
},
closeModal() {
this.setData({
areaOperationsFlag: false
})
}
}
})
this.setData({
moreSelectIndex: index,
// showSelect: !this.data.showSelect
});
},
closeModal() {
this.setData({
areaOperationsFlag: false,
});
},
},
});
......@@ -1349,7 +1349,7 @@ Page({
if (orderObj.orderType !== undefined && orderObj.orderType !== null) {
orderObj.djOrderType = orderObj.orderType
} else {
orderObj.djOrderType = 0
orderObj.djOrderType = 1
}
}
......
......@@ -89,7 +89,7 @@ Page({
refundRule: {
data: "",
show: false,
title: "展开",
title: "查看",
},
},
},
......@@ -139,7 +139,7 @@ Page({
}, 500);
},
onCollapseChange(e) {
const value = e.detail ? "收起" : "展开";
const value = e.detail ? "收起" : "查看";
this.setData({
"collapse.refundRule.show": e.detail,
"collapse.refundRule.title": value,
......@@ -635,6 +635,7 @@ Page({
let { submitStatus, infoData, userInfo, refundPayType } = this.data;
// 校验是否选择退款方式
if (!infoData.refundType) return wx.$util.showToast("请选择退款方式");
if (infoData.payee === "" || infoData.payee == null || infoData.payee == undefined) return wx.$util.showToast("请输入收款人姓名");
// 部分退款校验子订单
let checkKey = this.checkSubOrderValid(infoData.subOrderList);
if (checkKey) return wx.$util.showToast(checkKey);
......
......@@ -331,6 +331,14 @@ page {
}
}
}
.modify-name-wrapper {
border-top: var(--fontSize2) solid #eff0f2;
padding: var(--fontSize40);
color: #5a5e66;
font-size: var(--fontSize24);
line-height: var(--fontSize36);
}
}
.review_box {
display: flex;
......
......@@ -329,6 +329,10 @@
</view>
</view>
</view>
<view wx:if="{{ !filter.filterRefundDisabled(infoData, userInfo) }}"
class="modify-name-wrapper">
说明:收款人姓名将自动带入工单完整姓名,如需修改请确保提供实际收款人付款凭证,避免影响审核进度。
</view>
</block>
<block wx:else>
<view class="upload_box">
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!