完成申请售后退款金额的修改功能

This commit is contained in:
赵毅 2025-09-18 10:59:12 +08:00
parent 49120a2e1f
commit 06c5e64f54
3 changed files with 63 additions and 11 deletions

View File

@ -168,8 +168,6 @@ export default {
}, },
methods: { methods: {
selectTab(index, item) { selectTab(index, item) {
console.log("🚀 ~ selectTab ~ index:", index)
console.log("🚀 ~ selectTab ~ item:", item)
this.selectedTab = index; this.selectedTab = index;
if (index == 6) { if (index == 6) {
this.evaluateStatus = 2; this.evaluateStatus = 2;
@ -235,7 +233,7 @@ export default {
goods_ids: this.afterSaleOrderItem.commodity_order_item_list.map(item => item.goods_id), goods_ids: this.afterSaleOrderItem.commodity_order_item_list.map(item => item.goods_id),
after_sales_type: data.afterSalesType, after_sales_type: data.afterSalesType,
after_sales_reason: data.refundReason, after_sales_reason: data.refundReason,
refund_amount: this.afterSaleOrderItem.total_amount, refund_amount: data.refundAmount,
application_description: data.refundDescription, application_description: data.refundDescription,
// URL // URL
application_images: data.imgList && data.imgList.length > 0 ? application_images: data.imgList && data.imgList.length > 0 ?

View File

@ -234,7 +234,7 @@ export default {
goods_ids: this.afterSaleOrderItem.commodity_order_item_list.map(item => item.goods_id), goods_ids: this.afterSaleOrderItem.commodity_order_item_list.map(item => item.goods_id),
after_sales_type: data.afterSalesType, after_sales_type: data.afterSalesType,
after_sales_reason: data.refundReason, after_sales_reason: data.refundReason,
refund_amount: this.afterSaleOrderItem.total_amount, refund_amount: data.refundAmount,
application_description: data.refundDescription, application_description: data.refundDescription,
// URL // URL
application_images: data.imgList && data.imgList.length > 0 ? application_images: data.imgList && data.imgList.length > 0 ?
@ -262,7 +262,7 @@ export default {
// 退 // 退
handleRefundConfirmed(data) { handleRefundConfirmed(data) {
const params = { const params = {
order_id: this.afterSaleItem.id, order_id: this.afterSaleItem.id,
} }
request(afterSaleApi.orderRefund, "POST", params).then((res) => { request(afterSaleApi.orderRefund, "POST", params).then((res) => {

View File

@ -281,6 +281,9 @@ export default {
refundDescription: '', refundDescription: '',
refundMethod: '自行寄回', refundMethod: '自行寄回',
imgList: [], imgList: [],
refundAmount: 0, // 退
maxRefundAmount: 0, // 退
postage: 0, //
applyRefundReasons: [ applyRefundReasons: [
'商品质量问题', '商品质量问题',
'商品与描述不符', '商品与描述不符',
@ -401,13 +404,18 @@ export default {
} }
this.afterSalePopup2 = false; this.afterSalePopup2 = false;
}, },
// 退
// 退
confirmAfterSaleCancel2() { confirmAfterSaleCancel2() {
const afterSaleTypes = ['退货退款', '退款']; const afterSaleTypes = ['退货退款', '退款'];
const selectedType = afterSaleTypes[this.selectedAfterSaleType2]; const selectedType = afterSaleTypes[this.selectedAfterSaleType2];
console.log('选中的售后类型:', selectedType); console.log('选中的售后类型:', selectedType);
// 退退
this.refundAmount = this.orderItem.total_amount;
this.maxRefundAmount = this.orderItem.total_amount;
//
this.postage = this.orderItem.postage || 0;
let selectedReasonText = ''; let selectedReasonText = '';
if (selectedType == '退货退款') { if (selectedType == '退货退款') {
selectedReasonText = this.applyRefundReasons[this.selectedAsReason]; selectedReasonText = this.applyRefundReasons[this.selectedAsReason];
@ -486,7 +494,50 @@ export default {
// 退 // 退
modifyRefundAmount() { modifyRefundAmount() {
console.log('修改退款金额'); const that = this;
//
uni.showModal({
title: '修改退款金额',
editable: true,
placeholderText: `请输入不超过¥${this.maxRefundAmount.toFixed(2)}的金额`,
success: function (res) {
if (res.confirm && res.content) {
let inputAmount = parseFloat(res.content);
//
if (isNaN(inputAmount) || inputAmount <= 0) {
uni.showToast({
title: '请输入有效的金额',
icon: 'none'
});
return;
}
//
inputAmount = Math.round(inputAmount * 100) / 100;
// 退
if (inputAmount > that.maxRefundAmount) {
uni.showToast({
title: `退款金额不能超过¥${that.maxRefundAmount.toFixed(2)}`,
icon: 'none'
});
return;
}
// 退
that.refundAmount = inputAmount;
// 退
that.$emit('refundAmountChanged', that.refundAmount);
uni.showToast({
title: '退款金额修改成功',
icon: 'success'
});
}
}
});
}, },
// //
@ -511,9 +562,9 @@ export default {
afterSalesType: this.afterSalesType, afterSalesType: this.afterSalesType,
serviceType: this.selectedServiceType, serviceType: this.selectedServiceType,
refundReason: this.selectedRefundReason || this.changeRefundReason, refundReason: this.selectedRefundReason || this.changeRefundReason,
refundAmount: this.orderItem.total_amount, refundAmount: this.refundAmount || this.orderItem.total_amount,
maxRefundAmount: this.orderItem.total_amount, maxRefundAmount: this.maxRefundAmount || this.orderItem.total_amount,
postage: 0, // 0 postage: this.postage,
refundDescription: this.refundDescription, refundDescription: this.refundDescription,
refundMethod: this.refundMethod, refundMethod: this.refundMethod,
merchantAddress: this.orderItem.supplier_address, merchantAddress: this.orderItem.supplier_address,
@ -548,6 +599,9 @@ export default {
this.currentGGIndex = 0; this.currentGGIndex = 0;
this.refundDescription = ''; this.refundDescription = '';
this.imgList = []; this.imgList = [];
this.refundAmount = 0;
this.maxRefundAmount = 0;
this.postage = 0;
}, },
} }
}; };