完成售后页和处理页面的修改申请
This commit is contained in:
parent
9557a51e28
commit
ee60321a03
@ -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", //商品订单售后修改申请
|
||||
};
|
||||
|
||||
@ -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({
|
||||
|
||||
@ -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,27 +234,39 @@ 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);
|
||||
|
||||
this.afterSalePopup3 = false;
|
||||
// 这里可以添加提交后的处理逻辑
|
||||
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: '退款申请提交成功',
|
||||
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);
|
||||
});
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
@ -365,6 +365,7 @@ export default {
|
||||
},
|
||||
onShow() {
|
||||
this.getOrderList();
|
||||
uni.removeStorageSync('afterSaleItem')
|
||||
},
|
||||
};
|
||||
</script>
|
||||
|
||||
@ -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()返回上一页,触发index页面的onShow生命周期
|
||||
uni.navigateBack();
|
||||
return true; // 阻止默认返回行为
|
||||
},
|
||||
methods: {
|
||||
getServiceTypeText(type) {
|
||||
return type === 1 ? '退款' : (type === 2 ? '退货退款' : '换货');
|
||||
@ -194,7 +206,6 @@ export default {
|
||||
title: '订单撤销成功',
|
||||
icon: 'success'
|
||||
});
|
||||
this.$emit('revokeApplySuccess');
|
||||
});
|
||||
}
|
||||
},
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user