修复商城订单列表展示与模拟数据
This commit is contained in:
@@ -102,6 +102,41 @@ for (const [key, label] of [
|
||||
}
|
||||
}
|
||||
|
||||
// 商城订单必须遵循独立交易状态,并以名称展示用户关系。
|
||||
const orderDefinition = resources.match(
|
||||
/define\('ec_order',[\s\S]*?\n\s*\]\),/,
|
||||
)?.[0];
|
||||
if (!orderDefinition) throw new Error('无法读取商城订单资源定义');
|
||||
for (const [value, label] of [
|
||||
[16, '待支付'],
|
||||
[18, '已支付'],
|
||||
[22, '已取消'],
|
||||
]) {
|
||||
if (!orderDefinition.includes(`{ label: '${label}', value: ${value} }`)) {
|
||||
throw new Error(`商城订单状态 ${value} 缺少中文展示:${label}`);
|
||||
}
|
||||
}
|
||||
const orderUserField = orderDefinition.match(
|
||||
/relation\('user_account_identity'[\s\S]*?\}\)/,
|
||||
)?.[0];
|
||||
if (
|
||||
!orderUserField ||
|
||||
!orderUserField.includes("listLabel: '用户'") ||
|
||||
!orderUserField.includes('listRelationNameOnly: true') ||
|
||||
!orderUserField.includes('displayRelationLabel: true') ||
|
||||
!orderUserField.includes('showIdentityCopy: true')
|
||||
) {
|
||||
throw new Error('商城订单用户列必须以用户名称展示并保留唯一标识复制入口');
|
||||
}
|
||||
for (const invalidStatus of [10, 35]) {
|
||||
if (orderDefinition.includes(`value: ${invalidStatus}`)) {
|
||||
throw new Error(`商城订单不得把跨领域通用状态 ${invalidStatus} 当作有效交易状态`);
|
||||
}
|
||||
}
|
||||
if (!orderDefinition.includes("f('paid_at', { emptyText: '未支付' })")) {
|
||||
throw new Error('商城订单空支付时间必须明确显示为未支付');
|
||||
}
|
||||
|
||||
if (/title="ID"|data-index="id"/.test(listPage)) {
|
||||
throw new Error('标准资源列表不得把数据库ID作为业务列展示');
|
||||
}
|
||||
|
||||
@@ -711,10 +711,13 @@ export const resources: ResourceUiDefinition[] = [
|
||||
{ label: '已支付', value: 18 },
|
||||
{ label: '已取消', value: 22 },
|
||||
], unknownValueLabel: '未知订单状态' }),
|
||||
relation('user_account_identity', '/user_account'), relation('gas_basic_identity', '/gas_basic'),
|
||||
relation('user_account_identity', '/user_account', false, {
|
||||
label: '用户', listLabel: '用户', listRelationNameOnly: true,
|
||||
displayRelationLabel: true, showIdentityCopy: true,
|
||||
}), relation('gas_basic_identity', '/gas_basic'),
|
||||
relation('delivery_basic_identity', '/delivery_basic'), relation('user_address_identity', '/user_address'),
|
||||
f('contact_name'), f('contact_phone'), f('product_amount'), f('discount_amount'), f('payable_amount'),
|
||||
f('total_amount'), f('paid_at'), f('logistics_no'), f('logistics_company'), f('logistics_status'),
|
||||
f('total_amount'), f('paid_at', { emptyText: '未支付' }), f('logistics_no'), f('logistics_company'), f('logistics_status'),
|
||||
f('shipped_at'), f('received_at'), f('remark'),
|
||||
]),
|
||||
define('ec_order_item', '商城订单明细', 'readonly', [
|
||||
|
||||
Reference in New Issue
Block a user