fix: 修改结算单计算逻辑 (#612)
Reviewed-on: daoyoucloud/tachycode#612 Co-authored-by: wjh <wwwjh0710@163.com> Co-committed-by: wjh <wwwjh0710@163.com>
This commit is contained in:
parent
38c3e3db8d
commit
90b1beae5e
@ -95,11 +95,14 @@ export class SettlementService {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
if (
|
const recordItem = item.record_items.find((itemValue) => {
|
||||||
|
return (
|
||||||
(productRule.product_id > RulesNumber &&
|
(productRule.product_id > RulesNumber &&
|
||||||
productRule.product_id - RulesNumber === item.record_items[0]?.product.category_id) ||
|
productRule.product_id - RulesNumber === itemValue?.product.category_id) ||
|
||||||
productRule.product_id === item.record_items[0]?.product.id
|
productRule.product_id === itemValue?.product.id
|
||||||
) {
|
);
|
||||||
|
});
|
||||||
|
if (recordItem) {
|
||||||
const day =
|
const day =
|
||||||
dayjsDays(item.date) < dayjsDays(settlementAbout.start_date)
|
dayjsDays(item.date) < dayjsDays(settlementAbout.start_date)
|
||||||
? getCalcDays(settlementAbout.start_date, settlementAbout.end_date)
|
? getCalcDays(settlementAbout.start_date, settlementAbout.end_date)
|
||||||
@ -114,8 +117,8 @@ export class SettlementService {
|
|||||||
settlement_id: settlementsId, //合同ID
|
settlement_id: settlementsId, //合同ID
|
||||||
movement: item.movement, //出入库状态
|
movement: item.movement, //出入库状态
|
||||||
date: item.date, //时间
|
date: item.date, //时间
|
||||||
name: item.record_items[0]?.product.name, //名称
|
name: recordItem?.product.name, //名称
|
||||||
label: item.record_items[0]?.product.label, //规格
|
label: recordItem?.product.name, //规格
|
||||||
category: item.category, //费用类别
|
category: item.category, //费用类别
|
||||||
//租赁天数 历史订单就存开始日期到结束日期 当前订单存储订单日期到结束日期
|
//租赁天数 历史订单就存开始日期到结束日期 当前订单存储订单日期到结束日期
|
||||||
days: day,
|
days: day,
|
||||||
@ -813,11 +816,13 @@ const recordWeight = (rule, item, settlementsId, productRule, rulefee?) => {
|
|||||||
is_excluded: false,
|
is_excluded: false,
|
||||||
};
|
};
|
||||||
} else {
|
} else {
|
||||||
if (
|
const isRecordItem = item.record_items.find(
|
||||||
|
(itemValue) =>
|
||||||
(productRule.product_id > RulesNumber &&
|
(productRule.product_id > RulesNumber &&
|
||||||
productRule.product_id - RulesNumber === item.record_items[0]?.product.category_id) ||
|
productRule.product_id - RulesNumber === itemValue?.product.category_id) ||
|
||||||
productRule.product_id === item.record_items[0]?.product.category_id
|
productRule.product_id === itemValue?.product.category_id,
|
||||||
) {
|
);
|
||||||
|
if (isRecordItem) {
|
||||||
let count = item.weight;
|
let count = item.weight;
|
||||||
item.record_items.forEach((recordItem) => {
|
item.record_items.forEach((recordItem) => {
|
||||||
if (recordItem.record_item_fee_items.length) {
|
if (recordItem.record_item_fee_items.length) {
|
||||||
@ -827,13 +832,12 @@ const recordWeight = (rule, item, settlementsId, productRule, rulefee?) => {
|
|||||||
count = recordItemFee.is_excluded ? count - recordItemFee.count : count;
|
count = recordItemFee.is_excluded ? count - recordItemFee.count : count;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
const productsName = item.record_items[0].product;
|
const productName = isRecordItem.product.name;
|
||||||
const productName = productCategory === 'category' ? productsName.name : productsName.label;
|
|
||||||
return {
|
return {
|
||||||
settlement_id: settlementsId,
|
settlement_id: settlementsId,
|
||||||
date: item.date,
|
date: item.date,
|
||||||
name: productName + '-' + spec,
|
name: productName + '-' + spec,
|
||||||
label: productsName.label + '-' + spec,
|
label: productName + '-' + spec,
|
||||||
category: name,
|
category: name,
|
||||||
movement: item.movement,
|
movement: item.movement,
|
||||||
count: count,
|
count: count,
|
||||||
|
Loading…
Reference in New Issue
Block a user