完成申请售后退款金额的修改功能
This commit is contained in:
parent
49120a2e1f
commit
06c5e64f54
@ -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 ?
|
||||||
|
|||||||
@ -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) => {
|
||||||
|
|||||||
@ -281,6 +281,9 @@ export default {
|
|||||||
refundDescription: '',
|
refundDescription: '',
|
||||||
refundMethod: '自行寄回',
|
refundMethod: '自行寄回',
|
||||||
imgList: [],
|
imgList: [],
|
||||||
|
refundAmount: 0, // 当前退款金额
|
||||||
|
maxRefundAmount: 0, // 最大可退款金额
|
||||||
|
postage: 0, // 邮费金额
|
||||||
applyRefundReasons: [
|
applyRefundReasons: [
|
||||||
'商品质量问题',
|
'商品质量问题',
|
||||||
'商品与描述不符',
|
'商品与描述不符',
|
||||||
@ -401,12 +404,17 @@ 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 == '退货退款') {
|
||||||
@ -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;
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user