From 8e0790a2192ed44fe359743c4420d34e87a0da68 Mon Sep 17 00:00:00 2001 From: guofei Date: Wed, 12 Jun 2024 16:06:31 +0800 Subject: [PATCH] feat: order success bak --- src/pages/User/UserDetails.tsx | 23 ++++++++++++++++------- src/utils/const.ts | 21 +++++++++++++++++++++ 2 files changed, 37 insertions(+), 7 deletions(-) diff --git a/src/pages/User/UserDetails.tsx b/src/pages/User/UserDetails.tsx index 5dfeb0b..827235c 100644 --- a/src/pages/User/UserDetails.tsx +++ b/src/pages/User/UserDetails.tsx @@ -1,6 +1,7 @@ import { getUserByIdAPI } from '@/services/system/user'; -import { UxOrderStatus, UxOrderStatusTag } from '@/utils/const'; +import { OrderPayType, OrderPayTypeStr, UxOrderStatus, UxOrderStatusTag } from '@/utils/const'; import { formatDateTime } from '@/utils/format'; +import { AlipayCircleOutlined, WechatOutlined } from '@ant-design/icons'; import { ActionType } from '@ant-design/pro-components'; import { Descriptions, Empty, Form, Modal, Spin, Table, Tabs } from 'antd'; import { useEffect, useState } from 'react'; @@ -141,12 +142,20 @@ const UserDetailsModal = (props: PropTypes) => { align: 'center', render: (_, record: Order.OrderItem) => { // 支付类型 1. 微信 2. 支付宝 3. paypal -1: 后台创建 - if (record.payType === 1) { - return '微信'; - } else if (record.payType === 2) { - return '支付宝'; - } else if (record.payType === 3) { - return 'paypal'; + if ([OrderPayType.WX, OrderPayType.ZFB].includes(record.payType)) { + return ( +
+ {record.payType === OrderPayType.WX ? ( + + ) : ( + + )} + {Reflect.get(OrderPayTypeStr, record.payType)} +
+ ); + } + if (record.payType === OrderPayType.PAYPAL) { + return Reflect.get(OrderPayTypeStr, OrderPayType.PAYPAL); } return '后台创建'; }, diff --git a/src/utils/const.ts b/src/utils/const.ts index 63917a6..15d4803 100644 --- a/src/utils/const.ts +++ b/src/utils/const.ts @@ -14,3 +14,24 @@ export const UxOrderStatusTag: Record = { 4: '#e74c3c', // 红色 5: '订单超时支付(二维码过期)', // }; + +// 1: 待支付 2. 已支付 3. 订单取消 4. 支付失败 5. 订单超时支付(二维码过期) +export enum OrderStatus { + NO_PAY = 1, + HAVE_PAY = 2, + ORDER_CANCEL = 3, + PAY_ERROR = 4, + PAY_TIMEOUT = 5, +} + +export enum OrderPayType { + WX = 1, + ZFB = 2, + PAYPAL = 3, +} + +export const OrderPayTypeStr = { + 1: '微信', + 2: '支付宝', + 3: 'PayPal', +};