fix: 修复立减金复制库存重新计算

This commit is contained in:
zhangds 2022-10-31 15:43:19 +08:00
parent 8b80420d95
commit 0a744b0524
1 changed files with 12 additions and 3 deletions

View File

@ -1,4 +1,15 @@
import { divNum } from "./number";
// 判断
const kgType = (item) => {
let type = sessionStorage.getItem("KeyPcType");
if (type === "2" || type === "3") {
return divNum(item.all_budget, item.reduce_amount);
} else {
return item.stock;
}
};
// 立减金对象重构
export const knockGoldFun = (item) => {
let table_obj = {};
@ -11,9 +22,7 @@ export const knockGoldFun = (item) => {
table_obj.official_price = item.reduce_amount; // 官方价
table_obj.contract_price = item.price; // 合同价格
table_obj.quantity = item.total_stock; // 库存数量
table_obj.stock = item.stock
? item.stock
: divNum(item.all_budget, item.reduce_amount); // 剩余库存数量
table_obj.stock = kgType(item); // 剩余库存数量
table_obj.channel_activity_id = item.channel_activity_id; // 批次号
table_obj.all_budget = Number(item.all_budget); // 总预算
table_obj.effectDate = `${item.time_limit.effect_time.start_time}${item.time_limit.effect_time.end_time}`; // 有效时间段