|
@@ -17,7 +17,7 @@
|
|
|
@keyup.enter.native="handleQuery"
|
|
|
/>
|
|
|
</el-form-item>
|
|
|
- <el-form-item label="分类" prop="categoryId">
|
|
|
+ <el-form-item label="商品分类" prop="categoryId">
|
|
|
<el-cascader
|
|
|
v-model="queryParams.categoryId"
|
|
|
ref="formCascader"
|
|
@@ -28,6 +28,17 @@
|
|
|
/>
|
|
|
</el-form-item>
|
|
|
|
|
|
+ <el-form-item label="店铺分类" prop="merchantClassifyId">
|
|
|
+ <el-cascader
|
|
|
+ v-model="queryParams.merchantClassifyId"
|
|
|
+ ref="formCascader"
|
|
|
+ placeholder="请选择分类"
|
|
|
+ :props="categorypropsmerchant"
|
|
|
+ style="width: 240px"
|
|
|
+ @change="cascadermerchantChange"
|
|
|
+ />
|
|
|
+ </el-form-item>
|
|
|
+
|
|
|
<el-form-item label="商品状态" prop="spuStatus">
|
|
|
<el-select
|
|
|
v-model="queryParams.spuStatus"
|
|
@@ -54,17 +65,6 @@
|
|
|
</el-select>
|
|
|
</el-form-item>
|
|
|
|
|
|
- <!-- <el-form-item label="商品类型" prop="scope" v-if="shopInfo.scope == 1">
|
|
|
- <el-select
|
|
|
- v-model="queryParams.scope"
|
|
|
- placeholder="请选择商品类型"
|
|
|
- style="width: 240px"
|
|
|
- >
|
|
|
- <el-option label="全部" value=""> </el-option>
|
|
|
- <el-option label="同城秒送" value="3"> </el-option>
|
|
|
- </el-select>
|
|
|
- </el-form-item> -->
|
|
|
-
|
|
|
<el-form-item label="关联活动商品" prop="promotionTag">
|
|
|
<el-select
|
|
|
v-model="queryParams.promotionTag"
|
|
@@ -128,6 +128,9 @@
|
|
|
>
|
|
|
<el-dropdown-item @click.native="handleExport">批量导出</el-dropdown-item>
|
|
|
<el-dropdown-item @click.native="handleDelist">批量下架</el-dropdown-item>
|
|
|
+ <el-dropdown-item @click.native="handleSort"
|
|
|
+ >批量加入店铺分类</el-dropdown-item
|
|
|
+ >
|
|
|
</el-dropdown-menu>
|
|
|
</el-dropdown>
|
|
|
</template>
|
|
@@ -157,6 +160,9 @@
|
|
|
:show-overflow-tooltip="true"
|
|
|
/>
|
|
|
<el-table-column label="分类" align="center" prop="categoryName" />
|
|
|
+
|
|
|
+ <el-table-column label="店铺所属分类" align="center" prop="merchantClassifyName" />
|
|
|
+
|
|
|
<el-table-column label="价格" align="center" width="120">
|
|
|
<template slot-scope="scope">
|
|
|
{{ scope.row.lowestPrice.toFixed(2) }}/{{ scope.row.unit }}
|
|
@@ -541,6 +547,36 @@
|
|
|
<el-button type="primary" @click="bargainSubmit">确 定</el-button>
|
|
|
</span>
|
|
|
</el-dialog>
|
|
|
+
|
|
|
+ <el-dialog
|
|
|
+ title="设置店铺分类"
|
|
|
+ :visible.sync="sortDialog"
|
|
|
+ :before-close="sortDialog == false"
|
|
|
+ :width="200"
|
|
|
+ >
|
|
|
+ <el-form
|
|
|
+ :model="sort"
|
|
|
+ :rules="sortrules"
|
|
|
+ ref="ruleSort"
|
|
|
+ label-width="100px"
|
|
|
+ class="demo-ruleForm"
|
|
|
+ >
|
|
|
+ <el-form-item label="店铺分类" prop="merchantClassifyId">
|
|
|
+ <el-cascader
|
|
|
+ v-model="sort.merchantClassifyId"
|
|
|
+ ref="sortCascader"
|
|
|
+ placeholder="请选择分类"
|
|
|
+ :props="updatemerchange"
|
|
|
+ style="width: 240px"
|
|
|
+ @change="sortChange"
|
|
|
+ />
|
|
|
+ </el-form-item>
|
|
|
+ </el-form>
|
|
|
+ <span slot="footer" class="dialog-footer">
|
|
|
+ <el-button @click="sortDialog = false">取 消</el-button>
|
|
|
+ <el-button type="primary" @click="sortSubmit">确 定</el-button>
|
|
|
+ </span>
|
|
|
+ </el-dialog>
|
|
|
</div>
|
|
|
</template>
|
|
|
|
|
@@ -554,8 +590,9 @@ import {
|
|
|
goodsRemove,
|
|
|
setLowPrice,
|
|
|
cancelLowPrice,
|
|
|
+ batchEditCategory,
|
|
|
} from "@/api/manage/product";
|
|
|
-
|
|
|
+import { getMerchantClassifyList } from "@/api/sort/index.js";
|
|
|
import { promotionList, promotionSku } from "@/api/active/index";
|
|
|
import { getClassificationListPage } from "@/api/common/index";
|
|
|
import lookProduct from "../lookProduct.vue";
|
|
@@ -565,6 +602,10 @@ export default {
|
|
|
name: "product",
|
|
|
data() {
|
|
|
return {
|
|
|
+ sort: {
|
|
|
+ merchantClassifyId: "",
|
|
|
+ },
|
|
|
+ sortDialog: false,
|
|
|
// 遮罩层
|
|
|
bargainVisible: false,
|
|
|
loading: true,
|
|
@@ -596,6 +637,16 @@ export default {
|
|
|
lazy: true,
|
|
|
lazyLoad: this.categoryLazyLoad,
|
|
|
},
|
|
|
+ updatemerchange: {
|
|
|
+ checkStrictly: true,
|
|
|
+ lazy: true,
|
|
|
+ lazyLoad: this.categoryLazyLoadUpdate,
|
|
|
+ },
|
|
|
+ categorypropsmerchant: {
|
|
|
+ checkStrictly: true,
|
|
|
+ lazy: true,
|
|
|
+ lazyLoad: this.categoryLazyLoadmerchant,
|
|
|
+ },
|
|
|
activeShowBtn: true,
|
|
|
multipleSelection: [],
|
|
|
toggle: true,
|
|
@@ -607,6 +658,11 @@ export default {
|
|
|
shopInfo: {},
|
|
|
speList: {},
|
|
|
speRecord: {},
|
|
|
+ sortrules: {
|
|
|
+ merchantClassifyId: [
|
|
|
+ { required: true, message: "店铺所属分类不能为空", trigger: "blur" },
|
|
|
+ ],
|
|
|
+ },
|
|
|
};
|
|
|
},
|
|
|
mounted() {
|
|
@@ -725,7 +781,6 @@ export default {
|
|
|
});
|
|
|
},
|
|
|
eventsChange(val) {
|
|
|
- console.log(val);
|
|
|
this.radioId = val.id;
|
|
|
},
|
|
|
/**
|
|
@@ -791,8 +846,6 @@ export default {
|
|
|
},
|
|
|
|
|
|
submitGg() {
|
|
|
- console.log(this.dataTable);
|
|
|
- console.log(this.dataTable.skuList);
|
|
|
let params = {
|
|
|
spuId: this.skuId,
|
|
|
skuList: this.dataTable.skuList,
|
|
@@ -804,7 +857,6 @@ export default {
|
|
|
this.getList();
|
|
|
}
|
|
|
});
|
|
|
- console.log(params);
|
|
|
},
|
|
|
|
|
|
handRef(type, scope) {
|
|
@@ -821,6 +873,56 @@ export default {
|
|
|
handleSelectionChange(val) {
|
|
|
this.multipleSelection = val;
|
|
|
},
|
|
|
+ sortSubmit() {
|
|
|
+ this.$refs["ruleSort"].validate((valid) => {
|
|
|
+ if (valid) {
|
|
|
+ let ids = [];
|
|
|
+ this.multipleSelection.forEach((e) => {
|
|
|
+ ids.push(e.id);
|
|
|
+ });
|
|
|
+ this.$confirm("是否批量添加店铺分类?", "提示", {
|
|
|
+ confirmButtonText: "确定",
|
|
|
+ cancelButtonText: "取消",
|
|
|
+ type: "warning",
|
|
|
+ })
|
|
|
+ .then(() => {
|
|
|
+ batchEditCategory({
|
|
|
+ ids: ids.toString(),
|
|
|
+ merchantClassifyId: JSON.stringify(this.sort.merchantClassifyId),
|
|
|
+ merchantClassifyName: this.sort.merchantClassifyName,
|
|
|
+ }).then((res) => {
|
|
|
+ if (res.code == 200) {
|
|
|
+ this.$message.success(`操作成功!`);
|
|
|
+ this.getList();
|
|
|
+ this.sortDialog = false;
|
|
|
+ }
|
|
|
+ });
|
|
|
+ })
|
|
|
+ .catch(() => {
|
|
|
+ this.$message({
|
|
|
+ type: "info",
|
|
|
+ message: "已取消操作",
|
|
|
+ });
|
|
|
+ });
|
|
|
+ } else {
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+ });
|
|
|
+ },
|
|
|
+ handleSort() {
|
|
|
+ if (this.multipleSelection.length < 1) {
|
|
|
+ this.$message.error("请选择要添加的商品!");
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ for (let index = 0; index < this.multipleSelection.length; index++) {
|
|
|
+ if (this.multipleSelection[index].saleModel != 1) {
|
|
|
+ this.$message.error("所选商品的销售模式必须为普通商品!");
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ this.sortDialog = true;
|
|
|
+ },
|
|
|
+
|
|
|
handleDelist() {
|
|
|
if (this.multipleSelection.length < 1) {
|
|
|
this.$message.error("请选择要下架的商品!");
|
|
@@ -888,7 +990,6 @@ export default {
|
|
|
);
|
|
|
},
|
|
|
BatchRemove() {
|
|
|
- console.log(this.multipleSelection);
|
|
|
if (this.multipleSelection.length < 1) {
|
|
|
this.$message.error("请选择要删除的商品!");
|
|
|
return;
|
|
@@ -991,14 +1092,11 @@ export default {
|
|
|
this.dataTable = params;
|
|
|
this.dataTable = JSON.parse(JSON.stringify(this.dataTable));
|
|
|
this.unit = record.unit;
|
|
|
- console.log("1321231", this.dataTable);
|
|
|
this.dialogVisible = true;
|
|
|
}
|
|
|
});
|
|
|
},
|
|
|
handleUpdate(record) {
|
|
|
- console.log("1231231", record);
|
|
|
-
|
|
|
if (record.scope == 2) {
|
|
|
this.$message.error("特价商品不能编辑商品,请先取消特价!");
|
|
|
return false;
|
|
@@ -1049,7 +1147,6 @@ export default {
|
|
|
},
|
|
|
categoryLazyLoad(node, resolve) {
|
|
|
let level = node.level;
|
|
|
- console.log(node);
|
|
|
if (!node.data) {
|
|
|
getClassificationListPage({ parentId: 0 }).then((res) => {
|
|
|
//接口
|
|
@@ -1058,7 +1155,6 @@ export default {
|
|
|
label: `${item.className}`,
|
|
|
leaf: level >= 2,
|
|
|
}));
|
|
|
- console.log("111", node);
|
|
|
// 通过调用resolve将子节点数据返回,通知组件数据加载完成
|
|
|
resolve(nodes);
|
|
|
});
|
|
@@ -1088,6 +1184,60 @@ export default {
|
|
|
resolve({});
|
|
|
}
|
|
|
},
|
|
|
+ sortChange(val) {
|
|
|
+ let nodes = this.$refs["sortCascader"].getCheckedNodes();
|
|
|
+ this.sort.merchantClassifyName = nodes[0].label;
|
|
|
+ },
|
|
|
+
|
|
|
+ cascadermerchantChange(val) {
|
|
|
+ if (val.length == 1) {
|
|
|
+ this.queryParams.merchantClassifyId = val[0];
|
|
|
+ } else if (val.length == 2) {
|
|
|
+ this.queryParams.merchantClassifyId = val[1];
|
|
|
+ } else if (val.length == 3) {
|
|
|
+ this.queryParams.merchantClassifyId = val[2];
|
|
|
+ }
|
|
|
+ },
|
|
|
+ categoryLazyLoadUpdate(node, resolve) {
|
|
|
+ this.categoryLazyLoadmerchant(node, resolve, 1);
|
|
|
+ },
|
|
|
+
|
|
|
+ categoryLazyLoadmerchant(node, resolve, sortType) {
|
|
|
+ let params = {
|
|
|
+ classifyType: 1,
|
|
|
+ };
|
|
|
+ if (sortType) {
|
|
|
+ params.isDefault = 1;
|
|
|
+ }
|
|
|
+ let level = node.level;
|
|
|
+ if (!node.data) {
|
|
|
+ getMerchantClassifyList(params).then((res) => {
|
|
|
+ //接口
|
|
|
+ const nodes = Array.from(res.data).map((item, index) => ({
|
|
|
+ value: item.id,
|
|
|
+ label: `${item.classifyName}`,
|
|
|
+ leaf: level >= 2,
|
|
|
+ }));
|
|
|
+ // 通过调用resolve将子节点数据返回,通知组件数据加载完成
|
|
|
+ resolve(nodes);
|
|
|
+ });
|
|
|
+ } else if (level == 1) {
|
|
|
+ getMerchantClassifyList({ parentId: node.data.value, classifyType: 1 }).then(
|
|
|
+ (res) => {
|
|
|
+ const nodes = Array.from(res.data).map((item) => ({
|
|
|
+ value: item.id,
|
|
|
+ label: `${item.classifyName}`,
|
|
|
+ leaf: level >= 2,
|
|
|
+ // level: 2,
|
|
|
+ }));
|
|
|
+ // 通过调用resolve将子节点数据返回,通知组件数据加载完成
|
|
|
+ resolve(nodes);
|
|
|
+ }
|
|
|
+ );
|
|
|
+ } else {
|
|
|
+ resolve({});
|
|
|
+ }
|
|
|
+ },
|
|
|
},
|
|
|
};
|
|
|
</script>
|