完善兑换码复制操作 等待对接接口

This commit is contained in:
wangsongsole 2022-07-29 16:24:39 +08:00
parent db4a7f8160
commit 00d84202bf
1 changed files with 86 additions and 15 deletions

View File

@ -140,8 +140,7 @@ export default class acclist extends React.Component {
this.setState({ model: model })
this.setState({ white_visible: true })
}
//编辑
//复制
if (batch_id > 0 || copyOpearo == 2) {
// this.setState({isEdit:true})
getKeyBatchDetail(batch_id).then((res) => {
@ -151,31 +150,103 @@ export default class acclist extends React.Component {
this.setState({ pagetitle: '复制key' })
getReseller(req.reseller_id).then((res) => {
handelResponse(res, (req, msg) => {
this.setState({ reseller: req })
this.setState({ phone_list: req.contact_phone })
this.setState({ email_list: req.contact_email })
this.setState({
phone_list: req.contact_phone,
direct_reseller_id: req.direct_reseller_id,
email_list: req.contact_email,
reseller: req
})
getProductInfoSelect({
reseller_id: req.direct_reseller_id
}).then((res) => {
if (res.code === 200) {
sessionStorage.setItem(
'productsList',
JSON.stringify(res.data.data)
)
}
})
})
})
let model = {
title: req.plan_title,
batch_name: '',
style: req.style,
quantity: req.quantity,
allow_repetition: req.allow_repetition,
allow_loss: req.allow_loss,
merge_stock: req.merge_stock,
code_batch: req.code_batch
code_batch: req.code_batch,
batch_name: `${req.batch_name}_1`
}
this.setState({ checkedList: req.bind_object })
this.setState({ model: model })
this.setState({ endtime: req.end_time })
this.setState({ begintime: req.begin_time })
let codeInfo = {
//数据模型不可少
date_time: [req.begin_time, req.end_time]
}
this.setState({
checkedList: req.bind_object,
model: model,
endtime: req.end_time,
begintime: req.begin_time,
codeInfo: codeInfo
})
let list = _.map(req.code_batch, (item) => {
// item.disabled = true;
// item.checked = true;
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 = Math.trunc(
item1.entity.all_budget / item1.entity.reduce_amount -
item1.entity.used_amount / item1.entity.reduce_amount
)
obj.usage = Math.trunc(
item1.entity.all_budget / item1.entity.reduce_amount -
(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 = {}
pr.range = item.range
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 })
@ -183,6 +254,7 @@ export default class acclist extends React.Component {
(err) => {}
)
})
/* 新增 */
} else {
let plan_item = sessionStorage.getItem('plan_item')
if (plan_item) {
@ -199,7 +271,6 @@ export default class acclist extends React.Component {
getReseller(id).then((res) => {
handelResponse(res, (req, msg) => {
this.setState({ reseller: req })
this.setState({ phone_list: req.contact_phone })
this.setState({ email_list: req.contact_email })
this.setState({