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

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", //判断订单是否能申请售后 isAllow: "/api/v2/wechat/commodity/after-sales/is-allow", //判断订单是否能申请售后
revokeApply: "/api/v2/wechat/commodity/after-sales/revoke-apply", //撤销售后申请 revokeApply: "/api/v2/wechat/commodity/after-sales/revoke-apply", //撤销售后申请
changeGoodsList: "/api/v2/wechat/commodity/after-sales/change-goods-list", //商品售后换货商品列表 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"> <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> <button class="cancel-btn" @click="cancelApplication(item)">撤销申请</button>
</view> </view>
</view> </view>
@ -121,8 +121,8 @@ export default {
const seconds = String(date.getSeconds()).padStart(2, '0'); const seconds = String(date.getSeconds()).padStart(2, '0');
return `${year}-${month}-${day} ${hours}:${minutes}:${seconds}`; return `${year}-${month}-${day} ${hours}:${minutes}:${seconds}`;
}, },
modifyApplication() { modifyApplication(item) {
console.log('修改申请'); NavgateTo(`../apply/index?item=${JSON.stringify(item)}`);
}, },
cancelApplication(item) { cancelApplication(item) {
uni.showModal({ uni.showModal({

View File

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

View File

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