Browse Source

商品货号

1
mo 3 years ago
parent
commit
7bffc167c5

+ 3 - 0
src/views/businessManager/shopManager/shopOperation.vue

@@ -750,6 +750,9 @@ export default {
               // 判断有没有Id,如果有则删除
               delete tempForm.id;
             }
+            tempForm.sellCount = 0;
+            tempForm.stockCount = 0;
+            tempForm.taxStockCount = 0;
             tempForm.status = "NO"; // 默认上架
             goodsAdd(tempForm).then((res) => {
               this.messageTips("保存", res);

+ 208 - 0
src/views/liveClassManager/blackList.vue

@@ -0,0 +1,208 @@
+<template>
+  <div class="m-container">
+    <h2>
+      <el-page-header @back="onCancel" content="直播详情"></el-page-header>
+    </h2>
+    <save-form
+      :inline="true"
+      :model="searchForm"
+      @submit="search"
+      @reset="onReSet"
+    >
+      <el-form-item>
+        <el-input
+          v-model.trim="searchForm.search"
+          clearable
+          @keyup.enter.native="search"
+          placeholder="商品编号/名称"
+        ></el-input>
+      </el-form-item>
+      <el-form-item prop="status">
+        <el-select
+          v-model.trim="searchForm.status"
+          clearable
+          filterable
+          placeholder="状态"
+        >
+          <el-option label="上架" :value="1"></el-option>
+          <el-option label="下架" :value="0"></el-option>
+        </el-select>
+      </el-form-item>
+      <el-form-item>
+        <el-button native-type="submit" type="primary">搜索</el-button>
+        <el-button native-type="reset" type="danger">重置</el-button>
+      </el-form-item>
+    </save-form>
+  </div>
+</template>
+
+
+
+<script>
+import { addLiveGoodsMapper, addGroupMessageList } from "../api";
+import { getLiveGoodsMapperList } from "@/views/liveShopManger/api";
+import pagination from "@/components/Pagination/index";
+export default {
+  name: "eidtPostMsg",
+  components: { pagination },
+  data() {
+    return {
+      searchForm: {
+        search: "",
+      },
+      tableList: [],
+      organList: [],
+      rules: {
+        // 分页规则
+        limit: 10, // 限制显示条数
+        page: 1, // 当前页
+        total: 0, // 总条数
+        page_size: [10, 20, 40, 50], // 选择限制显示条数
+      },
+      addMuiscVisible: false,
+      multipleSelection: [],
+      chioseIdList: [],
+      isNewPage: false,
+      lookVisible: false,
+      activeRow: { sendFlag: false },
+    };
+  },
+
+  mounted() {},
+  methods: {
+    async getList() {
+      try {
+        const res = await getLiveGoodsMapperList({
+          ...this.searchForm,
+          page: this.rules.page,
+          rows: this.rules.limit,
+          liveId: this.activeRow.roomUid,
+        });
+        this.tableList = res.data.rows;
+        this.rules.total = res.data.total;
+        let idList = this.chioseIdList.map((group) => {
+          return group.id;
+        });
+        this.isNewPage = true;
+        this.$nextTick(() => {
+          this.tableList.forEach((course) => {
+            if (idList.indexOf(course.id) != -1) {
+              this.$refs.multipleSelection.toggleRowSelection(course, true);
+            }
+          });
+          this.isNewPage = false;
+        });
+      } catch (e) {
+        console.log(e);
+      }
+    },
+    search() {
+      this.rules.page = 1;
+      this.getList();
+    },
+    onReSet() {
+      this.searchForm.search = "";
+      this.clearCom();
+      this.search();
+    },
+    async submit() {
+      if (!this.chioseIdList || this.chioseIdList.length <= 0) {
+        this.$message.error("请至少选择一件商品");
+        return;
+      }
+      try {
+        let idList = this.chioseIdList
+          .map((group) => {
+            return group.id;
+          })
+          .join(",");
+        const res = await addLiveGoodsMapper({
+          liveGoodsIds: idList,
+          liveId: this.activeRow.roomUid,
+        });
+        this.$message.success("添加成功");
+        this.$emit("getList");
+        this.onClose();
+      } catch (e) {
+        console.log(e);
+      }
+
+      // 开始  addGroupMessageList
+      /**
+       *
+
+       */
+      console.log(this.chioseIdList);
+    },
+    handleSelectionChange(val) {
+      if (val.length > 0) {
+        this.chioseIdList = this.chioseIdList.concat(val);
+        this.chioseIdList = this.$helpers.lodash.uniqBy(
+          this.chioseIdList,
+          "id"
+        );
+      } else {
+        if (this.isNewPage) return;
+        let idList = this.chioseIdList.map((group) => {
+          return group.id;
+        });
+        this.$nextTick(() => {
+          let tableIdList = [];
+          this.tableList.forEach((group) => {
+            tableIdList.push(group.id);
+            if (idList.indexOf(group.id) != -1) {
+              this.$refs.multipleSelection.toggleRowSelection(group, false);
+            }
+          });
+          this.chioseIdList = this.$helpers.lodash.remove(
+            this.chioseIdList,
+            function (item) {
+              return tableIdList.indexOf(item.id) == -1;
+            }
+          );
+          if (this.chioseIdList.length <= 0) {
+            this.clearCom();
+          }
+        });
+      }
+    },
+    clearCom() {
+      this.chioseIdList = [];
+      this.$refs.multipleSelection.clearSelection();
+    },
+    onTableSelect(rows, row) {
+      let idList = this.chioseIdList.map((group) => {
+        return group.id;
+      });
+      if (idList.indexOf(row.id) != -1) {
+        this.chioseIdList.splice(idList.indexOf(row.id), 1);
+        if (this.chioseIdList.length <= 0) {
+          this.clearCom();
+        }
+      }
+    },
+    onClose() {
+      this.clearCom();
+      this.lookVisible = false;
+    },
+    openDioag(row) {
+      this.activeRow = row;
+      this.lookVisible = true;
+      console.log(row);
+      this.getList();
+    },
+    onCancel() {
+      this.$router.push("/liveClassManager");
+      this.$store.dispatch("delVisitedViews", this.$route);
+    },
+  },
+};
+</script>
+<style lang="scss" scoped>
+.w100 {
+  width: 100%;
+}
+.btnWrap {
+  justify-content: flex-start;
+}
+</style>

+ 29 - 26
src/views/liveClassManager/index.vue

@@ -148,10 +148,7 @@
                   >直播详情</el-button
                 >
                 <auth auths="liveGoodsMapper/page">
-                  <el-button
-                    type="text"
-
-                    @click="setShop(scope.row)"
+                  <el-button type="text" @click="setShop(scope.row)"
                     >商品设置</el-button
                   >
                 </auth>
@@ -200,6 +197,7 @@
     >
       <shareDetail @close="shareVisible = false" :row="activeRow" />
     </el-dialog>
+    <popularizeRoom @getList="getList"  ref='popularizeRoom' />
   </div>
 </template>
 
@@ -210,6 +208,7 @@ import { getTimes } from "@/utils";
 import pagination from "@/components/Pagination/index";
 import shareDetail from "./modals/shareDetail.vue";
 import load from "@/utils/loading";
+import popularizeRoom from './modals/popularizeRoom.vue'
 import {
   getLiveBroadcastList,
   delLiveBroadcast,
@@ -217,7 +216,7 @@ import {
   opsPopularize,
 } from "./api";
 export default {
-  components: { pagination, shareDetail },
+  components: { pagination, shareDetail,popularizeRoom },
   data() {
     return {
       searchForm: {
@@ -338,33 +337,37 @@ export default {
       if (row.popularize) {
         popularize = 0;
         str = "取消推广";
+        this.$confirm(`您是否${str}直播间"${row.roomTitle}"`, "提示", {
+          confirmButtonText: "确定",
+          cancelButtonText: "取消",
+          type: "warning",
+        })
+          .then(async () => {
+            try {
+              const res = await opsPopularize({
+                popularize,
+                id: row.id,
+              });
+              this.$message.success(`${str}成功`);
+              this.getList();
+            } catch (e) {
+              console.log(e);
+            }
+          })
+          .catch(() => {});
       } else {
         popularize = 1;
         str = "推广";
+        this.$refs.popularizeRoom.openDioag(row)
       }
-      this.$confirm(`您是否${str}直播间"${row.roomTitle}"`, "提示", {
-        confirmButtonText: "确定",
-        cancelButtonText: "取消",
-        type: "warning",
-      })
-        .then(async () => {
-          try {
-            const res = await opsPopularize({
-              popularize,
-              id: row.id,
-            });
-            this.$message.success(`${str}成功`);
-            this.getList();
-          } catch (e) {
-            console.log(e);
-          }
-        })
-        .catch(() => {});
     },
-    setShop(row){
-      this.$router.push({path:'/business/liveShopControl',query:{roomUid:row.roomUid}})
+    setShop(row) {
+      this.$router.push({
+        path: "/business/liveShopControl",
+        query: { roomUid: row.roomUid },
+      });
       //
-    }
+    },
   },
 };
 </script>

+ 154 - 0
src/views/liveClassManager/modals/popularizeRoom.vue

@@ -0,0 +1,154 @@
+<template>
+  <div>
+    <el-dialog
+      width="600px"
+      title="首页推广"
+      :visible.sync="lookVisible"
+      :before-close="onClose"
+      append-to-body
+    >
+      <el-form :model="form" label-width="80px" ref="form">
+        <el-form-item
+          label="推广类型"
+          prop="type"
+          :rules="[{ required: true, message: '请选择分部' }]"
+        >
+          <el-radio-group v-model="form.type" @change="changeType">
+            <el-radio label="all">全员</el-radio>
+            <el-radio label="organ">分部</el-radio>
+            <el-radio label="school">合作单位</el-radio>
+          </el-radio-group>
+        </el-form-item>
+        <el-form-item
+          v-if="form.type == 'school' || form.type == 'organ'"
+          label="分部"
+          prop="organId"
+          :rules="[{ required: true, message: '请选择分部' }]"
+        >
+          <select-all
+            v-model.trim="form.organId"
+            filterable
+            clearable
+            placeholder="请选择分部"
+            @change="changeSection"
+          >
+            <el-option
+              v-for="(item, index) in selects.branchs"
+              :key="index"
+              :label="item.name"
+              :value="item.id"
+            ></el-option>
+          </select-all>
+        </el-form-item>
+
+        <el-form-item
+          v-if="form.type == 'school'"
+          label="合作单位"
+          prop="school"
+          :rules="[{ required: true, message: '请选择合作单位' }]"
+        >
+          <select-all
+            v-model.trim="form.school"
+            :disabled="form.organId.length <= 0"
+            filterable
+            clearable
+            multiple
+          >
+            <el-option
+              v-for="(item, index) in cooperationList"
+              :key="index"
+              :label="item.name"
+              :value="item.id"
+            ></el-option>
+          </select-all>
+        </el-form-item>
+      </el-form>
+      <div slot="footer" class="dialog-footer">
+        <el-button type="primary" @click="submit">确 定</el-button>
+        <el-button type="primary" @click="onClose">取 消</el-button>
+      </div>
+    </el-dialog>
+  </div>
+</template>
+<script>
+import { addLiveGoodsMapper, addGroupMessageList } from "../api";
+import { queryByOrganId } from "@/api/systemManage";
+export default {
+  name: "eidtPostMsg",
+
+  data() {
+    return {
+      organList: [],
+      cooperationList: [],
+      rules: {
+        // 分页规则
+        limit: 10, // 限制显示条数
+        page: 1, // 当前页
+        total: 0, // 总条数
+        page_size: [10, 20, 40, 50], // 选择限制显示条数
+      },
+      form: {
+        type: "",
+        organId: [],
+        school: [],
+      },
+      lookVisible: false,
+    };
+  },
+
+  mounted() {
+    this.$store.dispatch("setBranchs");
+  },
+  methods: {
+    async submit() {
+      try {
+        this.$emit("getList");
+        this.onClose();
+      } catch (e) {
+        console.log(e);
+      }
+
+      // 开始  addGroupMessageList
+      /**
+       *
+
+       */
+      console.log(this.chioseIdList);
+    },
+    onClose() {
+      this.lookVisible = false;
+    },
+    openDioag(row) {
+      this.activeRow = row;
+      this.lookVisible = true;
+    },
+    changeType() {
+      this.$set(this.form, "organId", []);
+      this.$set(this.form, "school", []);
+    },
+    async changeSection(val) {
+      this.form.school = "";
+      if (this.form.type == "school" && val && val.length > 0) {
+        let organId = val.join(",");
+        try {
+          await queryByOrganId({ organId }).then((res) => {
+            if (res.code == 200) {
+              this.cooperationList = res.data;
+            }
+          });
+        } catch (e) {
+          console.log(e);
+        }
+      }
+    },
+  },
+};
+</script>
+<style lang="scss" scoped>
+.w100 {
+  width: 100%;
+}
+.btnWrap {
+  justify-content: flex-start;
+}
+</style>