feat 添加订单相关功能对接

This commit is contained in:
AERWEN\26795 2023-10-25 00:43:30 +08:00
parent 5751ee0f04
commit 573f8800bb
10 changed files with 372 additions and 130 deletions

View File

@ -87,7 +87,7 @@ Page({
// name: m.refundMethodName, // name: m.refundMethodName,
// amount: m.refundMethodAmount, // amount: m.refundMethodAmount,
// })), // 退款明细 // })), // 退款明细
refundRequestAmount: serviceRaw.refundRequestAmount, // 申请退款金额 refundRequestAmount: serviceRaw.refundMoney, // 申请退款金额
// payTraceNo: serviceRaw.rightsRefund.traceNo, // 交易流水号 // payTraceNo: serviceRaw.rightsRefund.traceNo, // 交易流水号
createTime: serviceRaw.createTime, // 申请时间 createTime: serviceRaw.createTime, // 申请时间
logisticsNo: serviceRaw.trajectoryVos?.logisticsCompanyCode, // 退货物流单号 logisticsNo: serviceRaw.trajectoryVos?.logisticsCompanyCode, // 退货物流单号

View File

@ -20,7 +20,7 @@
title="{{service.isRefunded ? '退款金额' : '预计退款金额'}}" title="{{service.isRefunded ? '退款金额' : '预计退款金额'}}"
bordered="{{false}}" bordered="{{false}}"
> >
<wr-price slot="note" price="{{service.refundRequestAmount}}" fill /> <wr-price priceUnit="yuan" slot="note" price="{{service.refundRequestAmount}}" fill />
</t-cell> </t-cell>
<t-cell <t-cell
wx:for="{{service.refundMethodList}}" wx:for="{{service.refundMethodList}}"
@ -33,7 +33,7 @@
title="{{item.name}}" title="{{item.name}}"
bordered="{{service.refundMethodList.length - 1 === index ? true : false}}" bordered="{{service.refundMethodList.length - 1 === index ? true : false}}"
> >
<wr-price slot="note" price="{{item.amount}}" fill /> <wr-price priceUnit="yuan" slot="note" price="{{item.amount}}" fill />
</t-cell> </t-cell>
<block wx:if="{{service.isRefunded}}"> <block wx:if="{{service.isRefunded}}">
<t-cell <t-cell
@ -144,7 +144,7 @@
t-class-note="t-refund-note" t-class-note="t-refund-note"
title="退款金额" title="退款金额"
> >
<wr-price slot="note" price="{{service.refundRequestAmount}}" fill /> <wr-price priceUnit="yuan" slot="note" price="{{service.refundRequestAmount}}" fill />
</t-cell> </t-cell>
<t-cell <t-cell
bordered="{{false}}" bordered="{{false}}"

View File

@ -1,7 +1,13 @@
import Dialog from 'tdesign-miniprogram/dialog/index'; import Dialog from 'tdesign-miniprogram/dialog/index';
import Toast from 'tdesign-miniprogram/toast/index'; import Toast from 'tdesign-miniprogram/toast/index';
import { priceFormat } from '../../../utils/util'; import {
import { OrderStatus, ServiceType, ServiceReceiptStatus } from '../config'; priceFormat
} from '../../../utils/util';
import {
OrderStatus,
ServiceType,
ServiceReceiptStatus
} from '../config';
import reasonSheet from '../components/reason-sheet/reasonSheet'; import reasonSheet from '../components/reason-sheet/reasonSheet';
import { import {
fetchRightsPreview, fetchRightsPreview,
@ -9,6 +15,15 @@ import {
fetchApplyReasonList, fetchApplyReasonList,
dispatchApplyService, dispatchApplyService,
} from '../../../services/order/applyService'; } from '../../../services/order/applyService';
import {
getRefundReason
} from '~/services/order/getRefundReason';
import {
addOrderRefund
} from '~/services/order/addOrderRefund';
import {
ServerBasePath
} from '~/app'
Page({ Page({
query: {}, query: {},
@ -16,18 +31,38 @@ Page({
uploading: false, // 凭证上传状态 uploading: false, // 凭证上传状态
canApplyReturn: true, // 是否可退货 canApplyReturn: true, // 是否可退货
goodsInfo: {}, goodsInfo: {},
receiptStatusList: [ goodsList: [],
{ desc: '未收到货', status: ServiceReceiptStatus.NOT_RECEIPTED }, sessionFrom:{
{ desc: '已收到货', status: ServiceReceiptStatus.RECEIPTED }, rightsImageUrls: ""
},
receiptStatusList: [{
desc: '未收到货',
status: ServiceReceiptStatus.NOT_RECEIPTED
},
{
desc: '已收到货',
status: ServiceReceiptStatus.RECEIPTED
},
], ],
applyReasons: [], applyReasons: [],
serviceType: null, // 20-仅退款10-退货退款 serviceType: null, // 20-仅退款10-退货退款
serviceFrom: { serviceFrom: {
returnNum: 1, returnNum: 1,
receiptStatus: { desc: '请选择', status: null }, receiptStatus: {
applyReason: { desc: '请选择', type: null }, desc: '请选择',
status: null
},
applyReason: {
desc: '请选择',
type: null
},
// max-填写上限(单位分)current-当前值(单位分)temp输入框中的值(单位元) // max-填写上限(单位分)current-当前值(单位分)temp输入框中的值(单位元)
amount: { max: 0, current: 0, temp: 0, focus: false }, amount: {
max: 0,
current: 0,
temp: 0,
focus: false
},
remark: '', remark: '',
rightsImageUrls: [], rightsImageUrls: [],
}, },
@ -40,6 +75,9 @@ Page({
}, },
submitting: false, submitting: false,
inputDialogVisible: false, inputDialogVisible: false,
imageProps: {
mode: 'aspectFit',
},
uploadGridConfig: { uploadGridConfig: {
column: 3, column: 3,
width: 212, width: 212,
@ -88,7 +126,12 @@ Page({
valid = false; valid = false;
msg = '退款金额必须大于0'; msg = '退款金额必须大于0';
} }
this.setData({ validateRes: { valid, msg } }); this.setData({
validateRes: {
valid,
msg
}
});
}, },
onLoad(query) { onLoad(query) {
@ -112,12 +155,17 @@ Page({
}, },
checkQuery() { checkQuery() {
const { orderNo, skuId } = this.query; const {
orderNo,
skuId
} = this.query;
if (!orderNo) { if (!orderNo) {
Dialog.alert({ Dialog.alert({
content: '请先选择订单', content: '请先选择订单',
}).then(() => { }).then(() => {
wx.redirectTo({ url: 'pages/order/order-list/index' }); wx.redirectTo({
url: 'pages/order/order-list/index'
});
}); });
return false; return false;
} }
@ -133,33 +181,40 @@ Page({
}, },
async refresh() { async refresh() {
wx.showLoading({ title: 'loading' }); wx.showLoading({
title: 'loading'
});
try { try {
const res = await this.getRightsPreview(); // const res = await this.getRightsPreview();
const {
orderNo,
orderAmt,
goodsList,
freightFee
} = this.query;
wx.hideLoading(); wx.hideLoading();
const goodsInfo = { // const goodsInfo = {
id: res.data.skuId, // id: res.data.skuId,
thumb: res.data.goodsInfo && res.data.goodsInfo.skuImage, // thumb: res.data.goodsInfo && res.data.goodsInfo.skuImage,
title: res.data.goodsInfo && res.data.goodsInfo.goodsName, // title: res.data.goodsInfo && res.data.goodsInfo.goodsName,
spuId: res.data.spuId, // spuId: res.data.spuId,
skuId: res.data.skuId, // skuId: res.data.skuId,
specs: ((res.data.goodsInfo && res.data.goodsInfo.specInfo) || []).map((s) => s.specValue), // specs: ((res.data.goodsInfo && res.data.goodsInfo.specInfo) || []).map((s) => s.specValue),
paidAmountEach: res.data.paidAmountEach, // paidAmountEach: res.data.paidAmountEach,
boughtQuantity: res.data.boughtQuantity, // boughtQuantity: res.data.boughtQuantity,
}; // };
this.setData({ this.setData({
goodsInfo, // goodsInfo,
goodsList: JSON.parse(goodsList),
'serviceFrom.amount': { 'serviceFrom.amount': {
max: res.data.refundableAmount, max: orderAmt,
current: res.data.refundableAmount, current: orderAmt,
}, },
'serviceFrom.returnNum': res.data.numOfSku, // 'serviceFrom.returnNum': res.data.numOfSku,
amountTip: `最多可申请退款¥ ${priceFormat(res.data.refundableAmount, 2)},含发货运费¥ ${priceFormat( amountTip: `最多可申请退款¥ ${orderAmt},含发货运费¥ ${freightFee}`,
res.data.shippingFeeIncluded, // maxApplyNum: res.data.numOfSkuAvailable,
2,
)}`,
maxApplyNum: res.data.numOfSkuAvailable,
}); });
console.log(this.data, 'asdasdasdasdasd');
} catch (err) { } catch (err) {
wx.hideLoading(); wx.hideLoading();
throw err; throw err;
@ -167,7 +222,11 @@ Page({
}, },
async getRightsPreview() { async getRightsPreview() {
const { orderNo, skuId, spuId } = this.query; const {
orderNo,
skuId,
spuId
} = this.query;
const params = { const params = {
orderNo, orderNo,
skuId, skuId,
@ -179,14 +238,23 @@ Page({
}, },
onApplyOnlyRefund() { onApplyOnlyRefund() {
wx.setNavigationBarTitle({ title: '申请退款' }); wx.setNavigationBarTitle({
this.setData({ serviceRequireType: 'REFUND_MONEY' }); title: '申请退款'
});
this.setData({
serviceRequireType: 'REFUND_MONEY',
serviceType: ServiceType.ONLY_REFUND
});
this.switchReceiptStatus(0); this.switchReceiptStatus(0);
}, },
onApplyReturnGoods() { onApplyReturnGoods() {
wx.setNavigationBarTitle({ title: '申请退货退款' }); wx.setNavigationBarTitle({
this.setData({ serviceRequireType: 'REFUND_GOODS' }); title: '申请退货退款'
});
this.setData({
serviceRequireType: 'REFUND_GOODS'
});
const orderStatus = parseInt(this.query.orderStatus); const orderStatus = parseInt(this.query.orderStatus);
Promise.resolve() Promise.resolve()
.then(() => { .then(() => {
@ -208,7 +276,9 @@ Page({
return; return;
}) })
.then(() => { .then(() => {
this.setData({ serviceType: ServiceType.RETURN_GOODS }); this.setData({
serviceType: ServiceType.RETURN_GOODS
});
this.switchReceiptStatus(1); this.switchReceiptStatus(1);
}); });
}, },
@ -231,7 +301,9 @@ Page({
}, },
onChangeReturnNum(e) { onChangeReturnNum(e) {
const { value } = e.detail; const {
value
} = e.detail;
this.setData({ this.setData({
'serviceFrom.returnNum': value, 'serviceFrom.returnNum': value,
}); });
@ -259,34 +331,48 @@ Page({
if (!statusItem) { if (!statusItem) {
this.setData({ this.setData({
showReceiptStatusDialog: false, showReceiptStatusDialog: false,
'serviceFrom.receiptStatus': { desc: '请选择', status: null }, 'serviceFrom.receiptStatus': {
'serviceFrom.applyReason': { desc: '请选择', type: null }, // 收货状态改变时,初始化申请原因 desc: '请选择',
status: null
},
'serviceFrom.applyReason': {
desc: '请选择',
type: null
}, // 收货状态改变时,初始化申请原因
applyReasons: [], applyReasons: [],
}); });
return; return;
} }
// 仅选中项与当前项不一致时才切换申请原因列表applyReasons // 仅选中项与当前项不一致时才切换申请原因列表applyReasons
if (!statusItem || statusItem.status === this.data.serviceFrom.receiptStatus.status) { if (!statusItem || statusItem.status === this.data.serviceFrom.receiptStatus.status) {
this.setData({ showReceiptStatusDialog: false }); this.setData({
showReceiptStatusDialog: false
});
return; return;
} }
this.getApplyReasons(statusItem.status).then((reasons) => { this.getApplyReasons(statusItem.status).then((reasons) => {
this.setData({ this.setData({
showReceiptStatusDialog: false, showReceiptStatusDialog: false,
'serviceFrom.receiptStatus': statusItem, 'serviceFrom.receiptStatus': statusItem,
'serviceFrom.applyReason': { desc: '请选择', type: null }, // 收货状态改变时,重置申请原因 'serviceFrom.applyReason': {
desc: '请选择',
type: null
}, // 收货状态改变时,重置申请原因
applyReasons: reasons, applyReasons: reasons,
}); });
}); });
}, },
// 获取退款原因列表
getApplyReasons(receiptStatus) { getApplyReasons(receiptStatus) {
const params = { rightsReasonType: receiptStatus }; const params = {
return fetchApplyReasonList(params) rightsReasonType: receiptStatus
};
return getRefundReason(params)
.then((res) => { .then((res) => {
return res.data.rightsReasonList.map((reason) => ({ return res.data.map((reason) => ({
type: reason.id, type: reason.dictValue,
desc: reason.desc, desc: reason.dictLabel,
})); }));
}) })
.catch(() => { .catch(() => {
@ -295,13 +381,15 @@ Page({
}, },
onReceiptStatusDialogConfirm(e) { onReceiptStatusDialogConfirm(e) {
const { index } = e.currentTarget.dataset; const {
index
} = e.currentTarget.dataset;
this.switchReceiptStatus(index); this.switchReceiptStatus(index);
}, },
onAmountTap() { onAmountTap() {
this.setData({ this.setData({
'serviceFrom.amount.temp': priceFormat(this.data.serviceFrom.amount.current), 'serviceFrom.amount.temp': this.data.serviceFrom.amount.current,
'serviceFrom.amount.focus': true, 'serviceFrom.amount.focus': true,
inputDialogVisible: true, inputDialogVisible: true,
}); });
@ -319,15 +407,21 @@ Page({
// 对输入的值进行过滤 // 对输入的值进行过滤
onAmountInput(e) { onAmountInput(e) {
let { value } = e.detail; let {
value
} = e.detail;
const regRes = value.match(/\d+(\.?\d*)?/); // 输入中,允许末尾为小数点 const regRes = value.match(/\d+(\.?\d*)?/); // 输入中,允许末尾为小数点
value = regRes ? regRes[0] : ''; value = regRes ? regRes[0] : '';
this.setData({ 'serviceFrom.amount.temp': value }); this.setData({
'serviceFrom.amount.temp': value
});
}, },
// 失去焦点时更严格的过滤并转化为float // 失去焦点时更严格的过滤并转化为float
onAmountBlur(e) { onAmountBlur(e) {
let { value } = e.detail; let {
value
} = e.detail;
const regRes = value.match(/\d+(\.?\d+)?/); // 失去焦点时,不允许末尾为小数点 const regRes = value.match(/\d+(\.?\d+)?/); // 失去焦点时,不允许末尾为小数点
value = regRes ? regRes[0] : '0'; value = regRes ? regRes[0] : '0';
value = parseFloat(value) * 100; value = parseFloat(value) * 100;
@ -341,61 +435,72 @@ Page({
}, },
onAmountFocus() { onAmountFocus() {
this.setData({ 'serviceFrom.amount.focus': true }); this.setData({
'serviceFrom.amount.focus': true
});
}, },
onRemarkChange(e) { onRemarkChange(e) {
const { value } = e.detail; const {
value
} = e.detail;
this.setData({ this.setData({
'serviceFrom.remark': value, 'serviceFrom.remark': value,
}); });
}, },
// 发起申请售后请求 // 发起申请售后请求 提交
onSubmit() { onSubmit() {
this.submitCheck().then(() => { this.submitCheck().then(() => {
const params = { const params = {
rights: { orderGuid: this.query.orderGuid,
orderNo: this.query.orderNo, refundType: this.data.serviceType,
refundRequestAmount: this.data.serviceFrom.amount.current, goodsReceiveStatus: this.data.serviceFrom.receiptStatus.status,
rightsImageUrls: this.data.serviceFrom.rightsImageUrls, RefundReason: this.data.serviceFrom.applyReason.type,
rightsReasonDesc: this.data.serviceFrom.applyReason.desc, CustomerRefundDesc: this.data.serviceFrom.remark,
rightsReasonType: this.data.serviceFrom.receiptStatus.status, RefundMoney: this.data.serviceFrom.amount.current,
rightsType: this.data.serviceType, CustomerRefundImg: "",
},
rightsItem: [
{
itemTotalAmount: this.data.goodsInfo.price * this.data.serviceFrom.returnNum,
rightsQuantity: this.data.serviceFrom.returnNum,
skuId: this.query.skuId,
spuId: this.query.spuId,
},
],
refundMemo: this.data.serviceFrom.remark.current,
}; };
this.setData({ submitting: true }); if(this.data.sessionFrom.rightsImageUrls){
if(this.data.sessionFrom.rightsImageUrls.length != 0){
params.CustomerRefundImg = this.data.sessionFrom.rightsImageUrls.map(item => item.url).join(',')
}
}
console.log(params);
this.setData({
submitting: true
});
// 发起申请售后请求 // 发起申请售后请求
dispatchApplyService(params) addOrderRefund(params)
.then((res) => { .then((res) => {
Toast({ if(res.code === 200){
context: this, Toast({
selector: '#t-toast', context: this,
message: '申请成功', selector: '#t-toast',
icon: '', message: '申请成功',
}); icon: '',
});
wx.redirectTo({
url: `/pages/order/after-service-detail/index?rightsNo=${res.data.rightsNo}`, wx.redirectTo({
}); url: `/pages/order/after-service-list/index`,
});
}
}) })
.then(() => this.setData({ submitting: false })) .then(() => this.setData({
.catch(() => this.setData({ submitting: false })); submitting: false
}))
.catch(() => this.setData({
submitting: false
}));
}); });
}, },
submitCheck() { submitCheck() {
return new Promise((resolve) => { return new Promise((resolve) => {
const { msg, valid } = this.data.validateRes; const {
msg,
valid
} = this.data.validateRes;
if (!valid) { if (!valid) {
Toast({ Toast({
context: this, context: this,
@ -410,16 +515,22 @@ Page({
}, },
handleSuccess(e) { handleSuccess(e) {
const { files } = e.detail; const {
files
} = e.detail;
this.setData({ this.setData({
'sessionFrom.rightsImageUrls': files, 'sessionFrom.rightsImageUrls': files,
}); });
}, },
handleRemove(e) { handleRemove(e) {
const { index } = e.detail;
const { const {
sessionFrom: { rightsImageUrls }, index
} = e.detail;
const {
sessionFrom: {
rightsImageUrls
},
} = this.data; } = this.data;
rightsImageUrls.splice(index, 1); rightsImageUrls.splice(index, 1);
this.setData({ this.setData({
@ -438,4 +549,73 @@ Page({
uploading: true, uploading: true,
}); });
}, },
});
// 上传图片
handleAddPic(e) {
const {
files
} = e.detail;
// 每次选择图片都上传,展示每次上传图片的进度
files.forEach(file => this.onUploadPic(file))
},
// 移除Pic
handleRemovePic(e) {
const {
index
} = e.detail;
const {
sessionFrom: {
rightsImageUrls
},
} = this.data;
rightsImageUrls.splice(index, 1);
this.setData({
'sessionFrom.rightsImageUrls': rightsImageUrls,
});
},
// 上传图片方法
onUploadPic(file) {
const {
sessionFrom: {
rightsImageUrls
},
} = this.data;
this.setData({
'sessionFrom.rightsImageUrls' : [...rightsImageUrls, {
...file,
status: 'loading'
}],
});
const {
length
} = rightsImageUrls;
const task = wx.uploadFile({
url: ServerBasePath + 'Common/UploadFile', // 仅为示例,非真实的接口地址
filePath: file.url,
name: 'file',
formData: {
fileDir: 'Shops'
},
success: (res) => {
this.setData({
[`sessionFrom.rightsImageUrls[${length}].url`]: JSON.parse(res.data).data.url,
[`sessionFrom.rightsImageUrls[${length}].status`]: 'done',
});
// this.triggerEventToParent()
},
});
task.onProgressUpdate((res) => {
this.setData({
[`sessionFrom.rightsImageUrls[${length}].percent`]: res.progress,
});
});
},
});

View File

@ -1,17 +1,24 @@
<view class="select-service"> <view class="select-service">
<view class="order-goods-card"> <view class="order-goods-card" >
<wr-order-goods-card goods="{{goodsInfo}}" no-top-line thumb-class="order-goods-card-title-class"> <view wx:for="{{ goodsList }}"
wx:key="index"
wx:for-item="item">
<wr-order-goods-card goods="{{item}}" no-top-line thumb-class="order-goods-card-title-class">
<view slot="footer" class="order-goods-card-footer"> <view slot="footer" class="order-goods-card-footer">
<wr-price <wr-price
price="{{goodsInfo.paidAmountEach}}" priceUnit="yuan"
price="{{item.price}}"
fill fill
wr-class="order-goods-card-footer-price-class" wr-class="order-goods-card-footer-price-class"
symbol-class="order-goods-card-footer-price-symbol" symbol-class="order-goods-card-footer-price-symbol"
decimal-class="order-goods-card-footer-price-decimal" decimal-class="order-goods-card-footer-price-decimal"
/> />
<view class="order-goods-card-footer-num">x {{goodsInfo.boughtQuantity}}</view> <!-- <view class="order-goods-card-footer-num">x {{item.num}}</view> -->
</view> </view>
</wr-order-goods-card> </wr-order-goods-card>
</view>
</view> </view>
<view wx:if="{{!serviceRequireType}}" class="service-choice"> <view wx:if="{{!serviceRequireType}}" class="service-choice">
<t-cell-group> <t-cell-group>
@ -89,20 +96,22 @@
title="退款金额" title="退款金额"
t-class-description="refund-money__description" t-class-description="refund-money__description"
description="{{amountTip}}" description="{{amountTip}}"
bind:tap="onAmountTap"
> >
<!-- bind:tap="onAmountTap" -->
<view class="service-from-group__wrapper" slot="note"> <view class="service-from-group__wrapper" slot="note">
<wr-price <wr-price
priceUnit="yuan"
price="{{serviceFrom.amount.current}}" price="{{serviceFrom.amount.current}}"
fill fill
wr-class="refund-money-price-class" wr-class="refund-money-price-class"
symbol-class="refund-money-price-symbol" symbol-class="refund-money-price-symbol"
decimal-class="refund-money-price-decimal" decimal-class="refund-money-price-decimal"
/> />
<view class="service-from-group__price"> <!-- <view class="service-from-group__price">
修改 修改
<t-icon color="#bbb" name="chevron-right" size="30rpx" slot="left-icon" /> <t-icon color="#bbb" name="chevron-right" size="30rpx" slot="left-icon" />
</view> </view> -->
</view> </view>
</t-cell> </t-cell>
</t-cell-group> </t-cell-group>
@ -119,8 +128,18 @@
bind:change="onRemarkChange" bind:change="onRemarkChange"
/> />
</view> </view>
<view class="service-from-group__grid"> <view class="service-from-group__grid">
<t-upload <t-upload mediaType="{{['image','video']}}" max="{{5}}" files="{{sessionFrom.rightsImageUrls}}" bind:add="handleAddPic" bind:remove="handleRemovePic" gridConfig="{{uploadGridConfig}}" imageProps="{{imageProps}}">
<view slot="add-content" class="upload-addcontent-slot">
<t-icon name="add" size="60rpx" />
<view class="upload-desc">
<text>上传凭证</text>
<text>最多3张</text>
</view>
</view>
</t-upload>
<!-- <t-upload
media-type="{{['image','video']}}" media-type="{{['image','video']}}"
files="{{sessionFrom.rightsImageUrls}}" files="{{sessionFrom.rightsImageUrls}}"
bind:remove="handleRemove" bind:remove="handleRemove"
@ -137,7 +156,7 @@
<text>最多3张</text> <text>最多3张</text>
</view> </view>
</view> </view>
</t-upload> </t-upload> -->
</view> </view>
<view class="bottom-bar"> <view class="bottom-bar">
<t-button <t-button

View File

@ -88,7 +88,7 @@ Component({
const params = { orderRefundGuid: this.data.service.id }; const params = { orderRefundGuid: this.data.service.id };
return repeal(params).then((res) => { return repeal(params).then((res) => {
if(res.code === 200){ if(res.code === 200){
bindrefresh() this.triggerEvent('refresh')
Toast({ Toast({
context: this, context: this,
selector: '#t-toast', selector: '#t-toast',

View File

@ -31,16 +31,16 @@ Component({
type: Object, type: Object,
observer(order) { observer(order) {
// 判定有传goodsIndex 则认为是商品button bar, 仅显示申请售后按钮 // 判定有传goodsIndex 则认为是商品button bar, 仅显示申请售后按钮
if (this.properties?.goodsIndex !== null) { // if (this.properties?.goodsIndex !== null) {
const goods = order.goodsList[Number(this.properties.goodsIndex)]; // const goods = order.goodsList[Number(this.properties.goodsIndex)];
this.setData({ // this.setData({
buttons: { // buttons: {
left: [], // left: [],
right: (goods.buttons || []).filter((b) => b.type == OrderButtonTypes.APPLY_REFUND), // right: (goods.buttons || []).filter((b) => b.type == OrderButtonTypes.APPLY_REFUND),
}, // },
}); // });
return; // return;
} // }
// 订单的button bar 不显示申请售后按钮 // 订单的button bar 不显示申请售后按钮
const buttonsRight = (order.buttons || []) const buttonsRight = (order.buttons || [])
// .filter((b) => b.type !== OrderButtonTypes.APPLY_REFUND) // .filter((b) => b.type !== OrderButtonTypes.APPLY_REFUND)
@ -233,19 +233,15 @@ Component({
// 重新调起支付 // 重新调起支付
onPay(order) { onPay(order) {
Toast({
context: this,
selector: '#t-toast',
message: '你点击了去支付',
icon: 'check-circle',
});
let data = { let data = {
orderNo: order.orderNo, orderNo: order.orderNo,
openId: wx.getStorageSync('openId') openId: wx.getStorageSync('openId')
} }
wxRepay(data).then((res) => { wxRepay(data).then((res) => {
console.log(res, '重新调起支付的参数'); this.handlePay(res.data,order).then((res) => {
console.log(res);
})
}) })
}, },
@ -260,19 +256,24 @@ Component({
// 申请售后 // 申请售后
onApplyRefund(order) { onApplyRefund(order) {
console.log(order,'这里的参数'); console.log(order, '这里的参数');
const goods = order.goodsList[this.properties.goodsIndex]; const goods = order.goodsList[this.properties.goodsIndex];
const params = { const params = {
orderGuid: order.Guid, orderGuid: order.Guid,
orderNo: order.orderNo, orderNo: order.orderNo,
goodsList: JSON.stringify(order.goodsList),
skuId: goods?.skuId, skuId: goods?.skuId,
spuId: goods?.id, spuId: goods?.id,
thumb: goods?.thumb,
title: goods?.title,
spec: goods?.spec,
orderStatus: order.status, orderStatus: order.status,
logisticsNo: order.logisticsNo, logisticsNo: order.logisticsNo,
price: goods?.price, price: goods?.price,
num: goods?.num, num: goods?.num,
createTime: order.createTime, createTime: order.createTime,
orderAmt: order.totalAmount, orderAmt: order.totalAmount,
freightFee: order.freightFee,
payAmt: order.amount, payAmt: order.amount,
canApplyReturn: true, canApplyReturn: true,
}; };
@ -295,7 +296,6 @@ Component({
/** 添加订单评论 */ /** 添加订单评论 */
onAddComment(order) { onAddComment(order) {
console.log(order?.goodsList?.[0],'asdasdsa');
const imgUrl = order?.goodsList?.[0]?.thumb; const imgUrl = order?.goodsList?.[0]?.thumb;
const title = order?.goodsList?.[0]?.title; const title = order?.goodsList?.[0]?.title;
const specs = order?.goodsList?.[0]?.specs; const specs = order?.goodsList?.[0]?.specs;
@ -307,7 +307,7 @@ Component({
}, },
// 处理支付 // 处理支付
handlePay(data) { handlePay(data,order) {
const { const {
jsApiUiPackage, jsApiUiPackage,
outTradeNo, outTradeNo,
@ -317,8 +317,8 @@ Component({
const payOrderInfo = { const payOrderInfo = {
payInfo: jsApiUiPackage, payInfo: jsApiUiPackage,
orderId: outTradeNo, orderId: outTradeNo,
orderAmt: totalAmount, orderAmt: order.totalAmount,
payAmt: totalPayAmount, payAmt: order.totalAmount,
interactId: interactId, interactId: interactId,
tradeNo: outTradeNo, tradeNo: outTradeNo,
transactionId: transactionId, transactionId: transactionId,

View File

@ -9,7 +9,7 @@
<block wx:if="{{!selectedNum}}">你有{{couponsList.length}}张可用优惠券</block> <block wx:if="{{!selectedNum}}">你有{{couponsList.length}}张可用优惠券</block>
<block wx:else> <block wx:else>
已选中{{selectedNum}}张推荐优惠券, 共抵扣 已选中{{selectedNum}}张推荐优惠券, 共抵扣
<wr-price fill="{{false}}" price="{{reduce || 0}}" /> <wr-price priceUnit="yuan" fill="{{false}}" price="{{reduce || 0}}" />
</block> </block>
</view> --> </view> -->
<scroll-view class="coupons-list" scroll-y="true"> <scroll-view class="coupons-list" scroll-y="true">

View File

@ -64,7 +64,7 @@
<price priceUnit="yuan" fill class="real-pay" price="{{order.amount + ''}}" decimalSmaller /> <price priceUnit="yuan" fill class="real-pay" price="{{order.amount + ''}}" decimalSmaller />
</view> </view>
<!-- 订单按钮栏 --> <!-- 订单按钮栏 -->
<order-button-bar order="{{order}}" bindrefresh="onRefresh" data-order="{{order}}" /> <order-button-bar order="{{order}}" bindrefresh="onRefresh" data-order="{{order}}" />
</view> </view>
</order-card> </order-card>
<!-- 列表加载中/已全部加载 --> <!-- 列表加载中/已全部加载 -->

View File

@ -0,0 +1,21 @@
import {
request
} from '../_utils/request';
/** 申请售后 */
export function addOrderRefund(data) {
return new Promise((resolve, reject) => {
request({
url: `OrderRefundApi/addOrderRefund`,
method: 'POST',
data: data,
success: function (res) {
resolve(res);
},
fail: function (error) {
reject(error);
}
});
});
}

View File

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