Tang 2 years ago
parent
commit
34cf047ce8

+ 17 - 0
src/components/searchBoxNew.vue

@@ -155,6 +155,22 @@
               :value="items.id"
               :value="items.id"
             ></el-option>
             ></el-option>
           </el-select>
           </el-select>
+          <!-- 店铺管理列表 -->
+          <el-select
+            v-else-if="item.scope === 'merList'"
+            v-model="formData[item.prop]"
+            :placeholder="item.placeholder"
+            :size="size"
+            clearable
+            filterable
+          >
+            <el-option
+              v-for="(items, indexs) in merList"
+              :key="indexs"
+              :label="items.merName"
+              :value="items.merId"
+            ></el-option>
+          </el-select>
           <!-- 机构列表 -->
           <!-- 机构列表 -->
           <el-select
           <el-select
             v-else-if="item.scope === 'systemtenantlist'"
             v-else-if="item.scope === 'systemtenantlist'"
@@ -736,6 +752,7 @@ export default {
       "certificate",
       "certificate",
       "systemtenantlist",
       "systemtenantlist",
       "roleList",
       "roleList",
+      "merList",
     ]),
     ]),
     /**
     /**
      * @remarks 过滤选择器列表
      * @remarks 过滤选择器列表

+ 3 - 11
src/fxApi/integral.js

@@ -31,18 +31,10 @@ export default {
             method: 'get',
             method: 'get',
         })
         })
     },
     },
-    //商户恢复密码
-    mallstorerestorePwd(data) {
+    //店铺批量删除
+    mallstorebatchRemove(data) {
         return request({
         return request({
-            url: '/mall/store/restorePwd',
-            method: 'post',
-            data
-        })
-    },
-    //商户修改密码
-    mallstoreupdatePwd(data) {
-        return request({
-            url: '/mall/store/updatePwd',
+            url: '/mall/store/batchRemove',
             method: 'post',
             method: 'post',
             data
             data
         })
         })

+ 8 - 0
src/store/getters.js

@@ -29,6 +29,14 @@ const getters = {
     }
     }
     return state.dict.indexnum
     return state.dict.indexnum
   },
   },
+  merList(state) {
+    if (!state.dict.merList) {
+      api.mallmerchantlist({ status: 1 }).then(res => {
+        state.dict.merList = res.rows
+      })
+    }
+    return state.dict.merList
+  },
   roleList(state) {
   roleList(state) {
     if (!state.dict.roleList) {
     if (!state.dict.roleList) {
       api.obtainRoleList({ status: 1 }).then(res => {
       api.obtainRoleList({ status: 1 }).then(res => {

+ 8 - 1
src/store/modules/dict.js

@@ -31,9 +31,16 @@ const state = {
   beforeList: null,//前培安排过滤
   beforeList: null,//前培安排过滤
   beforeLists: null,//前培安排
   beforeLists: null,//前培安排
   indexnum: null,//模拟
   indexnum: null,//模拟
-  systemtenantlist:null,//机构列表
+  systemtenantlist: null,//机构列表
+  merList: null,//店铺管理列表
 }
 }
 const mutations = {
 const mutations = {
+  //店铺管理列表
+  MERLIST(state) {
+    api.mallmerchantlist({ status: 1 }).then(res => {
+      state.merList = res.rows
+    })
+  },
   //更新角色列表
   //更新角色列表
   EDICROLELIST(state) {
   EDICROLELIST(state) {
     api.obtainRoleList({ status: 1 }).then(res => {
     api.obtainRoleList({ status: 1 }).then(res => {

+ 2 - 2
src/utils/request.js

@@ -7,9 +7,9 @@ import { paramMate } from "@/utils/common";
 
 
 axios.defaults.headers["Content-Type"] = "application/json;charset=utf-8";
 axios.defaults.headers["Content-Type"] = "application/json;charset=utf-8";
 // 创建axios实例
 // 创建axios实例
-// export const baseURL = process.env.VUE_APP_BASE_API
+export const baseURL = process.env.VUE_APP_BASE_API
 // export const baseURL = 'https://ptapi.gdzzkj.net/'
 // export const baseURL = 'https://ptapi.gdzzkj.net/'
-export const baseURL = "http://192.168.1.24:7077/";
+// export const baseURL = "http://192.168.1.24:7077/";
 export const BASE_IMG_URL = process.env.VUE_APP_IMG_API;
 export const BASE_IMG_URL = process.env.VUE_APP_IMG_API;
 const service = axios.create({
 const service = axios.create({
   // axios中请求配置有baseURL选项,表示请求URL公共部分
   // axios中请求配置有baseURL选项,表示请求URL公共部分

+ 1 - 0
src/views/integralManagement/merchantManageMent/dislog.vue

@@ -143,6 +143,7 @@ export default {
           }).then((res) => {
           }).then((res) => {
             this.$message.success("成功");
             this.$message.success("成功");
             this.isShow = false;
             this.isShow = false;
+            this.$store.commit("MERLIST");
             this.$emit("search");
             this.$emit("search");
           });
           });
         } else {
         } else {

+ 4 - 1
src/views/integralManagement/merchantManageMent/index.vue

@@ -115,7 +115,7 @@ export default {
         this.$message.error("请勾选数据");
         this.$message.error("请勾选数据");
         return;
         return;
       }
       }
-      this.$confirm("确定恢复为初始密码吗?", "提示", {
+      this.$confirm("确定批量删除选中的数据吗?", "提示", {
         confirmButtonText: "确定",
         confirmButtonText: "确定",
         cancelButtonText: "取消",
         cancelButtonText: "取消",
         type: "warning",
         type: "warning",
@@ -128,6 +128,7 @@ export default {
             })
             })
             .then(() => {
             .then(() => {
               this.$message.success("批量删除成功");
               this.$message.success("批量删除成功");
+              this.$store.commit("MERLIST");
               this.search(3);
               this.search(3);
             });
             });
         })
         })
@@ -170,6 +171,7 @@ export default {
         .editmallmerchant({ merId: row.merId, status: e })
         .editmallmerchant({ merId: row.merId, status: e })
         .then((res) => {
         .then((res) => {
           this.$message.success("操作成功");
           this.$message.success("操作成功");
+          this.$store.commit("MERLIST");
           row.status = e;
           row.status = e;
         })
         })
         .catch(() => {
         .catch(() => {
@@ -205,6 +207,7 @@ export default {
             .editmallmerchant({ merId: row.merId, status: -1 })
             .editmallmerchant({ merId: row.merId, status: -1 })
             .then((res) => {
             .then((res) => {
               this.$message.success("删除成功");
               this.$message.success("删除成功");
+              this.$store.commit("MERLIST");
               this.search();
               this.search();
             });
             });
         })
         })

+ 150 - 0
src/views/integralManagement/storeManageMent/dislog.vue

@@ -0,0 +1,150 @@
+<template>
+  <div>
+    <BaseDialog
+      width="580px"
+      :isShow.sync="isShow"
+      :title="storeId ? '编辑店铺' : '添加店铺'"
+      @submit="submitForm"
+      @close="close"
+    >
+      <el-form
+        :model="formData"
+        :rules="rules"
+        ref="formData"
+        label-width="100px"
+        class="demo-ruleForm"
+      >
+        <el-form-item label="合作商户:" prop="merId">
+          <el-select
+            v-model="formData.merId"
+            placeholder="请选择合作商户"
+            clearable
+            filterable
+          >
+            <el-option
+              v-for="(items, indexs) in merList"
+              :key="indexs"
+              :label="items.merName"
+              :value="items.merId"
+            ></el-option>
+          </el-select>
+        </el-form-item>
+        <el-form-item label="店铺简称:" prop="storeName">
+          <el-input
+            clearable
+            v-model="formData.storeName"
+            placeholder="请输入店铺简称"
+          ></el-input>
+        </el-form-item>
+        <el-form-item label="店铺地址:" prop="address">
+          <el-input
+            clearable
+            v-model="formData.address"
+            placeholder="请输入店铺地址"
+          ></el-input>
+        </el-form-item>
+      </el-form>
+      <template slot="slotBtn">
+        <el-button type="success" @click="submitForm(true)">启用</el-button>
+      </template>
+    </BaseDialog>
+  </div>
+</template>
+
+<script>
+import { mapGetters } from "vuex";
+export default {
+  name: "",
+  props: {
+    dialogVisible: {
+      type: Boolean,
+      default: false,
+    },
+    storeId: {
+      type: Number,
+      default: 0,
+    },
+  },
+  data() {
+    return {
+      formData: {
+        merId: "",
+        storeName: "",
+        address: "",
+      },
+      rules: {
+        merId: [
+          { required: true, message: "请选择合作商户", trigger: "change" },
+        ],
+        storeName: [
+          { required: true, message: "请输入店铺简称", trigger: "blur" },
+        ],
+        address: [
+          { required: false, message: "请输入店铺地址", trigger: "blur" },
+        ],
+      },
+    };
+  },
+
+  methods: {
+    init() {
+      if (this.storeId) {
+        this.$api.mallstoredata(this.storeId).then((res) => {
+          this.formData = res.data;
+        });
+      } else {
+        this.formData = {
+          merId: "",
+          storeName: "",
+          address: "",
+        };
+      }
+      console.log(this.merList, "---merList");
+    },
+    close() {
+      this.$refs["formData"].resetFields();
+    },
+    submitForm(status) {
+      this.$refs["formData"].validate((valid) => {
+        if (valid) {
+          this.$api[this.storeId ? "editmallstore" : "addmallstore"]({
+            status: status ? 1 : 0,
+            ...this.formData,
+          }).then((res) => {
+            this.$message.success("成功");
+            this.isShow = false;
+            this.$emit("search");
+          });
+        } else {
+          return false;
+        }
+      });
+    },
+  },
+  computed: {
+    ...mapGetters(["merList"]),
+    isShow: {
+      get() {
+        if (this.dialogVisible) {
+          this.init();
+        }
+        return this.dialogVisible;
+      },
+      set(val) {
+        this.$emit("update:dialogVisible", false);
+      },
+    },
+  },
+};
+</script>
+
+<style lang="scss" scoped>
+.el-input {
+  width: 220px;
+  margin-right: 10px;
+}
+.el-select {
+  width: 220px;
+  margin-right: 10px;
+}
+</style>

+ 215 - 0
src/views/integralManagement/storeManageMent/index.vue

@@ -0,0 +1,215 @@
+<template>
+  <div id="">
+    <search-box-new
+      ref="searchBox"
+      :formData="formData"
+      :formList="formList"
+      @search="search"
+      @init="init"
+    />
+    <table-list
+      rowKey="storeId"
+      ref="tableList"
+      :tableSets="tableSet"
+      :tableData="tableData"
+      :navText="navText"
+      :loading="loading"
+      @addClick="addClick"
+    >
+      <template slot="customize">
+        <el-button type="warning" @click="remove"> 批量删除 </el-button>
+      </template>
+      <template slot="status" slot-scope="props">
+        <el-switch
+          v-model="props.scope.row.status"
+          active-color="#13ce66"
+          inactive-color="#ff4949"
+          :active-value="1"
+          :inactive-value="0"
+          @change="statusChange($event, props.scope.row)"
+        >
+        </el-switch>
+      </template>
+      <template slot="btn" slot-scope="props">
+        <el-button type="text" @click="addClick(props.scope.row)"
+          >编辑</el-button
+        ><el-button type="text" @click="del(props.scope.row)">删除</el-button>
+      </template>
+    </table-list>
+    <pagination
+      :total="total"
+      :pageSize.sync="formData.pageSize"
+      :currentPage.sync="formData.pageNum"
+      @search="search"
+    />
+    <dislog
+      :dialogVisible.sync="dialogVisible"
+      @search="search"
+      :storeId="storeId"
+    ></dislog>
+  </div>
+</template>
+
+<script>
+import dislog from "./dislog.vue";
+import searchBoxNew from "@/components/searchBoxNew";
+import tableList from "@/components/tableList";
+import pagination from "@/components/pagination";
+export default {
+  name: "StoreManageMent",
+  components: { searchBoxNew, tableList, pagination, dislog },
+  data() {
+    return {
+      loading: false,
+      navText: {
+        title: "店铺管理",
+        index: 0,
+        ch: "条",
+        num: true,
+        choice: true,
+        addHide: false,
+        custom: false,
+        openCheckMore: true,
+      },
+      formList: [
+        {
+          prop: "merId",
+          placeholder: "请选择合作商户",
+          scope: "merList",
+        },
+        {
+          prop: "storeName",
+          placeholder: "输入店铺简称",
+        },
+      ],
+      formData: {},
+      tableSet: [
+        {
+          label: "店铺简称",
+          prop: "storeName",
+          hidden: true,
+        },
+        {
+          label: "店铺地址",
+          prop: "address",
+          hidden: true,
+        },
+        {
+          label: "合作商户",
+          prop: "merName",
+          hidden: true,
+        },
+        {
+          label: "启用状态",
+          prop: "status",
+          hidden: true,
+          scope: "solt",
+          soltName: "status",
+        },
+        {
+          label: "创建时间",
+          prop: "createTime",
+          hidden: true,
+          scope: "aTimeList",
+        },
+      ],
+      tableData: [],
+      total: 0,
+      dialogVisible: false,
+      storeId: 0,
+    };
+  },
+  created() {
+    this.search(2);
+  },
+  methods: {
+    remove() {
+      if (this.$refs.tableList.allCheckData.length === 0) {
+        this.$message.error("请勾选数据");
+        return;
+      }
+      this.$confirm("确定批量删除选中的数据吗?", "提示", {
+        confirmButtonText: "确定",
+        cancelButtonText: "取消",
+        type: "warning",
+      })
+        .then(() => {
+          this.$api
+            .mallstorebatchRemove({
+              storeIds: this.$refs.tableList.allCheckData.map((i) => i.storeId),
+              status: -1,
+            })
+            .then(() => {
+              this.$message.success("批量删除成功");
+              this.search(3);
+            });
+        })
+        .catch(() => {});
+    },
+    addClick(data) {
+      this.storeId = data?.storeId || 0;
+      this.dialogVisible = true;
+    },
+    search(v) {
+      this.loading = true;
+      if (v === 2) {
+        this.formData = {
+          pageSize: 10,
+          pageNum: 1,
+          status: "0,1",
+        };
+        this.$nextTick(() => {
+          this.$refs.tableList.clearMoreActive();
+        });
+      }
+      if (v === 3) {
+        this.$nextTick(() => {
+          this.$refs.tableList.clearMoreActive();
+        });
+      }
+      this.$api
+        .mallstorelist(this.formData)
+        .then((res) => {
+          this.tableData = res.rows;
+          this.total = res.total;
+          this.navText.index = res.total;
+        })
+        .finally(() => {
+          this.loading = false;
+        });
+    },
+    statusChange(e, row) {
+      this.$api
+        .editmallstore({ storeId: row.storeId, merId: row.merId, status: e })
+        .then((res) => {
+          this.$message.success("操作成功");
+          row.status = e;
+        })
+        .catch(() => {
+          return (row.status = e ? 0 : 1);
+        });
+    },
+    init() {
+      this.search(2);
+    },
+    del(v) {
+      this.$confirm("确定删除此内容?", "提示", {
+        confirmButtonText: "确定",
+        cancelButtonText: "取消",
+        type: "warning",
+      })
+        .then(() => {
+          this.$api
+            .editmallmerchant({ storeId: row.storeId, status: -1 })
+            .then((res) => {
+              this.$message.success("删除成功");
+              this.search();
+            });
+        })
+        .catch(() => {});
+    },
+  },
+};
+</script>
+
+<style lang="scss" scoped></style>