fix(订单中心):新增订单支付类型后,订单列表显示和首页统计添加筛选条件

This commit is contained in:
2025-09-01 14:35:49 +08:00
parent 925c915a9b
commit b477c5913b
3 changed files with 52 additions and 1 deletions
@@ -22,6 +22,7 @@ public interface DashboardMapper {
" AND q.is_test = 0",
"</if>",
"AND o.order_status IN (1, 3, 4, 5, 7, 8, 9)",
"AND (o.pay_type = 1 OR o.pay_type IS NULL)",
"<if test='p.tourismId != null'>",
" AND o.tourism_id = #{p.tourismId}",
"</if>",
@@ -52,6 +53,7 @@ public interface DashboardMapper {
"</if>",
"AND DATE(o.create_time) = CURDATE()",
"AND o.order_status IN (1, 3, 4, 5, 7, 8, 9)",
"AND (o.pay_type = 1 OR o.pay_type IS NULL)",
"<if test='p.tourismId != null'>",
" AND o.tourism_id = #{p.tourismId}",
"</if>",
@@ -75,6 +77,7 @@ public interface DashboardMapper {
" AND q.is_test = 0",
"</if>",
"AND o.order_status = 8",
"AND (o.pay_type = 1 OR o.pay_type IS NULL)",
"<if test='p.tourismId != null'>",
" AND o.tourism_id = #{p.tourismId}",
"</if>",
@@ -128,6 +131,7 @@ public interface DashboardMapper {
"<if test='p.includeTestQrcodes == null or p.includeTestQrcodes == false'>",
" AND q.is_test = 0",
"</if>",
"AND (o.pay_type = 1 OR o.pay_type IS NULL)",
"<if test='p.tourismId != null'>",
" AND o.tourism_id = #{p.tourismId}",
"</if>",
@@ -158,6 +162,7 @@ public interface DashboardMapper {
" AND q.is_test = 0",
"</if>",
" AND DATE(o.create_time) = CURDATE()",
"AND (o.pay_type = 1 OR o.pay_type IS NULL)",
"<if test='p.tourismId != null'>",
" AND o.tourism_id = #{p.tourismId}",
"</if>",
@@ -182,6 +187,7 @@ public interface DashboardMapper {
" AND q.is_test = 0",
"</if>",
"AND o.order_status IN (1, 3, 4, 5, 6, 7, 8, 9)",
"AND (o.pay_type = 1 OR o.pay_type IS NULL)",
"<if test='p.tourismId != null'>",
" AND o.tourism_id = #{p.tourismId}",
"</if>",
@@ -211,6 +217,7 @@ public interface DashboardMapper {
" AND q.is_test = 0",
"</if>",
"AND o.order_status = 8",
"AND (o.pay_type = 1 OR o.pay_type IS NULL)",
"<if test='p.tourismId != null'>",
" AND o.tourism_id = #{p.tourismId}",
"</if>",
@@ -244,6 +251,7 @@ public interface DashboardMapper {
" AND q.is_test = 0",
"</if>",
"AND o.order_status IN (1, 3, 4, 5, 7, 8, 9)",
"AND (o.pay_type = 1 OR o.pay_type IS NULL)",
"<if test='p.startTime != null and p.startTime != \"\"'>",
" AND o.create_time >= #{p.startTime}",
"</if>",
@@ -272,6 +280,7 @@ public interface DashboardMapper {
" AND q.is_test = 0",
"</if>",
" AND o.order_status = 3",
"AND (o.pay_type = 1 OR o.pay_type IS NULL)",
"<if test='p.startTime != null and p.startTime != \"\"'>",
" AND o.create_time >= #{p.startTime}",
"</if>",
@@ -300,6 +309,7 @@ public interface DashboardMapper {
" AND q.is_test = 0",
"</if>",
" AND o.order_status = 8",
"AND (o.pay_type = 1 OR o.pay_type IS NULL)",
"<if test='p.startTime != null and p.startTime != \"\"'>",
" AND o.create_time >= #{p.startTime}",
"</if>",
@@ -328,7 +338,7 @@ public interface DashboardMapper {
" q.code_id as qrcodeId,",
" COUNT(o.id) as orderCount",
"FROM qrcodes q",
"LEFT JOIN orders o ON q.code_id = o.code_id AND o.order_status IN (3, 7)",
"LEFT JOIN orders o ON q.code_id = o.code_id AND o.order_status IN (3, 7) AND (o.pay_type = 1 OR o.pay_type IS NULL)",
"WHERE q.is_del = 0",
"<if test='p.includeTestQrcodes == null or p.includeTestQrcodes == false'>",
" AND q.is_test = 0",
@@ -361,6 +371,7 @@ public interface DashboardMapper {
"</if>",
"AND DATE(o.create_time) = DATE_SUB(CURDATE(), INTERVAL 1 DAY)",
"AND o.order_status IN (1, 3, 4, 5, 7, 8, 9)",
"AND (o.pay_type = 1 OR o.pay_type IS NULL)",
"<if test='p.tourismId != null'>",
" AND o.tourism_id = #{p.tourismId}",
"</if>",
@@ -384,6 +395,7 @@ public interface DashboardMapper {
" AND q.is_test = 0",
"</if>",
"AND o.order_status = 3",
"AND (o.pay_type = 1 OR o.pay_type IS NULL)",
"<if test='p.tourismId != null'>",
" AND o.tourism_id = #{p.tourismId}",
"</if>",
@@ -426,6 +438,7 @@ public interface DashboardMapper {
"<if test='p.includeTestQrcodes == null or p.includeTestQrcodes == false'>",
" AND q.is_test = 0",
"</if>",
"AND (o.pay_type = 1 OR o.pay_type IS NULL)",
"<if test='p.tourismId != null'>",
" AND o.tourism_id = #{p.tourismId}",
"</if>",
@@ -457,6 +470,7 @@ public interface DashboardMapper {
"<if test='p.includeTestQrcodes == null or p.includeTestQrcodes == false'>",
" AND q.is_test = 0",
"</if>",
"AND (o.pay_type = 1 OR o.pay_type IS NULL)",
"<if test='p.tourismId != null'>",
" AND o.tourism_id = #{p.tourismId}",
"</if>",
@@ -482,6 +496,7 @@ public interface DashboardMapper {
"<if test='p.includeTestQrcodes == null or p.includeTestQrcodes == false'>",
" AND q.is_test = 0",
"</if>",
"AND (o.pay_type = 1 OR o.pay_type IS NULL)",
"<if test='p.tourismId != null'>",
" AND o.tourism_id = #{p.tourismId}",
"</if>",
@@ -507,6 +522,7 @@ public interface DashboardMapper {
"<if test='p.includeTestQrcodes == null or p.includeTestQrcodes == false'>",
" AND q.is_test = 0",
"</if>",
"AND (o.pay_type = 1 OR o.pay_type IS NULL)",
"<if test='p.tourismId != null'>",
" AND o.tourism_id = #{p.tourismId}",
"</if>",
@@ -31,6 +31,21 @@ const TableList: React.FC = () => {
return <Tag color={statusInfo.color}>{statusInfo.text}</Tag>;
}, []);
// 支付类型选项
const PAY_TYPE_OPTIONS = [
{ label: '微信支付', value: 1 },
{ label: '优惠券支付', value: 2 },
];
// 渲染支付类型标签
const renderPayType = (payType: number) => {
const payTypeInfo = PAY_TYPE_OPTIONS.find(option => option.value === payType);
if (!payTypeInfo) return <Tag color="default">未知</Tag>;
const color = payType === 1 ? 'green' : 'blue';
return <Tag color={color}>{payTypeInfo.label}</Tag>;
};
// 处理修改操作
const handleEdit = useCallback(async (fields: { orderStatus: number }) => {
const hide = message.loading('正在更新');
@@ -161,6 +176,17 @@ const TableList: React.FC = () => {
copyable: true,
ellipsis: true,
},
{
title: '支付类型',
dataIndex: 'payType',
render: (payType) => renderPayType(payType as number),
width: 120,
filters: PAY_TYPE_OPTIONS.map(option => ({
text: option.label,
value: option.value,
})),
filterMultiple: false,
},
{
title: '状态',
dataIndex: 'orderStatus',
@@ -223,6 +249,7 @@ const TableList: React.FC = () => {
orderNo: values.orderNo?.trim(), // 去除空格
orderStatus: values.orderStatus, // 状态
tourismId: values.tourismId, // 景区ID
payType: values.payType, // 支付类型
};
// 过滤掉空值
const validParams = Object.fromEntries(
@@ -244,6 +271,13 @@ const TableList: React.FC = () => {
options={STATUS_OPTIONS}
allowClear
/>
<ProFormSelect
name="payType"
label="支付类型"
placeholder="请选择支付类型"
options={PAY_TYPE_OPTIONS}
allowClear
/>
<ProFormSelect
name="tourismId"
label="景区"
@@ -7,6 +7,7 @@ declare namespace ORDERS {
id: number;
orderNo: string;
orderStatus: string;
payType?: number; // 支付类型(1:微信支付,2:优惠券支付)
createTime?: string;
tenantId?: string;
updateTime?: string;