|
@@ -83,7 +83,16 @@
|
|
v-hasPermi="['store:storeProduct:remove']"
|
|
v-hasPermi="['store:storeProduct:remove']"
|
|
>删除</el-button>
|
|
>删除</el-button>
|
|
</el-col>
|
|
</el-col>
|
|
|
|
+ <el-col :span="1.5">
|
|
|
|
+ <el-button
|
|
|
|
+ type="info"
|
|
|
|
+ plain
|
|
|
|
+ icon="el-icon-upload2"
|
|
|
|
+ size="mini"
|
|
|
|
+ @click="handleImport"
|
|
|
|
|
|
|
|
+ >导入</el-button>
|
|
|
|
+ </el-col>
|
|
<el-col :span="1.5">
|
|
<el-col :span="1.5">
|
|
<el-button
|
|
<el-button
|
|
type="warning"
|
|
type="warning"
|
|
@@ -247,7 +256,7 @@
|
|
</div>
|
|
</div>
|
|
</el-form-item>
|
|
</el-form-item>
|
|
</el-col>
|
|
</el-col>
|
|
-
|
|
|
|
|
|
+
|
|
<el-col :span="24" v-if="createBnt">
|
|
<el-col :span="24" v-if="createBnt">
|
|
<el-form-item>
|
|
<el-form-item>
|
|
<el-button type="primary" size="small" icon="md-add" @click="addBtn" class="mr15">添加新规格</el-button>
|
|
<el-button type="primary" size="small" icon="md-add" @click="addBtn" class="mr15">添加新规格</el-button>
|
|
@@ -275,7 +284,7 @@
|
|
<!-- 多规格表格-->
|
|
<!-- 多规格表格-->
|
|
<el-col :span="24">
|
|
<el-col :span="24">
|
|
<el-form-item label="商品属性:" class="labeltop">
|
|
<el-form-item label="商品属性:" class="labeltop">
|
|
-
|
|
|
|
|
|
+
|
|
<el-table :data="manyFormValidate" size="small" style="width: 90%;">
|
|
<el-table :data="manyFormValidate" size="small" style="width: 90%;">
|
|
<el-table-column type="myindex" v-for="(item,index) in form.header" :key="index" :width="item.minWidth" :label="item.title" :property="item.slot" align="center">
|
|
<el-table-column type="myindex" v-for="(item,index) in form.header" :key="index" :width="item.minWidth" :label="item.title" :property="item.slot" align="center">
|
|
<template slot-scope="scope">
|
|
<template slot-scope="scope">
|
|
@@ -299,7 +308,7 @@
|
|
</el-col>
|
|
</el-col>
|
|
</el-col>
|
|
</el-col>
|
|
</el-col>
|
|
</el-col>
|
|
-
|
|
|
|
|
|
+
|
|
<!-- 单规格表格-->
|
|
<!-- 单规格表格-->
|
|
<el-col :xl="23" :lg="24" :md="24" :sm="24" :xs="24" v-if="form.specType === 0">
|
|
<el-col :xl="23" :lg="24" :md="24" :sm="24" :xs="24" v-if="form.specType === 0">
|
|
<el-form-item >
|
|
<el-form-item >
|
|
@@ -494,16 +503,44 @@
|
|
<el-button @click="cancel">取 消</el-button>
|
|
<el-button @click="cancel">取 消</el-button>
|
|
</div>
|
|
</div>
|
|
</el-dialog>
|
|
</el-dialog>
|
|
|
|
+ <el-dialog :title="upload.title" :visible.sync="upload.open" width="400px" append-to-body>
|
|
|
|
+ <el-upload
|
|
|
|
+ ref="upload"
|
|
|
|
+ :limit="1"
|
|
|
|
+ accept=".xlsx, .xls"
|
|
|
|
+ :headers="upload.headers"
|
|
|
|
+ :action="upload.url + '?updateSupport=' + upload.updateSupport"
|
|
|
|
+ :disabled="upload.isUploading"
|
|
|
|
+ :on-progress="handleFileUploadProgress"
|
|
|
|
+ :on-success="handleFileSuccess"
|
|
|
|
+ :auto-upload="false"
|
|
|
|
+ drag
|
|
|
|
+ >
|
|
|
|
+ <i class="el-icon-upload"></i>
|
|
|
|
+ <div class="el-upload__text">将文件拖到此处,或<em>点击上传</em></div>
|
|
|
|
+ <div class="el-upload__tip text-center" slot="tip">
|
|
|
|
+ <div class="el-upload__tip" slot="tip">
|
|
|
|
+ <!-- <el-checkbox v-model="upload.updateSupport" /> 是否更新已经存在的数据 -->
|
|
|
|
+ </div>
|
|
|
|
+ <span>仅允许导入xls、xlsx格式文件。</span>
|
|
|
|
+ <el-link type="primary" :underline="false" style="font-size:12px;vertical-align: baseline;" @click="importTemplate">下载模板</el-link>
|
|
|
|
+ </div>
|
|
|
|
+ </el-upload>
|
|
|
|
+ <div slot="footer" class="dialog-footer">
|
|
|
|
+ <el-button type="primary" @click="submitFileForm">确 定</el-button>
|
|
|
|
+ <el-button @click="upload.open = false">取 消</el-button>
|
|
|
|
+ </div>
|
|
|
|
+ </el-dialog>
|
|
|
|
|
|
</div>
|
|
</div>
|
|
</template>
|
|
</template>
|
|
|
|
|
|
<script>
|
|
<script>
|
|
-import {genFormatAttr, listStoreProduct, getStoreProduct, delStoreProduct, addOrEdit, exportStoreProduct } from "@/api/store/storeProduct";
|
|
|
|
|
|
+import {genFormatAttr, listStoreProduct, getStoreProduct, delStoreProduct, addOrEdit, exportStoreProduct,importTemplate } from "@/api/store/storeProduct";
|
|
import { getAllStoreProductCategory } from "@/api/store/storeProductCategory";
|
|
import { getAllStoreProductCategory } from "@/api/store/storeProductCategory";
|
|
import { getAllStoreProductRule } from "@/api/store/storeProductRule";
|
|
import { getAllStoreProductRule } from "@/api/store/storeProductRule";
|
|
import { getAllShippingTemplates } from "@/api/store/shippingTemplates";
|
|
import { getAllShippingTemplates } from "@/api/store/shippingTemplates";
|
|
-
|
|
|
|
|
|
+import { getToken } from "@/utils/auth";
|
|
import Treeselect from "@riophae/vue-treeselect";
|
|
import Treeselect from "@riophae/vue-treeselect";
|
|
import "@riophae/vue-treeselect/dist/vue-treeselect.css";
|
|
import "@riophae/vue-treeselect/dist/vue-treeselect.css";
|
|
import Editor from '@/components/Editor/wang';
|
|
import Editor from '@/components/Editor/wang';
|
|
@@ -527,6 +564,20 @@ export default {
|
|
},
|
|
},
|
|
data() {
|
|
data() {
|
|
return {
|
|
return {
|
|
|
|
+ upload: {
|
|
|
|
+ // 是否显示弹出层
|
|
|
|
+ open: false,
|
|
|
|
+ // 弹出层标题
|
|
|
|
+ title: "",
|
|
|
|
+ // 是否禁用上传
|
|
|
|
+ isUploading: false,
|
|
|
|
+ // 是否更新已经存在的用户数据
|
|
|
|
+ updateSupport: 0,
|
|
|
|
+ // 设置上传的请求头部
|
|
|
|
+ headers: { Authorization: "Bearer " + getToken() },
|
|
|
|
+ // 上传的地址
|
|
|
|
+ url: process.env.VUE_APP_BASE_API + "/store/storeProduct/importData"
|
|
|
|
+ },
|
|
productTuiCateOptions:[],
|
|
productTuiCateOptions:[],
|
|
showIput: false,
|
|
showIput: false,
|
|
createBnt:true,
|
|
createBnt:true,
|
|
@@ -668,6 +719,31 @@ export default {
|
|
this.getList();
|
|
this.getList();
|
|
},
|
|
},
|
|
methods: {
|
|
methods: {
|
|
|
|
+ // 提交上传文件
|
|
|
|
+ submitFileForm() {
|
|
|
|
+ this.$refs.upload.submit();
|
|
|
|
+ },
|
|
|
|
+ // 文件上传中处理
|
|
|
|
+ handleFileUploadProgress(event, file, fileList) {
|
|
|
|
+ this.upload.isUploading = true;
|
|
|
|
+ },
|
|
|
|
+ // 文件上传成功处理
|
|
|
|
+ handleFileSuccess(response, file, fileList) {
|
|
|
|
+ this.upload.open = false;
|
|
|
|
+ this.upload.isUploading = false;
|
|
|
|
+ this.$refs.upload.clearFiles();
|
|
|
|
+ this.$alert(response.msg, "导入结果", { dangerouslyUseHTMLString: true });
|
|
|
|
+ this.getList();
|
|
|
|
+ },
|
|
|
|
+ handleImport() {
|
|
|
|
+ this.upload.title = "商品导入";
|
|
|
|
+ this.upload.open = true;
|
|
|
|
+ },
|
|
|
|
+ importTemplate() {
|
|
|
|
+ importTemplate().then(response => {
|
|
|
|
+ this.download(response.msg);
|
|
|
|
+ });
|
|
|
|
+ },
|
|
// 删除表格中的属性
|
|
// 删除表格中的属性
|
|
delAttrTable (index) {
|
|
delAttrTable (index) {
|
|
this.manyFormValidate.splice(index, 1);
|
|
this.manyFormValidate.splice(index, 1);
|