style: 统一代码格式化与代码规范

This commit is contained in:
yml2213
2026-09-19 10:41:15 +08:00
parent c62c8c2cad
commit 8631100d07
6 changed files with 38 additions and 19 deletions
@@ -3,13 +3,26 @@ import test from 'node:test'
import { readFile } from 'node:fs/promises'
const FULFILLMENT_SERVICE = new URL('./consignment-fulfillment-service.ts', import.meta.url)
const GIFT_REPO = new URL('../../repositories/worker-platform/work-order-gift-repo.ts', import.meta.url)
const GIFT_REPO = new URL(
'../../repositories/worker-platform/work-order-gift-repo.ts',
import.meta.url,
)
test('内部现货履约必须将工单发单金额更新为寄卖成本价并记录留痕', async () => {
const source = await readFile(FULFILLMENT_SERVICE, 'utf8')
assert.ok(source.includes('const previousRewardAmountFen = Number(lockedOrder.reward_amount || 0)'))
assert.ok(source.includes('const costPriceFen = Math.max(0, Math.round(Number(inv.cost_price_fen || 0)))'))
assert.ok(source.includes('const effectiveRewardAmountFen = costPriceFen > 0 ? costPriceFen : previousRewardAmountFen'))
assert.ok(
source.includes('const previousRewardAmountFen = Number(lockedOrder.reward_amount || 0)'),
)
assert.ok(
source.includes(
'const costPriceFen = Math.max(0, Math.round(Number(inv.cost_price_fen || 0)))',
),
)
assert.ok(
source.includes(
'const effectiveRewardAmountFen = costPriceFen > 0 ? costPriceFen : previousRewardAmountFen',
),
)
assert.ok(source.includes('previousRewardAmountFen,'))
assert.ok(source.includes('rewardAmountFen: effectiveRewardAmountFen,'))
assert.ok(source.includes('updatedRewardAmountFen: effectiveRewardAmountFen,'))
@@ -642,4 +642,3 @@ test('品类隔离门禁:苏尔南手枪现货绝不匹配特种兵密钥、
assert.ok(matched)
assert.equal(matched.matchType, 'partial') // 2璀璨充0璀璨
})
@@ -66,12 +66,12 @@ export function normalizePeacekeeperSeries(value: string): string {
/** 常见商品品类主体定义 */
export type ItemCategoryType =
| 'pistol_skin' // 手枪/苏尔南/枪皮
| 'key_secret' // 特种兵密钥/钥匙
| 'cannon' // 爆破型肩炮/肩甲
| 'gift_box' // 专属礼盒/宝箱/福袋
| 'rename_card' // 改名卡/更名卡
| 'diamond_topup' // 钻石/点券/充值
| 'pistol_skin' // 手枪/苏尔南/枪皮
| 'key_secret' // 特种兵密钥/钥匙
| 'cannon' // 爆破型肩炮/肩甲
| 'gift_box' // 专属礼盒/宝箱/福袋
| 'rename_card' // 改名卡/更名卡
| 'diamond_topup' // 钻石/点券/充值
| 'other'
export function detectItemCategory(text: string): ItemCategoryType {
@@ -300,12 +300,15 @@ export default function ConsignmentManualMatchModal({
<Tag color={meta.color}>{meta.label}</Tag>
</Space>
<Text type="secondary" style={{ fontSize: 12 }}>
寄卖单号 {option.inventory.sourceSubmissionNo || option.inventory.inventoryNo} ·{' '}
寄卖单号{' '}
{option.inventory.sourceSubmissionNo || option.inventory.inventoryNo} ·{' '}
{option.inventory.system || '未指定'}/
{option.inventory.serverZone || '未指定'}/
{option.inventory.series || '未指定'}{' '}
{option.inventory.diamondLevel ? `${option.inventory.diamondLevel}钻` : ''} · 货源{' '}
{option.inventory.workerName || '未关联打手'} · 结算价 ¥
{option.inventory.diamondLevel
? `${option.inventory.diamondLevel}钻`
: ''}{' '}
· 货源 {option.inventory.workerName || '未关联打手'} · 结算价 ¥
{(Number(option.inventory.costPriceFen || 0) / 100).toFixed(2)}
</Text>
{option.conflicts.length > 0 ? (
@@ -3232,7 +3232,14 @@ export default function WorkOrdersPanel() {
>
走接单平台指派打手
</Button>
<div style={{ fontSize: 11, color: '#8c8c8c', marginTop: 6, textAlign: 'center' }}>
<div
style={{
fontSize: 11,
color: '#8c8c8c',
marginTop: 6,
textAlign: 'center',
}}
>
指派供货打手履约 · 自动冻结履约押金
</div>
</>
@@ -89,10 +89,7 @@ test('手动匹配弹窗:数据过期的 409 要清选择并刷新,无打手
assert.ok(source.includes('setSelected(null)'), '数据过期时要清空已选')
// 统一平台履约:没关联打手的现货禁用提交,提交前严格校验 workerId
assert.ok(source.includes('Boolean(selected?.workerId)'), '无打手时必须禁用提交')
assert.ok(
source.includes("if (!selected.workerId)"),
'提交前要对无打手的现货严格拦截',
)
assert.ok(source.includes('if (!selected.workerId)'), '提交前要对无打手的现货严格拦截')
// 凭证核销反馈与关键字搜索:用共享出口 / 透传后端,不内联复制
assert.ok(source.includes("from '@/utils/voucher-consume'"), '核销反馈必须用共享出口')
assert.ok(source.includes('keyword: keyword.trim() || undefined'), '库存侧关键字要透传后端')