支付组件统一使用二维码展示

This commit is contained in:
2026-03-13 14:13:06 +08:00
parent 82bd8051d8
commit 2b77ea189b
16 changed files with 206 additions and 193 deletions

View File

@@ -6,10 +6,9 @@ export const usePlatformType = (): TradePlatform => {
// 在SSR环境下返回默认值
const [platform, setPlatform] = useState<TradePlatform>(() => {
if (typeof window === 'undefined') return TradePlatform.Desktop
// return window.matchMedia('(max-width: 768px)').matches
// ? TradePlatform.Mobile
// : TradePlatform.Desktop
return TradePlatform.Desktop
return window.matchMedia('(max-width: 768px)').matches
? TradePlatform.Mobile
: TradePlatform.Desktop
})
useEffect(() => {

View File

@@ -1,16 +1,26 @@
import {StaticImageData} from 'next/image'
import wechat from '@/components/composites/purchase/_assets/wechat.svg'
import alipay from '@/components/composites/purchase/_assets/alipay.svg'
import balance from '@/components/composites/purchase/_assets/balance.svg'
export const TradeMethodDecoration = {
alipay: {
text: '支付宝',
icon: alipay,
},
wechat: {
text: '微信支付',
icon: wechat,
},
export function getTradeMethodDecoration(method: TradeMethod) {
switch (method) {
case TradeMethod.Alipay:
return {
text: '支付宝',
icon: alipay,
}
case TradeMethod.Wechat:
return {
text: '微信支付',
icon: wechat,
}
default:
return {
text: '扫码支付',
icon: balance,
}
}
}
// 支付方法枚举