This commit is contained in:
parent
3ac84c8fcf
commit
647634a1f9
|
|
@ -15,6 +15,12 @@ describe('A5 launch', () => {
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
describe('A5 responses', () => {
|
describe('A5 responses', () => {
|
||||||
|
it('uses the backend id as the order number, independently of payment identifiers', () => {
|
||||||
|
expect(adaptA5Order({ id: 42, order_id: 'legacy', transaction_id: 'payment-123', out_trade_no: 'merchant-456' }))
|
||||||
|
.toMatchObject({ order_id: '42', transaction_id: 'payment-123', out_trade_no: 'merchant-456' })
|
||||||
|
expect(adaptA5Order({ id: 43 }).order_id).toBe('43')
|
||||||
|
expect(adaptA5Order({ transaction_id: 'payment-only' }).order_id).toBe('')
|
||||||
|
})
|
||||||
it('accepts numeric or string success codes, rejects failed HTTP and business responses', () => {
|
it('accepts numeric or string success codes, rejects failed HTTP and business responses', () => {
|
||||||
expect(unwrapA5Response(200, '{"code":"0","data":[]}').data).toEqual([])
|
expect(unwrapA5Response(200, '{"code":"0","data":[]}').data).toEqual([])
|
||||||
expect(() => unwrapA5Response(404, { code: 0 })).toThrow()
|
expect(() => unwrapA5Response(404, { code: 0 })).toThrow()
|
||||||
|
|
|
||||||
|
|
@ -132,8 +132,8 @@ export default function ComplaintPage ({ services }: { services?: ComplaintServi
|
||||||
</View>
|
</View>
|
||||||
<View className='complaint-hero__meta'>
|
<View className='complaint-hero__meta'>
|
||||||
<View className='complaint-hero__meta-row'>
|
<View className='complaint-hero__meta-row'>
|
||||||
<Text className='complaint-hero__meta-label'>交易ID</Text>
|
<Text className='complaint-hero__meta-label'>{services ? '订单编号' : '交易ID'}</Text>
|
||||||
<Text className='complaint-hero__meta-value'>{order?.out_trade_no || '-'}</Text>
|
<Text className='complaint-hero__meta-value'>{(services ? order?.order_id : order?.out_trade_no) || '-'}</Text>
|
||||||
</View>
|
</View>
|
||||||
<View className='complaint-hero__meta-row'>
|
<View className='complaint-hero__meta-row'>
|
||||||
<Text className='complaint-hero__meta-label'>交易时间</Text>
|
<Text className='complaint-hero__meta-label'>交易时间</Text>
|
||||||
|
|
|
||||||
|
|
@ -179,8 +179,9 @@ export default function Index ({ a5 = false }: { a5?: boolean }) {
|
||||||
a5={a5}
|
a5={a5}
|
||||||
order={order}
|
order={order}
|
||||||
onCopy={() => {
|
onCopy={() => {
|
||||||
if (!order.transaction_id) return
|
const number = a5 ? order.order_id : order.transaction_id
|
||||||
Taro.setClipboardData({ data: String(order.transaction_id) })
|
if (!number) return
|
||||||
|
Taro.setClipboardData({ data: String(number) })
|
||||||
}}
|
}}
|
||||||
onViewDetail={() => setDetailOrder(order)}
|
onViewDetail={() => setDetailOrder(order)}
|
||||||
onResubmit={() => openOrderPage('/pages/resubmit/index', order)}
|
onResubmit={() => openOrderPage('/pages/resubmit/index', order)}
|
||||||
|
|
@ -226,6 +227,7 @@ function OrderCard ({
|
||||||
onResubmit: () => void
|
onResubmit: () => void
|
||||||
onComplaint: () => void
|
onComplaint: () => void
|
||||||
}) {
|
}) {
|
||||||
|
const number = a5 ? order.order_id : order.transaction_id
|
||||||
const status = (a5 && A5_STATUSES[order.process_status]) || getStatusMeta(order.process_status, order.process_status_name)
|
const status = (a5 && A5_STATUSES[order.process_status]) || getStatusMeta(order.process_status, order.process_status_name)
|
||||||
const actions = a5 ? { complaint: true, submit: true, detail: order.process_status === '2' } : getOrderCardActions(order)
|
const actions = a5 ? { complaint: true, submit: true, detail: order.process_status === '2' } : getOrderCardActions(order)
|
||||||
|
|
||||||
|
|
@ -242,9 +244,9 @@ function OrderCard ({
|
||||||
<InfoLine label='订单时间:' value={order.create_time || order.pay_time || '-'} />
|
<InfoLine label='订单时间:' value={order.create_time || order.pay_time || '-'} />
|
||||||
|
|
||||||
<View className='order-card__row'>
|
<View className='order-card__row'>
|
||||||
<Text className='order-card__label'>交易单号:</Text>
|
<Text className='order-card__label'>{a5 ? '订单编号:' : '交易单号:'}</Text>
|
||||||
<Text className='order-card__value order-card__value--id'>{order.transaction_id || '-'}</Text>
|
<Text className='order-card__value order-card__value--id'>{number || '-'}</Text>
|
||||||
{order.transaction_id ? (
|
{number ? (
|
||||||
<Image className='order-card__copy' src={COPY_ICON} onClick={onCopy} />
|
<Image className='order-card__copy' src={COPY_ICON} onClick={onCopy} />
|
||||||
) : null}
|
) : null}
|
||||||
</View>
|
</View>
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue