修正 兑换码复制,审核驳回的兑换码不应该被复制。
This commit is contained in:
parent
6dd00c149c
commit
e784e7df49
|
@ -91,7 +91,6 @@ export default class acclist extends React.Component {
|
|||
tempdata: [],
|
||||
distdata: [],
|
||||
pagetitle: '编辑key',
|
||||
isEdit: false,
|
||||
begintime: '',
|
||||
endtime: '',
|
||||
isCancel: false,
|
||||
|
@ -119,7 +118,6 @@ export default class acclist extends React.Component {
|
|||
/* key批次分销商id */
|
||||
let reseller_id = sessionStorage.getItem('key_reseller_id')
|
||||
/* 审核id */
|
||||
let approval_id = sessionStorage.getItem('approval_id')
|
||||
/* 被复制得兑换码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) {
|
||||
this.setState({ isCancel: true })
|
||||
}
|
||||
|
||||
if (req.status == 1) {
|
||||
this.setState({ isEdit: false })
|
||||
} else {
|
||||
this.setState({ isEdit: true })
|
||||
}
|
||||
|
||||
req.code_batch = req.code_batch || []
|
||||
this.setState({
|
||||
pagetitle: '复制兑换码',
|
||||
|
@ -232,68 +223,6 @@ export default class acclist extends React.Component {
|
|||
})
|
||||
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 = {
|
||||
style: req.style,
|
||||
batch_name: req.batch_name,
|
||||
|
@ -696,202 +625,118 @@ export default class acclist extends React.Component {
|
|||
delete item.products
|
||||
})
|
||||
|
||||
//除了创建中 编辑key
|
||||
if (this.state.isEdit) {
|
||||
this.setState({ audit_visible: false })
|
||||
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) {
|
||||
let id = sessionStorage.getItem('keybatch_id')
|
||||
let data = {
|
||||
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]
|
||||
}
|
||||
|
||||
keyEditApproval(id, data).then((res) => {
|
||||
handelResponse(
|
||||
res,
|
||||
(req, msg) => {
|
||||
Notify.success('成功发起审批')
|
||||
setTimeout(() => {
|
||||
window.history.back()
|
||||
}, 1000)
|
||||
},
|
||||
(err) => {
|
||||
Notify.error(err)
|
||||
}
|
||||
)
|
||||
})
|
||||
}
|
||||
},
|
||||
(err) => {
|
||||
Notify.error(err)
|
||||
this.setState({ audit_visible: false })
|
||||
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 })
|
||||
}
|
||||
)
|
||||
})
|
||||
} else {
|
||||
if (this.state.key_status != 1) {
|
||||
let id = sessionStorage.getItem('keybatch_id')
|
||||
let data = {
|
||||
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]
|
||||
}
|
||||
|
||||
keyEditApproval(id, data).then((res) => {
|
||||
handelResponse(
|
||||
res,
|
||||
(req, msg) => {
|
||||
Notify.success('成功发起审批')
|
||||
setTimeout(() => {
|
||||
window.history.back()
|
||||
}, 1000)
|
||||
},
|
||||
(err) => {
|
||||
Notify.error(err)
|
||||
if (req.status == 1) {
|
||||
this.setState({ audit_visible: true })
|
||||
}
|
||||
if (req.status == 2 || req.status == 3) {
|
||||
let id = sessionStorage.getItem('keybatch_id')
|
||||
let data = {
|
||||
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]
|
||||
}
|
||||
)
|
||||
})
|
||||
} else {
|
||||
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')
|
||||
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)
|
||||
}
|
||||
)
|
||||
})
|
||||
}
|
||||
}
|
||||
keyEditApproval(id, data).then((res) => {
|
||||
handelResponse(
|
||||
res,
|
||||
(req, msg) => {
|
||||
Notify.success('成功发起审批')
|
||||
setTimeout(() => {
|
||||
window.history.back()
|
||||
}, 1000)
|
||||
},
|
||||
(err) => {
|
||||
Notify.error(err)
|
||||
}
|
||||
)
|
||||
})
|
||||
}
|
||||
},
|
||||
(err) => {
|
||||
Notify.error(err)
|
||||
}
|
||||
)
|
||||
})
|
||||
} 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]
|
||||
}
|
||||
if (this.state.key_status != 1) {
|
||||
let id = sessionStorage.getItem('keybatch_id')
|
||||
let data = {
|
||||
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) => {
|
||||
keyEditApproval(id, data).then((res) => {
|
||||
handelResponse(
|
||||
res,
|
||||
(req, msg) => {
|
||||
Notify.success('成功发起审批')
|
||||
setTimeout(() => {
|
||||
this.props.history.push('/home/key-list/')
|
||||
}, 2000)
|
||||
window.history.back()
|
||||
}, 1000)
|
||||
},
|
||||
(err) => {
|
||||
Notify.error(err)
|
||||
}
|
||||
)
|
||||
})
|
||||
} else {
|
||||
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')
|
||||
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)
|
||||
|
@ -1039,7 +884,7 @@ export default class acclist extends React.Component {
|
|||
this.onStyleChange(e)
|
||||
}}
|
||||
value={this.state.model.style}
|
||||
disabled={this.state.isEdit}>
|
||||
disabled={true}>
|
||||
<RadioButton value={1}>串码</RadioButton>
|
||||
<RadioButton value={2}>链接</RadioButton>
|
||||
<RadioButton value={4}>二维码</RadioButton>
|
||||
|
@ -1059,7 +904,7 @@ export default class acclist extends React.Component {
|
|||
<Checkbox.Group
|
||||
value={this.state.checkedList}
|
||||
onChange={(arr) => this.setState({ checkedList: arr })}
|
||||
disabled={this.state.isEdit}>
|
||||
disabled={true}>
|
||||
<Checkbox value={1}>兑换码</Checkbox>
|
||||
<Checkbox value={2} disabled>
|
||||
优惠券
|
||||
|
@ -1124,7 +969,7 @@ export default class acclist extends React.Component {
|
|||
id='allow_repetition'
|
||||
prop='allow_repetition'>
|
||||
<RadioGroup
|
||||
disabled={this.state.isEdit}
|
||||
disabled={true}
|
||||
onChange={(e) => this.onRepetitionChange(e)}
|
||||
value={this.state.model.allow_repetition}>
|
||||
<RadioButton value={1}>是</RadioButton>
|
||||
|
@ -1137,7 +982,7 @@ export default class acclist extends React.Component {
|
|||
id='allow_loss'
|
||||
prop='allow_loss'>
|
||||
<RadioGroup
|
||||
disabled={this.state.isEdit}
|
||||
disabled={true}
|
||||
onChange={(e) => this.onLossChange(e)}
|
||||
value={this.state.model.allow_loss}>
|
||||
<RadioButton value={1}>是</RadioButton>
|
||||
|
|
Loading…
Reference in New Issue