feat 对接售后订单详情

This commit is contained in:
AERWEN\26795 2023-10-22 15:27:54 +08:00
parent 64a5918a2a
commit ca48ddbabf
5 changed files with 96 additions and 61 deletions

View File

@ -48,9 +48,17 @@ Page({
goods.originPrice = undefined; goods.originPrice = undefined;
// 统计是否有加购数大于库存数的商品 // 统计是否有加购数大于库存数的商品
if (goods.quantity > goods.stockQuantity) { if(goods.skuId != 0){
store.storeStockShortage = true; if (goods.quantity > goods.skuStockQuantity) {
store.storeStockShortage = true;
}
} }
else{
if (goods.quantity > goods.stockQuantity) {
store.storeStockShortage = true;
}
}
// 统计是否全选 // 统计是否全选
if (!goods.isSelected) { if (!goods.isSelected) {
store.isSelected = false; store.isSelected = false;

View File

@ -1,6 +1,9 @@
import Toast from 'tdesign-miniprogram/toast/index'; import Toast from 'tdesign-miniprogram/toast/index';
import { ServiceType, ServiceTypeDesc, ServiceStatus } from '../config'; import { ServiceType, ServiceTypeDesc, ServiceStatus } from '../config';
import { formatTime, getRightsDetail } from './api'; import { formatTime, getRightsDetail } from './api';
import {
getOrderRefundDetails
} from '~/services/order/getOrderRefundDetails';
const TitleConfig = { const TitleConfig = {
[ServiceType.ORDER_CANCEL]: '退款详情', [ServiceType.ORDER_CANCEL]: '退款详情',
@ -49,77 +52,78 @@ Page({
}); });
}, },
// 获取订单详情
getService() { getService() {
const params = { rightsNo: this.rightsNo }; const params = { orderRefundGuid: this.rightsNo };
return getRightsDetail(params).then((res) => { return getOrderRefundDetails(params).then((res) => {
const serviceRaw = res.data[0]; const serviceRaw = res.data;
// 滤掉填写运单号、修改运单号按钮,这两个按钮特殊处理,不在底部按钮栏展示 // 滤掉填写运单号、修改运单号按钮,这两个按钮特殊处理,不在底部按钮栏展示
if (!serviceRaw.buttonVOs) serviceRaw.buttonVOs = []; if (!serviceRaw.buttonVOs) serviceRaw.buttonVOs = [];
const deliveryButton = {}; const deliveryButton = {};
const service = { const service = {
id: serviceRaw.rights.rightsNo, id: serviceRaw.orderRefundGuid,
serviceNo: serviceRaw.rights.rightsNo, serviceNo: serviceRaw.orderRefundGuid,
storeName: serviceRaw.rights.storeName, storeName: serviceRaw.storeName,
type: serviceRaw.rights.rightsType, type: serviceRaw.refundType,
typeDesc: ServiceTypeDesc[serviceRaw.rights.rightsType], typeDesc: ServiceTypeDesc[serviceRaw.refundType],
status: serviceRaw.rights.rightsStatus, status: serviceRaw.status,
statusIcon: this.genStatusIcon(serviceRaw.rights), statusIcon: this.genStatusIcon(serviceRaw),
statusName: serviceRaw.rights.userRightsStatusName, statusName: serviceRaw.statusName,
statusDesc: serviceRaw.rights.userRightsStatusDesc, statusDesc: serviceRaw.eserRightsStatusDesc,
amount: serviceRaw.rights.refundRequestAmount, amount: serviceRaw.refundMoney,
goodsList: (serviceRaw.rightsItem || []).map((item, i) => ({ goodsList: (serviceRaw.orderRefundGoodList || []).map((item, i) => ({
id: i, id: i,
thumb: item.goodsPictureUrl, thumb: item.thumb,
title: item.goodsName, title: item.title,
specs: (item.specInfo || []).map((s) => s.specValues || ''), specs: (item.specifications || []).map((s) => s.specValue || ''),
itemRefundAmount: item.itemRefundAmount, itemRefundAmount: item.price,
rightsQuantity: item.rightsQuantity, rightsQuantity: item.buyQuantity,
})), })),
orderNo: serviceRaw.rights.orderNo, // 订单编号 orderNo: serviceRaw.orderNo, // 订单编号
rightsNo: serviceRaw.rights.rightsNo, // 售后服务单号 // rightsNo: serviceRaw.rights.rightsNo, // 售后服务单号
rightsReasonDesc: serviceRaw.rights.rightsReasonDesc, // 申请售后原因 rightsReasonDesc: serviceRaw.reason, // 申请售后原因
isRefunded: serviceRaw.rights.userRightsStatus === ServiceStatus.REFUNDED, // 是否已退款 isRefunded: serviceRaw.status === ServiceStatus.REFUNDED, // 是否已退款
refundMethodList: (serviceRaw.refundMethodList || []).map((m) => ({ // refundMethodList: (serviceRaw.refundMethodList || []).map((m) => ({
name: m.refundMethodName, // name: m.refundMethodName,
amount: m.refundMethodAmount, // amount: m.refundMethodAmount,
})), // 退款明细 // })), // 退款明细
refundRequestAmount: serviceRaw.rights.refundRequestAmount, // 申请退款金额 refundRequestAmount: serviceRaw.refundRequestAmount, // 申请退款金额
payTraceNo: serviceRaw.rightsRefund.traceNo, // 交易流水号 // payTraceNo: serviceRaw.rightsRefund.traceNo, // 交易流水号
createTime: formatTime(parseFloat(`${serviceRaw.rights.createTime}`), 'YYYY-MM-DD HH:mm'), // 申请时间 createTime: serviceRaw.createTime, // 申请时间
logisticsNo: serviceRaw.logisticsVO.logisticsNo, // 退货物流单号 logisticsNo: serviceRaw.trajectoryVos?.logisticsCompanyCode, // 退货物流单号
logisticsCompanyName: serviceRaw.logisticsVO.logisticsCompanyName, // 退货物流公司 logisticsCompanyName: serviceRaw.trajectoryVos?.logisticsCompanyName, // 退货物流公司
logisticsCompanyCode: serviceRaw.logisticsVO.logisticsCompanyCode, // 退货物流公司 logisticsCompanyCode: serviceRaw.trajectoryVos?.logisticsCompanyCode, // 退货物流公司
remark: serviceRaw.logisticsVO.remark, // 退货备注 // remark: serviceRaw.logisticsVO.remark, // 退货备注
receiverName: serviceRaw.logisticsVO.receiverName, // 收货人 receiverName: serviceRaw.logisticsVO?.receiverName, // 收货人
receiverPhone: serviceRaw.logisticsVO.receiverPhone, // 收货人电话 receiverPhone: serviceRaw.logisticsVO?.receiverPhone, // 收货人电话
receiverAddress: this.composeAddress(serviceRaw), // 收货人地址 receiverAddress: this.composeAddress(serviceRaw), // 收货人地址
applyRemark: serviceRaw.rightsRefund.refundDesc, // 申请退款时的填写的说明 applyRemark: serviceRaw.customerRefundDesc, // 申请退款时的填写的说明
buttons: serviceRaw.buttonVOs || [], buttons: serviceRaw.buttonVOs || [],
logistics: serviceRaw.logisticsVO, logistics: serviceRaw?.logisticsVO,
}; };
const proofs = serviceRaw.rights.rightsImageUrls || []; const proofs = serviceRaw.customerRefundImg.split(',') || [];
this.setData({ this.setData({
serviceRaw, serviceRaw,
service, service,
deliveryButton, deliveryButton,
'gallery.proofs': proofs, 'gallery.proofs': proofs,
showProofs: showProofs:
serviceRaw.rights.userRightsStatus === ServiceStatus.PENDING_VERIFY && serviceRaw.status === ServiceStatus.PENDING_VERIFY &&
(service.applyRemark || proofs.length > 0), (service.applyRemark || proofs.length > 0),
}); });
wx.setNavigationBarTitle({ wx.setNavigationBarTitle({
title: TitleConfig[service.type], title: TitleConfig[service.refundType],
}); });
}); });
}, },
composeAddress(service) { composeAddress(service) {
return [ return [
service.logisticsVO.receiverProvince, service.logisticsVO?.receiverProvince,
service.logisticsVO.receiverCity, service.logisticsVO?.receiverCity,
service.logisticsVO.receiverCountry, service.logisticsVO?.receiverCountry,
service.logisticsVO.receiverArea, service.logisticsVO?.receiverArea,
service.logisticsVO.receiverAddress, service.logisticsVO?.receiverAddress,
] ]
.filter((item) => !!item) .filter((item) => !!item)
.join(' '); .join(' ');
@ -178,8 +182,8 @@ Page({
/** 获取状态ICON */ /** 获取状态ICON */
genStatusIcon(item) { genStatusIcon(item) {
const { userRightsStatus, afterSaleRequireType } = item; const { status, refundType } = item;
switch (userRightsStatus) { switch (status) {
// 退款成功 // 退款成功
case ServiceStatus.REFUNDED: { case ServiceStatus.REFUNDED: {
return 'succeed'; return 'succeed';
@ -189,7 +193,7 @@ Page({
return 'indent_close'; return 'indent_close';
} }
default: { default: {
switch (afterSaleRequireType) { switch (refundType) {
case 'REFUND_MONEY': { case 'REFUND_MONEY': {
return 'goods_refund'; return 'goods_refund';
} }

View File

@ -76,7 +76,7 @@
<view slot="description"> <view slot="description">
<view> {{service.receiverAddress}} </view> <view> {{service.receiverAddress}} </view>
<view>收货人:{{service.receiverName}}</view> <view>收货人:{{service.receiverName}}</view>
<view>收货人手机:{{service.receiverName}}</view> <view>收货人手机:{{service.receiverPhone}}</view>
</view> </view>
</t-cell> </t-cell>
</t-cell-group> </t-cell-group>
@ -97,6 +97,7 @@
> >
<view slot="footer" class="order-goods-card-footer"> <view slot="footer" class="order-goods-card-footer">
<wr-price <wr-price
priceUnit="yuan"
price="{{goods.itemRefundAmount}}" price="{{goods.itemRefundAmount}}"
fill fill
wr-class="order-goods-card-footer-price-class" wr-class="order-goods-card-footer-price-class"
@ -118,7 +119,7 @@
title="订单编号" title="订单编号"
note="{{service.orderNo}}" note="{{service.orderNo}}"
/> />
<t-cell <!-- <t-cell
bordered="{{false}}" bordered="{{false}}"
t-class="t-refund-wrapper" t-class="t-refund-wrapper"
t-class-title="t-refund-info" t-class-title="t-refund-info"
@ -127,7 +128,7 @@
note="{{service.rightsNo}}" note="{{service.rightsNo}}"
> >
<view slot="right-icon" class="text-btn" hover-class="text-btn--active" bindtap="onServiceNoCopy">复制 </view> <view slot="right-icon" class="text-btn" hover-class="text-btn--active" bindtap="onServiceNoCopy">复制 </view>
</t-cell> </t-cell> -->
<t-cell <t-cell
bordered="{{false}}" bordered="{{false}}"
t-class="t-refund-wrapper" t-class="t-refund-wrapper"

View File

@ -56,14 +56,14 @@ export const ServiceButtonTypes = {
// 售后状态 // 售后状态
export const ServiceStatus = { export const ServiceStatus = {
PENDING_VERIFY: 100, //待审核 PENDING_VERIFY: 1, //待审核
VERIFIED: 110, // 已审核待寄回商品 VERIFIED: 2, // 已审核待寄回商品
PENDING_DELIVERY: 120, // 等待买家寄回商品 PENDING_DELIVERY: 2, // 等待买家寄回商品
PENDING_RECEIPT: 130, // 已寄回商品,待收货 PENDING_RECEIPT: 3, // 已寄回商品,待收货
RECEIVED: 140, // 已收货 RECEIVED: 4, // 已收货
EXCEPTION: 150, // 收货异常 EXCEPTION: 150, // 收货异常
REFUNDED: 160, // 已退款 REFUNDED: 4, // 已退款
CLOSED: 170, // 已关闭 CLOSED: 4, // 已关闭
}; };
// 售后收货状态 // 售后收货状态

View File

@ -0,0 +1,22 @@
import {
request
} from '../_utils/request';
/* 获取售后详情 */
export async function getOrderRefundDetails(data) {
return new Promise((resolve, reject) => {
request({
url: `OrderRefundApi/getOrderRefundDetails`,
method: 'Get',
data: data,
success: function (res) {
resolve(res);
},
fail: function (error) {
reject(error);
}
});
});
}