diff --git a/src/pages/plan/add/step2.js b/src/pages/plan/add/step2.js index cc6d7bd5..dc909497 100644 --- a/src/pages/plan/add/step2.js +++ b/src/pages/plan/add/step2.js @@ -493,7 +493,6 @@ export default class acclist extends React.Component { this.setState({ distdata: tempdata }) } } - sessionStorage.setItem('knockGoldData', '') } addNewKey() { this.props.addNewkey() @@ -679,6 +678,7 @@ export default class acclist extends React.Component { } rowItemClick(row, rowIndex) { + debugger let codeInfo = { //数据模型不可少 code_name: row.title, @@ -707,6 +707,7 @@ export default class acclist extends React.Component { o.checked = true return o }) + sessionStorage.setItem('productData', JSON.stringify(row.product)) this.setState({ tempdata: temp, drawerVisible: true }) } @@ -843,14 +844,18 @@ export default class acclist extends React.Component { sessionStorage.setItem('productsList', JSON.stringify(data)) /* 区分立减金 */ if (rowData.type === 2) { - const temp = JSON.parse(sessionStorage.getItem('knockGoldData')) - const editData = temp.filter( - (item) => item.channel_activity_id === rowData.channel_activity_id - ) + let editData = '' + if (sessionStorage.getItem('knockGoldData')) { + const temp = JSON.parse(sessionStorage.getItem('knockGoldData')) + editData = temp.filter( + (item) => + item.channel_activity_id === rowData.channel_activity_id + ) + } this.setState({ product_title: '编辑立减金', - productData: editData[0], + productData: editData[0] ? editData[0] : rowData.origin, addIsType: 'addKnockGold' }) } else { diff --git a/src/pages/plan/key/edit.js b/src/pages/plan/key/edit.js index b1a220b0..8e2503d9 100644 --- a/src/pages/plan/key/edit.js +++ b/src/pages/plan/key/edit.js @@ -153,22 +153,6 @@ export default class acclist extends React.Component { req.code_batch = req.code_batch ? req.code_batch : [] this.setState({ pagetitle: '编辑key' }) - /* 转换数据结构 */ - // req.code_batch.map((item) => { - // item.product?.legal?.map((item1) => { - // item1.type = 1 - // item1.only = item1.product_id - // item1.upstream = '直连天下' - // }) - // item.product?.reduce?.map((item1) => { - // item1.type = 2 - // item1.only = item1.channel_activity_id - // item1.upstream = item.channel === '1' ? '支付宝' : '微信' //上游 - // item1.origin = item1 - // }) - // item.product = [...item.product?.legal, ...item.product?.reduce] - // }) - let temp = [] for (let i = 0; i < req.code_batch.length; i++) { let code_batch = req.code_batch[i] @@ -184,7 +168,7 @@ export default class acclist extends React.Component { } req.code_batch[i].disabled = true req.code_batch[i].checked = true - code_batch.range = range.toString() + req.code_batch.range = range.toString() temp.push(req.code_batch[i]) } //获取审批单信息 @@ -227,6 +211,7 @@ export default class acclist extends React.Component { code_batch.range = range.toString() temp.push(req.code_batch[i]) } + console.log(temp) if (req.payment_direction) { let index = this.state.payment_direction.indexOf( @@ -1170,7 +1155,6 @@ export default class acclist extends React.Component { }, { title: '兑换码范围', - type: 'normal', prop: 'range', width: 'auto'