💊 fix: 修复立减金商品id展示错误
This commit is contained in:
parent
a03f3feb7e
commit
7ce3aa8649
|
@ -1,78 +1,77 @@
|
|||
import { divNum } from './number';
|
||||
import { Notify } from 'zent';
|
||||
import { divNum } from "./number"
|
||||
import { Notify } from "zent"
|
||||
|
||||
// 判断
|
||||
const kgType = (item) => {
|
||||
let type = sessionStorage.getItem('KeyPcType');
|
||||
if (type === '2' || type === '3') {
|
||||
return parseInt(divNum(item.all_budget, item.reduce_amount));
|
||||
let type = sessionStorage.getItem("KeyPcType")
|
||||
if (type === "2" || type === "3") {
|
||||
return parseInt(divNum(item.all_budget, item.reduce_amount))
|
||||
} else {
|
||||
if (item.stock) {
|
||||
return item.stock;
|
||||
return item.stock
|
||||
} else {
|
||||
return parseInt(divNum(item.all_budget, item.reduce_amount));
|
||||
return parseInt(divNum(item.all_budget, item.reduce_amount))
|
||||
}
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
// 立减金对象重构
|
||||
export const knockGoldFun = (item) => {
|
||||
let table_obj = {};
|
||||
table_obj.type = 2; // 类型
|
||||
table_obj.upstream = String(item.channel) === '1' ? '支付宝' : '微信'; // 上游平台
|
||||
|
||||
table_obj.only = item; // 存储就数据 编辑好用
|
||||
table_obj.product_id = item.goods_id ? item.goods_id : item.batch_goods_name; // 商品编号
|
||||
table_obj.product_name = item.batch_goods_name; // 商品名
|
||||
table_obj.official_price = item.reduce_amount; // 官方价
|
||||
table_obj.contract_price = item.price; // 合同价格
|
||||
table_obj.quantity = kgType(item); // 库存数量
|
||||
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}`; // 有效时间段
|
||||
table_obj.create_time = item.create_time; // 创建时间
|
||||
return table_obj;
|
||||
};
|
||||
let table_obj = {}
|
||||
table_obj.type = 2 // 类型
|
||||
table_obj.upstream = String(item.channel) === "1" ? "支付宝" : "微信" // 上游平台
|
||||
table_obj.only = item // 存储就数据 编辑好用
|
||||
table_obj.product_id = item.goods_id ? item.goods_id : item.channel_activity_id // 商品编号
|
||||
table_obj.product_name = item.batch_goods_name // 商品名
|
||||
table_obj.official_price = item.reduce_amount // 官方价
|
||||
table_obj.contract_price = item.price // 合同价格
|
||||
table_obj.quantity = kgType(item) // 库存数量
|
||||
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}` // 有效时间段
|
||||
table_obj.create_time = item.create_time // 创建时间
|
||||
return table_obj
|
||||
}
|
||||
|
||||
// 红包对象重构
|
||||
export const redPacketsFun = (item) => {
|
||||
let table_obj = {};
|
||||
let table_obj = {}
|
||||
const price =
|
||||
item.cash_amount_type === '1'
|
||||
item.cash_amount_type === "1"
|
||||
? item.denomination
|
||||
: `${item.min_denomination}~${item.max_denomination}`;
|
||||
table_obj.type = 3; // 类型
|
||||
table_obj.upstream = item.channel === 1 ? '支付宝' : '微信'; // 上游平台
|
||||
table_obj.only = item; // 存储就数据 编辑好用
|
||||
table_obj.product_id = item.goods_id || item.id || item.cash_activity_id; // 商品编号
|
||||
table_obj.product_name = item.batch_goods_name; // 商品名
|
||||
table_obj.official_price = price; // 官方价
|
||||
table_obj.contract_price = price; // 合同价格
|
||||
table_obj.cost_price = '-'; //单价
|
||||
table_obj.quantity = item.num; // 库存数量
|
||||
table_obj.stock = item.stock || item.num; // 剩余库存数量
|
||||
table_obj.channel_activity_id = item.cash_activity_id; // 批次号
|
||||
table_obj.all_budget = Number(item.all_budget); // 总预算
|
||||
table_obj.effectDate = `${item.begin_time} 至 ${item.end_time}`; // 有效时间段
|
||||
return table_obj;
|
||||
};
|
||||
: `${item.min_denomination}~${item.max_denomination}`
|
||||
table_obj.type = 3 // 类型
|
||||
table_obj.upstream = item.channel === 1 ? "支付宝" : "微信" // 上游平台
|
||||
table_obj.only = item // 存储就数据 编辑好用
|
||||
table_obj.product_id = item.goods_id || item.id || item.cash_activity_id // 商品编号
|
||||
table_obj.product_name = item.batch_goods_name // 商品名
|
||||
table_obj.official_price = price // 官方价
|
||||
table_obj.contract_price = price // 合同价格
|
||||
table_obj.cost_price = "-" //单价
|
||||
table_obj.quantity = item.num // 库存数量
|
||||
table_obj.stock = item.stock || item.num // 剩余库存数量
|
||||
table_obj.channel_activity_id = item.cash_activity_id // 批次号
|
||||
table_obj.all_budget = Number(item.all_budget) // 总预算
|
||||
table_obj.effectDate = `${item.begin_time} 至 ${item.end_time}` // 有效时间段
|
||||
return table_obj
|
||||
}
|
||||
|
||||
// 卡密判断
|
||||
export const submitIsKm = (data) => {
|
||||
console.log('submitIsKm =>', data);
|
||||
let visible = true;
|
||||
let deDateTime = JSON.parse(sessionStorage.getItem('knockGold_effectDate'));
|
||||
let end_time = new Date(deDateTime.end_time).getTime(); // 计划结束时间
|
||||
console.log("submitIsKm =>", data)
|
||||
let visible = true
|
||||
let deDateTime = JSON.parse(sessionStorage.getItem("knockGold_effectDate"))
|
||||
let end_time = new Date(deDateTime.end_time).getTime() // 计划结束时间
|
||||
// 校验 卡密商品数据 结束时间
|
||||
let legal_km = data.filter((item) => Number(item.product_type) === 2);
|
||||
let legal_km = data.filter((item) => Number(item.product_type) === 2)
|
||||
for (let i = 0; i < legal_km.length; i++) {
|
||||
console.log('卡密时间 =>', legal_km[i].end_time);
|
||||
let end_time_km = new Date(legal_km[i].end_time).getTime();
|
||||
console.log("卡密时间 =>", legal_km[i].end_time)
|
||||
let end_time_km = new Date(legal_km[i].end_time).getTime()
|
||||
if (end_time < end_time_km) {
|
||||
Notify.error('卡密兑换有效期,不能超过计划时间');
|
||||
return false;
|
||||
Notify.error("卡密兑换有效期,不能超过计划时间")
|
||||
return false
|
||||
}
|
||||
}
|
||||
return visible;
|
||||
};
|
||||
return visible
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue