修复 key批次编辑页面,编辑兑换码批次,编辑商品,点击提交后,会在商品范围中新增一条商品数据

This commit is contained in:
wangsongsole 2022-06-16 17:33:54 +08:00
parent dc6a04b0e9
commit 029f388c3b
4 changed files with 40 additions and 10 deletions

View File

@ -407,11 +407,17 @@ export default class acclist extends React.Component {
setTimeout(() => { setTimeout(() => {
let data = null let data = null
let temp = null let temp = null
let concatData = null
/* 处理商品 */ /* 处理商品 */
if (this.state.addIsType === 'addProduct') { if (this.state.addIsType === 'addProduct') {
data = JSON.parse(sessionStorage.getItem('productData')).filter( data = JSON.parse(sessionStorage.getItem('productData')).filter(
(item) => item.type !== 2 (item) => item.type !== 2
) )
concatData = JSON.parse(
sessionStorage.getItem('knockGoldData')
).filter((item) => item.type !== 1)
temp = _.map(data, (item) => { temp = _.map(data, (item) => {
let index = this.state.tempdata.findIndex((o) => { let index = this.state.tempdata.findIndex((o) => {
return o.product_id == item.product_id return o.product_id == item.product_id
@ -430,6 +436,9 @@ export default class acclist extends React.Component {
data = JSON.parse(sessionStorage.getItem('knockGoldData')).filter( data = JSON.parse(sessionStorage.getItem('knockGoldData')).filter(
(item) => item.type !== 1 (item) => item.type !== 1
) )
concatData = JSON.parse(sessionStorage.getItem('productData')).filter(
(item) => item.type !== 2
)
temp = _.map(data, (item) => { temp = _.map(data, (item) => {
let index = this.state.tempdata.findIndex((o) => { let index = this.state.tempdata.findIndex((o) => {
return o.channel_activity_id === item.channel_activity_id return o.channel_activity_id === item.channel_activity_id
@ -470,8 +479,7 @@ export default class acclist extends React.Component {
return newObj return newObj
}) })
} }
let newArray = temp.concat(this.state.tempdata) let newArray = deWeightThree(temp.concat(concatData), 'only')
newArray = deWeightThree(newArray, 'only')
//select数据 //select数据
let arr = [] let arr = []

View File

@ -688,11 +688,17 @@ export default class exchangedit extends React.Component {
setTimeout(() => { setTimeout(() => {
let data = null let data = null
let temp = null let temp = null
let concatData = null
/* 处理商品 */ /* 处理商品 */
if (this.state.addIsType === 'addProduct') { if (this.state.addIsType === 'addProduct') {
data = JSON.parse(sessionStorage.getItem('productData')).filter( data = JSON.parse(sessionStorage.getItem('productData')).filter(
(item) => item.type !== 2 (item) => item.type !== 2
) )
concatData = JSON.parse(
sessionStorage.getItem('knockGoldData')
).filter((item) => item.type !== 1)
temp = _.map(data, (item) => { temp = _.map(data, (item) => {
let index = this.state.tempdata.findIndex((o) => { let index = this.state.tempdata.findIndex((o) => {
return o.product_id == item.product_id return o.product_id == item.product_id
@ -711,6 +717,11 @@ export default class exchangedit extends React.Component {
data = JSON.parse(sessionStorage.getItem('knockGoldData')).filter( data = JSON.parse(sessionStorage.getItem('knockGoldData')).filter(
(item) => item.type !== 1 (item) => item.type !== 1
) )
concatData = JSON.parse(sessionStorage.getItem('productData')).filter(
(item) => item.type !== 2
)
temp = _.map(data, (item) => { temp = _.map(data, (item) => {
let index = this.state.tempdata.findIndex((o) => { let index = this.state.tempdata.findIndex((o) => {
return o.channel_activity_id === item.channel_activity_id return o.channel_activity_id === item.channel_activity_id
@ -755,9 +766,7 @@ export default class exchangedit extends React.Component {
return newObj return newObj
}) })
} }
let newArray = temp.concat(this.state.tempdata) let newArray = deWeightThree(temp.concat(concatData), 'only')
newArray = deWeightThree(newArray, 'only')
//select数据 //select数据
let arr = [] let arr = []
let rank = [] let rank = []

View File

@ -300,11 +300,16 @@ export default class acclist extends React.Component {
setTimeout(() => { setTimeout(() => {
let data = null let data = null
let temp = null let temp = null
let concatData = null
/* 处理商品 */ /* 处理商品 */
if (this.state.addIsType === 'addProduct') { if (this.state.addIsType === 'addProduct') {
data = JSON.parse(sessionStorage.getItem('productData')).filter( data = JSON.parse(sessionStorage.getItem('productData')).filter(
(item) => item.type !== 2 (item) => item.type !== 2
) )
concatData = JSON.parse(
sessionStorage.getItem('knockGoldData')
).filter((item) => item.type !== 1)
temp = _.map(data, (item) => { temp = _.map(data, (item) => {
let index = this.state.tempdata.findIndex((o) => { let index = this.state.tempdata.findIndex((o) => {
return o.product_id == item.product_id return o.product_id == item.product_id
@ -324,7 +329,9 @@ export default class acclist extends React.Component {
data = JSON.parse(sessionStorage.getItem('knockGoldData')).filter( data = JSON.parse(sessionStorage.getItem('knockGoldData')).filter(
(item) => item.type !== 1 (item) => item.type !== 1
) )
concatData = JSON.parse(sessionStorage.getItem('productData')).filter(
(item) => item.type !== 2
)
temp = _.map(data, (item) => { temp = _.map(data, (item) => {
let index = this.state.tempdata.findIndex((o) => { let index = this.state.tempdata.findIndex((o) => {
return o.channel_activity_id === item.channel_activity_id return o.channel_activity_id === item.channel_activity_id
@ -365,8 +372,7 @@ export default class acclist extends React.Component {
return newObj return newObj
}) })
} }
let newArray = temp.concat(this.state.tempdata) let newArray = deWeightThree(temp.concat(concatData), 'only')
newArray = deWeightThree(newArray, 'only')
//select数据 //select数据
let arr = [] let arr = []

View File

@ -416,11 +416,16 @@ export default class acclist extends React.Component {
setTimeout(() => { setTimeout(() => {
let data = null let data = null
let temp = null let temp = null
let concatData = null
/* 处理商品 */ /* 处理商品 */
if (this.state.addIsType === 'addProduct') { if (this.state.addIsType === 'addProduct') {
data = JSON.parse(sessionStorage.getItem('productData')).filter( data = JSON.parse(sessionStorage.getItem('productData')).filter(
(item) => item.type !== 2 (item) => item.type !== 2
) )
concatData = JSON.parse(
sessionStorage.getItem('knockGoldData')
).filter((item) => item.type !== 1)
temp = _.map(data, (item) => { temp = _.map(data, (item) => {
let index = this.state.tempdata.findIndex((o) => { let index = this.state.tempdata.findIndex((o) => {
return o.product_id == item.product_id return o.product_id == item.product_id
@ -439,6 +444,9 @@ export default class acclist extends React.Component {
data = JSON.parse(sessionStorage.getItem('knockGoldData')).filter( data = JSON.parse(sessionStorage.getItem('knockGoldData')).filter(
(item) => item.type !== 1 (item) => item.type !== 1
) )
concatData = JSON.parse(sessionStorage.getItem('productData')).filter(
(item) => item.type !== 2
)
temp = _.map(data, (item) => { temp = _.map(data, (item) => {
let index = this.state.tempdata.findIndex((o) => { let index = this.state.tempdata.findIndex((o) => {
return o.channel_activity_id === item.channel_activity_id return o.channel_activity_id === item.channel_activity_id
@ -479,8 +487,7 @@ export default class acclist extends React.Component {
return newObj return newObj
}) })
} }
let newArray = temp.concat(this.state.tempdata) let newArray = deWeightThree(temp.concat(concatData), 'only')
newArray = deWeightThree(newArray, 'only')
//select数据 //select数据
let arr = [] let arr = []