fix(admin): 恢复接单模板计价配置并统一成本价格链路

This commit is contained in:
yml2213
2026-11-02 17:57:49 +08:00
parent d871b93fde
commit a7bac9c1d8
27 changed files with 304 additions and 83 deletions
@@ -342,7 +342,6 @@ export function ProductCatalogPanel() {
}
function openSetProductPrice(item: ProductCatalogItem) {
const isTemplateProduct = item.canonicalSku.startsWith('tpl:')
setPricingProduct(item)
priceForm.resetFields()
priceForm.setFieldsValue({
@@ -350,7 +349,6 @@ export function ProductCatalogPanel() {
item.activeCostAmountFen !== null && item.activeCostAmountFen !== undefined
? (item.activeCostAmountFen / 100).toFixed(2)
: undefined,
pricingMode: isTemplateProduct ? item.templatePricingMode || 'fixed' : undefined,
effectiveScope: 'immediate',
changeReason: '在商品与成本中心统一调整价格',
syncSnapshots: true,
@@ -360,7 +358,6 @@ export function ProductCatalogPanel() {
async function submitProductPrice(values: {
amountYuan: number | string
pricingMode?: 'fixed' | 'unit'
effectiveScope: 'immediate' | 'custom'
effectiveFromCustom?: string
changeReason?: string
@@ -381,7 +378,6 @@ export function ProductCatalogPanel() {
try {
const response = await setAdminProductPrice(pricingProduct.id, {
amountFen,
pricingMode: values.pricingMode,
effectiveFrom,
changeReason: values.changeReason || '在商品与成本中心统一调整价格',
syncOpenOrders: true,
@@ -1022,17 +1018,15 @@ export function ProductCatalogPanel() {
</div>
{pricingProduct.canonicalSku.startsWith('tpl:') ? (
<Form.Item
name="pricingMode"
label="接单计价方式"
rules={[{ required: true, message: '请选择计价方式' }]}
extra="保存后会同步到接单模板;固定金额按整单,按件单价按 SKU 数量计算"
>
<Radio.Group optionType="button" buttonStyle="solid">
<Radio.Button value="fixed">固定金额</Radio.Button>
<Radio.Button value="unit">按件计价</Radio.Button>
</Radio.Group>
</Form.Item>
<Alert
type="info"
showIcon
style={{ marginBottom: 16 }}
message={`当前计价方式:${
pricingProduct.templatePricingMode === 'unit' ? '按 SKU 按件' : '固定金额'
}`}
description="计价方式由接单模板统一设置;这里只维护对应金额。"
/>
) : null}
<Form.Item
@@ -1041,9 +1035,9 @@ export function ProductCatalogPanel() {
pricingProduct.source === 'affiliate_dash'
? '采购单价(元)'
: pricingProduct.canonicalSku.startsWith('tpl:')
? pricingProduct.templateSharingEnabled
? '拼单总成本(元)'
: '接单成本(元)'
? pricingProduct.templatePricingMode === 'unit'
? '每件接单成本(元)'
: '整单接单成本(元)'
: '标准结算单价(元)'
}
rules={[{ required: true, message: '请填写价格' }]}
@@ -1051,7 +1045,9 @@ export function ProductCatalogPanel() {
pricingProduct.source === 'affiliate_dash'
? '上游每发货 1 件扣除的采购成本金额'
: pricingProduct.canonicalSku.startsWith('tpl:')
? '固定金额按整单计;按件计价时填写每个 SKU 的接单成本'
? pricingProduct.templatePricingMode === 'unit'
? `订单有 N 件时,本单接单成本 = 当前金额 × N`
: '无论订单件数,当前金额就是整单接单成本'
: '接单打手发单/验收的基础结算单价'
}
>