| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354 |
- /** 订单列表/详情:支付方式与支付或结算说明(与后端 paymentMethod / payStatus / clientSettlementStatus 对齐) */
- export function paymentMethodLabel(method) {
- const raw =
- method &&
- typeof method === 'object' &&
- ('paymentMethod' in method || 'payment_method' in method)
- ? method.paymentMethod ?? method.payment_method
- : method
- const m = String(raw || 'online')
- .trim()
- .toLowerCase()
- return m === 'offline' ? '线下支付' : '线上支付'
- }
- /**
- * @param {{ paymentMethod?: string, payStatus?: string, clientSettlementStatus?: string }} order
- */
- export function paymentOrSettlementSubLabel(order) {
- const m = String(order?.paymentMethod || 'online')
- .trim()
- .toLowerCase()
- if (m === 'offline') {
- return order?.clientSettlementStatus === 'settled' ? '已结算' : '待结算'
- }
- const ps = String(order?.payStatus || 'pending_payment').trim()
- const map = {
- paid: '支付成功',
- pending_payment: '待支付',
- refunding: '退款中',
- refunded: '已退款',
- }
- return map[ps] || ps
- }
- export function paymentOrSettlementLabelTitle(order) {
- const m = String(order?.paymentMethod || 'online')
- .trim()
- .toLowerCase()
- return m === 'offline' ? '结算状态' : '支付状态'
- }
- export function paymentSubLabelClass(order) {
- const m = String(order?.paymentMethod || 'online')
- .trim()
- .toLowerCase()
- if (m === 'offline') {
- return order?.clientSettlementStatus === 'settled' ? 'settled' : 'pending'
- }
- const ps = String(order?.payStatus || 'pending_payment').trim()
- if (ps === 'paid') return 'settled'
- if (ps === 'refunding' || ps === 'refunded') return 'warn'
- return 'pending'
- }
|