|
|
@@ -1,27 +1,28 @@
|
|
|
<template>
|
|
|
- <el-card shadow="never" style="min-height: 500px;">
|
|
|
- <el-tabs tab-position="left" style="height: 400px;" v-model="tabValue" @tab-click="handleClick">
|
|
|
+ <el-card shadow="never" style="min-height: 450px; max-height: 450px; overflow: auto;">
|
|
|
+ <el-tabs tab-position="left" style="height: 100%; overflow: auto;" v-model="tabValue" @tab-click="handleClick">
|
|
|
<el-tab-pane v-for="(item,index) in tabData" :label="item.label" :name="item.value">
|
|
|
</el-tab-pane>
|
|
|
- <el-form ref="form" :model="form" label-width="0" stripe>
|
|
|
- <el-form-item>
|
|
|
-
|
|
|
- <el-table :data="tableData" style="width: 100%" border :ref="'multipleTable_' + tabValue" stripe
|
|
|
- @selection-change="handleSelectionChange">
|
|
|
- <el-table-column type="selection" width="55">
|
|
|
- </el-table-column>
|
|
|
- <el-table-column prop="name" label="规格" align="center">
|
|
|
- </el-table-column>
|
|
|
- </el-table>
|
|
|
-
|
|
|
- </el-form-item>
|
|
|
- <el-form-item style="padding-top: 20px;">
|
|
|
- <el-button type="primary" @click="onSubmit">立即创建</el-button>
|
|
|
- <el-button>取消</el-button>
|
|
|
- </el-form-item>
|
|
|
- </el-form>
|
|
|
+ <el-table :data="tableData" style="width: 100%" border :ref="'multipleTable_' + tabValue" stripe
|
|
|
+ @selection-change="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}">
|
|
|
+ <span>{{options[row.box_id]}}</span>
|
|
|
+ </template>
|
|
|
+ </el-table-column>
|
|
|
+ <el-table-column prop="price" label="发货价" align="center" ></el-table-column>
|
|
|
+
|
|
|
+ </el-table>
|
|
|
</el-tabs>
|
|
|
</el-card>
|
|
|
+ <div style="width: 100%;display: flex; align-items: center; justify-content: center; position: fixed; bottom: 6px;">
|
|
|
+ <el-button type="primary" @click="onSubmit">立即创建</el-button>
|
|
|
+ <el-button>取消</el-button>
|
|
|
+ </div>
|
|
|
</template>
|
|
|
<script>
|
|
|
import table from "@components/Table.js";
|
|
|
@@ -39,7 +40,7 @@
|
|
|
form: {
|
|
|
nameValue: null,
|
|
|
},
|
|
|
- options: Object.entries(Yunqi.data.packingList).map(([value, label]) => ({ label, value: value.toString() })),//品种
|
|
|
+ options: Yunqi.data.packingList,//品种
|
|
|
tabValue: Object.entries(Yunqi.data.typeList).map(([value, label]) => ({ label, value }))[0].value, //选中的品种 获取到品种数据后要给他默认赋值第一个
|
|
|
|
|
|
chooseSpec: [], // 当前分类选中的规格
|
|
|
@@ -49,14 +50,17 @@
|
|
|
},
|
|
|
methods: {
|
|
|
onSubmit() {
|
|
|
-
|
|
|
+
|
|
|
if (this.allData == "") return;
|
|
|
let arr = Object.values(this.allData).flat(Infinity)
|
|
|
-
|
|
|
+
|
|
|
Yunqi.ajax.post('shop/shop_list/specs', { ids: Yunqi.data.ids, all_data: arr }, false, false, true).then(res => {
|
|
|
if (res.code == 200) {
|
|
|
this.$message.success(__('设置成功'));
|
|
|
- Yunqi.api.closelayer(Yunqi.app.window.id, true);
|
|
|
+ //倒计时刷新窗口
|
|
|
+ setTimeout(() => {
|
|
|
+ Yunqi.api.closelayer(Yunqi.app.window.id, true);
|
|
|
+ }, 1000);
|
|
|
} else {
|
|
|
Yunqi.alert(__('请填写发货价格'), __('温馨提示'), { type: 'error' });
|
|
|
}
|
|
|
@@ -79,7 +83,7 @@
|
|
|
getSpecData() {
|
|
|
|
|
|
//获取规格 ;
|
|
|
- Yunqi.ajax.get('shop/shop_list/get_box', {ids:Yunqi.data.ids, type_id: this.tabValue }, false, false, true).then(res => {
|
|
|
+ Yunqi.ajax.get('shop/shop_list/get_box', { ids: Yunqi.data.ids, type_id: this.tabValue }, false, false, true).then(res => {
|
|
|
//编辑数据
|
|
|
if (res.length > 0) {
|
|
|
for (var key in Object(res)) {
|
|
|
@@ -119,7 +123,7 @@
|
|
|
}
|
|
|
|
|
|
});
|
|
|
-
|
|
|
+
|
|
|
if (matched) {
|
|
|
// this.tableData[index] = { name: 'kam', value: 3, price: '111', type_id: '4', packet: '3' }
|
|
|
if (matched.product_id) {
|
|
|
@@ -151,19 +155,19 @@
|
|
|
|
|
|
},
|
|
|
onLoad: function (query) {
|
|
|
- let row = Yunqi.data.row;
|
|
|
+ let row = Yunqi.data.row;
|
|
|
if (row) {
|
|
|
this.type = 1
|
|
|
const grouped = JSON.parse(row).reduce((acc, item) => {
|
|
|
- const key = item.type_id;
|
|
|
- if (!acc[key]) {
|
|
|
- acc[key] = [];
|
|
|
- }
|
|
|
-
|
|
|
- acc[key].push(item);
|
|
|
- return acc;
|
|
|
- }, {});
|
|
|
- this.allData = JSON.parse(JSON.stringify(grouped))
|
|
|
+ const key = item.type_id;
|
|
|
+ if (!acc[key]) {
|
|
|
+ acc[key] = [];
|
|
|
+ }
|
|
|
+
|
|
|
+ acc[key].push(item);
|
|
|
+ return acc;
|
|
|
+ }, {});
|
|
|
+ this.allData = JSON.parse(JSON.stringify(grouped))
|
|
|
} else {
|
|
|
this.type = 0
|
|
|
}
|