Files
web/src/lib/models/trade.ts

52 lines
1.1 KiB
TypeScript
Raw Normal View History

import {StaticImageData} from 'next/image'
import wechat from '@/components/composites/purchase/_assets/wechat.svg'
import alipay from '@/components/composites/purchase/_assets/alipay.svg'
export const TradeMethodDecoration = {
alipay: {
text: '支付宝',
icon: alipay,
},
wechat: {
text: '微信支付',
icon: wechat,
},
}
// 支付方法枚举
export const TradeMethod = {
Alipay: 1,
Wechat: 2,
Sft: 3,
SftAlipay: 4,
SftWechat: 5,
} as const
// 平台枚举
export const TradePlatform = {
Desktop: 1,
Mobile: 2,
} as const
// 支付状态枚举
export const TradeStatus = {
Pending: 0,
Completed: 1,
Cancelled: 2, // 同步修改
Refunded: 3,
} as const
// 定义类型
export type TradeMethod = typeof TradeMethod[keyof typeof TradeMethod]
export type TradePlatform = typeof TradePlatform[keyof typeof TradePlatform]
export type TradeStatus = typeof TradeStatus[keyof typeof TradeStatus]
// 支付方法配置类型
export type PaymentMethodConfig = {
value: TradeMethod
decoration: {
icon: StaticImageData
text: string
}
}