Selaa lähdekoodia

渠道管理和经销商管理页面(未完待续)

guanglong 3 vuotta sitten
vanhempi
commit
191f5ea8b5

+ 1 - 1
src/api/admin/area.js

@@ -6,7 +6,7 @@ export function listAreaByPid(pid) {
     pid:pid
   }
   return request({
-    url: '/system/dict/type/list',
+    url: '/api/v1/mp/listByPid',
     method: 'get',
     params: query
   })

+ 9 - 0
src/api/admin/channel.js

@@ -21,6 +21,15 @@ export function listChannel(urlParams, data) {
 }
 
 
+// 查询所有渠道列表
+export function listAllChannel() {
+  return request({
+    url: '/api/v1/mp/admin/channel/listAll',
+    method: 'post'
+  })
+}
+
+
 // 新增渠道
 export function addChannel(data) {
   return request({

+ 184 - 128
src/views/business/channel/index.vue

@@ -14,13 +14,15 @@
           />
         </div>
         <div class="head-container">
+          <!-- :data="deptOptions" -->
+          <!--           :expand-on-click-node="true"
+                     :filter-node-method="filterNode" -->
           <el-tree
-            :data="deptOptions"
             :props="defaultProps"
-            :expand-on-click-node="false"
-            :filter-node-method="filterNode"
+
             ref="tree"
-            default-expand-all
+            :load="loadNode"
+            lazy
             @node-click="handleNodeClick"
           />
         </div>
@@ -28,19 +30,19 @@
       <!--用户数据-->
       <el-col :span="20" :xs="24">
         <el-form :model="queryParams" ref="queryForm" :inline="true" v-show="showSearch" label-width="68px">
-          <el-form-item label="用户名称" prop="userName">
+          <el-form-item label="渠道名称" prop="name">
             <el-input
-              v-model="queryParams.userName"
-              placeholder="请输入用户名称"
+              v-model="queryParams.name"
+              placeholder="请输入渠道名称"
               clearable
               size="small"
               style="width: 240px"
               @keyup.enter.native="handleQuery"
             />
           </el-form-item>
-          <el-form-item label="手机号码" prop="phonenumber">
+          <el-form-item label="手机号码" prop="mobile">
             <el-input
-              v-model="queryParams.phonenumber"
+              v-model="queryParams.mobile"
               placeholder="请输入手机号码"
               clearable
               size="small"
@@ -48,34 +50,44 @@
               @keyup.enter.native="handleQuery"
             />
           </el-form-item>
-          <el-form-item label="状态" prop="status">
-            <el-select
-              v-model="queryParams.status"
-              placeholder="用户状态"
-              clearable
-              size="small"
-              style="width: 240px"
-            >
-              <el-option
-                v-for="dict in statusOptions"
-                :key="dict.dictValue"
-                :label="dict.dictLabel"
-                :value="dict.dictValue"
-              />
-            </el-select>
-          </el-form-item>
-          <el-form-item label="创建时间">
-            <el-date-picker
-              v-model="dateRange"
-              size="small"
-              style="width: 240px"
-              value-format="yyyy-MM-dd"
-              type="daterange"
-              range-separator="-"
-              start-placeholder="开始日期"
-              end-placeholder="结束日期"
-            ></el-date-picker>
-          </el-form-item>
+         <el-form-item label="地区">
+           <el-select
+             v-model="queryParams.provinceId"
+             placeholder="选择省份"
+             clearable
+             size="small"
+             @change="getCityList()"
+             style="width: 120px;margin-right: 1px;">
+             <el-option
+               v-for="item in provinceList"
+               :key="item.areaId"
+               :label="item.areaName"
+               :value="item.areaId"
+             />
+           </el-select>
+           <el-select
+             v-model="queryParams.cityId"
+             placeholder="选择市"
+             clearable
+             size="small"
+              @change="getAreaList()"
+             style="width: 120px;margin-right: 1px;">
+             <el-option
+               v-for="item in cityList"
+               :key="item.areaId"
+               :label="item.areaName"
+               :value="item.areaId"
+             />
+           </el-select>
+           <el-select v-model="queryParams.areaId" placeholder="选择区" clearable size="small" style="width: 120px;margin-right: 1px;">
+             <el-option
+               v-for="item in areaList"
+               :key="item.areaId"
+               :label="item.areaName"
+               :value="item.areaId"
+             />
+           </el-select>
+         </el-form-item>
           <el-form-item>
             <el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
             <el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
@@ -86,67 +98,31 @@
           <el-col :span="1.5">
             <el-button
               type="primary"
-              plain
               icon="el-icon-plus"
               size="mini"
               @click="handleAdd"
               v-hasPermi="['system:user:add']"
-            >新增</el-button>
-          </el-col>
-          <el-col :span="1.5">
-            <el-button
-              type="success"
-              plain
-              icon="el-icon-edit"
-              size="mini"
-              :disabled="single"
-              @click="handleUpdate"
-              v-hasPermi="['system:user:edit']"
-            >修改</el-button>
-          </el-col>
-          <el-col :span="1.5">
-            <el-button
-              type="danger"
-              plain
-              icon="el-icon-delete"
-              size="mini"
-              :disabled="multiple"
-              @click="handleDelete"
-              v-hasPermi="['system:user:remove']"
-            >删除</el-button>
-          </el-col>
-          <el-col :span="1.5">
-            <el-button
-              type="info"
-              plain
-              icon="el-icon-upload2"
-              size="mini"
-              @click="handleImport"
-              v-hasPermi="['system:user:import']"
-            >导入</el-button>
-          </el-col>
-          <el-col :span="1.5">
-            <el-button
-              type="warning"
-              plain
-              icon="el-icon-download"
-              size="mini"
-              :loading="exportLoading"
-              @click="handleExport"
-              v-hasPermi="['system:user:export']"
-            >导出</el-button>
+            >添加渠道</el-button>
           </el-col>
           <right-toolbar :showSearch.sync="showSearch" @queryTable="getList" :columns="columns"></right-toolbar>
         </el-row>
 
-        <el-table v-loading="loading" :data="userList" @selection-change="handleSelectionChange">
-          <el-table-column type="selection" width="50" align="center" />
-          <el-table-column label="用户编号" align="center" key="userId" prop="userId" v-if="columns[0].visible" />
-          <el-table-column label="用户名称" align="center" key="userName" prop="userName" v-if="columns[1].visible" :show-overflow-tooltip="true" />
-          <el-table-column label="用户昵称" align="center" key="nickName" prop="nickName" v-if="columns[2].visible" :show-overflow-tooltip="true" />
-          <el-table-column label="部门" align="center" key="deptName" prop="dept.deptName" v-if="columns[3].visible" :show-overflow-tooltip="true" />
-          <el-table-column label="手机号码" align="center" key="phonenumber" prop="phonenumber" v-if="columns[4].visible" width="120" />
-          <el-table-column label="状态" align="center" key="status" v-if="columns[5].visible">
+        <el-table v-loading="loading" :data="channelList" @selection-change="handleSelectionChange">
+          <el-table-column label="渠道ID" prop="channelId" width="140px" />
+          <el-table-column label="渠道名称" prop="name" show-overflow-tooltip  width="180px"/>
+          <el-table-column label="佣金比例" prop="commRate">
+            <template slot-scope="scope">
+              {{scope.row.commRate}}%
+            </template>
+          </el-table-column>
+          <el-table-column label="渠道级别" prop="level">
+            <template slot-scope="scope">
+              {{scope.row.level}}级渠道
+            </template>
+          </el-table-column>
+          <el-table-column label="经销商数" prop="siteCnt"  />
+          <el-table-column label="用户数" prop="userCnt"  />
+          <el-table-column label="状态" key="status">
             <template slot-scope="scope">
               <el-switch
                 v-model="scope.row.status"
@@ -156,33 +132,40 @@
               ></el-switch>
             </template>
           </el-table-column>
-          <el-table-column label="创建时间" align="center" prop="createTime" v-if="columns[6].visible" width="160">
-            <template slot-scope="scope">
-              <span>{{ parseTime(scope.row.createTime) }}</span>
-            </template>
-          </el-table-column>
           <el-table-column
             label="操作"
             align="center"
-            width="160"
+            width="200"
             class-name="small-padding fixed-width"
           >
             <template slot-scope="scope" v-if="scope.row.userId !== 1">
               <el-button
                 size="mini"
                 type="text"
-                icon="el-icon-edit"
                 @click="handleUpdate(scope.row)"
                 v-hasPermi="['system:user:edit']"
-              >修改</el-button>
+              >查看</el-button>
               <el-button
+                size="mini"
+                type="text"
+                @click="handleUpdate(scope.row)"
+                v-hasPermi="['system:user:edit']"
+              >编辑</el-button>
+       <!--       <el-button
                 size="mini"
                 type="text"
                 icon="el-icon-delete"
                 @click="handleDelete(scope.row)"
                 v-hasPermi="['system:user:remove']"
-              >删除</el-button>
-              <el-dropdown size="mini" @command="(command) => handleCommand(command, scope.row)" v-hasPermi="['system:user:resetPwd', 'system:user:edit']">
+              >删除</el-button> -->
+              <el-button
+                size="mini"
+                type="text"
+                icon="el-icon-plus"
+                @click="handleDelete(scope.row)"
+                v-hasPermi="['system:user:remove']"
+              >添加子渠道</el-button>
+      <!--        <el-dropdown size="mini" @command="(command) => handleCommand(command, scope.row)" v-hasPermi="['system:user:resetPwd', 'system:user:edit']">
                 <span class="el-dropdown-link">
                   <i class="el-icon-d-arrow-right el-icon--right"></i>更多
                 </span>
@@ -192,7 +175,7 @@
                   <el-dropdown-item command="handleAuthRole" icon="el-icon-circle-check"
                     v-hasPermi="['system:user:edit']">分配角色</el-dropdown-item>
                 </el-dropdown-menu>
-              </el-dropdown>
+              </el-dropdown> -->
             </template>
           </el-table-column>
         </el-table>
@@ -200,8 +183,8 @@
         <pagination
           v-show="total>0"
           :total="total"
-          :page.sync="queryParams.pageNum"
-          :limit.sync="queryParams.pageSize"
+          :page.sync="pageParams.pageNum"
+          :limit.sync="pageParams.pageSize"
           @pagination="getList"
         />
       </el-col>
@@ -348,7 +331,11 @@
 <script>
 import { listUser, getUser, delUser, addUser, updateUser, exportUser, resetUserPwd, changeUserStatus, importTemplate } from "@/api/system/user";
 import { getToken } from "@/utils/auth";
+
+import { treeChannel, listChannel, updateChannelStatus} from "@/api/admin/channel";
+
 import { treeselect } from "@/api/system/dept";
+import { listAreaByPid} from "@/api/admin/area";
 import Treeselect from "@riophae/vue-treeselect";
 import "@riophae/vue-treeselect/dist/vue-treeselect.css";
 
@@ -363,6 +350,10 @@ export default {
       exportLoading: false,
       // 选中数组
       ids: [],
+
+      provinceList:[],
+      cityList:[],
+      areaList:[],
       // 非单个禁用
       single: true,
       // 非多个禁用
@@ -372,7 +363,7 @@ export default {
       // 总条数
       total: 0,
       // 用户表格数据
-      userList: null,
+      channelList: null,
       // 弹出层标题
       title: "",
       // 部门树选项
@@ -397,7 +388,7 @@ export default {
       form: {},
       defaultProps: {
         children: "children",
-        label: "label"
+        label: "name"
       },
       // 用户导入参数
       upload: {
@@ -416,12 +407,15 @@ export default {
       },
       // 查询参数
       queryParams: {
+        name: "",
+        mobile: "",
+        provinceId:"",
+        cityId:"",
+        areaId:""
+      },
+      pageParams: {
         pageNum: 1,
-        pageSize: 10,
-        userName: undefined,
-        phonenumber: undefined,
-        status: undefined,
-        deptId: undefined
+        pageSize: 10
       },
       // 列信息
       columns: [
@@ -469,33 +463,36 @@ export default {
       this.$refs.tree.filter(val);
     }
   },
+  mounted() {
+     this.getProvinceList()
+  },
   created() {
     this.getList();
-    this.getTreeselect();
-    this.getDicts("sys_normal_disable").then(response => {
-      this.statusOptions = response.data;
-    });
-    this.getDicts("sys_user_sex").then(response => {
-      this.sexOptions = response.data;
-    });
-    this.getConfigKey("sys.user.initPassword").then(response => {
-      this.initPassword = response.msg;
-    });
+   // this.getChannelTree();
+    // this.getDicts("sys_normal_disable").then(response => {
+    //   this.statusOptions = response.data;
+    // });
+    // this.getDicts("sys_user_sex").then(response => {
+    //   this.sexOptions = response.data;
+    // });
+    // this.getConfigKey("sys.user.initPassword").then(response => {
+    //   this.initPassword = response.msg;
+    // });
   },
   methods: {
     /** 查询用户列表 */
     getList() {
       this.loading = true;
-      listUser(this.addDateRange(this.queryParams, this.dateRange)).then(response => {
-          this.userList = response.rows;
+      listChannel('pageNum='+this.pageParams.pageNum + '&pageSize='+this.pageParams.pageSize+'&', this.queryParams).then(response => {
+          this.channelList = response.rows;
           this.total = response.total;
           this.loading = false;
         }
       );
     },
     /** 查询部门下拉树结构 */
-    getTreeselect() {
-      treeselect().then(response => {
+    getChannelTree(data) {
+      treeChannel(data).then(response => {
         this.deptOptions = response.data;
       });
     },
@@ -506,9 +503,60 @@ export default {
     },
     // 节点单击事件
     handleNodeClick(data) {
-      this.queryParams.deptId = data.id;
+      this.queryParams.parentId = data.channelId;
       this.getList();
     },
+    loadNode(node, resolve) {
+      console.log("node.level =="+JSON.stringify(node.level))
+      if(node.level === 0){
+       treeChannel({}).then(response => {
+          return resolve(response.data);
+       });
+      }else{
+         console.log("node =="+JSON.stringify(node.data))
+          console.log("node.data.channelId =="+ node.data.channelId)
+        var params = {
+          parentId:node.data.channelId
+        }
+        treeChannel(params).then(response => {
+           return resolve(response.data);
+        });
+      }
+
+    },
+
+    // 省
+    getProvinceList(){
+      this.cityList = []
+      this.areaList = []
+      this.queryParams.cityId = ""
+      this.queryParams.areaId = ""
+      listAreaByPid(0).then(response => {
+        console.log("getProvinceList"+JSON.stringify(response))
+         this.provinceList = response || [];
+      });
+    },
+
+    getCityList(){
+      this.cityList = []
+      this.areaList = []
+      this.queryParams.cityId = ""
+      this.queryParams.areaId = ""
+      var provinceId = this.queryParams.provinceId
+      listAreaByPid(provinceId).then(response => {
+        console.log("getCityList"+JSON.stringify(response))
+         this.cityList = response || [];
+      });
+    },
+
+    getAreaList(){
+      var cityId = this.queryParams.cityId
+      listAreaByPid(cityId).then(response => {
+        console.log("getAreaList"+JSON.stringify(response))
+         this.areaList = response || [];
+      });
+    },
+
     // 用户状态修改
     handleStatusChange(row) {
       let text = row.status === "0" ? "启用" : "停用";
@@ -554,7 +602,15 @@ export default {
     },
     /** 重置按钮操作 */
     resetQuery() {
-      this.dateRange = [];
+      this.queryParams= {
+        pageNum: 1,
+        pageSize: 10,
+         name: "",
+         mobile: "",
+         provinceId:"",
+         cityId:"",
+         areaId:""
+      },
       this.resetForm("queryForm");
       this.handleQuery();
     },
@@ -704,5 +760,5 @@ export default {
 };
 </script>
 <style lang="sass" scoped>
-  
-</style>
+
+</style>

+ 170 - 102
src/views/business/salesite/index.vue

@@ -2,17 +2,30 @@
   <div class="app-container">
     <el-form :model="queryParams" ref="queryForm" :inline="true" v-show="showSearch" label-width="75px">
       <el-form-item label="上级渠道" prop="parentId">
-        <el-input
+        <el-select
           v-model="queryParams.parentId"
           placeholder="请选择上级渠道"
+          style="width: 100%;"
+          filterable
           clearable
-          size="small"
-          @keyup.enter.native="handleQuery"
-        />
+          :filter-method="dataFilter"
+          @change="handleQuery"
+        >
+          <el-option
+            v-for="(item, index) in channelList"
+            :key="item.channelId"
+            :label="item.name"
+            :value="item.channelId">
+            <div>
+              <span style="float: left;">{{item.name}} </span>
+              <span style="float: right;">{{item.mobile}}</span>
+            </div>
+          </el-option>
+        </el-select>
       </el-form-item>
-      <el-form-item label="经销商名称" prop="postName" label-width="90px">
+      <el-form-item label="经销商名称" prop="name" label-width="90px">
         <el-input
-          v-model="queryParams.postName"
+          v-model="queryParams.name"
           placeholder="请输入岗经销商名称"
           clearable
           size="small"
@@ -21,36 +34,48 @@
       </el-form-item>
       <el-form-item label="手机号码" prop="mobile">
         <el-input
-          v-model="queryParams.postName"
+          v-model="queryParams.mobile"
           placeholder="请输入手机号码"
           clearable
           size="small"
           @keyup.enter.native="handleQuery"
         />
       </el-form-item>
-      <el-form-item label="地区" prop="status">
-        <el-select v-model="queryParams.status" placeholder="选择省份" clearable size="small" style="width: 120px;margin-right: 1px;">
+      <el-form-item label="地区">
+        <el-select
+          v-model="queryParams.provinceId"
+          placeholder="选择省份"
+          clearable
+          size="small"
+          @change="getCityList()"
+          style="width: 120px;margin-right: 1px;">
           <el-option
-            v-for="dict in statusOptions"
-            :key="dict.dictValue"
-            :label="dict.dictLabel"
-            :value="dict.dictValue"
+            v-for="item in provinceList"
+            :key="item.areaId"
+            :label="item.areaName"
+            :value="item.areaId"
           />
         </el-select>
-        <el-select v-model="queryParams.status" placeholder="选择市" clearable size="small" style="width: 120px;margin-right: 1px;">
+        <el-select
+          v-model="queryParams.cityId"
+          placeholder="选择市"
+          clearable
+          size="small"
+           @change="getAreaList()"
+          style="width: 120px;margin-right: 1px;">
           <el-option
-            v-for="dict in statusOptions"
-            :key="dict.dictValue"
-            :label="dict.dictLabel"
-            :value="dict.dictValue"
+            v-for="item in cityList"
+            :key="item.areaId"
+            :label="item.areaName"
+            :value="item.areaId"
           />
         </el-select>
-        <el-select v-model="queryParams.status" placeholder="选择区" clearable size="small" style="width: 120px;margin-right: 1px;">
+        <el-select v-model="queryParams.areaId" placeholder="选择区" clearable size="small" style="width: 120px;margin-right: 1px;">
           <el-option
-            v-for="dict in statusOptions"
-            :key="dict.dictValue"
-            :label="dict.dictLabel"
-            :value="dict.dictValue"
+            v-for="item in areaList"
+            :key="item.areaId"
+            :label="item.areaName"
+            :value="item.areaId"
           />
         </el-select>
       </el-form-item>
@@ -64,58 +89,34 @@
       <el-col :span="1.5">
         <el-button
           type="primary"
-
           icon="el-icon-plus"
           size="mini"
           @click="handleAdd"
           v-hasPermi="['system:post:add']"
         >添加经销商</el-button>
       </el-col>
-     <!-- <el-col :span="1.5">
-        <el-button
-          type="success"
-          plain
-          icon="el-icon-edit"
-          size="mini"
-          :disabled="single"
-          @click="handleUpdate"
-          v-hasPermi="['system:post:edit']"
-        >修改</el-button>
-      </el-col>
-      <el-col :span="1.5">
-        <el-button
-          type="danger"
-          plain
-          icon="el-icon-delete"
-          size="mini"
-          :disabled="multiple"
-          @click="handleDelete"
-          v-hasPermi="['system:post:remove']"
-        >删除</el-button>
-      </el-col>
-      <el-col :span="1.5">
-        <el-button
-          type="warning"
-          plain
-          icon="el-icon-download"
-          size="mini"
-          :loading="exportLoading"
-          @click="handleExport"
-          v-hasPermi="['system:post:export']"
-        >导出</el-button> -->
-      </el-col>
       <right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
     </el-row>
 
     <el-table v-loading="loading" :data="postList" @selection-change="handleSelectionChange">
      <!-- <el-table-column type="selection" width="55" align="center" /> -->
-      <el-table-column label="经销商ID" align="center" prop="channelId" />
+      <el-table-column label="经销商ID" prop="channelId" />
       <el-table-column label="经销商名称" align="center" prop="name" />
       <el-table-column label="手机号码" align="center" prop="mobile" />
       <el-table-column label="佣金比例" align="center" prop="commRate" />
       <el-table-column label="用户数" align="center" prop="userCnt" />
-      <el-table-column label="认证状态" align="center" prop="certifyStatus" />
-      <el-table-column label="状态" align="center" prop="status" :formatter="statusFormat" />
+      <el-table-column label="认证状态" align="center" prop="certifyStatus" >
+        <template slot-scope="{ row, column }">
+             <span v-if="getValue(row.certifyStatus) == 'y'" style="color: blue;"> {{getDesc(row.certifyStatus)}}</span>
+             <span v-if="getValue(row.certifyStatus) == 'n'" style="color: red;"> {{getDesc(row.certifyStatus)}}</span>
+         </template>
+      </el-table-column>
+      <el-table-column label="状态" align="center" prop="status"  >
+         <template slot-scope="{ row, column }">
+             <span v-if="getValue(row.status) == 1" style="color: blue;"> {{getDesc(row.status)}}</span>
+             <span v-if="getValue(row.status) == 0" style="color: red;"> {{getDesc(row.status)}}</span>
+         </template>
+      </el-table-column>
      <!-- <el-table-column label="创建时间" align="center" prop="createTime" width="180">
         <template slot-scope="scope">
           <span>{{ parseTime(scope.row.createTime) }}</span>
@@ -126,17 +127,21 @@
           <el-button
             size="mini"
             type="text"
-            icon="el-icon-edit"
             @click="handleUpdate(scope.row)"
             v-hasPermi="['system:post:edit']"
-          >修改</el-button>
+          >查看</el-button>
+          <el-button
+            size="mini"
+            type="text"
+            @click="handleUpdate(scope.row)"
+            v-hasPermi="['system:post:edit']"
+          >编辑</el-button>
           <el-button
             size="mini"
             type="text"
-            icon="el-icon-delete"
             @click="handleDelete(scope.row)"
             v-hasPermi="['system:post:remove']"
-          >删除</el-button>
+          >停用</el-button>
         </template>
       </el-table-column>
     </el-table>
@@ -144,8 +149,8 @@
     <pagination
       v-show="total>0"
       :total="total"
-      :page.sync="queryParams.pageNum"
-      :limit.sync="queryParams.pageSize"
+      :page.sync="pageParams.pageNum"
+      :limit.sync="pageParams.pageSize"
       @pagination="getList"
     />
 
@@ -165,43 +170,13 @@
       :edit-id="editId"
       @close="hideDialog"
     />
-
-
-    <!-- 添加或修改岗位对话框 -->
-<!--    <el-dialog :title="title" :visible.sync="open" width="500px" append-to-body>
-      <el-form ref="form" :model="form" :rules="rules" label-width="80px">
-        <el-form-item label="岗位名称" prop="postName">
-          <el-input v-model="form.postName" placeholder="请输入岗位名称" />
-        </el-form-item>
-        <el-form-item label="岗位编码" prop="postCode">
-          <el-input v-model="form.postCode" placeholder="请输入编码名称" />
-        </el-form-item>
-        <el-form-item label="岗位顺序" prop="postSort">
-          <el-input-number v-model="form.postSort" controls-position="right" :min="0" />
-        </el-form-item>
-        <el-form-item label="岗位状态" prop="status">
-          <el-radio-group v-model="form.status">
-            <el-radio
-              v-for="dict in statusOptions"
-              :key="dict.dictValue"
-              :label="dict.dictValue"
-            >{{dict.dictLabel}}</el-radio>
-          </el-radio-group>
-        </el-form-item>
-        <el-form-item label="备注" prop="remark">
-          <el-input v-model="form.remark" type="textarea" placeholder="请输入内容" />
-        </el-form-item>
-      </el-form>
-      <div slot="footer" class="dialog-footer">
-        <el-button @click="cancel">取 消</el-button>
-        <el-button type="primary" @click="submitForm">确 定</el-button>
-      </div>
-    </el-dialog> -->
   </div>
 </template>
 
 <script>
 import { listPost, getPost, delPost, addPost, updatePost, exportPost } from "@/api/system/post";
+import { listAllChannel} from "@/api/admin/channel";
+import { listAreaByPid} from "@/api/admin/area";
 import { listSaleSite, updateSaleSiteStatus} from "@/api/admin/salesite";
 import SiteCreate from './components/Create'
 import SiteDetail from './components/Detail'
@@ -225,6 +200,12 @@ export default {
       exportLoading: false,
       // 选中数组
       ids: [],
+      // 上级渠道列表
+      channelList:[],
+      channelCopyList:[],
+      provinceList:[],
+      cityList:[],
+      areaList:[],
       // 非单个禁用
       single: true,
       // 非多个禁用
@@ -243,9 +224,12 @@ export default {
       statusOptions: [],
       // 查询参数
       queryParams: {
-        postCode: undefined,
-        postName: undefined,
-        status: undefined
+        parentId: "",
+        name: "",
+        mobile: "",
+        provinceId:"",
+        cityId:"",
+        areaId:""
       },
       pageParams: {
         pageNum: 1,
@@ -267,6 +251,10 @@ export default {
       }
     };
   },
+  mounted() {
+    this.getChannelList()
+    this.getProvinceList()
+  },
   created() {
     this.getList();
     this.getDicts("sys_normal_disable").then(response => {
@@ -283,10 +271,79 @@ export default {
         this.loading = false;
       });
     },
+    // 获取上级渠道下拉列表
+    getChannelList(){
+      listAllChannel().then(response => {
+         this.channelList = response.data || [];
+         this.channelCopyList = response.data || [];
+      });
+    },
+
+    // 省
+    getProvinceList(){
+      this.cityList = []
+      this.areaList = []
+      this.queryParams.cityId = ""
+      this.queryParams.areaId = ""
+      listAreaByPid(0).then(response => {
+        console.log("getProvinceList"+JSON.stringify(response))
+         this.provinceList = response || [];
+      });
+    },
+
+    getCityList(){
+      this.cityList = []
+      this.areaList = []
+      this.queryParams.cityId = ""
+      this.queryParams.areaId = ""
+      var provinceId = this.queryParams.provinceId
+      listAreaByPid(provinceId).then(response => {
+        console.log("getCityList"+JSON.stringify(response))
+         this.cityList = response || [];
+      });
+    },
+
+    getAreaList(){
+      var cityId = this.queryParams.cityId
+      listAreaByPid(cityId).then(response => {
+        console.log("getAreaList"+JSON.stringify(response))
+         this.areaList = response || [];
+      });
+    },
+
+
+    dataFilter(val) {
+      this.value = val;
+      if (val) { //val存在
+        this.channelList = this.channelCopyList.filter((item) => {
+          // console.log("dataFilter item"+JSON.stringify(item))
+          if (!!~item.mobile.indexOf(val) || !!~item.mobile.toUpperCase().indexOf(val.toUpperCase())) {
+             return true
+          }
+        })
+      } else { //val为空时,还原数组
+        this.channelList = this.channelCopyList;
+      }
+    },
+
+
     // 岗位状态字典翻译
     statusFormat(row, column) {
       return this.selectDictLabel(this.statusOptions, row.status);
     },
+
+    getDesc(val) {
+      // console.log("val == "+val);
+      const dataObj = JSON.parse(val);
+      return (dataObj && dataObj.desc) || "";
+    },
+
+    getValue(val) {
+      // console.log("val == "+val);
+      const dataObj = JSON.parse(val);
+      return (dataObj && dataObj.value) || "";
+    },
+
     submitSuccess(){
       this.getList();
     },
@@ -310,15 +367,26 @@ export default {
         status: "0",
         remark: undefined
       };
+      this.cityList = []
+      this.areaList = []
       this.resetForm("form");
     },
     /** 搜索按钮操作 */
     handleQuery() {
+      this.channelList = this.channelCopyList;
       this.queryParams.pageNum = 1;
       this.getList();
     },
     /** 重置按钮操作 */
     resetQuery() {
+      this.queryParams= {
+         parentId: "",
+         name: "",
+         mobile: "",
+         provinceId:"",
+         cityId:"",
+         areaId:""
+      },
       this.resetForm("queryForm");
       this.handleQuery();
     },
@@ -366,7 +434,7 @@ export default {
     /** 删除按钮操作 */
     handleDelete(row) {
       const postIds = row.postId || this.ids;
-      this.$confirm('是否确认删除岗位编号为"' + postIds + '"的数据项?', "警告", {
+      this.$confirm('是否确认删除名称为"' + row.name + '"的经销商?', "警告", {
           confirmButtonText: "确定",
           cancelButtonText: "取消",
           type: "warning"