Commit 4c44da46 by liimin

feat(售后): 添加云中鹤售后商品数量查询功能并优化售后流程

- 在shopmall模块添加getYzhAvailableQty方法用于查询可申请售后的商品数量
- 优化afterSaleDetail页面数据处理逻辑,简化订单信息结构
- 移除调试用的console.log语句
- 调整售后申请接口调用方式,直接通过API_Methods调用
1 parent 6d8198f7
...@@ -51,5 +51,6 @@ module.exports = { ...@@ -51,5 +51,6 @@ module.exports = {
method: 'scrm.api.shopmall.platform.base.address.list', method: 'scrm.api.shopmall.platform.base.address.list',
...data ...data
}) })
} },
} }
\ No newline at end of file \ No newline at end of file
...@@ -154,4 +154,15 @@ queryExpressList(data={}){ ...@@ -154,4 +154,15 @@ queryExpressList(data={}){
...data ...data
}) })
}, },
/**云中鹤查看可申请售后的商品数量 */
getYzhAvailableQty(data) {
return api.post({
method: 'scrm.api.shopmall.platform.afterSales.available.qty',
...data
})
},
/**自营查看可申请售后的商品数量(暂无) */
getAvailableQty(data) {
return Promise.resolve(null)
}
} }
\ No newline at end of file \ No newline at end of file
...@@ -96,11 +96,11 @@ Page({ ...@@ -96,11 +96,11 @@ Page({
}, },
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 orderInfo
); );
}, },
/**撤销申请 */ /**撤销申请 */
......
...@@ -21,9 +21,9 @@ Page({ ...@@ -21,9 +21,9 @@ Page({
wx.p.router.getRouterParams(options).then((orderObj) => { wx.p.router.getRouterParams(options).then((orderObj) => {
const { goodsSource, tparReturnOrderCode, subOrderCode, goodsSkuCode } = const { goodsSource, tparReturnOrderCode, subOrderCode, goodsSkuCode } =
orderObj; orderObj;
this.setData({ // this.setData({
method: API_Methods[orderObj.goodsSource][APIS.AFTER_SALE], // method: API_Methods[orderObj.goodsSource][APIS.AFTER_SALE],
}); // });
if (tparReturnOrderCode) { if (tparReturnOrderCode) {
this.getOrderAfterSaleDetail( this.getOrderAfterSaleDetail(
{ goodsSource, tparReturnOrderCode, subOrderCode, goodsSkuCode }, { goodsSource, tparReturnOrderCode, subOrderCode, goodsSkuCode },
...@@ -39,7 +39,7 @@ Page({ ...@@ -39,7 +39,7 @@ Page({
setOrderInfo(order) { setOrderInfo(order) {
const _order = Object.assign({}, order, { const _order = Object.assign({}, order, {
returnType: order.returnType || 1001, returnType: order.returnType || 1001,
imgList: order.imgList || [], imgList: order.imgList || []
}); });
this.setData({ this.setData({
orderObj: _order, orderObj: _order,
...@@ -128,7 +128,7 @@ Page({ ...@@ -128,7 +128,7 @@ Page({
if (orderObj.goodsSource === GoodsSource.YZH) { if (orderObj.goodsSource === GoodsSource.YZH) {
delete orderObj.refundPoints; delete orderObj.refundPoints;
} }
this.data.method(orderObj).then(({ code, data, message }) => { API_Methods[orderObj.goodsSource][APIS.AFTER_SALE](orderObj).then(({ code, data, message }) => {
if (code == "0") { if (code == "0") {
wx.p.wxApi.showToast("申请成功!"); wx.p.wxApi.showToast("申请成功!");
setTimeout(() => { setTimeout(() => {
...@@ -149,18 +149,36 @@ Page({ ...@@ -149,18 +149,36 @@ Page({
cb cb
) { ) {
wx.p.wxApi.showLoading("加载中..."); wx.p.wxApi.showLoading("加载中...");
// const Methods = goodsSource == 2 ? "afterSaleDetail" : "platformSaleDetail";
API_Methods[goodsSource][APIS.AFTER_SALE_DETAIL]({ API_Methods[goodsSource][APIS.AFTER_SALE_DETAIL]({
subOrderCode, subOrderCode,
tparReturnOrderCode, tparReturnOrderCode,
goodsSkuCode, goodsSkuCode,
}).then((res) => { }).then((res) => {
const { orderGoods, imgUrlList, ...rest } = res; const {
const order = Object.assign({ imgList: imgUrlList }, orderGoods, rest); imgUrlList: imgList,
const { ___qty, ___price, ___totalPrice } = calcOrderProp(order); refundPoints,
Object.assign(order, { ___qty, ___price, ___totalPrice }); returnContent,
returnType,
returnReasonType,
applyQty,
} = res;
const order = {
imgList,
refundPoints,
returnContent,
returnType,
returnReasonType,
applyQty,
goodsSource,
tparReturnOrderCode,
subOrderCode,
goodsSkuCode,
};
// const { ___qty, ___price, ___totalPrice } = calcOrderProp(order);
// Object.assign(order, { ___qty, ___price, ___totalPrice });
cb(order); cb(order);
}).finally(() => { })
.finally(() => {
wx.hideLoading(); wx.hideLoading();
}); });
}, },
......
...@@ -88,7 +88,6 @@ Page({ ...@@ -88,7 +88,6 @@ Page({
} }
} : {}) } : {})
}); });
console.log(this.data)
}) })
.catch((err) => { .catch((err) => {
wx.p.sentry.reportError(`订单详情异常:${err.message}`, { wx.p.sentry.reportError(`订单详情异常:${err.message}`, {
......
...@@ -171,15 +171,18 @@ export function calcOrderProp(order = {}) { ...@@ -171,15 +171,18 @@ export function calcOrderProp(order = {}) {
export const APIS = { export const APIS = {
AFTER_SALE_DETAIL: "AFTER_SALE_DETAIL", AFTER_SALE_DETAIL: "AFTER_SALE_DETAIL",
AFTER_SALE: "AFTER_SALE", AFTER_SALE: "AFTER_SALE",
AVAILABLE_QTY: "AVAILABLE_QTY",
}; };
export const API_Methods = { export const API_Methods = {
[GoodsSource.YZH]: { [GoodsSource.YZH]: {
[APIS.AFTER_SALE_DETAIL]: wx.p.api.shopmallApi.platformSaleDetail, //售后详情 [APIS.AFTER_SALE_DETAIL]: wx.p.api.shopmallApi.platformSaleDetail, //售后详情
[APIS.AFTER_SALE]: wx.p.api.shopmallApi.afterSalesPlatform, // 售后 [APIS.AFTER_SALE]: wx.p.api.shopmallApi.afterSalesPlatform, // 售后
[APIS.AVAILABLE_QTY]: wx.p.api.shopmallApi.getYzhAvailableQty, // 云中鹤查看可申请售后的商品数量
}, },
[GoodsSource.SELF]: { [GoodsSource.SELF]: {
[APIS.AFTER_SALE_DETAIL]: wx.p.api.shopmallApi.afterSaleDetail, //售后详情 [APIS.AFTER_SALE_DETAIL]: wx.p.api.shopmallApi.afterSaleDetail, //售后详情
[APIS.AFTER_SALE]: wx.p.api.shopmallApi.afterSale, // 售后 [APIS.AFTER_SALE]:wx.p.api.shopmallApi.afterSale, // 售后
[APIS.AVAILABLE_QTY]:wx.p.api.shopmallApi.getAvailableQty
}, },
}; };
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!