diff --git a/src/pages/exchangecode/exchangecodeAdd/index.jsx b/src/pages/exchangecode/exchangecodeAdd/index.jsx index c2b36854..16e92ab5 100644 --- a/src/pages/exchangecode/exchangecodeAdd/index.jsx +++ b/src/pages/exchangecode/exchangecodeAdd/index.jsx @@ -221,10 +221,6 @@ export default class exchangeAdd extends React.Component { rank: checkedArray, rankoptions: arr }); - - this.storage(reqCopy.goods, 1, 'productData'); - this.storage(reqCopy.goods, 2, 'knockGoldData'); - this.storage(reqCopy.goods, 3, 'redPacketsData'); }, (err) => {} ); @@ -232,18 +228,6 @@ export default class exchangeAdd extends React.Component { .catch((err) => {}); } - /* 分类缓存到本地 */ - storage(data = [], type, key) { - const filterData = data - .map((item) => { - if (item.type === type) { - return item.origin || item; - } - }) - .filter((item) => item); - sessionStorage.setItem(key, JSON.stringify(filterData)); - } - /* 获取直连天下商品数据 */ getProductInfoSelectData(reseller_id) { return new Promise((resolve, reject) => { @@ -280,6 +264,9 @@ export default class exchangeAdd extends React.Component { /* 编辑/复制转换数据 */ transFormData(req) { const newData = []; + const legal = []; + const reduce = []; + const cash = []; req.legal.map((item) => { item.type = 1; item.only = item.product_id; @@ -296,6 +283,7 @@ export default class exchangeAdd extends React.Component { item = omit(item, ['code_batch_id']); } newData.push(item); + legal.push(item); }); /* 立减金 */ @@ -329,6 +317,7 @@ export default class exchangeAdd extends React.Component { data = omit(data, exclude); } newData.push(data); + reduce.push(data.origin); }); /* 红包 */ @@ -349,7 +338,9 @@ export default class exchangeAdd extends React.Component { 'total_stock', 'use_stock', 'stock', - 'goods_id' + 'goods_id', + 'update_time', + 'delete_time' ]); data = omit(data, ['product_id']); } @@ -362,7 +353,13 @@ export default class exchangeAdd extends React.Component { data = omit(data, exclude); } newData.push(data); + cash.push(data.origin); }); + + /* 暂存到本地 */ + sessionStorage.setItem('productData', JSON.stringify(legal)); + sessionStorage.setItem('knockGoldData', JSON.stringify(reduce)); + sessionStorage.setItem('redPacketsData', JSON.stringify(cash)); return newData; } @@ -803,9 +800,7 @@ export default class exchangeAdd extends React.Component { /* 处理商品 */ if (this.state.addIsType === 'addProduct') { data = JSON.parse(sessionStorage.getItem('productData')); - concatData = this.state.tempdata.filter((item) => item.type !== 1); - temp = map(data, (item) => { let index = this.state.tempdata.findIndex((o) => { return o.product_id == item.product_id;