1) 增加key批次复制
This commit is contained in:
parent
6d0bc162f4
commit
3e20513d93
|
@ -252,7 +252,6 @@ export default class acclist extends React.Component {
|
|||
|
||||
//复制
|
||||
if (batch_id > 0 || copyOpearo == 2) {
|
||||
// this.setState({isEdit:true})
|
||||
getKeyBatchDetail(batch_id).then((res) => {
|
||||
handelResponse(
|
||||
res,
|
||||
|
@ -269,7 +268,6 @@ export default class acclist extends React.Component {
|
|||
this.getProductFunction(req.direct_reseller_id);
|
||||
});
|
||||
});
|
||||
|
||||
let model = {
|
||||
title: req.plan_title,
|
||||
style: req.style,
|
||||
|
@ -277,89 +275,102 @@ export default class acclist extends React.Component {
|
|||
allow_repetition: req.allow_repetition,
|
||||
allow_loss: req.allow_loss,
|
||||
merge_stock: req.merge_stock,
|
||||
code_batch: req.code_batch,
|
||||
batch_name: `${req.batch_name}_${++req.copy_count}`,
|
||||
};
|
||||
this.setState({ keyType: req.bind_object });
|
||||
|
||||
// 兑换码
|
||||
if (req.bind_object[0] === 1) {
|
||||
model.code_batch = req.code_batch;
|
||||
let list = _.map(req.code_batch, (item) => {
|
||||
item.product = item.product.map((item1) => {
|
||||
let obj = {};
|
||||
if (item1.type === 1) {
|
||||
obj = item1.entity;
|
||||
obj.upstream = "直连天下";
|
||||
obj.only = item1.entity.product_id;
|
||||
obj.id = item1.entity.product_id;
|
||||
obj.weight = item1.weight;
|
||||
obj.type = item1.type;
|
||||
} else if (item1.type === 2) {
|
||||
obj.type = item1.type;
|
||||
obj.product_id = item1.entity.goods_id;
|
||||
obj.product_type_text = "立减金";
|
||||
obj.only = item1.entity.channel_activity_id;
|
||||
obj.id = item1.entity.goods_id;
|
||||
obj.upstream =
|
||||
String(item1.entity.channel) === "1" ? "支付宝" : "微信";
|
||||
obj.code_batch_id = item1.code_batch_id;
|
||||
obj.contract_price = item1.entity.price;
|
||||
obj.create_time = item1.create_time;
|
||||
obj.official_price = item1.entity.reduce_amount;
|
||||
obj.channel_activity_id = item1.entity.channel_activity_id;
|
||||
obj.product_name = item1.entity.batch_goods_name;
|
||||
obj.quantity = item1.entity.stock;
|
||||
item1.entity.weight = item1.weight;
|
||||
obj.stock = parseInt(
|
||||
divNum(
|
||||
item1.entity.all_budget,
|
||||
item1.entity.reduce_amount
|
||||
) -
|
||||
divNum(
|
||||
item1.entity.used_amount,
|
||||
item1.entity.reduce_amount
|
||||
)
|
||||
);
|
||||
obj.usage = parseInt(
|
||||
divNum(
|
||||
item1.entity.all_budget,
|
||||
item1.entity.reduce_amount
|
||||
) -
|
||||
divNum(
|
||||
item1.entity.all_budget - item1.entity.used_amount,
|
||||
item1.entity.reduce_amount
|
||||
)
|
||||
);
|
||||
obj.effectDate =
|
||||
item1.entity.time_limit.effect_time.start_time +
|
||||
" 至 " +
|
||||
item1.entity.time_limit.effect_time.end_time;
|
||||
//有效时间
|
||||
delete item1.entity.id;
|
||||
obj.origin = item1.entity;
|
||||
}
|
||||
|
||||
return obj;
|
||||
});
|
||||
let pr = {};
|
||||
let productRange = [];
|
||||
item.product.forEach((item) => {
|
||||
productRange.push(item.product_name);
|
||||
});
|
||||
productRange = productRange.toString();
|
||||
pr.range = productRange;
|
||||
pr.restrict = item.restrict;
|
||||
pr.title = item.title;
|
||||
pr.begin_time = item.begin_time;
|
||||
pr.end_time = item.end_time;
|
||||
pr.quantity = item.quantity;
|
||||
pr.describe = item.describe;
|
||||
pr.product = item.product;
|
||||
item = pr;
|
||||
return item;
|
||||
});
|
||||
this.setState({ distdata: list });
|
||||
} else {
|
||||
// 优惠券
|
||||
let temp = _.map(req.coupon, (o) => {
|
||||
o.checked = true;
|
||||
return o;
|
||||
});
|
||||
model.coupon = temp;
|
||||
this.setState({ couponData: temp });
|
||||
}
|
||||
|
||||
this.setState({ keyType: req.bind_object[0] });
|
||||
this.setState({ model: model });
|
||||
this.setState({ endtime: req.end_time });
|
||||
this.setState({ begintime: req.begin_time });
|
||||
this.setState({ keyCodeId: req.id });
|
||||
let list = _.map(req.code_batch, (item) => {
|
||||
item.product = item.product.map((item1) => {
|
||||
let obj = {};
|
||||
if (item1.type === 1) {
|
||||
obj = item1.entity;
|
||||
obj.upstream = "直连天下";
|
||||
obj.only = item1.entity.product_id;
|
||||
obj.id = item1.entity.product_id;
|
||||
obj.weight = item1.weight;
|
||||
obj.type = item1.type;
|
||||
} else if (item1.type === 2) {
|
||||
obj.type = item1.type;
|
||||
obj.product_id = item1.entity.goods_id;
|
||||
obj.product_type_text = "立减金";
|
||||
obj.only = item1.entity.channel_activity_id;
|
||||
obj.id = item1.entity.goods_id;
|
||||
obj.upstream =
|
||||
String(item1.entity.channel) === "1" ? "支付宝" : "微信";
|
||||
obj.code_batch_id = item1.code_batch_id;
|
||||
obj.contract_price = item1.entity.price;
|
||||
obj.create_time = item1.create_time;
|
||||
obj.official_price = item1.entity.reduce_amount;
|
||||
obj.channel_activity_id = item1.entity.channel_activity_id;
|
||||
obj.product_name = item1.entity.batch_goods_name;
|
||||
obj.quantity = item1.entity.stock;
|
||||
item1.entity.weight = item1.weight;
|
||||
obj.stock = parseInt(
|
||||
divNum(
|
||||
item1.entity.all_budget,
|
||||
item1.entity.reduce_amount
|
||||
) -
|
||||
divNum(
|
||||
item1.entity.used_amount,
|
||||
item1.entity.reduce_amount
|
||||
)
|
||||
);
|
||||
obj.usage = parseInt(
|
||||
divNum(
|
||||
item1.entity.all_budget,
|
||||
item1.entity.reduce_amount
|
||||
) -
|
||||
divNum(
|
||||
item1.entity.all_budget - item1.entity.used_amount,
|
||||
item1.entity.reduce_amount
|
||||
)
|
||||
);
|
||||
obj.effectDate =
|
||||
item1.entity.time_limit.effect_time.start_time +
|
||||
" 至 " +
|
||||
item1.entity.time_limit.effect_time.end_time;
|
||||
//有效时间
|
||||
delete item1.entity.id;
|
||||
obj.origin = item1.entity;
|
||||
}
|
||||
|
||||
return obj;
|
||||
});
|
||||
let pr = {};
|
||||
let productRange = [];
|
||||
item.product.forEach((item) => {
|
||||
productRange.push(item.product_name);
|
||||
});
|
||||
productRange = productRange.toString();
|
||||
pr.range = productRange;
|
||||
pr.restrict = item.restrict;
|
||||
pr.title = item.title;
|
||||
pr.begin_time = item.begin_time;
|
||||
pr.end_time = item.end_time;
|
||||
pr.quantity = item.quantity;
|
||||
pr.describe = item.describe;
|
||||
pr.product = item.product;
|
||||
item = pr;
|
||||
return item;
|
||||
});
|
||||
this.setState({ distdata: list });
|
||||
},
|
||||
(err) => {}
|
||||
);
|
||||
|
|
Loading…
Reference in New Issue