修复 【兑换码管理】编辑立减金商品页面,加款成功后,点击页面的取消按钮,充值批次金额也应该被保存

This commit is contained in:
wangsongsole 2022-06-16 14:27:45 +08:00
parent 4891721bc2
commit 7663f0d21b
1 changed files with 68 additions and 62 deletions

View File

@ -241,74 +241,79 @@ export default class exchangedit extends React.Component {
}) })
.catch((err) => {}) .catch((err) => {})
} else { } else {
getCodesDetail(code_batch_id) this.getTableList()
.then((res) => { }
handelResponse( }
res,
(req, msg) => {
let reqCopy = _.cloneDeep(req)
const resData = this.transFormData(reqCopy)
reqCopy.goods = resData
let codeInfo = {
code_name: reqCopy.title,
issued: reqCopy.quantity,
stock: reqCopy.stock,
describe: reqCopy.describe,
date_time: [reqCopy.begin_time, reqCopy.end_time],
range: reqCopy.goods
}
this.setState({ plan_time: reqCopy.plan.end_time }) getTableList() {
//获取分销商 let code_batch_id = sessionStorage.getItem('code_id')
getReseller(reqCopy.plan.reseller_id).then((res) => { getCodesDetail(code_batch_id)
handelResponse(res, (req1, msg) => { .then((res) => {
console.log('req ==>1', req1) handelResponse(
req1.receive_email = req1.contact_email[0] res,
this.setState({ reseller: req1 }) (req, msg) => {
this.setState({ phone_list: req1.contact_phone }) let reqCopy = _.cloneDeep(req)
this.setState({ email_list: req1.contact_email }) const resData = this.transFormData(reqCopy)
this.setState({ reqCopy.goods = resData
direct_reseller_id: req1.direct_reseller_id let codeInfo = {
}) code_name: reqCopy.title,
issued: reqCopy.quantity,
stock: reqCopy.stock,
describe: reqCopy.describe,
date_time: [reqCopy.begin_time, reqCopy.end_time],
range: reqCopy.goods
}
this.setState({ plan_time: reqCopy.plan.end_time })
//获取分销商
getReseller(reqCopy.plan.reseller_id).then((res) => {
handelResponse(res, (req1, msg) => {
console.log('req ==>1', req1)
req1.receive_email = req1.contact_email[0]
this.setState({ reseller: req1 })
this.setState({ phone_list: req1.contact_phone })
this.setState({ email_list: req1.contact_email })
this.setState({
direct_reseller_id: req1.direct_reseller_id
}) })
}) })
})
this.setState({ codeInfo: codeInfo }) this.setState({ codeInfo: codeInfo })
this.setState({ isload: true }) this.setState({ isload: true })
_.map(reqCopy.goods, (res) => { _.map(reqCopy.goods, (res) => {
res.checked = true res.checked = true
return res return res
}) })
this.setState({ tempdata: reqCopy.goods || [] }) this.setState({ tempdata: reqCopy.goods || [] })
let a1 = reqCopy.goods.map((item) => { let a1 = reqCopy.goods.map((item) => {
let obj = { let obj = {
...item, ...item,
in: true in: true
} }
return obj return obj
}) })
sessionStorage.setItem('productData', JSON.stringify(a1)) sessionStorage.setItem('productData', JSON.stringify(a1))
sessionStorage.setItem('knockGoldData', JSON.stringify(a1)) sessionStorage.setItem('knockGoldData', JSON.stringify(a1))
let arr = [] let arr = []
_.map(reqCopy.goods, (res) => { _.map(reqCopy.goods, (res) => {
let obj = {} let obj = {}
obj.key = res.only obj.key = res.only
obj.text = res.product_name obj.text = res.product_name
obj.id = res.id obj.id = res.id
this.state.oldProduct.push(res.id) this.state.oldProduct.push(res.id)
arr.push(obj) arr.push(obj)
return obj return obj
}) })
this.setState({ rankoptions: arr }) this.setState({ rankoptions: arr })
this.setState({ rank: arr }) this.setState({ rank: arr })
}, },
(err) => {} (err) => {}
) )
}) })
.catch((err) => {}) .catch((err) => {})
}
} }
/* 转换数据 */ /* 转换数据 */
@ -1360,6 +1365,7 @@ export default class exchangedit extends React.Component {
<Button <Button
onClick={(e) => { onClick={(e) => {
this.setState({ drawerVisible2: false }) this.setState({ drawerVisible2: false })
this.getTableList()
}}> }}>
取消 取消
</Button> </Button>