feat(售后订单): 添加售后数量统计功能并显示在标签页

- 在manager和seller端添加获取售后数量统计的API接口
- 修改售后订单页面,显示各状态对应的数量统计
- 新增计算属性serviceStatusWithCount动态生成带数量的标签页
- 在初始化、搜索和状态切换时调用统计接口更新数据
This commit is contained in:
pikachu1995@126.com
2025-08-29 11:36:45 +08:00
parent 78b058009b
commit 7db8484a7c
4 changed files with 81 additions and 9 deletions

View File

@@ -165,3 +165,8 @@ export const storeAddress = (sn) => {
export const getOrderNum = (params) => { export const getOrderNum = (params) => {
return getRequest(`/order/order/orderNum`, params) return getRequest(`/order/order/orderNum`, params)
} }
// 获取售后数量统计
export const getAfterSaleNumVO = (params) => {
return getRequest(`/order/afterSale/afterSaleNumVO`, params)
}

View File

@@ -90,7 +90,7 @@
<Card> <Card>
<div class="order-tab"> <div class="order-tab">
<Tabs v-model="currentStatus" @on-click="serviceStatusClick"> <Tabs v-model="currentStatus" @on-click="serviceStatusClick">
<TabPane v-for="(item,index) in serviceStatus" :key="index" :label="item.title" :name="item.value"> <TabPane v-for="item in serviceStatusWithCount" :key="item.value" :label="item.title" :name="item.value">
</TabPane> </TabPane>
</Tabs> </Tabs>
</div> </div>
@@ -316,13 +316,15 @@ export default {
{title: '卖家终止售后', value: 'SELLER_TERMINATION'}, {title: '卖家终止售后', value: 'SELLER_TERMINATION'},
{title: '买家取消售后', value: 'BUYER_CANCEL'} {title: '买家取消售后', value: 'BUYER_CANCEL'}
], ],
currentStatus: '' currentStatus: '',
afterSaleNumData: {} // 售后数量统计数据
}; };
}, },
methods: { methods: {
// 初始化数据 // 初始化数据
init() { init() {
this.getDataList(); this.getDataList();
this.getAfterSaleNumData();
}, },
// 分页 改变页码 // 分页 改变页码
changePage(v) { changePage(v) {
@@ -340,6 +342,7 @@ export default {
this.searchForm.pageNumber = 1; this.searchForm.pageNumber = 1;
this.searchForm.pageSize = 20; this.searchForm.pageSize = 20;
this.getDataList(); this.getDataList();
this.getAfterSaleNumData();
}, },
// 开始结束时间分别赋值 // 开始结束时间分别赋值
selectDateRange(v) { selectDateRange(v) {
@@ -358,9 +361,19 @@ export default {
this.total = res.result.total; this.total = res.result.total;
} }
}); });
// 获取售后状态数量
this.total = this.data.length; this.total = this.data.length;
this.loading = false; this.loading = false;
}, },
// 获取售后数量统计
getAfterSaleNumData() {
const { serviceStatus, ...searchParams } = this.searchForm;
API_Order.getAfterSaleNumVO(searchParams).then((res) => {
if (res.success) {
this.afterSaleNumData = res.result;
}
});
},
// 跳转售后详情 // 跳转售后详情
detail(v) { detail(v) {
let sn = v.sn; let sn = v.sn;
@@ -379,12 +392,30 @@ export default {
this.searchForm.serviceStatus = item; this.searchForm.serviceStatus = item;
} }
this.getDataList(); this.getDataList();
this.getAfterSaleNumData();
}, },
}, },
mounted() { mounted() {
this.init(); this.init();
}, },
}; computed: {
// 带数量的售后状态
serviceStatusWithCount() {
return [
{title: '全部', value: ''},
{title: `申请售后${this.afterSaleNumData.applyNum ? '(' + this.afterSaleNumData.applyNum + ')' : ''}`, value: 'APPLY'},
{title: `通过售后${this.afterSaleNumData.passNum ? '(' + this.afterSaleNumData.passNum + ')' : ''}`, value: 'PASS'},
{title: `拒绝售后${this.afterSaleNumData.refuseNum ? '(' + this.afterSaleNumData.refuseNum + ')' : ''}`, value: 'REFUSE'},
{title: `待收货${this.afterSaleNumData.buyerReturnNum ? '(' + this.afterSaleNumData.buyerReturnNum + ')' : ''}`, value: 'BUYER_RETURN'},
{title: `确认收货${this.afterSaleNumData.sellerConfirmNum ? '(' + this.afterSaleNumData.sellerConfirmNum + ')' : ''}`, value: 'SELLER_CONFIRM'},
{title: `完成售后${this.afterSaleNumData.completeNum ? '(' + this.afterSaleNumData.completeNum + ')' : ''}`, value: 'COMPLETE'},
{title: `卖家终止售后${this.afterSaleNumData.sellerTerminationNum ? '(' + this.afterSaleNumData.sellerTerminationNum + ')' : ''}`, value: 'SELLER_TERMINATION'},
{title: `买家取消售后${this.afterSaleNumData.buyerCancelNum ? '(' + this.afterSaleNumData.buyerCancelNum + ')' : ''}`, value: 'BUYER_CANCEL'},
{title: `等待平台退款${this.afterSaleNumData.waitRefundNum ? '(' + this.afterSaleNumData.waitRefundNum + ')' : ''}`, value: 'WAIT_REFUND'}
];
}
}
}
</script> </script>
<style lang="scss" scoped> <style lang="scss" scoped>
// Tab组件样式 // Tab组件样式

View File

@@ -173,3 +173,8 @@ export const getTracesList = (sn) => {
export const getOrderNum = (params) => { export const getOrderNum = (params) => {
return getRequest(`/order/order/orderNum`, params); return getRequest(`/order/order/orderNum`, params);
} }
// 获取售后数量统计
export const getAfterSaleNumVO = (params) => {
return getRequest(`/order/afterSale/afterSaleNumVO`, params);
}

View File

@@ -50,8 +50,7 @@
<Card> <Card>
<div class="order-tab"> <div class="order-tab">
<Tabs v-model="currentStatus" @on-click="serviceStatusClick"> <Tabs v-model="currentStatus" @on-click="serviceStatusClick">
<TabPane v-for="(item,index) in serviceStatus" :key="index" :label="item.title" :name="item.value"> <TabPane v-for="item in serviceStatusWithCount" :key="item.value" :label="item.title" :name="item.value"/>
</TabPane>
</Tabs> </Tabs>
</div> </div>
<Table <Table
@@ -114,7 +113,7 @@
order: "desc", // 默认排序方式 order: "desc", // 默认排序方式
startDate: "", // 起始时间 startDate: "", // 起始时间
endDate: "", // 终止时间 endDate: "", // 终止时间
serviceType:"RETURN_GOODS", // serviceType:"RETURN_GOODS",
orderSn:"", orderSn:"",
memberName:"", memberName:"",
goodsName:"" goodsName:""
@@ -232,15 +231,18 @@
{title: '确认收货', value: 'SELLER_CONFIRM'}, {title: '确认收货', value: 'SELLER_CONFIRM'},
{title: '完成售后', value: 'COMPLETE'}, {title: '完成售后', value: 'COMPLETE'},
{title: '卖家终止售后', value: 'SELLER_TERMINATION'}, {title: '卖家终止售后', value: 'SELLER_TERMINATION'},
{title: '买家取消售后', value: 'BUYER_CANCEL'} {title: '买家取消售后', value: 'BUYER_CANCEL'},
{title: '等待平台退款', value: 'WAIT_REFUND'}
], ],
currentStatus: '' currentStatus: '',
afterSaleNumData: {} // 售后数量统计数据
}; };
}, },
methods: { methods: {
// 初始化数据 // 初始化数据
init() { init() {
this.getDataList(); this.getDataList();
this.getAfterSaleNumData();
}, },
// 改变页码 // 改变页码
changePage(v) { changePage(v) {
@@ -257,6 +259,7 @@
this.searchForm.pageNumber = 1; this.searchForm.pageNumber = 1;
this.searchForm.pageSize = 20; this.searchForm.pageSize = 20;
this.getDataList(); this.getDataList();
this.getAfterSaleNumData();
}, },
// 重置 // 重置
handleReset() { handleReset() {
@@ -268,7 +271,7 @@
order: "desc", // 默认排序方式 order: "desc", // 默认排序方式
startDate: "", // 起始时间 startDate: "", // 起始时间
endDate: "", // 终止时间 endDate: "", // 终止时间
serviceType:"RETURN_GOODS", // serviceType:"RETURN_GOODS",
orderSn:"", orderSn:"",
memberName:"", memberName:"",
goodsName:"" goodsName:""
@@ -276,6 +279,7 @@
this.searchForm = defaultForm; this.searchForm = defaultForm;
this.selectDate = '' this.selectDate = ''
this.getDataList(); this.getDataList();
this.getAfterSaleNumData();
}, },
// 范围时间选择格式化 // 范围时间选择格式化
selectDateRange(v) { selectDateRange(v) {
@@ -297,6 +301,15 @@
this.total = this.data.length; this.total = this.data.length;
this.loading = false; this.loading = false;
}, },
// 获取售后数量统计
getAfterSaleNumData() {
const { serviceStatus, ...searchParams } = this.searchForm;
API_Order.getAfterSaleNumVO(searchParams).then((res) => {
if (res.success) {
this.afterSaleNumData = res.result;
}
});
},
// 退货订单详情 // 退货订单详情
detail(v) { detail(v) {
let sn = v.sn; let sn = v.sn;
@@ -316,11 +329,29 @@
this.searchForm.serviceStatus = item; this.searchForm.serviceStatus = item;
} }
this.getDataList(); this.getDataList();
this.getAfterSaleNumData();
}, },
}, },
mounted () { mounted () {
this.init(); this.init();
}, },
computed: {
// 带数量的售后状态
serviceStatusWithCount() {
return [
{title: '全部', value: ''},
{title: `申请售后${this.afterSaleNumData.applyNum ? '(' + this.afterSaleNumData.applyNum + ')' : ''}`, value: 'APPLY'},
{title: `通过售后${this.afterSaleNumData.passNum ? '(' + this.afterSaleNumData.passNum + ')' : ''}`, value: 'PASS'},
{title: `拒绝售后${this.afterSaleNumData.refuseNum ? '(' + this.afterSaleNumData.refuseNum + ')' : ''}`, value: 'REFUSE'},
{title: `待收货${this.afterSaleNumData.buyerReturnNum ? '(' + this.afterSaleNumData.buyerReturnNum + ')' : ''}`, value: 'BUYER_RETURN'},
{title: `确认收货${this.afterSaleNumData.sellerConfirmNum ? '(' + this.afterSaleNumData.sellerConfirmNum + ')' : ''}`, value: 'SELLER_CONFIRM'},
{title: `完成售后${this.afterSaleNumData.completeNum ? '(' + this.afterSaleNumData.completeNum + ')' : ''}`, value: 'COMPLETE'},
{title: `卖家终止售后${this.afterSaleNumData.sellerTerminationNum ? '(' + this.afterSaleNumData.sellerTerminationNum + ')' : ''}`, value: 'SELLER_TERMINATION'},
{title: `买家取消售后${this.afterSaleNumData.buyerCancelNum ? '(' + this.afterSaleNumData.buyerCancelNum + ')' : ''}`, value: 'BUYER_CANCEL'},
{title: `等待平台退款${this.afterSaleNumData.waitRefundNum ? '(' + this.afterSaleNumData.waitRefundNum + ')' : ''}`, value: 'WAIT_REFUND'}
];
}
},
// 页面缓存处理从该页面离开时修改KeepAlive为false保证进入该页面是刷新 // 页面缓存处理从该页面离开时修改KeepAlive为false保证进入该页面是刷新
beforeRouteLeave(to, from, next) { beforeRouteLeave(to, from, next) {
from.meta.keepAlive = false from.meta.keepAlive = false