修正 兑换码复制,审核驳回的兑换码不应该被复制。
This commit is contained in:
parent
6dd00c149c
commit
e784e7df49
|
@ -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,202 +625,118 @@ export default class acclist extends React.Component {
|
||||||
delete item.products
|
delete item.products
|
||||||
})
|
})
|
||||||
|
|
||||||
//除了创建中 编辑key
|
this.setState({ audit_visible: false })
|
||||||
if (this.state.isEdit) {
|
let approval_id = sessionStorage.getItem('approval_id')
|
||||||
this.setState({ audit_visible: false })
|
if (approval_id > 0) {
|
||||||
let approval_id = sessionStorage.getItem('approval_id')
|
getApprovalsStatus(approval_id).then((res) => {
|
||||||
if (approval_id > 0) {
|
handelResponse(
|
||||||
getApprovalsStatus(approval_id).then((res) => {
|
res,
|
||||||
handelResponse(
|
(req, msg) => {
|
||||||
res,
|
if (req.status == 0) {
|
||||||
(req, msg) => {
|
this.setState({ recall_visible: true })
|
||||||
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)
|
|
||||||
}
|
}
|
||||||
)
|
if (req.status == 1) {
|
||||||
})
|
this.setState({ audit_visible: true })
|
||||||
} else {
|
}
|
||||||
if (this.state.key_status != 1) {
|
if (req.status == 2 || req.status == 3) {
|
||||||
let id = sessionStorage.getItem('keybatch_id')
|
let id = sessionStorage.getItem('keybatch_id')
|
||||||
let data = {
|
let data = {
|
||||||
code_batch: dataCopy,
|
code_batch: dataCopy,
|
||||||
reseller_id: this.state.reseller?.id,
|
reseller_id: this.state.reseller.id,
|
||||||
reseller_name: this.state.reseller?.name,
|
reseller_name: this.state.reseller.name,
|
||||||
company_name: this.state.reseller?.company_name,
|
company_name: this.state.reseller.company_name,
|
||||||
receive_email: this.state.reseller?.contact_email[0],
|
receive_email: this.state.reseller.contact_email[0],
|
||||||
payment_direction:
|
payment_direction:
|
||||||
this.state.payment_direction[this.state.paytype - 1]
|
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)
|
|
||||||
}
|
}
|
||||||
)
|
|
||||||
})
|
|
||||||
} 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')
|
keyEditApproval(id, data).then((res) => {
|
||||||
putKeyBatchDetail(id, data).then((res) => {
|
handelResponse(
|
||||||
handelResponse(
|
res,
|
||||||
res,
|
(req, msg) => {
|
||||||
(req, msg) => {
|
Notify.success('成功发起审批')
|
||||||
keyApproval(this.state.plan_id, id, data).then((res) => {
|
setTimeout(() => {
|
||||||
handelResponse(
|
window.history.back()
|
||||||
res,
|
}, 1000)
|
||||||
(req, msg) => {
|
},
|
||||||
Notify.success('成功发起审批')
|
(err) => {
|
||||||
setTimeout(() => {
|
Notify.error(err)
|
||||||
this.props.history.push('/home/key-list/')
|
}
|
||||||
}, 2000)
|
)
|
||||||
},
|
})
|
||||||
(err) => {
|
}
|
||||||
Notify.error(err)
|
},
|
||||||
}
|
(err) => {
|
||||||
)
|
Notify.error(err)
|
||||||
})
|
}
|
||||||
},
|
)
|
||||||
(err) => {
|
})
|
||||||
Notify.error(err)
|
|
||||||
}
|
|
||||||
)
|
|
||||||
})
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} else {
|
} else {
|
||||||
//创建中 编辑key
|
if (this.state.key_status != 1) {
|
||||||
let data = {
|
let id = sessionStorage.getItem('keybatch_id')
|
||||||
batch_name: this.state.model.batch_name,
|
let data = {
|
||||||
style: this.state.model.style,
|
code_batch: dataCopy,
|
||||||
quantity: this.state.model.quantity,
|
reseller_id: this.state.reseller?.id,
|
||||||
bind_object: this.state.checkedList,
|
reseller_name: this.state.reseller?.name,
|
||||||
allow_repetition: this.state.model.allow_repetition,
|
company_name: this.state.reseller?.company_name,
|
||||||
allow_loss: this.state.model.allow_loss,
|
receive_email: this.state.reseller?.contact_email[0],
|
||||||
merge_stock: this.state.model.merge_stock,
|
payment_direction:
|
||||||
mobile_excel: this.state.mobile_excel,
|
this.state.payment_direction[this.state.paytype - 1]
|
||||||
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')
|
keyEditApproval(id, data).then((res) => {
|
||||||
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(
|
handelResponse(
|
||||||
res,
|
res,
|
||||||
(req, msg) => {
|
(req, msg) => {
|
||||||
Notify.success('成功发起审批')
|
Notify.success('成功发起审批')
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
this.props.history.push('/home/key-list/')
|
window.history.back()
|
||||||
}, 2000)
|
}, 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) => {
|
(err) => {
|
||||||
Notify.error(err)
|
Notify.error(err)
|
||||||
|
@ -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>
|
||||||
|
|
Loading…
Reference in New Issue