Parcourir la source

feat: 设备,货道管理

pangqijun il y a 3 mois
Parent
commit
cc752f22cf

+ 50 - 0
src/api/business/facilitycargoway.js

@@ -0,0 +1,50 @@
+import request from '@/router/axios';
+
+export const getList = (current, size, params) => {
+  return request({
+    url: '/api/facilitycargoway/list',
+    method: 'get',
+    params: {
+      ...params,
+      current,
+      size,
+    }
+  })
+}
+
+export const getDetail = (id) => {
+  return request({
+    url: '/api/facilitycargoway/detail',
+    method: 'get',
+    params: {
+      id
+    }
+  })
+}
+
+export const remove = (ids) => {
+  return request({
+    url: '/api/facilitycargoway/remove',
+    method: 'post',
+    params: {
+      ids,
+    }
+  })
+}
+
+export const add = (row) => {
+  return request({
+    url: '/api/facilitycargoway/submit',
+    method: 'post',
+    data: row
+  })
+}
+
+export const update = (row) => {
+  return request({
+    url: '/api/facilitycargoway/submit',
+    method: 'post',
+    data: row
+  })
+}
+

+ 311 - 0
src/views/business/facilitycargoway.vue

@@ -0,0 +1,311 @@
+<template>
+  <basic-container>
+    <avue-crud :option="option"
+               :table-loading="loading"
+               :data="data"
+               :page.sync="page"
+               :permission="permissionList"
+               :before-open="beforeOpen"
+               v-model="form"
+               ref="crud"
+               @row-update="rowUpdate"
+               @row-save="rowSave"
+               @row-del="rowDel"
+               @search-change="searchChange"
+               @search-reset="searchReset"
+               @selection-change="selectionChange"
+               @current-change="currentChange"
+               @size-change="sizeChange"
+               @refresh-change="refreshChange"
+               @on-load="onLoad">
+      <template slot="menuLeft">
+        <el-button type="danger"
+                   size="small"
+                   icon="el-icon-delete"
+                   plain
+                   v-if="permission.facilitycargoway_delete"
+                   @click="handleDelete">删 除
+        </el-button>
+      </template>
+
+      <template slot="cargoStatus" slot-scope="scope" >
+        <el-tag v-if="scope.row.cargoStatus == '1'" type="success">正常</el-tag>
+        <el-tag v-if="scope.row.cargoStatus == '0'" type="danger">异常</el-tag>
+      </template>
+
+      <template slot="enable" slot-scope="scope" >
+        <el-tag v-if="scope.row.enable == '1'" type="success">开启</el-tag>
+        <el-tag v-if="scope.row.enable == '0'" type="danger">关闭</el-tag>
+      </template>
+    </avue-crud>
+  </basic-container>
+</template>
+
+<script>
+  import {getList, getDetail, add, update, remove} from "@/api/business/facilitycargoway";
+  import {mapGetters} from "vuex";
+
+  export default {
+    props: {
+      facilityId: {
+        type: [String, Number],
+        default: 0
+      }
+    },
+    data() {
+      return {
+        form: {},
+        query: {},
+        loading: true,
+        page: {
+          pageSize: 10,
+          currentPage: 1,
+          total: 0
+        },
+        selectionList: [],
+        option: {
+          calcHeight: 30,
+          tip: false,
+          searchShow: true,
+          searchMenuSpan: 6,
+          border: true,
+          index: false,
+          addBtn: false,
+          viewBtn: true,
+          delBtn: false,
+          editBtn: false,
+          selection: false,
+          dialogClickModal: false,
+          column: [
+            {
+              label: "货道编号",
+              prop: "cargoNo",
+              rules: [{
+                required: true,
+                message: "请输入货道编号",
+                trigger: "blur"
+              }]
+            },
+            {
+              label: "货道容量",
+              prop: "volume",
+              rules: [{
+                required: true,
+                message: "请输入货道容量",
+                trigger: "blur"
+              }]
+            },
+            {
+              label: "货道状态",
+              prop: "cargoStatus",
+              rules: [{
+                required: true,
+                message: "请输入货道状态",
+                trigger: "blur"
+              }]
+            },
+            {
+              label: "货道开启状态",
+              prop: "enable",
+              rules: [{
+                required: true,
+                message: "请输入货道启用状态",
+                trigger: "blur"
+              }]
+            },
+            {
+              label: "商品",
+              prop: "goodsId",
+              type: "select",
+              dicUrl: "/api/mall/goodsinfo/page?isSale=1&current=1&size=9999",
+              dicFormatter: function (res) {
+                return res.data.records;
+              },
+              props: {
+                label: "goodsName",
+                value: "id",
+              },
+            },
+            {
+              label: "售价",
+              prop: "salePrice",
+              rules: [{
+                required: true,
+                message: "请输入售价",
+                trigger: "blur"
+              }]
+            },
+            {
+              label: "折扣",
+              prop: "discount",
+              rules: [{
+                required: true,
+                message: "请输入折扣",
+                trigger: "blur"
+              }]
+            },
+            {
+              label: "商品库存",
+              prop: "goodsStore",
+              rules: [{
+                required: true,
+                message: "请输入商品库存",
+                trigger: "blur"
+              }]
+            },
+            {
+              label: "货道总交易数量",
+              prop: "totalTrade",
+              rules: [{
+                required: true,
+                message: "请输入货道总交易数量",
+                trigger: "blur"
+              }]
+            },
+            {
+              label: "货道总交易金额",
+              prop: "totalAmount",
+              rules: [{
+                required: true,
+                message: "请输入货道总交易金额",
+                trigger: "blur"
+              }]
+            },
+          ]
+        },
+        data: []
+      };
+    },
+    computed: {
+      ...mapGetters(["permission"]),
+      permissionList() {
+
+      },
+      ids() {
+        let ids = [];
+        this.selectionList.forEach(ele => {
+          ids.push(ele.id);
+        });
+        return ids.join(",");
+      }
+    },
+    created() {
+      this.onLoad(this.page)
+    },
+    methods: {
+      rowSave(row, done, loading) {
+        add(row).then(() => {
+          this.onLoad(this.page);
+          this.$message({
+            type: "success",
+            message: "操作成功!"
+          });
+          done();
+        }, error => {
+          loading();
+          window.console.log(error);
+        });
+      },
+      rowUpdate(row, index, done, loading) {
+        update(row).then(() => {
+          this.onLoad(this.page);
+          this.$message({
+            type: "success",
+            message: "操作成功!"
+          });
+          done();
+        }, error => {
+          loading();
+          console.log(error);
+        });
+      },
+      rowDel(row) {
+        this.$confirm("确定将选择数据删除?", {
+          confirmButtonText: "确定",
+          cancelButtonText: "取消",
+          type: "warning"
+        })
+          .then(() => {
+            return remove(row.id);
+          })
+          .then(() => {
+            this.onLoad(this.page);
+            this.$message({
+              type: "success",
+              message: "操作成功!"
+            });
+          });
+      },
+      handleDelete() {
+        if (this.selectionList.length === 0) {
+          this.$message.warning("请选择至少一条数据");
+          return;
+        }
+        this.$confirm("确定将选择数据删除?", {
+          confirmButtonText: "确定",
+          cancelButtonText: "取消",
+          type: "warning"
+        })
+          .then(() => {
+            return remove(this.ids);
+          })
+          .then(() => {
+            this.onLoad(this.page);
+            this.$message({
+              type: "success",
+              message: "操作成功!"
+            });
+            this.$refs.crud.toggleSelection();
+          });
+      },
+      beforeOpen(done, type) {
+        if (["edit", "view"].includes(type)) {
+          getDetail(this.form.id).then(res => {
+            this.form = res.data.data;
+          });
+        }
+        done();
+      },
+      searchReset() {
+        this.query = {};
+        this.onLoad(this.page);
+      },
+      searchChange(params, done) {
+        this.query = params;
+        this.page.currentPage = 1;
+        this.onLoad(this.page, params);
+        done();
+      },
+      selectionChange(list) {
+        this.selectionList = list;
+      },
+      selectionClear() {
+        this.selectionList = [];
+        this.$refs.crud.toggleSelection();
+      },
+      currentChange(currentPage){
+        this.page.currentPage = currentPage;
+      },
+      sizeChange(pageSize){
+        this.page.pageSize = pageSize;
+      },
+      refreshChange() {
+        this.onLoad(this.page, this.query);
+      },
+      onLoad(page, params = {}) {
+        this.loading = true;
+        this.query.facilityId = this.facilityId;
+        getList(page.currentPage, page.pageSize, Object.assign(params, this.query)).then(res => {
+          const data = res.data.data;
+          this.page.total = data.total;
+          this.data = data.records;
+          this.loading = false;
+          this.selectionClear();
+        });
+      }
+    }
+  };
+</script>
+
+<style>
+</style>

+ 297 - 0
src/views/business/view-shop.vue

@@ -0,0 +1,297 @@
+<template>
+  <basic-container>
+    <avue-crud :option="option"
+               :table-loading="loading"
+               :data="data"
+               :page.sync="page"
+               :permission="permissionList"
+               :before-open="beforeOpen"
+               v-model="form"
+               ref="crud"
+               @row-update="rowUpdate"
+               @row-save="rowSave"
+               @row-del="rowDel"
+               @search-change="searchChange"
+               @search-reset="searchReset"
+               @selection-change="selectionChange"
+               @current-change="currentChange"
+               @size-change="sizeChange"
+               @refresh-change="refreshChange"
+               @on-load="onLoad">
+      <template slot="menuLeft">
+
+      </template>
+    </avue-crud>
+  </basic-container>
+</template>
+
+<script>
+  import {getList, getDetail, add, update, remove} from "@/api/business/shop";
+  import {mapGetters} from "vuex";
+
+  export default {
+    props: {
+      merchantId: {
+        type: [String, Number],
+        default: 0
+      }
+    },
+    data() {
+      return {
+        form: {},
+        query: {},
+        loading: true,
+        page: {
+          pageSize: 10,
+          currentPage: 1,
+          total: 0
+        },
+        selectionList: [],
+        option: {
+          calcHeight: 30,
+          tip: false,
+          searchShow: true,
+          searchMenuSpan: 6,
+          border: true,
+          index: true,
+          addBtn: false,
+          viewBtn: true,
+          selection: true,
+          dialogClickModal: false,
+          column: [
+            {
+              label: "门店名称",
+              prop: "storeName",
+              search: true,
+              rules: [{
+                required: true,
+                message: "请输入门店名称",
+                trigger: "blur"
+              }]
+            },
+            {
+              label: "门店地址",
+              prop: "address",
+              rules: [{
+                required: true,
+                message: "请输入门店地址",
+                trigger: "blur"
+              }]
+            },
+            {
+              label: "店长姓名",
+              prop: "managerName",
+              rules: [{
+                required: true,
+                message: "请输入店长姓名",
+                trigger: "blur"
+              }]
+            },
+            {
+              label: "店长电话",
+              prop: "managerPhone",
+              rules: [{
+                required: true,
+                message: "请输入店长电话",
+                trigger: "blur"
+              }]
+            },
+            {
+              label: "营业状态",
+              prop: "businessStatus",
+              search: true,
+              type: "select",
+              dicUrl: "/api/blade-system/dict-biz/dictionary?code=business_status",
+              props: {
+                label: "dictValue",
+                value: "dictKey"
+              },
+              dataType: "number",
+              rules: [{
+                required: true,
+                message: "请输入营业状态",
+                trigger: "blur"
+              }]
+            },
+            {
+              label: "营业开始时间",
+              prop: "openingHours",
+              rules: [{
+                required: true,
+                message: "请输入营业开始时间",
+                trigger: "blur"
+              }]
+            },
+            {
+              label: "营业结束时间",
+              prop: "closingHours",
+              rules: [{
+                required: true,
+                message: "请输入营业结束时间",
+                trigger: "blur"
+              }]
+            },
+            {
+              label: "门店图片",
+              prop: "storeImage",
+              type: 'upload',
+              span: 24,
+              listType: 'picture-img',
+              rules: [{
+                required: true,
+                message: "请输入门店图片",
+                trigger: "blur"
+              }]
+            },
+            // {
+            //   label: "营业执照",
+            //   prop: "businessLicence",
+            //   rules: [{
+            //     required: true,
+            //     message: "请输入营业执照",
+            //     trigger: "blur"
+            //   }]
+            // },
+          ]
+        },
+        data: []
+      };
+    },
+    computed: {
+      ...mapGetters(["permission"]),
+      permissionList() {
+        return {
+          addBtn: this.vaildData(this.permission.shop_add, false),
+          viewBtn: this.vaildData(this.permission.shop_view, false),
+          delBtn: this.vaildData(this.permission.shop_delete, false),
+          editBtn: this.vaildData(this.permission.shop_edit, false)
+        };
+      },
+      ids() {
+        let ids = [];
+        this.selectionList.forEach(ele => {
+          ids.push(ele.id);
+        });
+        return ids.join(",");
+      }
+    },
+    created() {
+      this.onLoad(this.page)
+    },
+    methods: {
+      rowSave(row, done, loading) {
+        add(row).then(() => {
+          this.onLoad(this.page);
+          this.$message({
+            type: "success",
+            message: "操作成功!"
+          });
+          done();
+        }, error => {
+          loading();
+          window.console.log(error);
+        });
+      },
+      rowUpdate(row, index, done, loading) {
+        update(row).then(() => {
+          this.onLoad(this.page);
+          this.$message({
+            type: "success",
+            message: "操作成功!"
+          });
+          done();
+        }, error => {
+          loading();
+          console.log(error);
+        });
+      },
+      rowDel(row) {
+        this.$confirm("确定将选择数据删除?", {
+          confirmButtonText: "确定",
+          cancelButtonText: "取消",
+          type: "warning"
+        })
+          .then(() => {
+            return remove(row.id);
+          })
+          .then(() => {
+            this.onLoad(this.page);
+            this.$message({
+              type: "success",
+              message: "操作成功!"
+            });
+          });
+      },
+      handleDelete() {
+        if (this.selectionList.length === 0) {
+          this.$message.warning("请选择至少一条数据");
+          return;
+        }
+        this.$confirm("确定将选择数据删除?", {
+          confirmButtonText: "确定",
+          cancelButtonText: "取消",
+          type: "warning"
+        })
+          .then(() => {
+            return remove(this.ids);
+          })
+          .then(() => {
+            this.onLoad(this.page);
+            this.$message({
+              type: "success",
+              message: "操作成功!"
+            });
+            this.$refs.crud.toggleSelection();
+          });
+      },
+      beforeOpen(done, type) {
+        if (["edit", "view"].includes(type)) {
+          getDetail(this.form.id).then(res => {
+            this.form = res.data.data;
+          });
+        }
+        done();
+      },
+      searchReset() {
+        this.query = {};
+        this.onLoad(this.page);
+      },
+      searchChange(params, done) {
+        this.query = params;
+        this.page.currentPage = 1;
+        this.onLoad(this.page, params);
+        done();
+      },
+      selectionChange(list) {
+        this.selectionList = list;
+      },
+      selectionClear() {
+        this.selectionList = [];
+        this.$refs.crud.toggleSelection();
+      },
+      currentChange(currentPage){
+        this.page.currentPage = currentPage;
+      },
+      sizeChange(pageSize){
+        this.page.pageSize = pageSize;
+      },
+      refreshChange() {
+        this.onLoad(this.page, this.query);
+      },
+      onLoad(page, params = {}) {
+        this.loading = true;
+        this.query.merchantId = this.merchantId;
+        getList(page.currentPage, page.pageSize, Object.assign(params, this.query)).then(res => {
+          const data = res.data.data;
+          this.page.total = data.total;
+          this.data = data.records;
+          this.loading = false;
+          this.selectionClear();
+        });
+      }
+    }
+  };
+</script>
+
+<style>
+</style>

+ 31 - 14
src/views/facility/facility.vue

@@ -27,17 +27,41 @@
                    @click="handleDelete">删 除
         </el-button>
       </template>
+
+      <template slot="facilityStatus" slot-scope="scope" >
+        <el-tag v-if="scope.row.facilityStatus == '1'" type="success">在线</el-tag>
+        <el-tag v-if="scope.row.facilityStatus == '0'" type="danger">离线</el-tag>
+      </template>
+
+      <template slot-scope="scope" slot="menu">
+        <el-button type="text"
+                   size="small"
+                   @click="handleViewCargoWay(scope.row)"
+        >查看设备货道</el-button>
+      </template>
     </avue-crud>
+
+    <el-dialog title="门店"
+               append-to-body
+               :visible.sync="cargowayBox"
+               :before-close="handleClose"
+               width="80%">
+      <CargoWay :facility-id="facilityId"></CargoWay>
+    </el-dialog>
   </basic-container>
 </template>
 
 <script>
   import {getList, getDetail, add, update, remove} from "@/api/facility/facility";
   import {mapGetters} from "vuex";
+  import CargoWay from "@/views/business/facilitycargoway.vue";
 
   export default {
+    components: {CargoWay},
     data() {
       return {
+        facilityId: 0,
+        cargowayBox: false,
         form: {},
         query: {},
         loading: true,
@@ -54,7 +78,6 @@
           searchShow: true,
           searchMenuSpan: 6,
           border: true,
-          index: true,
           viewBtn: true,
           selection: true,
           dialogClickModal: false,
@@ -68,22 +91,9 @@
                 trigger: "blur"
               }]
             },
-            {
-              label: "所属门店",
-              prop: "shopName",
-              search: true,
-              addDisplay: false,
-              editDisplay: false,
-              rules: [{
-                required: true,
-                message: "请输入门店id",
-                trigger: "blur"
-              }]
-            },
             {
               label: "所属门店",
               prop: "shopId",
-              hide: true,
               type: "select",
               dicUrl: "/api/business/shop/list?status=0&current=1&size=100",
               dicFormatter: function (res) {
@@ -299,6 +309,13 @@
           this.loading = false;
           this.selectionClear();
         });
+      },
+      handleClose() {
+        this.cargowayBox = false;
+      },
+      handleViewCargoWay(row) {
+        this.facilityId = row.id;
+        this.cargowayBox = true;
       }
     }
   };

+ 29 - 29
src/views/mall/goodsinfo.vue

@@ -220,35 +220,35 @@
                 trigger: "blur"
               }]
             },
-            {
-              label: "厂家",
-              prop: "supplierId",
-              editDisplay: true,
-              viewDisplay: false,
-              remote: true,
-              hide: true,
-              type: "select",
-              dicUrl: "/api/mall/store/list?name={{key}}&state=1&auditState=1&size=30",
-              props: {
-                label: "name",
-                value: "id"
-              },
-              dicFormatter: function (res) {
-                return res.data.records;
-              },
-              rules: [{
-                required: true,
-                message: "请选择厂家",
-                trigger: "blur"
-              }]
-            },
-            {
-              label: "厂家",
-              prop: "supplierName",
-              search: true,
-              addDisplay: false,
-              editDisplay: false,
-            },
+            // {
+            //   label: "厂家",
+            //   prop: "supplierId",
+            //   editDisplay: true,
+            //   viewDisplay: false,
+            //   remote: true,
+            //   hide: true,
+            //   type: "select",
+            //   dicUrl: "/api/mall/store/list?name={{key}}&state=1&auditState=1&size=30",
+            //   props: {
+            //     label: "name",
+            //     value: "id"
+            //   },
+            //   dicFormatter: function (res) {
+            //     return res.data.records;
+            //   },
+            //   rules: [{
+            //     required: true,
+            //     message: "请选择厂家",
+            //     trigger: "blur"
+            //   }]
+            // },
+            // {
+            //   label: "厂家",
+            //   prop: "supplierName",
+            //   search: true,
+            //   addDisplay: false,
+            //   editDisplay: false,
+            // },
             {
               label: "品牌",
               prop: "brandDesc",

+ 0 - 42
src/views/platform/userapp.vue

@@ -41,8 +41,6 @@
       <template slot-scope="{type,size,row}" slot="menu">
          <el-button v-if="row.state == 1" :size="size" :type="type" @click="forbidden(row, 2)">禁用</el-button>
          <el-button v-if="row.state == 2" :size="size" :type="type" @click="forbidden(row, 1)">启用</el-button>
-         <el-button v-if="row.livingHall === 0" :size="size" :type="type" @click="setLeader(row)">设为团长</el-button>
-         <el-button v-if="row.livingHall === 1" :size="size" :type="type" @click="removeLeader(row)">移除团长</el-button>
       </template>
     </avue-crud>
 
@@ -191,46 +189,6 @@
               editDisplay: false,
               search: true,
             },
-            // {
-            //   label: "供应商身份",
-            //   prop: "isStore",
-            //   type: "select",
-            //   dicUrl: "/api/blade-system/dict-biz/dictionary?code=is_store",
-            //   props: {
-            //     label: "dictValue",
-            //     value: "dictKey"
-            //   },
-            //   dataType: "number",
-            //   hide: false,
-            //   search: true,
-            //   addDisplay: false,
-            //   editDisplay: false,
-            //   rules: [{
-            //     required: true,
-            //     message: "请选择状态",
-            //     trigger: "blur"
-            //   }]
-            // },
-            {
-              label: "团长身份",
-              prop: "livingHall",
-              type: "select",
-              dicUrl: "/api/blade-system/dict-biz/dictionary?code=is_captain",
-              props: {
-                label: "dictValue",
-                value: "dictKey"
-              },
-              dataType: "number",
-              hide: false,
-              search: true,
-              addDisplay: false,
-              editDisplay: false,
-              rules: [{
-                required: true,
-                message: "请选择状态",
-                trigger: "blur"
-              }]
-            },
             {
               label: "状态",
               prop: "state",

+ 236 - 0
src/views/system/childAccount.vue

@@ -0,0 +1,236 @@
+<template>
+  <basic-container>
+    <avue-crud :option="option"
+               :table-loading="loading"
+               :data="data"
+               :page.sync="page"
+               :permission="permissionList"
+               :before-open="beforeOpen"
+               v-model="form"
+               ref="crud"
+               @row-update="rowUpdate"
+               @row-save="rowSave"
+               @row-del="rowDel"
+               @search-change="searchChange"
+               @search-reset="searchReset"
+               @selection-change="selectionChange"
+               @current-change="currentChange"
+               @size-change="sizeChange"
+               @refresh-change="refreshChange"
+               @on-load="onLoad">
+      <template slot="menuLeft">
+
+      </template>
+
+    </avue-crud>
+  </basic-container>
+
+</template>
+
+<script>
+  import {getList, getDetail, add, update, remove} from "@/api/system/usermerchant";
+  import {mapGetters} from "vuex";
+
+  export default {
+    props: {
+      parentId: {
+        type: [String, Number],
+        default: 0
+      }
+    },
+    data() {
+      return {
+        childBox: false,
+        form: {},
+        query: {},
+        loading: true,
+        page: {
+          pageSize: 10,
+          currentPage: 1,
+          total: 0
+        },
+        selectionList: [],
+        option: {
+          calcHeight: 30,
+          tip: false,
+          searchShow: true,
+          searchMenuSpan: 6,
+          border: true,
+          index: true,
+          viewBtn: true,
+          addBtn: false,
+          selection: true,
+          dialogClickModal: false,
+          column: [
+            {
+              label: "手机号",
+              prop: "phone",
+              search: true
+            },
+            {
+              label: "姓名",
+              prop: "realName"
+            },
+            {
+              label: "授权门店",
+              prop: "authShopDesc"
+            },
+          ]
+        },
+        data: []
+      };
+    },
+    computed: {
+      ...mapGetters(["permission"]),
+      permissionList() {
+        return {
+          addBtn: this.vaildData(this.permission.usermerchant_add, false),
+          viewBtn: this.vaildData(this.permission.usermerchant_view, false),
+          delBtn: this.vaildData(this.permission.usermerchant_delete, false),
+          editBtn: this.vaildData(this.permission.usermerchant_edit, false)
+        };
+      },
+      ids() {
+        let ids = [];
+        this.selectionList.forEach(ele => {
+          ids.push(ele.id);
+        });
+        return ids.join(",");
+      }
+    },
+    created() {
+      this.onLoad(this.page);
+    },
+    methods: {
+      rowSave(row, done, loading) {
+        add(row).then(() => {
+          this.onLoad(this.page);
+          this.$message({
+            type: "success",
+            message: "操作成功!"
+          });
+          done();
+        }, error => {
+          loading();
+          window.console.log(error);
+        });
+      },
+      rowUpdate(row, index, done, loading) {
+        update(row).then(() => {
+          this.onLoad(this.page);
+          this.$message({
+            type: "success",
+            message: "操作成功!"
+          });
+          done();
+        }, error => {
+          loading();
+          console.log(error);
+        });
+      },
+      rowDel(row) {
+        this.$confirm("确定将选择数据删除?", {
+          confirmButtonText: "确定",
+          cancelButtonText: "取消",
+          type: "warning"
+        })
+          .then(() => {
+            return remove(row.id);
+          })
+          .then(() => {
+            this.onLoad(this.page);
+            this.$message({
+              type: "success",
+              message: "操作成功!"
+            });
+          });
+      },
+      handleDelete() {
+        if (this.selectionList.length === 0) {
+          this.$message.warning("请选择至少一条数据");
+          return;
+        }
+        this.$confirm("确定将选择数据删除?", {
+          confirmButtonText: "确定",
+          cancelButtonText: "取消",
+          type: "warning"
+        })
+          .then(() => {
+            return remove(this.ids);
+          })
+          .then(() => {
+            this.onLoad(this.page);
+            this.$message({
+              type: "success",
+              message: "操作成功!"
+            });
+            this.$refs.crud.toggleSelection();
+          });
+      },
+      beforeOpen(done, type) {
+        if (["edit", "view"].includes(type)) {
+          getDetail(this.form.id).then(res => {
+            this.form = res.data.data;
+          });
+        }
+        done();
+      },
+      searchReset() {
+        this.query = {};
+        this.onLoad(this.page);
+      },
+      searchChange(params, done) {
+        this.query = params;
+        this.page.currentPage = 1;
+        this.onLoad(this.page, params);
+        done();
+      },
+      selectionChange(list) {
+        this.selectionList = list;
+      },
+      selectionClear() {
+        this.selectionList = [];
+        this.$refs.crud.toggleSelection();
+      },
+      currentChange(currentPage){
+        this.page.currentPage = currentPage;
+      },
+      sizeChange(pageSize){
+        this.page.pageSize = pageSize;
+      },
+      refreshChange() {
+        this.onLoad(this.page, this.query);
+      },
+      onLoad(page, params = {}) {
+        this.loading = true;
+        this.query.parentId = this.parentId;
+        getList(page.currentPage, page.pageSize, Object.assign(params, this.query)).then(res => {
+          const data = res.data.data;
+          this.page.total = data.total;
+          this.data = data.records;
+          this.loading = false;
+          this.selectionClear();
+        });
+      },
+      pass(row) {
+        this.$confirm("是否确定审核通过?", {
+          confirmButtonText: "确定",
+          cancelButtonText: "取消",
+          type: "warning"
+        }).then(() => {
+          row.auditStatus = 1;
+          return update(row);
+        }).then(() => {
+          this.onLoad(this.page);
+          this.$message({
+            type: "success",
+            message: "操作成功!"
+          });
+        });
+      }
+    }
+  };
+</script>
+
+<style>
+</style>

+ 40 - 0
src/views/system/usermerchant.vue

@@ -36,22 +36,48 @@
         >通过</el-button>
         <el-button type="text"
                    size="small"
+                   @click="handleViewChild(scope.row)"
         >查看子账号</el-button>
         <el-button type="text"
                    size="small"
+                   @click="handleViewShop(scope.row)"
         >查看门店</el-button>
       </template>
     </avue-crud>
+
+    <el-dialog title="子账号"
+               append-to-body
+               :visible.sync="childBox"
+               :before-close="handleClose"
+               width="80%">
+      <childAccount :parent-id="parentId"></childAccount>
+    </el-dialog>
+
+    <el-dialog title="门店"
+               append-to-body
+               :visible.sync="shopBox"
+               :before-close="handleClose"
+               width="80%">
+      <ViewShop :merchant-id="merchantId"></ViewShop>
+    </el-dialog>
   </basic-container>
+
 </template>
 
 <script>
   import {getList, getDetail, add, update, remove} from "@/api/system/usermerchant";
   import {mapGetters} from "vuex";
+  import ChildAccount from "@/views/system/childAccount.vue";
+  import ViewShop from "@/views/business/view-shop.vue";
 
   export default {
+    components: {ViewShop, ChildAccount},
     data() {
       return {
+        parentId: 0,
+        merchantId: 0,
+        childBox: false,
+        shopBox: false,
         form: {},
         query: {},
         loading: true,
@@ -87,6 +113,7 @@
             {
               label: "手机号",
               prop: "phone",
+              search: true,
               rules: [{
                 required: true,
                 message: "请输入手机号",
@@ -283,6 +310,7 @@
       },
       onLoad(page, params = {}) {
         this.loading = true;
+        this.query.parentId = 0;
         getList(page.currentPage, page.pageSize, Object.assign(params, this.query)).then(res => {
           const data = res.data.data;
           this.page.total = data.total;
@@ -306,6 +334,18 @@
             message: "操作成功!"
           });
         });
+      },
+      handleViewChild(row) {
+        this.childBox = true;
+        this.parentId = row.userId;
+      },
+      handleViewShop(row) {
+        this.shopBox = true;
+        this.merchantId = row.userId;
+      },
+      handleClose() {
+        this.childBox = false;
+        this.shopBox = false;
       }
     }
   };