feat(order): 调整订单状态相关文案及逻辑

- 将“已取消”改为“已关闭”及相关状态文案调整- 更新订单状态判断逻辑,适配新的状态值
- 修改订单搜索组件中的选项文案
- 调整订单列表中操作按钮的提示信息
- 优化订单数据查询条件,增加type过滤项- 更新导出表格的字段展示内容与结构
- 新增资金流水类型“新人注册奖”的显示支持
- 移除无用的时间格式化工具引入声明
This commit is contained in:
2025-11-13 13:04:14 +08:00
parent b5d4cc9189
commit 306b600da0
5 changed files with 35 additions and 28 deletions

View File

@@ -200,12 +200,12 @@ const columns = ref<ColumnItem[]>([
key: 'isInvoice',
align: 'center',
},
{
title: '订单状态',
dataIndex: 'orderStatus',
key: 'orderStatus',
align: 'center',
},
// {
// title: '订单状态',
// dataIndex: 'orderStatus',
// key: 'orderStatus',
// align: 'center',
// },
// {
// title: '支付时间',
// dataIndex: 'payTime',

View File

@@ -53,7 +53,6 @@
import { message, Modal } from 'ant-design-vue';
import { ExclamationCircleOutlined } from '@ant-design/icons-vue';
import type { EleProTable } from 'ele-admin-pro';
import { toDateString } from 'ele-admin-pro';
import type {
DatasourceFunction,
ColumnItem
@@ -124,7 +123,8 @@
10: { text: '佣金收入', color: 'success' },
20: { text: '提现支出', color: 'warning' },
30: { text: '转账支出', color: 'error' },
40: { text: '转账收入', color: 'processing' }
40: { text: '转账收入', color: 'processing' },
50: { text: '新人注册奖', color: 'processing' }
};
const type = typeMap[text] || { text: '未知', color: 'default' };
return { type: 'tag', props: { color: type.color }, children: type.text };
@@ -137,7 +137,7 @@
align: 'center',
customRender: ({ text, record }) => {
const amount = parseFloat(text || '0').toFixed(2);
const isIncome = record.flowType === 10 || record.flowType === 40;
const isIncome = record.flowType === 10 || record.flowType === 40 || record.flowType === 50;
return {
type: 'span',
props: {

View File

@@ -66,8 +66,11 @@
'税费',
'实发金额',
'一级佣金30%',
'一级佣金收益',
'二级佣金10%',
'二级佣金收益',
'三级佣金60%',
'三级佣金收益',
'月份',
'创建时间',
'结算时间',
@@ -90,9 +93,12 @@
`${d.settledPrice}`,
`${d.rate}`,
`${d.payPrice}`,
`${d.firstNickname}(${d.firstUserId}),收益:${d.firstMoney}`,
`${d.secondNickname}(${d.secondUserId}),收益:${d.secondMoney}`,
`${d.thirdNickname}(${d.thirdUserId}),收益:${d.thirdMoney}`,
`${d.firstNickname}(${d.firstUserId})`,
`${d.firstMoney}`,
`${d.secondNickname}(${d.secondUserId})`,
`${d.secondMoney}`,
`${d.thirdNickname}(${d.thirdUserId})`,
`${d.thirdMoney}`,
`${d.month}`,
`${d.createTime}`,
`${d.settleTime}`,

View File

@@ -83,7 +83,7 @@
style="width: 88px;"
@change="onType"
>
<a-select-option value="">全部</a-select-option>
<a-select-option value="">不限</a-select-option>
<a-select-option value="userId">
用户ID
</a-select-option>

View File

@@ -17,7 +17,7 @@
<a-tab-pane key="unreceived" tab="待收货"/>
<a-tab-pane key="completed" tab="已完成"/>
<a-tab-pane key="refunded" tab="退货/售后"/>
<a-tab-pane key="cancelled" tab="已取消"/>
<a-tab-pane key="cancelled" tab="已关闭"/>
</a-tabs>
<ele-pro-table
ref="tableRef"
@@ -83,8 +83,8 @@
<template v-if="column.key === 'orderStatus'">
<a-tag v-if="record.orderStatus === 0">未完成</a-tag>
<a-tag v-if="record.orderStatus === 1" color="green">已完成</a-tag>
<a-tag v-if="record.orderStatus === 2" color="red">取消</a-tag>
<a-tag v-if="record.orderStatus === 3" color="red">取消</a-tag>
<a-tag v-if="record.orderStatus === 2">关闭</a-tag>
<a-tag v-if="record.orderStatus === 3" color="red">关闭</a-tag>
<a-tag v-if="record.orderStatus === 4" color="red">退款申请中</a-tag>
<a-tag v-if="record.orderStatus === 5" color="red">退款被拒绝</a-tag>
<a-tag v-if="record.orderStatus === 6" color="orange">退款成功</a-tag>
@@ -116,7 +116,7 @@
@click.stop="handleCancelOrder(record)"
>
<span class="ele-text-warning">
<CloseOutlined /> 取消
<CloseOutlined /> 关闭
</span>
</a>
</template>
@@ -174,7 +174,7 @@
</a>
</template>
<!-- 删除操作 - 已完成取消退款成功的订单可以删除 -->
<!-- 删除操作 - 已完成关闭退款成功的订单可以删除 -->
<template v-if="canDeleteOrder(record)">
<a-divider type="vertical"/>
<a-popconfirm
@@ -258,6 +258,7 @@ const datasource: DatasourceFunction = ({
if (filters) {
where.status = filters.status;
}
where.type = 0;
return pageShopOrder({
...where,
...orders,
@@ -316,7 +317,7 @@ const columns = ref<ColumnItem[]>([
title: '订单状态',
dataIndex: 'orderStatus',
key: 'orderStatus',
align: 'center',
align: 'center'
},
// {
// title: '备注',
@@ -395,7 +396,7 @@ const onTabs = () => {
filterParams.statusFilter = 5;
break;
case 'cancelled':
// 已取消order_status = 2
// 已关闭order_status = 2
filterParams.statusFilter = 8;
break;
case 'refunded':
@@ -452,7 +453,7 @@ const query = () => {
};
/* 辅助判断函数 */
// 判断是否为取消状态
// 判断是否为关闭状态
const isCancelledStatus = (orderStatus?: number) => {
return [2, 3].includes(orderStatus || 0);
};
@@ -464,7 +465,7 @@ const isRefundStatus = (orderStatus?: number) => {
// 判断是否可以删除订单
const canDeleteOrder = (order: ShopOrder) => {
// 已完成、已取消、退款成功的订单可以删除 (原来是[1, 2, 6],后面改成只有取消的订单能删除)
// 已完成、已关闭、退款成功的订单可以删除 (原来是[1, 2, 6],后面改成只有关闭的订单能删除)
return [2].includes(order.orderStatus || 0);
};
@@ -475,21 +476,21 @@ const handleEditOrder = (record: ShopOrder) => {
// TODO: 实现订单修改功能
};
// 取消订单
// 关闭订单
const handleCancelOrder = (record: ShopOrder) => {
Modal.confirm({
title: '确认取消订单',
content: '确定要取消此订单吗?取消后无法恢复。',
title: '确认关闭订单',
content: '确定要关闭此订单吗?关闭后无法恢复。',
onOk: async () => {
try {
await updateShopOrder({
...record,
orderStatus: 2 // 已取消
orderStatus: 2 // 已关闭
});
message.success('订单已取消');
message.success('订单已关闭');
reload();
} catch (error: any) {
message.error(error.message || '取消订单失败');
message.error(error.message || '关闭订单失败');
}
}
});