fix: 修改结算单合并规则的订单数量不对 (#734)
Reviewed-on: daoyoucloud/tachycode#734 Co-authored-by: wjh <wwwjh0710@163.com> Co-committed-by: wjh <wwwjh0710@163.com>
This commit is contained in:
parent
e0be6a7aba
commit
0da2e5f890
5
.changeset/tricky-garlics-pay.md
Normal file
5
.changeset/tricky-garlics-pay.md
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
---
|
||||||
|
"@hera/plugin-rental": patch
|
||||||
|
---
|
||||||
|
|
||||||
|
修改结算单的合并规格产品数量不对
|
@ -146,6 +146,20 @@ export class SettlementService {
|
|||||||
settlementAbout.end_date,
|
settlementAbout.end_date,
|
||||||
);
|
);
|
||||||
const movement = item.movement === '-1' ? '1' : '-1';
|
const movement = item.movement === '-1' ? '1' : '-1';
|
||||||
|
const item_count = item.record_items.reduce((prev, curr) => {
|
||||||
|
if (
|
||||||
|
countRule.find(
|
||||||
|
(productRule) =>
|
||||||
|
(productRule.product_id > RulesNumber &&
|
||||||
|
productRule.product_id - RulesNumber === curr.product.category_id) ||
|
||||||
|
productRule.product_id === curr?.product_id,
|
||||||
|
)
|
||||||
|
) {
|
||||||
|
return prev + curr.count;
|
||||||
|
} else {
|
||||||
|
return prev + 0;
|
||||||
|
}
|
||||||
|
}, 0);
|
||||||
createLeasDatas.push({
|
createLeasDatas.push({
|
||||||
settlement_id: settlementsId, //合同ID
|
settlement_id: settlementsId, //合同ID
|
||||||
movement: item.movement, //出入库状态
|
movement: item.movement, //出入库状态
|
||||||
@ -156,7 +170,7 @@ export class SettlementService {
|
|||||||
//租赁天数 历史订单就存开始日期到结束日期 当前订单存储订单日期到结束日期
|
//租赁天数 历史订单就存开始日期到结束日期 当前订单存储订单日期到结束日期
|
||||||
days: day,
|
days: day,
|
||||||
is_excluded: false,
|
is_excluded: false,
|
||||||
item_count: recordItem.count * Number(movement),
|
item_count: productLength > 1 ? item_count : recordItem.count * Number(movement),
|
||||||
count: item.weight * Number(movement),
|
count: item.weight * Number(movement),
|
||||||
unit_price: rule.unit_price * 1000,
|
unit_price: rule.unit_price * 1000,
|
||||||
amount: item.weight * (rule.unit_price * 1000) * day * Number(movement),
|
amount: item.weight * (rule.unit_price * 1000) * day * Number(movement),
|
||||||
|
Loading…
Reference in New Issue
Block a user