fix(ggmx): 规格明细上下架状态不能为空

This commit is contained in:
woody 2025-07-28 11:40:03 +08:00
parent 1e410fb30e
commit a5d5df1bee
2 changed files with 542 additions and 553 deletions

File diff suppressed because it is too large Load Diff

View File

@ -13,7 +13,7 @@
<template> <template>
<div class="ggmx"> <div class="ggmx">
<div class="tit">{{ '规格明细' }}</div> <div class="tit">{{ '规格明细' }}</div>
<div class="goodsAll" v-for="(item, index) in goodList" :key="index"> <div v-for="(item, index) in goodList" :key="index" class="goodsAll">
<div class="goods_t"> <div class="goods_t">
<div class="goods_tit"> <div class="goods_tit">
<div class="goods_tit_1">{{ item.productName }}</div> <div class="goods_tit_1">{{ item.productName }}</div>
@ -25,13 +25,15 @@
<div class="goods_btm"> <div class="goods_btm">
<el-form label-width="auto"> <el-form label-width="auto">
<el-form-item <el-form-item
:label="child.typeName"
v-for="(child, cindex) in item.specsTypeData" v-for="(child, cindex) in item.specsTypeData"
:key="cindex" :key="cindex"
:label="child.typeName"
> >
<el-checkbox-group v-model="item.checked"> <el-checkbox-group v-model="item.checked">
<el-checkbox <el-checkbox
v-for="(sld, sindex) in child.specsList" v-for="(sld, sindex) in child.specsList"
:key="sld.specsId"
:label="sld.specsId"
@change=" @change="
getCheckBox( getCheckBox(
$event, $event,
@ -41,16 +43,13 @@
item.isGift item.isGift
) )
" "
:key="sld.specsId" >{{ sld.value }}</el-checkbox>
:label="sld.specsId"
>{{ sld.value }}</el-checkbox
>
</el-checkbox-group> </el-checkbox-group>
</el-form-item> </el-form-item>
</el-form> </el-form>
</div> </div>
</div> </div>
<div class="goods_b" v-show="item.allSel"> <div v-show="item.allSel" class="goods_b">
<div class="pl"> <div class="pl">
<el-row type="flex" justify="end" :gutter="20"> <el-row type="flex" justify="end" :gutter="20">
<el-col :span="2"> <el-col :span="2">
@ -58,53 +57,53 @@
</el-col> </el-col>
<el-col :span="2"> <el-col :span="2">
<el-input <el-input
clearable
size="medium"
v-model="item.price" v-model="item.price"
clearable
size="medium"
:placeholder="'产品价格'" :placeholder="'产品价格'"
></el-input> />
</el-col> </el-col>
<el-col :span="2" v-if="specialArea == 31"> <el-col v-if="specialArea == 31" :span="2">
<el-input <el-input
clearable
size="medium"
v-model="item.vipPrice" v-model="item.vipPrice"
clearable
size="medium"
placeholder="会员价" placeholder="会员价"
></el-input> />
</el-col> </el-col>
<el-col :span="2" v-if="specialArea == 31"> <el-col v-if="specialArea == 31" :span="2">
<el-input <el-input
clearable
size="medium"
v-model="item.retailPriced" v-model="item.retailPriced"
clearable
size="medium"
placeholder="零售价" placeholder="零售价"
></el-input> />
</el-col> </el-col>
<el-col :span="2"> <el-col :span="2">
<el-input <el-input
clearable
size="medium"
v-model="item.integral" v-model="item.integral"
clearable
size="medium"
:placeholder="'产品业绩'" :placeholder="'产品业绩'"
></el-input> />
</el-col> </el-col>
<el-col :span="2"> <el-col :span="2">
<el-input <el-input
v-model="item.assAchieve"
clearable clearable
size="medium" size="medium"
v-model="item.assAchieve"
:placeholder="specialArea == 40 ? 'EV' : 'BV'" :placeholder="specialArea == 40 ? 'EV' : 'BV'"
></el-input> />
</el-col> </el-col>
<el-col :span="2"> <el-col :span="2">
<el-select clearable size="medium" v-model="item.sj"> <el-select v-model="item.sj" size="medium">
<el-option <el-option
v-for="item in agreeList" v-for="item in agreeList"
:key="item.val" :key="item.val"
:label="item.text" :label="item.text"
:value="item.val" :value="item.val"
></el-option> />
</el-select> </el-select>
</el-col> </el-col>
<!-- <el-col :span="2"> <!-- <el-col :span="2">
@ -119,8 +118,7 @@
<el-button <el-button
type="primary" type="primary"
@click="plcz(item.productId, item.isGift)" @click="plcz(item.productId, item.isGift)"
>{{ '批量操作' }}</el-button >{{ '批量操作' }}</el-button>
>
</el-col> </el-col>
</el-row> </el-row>
</div> </div>
@ -133,7 +131,7 @@
:row-class-name="tableRowClassName" :row-class-name="tableRowClassName"
@selection-change="handleSelectionChange" @selection-change="handleSelectionChange"
> >
<el-table-column type="selection" width="55"> </el-table-column> <el-table-column type="selection" width="55" />
<el-table-column <el-table-column
align="center" align="center"
width="200" width="200"
@ -151,8 +149,7 @@
align="center" align="center"
prop="productName" prop="productName"
:label="'产品名称'" :label="'产品名称'"
> />
</el-table-column>
<el-table-column <el-table-column
v-for="(ctm, index) in item.titName" v-for="(ctm, index) in item.titName"
:key="index" :key="index"
@ -168,10 +165,8 @@
<div v-show="index == 5">{{ scope.row.value5 }}</div> <div v-show="index == 5">{{ scope.row.value5 }}</div>
</template> </template>
</el-table-column> </el-table-column>
<el-table-column align="center" prop="retailPriceTmp" label="划线价"> <el-table-column align="center" prop="retailPriceTmp" label="划线价" />
</el-table-column> <el-table-column align="center" prop="quantity" label="数量" />
<el-table-column align="center" prop="quantity" label="数量">
</el-table-column>
<el-table-column <el-table-column
align="center" align="center"
prop="productPrice" prop="productPrice"
@ -179,41 +174,41 @@
> >
<template slot-scope="scope"> <template slot-scope="scope">
<el-input <el-input
v-model="scope.row.productPrice"
clearable clearable
size="medium" size="medium"
v-model="scope.row.productPrice"
:placeholder="'请输入'" :placeholder="'请输入'"
></el-input> />
</template> </template>
</el-table-column> </el-table-column>
<el-table-column <el-table-column
align="center"
v-if="specialArea == 31" v-if="specialArea == 31"
align="center"
prop="vipPrice" prop="vipPrice"
label="会员价" label="会员价"
> >
<template slot-scope="scope"> <template slot-scope="scope">
<el-input <el-input
v-model="scope.row.vipPrice"
clearable clearable
size="medium" size="medium"
v-model="scope.row.vipPrice"
:placeholder="'请输入'" :placeholder="'请输入'"
></el-input> />
</template> </template>
</el-table-column> </el-table-column>
<el-table-column <el-table-column
align="center"
v-if="specialArea == 31" v-if="specialArea == 31"
align="center"
prop="retailPrice" prop="retailPrice"
label="零售价" label="零售价"
> >
<template slot-scope="scope"> <template slot-scope="scope">
<el-input <el-input
v-model="scope.row.retailPrice"
clearable clearable
size="medium" size="medium"
v-model="scope.row.retailPrice"
:placeholder="'请输入'" :placeholder="'请输入'"
></el-input> />
</template> </template>
</el-table-column> </el-table-column>
<el-table-column <el-table-column
@ -223,11 +218,11 @@
> >
<template slot-scope="scope"> <template slot-scope="scope">
<el-input <el-input
v-model="scope.row.productAchieve"
clearable clearable
size="medium" size="medium"
v-model="scope.row.productAchieve"
:placeholder="'请输入'" :placeholder="'请输入'"
></el-input> />
</template> </template>
</el-table-column> </el-table-column>
<el-table-column <el-table-column
@ -237,11 +232,11 @@
> >
<template slot-scope="scope"> <template slot-scope="scope">
<el-input <el-input
v-model="scope.row.assAchieve"
clearable clearable
size="medium" size="medium"
v-model="scope.row.assAchieve"
:placeholder="'请输入'" :placeholder="'请输入'"
></el-input> />
</template> </template>
</el-table-column> </el-table-column>
<el-table-column <el-table-column
@ -250,13 +245,13 @@
:label="'上架状态'" :label="'上架状态'"
> >
<template slot-scope="scope"> <template slot-scope="scope">
<el-select clearable size="medium" v-model="scope.row.isPutOn"> <el-select v-model="scope.row.isPutOn" size="medium">
<el-option <el-option
v-for="item in agreeList" v-for="item in agreeList"
:key="item.val" :key="item.val"
:label="item.text" :label="item.text"
:value="item.val" :value="item.val"
></el-option> />
</el-select> </el-select>
</template> </template>
</el-table-column> </el-table-column>
@ -287,70 +282,70 @@
</template> </template>
<script> <script>
import { getProductSpecsIsGift } from "@/api/product.js"; import { getProductSpecsIsGift } from '@/api/product.js'
// import SkuForm from 'vue-sku-form' // import SkuForm from 'vue-sku-form'
import { mapGetters } from "vuex"; import { mapGetters } from 'vuex'
import ImageUpload from "@/components/ImageUpload"; import ImageUpload from '@/components/ImageUpload'
export default { export default {
name: "ggmx", name: 'Ggmx',
components: { components: {
// SkuForm, // SkuForm,
ImageUpload, ImageUpload
}, },
computed: { computed: {
...mapGetters(["productIds"]), ...mapGetters(['productIds'])
}, },
watch: { watch: {
goodList: { goodList: {
handler(newVal, oldVal) { handler(newVal, oldVal) {
// console.log('%c [ newVal ]-193', 'font-size:13px; background:#55e8eb; color:#99ffff;', newVal) // console.log('%c [ newVal ]-193', 'font-size:13px; background:#55e8eb; color:#99ffff;', newVal)
this.$emit("getGoodList", newVal, this.copyArr); this.$emit('getGoodList', newVal, this.copyArr)
// this.fixThing() // this.fixThing()
}, },
deep: true, // deep: true //
}, }
}, },
data() { data() {
return { return {
uploadUrl: process.env.VUE_APP_BASE_API + "/manage/upload", // uploadUrl: process.env.VUE_APP_BASE_API + '/manage/upload', //
agreeList: [ agreeList: [
{ {
text: '允许', text: '允许',
val: 0, val: 0
}, },
{ {
text: '禁止', text: '禁止',
val: 1, val: 1
}, }
], ],
form: { form: {
specsList: [], specsList: [],
price: "", price: '',
productAchieve: "", productAchieve: '',
sj: "", sj: '',
xs: "", xs: '',
integral: "", integral: '',
assAchieve: "", assAchieve: ''
}, },
// //
selCheckList: [], selCheckList: [],
// productIds: [], // productIds: [],
goodList: [ goodList: [
{ {
checked: [], checked: []
}, }
], ],
allData: [], allData: [],
copyArr: [], copyArr: [],
specialArea: "", specialArea: ''
}; }
}, },
mounted() { mounted() {
// this.getData() // this.getData()
}, },
methods: { methods: {
getSpecial(val) { getSpecial(val) {
this.specialArea = val; this.specialArea = val
}, },
// getInput() { // getInput() {
// console.log( // console.log(
@ -381,10 +376,10 @@ export default {
if (check) { if (check) {
this.allData.forEach((aTem) => { this.allData.forEach((aTem) => {
if (aTem.productId == goodsId && aTem.isGift == isGift) { if (aTem.productId == goodsId && aTem.isGift == isGift) {
aTem.titName = []; aTem.titName = []
aTem.selList.forEach((sTem, sIex) => { aTem.selList.forEach((sTem, sIex) => {
if (sTem.selData.indexOf(sTem.typeName) == -1) { if (sTem.selData.indexOf(sTem.typeName) == -1) {
aTem.titName.push(sTem.typeName); aTem.titName.push(sTem.typeName)
} }
if (sTem.pkId == pkId && sTem.selData.indexOf(sld) == -1) { if (sTem.pkId == pkId && sTem.selData.indexOf(sld) == -1) {
sTem.selData.push( sTem.selData.push(
@ -395,16 +390,16 @@ export default {
productCover: aTem.productCover, productCover: aTem.productCover,
productId: aTem.productId, productId: aTem.productId,
isGift: aTem.isGift, isGift: aTem.isGift,
productName: aTem.productName, productName: aTem.productName
}, },
{ typeName: sTem.typeName, pkId: sTem.pkId }, { typeName: sTem.typeName, pkId: sTem.pkId },
sld sld
) )
); )
} }
}); })
} }
}); })
} else { } else {
this.allData.forEach((aTem) => { this.allData.forEach((aTem) => {
if (aTem.productId == goodsId && aTem.isGift == isGift) { if (aTem.productId == goodsId && aTem.isGift == isGift) {
@ -415,11 +410,11 @@ export default {
(sstem) => sstem.specsId === sld.specsId (sstem) => sstem.specsId === sld.specsId
), ),
1 1
); )
} }
}); })
} }
}); })
} }
// this.allData // this.allData
// console.log( // console.log(
@ -428,190 +423,191 @@ export default {
// this.allData // this.allData
// ) // )
this.pushArr(goodsId, isGift); this.pushArr(goodsId, isGift)
}, },
// //
pushArr(goodsId, isGift) { pushArr(goodsId, isGift) {
this.allData.forEach((aTem) => { this.allData.forEach((aTem) => {
if (aTem.productId == goodsId && aTem.isGift == isGift) { if (aTem.productId == goodsId && aTem.isGift == isGift) {
aTem.checkList = []; aTem.checkList = []
aTem.selList.forEach((sTem, sIex) => { aTem.selList.forEach((sTem, sIex) => {
aTem.checkList.push(sTem.selData); aTem.checkList.push(sTem.selData)
}); })
} }
}); })
this.runFunc(goodsId, isGift); this.runFunc(goodsId, isGift)
}, },
// //
runFunc(goodsId, isGift) { runFunc(goodsId, isGift) {
this.allData.forEach((aTem) => { this.allData.forEach((aTem) => {
if (aTem.productId == goodsId && aTem.isGift == isGift) { if (aTem.productId == goodsId && aTem.isGift == isGift) {
aTem.checkList = this.calcDescartes(aTem.checkList); aTem.checkList = this.calcDescartes(aTem.checkList)
} }
}); })
this.goodList.forEach((item) => { this.goodList.forEach((item) => {
if (item.productId == goodsId && item.isGift == isGift) { if (item.productId == goodsId && item.isGift == isGift) {
item.checkList = []; item.checkList = []
this.allData.forEach((aTem) => { this.allData.forEach((aTem) => {
if (aTem.productId == goodsId && aTem.isGift == isGift) { if (aTem.productId == goodsId && aTem.isGift == isGift) {
aTem.checkList.forEach((cTem) => { aTem.checkList.forEach((cTem) => {
if (item.pkId == aTem.pkid) { if (item.pkId == aTem.pkid) {
item.checkList.push(cTem); item.checkList.push(cTem)
item.titName = aTem.titName; item.titName = aTem.titName
} }
}); })
} }
}); })
} }
}); })
this.goodList.forEach((item, fdex) => { this.goodList.forEach((item, fdex) => {
if (item.productId == goodsId && item.isGift == isGift) { if (item.productId == goodsId && item.isGift == isGift) {
item.showList = []; item.showList = []
item.checkList.forEach((ctem, cdex) => { item.checkList.forEach((ctem, cdex) => {
ctem.assn = {}; ctem.assn = {}
ctem.waresSpecsList = []; ctem.waresSpecsList = []
if (ctem.forEach) { if (ctem.forEach) {
ctem.forEach((cld, index) => { ctem.forEach((cld, index) => {
this.$set( this.$set(
this.goodList[fdex].checkList[cdex], this.goodList[fdex].checkList[cdex],
"productPrice", 'productPrice',
"" ''
); )
this.$set(this.goodList[fdex].checkList[cdex], "vipPrice", ""); this.$set(this.goodList[fdex].checkList[cdex], 'vipPrice', '')
this.$set( this.$set(
this.goodList[fdex].checkList[cdex], this.goodList[fdex].checkList[cdex],
"retailPrice", 'retailPrice',
"" ''
); )
// this.$set(this.goodList[fdex].checkList[cdex], 'code', '') // this.$set(this.goodList[fdex].checkList[cdex], 'code', '')
this.$set(this.goodList[fdex].checkList[cdex], "isPutOn", 0); this.$set(this.goodList[fdex].checkList[cdex], 'isPutOn', 0)
this.$set( this.$set(
this.goodList[fdex].checkList[cdex], this.goodList[fdex].checkList[cdex],
"productAchieve", 'productAchieve',
"" ''
); )
this.$set( this.$set(
this.goodList[fdex].checkList[cdex], this.goodList[fdex].checkList[cdex],
"assAchieve", 'assAchieve',
"" ''
); )
cld.productPrice = ""; cld.productPrice = ''
cld.retailPrice = ""; cld.retailPrice = ''
cld.vipPrice = ""; cld.vipPrice = ''
cld.productAchieve = ""; cld.productAchieve = ''
cld.assAchieve = ""; cld.assAchieve = ''
cld.isPutOn = 0; cld.isPutOn = 0
cld.status = ""; cld.status = ''
cld.pkProduct = cld.productId; cld.pkProduct = cld.productId
cld.quantity = item.quantity; cld.quantity = item.quantity
cld.retailPriceTmp = item.retailPriceTmp; cld.retailPriceTmp = item.retailPriceTmp
cld.isGift = cld.isGift; cld.isGift = cld.isGift
ctem.waresSpecsList.push({ ctem.waresSpecsList.push({
pkSpecs: cld.specsId, pkSpecs: cld.specsId,
pkSpecsType: cld.pkSpecsType, pkSpecsType: cld.pkSpecsType
}); })
if (index == 0) { if (index == 0) {
cld.value0 = cld.value; cld.value0 = cld.value
cld.pkId0 = cld.pkId; cld.pkId0 = cld.pkId
cld.specsId0 = cld.specsId; cld.specsId0 = cld.specsId
cld.typeName0 = cld.typeName; cld.typeName0 = cld.typeName
cld.pkSpecsType0 = cld.pkSpecsType; cld.pkSpecsType0 = cld.pkSpecsType
} }
if (index == 1) { if (index == 1) {
cld.value1 = cld.value; cld.value1 = cld.value
cld.pkId1 = cld.pkId; cld.pkId1 = cld.pkId
cld.specsId1 = cld.specsId; cld.specsId1 = cld.specsId
cld.typeName1 = cld.typeName; cld.typeName1 = cld.typeName
cld.pkSpecsType1 = cld.pkSpecsType; cld.pkSpecsType1 = cld.pkSpecsType
} }
if (index == 2) { if (index == 2) {
cld.value2 = cld.value; cld.value2 = cld.value
cld.pkId2 = cld.pkId; cld.pkId2 = cld.pkId
cld.specsId2 = cld.specsId; cld.specsId2 = cld.specsId
cld.typeName2 = cld.typeName; cld.typeName2 = cld.typeName
cld.pkSpecsType2 = cld.pkSpecsType; cld.pkSpecsType2 = cld.pkSpecsType
} }
if (index == 3) { if (index == 3) {
cld.value3 = cld.value; cld.value3 = cld.value
cld.pkId3 = cld.pkId; cld.pkId3 = cld.pkId
cld.specsId3 = cld.specsId; cld.specsId3 = cld.specsId
cld.typeName3 = cld.typeName; cld.typeName3 = cld.typeName
cld.pkSpecsType3 = cld.pkSpecsType; cld.pkSpecsType3 = cld.pkSpecsType
} }
if (index == 4) { if (index == 4) {
cld.value4 = cld.value; cld.value4 = cld.value
cld.pkId4 = cld.pkId; cld.pkId4 = cld.pkId
cld.specsId4 = cld.specsId; cld.specsId4 = cld.specsId
cld.typeName4 = cld.typeName; cld.typeName4 = cld.typeName
cld.pkSpecsType4 = cld.pkSpecsType; cld.pkSpecsType4 = cld.pkSpecsType
} }
if (index == 5) { if (index == 5) {
cld.value5 = cld.value; cld.value5 = cld.value
cld.pkId5 = cld.pkId; cld.pkId5 = cld.pkId
cld.specsId5 = cld.specsId; cld.specsId5 = cld.specsId
cld.typeName5 = cld.typeName; cld.typeName5 = cld.typeName
cld.pkSpecsType5 = cld.pkSpecsType; cld.pkSpecsType5 = cld.pkSpecsType
} }
item.showList.push( item.showList.push(
Object.assign(ctem.assn, cld, { Object.assign(ctem.assn, cld, {
waresSpecsList: ctem.waresSpecsList, waresSpecsList: ctem.waresSpecsList
}) })
); )
// item.showList[cdex].waresSpecsList.push(cld.waresSpecs) // item.showList[cdex].waresSpecsList.push(cld.waresSpecs)
}); })
} else { } else {
ctem.waresSpecsList = [ ctem.waresSpecsList = [
{ {
pkSpecs: ctem.specsId, pkSpecs: ctem.specsId,
pkSpecsType: ctem.pkSpecsType, pkSpecsType: ctem.pkSpecsType
}, }
]; ]
this.$set( this.$set(
this.goodList[fdex].checkList[cdex], this.goodList[fdex].checkList[cdex],
"productPrice", 'productPrice',
"" ''
); )
this.$set(this.goodList[fdex].checkList[cdex], "retailPrice", ""); this.$set(this.goodList[fdex].checkList[cdex], 'retailPrice', '')
this.$set(this.goodList[fdex].checkList[cdex], "vipPrice", ""); this.$set(this.goodList[fdex].checkList[cdex], 'vipPrice', '')
// this.$set(this.goodList[fdex].checkList[cdex], 'code', '') // this.$set(this.goodList[fdex].checkList[cdex], 'code', '')
this.$set(this.goodList[fdex].checkList[cdex], "isPutOn", 0); this.$set(this.goodList[fdex].checkList[cdex], 'isPutOn', 0)
this.$set(this.goodList[fdex].checkList[cdex], "assAchieve", 0); this.$set(this.goodList[fdex].checkList[cdex], 'assAchieve', 0)
this.$set( this.$set(
this.goodList[fdex].checkList[cdex], this.goodList[fdex].checkList[cdex],
"productAchieve", 'productAchieve',
0 0
); )
// this.$set(this.goodList[index].checkList[cdex], 'productPrice', '') // this.$set(this.goodList[index].checkList[cdex], 'productPrice', '')
// this.$set(this.goodList[index].checkList[cdex], 'productPrice', '') // this.$set(this.goodList[index].checkList[cdex], 'productPrice', '')
// this.$set(item.checkList, ctem.integral, '') // this.$set(item.checkList, ctem.integral, '')
// this.$set(item.checkList, ctem.isPutOn, '') // this.$set(item.checkList, ctem.isPutOn, '')
// this.$set(item.checkList, ctem.status, '') // this.$set(item.checkList, ctem.status, '')
ctem.pkProduct = ctem.productId; ctem.pkProduct = ctem.productId
ctem.quantity = item.quantity; ctem.quantity = item.quantity
ctem.retailPriceTmp = item.retailPriceTmp; ctem.retailPriceTmp = item.retailPriceTmp
ctem.isGift = ctem.isGift; ctem.isGift = ctem.isGift
ctem.value0 = ctem.value; ctem.value0 = ctem.value
ctem.pkId0 = ctem.pkId; ctem.pkId0 = ctem.pkId
ctem.specsId0 = ctem.specsId; ctem.specsId0 = ctem.specsId
ctem.typeName0 = ctem.typeName; ctem.typeName0 = ctem.typeName
ctem.pkSpecsType0 = ctem.pkSpecsType; ctem.pkSpecsType0 = ctem.pkSpecsType
item.showList.push(ctem); item.showList.push(ctem)
} }
}); })
} }
}); })
this.goodList.forEach((item) => { this.goodList.forEach((item) => {
if (item.productId == goodsId && item.isGift == isGift) { if (item.productId == goodsId && item.isGift == isGift) {
item.showList = this.unique(item.showList); item.showList = this.unique(item.showList)
if (item.showList.length > 0 && item.showList[0].pkId0) { if (item.showList.length > 0 && item.showList[0].pkId0) {
item.allSel = true; item.allSel = true
} else { } else {
item.allSel = false; item.allSel = false
} }
} }
}); })
this.goodList.forEach((item) => { this.goodList.forEach((item) => {
item.sj = this.agreeList[0].val
if (item.showList) { if (item.showList) {
item.showList.forEach((cld) => { item.showList.forEach((cld) => {
cld.specsIdList = [ cld.specsIdList = [
@ -620,13 +616,13 @@ export default {
cld.specsId2, cld.specsId2,
cld.specsId3, cld.specsId3,
cld.specsId4, cld.specsId4,
cld.specsId5, cld.specsId5
].filter(Boolean); ].filter(Boolean)
}); })
} }
}); })
this.copyArr = JSON.parse(JSON.stringify(this.allData)); this.copyArr = JSON.parse(JSON.stringify(this.allData))
this.$forceUpdate(); this.$forceUpdate()
}, },
// // // //
// fixThing() { // fixThing() {
@ -648,17 +644,17 @@ export default {
// //
if (arr[i] == arr[j]) { if (arr[i] == arr[j]) {
// //
arr.splice(j, 1); // arr.splice(j, 1) //
j--; j--
} }
} }
} }
return arr; return arr
}, },
calcDescartes(array) { calcDescartes(array) {
// if (array.length < 2) return array[0] || [] // if (array.length < 2) return array[0] || []
return array.reduce((total, currentValue) => { return array.reduce((total, currentValue) => {
let res = []; const res = []
// if (total.length == 0) { // if (total.length == 0) {
// res.push([cv]) // res.push([cv])
// } // }
@ -667,18 +663,17 @@ export default {
currentValue.forEach((cv) => { currentValue.forEach((cv) => {
if (t instanceof Array) if (t instanceof Array)
// 使 Array.isArray(t) // 使 Array.isArray(t)
res.push([...t, cv]); { res.push([...t, cv]) } else res.push([t, cv])
else res.push([t, cv]); })
});
} else { } else {
res.push([t]); res.push([t])
} }
}); })
return res; return res
}); })
}, },
handleSelectionChange(val) { handleSelectionChange(val) {
this.selCheckList = val; this.selCheckList = val
}, },
plcz(productId, isGift) { plcz(productId, isGift) {
this.goodList.forEach((item, index) => { this.goodList.forEach((item, index) => {
@ -692,74 +687,74 @@ export default {
cld.specsIdList.sort().toString() cld.specsIdList.sort().toString()
) { ) {
if (item.price) { if (item.price) {
sld.productPrice = item.price; sld.productPrice = item.price
this.$set( this.$set(
this.goodList[index].showList[sndex], this.goodList[index].showList[sndex],
"productPrice", 'productPrice',
item.price item.price
); )
this.$forceUpdate(); this.$forceUpdate()
} }
if (item.retailPriced) { if (item.retailPriced) {
sld.retailPrice = item.retailPriced; sld.retailPrice = item.retailPriced
this.$set( this.$set(
this.goodList[index].showList[sndex], this.goodList[index].showList[sndex],
"retailPrice", 'retailPrice',
item.retailPriced item.retailPriced
); )
this.$forceUpdate(); this.$forceUpdate()
} }
if (item.vipPrice) { if (item.vipPrice) {
sld.vipPrice = item.vipPrice; sld.vipPrice = item.vipPrice
this.$set( this.$set(
this.goodList[index].showList[sndex], this.goodList[index].showList[sndex],
"vipPrice", 'vipPrice',
item.vipPrice item.vipPrice
); )
this.$forceUpdate(); this.$forceUpdate()
} }
if (item.integral) { if (item.integral) {
sld.productAchieve = item.integral; sld.productAchieve = item.integral
this.$set( this.$set(
this.goodList[index].showList[sndex], this.goodList[index].showList[sndex],
"productAchieve", 'productAchieve',
item.integral item.integral
); )
this.$forceUpdate(); this.$forceUpdate()
} }
if (item.assAchieve) { if (item.assAchieve) {
sld.assAchieve = item.assAchieve; sld.assAchieve = item.assAchieve
this.$set( this.$set(
this.goodList[index].showList[sndex], this.goodList[index].showList[sndex],
"assAchieve", 'assAchieve',
item.assAchieve item.assAchieve
); )
this.$forceUpdate(); this.$forceUpdate()
} }
if (item.productAchieve) { if (item.productAchieve) {
sld.productAchieve = item.productAchieve; sld.productAchieve = item.productAchieve
} }
if (item.sj != "" || item.sj != undefined) { if (item.sj != '' || item.sj != undefined) {
// console.log( // console.log(
// '%c [ item.sj ]-555', // '%c [ item.sj ]-555',
// 'font-size:13px; background:#2d4cc6; color:#7190ff;', // 'font-size:13px; background:#2d4cc6; color:#7190ff;',
// item.sj // item.sj
// ) // )
sld.isPutOn = item.sj; sld.isPutOn = item.sj
this.$set( this.$set(
this.goodList[index].showList[sndex], this.goodList[index].showList[sndex],
"isPutOn", 'isPutOn',
item.sj item.sj
); )
this.$forceUpdate(); this.$forceUpdate()
} }
if (item.xs) { if (item.xs) {
sld.status = item.xs; sld.status = item.xs
} }
// this.$set(this.goodList[index].showList[sndex], isPutOn, item.sj) // this.$set(this.goodList[index].showList[sndex], isPutOn, item.sj)
} }
this.$set(this.goodList[index].showList, sndex, sld); this.$set(this.goodList[index].showList, sndex, sld)
}); })
} }
// if (item.productId == productId) { // if (item.productId == productId) {
// if (item.price != '') { // if (item.price != '') {
@ -775,82 +770,82 @@ export default {
// cld.status = item.xs // cld.status = item.xs
// } // }
// } // }
}); })
}); })
// this.selCheckList // this.selCheckList
// console.log(this.$refs.multipleTable) // console.log(this.$refs.multipleTable)
// this.$set('this','goodList',this.goodList) // this.$set('this','goodList',this.goodList)
this.$forceUpdate(); this.$forceUpdate()
this.$nextTick(() => { this.$nextTick(() => {
for (var i = 0; i < this.$refs.multipleTable.length; i++) { for (var i = 0; i < this.$refs.multipleTable.length; i++) {
this.$refs.multipleTable[i].clearSelection(); this.$refs.multipleTable[i].clearSelection()
} }
}); })
}, },
compareArrays(arr1, arr2) { compareArrays(arr1, arr2) {
if (arr1.length !== arr2.length) { if (arr1.length !== arr2.length) {
return false; return false
} }
for (let i = 0; i < arr1.length; i++) { for (let i = 0; i < arr1.length; i++) {
if (arr1[i] !== arr2[i]) { if (arr1[i] !== arr2[i]) {
return false; return false
} }
} }
return true; return true
}, },
getData(data, specialArea) { getData(data, specialArea) {
this.specialArea = specialArea; this.specialArea = specialArea
if (this.productIds.length > 0) { if (this.productIds.length > 0) {
let a = this.compareArrays(this.productIds, data); const a = this.compareArrays(this.productIds, data)
if (a) { if (a) {
} else { } else {
this.getList(data); this.getList(data)
this.$store.commit("settings/GGMX_SETTING", data); this.$store.commit('settings/GGMX_SETTING', data)
} }
} else { } else {
this.getList(data); this.getList(data)
this.$store.commit("settings/GGMX_SETTING", data); this.$store.commit('settings/GGMX_SETTING', data)
} }
}, },
getList(data) { getList(data) {
getProductSpecsIsGift({ productGiftList: data }).then((res) => { getProductSpecsIsGift({ productGiftList: data }).then((res) => {
let arr = res.data; const arr = res.data
// //
let allData = []; const allData = []
arr.forEach((item, index) => { arr.forEach((item, index) => {
item.checked = []; item.checked = []
allData.push({ allData.push({
productId: item.productId, productId: item.productId,
productCode: item.productCode, productCode: item.productCode,
productCover: item.productCover, productCover: item.productCover,
productName: item.productName, productName: item.productName,
selList: [], selList: [],
isGift: item.isGift, isGift: item.isGift
}); })
item.specsTypeData.forEach((cld) => { item.specsTypeData.forEach((cld) => {
allData[index].selList.push({ allData[index].selList.push({
pkId: cld.pkId, pkId: cld.pkId,
typeName: cld.typeName, typeName: cld.typeName,
selData: [], selData: []
}); })
}); })
}); })
this.allData = allData; this.allData = allData
this.goodList = arr; this.goodList = arr
}); })
}, },
tableRowClassName({ row, rowIndex }) { tableRowClassName({ row, rowIndex }) {
if (rowIndex % 2 == 1) { if (rowIndex % 2 == 1) {
return "warning-row"; return 'warning-row'
} else if (rowIndex % 2 == 0) { } else if (rowIndex % 2 == 0) {
return "success-row"; return 'success-row'
}
return ''
}
}
} }
return "";
},
},
};
</script> </script>
<style scoped lang="scss"> <style scoped lang="scss">