|
|
@@ -8,31 +8,23 @@
|
|
|
</el-tab-pane>
|
|
|
|
|
|
<el-table :data="tableData" style="width: 100%" border :ref="'multipleTable_' + tabValue" stripe
|
|
|
- @select="handleSelectionChange" @select-all="handleAllSelect">
|
|
|
+ @select="handleSelectionChange">
|
|
|
<el-table-column type="selection" width="55">
|
|
|
</el-table-column>
|
|
|
<el-table-column prop="name" label="规格" align="center">
|
|
|
</el-table-column>
|
|
|
<el-table-column prop="packet" label="包装箱" align="center">
|
|
|
<template #default="{row}">
|
|
|
- <el-select v-model="row.packet" placeholder="请选择" @change="changePacket($event, row)">
|
|
|
+ <el-select v-model="row.packet" placeholder="请选择">
|
|
|
<el-option v-for="item in options" :key="item.value" :label="item.label"
|
|
|
:value="item.value">
|
|
|
</el-option>
|
|
|
</el-select>
|
|
|
</template>
|
|
|
</el-table-column>
|
|
|
- <el-table-column prop="fast_mail" label="快递" align="center">
|
|
|
- <template #default="{row}">
|
|
|
- <el-select v-model="row.fast_mail" placeholder="请选择" @change="changeLogi($event, row)">
|
|
|
- <el-option v-for="item in logiOptions" :key="item" :label="item" :value="item">
|
|
|
- </el-option>
|
|
|
- </el-select>
|
|
|
- </template>
|
|
|
- </el-table-column>
|
|
|
<el-table-column prop="price" label="发货价" align="center">
|
|
|
<template #default="{row}">
|
|
|
- <el-input v-model="row.price" @input="changePrice($event, row)"></el-input>
|
|
|
+ <el-input v-model="row.price"></el-input>
|
|
|
</template>
|
|
|
</el-table-column>
|
|
|
</el-table>
|
|
|
@@ -61,7 +53,7 @@
|
|
|
},
|
|
|
options: Object.entries(Yunqi.data.packingList).map(([value, label]) => ({ label, value: value.toString() })),//品种
|
|
|
tabValue: Object.entries(Yunqi.data.typeList).map(([value, label]) => ({ label, value }))[0].value, //选中的品种 获取到品种数据后要给他默认赋值第一个
|
|
|
- logiOptions: Yunqi.data.fastmailList,
|
|
|
+
|
|
|
chooseSpec: [], // 当前分类选中的规格
|
|
|
|
|
|
allData: {},
|
|
|
@@ -92,9 +84,6 @@
|
|
|
this.allData[this.tabValue] = e || []
|
|
|
// }
|
|
|
},
|
|
|
- handleAllSelect(e){
|
|
|
- this.allData[this.tabValue] = e || []
|
|
|
- },
|
|
|
handleClick(data, row) {
|
|
|
// 品种切换事件 可以在这里请求规格接口
|
|
|
|
|
|
@@ -117,14 +106,12 @@
|
|
|
if (index != -1) {
|
|
|
this.tableData.splice(index, 1)
|
|
|
} else {
|
|
|
- this.tableData.push({ name: res[key]['name'], value: res[key]['id'], price: res[key]['price'], type_id: this.tabValue, fast_mail: res[key]['fast_mail'] });
|
|
|
-
|
|
|
+ this.tableData.push({ name: res[key]['title'], value: res[key]['id'], price: res[key]['price'], type_id: this.tabValue });
|
|
|
}
|
|
|
}
|
|
|
this.$nextTick(() => {
|
|
|
const tableRef = this.$refs['multipleTable_' + this.tabValue];
|
|
|
if (this.type == 0 && this.allData[this.tabValue]?.length > 0 && tableRef) {
|
|
|
- console.log(this.allData[Number(this.tabValue)], this.tableData, "===")
|
|
|
this.tableData.forEach((item, index) => {
|
|
|
const matched = this.allData[this.tabValue].find(row => {
|
|
|
return row.value == item.value
|
|
|
@@ -142,7 +129,6 @@
|
|
|
});
|
|
|
}
|
|
|
else if (this.type == 1 && this.allData[Number(this.tabValue)]) {
|
|
|
- console.log(this.allData[Number(this.tabValue)], this.tableData)
|
|
|
this.tableData.forEach((item, index) => {
|
|
|
const matched = this.allData[Number(this.tabValue)].find(row => {
|
|
|
if (row.product_id) {
|
|
|
@@ -150,13 +136,13 @@
|
|
|
} else {
|
|
|
return row.value == item.value
|
|
|
}
|
|
|
+
|
|
|
});
|
|
|
if (matched) {
|
|
|
// this.tableData[index] = { name: 'kam', value: 3, price: '111', type_id: '4', packet: '3' }
|
|
|
if (matched.product_id) {
|
|
|
this.tableData[index].price = matched.price
|
|
|
this.tableData[index].packet = matched.box_id != 0 ? matched?.box_id.toString() : ""
|
|
|
- this.tableData[index].fast_mail = matched.fast_mail
|
|
|
} else {
|
|
|
this.tableData[index] = matched
|
|
|
}
|
|
|
@@ -179,34 +165,8 @@
|
|
|
});
|
|
|
}
|
|
|
});
|
|
|
- },
|
|
|
- changeLogi(value, row) {
|
|
|
- if (this.allData[this.tabValue].length > 0) {
|
|
|
- this.allData[this.tabValue].forEach((item, index) => {
|
|
|
- if (item.product_id == row.value) {
|
|
|
- this.allData[this.tabValue][index].fast_mail = value
|
|
|
- }
|
|
|
- })
|
|
|
- }
|
|
|
-
|
|
|
- },
|
|
|
- changePacket(value, row) {
|
|
|
- if (this.allData[this.tabValue].length > 0) {
|
|
|
- this.allData[this.tabValue].forEach((item, index) => {
|
|
|
- if (item.product_id == row.value) {
|
|
|
- this.allData[this.tabValue][index].packet = value
|
|
|
- this.allData[this.tabValue][index].box_id = value
|
|
|
- }
|
|
|
- })
|
|
|
- }
|
|
|
- },
|
|
|
- changePrice(value, row) {
|
|
|
- this.allData[this.tabValue].forEach((item, index) => {
|
|
|
- if (item.product_id == row.value) {
|
|
|
- this.allData[this.tabValue][index].price = value
|
|
|
- }
|
|
|
- })
|
|
|
- },
|
|
|
+ }
|
|
|
+
|
|
|
},
|
|
|
onLoad: function (query) {
|
|
|
let row = Yunqi.data.row;
|
|
|
@@ -215,9 +175,7 @@
|
|
|
} else {
|
|
|
this.type = 0
|
|
|
}
|
|
|
- // Yunqi.data.fastmailList 快递 1111
|
|
|
- console.log(Yunqi.data.fastmailList, "快递")
|
|
|
- console.log(row, "-----")
|
|
|
+ console.log(this.type)
|
|
|
const grouped = row.reduce((acc, item) => {
|
|
|
const key = item.type_id;
|
|
|
if (!acc[key]) {
|