import { Children, Fragment } from 'react'; import { describeMaterialSources, validateMaterialQuote as checkMaterialQuote } from '../../lib/materialQuote'; import { Model, Calc as LedgerCalc, Values } from '../../shared'; export function lockViews(state, session) { const validateMaterialQuote = (result, input) => checkMaterialQuote(result, input, Model.memberKeys(state)); function priceLockSplitMaterialSources(pool, mg) { let left = mg; const taken = [], rest = []; if ( !Array.isArray(pool.materialSources) || pool.materialSources.reduce((sum, source) => sum + source.quantity, 0) !== pool.quantity || pool.materialSources.reduce((sum, source) => sum + source.amount, 0) !== pool.amount ) throw new Error('原锁分来源克重或成本未完整读到,请重新读取。'); for (const source of pool.materialSources) { if ( !['quantity', 'amount', 'basisAmount', 'basisMg', 'prefixMg', 'prefixAmount'].every( key => Number.isSafeInteger(source[key]) && source[key] >= 0, ) || !source.basisMg || !Array.isArray(source.allocations) || source.allocations.reduce((sum, part) => sum + part.amount, 0) !== source.amount ) throw new Error('原锁分来源成本未完整读到,请重新读取。'); const n = Math.min(left, source.quantity); left -= n; if (!n) { rest.push({ ...source, }); continue; } if (n === source.quantity) { taken.push({ ...source, }); continue; } const amount = LedgerCalc.poolMaterialAmount(source.basisAmount, source.basisMg, source.prefixMg + n) - source.prefixAmount, paid = [], unpaid = []; let money = amount; for (const part of source.allocations) { const value = Math.min(money, part.amount); if (value) paid.push({ ...part, amount: value, }); if (part.amount > value) unpaid.push({ ...part, amount: part.amount - value, }); money -= value; } if (money || amount < 0 || amount > source.amount) throw new Error('原锁分来源分币未完整读到,请重新读取。'); if (!amount && !paid.length) paid.push({ payer: source.allocations[0]?.payer || 'owner', amount: 0, }); const batches = [], remainingBatches = []; let weight = n; for (const batch of source.batches || []) { const value = Math.min(weight, batch.mg); if (value) batches.push({ ...batch, mg: value, }); if (batch.mg > value) remainingBatches.push({ ...batch, mg: batch.mg - value, }); weight -= value; } taken.push({ ...source, quantity: n, amount, allocations: paid, batches, }); rest.push({ ...source, quantity: source.quantity - n, amount: source.amount - amount, allocations: unpaid, batches: remainingBatches, prefixMg: source.prefixMg + n, prefixAmount: source.prefixAmount + amount, }); } if (left) throw new Error('实际耗料超过原锁来源克重。'); return { taken, rest, }; } function lockQuantityMg(value) { const text = String(value ?? '').trim(); if (!/^\d+(?:\.\d{1,3})?$/.test(text)) throw new Error('克重请填写正数,最多3位小数。'); const [whole, part = ''] = text.split('.'), mg = Number(whole) * 1000 + Number(part.padEnd(3, '0')); if (!Number.isSafeInteger(mg) || mg <= 0) throw new Error('克重请填写大于0的有效数字。'); return mg; } function priceLockDeliveryCost(lock, quantity, extraBuyRate) { if (!priceLockUsesPool(lock)) return LedgerCalc.priceLockCost({ lockedQuantity: grams(lock.locked_mg), quantity, buyRate: (lock.buy_rate / 100).toFixed(2), extraBuyRate, }); const pool = lock.materialPool, finalMg = lockQuantityMg(quantity), originalUsedMg = Math.min(finalMg, lock.locked_mg), extraMg = Math.max(0, finalMg - lock.locked_mg), leftoverMg = lock.locked_mg - originalUsedMg; if ( !pool || !['basisAmount', 'basisMg', 'prefixMg', 'prefixAmount', 'amount'].every( key => Number.isSafeInteger(pool[key]) && pool[key] >= 0, ) || !pool.basisMg ) throw new Error('原锁料池成本来源未完整读到,请重新读取锁价单。'); const split = pool.materialSources ? priceLockSplitMaterialSources(pool, originalUsedMg) : null, originalUsedCost = split ? split.taken.reduce((sum, source) => sum + source.amount, 0) : LedgerCalc.poolMaterialAmount(pool.basisAmount, pool.basisMg, pool.prefixMg + originalUsedMg) - pool.prefixAmount; const extraRate = extraMg ? LedgerCalc.cents(extraBuyRate, '补重进货料价') : 0; if (extraMg && !extraRate) throw new Error('补重进货料价必须大于0。'); const extraCost = extraMg ? Number((BigInt(extraMg) * BigInt(extraRate) + 500n) / 1000n) : 0; let left = originalUsedCost; const allocations = []; for (const part of split ? split.taken.flatMap(source => source.allocations) : priceLockMaterialAllocations(lock)) { const amount = Math.min(left, part.amount); if (amount || (!originalUsedCost && !allocations.length)) allocations.push({ payer: part.payer, amount, }); left -= amount; } if (left || originalUsedCost < 0 || originalUsedCost > pool.amount) throw new Error('原锁料池成本分摊不完整,请重新读取锁价单。'); return { lockedMg: lock.locked_mg, finalMg, originalUsedMg, extraMg, leftoverMg, originalPurchase: pool.amount, originalUsedCost, extraCost, materialCost: originalUsedCost + extraCost, leftoverCost: pool.amount - originalUsedCost, allocations, ...(split ? { materialSources: split.taken, leftoverMaterialSources: split.rest, } : {}), }; } function priceLockLineInputs(lock) { const line = lock.line, payer = priceLockMaterialAllocations(lock)[0]?.payer || lock.buy_payer || 'owner'; return { ...line, quantity: grams(lock.locked_mg), goldPrice: (lock.sell_rate / 100).toFixed(2), laborRate: (line.laborRate / 100).toFixed(2), sale: (line.sale / 100).toFixed(2), baseSale: ((line.baseSale ?? line.sale) / 100).toFixed(2), charges: (line.charges || []).map(c => ({ ...c, amount: (c.amount / 100).toFixed(2), })), payer, costParts: { material: (lock.material_amount / 100).toFixed(2), labor: '', accessories: '0', other: '0', }, costMaterial: { mode: 'total', }, costLabor: { mode: 'total', }, costPayers: { material: payer, labor: 'owner', }, }; } function detailView(lock) { return ( <>
GOLD PRICE LOCK

{lock.customer} · {priceLockLines(lock).length}件黄金锁价

{priceLockFacts(lock)} {priceLockLines(lock).length === 1 ? renderPriceLockItems(lock) : ''}

预计报价 ¥{yuan(lock.estimated_total)};交付时按最终克重、工费和附加项目重新结算,销售金价保持原锁价格。

{lock.note ? ( <>

{lock.note}

) : ( '' )} {lock.status === 'cancelled' ? ( <>

已作废 · {lock.cancelled_reason || '原单记录保留'}
{lock.cancelled_at || ''}

) : ( '' )}
{lock.status === 'pending' ? ( <> {button('办理交付', 'deliver-price-lock', 'primary', { 'data-id': lock.id, })} {renderPriceLockPendingButtons(lock)} ) : lock.final_order_id ? ( button('查看销售单', 'open-lock-order', 'primary', { 'data-id': lock.final_order_id, }) ) : ( '' )}
); } function priceLockCardFeeTotal(lock) { return Number.isSafeInteger(lock.credit_card_fee_total) ? lock.credit_card_fee_total : (lock.credit_card_fees || []).reduce((sum, item) => sum + item.amount, 0); } function renderPriceLockCardFees(lock) { const fees = lock.credit_card_fees || []; if (!fees.length && !priceLockCardFeeTotal(lock)) return ''; return ( <>
已记录的信用卡手续费 · ¥{yuan(priceLockCardFeeTotal(lock))}

已按各笔付款时保存的金额与费率计入内部成本;交付时沿用,不重复收取。退款不冲回已发生的手续费。

); } function priceLockFacts(lock) { const voided = lock.status === 'cancelled' ? ( <>
这张锁价单已作废

客户收款、手填购料和信用卡手续费有效记账已撤销,料池预留已释放。下方原录入克重、售价和成本保留用于追溯,不计当前有效收付。

{Children.toArray( (lock.cancellationReturns || []).map(row => ( <>

商品 {row.line_index + 1} · {row.date} 按原成本回池: {grams(row.mg)}g / ¥{yuan(row.amount)} ,参与回池当天加权;原料池日期 {row.origin_pool_id}。

)), )}
) : ( '' ); const rows = priceLockLines(lock); if (rows.length > 1) { const mg = rows.reduce((sum, row) => sum + row.locked_mg, 0), pending = rows.some(priceLockMaterialPending), amount = rows.reduce((sum, row) => sum + (row.material_amount ?? 0), 0); return ( <> {voided}
锁价日期{lock.date}
原锁总克重 · {rows.length}件{grams(mg)}g
{lock.status === 'delivered' ? '锁价及交付阶段净收款' : '客户实际已付净额'} ¥{yuan(lock.netReceived)}
原锁料费合计{pending ? '料费待补' : '¥' + yuan(amount)}
状态 {lock.status === 'pending' ? '待交付,不计利润' : lock.status === 'cancelled' ? '已作废' : '已交付'}
{renderPriceLockItems(lock)} {renderPriceLockCardFees(lock)} ); } lock = rows[0] || lock; const pool = priceLockUsesPool(lock), material = lock.materialPool, pendingMaterial = priceLockMaterialPending(lock); const source = pendingMaterial ? ( <> 关联用料不足,补足购料后自动核算料费与付款来源。 ) : ( <> {pool ? material?.materialSources?.length ? materialSourceSegmentsText(material.materialSources) : `${material?.date || lock.material_pool_id || lock.date}料池,加权均价约 ¥${yuan(material?.averageRate ?? lock.buy_rate)}/克` : `${priceLockPayerName(lock.buy_payer)}支付,进货料价 ¥${yuan(lock.buy_rate)}/克`} {pool ? ( <> {priceLockAllocationText(priceLockMaterialAllocations(lock))} {material?.frozen ? '已冻结锁价日成本' : '当天补料继续加权'},不重复记购料付款。 ) : ( '' )} ); return ( <> {voided}
锁价日期{lock.date}
原锁克重{grams(lock.locked_mg)}g
锁定销售金价¥{yuan(lock.sell_rate)}/克
{lock.status === 'delivered' ? '锁价及交付阶段净收款' : '客户实际已付净额'} ¥{yuan(lock.netReceived)} {lock.status === 'delivered' ? ( <> 后续收退款请查看销售单。 ) : ( '' )}
原锁料费 · {pool ? '当日加权料池' : '手动独立购料'} {priceLockMaterialAmountText(lock)} {source}
状态 {lock.status === 'pending' ? '待交付,不计利润' : lock.status === 'cancelled' ? '已作废' : '已交付'}
{renderPriceLockCardFees(lock)} ); } function cancelView(result, approval) { const id = result.lock.id; return ( <>
VOID PRICE LOCK

{approval ? '申请作废' : '作废'} · {result.lock.customer}

{priceLockFacts(result.lock)}
录错作废

生效后撤销本单有效收款、手填购料与信用卡手续费记账,同日释放料池预留;跨天按原锁定克重和原成本回到实际作废日料池,参与当天加权,历史订单成本不变。保留原单和作废记录。适用于录错单据。

本操作不登记真实客户退款,也不登记实物退料。

{approval ? ( <>

提交申请后,店主复核同意才撤销记账;待批期间原锁价单保持有效。

) : ( '' )}
{button('返回锁价详情', 'open-price-lock', 'quiet', { 'data-id': id, })}
); } function renderPriceLockRelatedOrders(rows) { const money = value => (value === null ? '待核算' : Number.isSafeInteger(value) ? '¥' + yuan(value) : '未提供'); return ( <>

受影响的销售单({rows.length}张)

{Children.toArray( rows.map(row => ( <> )), )}
订单 货品成本:当前 → 生效后 利润:当前 → 生效后
{row.date} · {row.number || row.id} {money(row.before?.goodsCost)} → {money(row.after?.goodsCost)} {money(row.before?.profit)} → {money(row.after?.profit)}
); } const validOrderDate = Values.validDate; const teamMemberKeys = () => Model.memberKeys(state); function validateRelatedPriceLocks(items) { if (items === undefined) return []; const amount = value => value === null || (Number.isSafeInteger(value) && value >= 0); const snapshot = value => value && amount(value.materialAmount) && ['usedMaterialAmount', 'leftoverCost'].every(key => !Object.hasOwn(value, key) || amount(value[key])) && Array.isArray(value.allocations) && value.allocations.every( part => teamMemberKeys().includes(part.payer) && Number.isSafeInteger(part.amount) && part.amount >= 0, ) && (value.materialAmount === null || value.allocations.reduce((sum, part) => sum + part.amount, 0) === value.materialAmount); if ( !Array.isArray(items) || !items.every( item => item && typeof item.id === 'string' && item.id && validOrderDate(item.date) && snapshot(item.before) && snapshot(item.after), ) ) throw new Error('关联锁价单的成本影响未完整返回,请重新读取后复核。'); return items; } function renderRelatedPriceLocks(items) { const locks = validateRelatedPriceLocks(items); if (!locks.length) return ''; const money = value => (value === null ? '待补齐' : '¥' + yuan(value)), sources = value => value.allocations.length ? value.allocations.map(part => teamMemberName(part.payer) + ' ' + money(part.amount)).join(';') : value.materialAmount === null ? '待补齐后分摊' : '无分摊金额'; const pair = (name, before, after) => ( <> {name} {before} {after} ); return ( <>

同时受影响的锁价单({locks.length} 张)

以下只调整料池成本和付款归属,客户锁定售价与实际收付款保持原记录。

{Children.toArray( locks.map(lock => ( <>

{lock.date} · {lock.number || lock.id} {lock.customer ? ' · ' + lock.customer : ''}

{pair('原锁预留料费', money(lock.before.materialAmount), money(lock.after.materialAmount))} {['before', 'after'].some(side => Object.hasOwn(lock[side], 'usedMaterialAmount')) ? pair( '交付耗用原锁料费', Object.hasOwn(lock.before, 'usedMaterialAmount') ? money(lock.before.usedMaterialAmount) : '未交付', Object.hasOwn(lock.after, 'usedMaterialAmount') ? money(lock.after.usedMaterialAmount) : '未交付', ) : ''} {['before', 'after'].some(side => Object.hasOwn(lock[side], 'leftoverCost')) ? pair( '少重回池成本', Object.hasOwn(lock.before, 'leftoverCost') ? money(lock.before.leftoverCost) : '未交付', Object.hasOwn(lock.after, 'leftoverCost') ? money(lock.after.leftoverCost) : '未交付', ) : ''} {pair('自动付款归属', sources(lock.before), sources(lock.after))}
核对项目 变更前 批准后
)), )}
); } const accountDisplayName = value => { const id = Model.accountIdentity(state, value); return id ? Model.memberName(state, id.member) + id.channel : value; }; function pocketLabel(key) { return state?.pocketCatalog?.find(row => row.key === key)?.name || String(key ?? ''); } function renderPriceLockItems(lock) { const rows = priceLockLines(lock); return ( <>
{lock.status === 'delivered' ? ( <> ) : ( '' )} {Children.toArray( rows.map((row, index) => { const item = row.line || {}, delivery = row.delivery; return ( <> {lock.status === 'delivered' ? ( <> ) : ( '' )} ); }), )}
商品 原锁克重 原锁销售金价 工费与附加项目 原锁料费/付款来源实际交付
{item.name || '黄金'}
商品 {index + 1} {item.code ? ' · ' + item.code : ''}
{grams(row.locked_mg)}g ¥{yuan(row.sell_rate)}/克 {item.laborMode === 'piece' ? `件工费 ¥${yuan(item.laborRate ?? 0)} × ${item.pieces || 1}件` : `克工费 ¥${yuan(item.laborRate ?? 0)}/克`} {Children.toArray( (item.charges || []).map(charge => ( <>
{charge.name} ¥{yuan(charge.amount)}
)), )}
{renderPriceLockItemFacts(row)} {delivery ? `${grams(delivery.finalMg ?? delivery.quantity ?? row.locked_mg)}g${ (delivery.extraMg ?? delivery.extra_mg) ? ( <>
补重 {grams(delivery.extraMg ?? delivery.extra_mg)}g ) : ( '' ) }${ (delivery.leftoverMg ?? delivery.leftover_mg) ? ( <>
{priceLockUsesPool(row) ? '解除预留回池 ' : '剩料留盘 '} {grams(delivery.leftoverMg ?? delivery.leftover_mg)}g ) : ( '' ) }${ delivery.inventory?.pocket ? ( <>
货盘 {pocketLabel(delivery.inventory.pocket)} ) : delivery.pocket ? ( <>
货盘 {pocketLabel(delivery.pocket)} ) : ( '' ) }` : '详见销售单'}
); } function renderPriceLockChangeSnapshot(snapshot, title) { if (!snapshot) return ( <>

{title}

未提供

); const value = snapshot.lock || snapshot, rows = value.lines || [], inputRows = rows[0] && !rows[0].line; if (!inputRows) return ( <>

{title}

{value.date || ''} · {value.customer || ''} · 开单人 {value.salesperson || '未提供'}

{renderPriceLockItems(value)}

预计成交 {Number.isSafeInteger(value.estimated_total) ? '¥' + yuan(value.estimated_total) : '未提供'} · 已收净额 {Number.isSafeInteger(value.netReceived) ? '¥' + yuan(value.netReceived) : '未提供'} · 整单优惠{' '} {Number.isSafeInteger(value.discount) ? '¥' + yuan(value.discount) : '未提供'}

{value.note ? ( <>

客户备注:{value.note}

) : ( '' )}
); return ( <>

{title}

{value.date || ''} · {value.customer || ''} · 开单人 {value.salesperson || '未提供'}

{Children.toArray( rows.map(row => ( <> )), )}
商品 锁重/售价 销售工费/附加项目 原锁料费/付款人
{row.name || '未提供'} {row.quantity || '未提供'}g
¥{row.goldPrice ?? '未提供'}/克
{row.laborMode === 'piece' ? '件工费' : '克工费'} ¥{row.laborRate ?? '未提供'} {row.laborMode === 'piece' ? ' × ' + (row.pieces || 1) + '件' : '/克'} {Children.toArray( (row.charges || []).map(charge => ( <>
{charge.name} ¥{charge.amount} )), )}
{row.material?.source === 'pool' ? ( '当日加权料池' ) : ( <> 手填 ¥{row.material?.rate ?? '未提供'}/克
{priceLockPayerName(row.material?.payer)} )}

客户实际付款 ¥{value.payment?.amount ?? '未提供'} · {accountDisplayName(value.payment?.account || '')} · 整单优惠 ¥{value.discount ?? '未提供'}

{value.note ? ( <>

客户备注:{value.note}

) : ( '' )}
); } function changeDetail(result, canReview) { return ( <>
PRICE LOCK REVIEW

{result.action === 'cancel' ? '录错作废' : '整单修改'}申请

{result.requester_name || ''} · {result.created || ''} ·{' '} {{ pending: '待复核', approved: '已批准', rejected: '已驳回', }[result.status] || result.status}

申请原因:{result.reason || '未提供'}

{result.stale ? ( <>
原单或关联料池已有变动,本次申请不能直接批准。请驳回后重新核实提交。
) : ( '' )} {renderPriceLockChangeSnapshot(result.before, '当前原单')} {result.action === 'edit' ? ( renderPriceLockChangeSnapshot(result.after, '申请修改后') ) : ( <>
批准后整单作废,撤销有效收款、手填购料及信用卡手续费记账,同日释放预留;跨天按原克重原成本回到批准当天料池,历史订单成本不变。保留原单与作废记录,不登记真实退款或实物退料。
)} {result.relatedPriceLocks?.length ? renderRelatedPriceLocks(result.relatedPriceLocks) : ''} {result.relatedOrders?.length ? renderPriceLockRelatedOrders(result.relatedOrders) : ''} {result.note ? ( <>

复核备注:{result.note}

) : ( '' )}
{button('返回申请列表', 'price-lock-changes-open', 'quiet')} {button('查看原锁价单', 'price-lock-change-lock', '', { 'data-id': result.price_lock_id, })}
{session.user.role === 'owner' && result.status === 'pending' ? ( <>
{canReview ? ( <> ) : ( '' )}
{canReview ? ( <> ) : ( '' )}
) : ( '' )} ); } function changeRows(result) { return result.rows.length ? ( <>
{Children.toArray( result.rows.map(row => ( <> )), )}
原锁价单/客户 申请 申请人/日期 状态 操作
{row.number || row.before?.number || '锁价单'}
{row.customer || row.before?.customer || ''}
{row.action === 'cancel' ? '录错作废' : '修改整单'}
{row.reason || ''}
{row.requester_name || row.requester || ''}
{row.created || ''}
{{ pending: '待店主复核', approved: '已批准', rejected: '已驳回', }[row.status] || row.status} {button('查看申请', 'price-lock-change-open', '', { 'data-id': row.requestId || row.id, })}
) : ( <>

暂无符合条件的申请。

); } function renderPriceLockPendingButtons(lock) { return ['owner', 'assistant'].includes(session.user.role) ? ( <> {button('修改', 'edit-price-lock', 'quiet', { 'data-id': lock.id, })} {button('作废', 'cancel-price-lock', 'quiet', { 'data-id': lock.id, })} ) : ( '' ); } const button = (text, action, cls = '', props = {}) => ( ); const materialSourceSegmentsText = sources => describeMaterialSources(sources, teamMemberName); function priceLockMaterialAllocations(lock) { return priceLockMaterialPending(lock) ? [] : priceLockUsesPool(lock) ? lock.materialPool?.allocations || [] : [ { payer: lock.buy_payer, amount: lock.material_amount, }, ]; } const teamMemberName = key => Model.memberName(state, key, session); const priceLockPayerName = payer => (payer ? teamMemberName(payer) : '待补'); function priceLockAllocationText(allocations) { return allocations.map(part => priceLockPayerName(part.payer) + ' ¥' + yuan(part.amount)).join(';'); } function priceLockMaterialAmountText(lock) { const amount = priceLockUsesPool(lock) && Number.isSafeInteger(lock.materialPool?.amount) ? lock.materialPool.amount : lock.material_amount; return priceLockMaterialPending(lock) || !Number.isSafeInteger(amount) ? '料费待补' : '¥' + yuan(amount); } const priceLockMaterialPending = lock => lock?.material_amount === null || (priceLockUsesPool(lock) && (lock.materialPool?.status === 'pending' || lock.materialPool?.amount === null)); const priceLockUsesPool = lock => lock?.material_source === 'pool'; function renderPriceLockItemFacts(lock) { const pool = priceLockUsesPool(lock), material = lock.materialPool, pendingMaterial = priceLockMaterialPending(lock); return ( <> {lock.status === 'cancelled' ? ( <>
原录入成本(已撤销记账)
) : ( '' )} {priceLockMaterialAmountText(lock)}
{pool ? '当日加权料池' : '手动独立购料'} {pendingMaterial ? ( ';补足购料后自动核算付款来源' ) : pool ? ( <> {' '} · {material?.date || lock.material_pool_id || lock.date}
{priceLockAllocationText(priceLockMaterialAllocations(lock))}
{material?.materialSources?.length ? ( <> {materialSourceSegmentsText(material.materialSources)}
) : ( '' )} {material?.frozen ? '已冻结锁价日成本' : '当天补料继续加权'},不重复记购料付款。 ) : ( <> {' '} · {priceLockPayerName(lock.buy_payer)}
进货料价 ¥{yuan(lock.buy_rate)}/克 )}
); } const yuan = Model.yuan; const grams = Model.grams; function priceLockLines(lock) { if (!Array.isArray(lock?.lines) || !lock.lines.length) return lock ? [lock] : []; return lock.lines.map((item, index) => { const row = { ...lock, ...item, id: item.id || item.lineId || item.price_lock_line_id, line: item.line || item, line_index: index, parent_id: lock.id, }; delete row.lines; return row; }); } function listRecords(result, status) { return result.rows.length ? ( <>
{Children.toArray( result.rows.map(lock => ( <> )), )}
锁价日期/客户 黄金商品 锁定克重 销售金价 已收净额 {status === 'cancelled' ? '原录入成本(已撤销记账)' : '原料来源/成本'} 操作
{lock.date}
{lock.customer}
{priceLockLines(lock) .map(row => row.line?.name || '黄金') .map((part, i) => ( {i > 0 &&
} {part}
))}
{grams(priceLockLines(lock).reduce((sum, row) => sum + row.locked_mg, 0))}g {priceLockLines(lock) .map(row => '¥' + yuan(row.sell_rate) + '/克') .map((part, i) => ( {i > 0 &&
} {part}
))}
¥{yuan(lock.netReceived)} {priceLockLines(lock) .map(row => renderPriceLockItemFacts(row)) .map((part, i) => ( {i > 0 &&
} {part}
))}
{button('查看', 'open-price-lock', '', { 'data-id': lock.id, })} {lock.status === 'pending' ? ( <> {button('交付', 'deliver-price-lock', 'primary', { 'data-id': lock.id, })} {renderPriceLockPendingButtons(lock)} ) : ( '' )}
) : status === 'cancelled' ? ( <>
目前没有已作废锁价单作废后保留的原单会显示在这里。
) : ( <>
目前没有锁价待交付记录已交付记录会进入订单列表。
); } return { listRecords, changeRows, changeDetail, cancelView, detailView, priceLockFacts, priceLockLines, priceLockLineInputs, priceLockDeliveryCost, materialSourceSegmentsText, validateMaterialQuote, lockQuantityMg, }; }