完成售后页和处理页面的修改申请

This commit is contained in:
赵毅 2025-09-12 15:07:15 +08:00
parent 9557a51e28
commit ee60321a03
5 changed files with 66 additions and 39 deletions

View File

@ -6,4 +6,5 @@ export const apiArr = {
isAllow: "/api/v2/wechat/commodity/after-sales/is-allow", //判断订单是否能申请售后
revokeApply: "/api/v2/wechat/commodity/after-sales/revoke-apply", //撤销售后申请
changeGoodsList: "/api/v2/wechat/commodity/after-sales/change-goods-list", //商品售后换货商品列表
updateApply: "/api/v2/wechat/commodity/after-sales/update-apply", //商品订单售后修改申请
};

View File

@ -42,7 +42,7 @@
<!-- 操作按钮 -->
<view class="action-buttons">
<button class="modify-btn" @click="modifyApplication">修改申请</button>
<button class="modify-btn" @click="modifyApplication(item)">修改申请</button>
<button class="cancel-btn" @click="cancelApplication(item)">撤销申请</button>
</view>
</view>
@ -121,8 +121,8 @@ export default {
const seconds = String(date.getSeconds()).padStart(2, '0');
return `${year}-${month}-${day} ${hours}:${minutes}:${seconds}`;
},
modifyApplication() {
console.log('修改申请');
modifyApplication(item) {
NavgateTo(`../apply/index?item=${JSON.stringify(item)}`);
},
cancelApplication(item) {
uni.showModal({

View File

@ -72,7 +72,7 @@
退货退款</view>
<view :class="['asTab2', selectedAfterSaleType2 === 1 ? 'active' : '']"
@click="selectAfterSaleType2(1)">
退
退
</view>
</view>
<view class="reason-list" v-if="selectedAfterSaleType2 === 0">
@ -103,14 +103,15 @@ import {
upload,
NavgateTo
} from '../../../utils';
import { apiArr } from "../../../api/afterSale";
export default {
data() {
return {
currentAfterSale: null,
afterSalePopup2: false,
afterSalePopup3: false,
selectedAfterSaleType2: 0, // 0:退/退, 1:退
selectedAfterSaleType2: 0, // 0:退/退, 1:退
selectedAsReason: 0,
selectedServiceType: '',
selectedRefundReason: '',
@ -119,9 +120,10 @@ export default {
postage: 0,
refundDescription: '',
refundMethod: '自行寄回',
merchantAddress: '衡水市路北街道中心北大街世纪名城41号楼',
merchantContact: '高尚 18032753127',
merchantAddress: '',
merchantContact: '',
imgList: [],
afterSalesType: 2,
applyRefundReasons: [
'商品质量问题',
'商品与描述不符',
@ -143,8 +145,10 @@ export default {
this.currentAfterSale = item;
// 退
if (item) {
this.refundAmount = item.sales_price || 0;
this.refundAmount = item.refund_amount || 0;
this.maxRefundAmount = item.sales_price || 0;
this.merchantAddress = item.supplier_address || '未设置';
this.merchantContact = `${item.supplier_name} ${item.supplier_phone}` || '未设置';
}
},
methods: {
@ -153,12 +157,13 @@ export default {
this.afterSalePopup2 = false;
},
closeAfterSalePopup3() {
this.afterSalePopup3 = false;
},
//
selectAfterSaleType2(index) {
if (index == 0) {
this.afterSalesType = 2;
} else {
this.afterSalesType = 1;
}
this.selectedAfterSaleType2 = index;
},
@ -169,7 +174,7 @@ export default {
// 退
confirmAfterSaleCancel2() {
const afterSaleTypes = ['退货退款', '退'];
const afterSaleTypes = ['退货退款', '退'];
const selectedType = afterSaleTypes[this.selectedAfterSaleType2];
console.log('选中的售后类型:', selectedType);
@ -191,7 +196,6 @@ export default {
// 退
openAfterSalePopup2(type) {
this.afterSalePopup3 = false;
this.afterSalePopup2 = true;
},
@ -213,16 +217,14 @@ export default {
// 退
modifyRefundAmount() {
console.log('修改退款金额');
// 退
},
//
viewAddressDetails() {
console.log('查看地址详情');
//
},
// 退
//
submitRefundApplication() {
if (!this.selectedServiceType || !this.selectedRefundReason) {
uni.showToast({
@ -232,26 +234,38 @@ export default {
return;
}
//
const refundInfo = {
serviceType: this.selectedServiceType,
refundReason: this.selectedRefundReason,
refundAmount: this.refundAmount,
maxRefundAmount: this.maxRefundAmount,
postage: this.postage,
refundDescription: this.refundDescription,
refundMethod: this.refundMethod,
merchantAddress: this.merchantAddress,
merchantContact: this.merchantContact,
imgList: this.imgList
};
console.log('提交退款申请:', refundInfo);
const params = {
id: this.currentAfterSale.id,
after_sales_type: this.afterSalesType,
after_sales_reason: this.selectedRefundReason,
refund_amount: this.refundAmount,
application_description: this.refundDescription,
application_images: this.imgList && this.imgList.length > 0 ?
this.imgList.map(img => img.url).join(',') : '',
receiving_address: this.merchantAddress
}
console.log("🚀 ~ submitRefundApplication ~ params:", params)
request(apiArr.updateApply, "POST", params).then((res) => {
uni.showToast({
title: '申请提交成功',
icon: 'success'
});
this.afterSalePopup3 = false;
//
uni.showToast({
title: '退款申请提交成功',
icon: 'success'
//
const updatedAfterSale = {
...this.currentAfterSale,
after_sales_type: this.afterSalesType,
after_sales_reason: this.selectedRefundReason,
refund_amount: this.refundAmount,
application_description: this.refundDescription,
application_images: this.imgList && this.imgList.length > 0 ?
this.imgList.map(img => img.url).join(',') : ''
};
setTimeout(() => {
this.currentAfterSale = updatedAfterSale;
uni.setStorageSync('afterSaleItem', updatedAfterSale);
}, 1500);
});
}
}

View File

@ -365,6 +365,7 @@ export default {
},
onShow() {
this.getOrderList();
uni.removeStorageSync('afterSaleItem')
},
};
</script>

View File

@ -117,7 +117,6 @@
</template>
<script>
import { apiArr } from "../../../api/afterSale";
import {
isPhone,
@ -139,11 +138,24 @@ export default {
//
this.pickerDefaultDate = new Date(this.currentAfterSale.create_time);
},
onShow() {
const storageAfterSale = uni.getStorageSync('afterSaleItem');
if (storageAfterSale) {
this.currentAfterSale = storageAfterSale;
uni.removeStorageSync('afterSaleItem');
}
},
onLoad(options) {
const item = JSON.parse(options?.item);
console.log("🚀 ~ onLoad ~ item:", item)
this.currentAfterSale = item;
},
// onBackPress
onBackPress() {
// 使uni.navigateBack()indexonShow
uni.navigateBack();
return true; //
},
methods: {
getServiceTypeText(type) {
return type === 1 ? '退款' : (type === 2 ? '退货退款' : '换货');
@ -194,7 +206,6 @@ export default {
title: '订单撤销成功',
icon: 'success'
});
this.$emit('revokeApplySuccess');
});
}
},