|
|
|
@ -1,6 +1,7 @@ |
|
|
|
|
|
|
|
|
|
import _ from 'lodash' |
|
|
|
|
import { debounce, isEmpty } from '@/utils/util' |
|
|
|
|
import { log } from '@/api/market/presale' |
|
|
|
|
|
|
|
|
|
// 默认的sku字段属性
|
|
|
|
|
const defaultColumns = [ |
|
|
|
@ -117,7 +118,7 @@ export default class MultiSpec { |
|
|
|
|
* @param {array} specList 规格列表 |
|
|
|
|
* @param {array} skuList SKU列表 |
|
|
|
|
*/ |
|
|
|
|
constructor() { |
|
|
|
|
constructor () { |
|
|
|
|
this.multiSpecData = { |
|
|
|
|
// 规格列表
|
|
|
|
|
specList: [], |
|
|
|
@ -221,11 +222,28 @@ export default class MultiSpec { |
|
|
|
|
for (const index in newSkuList) { |
|
|
|
|
// 查找符合的旧记录
|
|
|
|
|
let oldSkuItem = {} |
|
|
|
|
if (oldSkuList.length === newSkuList.length) { |
|
|
|
|
/* if (oldSkuList.length === newSkuList.length) { |
|
|
|
|
oldSkuItem = _.cloneDeep(oldSkuList[index]) |
|
|
|
|
} else { |
|
|
|
|
oldSkuItem = oldSkuList.find(item => item.tempId === newSkuList[index].tempId) |
|
|
|
|
} |
|
|
|
|
} */ |
|
|
|
|
|
|
|
|
|
const item = newSkuList[index] |
|
|
|
|
|
|
|
|
|
const specKeys = item.skuKeys.map((x, i) => { |
|
|
|
|
return item[`spec_value_${i}`] |
|
|
|
|
}).join('_') |
|
|
|
|
|
|
|
|
|
oldSkuList.forEach((x, i) => { |
|
|
|
|
const goodsPropsStr = x.goods_props.map(x => { |
|
|
|
|
return x?.value?.name |
|
|
|
|
}).join('_') |
|
|
|
|
console.log(goodsPropsStr) |
|
|
|
|
if (goodsPropsStr === specKeys) { |
|
|
|
|
oldSkuItem = _.cloneDeep(x) |
|
|
|
|
} |
|
|
|
|
}) |
|
|
|
|
|
|
|
|
|
// 写入新纪录
|
|
|
|
|
if (oldSkuItem) { |
|
|
|
|
newSkuList[index] = { |
|
|
|
|