This commit is contained in:
wangsongsole 2022-08-04 18:31:43 +08:00
parent 898efb27cd
commit 86830177f8
1 changed files with 16 additions and 95 deletions

View File

@ -140,7 +140,8 @@ export default class acclist extends React.Component {
this.setState({ model: model }) this.setState({ model: model })
this.setState({ white_visible: true }) this.setState({ white_visible: true })
} }
//复制
//编辑
if (batch_id > 0 || copyOpearo == 2) { if (batch_id > 0 || copyOpearo == 2) {
// this.setState({isEdit:true}) // this.setState({isEdit:true})
getKeyBatchDetail(batch_id).then((res) => { getKeyBatchDetail(batch_id).then((res) => {
@ -150,110 +151,31 @@ export default class acclist extends React.Component {
this.setState({ pagetitle: '复制key' }) this.setState({ pagetitle: '复制key' })
getReseller(req.reseller_id).then((res) => { getReseller(req.reseller_id).then((res) => {
handelResponse(res, (req, msg) => { handelResponse(res, (req, msg) => {
this.setState({ this.setState({ reseller: req })
phone_list: req.contact_phone,
direct_reseller_id: req.direct_reseller_id, this.setState({ phone_list: req.contact_phone })
email_list: req.contact_email, this.setState({ 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 = { let model = {
title: req.plan_title, title: req.plan_title,
batch_name: '',
style: req.style, style: req.style,
quantity: req.quantity, quantity: req.quantity,
allow_repetition: req.allow_repetition, allow_repetition: req.allow_repetition,
allow_loss: req.allow_loss, allow_loss: req.allow_loss,
merge_stock: req.merge_stock, merge_stock: req.merge_stock,
code_batch: req.code_batch, code_batch: req.code_batch
batch_name: `${req.batch_name}_${++req.copy_count}`,
copy_code_batch_id: req.id
} }
let codeInfo = { this.setState({ checkedList: req.bind_object })
//数据模型不可少 this.setState({ model: model })
date_time: [req.begin_time, req.end_time] this.setState({ endtime: req.end_time })
} this.setState({ begintime: req.begin_time })
sessionStorage.setItem(
'plan_item',
JSON.stringify({
begin_time: req.begin_time,
end_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) => { let list = _.map(req.code_batch, (item) => {
item.product = item.product.map((item1) => { // item.disabled = true;
let obj = {} // item.checked = true;
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 return item
}) })
this.setState({ distdata: list }) this.setState({ distdata: list })
@ -261,7 +183,6 @@ export default class acclist extends React.Component {
(err) => {} (err) => {}
) )
}) })
/* 新增 */
} else { } else {
let plan_item = sessionStorage.getItem('plan_item') let plan_item = sessionStorage.getItem('plan_item')
if (plan_item) { if (plan_item) {
@ -278,6 +199,7 @@ export default class acclist extends React.Component {
getReseller(id).then((res) => { getReseller(id).then((res) => {
handelResponse(res, (req, msg) => { handelResponse(res, (req, msg) => {
this.setState({ reseller: req }) this.setState({ reseller: req })
this.setState({ phone_list: req.contact_phone }) this.setState({ phone_list: req.contact_phone })
this.setState({ email_list: req.contact_email }) this.setState({ email_list: req.contact_email })
this.setState({ this.setState({
@ -737,7 +659,6 @@ export default class acclist extends React.Component {
let data = {} let data = {}
data.batch_name = this.state.model.batch_name data.batch_name = this.state.model.batch_name
data.copy_code_batch_id = this.state.model?.copy_code_batch_id
data.style = this.state.model.style data.style = this.state.model.style
data.quantity = this.state.model.quantity data.quantity = this.state.model.quantity
data.bind_object = this.state.checkedList data.bind_object = this.state.checkedList