This commit is contained in:
parent
647634a1f9
commit
99c188a26b
|
|
@ -1,4 +1,5 @@
|
|||
import { describe, expect, it } from 'vitest'
|
||||
import { adaptA5Order } from './a5/data'
|
||||
import {
|
||||
buildResubmitPayload,
|
||||
filterMapLabelOrders,
|
||||
|
|
@ -33,13 +34,25 @@ const mapOrder = {
|
|||
}
|
||||
|
||||
describe('order display name', () => {
|
||||
it('uses neutral copy for map_label and keeps other product names', () => {
|
||||
expect(getOrderDisplayName(mapOrder)).toBe('商户资料服务')
|
||||
it('uses the actual product name for each order', () => {
|
||||
expect(getOrderDisplayName(mapOrder)).toBe('地图标注代办服务')
|
||||
expect(getOrderDisplayName({
|
||||
goods_type: 'license_year',
|
||||
goods_name: '企业年报服务',
|
||||
})).toBe('企业年报服务')
|
||||
expect(getOrderDisplayName(null)).toBe('-')
|
||||
expect(getOrderDisplayName({ goods_type: 'map_label', goods_name: ' ' })).toBe('-')
|
||||
})
|
||||
|
||||
it('displays goods_info.name from an A5 order', () => {
|
||||
const order = adaptA5Order({
|
||||
id: '727',
|
||||
goods_type: 'map_label',
|
||||
goods_name: '旧商品名称',
|
||||
goods_info: JSON.stringify({ id: '23', name: '地图标注(常见平台)' }),
|
||||
})
|
||||
|
||||
expect(getOrderDisplayName(order)).toBe('地图标注(常见平台)')
|
||||
})
|
||||
})
|
||||
|
||||
|
|
|
|||
|
|
@ -142,10 +142,7 @@ export function normalizeOrders<T extends OrderLike> (orders: T[] = []) {
|
|||
})
|
||||
}
|
||||
|
||||
export const MAP_LABEL_DISPLAY_NAME = '商户资料服务'
|
||||
|
||||
export function getOrderDisplayName (order?: OrderLike | null) {
|
||||
if (order?.goods_type === 'map_label') return MAP_LABEL_DISPLAY_NAME
|
||||
return String(order?.goods_name || '').trim() || '-'
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -227,9 +227,11 @@ function OrderCard ({
|
|||
onResubmit: () => void
|
||||
onComplaint: () => void
|
||||
}) {
|
||||
const isMapLabel = order.goods_type === 'map_label'
|
||||
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 actions = a5 ? { complaint: true, submit: true, detail: order.process_status === '2' } : getOrderCardActions(order)
|
||||
const canSubmit = isMapLabel && actions.submit
|
||||
|
||||
return (
|
||||
<View className='order-card'>
|
||||
|
|
@ -240,7 +242,7 @@ function OrderCard ({
|
|||
</View>
|
||||
</View>
|
||||
|
||||
<InfoLine label='门店电话:' value={order.entity_phone || '-'} />
|
||||
<InfoLine label={isMapLabel ? '门店电话:' : '联系电话:'} value={order.entity_phone || '-'} />
|
||||
<InfoLine label='订单时间:' value={order.create_time || order.pay_time || '-'} />
|
||||
|
||||
<View className='order-card__row'>
|
||||
|
|
@ -260,7 +262,7 @@ function OrderCard ({
|
|||
<View className='order-card__reject'>驳回理由:{order.reject_reason}</View>
|
||||
) : null}
|
||||
|
||||
{actions.complaint || actions.submit || actions.detail ? (
|
||||
{actions.complaint || canSubmit || actions.detail ? (
|
||||
<>
|
||||
<View className='order-card__divider' />
|
||||
<View className='order-card__actions'>
|
||||
|
|
@ -270,7 +272,7 @@ function OrderCard ({
|
|||
{actions.detail ? (
|
||||
<View className='order-card__action' onClick={onViewDetail}>查看详情</View>
|
||||
) : null}
|
||||
{actions.submit ? (
|
||||
{canSubmit ? (
|
||||
<View className='order-card__action order-card__action--primary' onClick={onResubmit}>
|
||||
补充资料
|
||||
</View>
|
||||
|
|
|
|||
Loading…
Reference in New Issue