diff --git a/src/pages/exchangecode/copyCode/index.jsx b/src/pages/exchangecode/copyCode/index.jsx index 5f5a8a79..3ca2e3fb 100644 --- a/src/pages/exchangecode/copyCode/index.jsx +++ b/src/pages/exchangecode/copyCode/index.jsx @@ -152,14 +152,23 @@ export default class acclist extends React.Component { this.setState({ isEdit: true }) } - req.code_batch = req.code_batch ? req.code_batch : [] + req.code_batch = req.code_batch || [] this.setState({ pagetitle: '复制兑换码', plan_id: req.plan_id, key_status: req.status }) - let list = _.map(req.code_batch, (item) => { + const cloneData = _.cloneDeep(req.code_batch) + req.code_batch.map((item) => { + if (item.id === copy_code_id) { + const data = _.cloneDeep(item) + data.id = new Date().getTime() + cloneData.push(data) + } + }) + + let list = _.map(cloneData, (item) => { item.product = item.product.map((item1) => { let obj = {} if (item1.type === 1) { @@ -202,6 +211,7 @@ export default class acclist extends React.Component { return obj }) + let pr = {} pr.range = item.range pr.restrict = item.restrict