修改应付总额显示
This commit is contained in:
+7
-13
@@ -1086,12 +1086,8 @@ public class PrcOrderBillServiceImpl implements IPrcOrderBillService
|
||||
bill.setFreightAmount(result.getFreightAmount());
|
||||
bill.setSurchargeAmount(result.getSurchargeAmount());
|
||||
bill.setIncomeTotal(result.getPayableTotal());
|
||||
BigDecimal payTotal = result.getPayTotal();
|
||||
if (payTotal == null)
|
||||
{
|
||||
payTotal = result.getProductAmount();
|
||||
}
|
||||
bill.setPayTotal(payTotal == null ? BigDecimal.ZERO : payTotal);
|
||||
// 应付总额与产品目录价解耦:试算未产出 pay_total 时留空,不再用 product_amount 兜底
|
||||
bill.setPayTotal(result.getPayTotal());
|
||||
bill.setCurrency(result.getCurrency());
|
||||
bill.setRoundMode(result.getRoundMode());
|
||||
// Credit soft-fail before persist so insert/update stores arrears flag in one write.
|
||||
@@ -1481,14 +1477,13 @@ public class PrcOrderBillServiceImpl implements IPrcOrderBillService
|
||||
return fees;
|
||||
}
|
||||
|
||||
/** 应付主表与订单计费一对一落库;成本价/应付=产品目录价,同步写入 product_amount;红线价同步写入 redline_amount。 */
|
||||
/** 应付主表与订单计费一对一落库;product_amount 取产品目录价、redline_amount 取红线价;应付/成本价留空待接入真实成本源。 */
|
||||
private PrcPayBill persistPayBill(PrcOrderBill bill, TmsPriceQuoteResult result)
|
||||
{
|
||||
if (bill == null || StringUtils.isEmpty(bill.getBillId()))
|
||||
{
|
||||
return null;
|
||||
}
|
||||
BigDecimal pay = nz(bill.getPayTotal());
|
||||
PrcPayBill existed = payBillMapper.selectByBillId(bill.getBillId());
|
||||
PrcPayBill row = existed == null ? new PrcPayBill() : existed;
|
||||
if (existed == null)
|
||||
@@ -1498,12 +1493,11 @@ public class PrcOrderBillServiceImpl implements IPrcOrderBillService
|
||||
row.setCreateBy(bill.getCreateBy());
|
||||
}
|
||||
row.setCurrency(StringUtils.isEmpty(bill.getCurrency()) ? "CNY" : bill.getCurrency());
|
||||
// product/cost = catalog; redline from quote
|
||||
BigDecimal product = result == null ? null : result.getProductAmount();
|
||||
row.setProductAmount(product);
|
||||
// product = catalog; redline from quote; cost/pay 不再等于产品目录价
|
||||
row.setProductAmount(result == null ? null : result.getProductAmount());
|
||||
row.setRedlineAmount(result == null ? null : result.getRedlineAmount());
|
||||
row.setCostAmount(pay);
|
||||
row.setPayTotal(pay);
|
||||
row.setCostAmount(result == null ? null : result.getCostAmount());
|
||||
row.setPayTotal(result == null ? null : result.getPayTotal());
|
||||
row.setBelongSaler(bill.getBelongSaler());
|
||||
row.setBelongSalerCode(bill.getBelongSalerCode());
|
||||
row.setSettlementMan(bill.getSettlementMan());
|
||||
|
||||
+14
-18
@@ -940,9 +940,9 @@ public class TmsPriceQuoteServiceImpl implements ITmsPriceQuoteService
|
||||
}
|
||||
|
||||
/**
|
||||
* Product catalog amount (product_amount) and payable cost (pay_total / payFeeDetails).
|
||||
* Product catalog amount (product_amount) and its fee lines.
|
||||
* Formula: product_country.freight_price * weight + registration_fee.
|
||||
* Cost currently equals product catalog amount (no separate cost table yet).
|
||||
* 应付(cost_amount / pay_total)与产品目录价解耦,此处不再赋值,留空待接入真实成本数据源。
|
||||
*/
|
||||
private void fillProductAmountAndPay(TmsPriceQuoteResult r, BmsProductCountry base,
|
||||
BigDecimal weight, RoundingMode rm, String roundMode)
|
||||
@@ -955,8 +955,9 @@ public class TmsPriceQuoteServiceImpl implements ITmsPriceQuoteService
|
||||
BigDecimal productFreight = base.getFreightPrice().multiply(weight).setScale(2, rm);
|
||||
BigDecimal productAmount = productFreight.add(baseReg).setScale(2, rm);
|
||||
r.setProductAmount(productAmount);
|
||||
r.setCostAmount(productAmount);
|
||||
r.setPayTotal(productAmount);
|
||||
// 应付(cost_amount / pay_total)不再用产品目录价兜底,留待后续接入真实成本数据源
|
||||
r.setCostAmount(null);
|
||||
r.setPayTotal(null);
|
||||
String currency = normalizeCurrency(r.getCurrency());
|
||||
List<TmsPriceQuoteFeeLine> payLines = new ArrayList<TmsPriceQuoteFeeLine>();
|
||||
TmsPriceQuoteFeeLine payFreight = feeLine(FEE_BASIC, feeNameOf(FEE_BASIC), 0L, productFreight, currency, roundMode, null);
|
||||
@@ -1077,14 +1078,7 @@ public class TmsPriceQuoteServiceImpl implements ITmsPriceQuoteService
|
||||
{
|
||||
result.setProductAmount(nvl(result.getProductAmount()).add(productExtra).setScale(2, rm));
|
||||
}
|
||||
if (result.getCostAmount() != null || productExtra.compareTo(BigDecimal.ZERO) > 0)
|
||||
{
|
||||
result.setCostAmount(nvl(result.getCostAmount()).add(productExtra).setScale(2, rm));
|
||||
}
|
||||
if (result.getPayTotal() != null || productExtra.compareTo(BigDecimal.ZERO) > 0)
|
||||
{
|
||||
result.setPayTotal(nvl(result.getPayTotal()).add(productExtra).setScale(2, rm));
|
||||
}
|
||||
// cost_amount / pay_total 不再随产品目录价变化(含附加费),保持留空
|
||||
if (result.getRedlineAmount() != null || redlineExtra.compareTo(BigDecimal.ZERO) > 0)
|
||||
{
|
||||
result.setRedlineAmount(nvl(result.getRedlineAmount()).add(redlineExtra).setScale(2, rm));
|
||||
@@ -1265,8 +1259,8 @@ public class TmsPriceQuoteServiceImpl implements ITmsPriceQuoteService
|
||||
quote.setPayableTotal(result.getPayableTotal());
|
||||
quote.setProductAmount(result.getProductAmount());
|
||||
quote.setRedlineAmount(result.getRedlineAmount());
|
||||
quote.setCostAmount(result.getCostAmount() != null ? result.getCostAmount() : result.getProductAmount());
|
||||
quote.setPayTotal(result.getPayTotal() != null ? result.getPayTotal() : result.getProductAmount());
|
||||
quote.setCostAmount(result.getCostAmount());
|
||||
quote.setPayTotal(result.getPayTotal());
|
||||
quote.setCurrency(result.getCurrency());
|
||||
quote.setRoundMode(result.getRoundMode());
|
||||
try
|
||||
@@ -1329,8 +1323,8 @@ public class TmsPriceQuoteServiceImpl implements ITmsPriceQuoteService
|
||||
{
|
||||
quoteFeeMapper.insertBatch(fees);
|
||||
}
|
||||
BigDecimal cost = result.getCostAmount() != null ? result.getCostAmount() : result.getProductAmount();
|
||||
BigDecimal pay = result.getPayTotal() != null ? result.getPayTotal() : cost;
|
||||
BigDecimal cost = result.getCostAmount();
|
||||
BigDecimal pay = result.getPayTotal();
|
||||
quoteMapper.updateQuoteAmounts(quoteId, result.getSurchargeAmount(), result.getPayableTotal(),
|
||||
result.getProductAmount(), cost, pay);
|
||||
}
|
||||
@@ -1395,8 +1389,10 @@ public class TmsPriceQuoteServiceImpl implements ITmsPriceQuoteService
|
||||
r.setPayableTotal(quote.getPayableTotal());
|
||||
r.setProductAmount(quote.getProductAmount());
|
||||
r.setRedlineAmount(quote.getRedlineAmount());
|
||||
r.setCostAmount(quote.getCostAmount());
|
||||
r.setPayTotal(quote.getPayTotal());
|
||||
// 历史缓存里的 cost_amount / pay_total 可能是早期按产品目录价写入的值,直接丢弃不回填。
|
||||
// TODO 接入真实成本数据源后,改回回填 quote.getCostAmount() / quote.getPayTotal()。
|
||||
r.setCostAmount(null);
|
||||
r.setPayTotal(null);
|
||||
r.setIncomeTotal(quote.getPayableTotal());
|
||||
r.setCurrency(normalizeCurrency(quote.getCurrency()));
|
||||
r.setRoundMode(quote.getRoundMode());
|
||||
|
||||
@@ -117,13 +117,13 @@
|
||||
<el-descriptions-item label="附加费">{{ formatMoney(result.surchargeAmount) }}</el-descriptions-item>
|
||||
<el-descriptions-item label="产品价">{{ formatMoney(result.productAmount) }}</el-descriptions-item>
|
||||
<el-descriptions-item label="成本价">
|
||||
<span class="cost">{{ formatMoney(result.costAmount != null ? result.costAmount : result.payTotal) }}</span>
|
||||
<span class="cost">{{ formatMoney(result.costAmount) }}</span>
|
||||
</el-descriptions-item>
|
||||
<el-descriptions-item label="应收总额">
|
||||
<span class="payable">{{ formatMoney(result.payableTotal) }}</span>
|
||||
</el-descriptions-item>
|
||||
<el-descriptions-item label="应付总额">
|
||||
<span class="cost">{{ formatMoney(result.payTotal != null ? result.payTotal : result.costAmount) }}</span>
|
||||
<span class="cost">{{ formatMoney(result.payTotal) }}</span>
|
||||
</el-descriptions-item>
|
||||
<el-descriptions-item label="试算来源">
|
||||
<el-tag v-if="result.fromCache" size="small" type="success">命中历史试算</el-tag>
|
||||
@@ -161,7 +161,7 @@
|
||||
<template #default="{ row }">{{ row.remark || '-' }}</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
<div class="formula-tip">销售试算:运费金额 = 套餐运费单价 × 计费重量;应收总额 = 运费金额 + 挂号费 + 附加费。产品价/成本价 = 目录运费单价 × 计费重量 + 目录挂号费。相同试算参数直接返回已落库明细。</div>
|
||||
<div class="formula-tip">销售试算:运费金额 = 套餐运费单价 × 计费重量;应收总额 = 运费金额 + 挂号费 + 附加费。产品价 = 目录运费单价 × 计费重量 + 目录挂号费 + 目录附加费。成本价/应付总额待接入真实成本数据源,暂不计算。相同试算参数直接返回已落库明细。</div>
|
||||
</div>
|
||||
</el-card>
|
||||
</el-col>
|
||||
@@ -189,7 +189,7 @@
|
||||
<el-tag size="small" :type="sourceTagType(row.matchSource)">{{ sourceLabel(row.matchSource) }}</el-tag>
|
||||
</template>
|
||||
<template #col-costAmount="{ row }">
|
||||
<span class="cost">{{ formatMoney(row.costAmount != null ? row.costAmount : row.payTotal) }}</span>
|
||||
<span class="cost">{{ formatMoney(row.costAmount) }}</span>
|
||||
</template>
|
||||
<template #col-payableTotal="{ row }">
|
||||
<span class="payable">{{ formatMoney(row.payableTotal) }}</span>
|
||||
@@ -222,13 +222,13 @@
|
||||
<el-descriptions-item label="附加费">{{ formatMoney(viewResult.surchargeAmount) }}</el-descriptions-item>
|
||||
<el-descriptions-item label="产品价">{{ formatMoney(viewResult.productAmount) }}</el-descriptions-item>
|
||||
<el-descriptions-item label="成本价">
|
||||
<span class="cost">{{ formatMoney(viewResult.costAmount != null ? viewResult.costAmount : viewResult.payTotal) }}</span>
|
||||
<span class="cost">{{ formatMoney(viewResult.costAmount) }}</span>
|
||||
</el-descriptions-item>
|
||||
<el-descriptions-item label="应收总额">
|
||||
<span class="payable">{{ formatMoney(viewResult.payableTotal) }}</span>
|
||||
</el-descriptions-item>
|
||||
<el-descriptions-item label="应付总额">
|
||||
<span class="cost">{{ formatMoney(viewResult.payTotal != null ? viewResult.payTotal : viewResult.costAmount) }}</span>
|
||||
<span class="cost">{{ formatMoney(viewResult.payTotal) }}</span>
|
||||
</el-descriptions-item>
|
||||
<el-descriptions-item label="命中说明" :span="2">{{ viewResult.matchMessage || '-' }}</el-descriptions-item>
|
||||
</el-descriptions>
|
||||
|
||||
Reference in New Issue
Block a user