修正 兑换码复制,审核驳回的兑换码不应该被复制。

This commit is contained in:
wangsongsole 2022-08-16 11:26:36 +08:00
parent 6dd00c149c
commit e784e7df49
1 changed files with 106 additions and 261 deletions

View File

@ -91,7 +91,6 @@ export default class acclist extends React.Component {
tempdata: [], tempdata: [],
distdata: [], distdata: [],
pagetitle: '编辑key', pagetitle: '编辑key',
isEdit: false,
begintime: '', begintime: '',
endtime: '', endtime: '',
isCancel: false, isCancel: false,
@ -119,7 +118,6 @@ export default class acclist extends React.Component {
/* key批次分销商id */ /* key批次分销商id */
let reseller_id = sessionStorage.getItem('key_reseller_id') let reseller_id = sessionStorage.getItem('key_reseller_id')
/* 审核id */ /* 审核id */
let approval_id = sessionStorage.getItem('approval_id')
/* 被复制得兑换码id */ /* 被复制得兑换码id */
let copy_code_id = ~~sessionStorage.getItem('copy_code_id') let copy_code_id = ~~sessionStorage.getItem('copy_code_id')
@ -145,13 +143,6 @@ export default class acclist extends React.Component {
if (req.status == 7) { if (req.status == 7) {
this.setState({ isCancel: true }) this.setState({ isCancel: true })
} }
if (req.status == 1) {
this.setState({ isEdit: false })
} else {
this.setState({ isEdit: true })
}
req.code_batch = req.code_batch || [] req.code_batch = req.code_batch || []
this.setState({ this.setState({
pagetitle: '复制兑换码', pagetitle: '复制兑换码',
@ -232,68 +223,6 @@ export default class acclist extends React.Component {
}) })
let temp = [...list] let temp = [...list]
//
if (approval_id > 0) {
getApprovalsInfo(approval_id).then((res) => {
handelResponse(res, (req, msg) => {
/*当为创建中和审核驳回时 转换数据结构 */
const newProduct = []
req.code_batch.map((item) => {
item.product.legal.map((item1) => {
newProduct.push({
type: 1,
only: item1.product_id,
upstream: '直连天下',
...item1
})
})
item.product.reduce.map((item1) => {
newProduct.push({
type: 2,
only: item1.channel_activity_id,
upstream:
String(item.channel) === '1' ? '支付宝' : '微信',
origin: item1,
product_name: item1.batch_goods_name,
effectDate:
item1.time_limit?.effect_time.start_time +
' 至 ' +
item1.time_limit?.effect_time.end_time, //
contract_price: item1.price, //
official_price: item1.reduce_amount, //
quantity: Math.trunc(
item1.all_budget / item1.reduce_amount
), //
...item1
})
})
item.product = [...newProduct]
})
for (let i = 0; i < req.code_batch.length; i++) {
let code_batch = req.code_batch[i]
let range = []
for (let j = 0; j < code_batch.product.length; j++) {
let product = code_batch.product[j]
range.push(product.product_name)
}
req.code_batch[i].disabled = true
req.code_batch[i].checked = true
req.code_batch[i].range = range.toString()
temp.push(req.code_batch[i])
}
if (req.payment_direction) {
let index = this.state.payment_direction.indexOf(
req.payment_direction
)
this.setState({ paytype: index + 1 })
}
})
})
}
let model = { let model = {
style: req.style, style: req.style,
batch_name: req.batch_name, batch_name: req.batch_name,
@ -696,8 +625,6 @@ export default class acclist extends React.Component {
delete item.products delete item.products
}) })
// key
if (this.state.isEdit) {
this.setState({ audit_visible: false }) this.setState({ audit_visible: false })
let approval_id = sessionStorage.getItem('approval_id') let approval_id = sessionStorage.getItem('approval_id')
if (approval_id > 0) { if (approval_id > 0) {
@ -818,88 +745,6 @@ export default class acclist extends React.Component {
}) })
} }
} }
} else {
// key
let data = {
batch_name: this.state.model.batch_name,
style: this.state.model.style,
quantity: this.state.model.quantity,
bind_object: this.state.checkedList,
allow_repetition: this.state.model.allow_repetition,
allow_loss: this.state.model.allow_loss,
merge_stock: this.state.model.merge_stock,
mobile_excel: this.state.mobile_excel,
mobile_repeat: this.state.mobile_repeat,
code_batch: dataCopy,
reseller_id: this.state.reseller.id,
reseller_name: this.state.reseller.name,
company_name: this.state.reseller.company_name,
receive_email: this.state.reseller.contact_email[0],
payment_direction: this.state.payment_direction[this.state.paytype - 1]
}
let id = sessionStorage.getItem('keybatch_id')
let approval_id = sessionStorage.getItem('approval_id')
if (approval_id > 0) {
getApprovalsStatus(approval_id).then((res) => {
handelResponse(
res,
(req, msg) => {
if (req.status == 0) {
this.setState({ recall_visible: true })
}
if (req.status == 1) {
this.setState({ audit_visible: true })
}
if (req.status == 2 || req.status == 3) {
putKeyBatchDetail(id, data).then((res) => {
handelResponse(
res,
(req, msg) => {
keyApproval(this.state.plan_id, id, data).then((res) => {
handelResponse(
res,
(req, msg) => {
Notify.success('成功发起审批')
setTimeout(() => {
this.props.history.push('/home/key-list/')
}, 2000)
},
(err) => {
Notify.error(err)
}
)
})
},
(err) => {
Notify.error(err)
}
)
})
}
},
(err) => {
Notify.error(err)
}
)
})
} else {
keyApproval(this.state.plan_id, id, data).then((res) => {
handelResponse(
res,
(req, msg) => {
Notify.success('成功发起审批')
setTimeout(() => {
this.props.history.push('/home/key-list/')
}, 2000)
},
(err) => {
Notify.error(err)
}
)
})
}
}
} }
onBindNum(e, row) { onBindNum(e, row) {
@ -1039,7 +884,7 @@ export default class acclist extends React.Component {
this.onStyleChange(e) this.onStyleChange(e)
}} }}
value={this.state.model.style} value={this.state.model.style}
disabled={this.state.isEdit}> disabled={true}>
<RadioButton value={1}>串码</RadioButton> <RadioButton value={1}>串码</RadioButton>
<RadioButton value={2}>链接</RadioButton> <RadioButton value={2}>链接</RadioButton>
<RadioButton value={4}>二维码</RadioButton> <RadioButton value={4}>二维码</RadioButton>
@ -1059,7 +904,7 @@ export default class acclist extends React.Component {
<Checkbox.Group <Checkbox.Group
value={this.state.checkedList} value={this.state.checkedList}
onChange={(arr) => this.setState({ checkedList: arr })} onChange={(arr) => this.setState({ checkedList: arr })}
disabled={this.state.isEdit}> disabled={true}>
<Checkbox value={1}>兑换码</Checkbox> <Checkbox value={1}>兑换码</Checkbox>
<Checkbox value={2} disabled> <Checkbox value={2} disabled>
优惠券 优惠券
@ -1124,7 +969,7 @@ export default class acclist extends React.Component {
id='allow_repetition' id='allow_repetition'
prop='allow_repetition'> prop='allow_repetition'>
<RadioGroup <RadioGroup
disabled={this.state.isEdit} disabled={true}
onChange={(e) => this.onRepetitionChange(e)} onChange={(e) => this.onRepetitionChange(e)}
value={this.state.model.allow_repetition}> value={this.state.model.allow_repetition}>
<RadioButton value={1}></RadioButton> <RadioButton value={1}></RadioButton>
@ -1137,7 +982,7 @@ export default class acclist extends React.Component {
id='allow_loss' id='allow_loss'
prop='allow_loss'> prop='allow_loss'>
<RadioGroup <RadioGroup
disabled={this.state.isEdit} disabled={true}
onChange={(e) => this.onLossChange(e)} onChange={(e) => this.onLossChange(e)}
value={this.state.model.allow_loss}> value={this.state.model.allow_loss}>
<RadioButton value={1}></RadioButton> <RadioButton value={1}></RadioButton>