Переглянути джерело

Merge branch 'dev' into 'test'

Dev

See merge request quanshu/mp-ui-pc!1
zhong chunping 3 роки тому
батько
коміт
773380980b

+ 13 - 0
src/api/admin/area.js

@@ -0,0 +1,13 @@
+import request from '@/utils/request'
+
+// 查询Pid查询区域列表列表
+export function listAreaByPid(pid) {
+  var query = {
+    pid:pid
+  }
+  return request({
+    url: '/api/v1/mp/listByPid',
+    method: 'get',
+    params: query
+  })
+}

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

@@ -0,0 +1,61 @@
+import request from '@/utils/request'
+
+
+// 查询渠道树列表
+export function treeChannel(data) {
+  return request({
+    url: '/api/v1/mp/admin/channel/tree',
+    method: 'post',
+    data: data
+  })
+}
+
+// 查询子渠道列表
+export function listChannel(urlParams, data) {
+  return request({
+    url: '/api/v1/mp/admin/channel/list',
+    method: 'post',
+    data: data,
+    urlParams: urlParams
+  })
+}
+
+
+// 查询所有渠道列表
+export function listAllChannel() {
+  return request({
+    url: '/api/v1/mp/admin/channel/listAll',
+    method: 'post'
+  })
+}
+
+
+// 新增渠道
+export function addChannel(data) {
+  return request({
+    url: '/api/v1/mp/admin/channel/create',
+    method: 'post',
+    data: data
+  })
+}
+
+// 修改渠道
+export function updateChannel(data) {
+  return request({
+    url: '/api/v1/mp/admin/channel/update',
+    method: 'post',
+    data: data
+  })
+}
+
+
+//编辑渠道用户状态信息
+export function updateChannelStatus(data) {
+  return request({
+    url: '/api/v1/mp/admin/channel/status',
+    method: 'post',
+    data: data
+  })
+}
+
+

+ 43 - 0
src/api/admin/salesite.js

@@ -0,0 +1,43 @@
+import request from '@/utils/request'
+
+
+// 查询经销商列表
+export function listSaleSite(urlParams, data) {
+  return request({
+    url: '/api/v1/mp/admin/salesite/list',
+    method: 'post',
+    data: data,
+    urlParams: urlParams
+  })
+}
+
+
+// 新增经销商
+export function addSaleSite(data) {
+  return request({
+    url: '/api/v1/mp/admin/salesite/create',
+    method: 'post',
+    data: data
+  })
+}
+
+// 修改经销商
+export function updateSaleSite(data) {
+  return request({
+    url: '/api/v1/mp/admin/salesite/update',
+    method: 'post',
+    data: data
+  })
+}
+
+
+//编辑经销商用户状态信息
+export function updateSaleSiteStatus(data) {
+  return request({
+    url: '/api/v1/mp/admin/salesite/status',
+    method: 'post',
+    data: data
+  })
+}
+
+

+ 44 - 0
src/api/business/coupon.js

@@ -0,0 +1,44 @@
+import request from '@/utils/request'
+
+export function getCouponList(urlParams, data) {
+  return request({
+    url: '/api/v1/mp/admin/coupon/list',
+    method: 'post',
+    data,
+    urlParams
+  })
+}
+
+export function getCouponDetail(couponId) {
+  return request({
+    url: '/api/v1/mp/admin/coupon/detail',
+    method: 'post',
+    data: {
+      couponId
+    }
+  })
+}
+
+export function addCoupon(data) {
+  return request({
+    url: `/api/v1/mp/admin/coupon/${data.couponId ? 'update' : 'create'}`,
+    method: 'post',
+    data
+  })
+}
+
+export function delCoupon(couponId) {
+  return request({
+    url: '/api/v1/mp/admin/coupon/delete',
+    method: 'post',
+    data: { couponId }
+  })
+}
+
+export function setCouponStatus(data) {
+  return request({
+    url: '/api/v1/mp/admin/coupon/status',
+    method: 'post',
+    data
+  })
+}

+ 44 - 0
src/api/business/goods.js

@@ -0,0 +1,44 @@
+import request from '@/utils/request'
+
+export function getGoodsList(urlParams, data) {
+  return request({
+    url: '/api/v1/mp/admin/goods/list',
+    method: 'post',
+    data,
+    urlParams
+  })
+}
+
+export function getGoodsDetail(goodsId) {
+  return request({
+    url: '/api/v1/mp/admin/goods/detail',
+    method: 'post',
+    data: {
+      goodsId
+    }
+  })
+}
+
+export function addGoods(data) {
+  return request({
+    url: `/api/v1/mp/admin/goods/${data.goodsId ? 'update' : 'create'}`,
+    method: 'post',
+    data
+  })
+}
+
+export function delGoods(goodsId) {
+  return request({
+    url: '/api/v1/mp/admin/goods/delete',
+    method: 'post',
+    data: { goodsId }
+  })
+}
+
+export function setGoodsStatus(data) {
+  return request({
+    url: '/api/v1/mp/admin/goods/status',
+    method: 'post',
+    data
+  })
+}

+ 2 - 2
src/api/common.js

@@ -23,7 +23,7 @@ export function publicFileSaveAPI(data, config = {}) {
     formData.append(key, data[key])
   })
   return request({
-    url: '/api/v1/ygp/image/remote/upload/0',
+    url: '/api/v1/mp/image/remote/upload/0',
     method: 'put',
     data: formData ,
     ...config,
@@ -42,7 +42,7 @@ export function privateFileSaveAPI(data, config = {}) {
     formData.append(key, data[key])
   })
   return request({
-    url: '/api/v1/ygp/image/remote/upload/1',
+    url: '/api/v1/mp/image/remote/upload/1',
     method: 'put',
     data: formData ,
     ...config,

+ 1 - 1
src/api/system/role.js

@@ -9,7 +9,7 @@ export function listRole(query) {
   })
 }
 
-// 查询可分配的角色(门店角色和商户角色)列表(下拉框使用)
+// 查询可分配的角色(渠道商角色和经销商角色)列表(下拉框使用)
 export function itemRole(query) {
   // console.log("itemRole query == "+JSON.stringify(query))
   return request({

+ 469 - 0
src/views/business/channel/components/Create.vue

@@ -0,0 +1,469 @@
+<template>
+  <el-dialog
+    :title="title"
+    :visible.sync="dialogVisible"
+    width="750px"
+    :append-to-body="true"
+    :before-close="close"
+    :destroy-on-close="true"
+    :close-on-click-modal="false"
+  >
+    <el-form
+      ref="form"
+      :model="form"
+      :rules="rules"
+      label-width="120px"
+      label-position="top"
+      style="max-height: 375px;overflow: auto;"
+    >
+    <flexbox class="ygp-form-items" align="flex-start" justify="flex-start">
+      <el-form-item label="渠道名称" prop="name" style="width: 50%;">
+        <el-input v-model="form.name" placeholder="请输入渠道名称" />
+      </el-form-item>
+       <el-form-item label="手机号码" prop="mobile" style="width: 50%;">
+         <el-input v-model="form.mobile" placeholder="请输入手机号码" />
+       </el-form-item>
+    </flexbox>
+      <flexbox class="ygp-form-items" align="flex-start" justify="flex-start">
+        <el-form-item label="上级渠道" prop="parentId" style="width: 50%;">
+          <el-select
+            v-model="form.parentId"
+            placeholder="请选择上级渠道"
+            style="width: 100%;"
+            filterable
+            clearable
+            :filter-method="dataFilter"
+          >
+            <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="contact" style="width: 50%;">
+         <el-input v-model="form.contact" placeholder="联系人" />
+       </el-form-item>
+      </flexbox>
+      <flexbox class="ygp-form-items" align="flex-start" justify="flex-start">
+        <el-form-item label="佣金比例" prop="commRate" style="width: 50%;">
+          <el-input v-model="form.commRate" placeholder="请输入佣金比例" />
+        </el-form-item>
+      </flexbox>
+      <flexbox class="ygp-form-items" align="flex-start" justify="flex-start">
+        <el-form-item label="省" prop="provinceId" style="width: 30%;">
+          <el-select
+            v-model="form.provinceId"
+            placeholder="选择省份"
+            clearable
+            size="small"
+            @change="getCityList()"
+            style="width: 100%;margin-right: 1px;">
+            <el-option
+              v-for="item in provinceList"
+              :key="item.areaId"
+              :label="item.areaName"
+              :value="item.areaId"
+            />
+          </el-select>
+
+        </el-form-item>
+        <el-form-item label="市" prop="cityId" style="width: 30%;">
+          <el-select
+            v-model="form.cityId"
+            placeholder="选择市"
+            clearable
+            size="small"
+             @change="getAreaList()"
+            style="width: 100%;margin-right: 1px;">
+            <el-option
+              v-for="item in cityList"
+              :key="item.areaId"
+              :label="item.areaName"
+              :value="item.areaId"
+            />
+          </el-select>
+        </el-form-item>
+        <el-form-item label="区" prop="areaId" style="width: 30%;" >
+          <el-select v-model="form.areaId"
+            placeholder="选择区"
+            clearable
+            size="small"
+            @change="getAreaName()"
+            style="width: 100%;margin-right: 1px;">
+            <el-option
+              v-for="item in areaList"
+              :key="item.areaId"
+              :label="item.areaName"
+              :value="item.areaId"
+            />
+          </el-select>
+        </el-form-item>
+      </flexbox>
+    </el-form>
+    <div slot="footer" class="dialog-footer">
+      <el-button @click="close">取 消</el-button>
+      <el-button type="primary" :disabled="loading" @click="saveClick">确 定</el-button>
+    </div>
+  </el-dialog>
+</template>
+<script>
+import { addChannel, updateChannel, listAllChannel} from "@/api/admin/channel";
+import { listAreaByPid} from "@/api/admin/area";
+import { mapGetters } from "vuex";
+import CustomFieldsMixin from "@/mixins/CustomFields";
+// import {
+//   getCollector,
+//   addCollector,
+//   updateCollector,
+//   itemTypes
+// } from "@/api/business/collector";
+// import { itemCustomer } from "@/api/business/customer";
+// import { itemStore } from "@/api/business/store";
+export default {
+  mixins: [CustomFieldsMixin],
+  props: {
+    dialogVisible: {
+      type: Boolean,
+      default: false
+    },
+    editId: [Number, String] //  编辑用
+  },
+
+  data() {
+    return {
+      loading: false,
+      // 上级渠道列表
+      channelList:[],
+      channelCopyList:[],
+      provinceList:[],
+      cityList:[],
+      areaList:[],
+      statusOptions: [],
+      // 表单参数
+      form: {},
+      detail: {},
+      // 表单校验
+      rules: {
+        name: [
+          { required: true, message: "请输入渠道名称", trigger: "blur" }
+        ],
+        mobile: [
+          { required: true, message: "请输入手机号码", trigger: "blur" },
+          {pattern: /^((\+?86)|(\(\+86\)))?1\d{10}$/, message: "请输入正确的手机号码", trigger: "blur" }
+        ],
+        parentId: [{ required: true, message: "请选择上级渠道", trigger: "change" }],
+        contact: [
+          { required: true, message: "请输入联系人", trigger: "blur" }
+        ],
+        commRate: [
+          { required: true, message: "请输入佣金比例", trigger: "blur" },
+          { pattern: /^(([1-9]{1}\d{0,99}))(\.\d{1,2})?$/, message: "佣金比例只能为大于0的数字", trigger:['blur', 'change'] },
+        ],
+        provinceId: [{ required: true, message: "请选择省", trigger: "change" }],
+        cityId: [{ required: true, message: "请选择市", trigger: "change" }],
+        areaId: [{ required: true, message: "请选择区", trigger: "change" }],
+
+      },
+      //招商推广宣传图
+      picture: []
+    };
+  },
+
+  computed: {
+    ...mapGetters(["userInfo"]),
+    title() {
+      return this.editId ? "编辑渠道" : "添加渠道";
+    }
+  },
+
+  created() {
+    //this.getCustItems();
+   // this.getTypeItems();
+    //console.log("watch dialogVisible created == ");
+    // 是编辑
+    if (this.editId) {
+     // this.getDetail();
+    }
+    this.getChannelList()
+    this.getProvinceList()
+  },
+
+  mounted() {
+    document.body.appendChild(this.$el);
+  },
+
+  destroyed() {
+    // if appendToBody is true, remove DOM node after destroy
+    if (this.appendToBody && this.$el && this.$el.parentNode) {
+      this.$el.parentNode.removeChild(this.$el);
+    }
+  },
+
+  methods: {
+
+    // 获取上级渠道下拉列表
+    getChannelList(){
+      listAllChannel().then(response => {
+        var noneObj = {
+          channelId:0,
+          name:'无(新建一级渠道)'
+          }
+          this.channelList.push(noneObj)
+        console.log("getChannelList == "+ JSON.stringify(response.data))
+         this.channelList = this.channelList.concat(response.data || []);
+         this.channelCopyList = this.channelList;
+      });
+    },
+    // 省
+    getProvinceList(){
+      this.cityList = []
+      this.areaList = []
+      this.form.cityId = ""
+      this.form.areaId = ""
+      listAreaByPid(0).then(response => {
+        console.log("getProvinceList"+JSON.stringify(response))
+         this.provinceList = response || [];
+      });
+    },
+
+    getProvinceName(){
+      let val = this.form.provinceId
+      if(val){
+        let nameObj = this.provinceList.find(item => {
+              return item.areaId == val;
+        })
+        return nameObj && nameObj.areaName
+      }
+      return ""
+    },
+
+
+    getCityList(){
+      this.cityList = []
+      this.areaList = []
+      this.form.cityId = ""
+      this.form.city = ""
+      this.form.areaId = ""
+      this.form.area = ""
+      var provinceId = this.form.provinceId
+      this.form.province = this.getProvinceName()
+      listAreaByPid(provinceId).then(response => {
+        console.log("getCityList"+JSON.stringify(response))
+         this.cityList = response || [];
+      });
+
+    },
+
+    getCityName(){
+      let val = this.form.cityId
+      if(val){
+        let nameObj = this.cityList.find(item => {
+              return item.areaId == val;
+        })
+        return nameObj && nameObj.areaName
+      }
+      return ""
+    },
+
+    getAreaList(){
+      var cityId = this.form.cityId
+      this.form.city = this.getCityName();
+      listAreaByPid(cityId).then(response => {
+        console.log("getAreaList"+JSON.stringify(response))
+         this.areaList = response || [];
+      });
+    },
+
+    getAreaName(){
+      let val = this.form.areaId
+      if(val){
+        let nameObj = this.areaList.find(item => {
+              return item.areaId == val;
+        })
+        this.form.area = nameObj && nameObj.areaName
+      }else{
+        this.form.area = "";
+      }
+    },
+
+    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;
+      }
+    },
+
+
+    // /** 查询可分配的门店 */
+    getCustItems() {
+      this.custOptions = [];
+      itemCustomer({})
+        .then(res => {
+          const resData = res.data || [];
+          this.custOptions = resData;
+        })
+        .catch(() => {
+          this.loading = false;
+        });
+    },
+
+    /**
+     * 获取项目详情
+     */
+    // getDetail() {
+    //   this.loading = true;
+    //   getCollector({
+    //     colDeviceId: this.editId
+    //   }).then(res => {
+    //       const data = res.data || {}
+    //       // console.log("getDetail :" + JSON.stringify(data))
+    //       this.detail = data
+    //       this.$set(this.form,'custId', data.custId)
+    //       this.$set(this.form,'storeId', data.storeId)
+    //       this.$set(this.form,'colAddress', data.colAddress)
+    //       const deviceCategory = JSON.parse(data.typeId || {})
+    //       this.detail.typeId = deviceCategory
+    //       this.$set(this.form,'typeId', deviceCategory.value)
+    //       this.$set(this.form,'label', data.label)
+    //       this.loading = false
+    //     })
+    //     .catch(() => {
+    //       this.loading = false;
+    //     });
+    // },
+
+
+    saveClick(){
+      // console.log("saveClick tthis.form = "+JSON.stringify(this.form))
+      this.loading = true
+      const subForm = this.$refs["form"]
+      subForm.validate(valid => {
+        if (valid) {
+          this.submitForm(this.form);
+        } else {
+          this.loading = false;
+          // 提示第一个error
+          this.getFormErrorMessage(subForm);
+          return false;
+        }
+      });
+    },
+
+    /**
+     * 保存
+     */
+    submitForm(params) {
+       console.log("submitForm =============")
+      if (this.editId) {
+        params.channelId = this.editId;
+      }
+      const request = this.editId ? updateChannel : addChannel
+      // console.log("submitForm params = "+ JSON.stringify(params))
+      request(params).then(response => {
+        this.loading = false
+        if(this.editId){
+           this.$message.success('更新成功')
+        }else{
+           this.$message.success('新增成功')
+        }
+        this.$emit('saveSuccess')
+        this.close()
+      }).catch(() => {
+        this.loading = false
+      });
+    },
+
+    /**
+     * 关闭窗口
+     */
+    close() {
+      this.$emit("close");
+      this.form = {
+        month: 3,
+        packageType: "1"
+      };
+    }
+  }
+};
+</script>
+
+<style scoped lang="scss">
+.tag {
+  margin-right: 15px;
+  width: 90px;
+  text-align: center;
+  cursor: pointer;
+}
+
+.tag-select {
+  background-color: #409eff !important;
+  border-color: #409eff !important;
+  color: #fff !important;
+}
+
+.cover-content-item {
+  width: 220px;
+  float: left;
+  position: relative;
+  .cover-img {
+    width: 200px;
+    height: 100px;
+  }
+  .cover-mark {
+    position: absolute;
+    top: 0px;
+    right: 28px;
+    z-index: 1;
+    color: red;
+    cursor: pointer;
+    visibility: hidden;
+  }
+  .select {
+    visibility: visible !important;
+  }
+}
+
+.dialog-footer {
+  text-align: center;
+}
+</style>
+
+<style lang="scss">
+.ygp-form-items {
+  .el-form-item {
+    padding: 0 5px;
+  }
+  .el-form-item__label {
+    line-height: 1.2;
+    padding-bottom: 8px;
+    word-break: break-all;
+    word-wrap: break-word;
+    color: #333;
+  }
+
+  .el-form-item__error {
+    position: relative;
+    top: auto;
+    left: auto;
+  }
+
+  .el-form-item.is-desc_text {
+    .el-form-item__label {
+      display: none;
+    }
+  }
+}
+</style>

+ 205 - 0
src/views/business/channel/components/Detail.vue

@@ -0,0 +1,205 @@
+<template>
+ <el-dialog
+    :title="title"
+    :visible.sync="dialogVisible"
+    width="750px"
+    :append-to-body="true"
+    :before-close="close"
+    :destroy-on-close="true"
+    :close-on-click-modal="false">
+   <el-form ref="form" :model="form" label-width="120px" label-position="top" style="max-height: 375px;overflow: auto;">
+     <flexbox
+         class="ygp-form-items"
+         align="flex-start"
+         justify="flex-start">
+        <el-form-item label="运营企业" prop="custId" style="width: 50%;" >
+          <span :class="loading?'el-icon-loading':''">{{detail.customer && detail.customer.name}}</span>
+        </el-form-item>
+         <el-form-item label="门店" prop="storeId" style="width: 50%;" >
+            <span :class="loading?'el-icon-loading':''">{{detail.store && detail.store.name}}</span>
+         </el-form-item>
+     </flexbox>
+     <flexbox
+         class="ygp-form-items"
+         align="flex-start"
+         justify="flex-start">
+         <el-form-item label="采集器编号" prop="colAddress" style="width: 50%;">
+             <span :class="loading?'el-icon-loading':''">{{detail.colAddress}}</span>
+         </el-form-item>
+         <el-form-item label="类型" prop="typeId" style="width: 50%;">
+           <span :class="loading?'el-icon-loading':''">{{detail.typeId && detail.typeId.desc}}</span>
+         </el-form-item>
+     </flexbox>
+     <flexbox
+          class="ygp-form-items"
+          align="flex-start"
+          justify="flex-start">
+         <el-form-item label="备注" prop="label" style="width: 100%;">
+            <span :class="loading?'el-icon-loading':''">{{detail.label}}</span>
+         </el-form-item>
+      </flexbox>
+   </el-form>
+   <div slot="footer" class="dialog-footer">
+     <el-button @click="close">关 闭</el-button>
+   </div>
+ </el-dialog>
+</template>
+<script>
+
+import { mapGetters } from 'vuex'
+import CustomFieldsMixin from '@/mixins/CustomFields'
+// import { getCollector } from "@/api/business/collector";
+export default {
+  mixins: [CustomFieldsMixin],
+  props: {
+    dialogVisible: {
+      type: Boolean,
+      default: false
+    },
+    editId: [Number, String] //  编辑用
+  },
+
+  data() {
+    return {
+      loading: false,
+      // 表单参数
+      form: {},
+      detail: {}
+    }
+  },
+
+  computed: {
+    ...mapGetters(['userInfo']),
+    title() {
+      return '采集器详情'
+    }
+  },
+
+  created() {
+    // 是编辑
+    if (this.editId) {
+      // this.getDetail()
+    }
+  },
+
+  mounted() {
+    document.body.appendChild(this.$el)
+  },
+
+  destroyed() {
+    // if appendToBody is true, remove DOM node after destroy
+    if (this.appendToBody && this.$el && this.$el.parentNode) {
+      this.$el.parentNode.removeChild(this.$el)
+    }
+  },
+
+  methods: {
+
+    /**
+     * 获取项目详情
+     */
+    getDetail() {
+      this.loading = true
+      getCollector({
+        colDeviceId: this.editId
+      }).then(res => {
+          const data = res.data || {}
+          this.detail = data
+          // console.log("getDetail :" + JSON.stringify(data))
+          this.$set(this.form,'custId', data.custId)
+          this.$set(this.form,'storeId', data.storeId)
+          this.$set(this.form,'colAddress', data.colAddress)
+          const deviceCategory = JSON.parse(data.typeId || {})
+          this.detail.typeId = deviceCategory
+          this.$set(this.form,'typeId', deviceCategory.value)
+          this.$set(this.form,'label', data.label)
+          this.loading = false
+        })
+        .catch(() => {
+          this.loading = false
+        })
+    },
+
+    /**
+     * 关闭窗口
+     */
+    close() {
+      this.$emit('close')
+      this.form = {
+        month:3,
+        packageType:'1'
+      }
+    }
+  }
+}
+</script>
+
+<style scoped lang="scss">
+.tag{
+  margin-right: 15px;
+  width: 90px;
+  text-align: center;
+  cursor: pointer;
+
+}
+
+.tag-select{
+  background-color: #409eff!important;
+  border-color: #409eff!important;
+  color: #fff!important;
+}
+
+.cover-content-item{
+  width: 220px;
+  float: left;
+  position: relative;
+  .cover-img {
+    width: 200px;
+    height: 100px;
+  }
+  .cover-mark {
+    position: absolute;
+    top: 0px;
+    right: 28px;
+    z-index: 1;
+    color: red;
+    cursor: pointer;
+    visibility: hidden;
+  }
+  .select {
+      visibility: visible!important;
+  }
+}
+
+.dialog-footer{
+  text-align: center;
+}
+
+</style>
+
+<style lang="scss">
+.ygp-form-items {
+   .el-form-item{
+     padding: 0 5px;
+   }
+  .el-form-item__label {
+    line-height: 1.2;
+    padding-bottom: 8px;
+    word-break: break-all;
+    word-wrap: break-word;
+    color: #333;
+  }
+
+  .el-form-item__error {
+    position: relative;
+    top: auto;
+    left: auto;
+  }
+
+  .el-form-item.is-desc_text {
+    .el-form-item__label {
+      display: none;
+    }
+  }
+}
+</style>

+ 432 - 0
src/views/business/channel/index.vue

@@ -0,0 +1,432 @@
+<template>
+  <div class="app-container">
+    <el-row :gutter="20">
+      <!--部门数据-->
+      <el-col :span="4" :xs="24" >
+        <div class="head-container">
+        <!--  <el-input
+            v-model="channelName"
+            placeholder="请输入渠道名称"
+            clearable
+            size="small"
+            prefix-icon="el-icon-search"
+            style="margin-bottom: 20px"
+          /> -->
+        </div>
+        <div class="head-container" style="overflow-x:scroll">
+          <el-tree
+            :props="defaultProps"
+            ref="tree"
+            :load="loadNode"
+            lazy
+            @node-click="handleNodeClick"
+          />
+        </div>
+      </el-col>
+      <!--用户数据-->
+      <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="name">
+            <el-input
+              v-model="queryParams.name"
+              placeholder="请输入渠道名称"
+              clearable
+              size="small"
+              style="width: 240px"
+              @keyup.enter.native="handleQuery"
+            />
+          </el-form-item>
+          <el-form-item label="手机号码" prop="mobile">
+            <el-input
+              v-model="queryParams.mobile"
+              placeholder="请输入手机号码"
+              clearable
+              size="small"
+              style="width: 240px"
+              @keyup.enter.native="handleQuery"
+            />
+          </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>
+          </el-form-item>
+        </el-form>
+
+        <el-row :gutter="10" class="mb8">
+          <el-col :span="1.5">
+            <el-button
+              type="primary"
+              icon="el-icon-plus"
+              size="mini"
+              @click="handleAdd"
+              v-hasPermi="['system:user:add']"
+            >添加渠道</el-button>
+          </el-col>
+          <right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
+        </el-row>
+
+        <el-table v-loading="loading" :data="channelList">
+          <el-table-column label="渠道ID" prop="channelId" width="100px" />
+          <el-table-column label="渠道名称" prop="name" show-overflow-tooltip  width="180px"/>
+          <el-table-column label="手机号码" prop="mobile" show-overflow-tooltip  width="120px"/>
+          <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="{ row, column }">
+               <span v-if="getValue(row.status) == 1" style="color: blue;"> {{getDesc(row.status)}}</span>
+               <span v-if="getValue(row.status) == 2" style="color: red;"> {{getDesc(row.status)}}</span>
+           </template>
+          </el-table-column>
+          <el-table-column
+            label="操作"
+            align="center"
+            width="200"
+            class-name="small-padding fixed-width"
+          >
+            <template slot-scope="scope" v-if="scope.row.userId !== 1">
+              <el-button
+                size="mini"
+                type="text"
+                disabled
+                @click="handleDetail(scope.row)"
+                v-hasPermi="['admin:channel:read']"
+              >查看</el-button>
+              <el-button
+                size="mini"
+                type="text"
+                disabled
+                @click="handleUpdate(scope.row)"
+                v-hasPermi="['admin:channel:edit']"
+              >编辑</el-button>
+              <el-button
+                size="mini"
+                type="text"
+                @click="handleStatusChange(scope.row)"
+                v-hasPermi="['admin:channel:edit']"
+              >
+              <span v-if="getValue(scope.row.status) == 1"> 停用</span>
+              <span v-if="getValue(scope.row.status) == 2"> 启用</span>
+              </el-button>
+              <el-button
+                size="mini"
+                type="text"
+                disabled
+                icon="el-icon-plus"
+                @click="handleAdd(scope.row)"
+                v-hasPermi="['admin:channel:add']"
+              >添加子渠道</el-button>
+            </template>
+          </el-table-column>
+        </el-table>
+
+        <pagination
+          v-show="total>0"
+          :total="total"
+          :page.sync="pageParams.pageNum"
+          :limit.sync="pageParams.pageSize"
+          @pagination="getList"
+        />
+      </el-col>
+    </el-row>
+    <!-- 新建 -->
+    <channel-create
+      v-if="createShow"
+      :dialog-visible="createShow"
+      :edit-id="editId"
+      @saveSuccess="submitSuccess"
+      @close="hideDialog"
+    />
+
+    <!-- 详情 -->
+    <channel-detail
+      v-if="detailShow"
+      :dialog-visible="detailShow"
+      :edit-id="editId"
+      @close="hideDialog"
+    />
+
+  </div>
+</template>
+
+<script>
+import { getToken } from "@/utils/auth";
+import { treeChannel, listChannel, updateChannelStatus} from "@/api/admin/channel";
+import { listAreaByPid} from "@/api/admin/area";
+import Treeselect from "@riophae/vue-treeselect";
+import "@riophae/vue-treeselect/dist/vue-treeselect.css";
+import ChannelCreate from './components/Create'
+import ChannelDetail from './components/Detail'
+export default {
+  name: "ChannelIndex",
+  components: {
+    Treeselect,
+    ChannelCreate,
+    ChannelDetail
+  },
+  data() {
+    return {
+      // 遮罩层
+      loading: true,
+      // 导出遮罩层
+      exportLoading: false,
+      // 选中数组
+      ids: [],
+      // 创建编辑
+      createShow: false,
+      // 详情
+      detailShow: false,
+      provinceList:[],
+      cityList:[],
+      areaList:[],
+      // 编辑项ID
+      editId: null,
+      // 显示搜索条件
+      showSearch: true,
+      // 总条数
+      total: 0,
+      // 用户表格数据
+      channelList: null,
+
+      channelName:"",
+      // 状态数据字典
+      statusOptions: [],
+      // 表单参数
+      form: {},
+      defaultProps: {
+        children: "children",
+        label: "name"
+      },
+      // 查询参数
+      queryParams: {
+        name: "",
+        mobile: "",
+        provinceId:"",
+        cityId:"",
+        areaId:""
+      },
+      pageParams: {
+        pageNum: 1,
+        pageSize: 10
+      }
+    };
+  },
+  watch: {
+    // 根据渠道名称筛选渠道树
+    channelName(val) {
+      this.$refs.tree.filter(val);
+    }
+  },
+  mounted() {
+     this.getProvinceList()
+  },
+  created() {
+    this.getList();
+  },
+  methods: {
+    /** 查询用户列表 */
+    getList() {
+      this.loading = true;
+      listChannel('pageNum='+this.pageParams.pageNum + '&pageSize='+this.pageParams.pageSize+'&', this.queryParams).then(response => {
+          this.channelList = response.rows;
+          this.total = response.total;
+          this.loading = false;
+        }
+      );
+    },
+    // 节点单击事件
+    handleNodeClick(data) {
+      this.queryParams.parentId = data.channelId;
+      this.getList();
+    },
+    // 懒加载节点
+    loadNode(node, resolve) {
+      if(node.level === 0){
+       treeChannel({}).then(response => {
+          return resolve(response.data);
+       });
+      }else{
+        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) {
+      var newStatus = this.getValue(row.status) == 2?1:2
+      let text = this.getValue(row.status) == 2 ? "启用" : "停用";
+      this.$confirm('确认要"' + text + '""' + row.name + '"渠道吗?', "警告", {
+          confirmButtonText: "确定",
+          cancelButtonText: "取消",
+          type: "warning"
+        }).then(function() {
+          var params={
+            channelId:row.channelId,
+            status: newStatus
+          }
+          return updateChannelStatus(params);
+        }).then(() => {
+          this.msgSuccess(text + "成功");
+          this.getList();
+        }).catch(function() {
+          // row.status = row.status === "0" ? "1" : "0";
+        });
+    },
+
+    /** 搜索按钮操作 */
+    handleQuery() {
+      this.queryParams.pageNum = 1;
+      this.getList();
+    },
+    /** 重置按钮操作 */
+    resetQuery() {
+      this.queryParams= {
+        pageNum: 1,
+        pageSize: 10,
+         name: "",
+         mobile: "",
+         provinceId:"",
+         cityId:"",
+         areaId:""
+      },
+      this.resetForm("queryForm");
+      this.handleQuery();
+    },
+    handleDetail(row){
+
+    },
+    /** 新增按钮操作 */
+    handleAdd() {
+      this.createShow = true
+      this.editId = null
+    },
+    /** 修改按钮操作 */
+    handleUpdate(row) {
+
+    },
+    // 保存后的操作
+    submitSuccess(){
+      this.getList();
+    },
+    /**关闭弹窗*/
+    hideDialog(){
+      this.createShow = false
+      this.detailShow = false
+    },
+
+    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) || "";
+    },
+
+    /** 删除按钮操作 */
+    handleDelete(row) {
+      const channelId = row.channelId;
+      // this.$confirm('是否确认删除编号为"' + channelId + '"的数据项?', "警告", {
+      //     confirmButtonText: "确定",
+      //     cancelButtonText: "取消",
+      //     type: "warning"
+      //   }).then(function() {
+      //     return delUser(userIds);
+      //   }).then(() => {
+      //     this.getList();
+      //     this.msgSuccess("删除成功");
+      //   }).catch(() => {});
+    }
+  }
+};
+</script>
+<style lang="sass" scoped>
+
+</style>

+ 107 - 0
src/views/business/coupon/add.vue

@@ -0,0 +1,107 @@
+<template>
+  <div class="app-container coupon-add">
+    <el-row>
+      <el-col :span="23">
+        <el-form ref="addItem" :model="addData" :rules="rules" label-width="160px">
+          <el-form-item label="代金券名称:" prop="title">
+            <el-input v-model="addData.title" placeholder="请输入代金券名称" :maxlength="32" show-word-limit />
+          </el-form-item>
+          <!-- <el-form-item label="主图:" prop="mainImg">
+            <Upload v-model="addData.mainImg" :accept="accept" :limit="isVideoMode? 1:3" :type="4"/>
+            <div class="tip" style="font-size: 12px;color: #777"> 可选上传3张图片 或 1个视频(限.mp4格式)。</div>
+          </el-form-item> -->
+          <el-form-item label="面值:" prop="discount">
+            <el-input v-model.number="addData.discount" type="number" placeholder="请输入代金券面值">
+              <template slot="append">元</template>
+            </el-input>
+          </el-form-item>
+          <el-form-item label="门店默认承担比例:" prop="bili">
+            <el-input v-model.number="addData.amount" type="number" placeholder="请输入面值">
+              <template slot="append">%</template>
+            </el-input>
+          </el-form-item>
+          <el-form-item label="最低消费金额:" prop="discount">
+            <el-input v-model.number="addData.discount" type="number" placeholder="请输入可使用的最低消费金额">
+              <template slot="append">元</template>
+            </el-input>
+          </el-form-item>
+          <el-form-item label="有效期类型:" prop="contactTel">
+            <el-input v-model="addData.contactTel" placeholder="请输入有效期类型">
+              <template slot="prepend">领取之日起</template>
+              <template slot="append">天有效</template>
+            </el-input>
+          </el-form-item>
+          <el-form-item label="使用说明:" prop="detailAddress">
+            <el-input type="textarea" rows="4" v-model="addData.detailAddress" placeholder="使用说明仅用户可见"/>
+          </el-form-item>
+          <el-form-item label="使用范围:" prop="detailAddress">
+            <el-radio-group v-model="radio">
+              <el-radio :label="1">进票门店</el-radio>
+              <el-radio :label="2">所有盲票</el-radio>
+              <el-radio :label="3">制定盲票</el-radio>
+            </el-radio-group>
+          </el-form-item>
+        </el-form>
+      </el-col>
+    </el-row>
+    <el-row>
+      <el-col :span="23" style="text-align: right">
+        <el-button type="info" @click="$router.go(-1)">取消</el-button>
+        <el-button :loading="addIng" type="primary" @click="update()">保存</el-button>
+      </el-col>
+    </el-row>
+  </div>
+</template>
+<script>
+
+export default {
+  name: 'CouponAdd',
+  data() {
+    return {
+      id: this.$route.query.id,
+      addData: {},
+      addIng: false,
+      rules: {
+        title: [
+          { required: true, message: '请输入代金券名称', trigger: 'blur' }
+        ],
+      }
+    }
+  },
+  created() {
+    if (this.id) {
+      getCouponDetail(this.id).then(res => {
+        this.addData = res.data
+      })
+    }
+  },
+  methods: {
+    update() {
+      this.$refs.addItem.validate((valid, items) => {
+        if (valid) {
+          this.addIng = true
+          action(this.addData).then(res => {
+            this.addIng = false
+            if (res.code === 0) {
+              this.$message({
+                message: this.addData.id ? '修改成功!' : '添加成功!',
+                type: 'success'
+              })
+              this.$router.go(-1)
+            }
+          }).catch(() => {
+            this.addIng = false
+          })
+        } else {
+          if (items && Object.keys(items).length > 0) {
+            this.$message({
+              message: items[Object.keys(items)[0]][0].message,
+              type: 'warning'
+            })
+          }
+        }
+      })
+    }
+  }
+}
+</script>

+ 93 - 0
src/views/business/coupon/index.vue

@@ -0,0 +1,93 @@
+<template>
+  <div class="app-container coupon-list">
+    <el-form v-show="showSearch" :model="queryParams" ref="queryForm" :inline="true" size="small">
+      <el-form-item label="代金券名称" prop="title">
+        <el-input
+          v-model="queryParams.title"
+          placeholder="请输入代金券名称"
+          clearable
+          @keyup.enter.native="queryParams.pageNum = 1;getList()"
+        />
+      </el-form-item>
+      <el-form-item label="状态" prop="status">
+        <el-select v-model="queryParams.status" placeholder="请选择代金券状态" clearable>
+          <el-option label="上架" value="1" />
+          <el-option label="下架" value="2" />
+        </el-select>
+      </el-form-item>
+      <el-form-item>
+        <el-button type="primary" icon="el-icon-search" @click="queryParams.pageNum = 1;getList()">搜索</el-button>
+        <el-button icon="el-icon-refresh" @click="getList(true)">重置</el-button>
+      </el-form-item>
+    </el-form>
+    <el-row :gutter="10" class="mb8">
+      <el-col :span="10">
+        <el-button
+          type="primary"
+          icon="el-icon-plus"
+          size="mini"
+          @click="$router.push('/coupon/add')"
+          v-hasPermi="['business:coupon:add']"
+        >添加门店代金券</el-button>
+      </el-col>
+      <right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
+    </el-row>
+    <el-table v-loading="loading" :data="tableData">
+      <el-table-column label="代金券ID" prop="id" min-width="70" />
+      <el-table-column label="代金券名称" prop="title" />
+      <el-table-column label="代金券金额" prop="amount" />
+      <el-table-column label="已领取数量" prop="quiety" />
+      <el-table-column label="有效期限" prop="lastMessageTime" />
+      <el-table-column label="状态" prop="status">
+        <template slot-scope="{row}">
+          {{ JSON.parse(row.status).desc }}
+        </template>
+      </el-table-column>
+      <el-table-column fixed="right" align="right" label="操作" width="120">
+        <template slot-scope="{row}">
+          <el-button type="text">查看</el-button>
+          <el-button type="text">下架</el-button>
+          <!-- <el-button type="text">门店承担比例</el-button> -->
+        </template>
+      </el-table-column>
+    </el-table>
+    <pagination :total="total" :page.sync="queryParams.pageNum" :limit.sync="queryParams.pageSize" @pagination="getList()" />
+  </div>
+</template>
+<script>
+import { getCouponList } from '@/api/business/coupon'
+export default {
+  name: 'CouponList',
+  data() {
+    return {
+      loading: false,
+      showSearch: true,
+      queryParams: {},
+      total: 0
+    }
+  },
+  created() {
+    this.getList(true)
+  },
+  methods: {
+    getList(reset) {
+      if (this.loading) {
+        return
+      }
+      this.loading = true
+      if (reset) {
+        this.queryParams = { pageNum: 1, pageSize: 20 }
+      }
+      getCouponList('pageNum='+this.queryParams.pageNum + '&pageSize='+this.queryParams.pageSize+'&', this.queryParams).then(res => {
+        this.loading = false
+        if (res.code === 0) {
+          this.tableData = res.rows
+          this.total = res.total
+        }
+      }).catch(() => {
+        this.loading = false
+      })
+    }
+  }
+}
+</script>

+ 101 - 0
src/views/business/goods/index.vue

@@ -0,0 +1,101 @@
+<template>
+  <div class="app-container coupon-list">
+    <el-form v-show="showSearch" :model="queryParams" ref="queryForm" :inline="true" size="small">
+      <el-form-item label="商品名称" prop="title">
+        <el-input
+          v-model="queryParams.title"
+          placeholder="请输入商品名称"
+          clearable
+          @keyup.enter.native="queryParams.pageNum = 1;getList()"
+        />
+      </el-form-item>
+      <el-form-item label="商品ID" prop="goodsId">
+        <el-input
+          v-model="queryParams.goodsId"
+          placeholder="请输入商品名称"
+          clearable
+          @keyup.enter.native="queryParams.pageNum = 1;getList()"
+        />
+      </el-form-item>
+      <el-form-item label="上架状态" prop="status">
+        <el-select v-model="queryParams.status" placeholder="请选择商品状态" clearable>
+          <el-option label="上架" value="1" />
+          <el-option label="下架" value="2" />
+        </el-select>
+      </el-form-item>
+      <el-form-item>
+        <el-button type="primary" icon="el-icon-search" @click="queryParams.pageNum = 1;getList()">搜索</el-button>
+        <el-button icon="el-icon-refresh" @click="getList(true)">重置</el-button>
+      </el-form-item>
+    </el-form>
+    <el-row :gutter="10" class="mb8">
+      <el-col :span="10">
+        <el-button v-hasPermi="['business:goods:add']" type="primary" icon="el-icon-plus" size="mini" @click="$router.push('/goods/add')">添加商品</el-button>
+        <el-button v-hasPermi="['business:goods:on']" type="primary" plain size="mini">上架</el-button>
+        <el-button v-hasPermi="['business:goods:off']" type="primary" plain size="mini">下架</el-button>
+        <el-button v-hasPermi="['business:goods:remove']" type="danger" plain size="mini">删除</el-button>
+      </el-col>
+      <right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
+    </el-row>
+    <el-table v-loading="loading" :data="tableData">
+      <el-table-column label="商品ID" prop="id" min-width="70" />
+      <el-table-column label="商品图片" prop="title" />
+      <el-table-column label="商品名称" prop="title" />
+      <el-table-column label="价格" prop="amount" />
+      <el-table-column label="兑换盲豆" prop="quiety" />
+      <el-table-column label="销量" prop="lastMessageTime" />
+      <el-table-column label="库存" prop="lastMessageTime" />
+      <el-table-column label="状态" prop="status">
+        <template slot-scope="{row}">
+          {{ JSON.parse(row.status).desc }}
+        </template>
+      </el-table-column>
+      <el-table-column label="排序" prop="lastMessageTime" />
+      <el-table-column fixed="right" align="right" label="操作" width="140">
+        <template slot-scope="{row}">
+          <el-button v-hasPermi="['business:goods:query']" type="text">查看</el-button>
+          <el-button v-hasPermi="['business:goods:edit']" type="text">编辑</el-button>
+          <el-button v-hasPermi="['business:goods:off']" type="text">下架</el-button>
+        </template>
+      </el-table-column>
+    </el-table>
+    <pagination :total="total" :page.sync="queryParams.pageNum" :limit.sync="queryParams.pageSize" @pagination="getList()" />
+  </div>
+</template>
+<script>
+import { getGoodsList } from '@/api/business/goods'
+export default {
+  name: 'GoodsList',
+  data() {
+    return {
+      loading: false,
+      showSearch: true,
+      queryParams: {},
+      total: 0
+    }
+  },
+  created() {
+    this.getList(true)
+  },
+  methods: {
+    getList(reset) {
+      if (this.loading) {
+        return
+      }
+      this.loading = true
+      if (reset) {
+        this.queryParams = { pageNum: 1, pageSize: 20 }
+      }
+      getGoodsList('pageNum='+this.queryParams.pageNum + '&pageSize='+this.queryParams.pageSize+'&', this.queryParams).then(res => {
+        this.loading = false
+        if (res.code === 0) {
+          this.tableData = res.rows
+          this.total = res.total
+        }
+      }).catch(() => {
+        this.loading = false
+      })
+    }
+  }
+}
+</script>

+ 436 - 0
src/views/business/salesite/components/Create.vue

@@ -0,0 +1,436 @@
+<template>
+  <el-dialog
+    :title="title"
+    :visible.sync="dialogVisible"
+    width="750px"
+    :append-to-body="true"
+    :before-close="close"
+    :destroy-on-close="true"
+    :close-on-click-modal="false"
+  >
+    <el-form
+      ref="form"
+      :model="form"
+      :rules="rules"
+      label-width="120px"
+      label-position="top"
+      style="max-height: 375px;overflow: auto;"
+    >
+    <flexbox class="ygp-form-items" align="flex-start" justify="flex-start">
+      <el-form-item label="经销商名称" prop="colAddress" style="width: 50%;">
+        <el-input v-model="form.colAddress" placeholder="请输入采集器编号" v-if="!editId" />
+        <span v-else :class="loading?'el-icon-loading':''">{{detail.colAddress}}</span>
+      </el-form-item>
+       <el-form-item label="手机号码" prop="colAddress" style="width: 50%;">
+         <el-input v-model="form.colAddress" placeholder="请输入采集器编号" v-if="!editId" />
+         <span v-else :class="loading?'el-icon-loading':''">{{detail.colAddress}}</span>
+       </el-form-item>
+    </flexbox>
+      <flexbox class="ygp-form-items" align="flex-start" justify="flex-start">
+        <el-form-item label="上级渠道" prop="custId" style="width: 50%;">
+          <el-select
+            v-if="!editId"
+            v-model="form.custId"
+            placeholder="请选择客户"
+            style="width: 100%;"
+            filterable
+            clearable
+            @change="getCustStoreItem"
+          >
+            <el-option
+              v-for="(item, index) in custOptions"
+              :key="index"
+              :label="item.name"
+              :value="item.custId"
+            />
+          </el-select>
+          <span v-else :class="loading?'el-icon-loading':''">{{detail.customer && detail.customer.name}}</span>
+        </el-form-item>
+       <el-form-item label="联系人" prop="colAddress" style="width: 50%;">
+         <el-input v-model="form.colAddress" placeholder="请输入采集器编号" v-if="!editId" />
+         <span v-else :class="loading?'el-icon-loading':''">{{detail.colAddress}}</span>
+       </el-form-item>
+      </flexbox>
+      <flexbox class="ygp-form-items" align="flex-start" justify="flex-start">
+        <el-form-item label="佣金比例" prop="colAddress" style="width: 50%;">
+          <el-input v-model="form.colAddress" placeholder="请输入采集器编号" v-if="!editId" />
+          <span v-else :class="loading?'el-icon-loading':''">{{detail.colAddress}}</span>
+        </el-form-item>
+        <el-form-item label="经销商类型" prop="typeId" style="width: 50%;">
+          <el-select
+            v-if="!editId"
+            v-model="form.typeId"
+            placeholder="请选择类型"
+            style="width: 100%;"
+            filterable
+            clearable
+            :disabled="editId?true:false"
+          >
+            <el-option
+              v-for="(item, index) in typeOptions"
+              :key="index"
+              :label="item.desc"
+              :value="item.typeId"
+            />
+          </el-select>
+          <span v-else :class="loading?'el-icon-loading':''">{{detail.typeId && detail.typeId.desc}}</span>
+        </el-form-item>
+      </flexbox>
+
+      <flexbox class="ygp-form-items" align="flex-start" justify="flex-start">
+        <el-form-item label="地区" style="width: 50%;">
+          <el-select v-model="form.status" placeholder="选择省份" clearable size="small" style="width: 33%;margin-right: 1px;">
+            <el-option
+              v-for="dict in statusOptions"
+              :key="dict.dictValue"
+              :label="dict.dictLabel"
+              :value="dict.dictValue"
+            />
+          </el-select>
+          <el-select v-model="form.status" placeholder="选择市" clearable size="small" style="width: 33%;margin-right: 1px;">
+            <el-option
+              v-for="dict in statusOptions"
+              :key="dict.dictValue"
+              :label="dict.dictLabel"
+              :value="dict.dictValue"
+            />
+          </el-select>
+          <el-select v-model="form.status" placeholder="选择区" clearable size="small" style="width: 33%;margin-right: 1px;">
+            <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="详细地址" prop="colAddress" style="width: 50%;">
+          <el-input v-model="form.colAddress" placeholder="请输入采集器编号" v-if="!editId" />
+          <span v-else :class="loading?'el-icon-loading':''">{{detail.colAddress}}</span>
+        </el-form-item>
+      </flexbox>
+      <flexbox
+          class="ygp-form-items"
+          align="flex-start"
+          justify="flex-start">
+         <el-form-item label="营业执照" prop="rentContract" style="width: 50%;">
+          <image-upload
+            :limit="7"
+            :value="rentContract"
+            :file-size="50"
+            :is-public="false"
+            :show-file-list="true"
+            :auto-upload="false"
+             @input="rentContractSelect"
+          />
+         </el-form-item>
+         <el-form-item label="门头照片" prop="rentContract" style="width: 50%;">
+          <image-upload
+            :limit="7"
+            :value="rentContract"
+            :file-size="50"
+            :is-public="false"
+            :show-file-list="true"
+            :auto-upload="false"
+             @input="rentContractSelect"
+          />
+         </el-form-item>
+      </flexbox>
+      <flexbox class="ygp-form-items" align="flex-start" justify="flex-start">
+         <el-form-item label="认证状态" prop="colAddress" style="width: 50%;">
+           <el-input v-model="form.colAddress" placeholder="请输入采集器编号" v-if="!editId" />
+           <span v-else :class="loading?'el-icon-loading':''">{{detail.colAddress}}</span>
+         </el-form-item>
+      </flexbox>
+     <!-- <flexbox class="ygp-form-items" align="flex-start" justify="flex-start">
+        <el-form-item label="备注" prop="label" style="width: 100%;">
+          <el-input
+            type="textarea"
+            :rows="3"
+            :autosize="{ minRows: 3}"
+            :maxlength="64"
+            show-word-limit
+            resize="none"
+            v-model="form.label"
+            placeholder="请输入备注"
+          />
+        </el-form-item>
+      </flexbox> -->
+    </el-form>
+    <div slot="footer" class="dialog-footer">
+      <el-button @click="close">取 消</el-button>
+      <el-button type="primary" :disabled="loading" @click="saveClick">确 定</el-button>
+    </div>
+  </el-dialog>
+</template>
+<script>
+import { mapGetters } from "vuex";
+import CustomFieldsMixin from "@/mixins/CustomFields";
+// import {
+//   getCollector,
+//   addCollector,
+//   updateCollector,
+//   itemTypes
+// } from "@/api/business/collector";
+// import { itemCustomer } from "@/api/business/customer";
+// import { itemStore } from "@/api/business/store";
+export default {
+  mixins: [CustomFieldsMixin],
+  props: {
+    dialogVisible: {
+      type: Boolean,
+      default: false
+    },
+    editId: [Number, String] //  编辑用
+  },
+
+  data() {
+    return {
+      loading: false,
+      statusOptions: [],
+      // 表单参数
+      form: {},
+      detail: {},
+      feeItems: [],
+      checkedItems: [],
+      custOptions: [],
+      storeOptions: [],
+      typeOptions: [],
+      // 表单校验
+      rules: {
+        custId: [{ required: true, message: "请选择客户", trigger: "change" }],
+        storeId: [{ required: true, message: "请选择门店", trigger: "change" }],
+        colAddress: [
+          { required: true, message: "请输入采集器编号", trigger: "blur" }
+        ],
+        typeId: [
+          { required: true, message: "请选择设备类型", trigger: "change" }
+        ],
+        label: [{ required: false, message: "请输入备注", trigger: "blur" }]
+      },
+      //招商推广宣传图
+      picture: []
+    };
+  },
+
+  computed: {
+    ...mapGetters(["userInfo"]),
+    title() {
+      return this.editId ? "编辑经销商" : "添加经销商";
+    }
+  },
+
+  created() {
+    //this.getCustItems();
+   // this.getTypeItems();
+    //console.log("watch dialogVisible created == ");
+    // 是编辑
+    if (this.editId) {
+     // this.getDetail();
+    }
+  },
+
+  mounted() {
+    document.body.appendChild(this.$el);
+  },
+
+  destroyed() {
+    // if appendToBody is true, remove DOM node after destroy
+    if (this.appendToBody && this.$el && this.$el.parentNode) {
+      this.$el.parentNode.removeChild(this.$el);
+    }
+  },
+
+  methods: {
+    // /** 查询可分配的门店 */
+    getCustItems() {
+      this.custOptions = [];
+      itemCustomer({})
+        .then(res => {
+          const resData = res.data || [];
+          this.custOptions = resData;
+        })
+        .catch(() => {
+          this.loading = false;
+        });
+    },
+
+    // /** 查询可分配的门店 */
+    getCustStoreItem() {
+      this.storeOptions = [];
+      this.$set(this.form, "storeId", "");
+      itemStore({
+        custId: this.form.custId
+      })
+        .then(res => {
+          const resData = res.data || [];
+          this.storeOptions = resData;
+        })
+        .catch(() => {
+          this.loading = false;
+        });
+    },
+
+    // /** 查询可分配的门店 */
+    getTypeItems() {
+      this.typeOptions = [];
+      itemTypes({})
+        .then(res => {
+          const resData = res.data || [];
+          this.typeOptions = resData;
+        })
+        .catch(() => {
+          this.loading = false;
+        });
+    },
+
+    /**
+     * 获取项目详情
+     */
+    getDetail() {
+      this.loading = true;
+      getCollector({
+        colDeviceId: this.editId
+      }).then(res => {
+          const data = res.data || {}
+          // console.log("getDetail :" + JSON.stringify(data))
+          this.detail = data
+          this.$set(this.form,'custId', data.custId)
+          this.$set(this.form,'storeId', data.storeId)
+          this.$set(this.form,'colAddress', data.colAddress)
+          const deviceCategory = JSON.parse(data.typeId || {})
+          this.detail.typeId = deviceCategory
+          this.$set(this.form,'typeId', deviceCategory.value)
+          this.$set(this.form,'label', data.label)
+          this.loading = false
+          // if(this.editId){
+          //   this.getCustStoreItem()
+          // }
+        })
+        .catch(() => {
+          this.loading = false;
+        });
+    },
+
+
+    saveClick(){
+      // console.log("saveClick tthis.form = "+JSON.stringify(this.form))
+      this.loading = true
+      const subForm = this.$refs["form"]
+      subForm.validate(valid => {
+        if (valid) {
+          this.submitForm(this.form);
+        } else {
+          this.loading = false;
+          // 提示第一个error
+          this.getFormErrorMessage(subForm);
+          return false;
+        }
+      });
+    },
+
+    /**
+     * 保存
+     */
+    submitForm(params) {
+      // console.log("submitForm =============")
+      if (this.editId) {
+        params.colDeviceId = this.editId;
+      }
+      const request = this.editId ? updateCollector : addCollector
+      // console.log("submitForm params = "+ JSON.stringify(params))
+      request(params).then(response => {
+        this.loading = false
+        if(this.editId){
+           this.$message.success('更新成功')
+        }else{
+           this.$message.success('新增成功')
+        }
+        this.$emit('saveSuccess')
+        this.close()
+      }).catch(() => {
+        this.loading = false
+      });
+    },
+
+    /**
+     * 关闭窗口
+     */
+    close() {
+      this.$emit("close");
+      this.form = {
+        month: 3,
+        packageType: "1"
+      };
+    }
+  }
+};
+</script>
+
+<style scoped lang="scss">
+.tag {
+  margin-right: 15px;
+  width: 90px;
+  text-align: center;
+  cursor: pointer;
+}
+
+.tag-select {
+  background-color: #409eff !important;
+  border-color: #409eff !important;
+  color: #fff !important;
+}
+
+.cover-content-item {
+  width: 220px;
+  float: left;
+  position: relative;
+  .cover-img {
+    width: 200px;
+    height: 100px;
+  }
+  .cover-mark {
+    position: absolute;
+    top: 0px;
+    right: 28px;
+    z-index: 1;
+    color: red;
+    cursor: pointer;
+    visibility: hidden;
+  }
+  .select {
+    visibility: visible !important;
+  }
+}
+
+.dialog-footer {
+  text-align: center;
+}
+</style>
+
+<style lang="scss">
+.ygp-form-items {
+  .el-form-item {
+    padding: 0 5px;
+  }
+  .el-form-item__label {
+    line-height: 1.2;
+    padding-bottom: 8px;
+    word-break: break-all;
+    word-wrap: break-word;
+    color: #333;
+  }
+
+  .el-form-item__error {
+    position: relative;
+    top: auto;
+    left: auto;
+  }
+
+  .el-form-item.is-desc_text {
+    .el-form-item__label {
+      display: none;
+    }
+  }
+}
+</style>

+ 205 - 0
src/views/business/salesite/components/Detail.vue

@@ -0,0 +1,205 @@
+<template>
+ <el-dialog
+    :title="title"
+    :visible.sync="dialogVisible"
+    width="750px"
+    :append-to-body="true"
+    :before-close="close"
+    :destroy-on-close="true"
+    :close-on-click-modal="false">
+   <el-form ref="form" :model="form" label-width="120px" label-position="top" style="max-height: 375px;overflow: auto;">
+     <flexbox
+         class="ygp-form-items"
+         align="flex-start"
+         justify="flex-start">
+        <el-form-item label="运营企业" prop="custId" style="width: 50%;" >
+          <span :class="loading?'el-icon-loading':''">{{detail.customer && detail.customer.name}}</span>
+        </el-form-item>
+         <el-form-item label="门店" prop="storeId" style="width: 50%;" >
+            <span :class="loading?'el-icon-loading':''">{{detail.store && detail.store.name}}</span>
+         </el-form-item>
+     </flexbox>
+     <flexbox
+         class="ygp-form-items"
+         align="flex-start"
+         justify="flex-start">
+         <el-form-item label="采集器编号" prop="colAddress" style="width: 50%;">
+             <span :class="loading?'el-icon-loading':''">{{detail.colAddress}}</span>
+         </el-form-item>
+         <el-form-item label="类型" prop="typeId" style="width: 50%;">
+           <span :class="loading?'el-icon-loading':''">{{detail.typeId && detail.typeId.desc}}</span>
+         </el-form-item>
+     </flexbox>
+     <flexbox
+          class="ygp-form-items"
+          align="flex-start"
+          justify="flex-start">
+         <el-form-item label="备注" prop="label" style="width: 100%;">
+            <span :class="loading?'el-icon-loading':''">{{detail.label}}</span>
+         </el-form-item>
+      </flexbox>
+   </el-form>
+   <div slot="footer" class="dialog-footer">
+     <el-button @click="close">关 闭</el-button>
+   </div>
+ </el-dialog>
+</template>
+<script>
+
+import { mapGetters } from 'vuex'
+import CustomFieldsMixin from '@/mixins/CustomFields'
+// import { getCollector } from "@/api/business/collector";
+export default {
+  mixins: [CustomFieldsMixin],
+  props: {
+    dialogVisible: {
+      type: Boolean,
+      default: false
+    },
+    editId: [Number, String] //  编辑用
+  },
+
+  data() {
+    return {
+      loading: false,
+      // 表单参数
+      form: {},
+      detail: {}
+    }
+  },
+
+  computed: {
+    ...mapGetters(['userInfo']),
+    title() {
+      return '采集器详情'
+    }
+  },
+
+  created() {
+    // 是编辑
+    if (this.editId) {
+      // this.getDetail()
+    }
+  },
+
+  mounted() {
+    document.body.appendChild(this.$el)
+  },
+
+  destroyed() {
+    // if appendToBody is true, remove DOM node after destroy
+    if (this.appendToBody && this.$el && this.$el.parentNode) {
+      this.$el.parentNode.removeChild(this.$el)
+    }
+  },
+
+  methods: {
+
+    /**
+     * 获取项目详情
+     */
+    getDetail() {
+      this.loading = true
+      getCollector({
+        colDeviceId: this.editId
+      }).then(res => {
+          const data = res.data || {}
+          this.detail = data
+          // console.log("getDetail :" + JSON.stringify(data))
+          this.$set(this.form,'custId', data.custId)
+          this.$set(this.form,'storeId', data.storeId)
+          this.$set(this.form,'colAddress', data.colAddress)
+          const deviceCategory = JSON.parse(data.typeId || {})
+          this.detail.typeId = deviceCategory
+          this.$set(this.form,'typeId', deviceCategory.value)
+          this.$set(this.form,'label', data.label)
+          this.loading = false
+        })
+        .catch(() => {
+          this.loading = false
+        })
+    },
+
+    /**
+     * 关闭窗口
+     */
+    close() {
+      this.$emit('close')
+      this.form = {
+        month:3,
+        packageType:'1'
+      }
+    }
+  }
+}
+</script>
+
+<style scoped lang="scss">
+.tag{
+  margin-right: 15px;
+  width: 90px;
+  text-align: center;
+  cursor: pointer;
+
+}
+
+.tag-select{
+  background-color: #409eff!important;
+  border-color: #409eff!important;
+  color: #fff!important;
+}
+
+.cover-content-item{
+  width: 220px;
+  float: left;
+  position: relative;
+  .cover-img {
+    width: 200px;
+    height: 100px;
+  }
+  .cover-mark {
+    position: absolute;
+    top: 0px;
+    right: 28px;
+    z-index: 1;
+    color: red;
+    cursor: pointer;
+    visibility: hidden;
+  }
+  .select {
+      visibility: visible!important;
+  }
+}
+
+.dialog-footer{
+  text-align: center;
+}
+
+</style>
+
+<style lang="scss">
+.ygp-form-items {
+   .el-form-item{
+     padding: 0 5px;
+   }
+  .el-form-item__label {
+    line-height: 1.2;
+    padding-bottom: 8px;
+    word-break: break-all;
+    word-wrap: break-word;
+    color: #333;
+  }
+
+  .el-form-item__error {
+    position: relative;
+    top: auto;
+    left: auto;
+  }
+
+  .el-form-item.is-desc_text {
+    .el-form-item__label {
+      display: none;
+    }
+  }
+}
+</style>

+ 474 - 0
src/views/business/salesite/index.vue

@@ -0,0 +1,474 @@
+<template>
+  <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-select
+          v-model="queryParams.parentId"
+          placeholder="请选择上级渠道"
+          style="width: 100%;"
+          filterable
+          clearable
+          :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="name" label-width="90px">
+        <el-input
+          v-model="queryParams.name"
+          placeholder="请输入经销商名称"
+          clearable
+          size="small"
+          @keyup.enter.native="handleQuery"
+        />
+      </el-form-item>
+      <el-form-item label="手机号码" prop="mobile">
+        <el-input
+          v-model="queryParams.mobile"
+          placeholder="请输入手机号码"
+          clearable
+          size="small"
+          @keyup.enter.native="handleQuery"
+        />
+      </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>
+      </el-form-item>
+    </el-form>
+    <el-row :gutter="10" class="mb8">
+      <el-col :span="1.5">
+        <el-button
+          type="primary"
+          icon="el-icon-plus"
+          size="mini"
+          disabled=""
+          @click="handleAdd"
+          v-hasPermi="['system:post:add']"
+        >添加经销商</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" 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" >
+        <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) == 2" style="color: red;"> {{getDesc(row.status)}}</span>
+         </template>
+      </el-table-column>
+      <el-table-column label="操作" align="center" class-name="small-padding fixed-width">
+        <template slot-scope="scope">
+          <el-button
+            size="mini"
+            type="text"
+            disabled
+            @click="handleUpdate(scope.row)"
+            v-hasPermi="['admin:salesite:read']"
+          >查看</el-button>
+          <el-button
+            size="mini"
+            type="text"
+            disabled
+            @click="handleUpdate(scope.row)"
+            v-hasPermi="['admin:salesite:edit']"
+          >编辑</el-button>
+          <el-button
+            size="mini"
+            type="text"
+            @click="handleStatusChange(scope.row)"
+            v-hasPermi="['admin:salesite:remove']"
+          >
+
+          <span v-if="getValue(scope.row.status) == 1"> 停用</span>
+          <span v-if="getValue(scope.row.status) == 2"> 启用</span>
+
+          </el-button>
+        </template>
+      </el-table-column>
+    </el-table>
+
+    <pagination
+      v-show="total>0"
+      :total="total"
+      :page.sync="pageParams.pageNum"
+      :limit.sync="pageParams.pageSize"
+      @pagination="getList"
+    />
+
+    <!-- 新建 -->
+    <site-create
+      v-if="createShow"
+      :dialog-visible="createShow"
+      :edit-id="editId"
+      @saveSuccess="submitSuccess"
+      @close="hideDialog"
+    />
+
+    <!-- 详情 -->
+    <site-detail
+      v-if="detailShow"
+      :dialog-visible="detailShow"
+      :edit-id="editId"
+      @close="hideDialog"
+    />
+  </div>
+</template>
+
+<script>
+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'
+export default {
+  name: "SaleSiteIndex",
+  components: {
+   SiteCreate,
+   SiteDetail
+  },
+  data() {
+    return {
+      // 遮罩层
+      loading: true,
+      // 创建编辑
+      createShow: false,
+      // 详情
+      detailShow: false,
+      // 编辑项ID
+      editId: null,
+      // 导出遮罩层
+      exportLoading: false,
+      // 选中数组
+      ids: [],
+      // 上级渠道列表
+      channelList:[],
+      channelCopyList:[],
+      provinceList:[],
+      cityList:[],
+      areaList:[],
+      // 非单个禁用
+      single: true,
+      // 非多个禁用
+      multiple: true,
+      // 显示搜索条件
+      showSearch: true,
+      // 总条数
+      total: 0,
+      // 岗位表格数据
+      postList: [],
+      // 弹出层标题
+      title: "",
+      // 是否显示弹出层
+      open: false,
+      // 状态数据字典
+      statusOptions: [],
+      // 查询参数
+      queryParams: {
+        parentId: "",
+        name: "",
+        mobile: "",
+        provinceId:"",
+        cityId:"",
+        areaId:""
+      },
+      pageParams: {
+        pageNum: 1,
+        pageSize: 10
+      },
+      // 表单参数
+      form: {},
+      // 表单校验
+      rules: {
+        postName: [
+          { required: true, message: "岗位名称不能为空", trigger: "blur" }
+        ],
+        postCode: [
+          { required: true, message: "岗位编码不能为空", trigger: "blur" }
+        ],
+        postSort: [
+          { required: true, message: "岗位顺序不能为空", trigger: "blur" }
+        ]
+      }
+    };
+  },
+  mounted() {
+    this.getChannelList()
+    this.getProvinceList()
+  },
+  created() {
+    this.getList();
+    this.getDicts("sys_normal_disable").then(response => {
+      this.statusOptions = response.data;
+    });
+  },
+  methods: {
+    /** 查询岗位列表 */
+    getList() {
+      this.loading = true;
+      listSaleSite('pageNum='+this.pageParams.pageNum + '&pageSize='+this.pageParams.pageSize+'&',this.queryParams).then(response => {
+        this.postList = response.rows;
+        this.total = response.total;
+        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();
+    },
+
+    hideDialog(){
+      this.createShow = false
+      this.detailShow = false
+    },
+    // 取消按钮
+    cancel() {
+      this.open = false;
+      this.reset();
+    },
+    // 表单重置
+    reset() {
+      this.form = {
+        postId: undefined,
+        postCode: undefined,
+        postName: undefined,
+        postSort: 0,
+        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();
+    },
+    // 多选框选中数据
+    handleSelectionChange(selection) {
+      this.ids = selection.map(item => item.postId)
+      this.single = selection.length!=1
+      this.multiple = !selection.length
+    },
+    /** 新增按钮操作 */
+    handleAdd() {
+       this.createShow = true
+       this.editId = null
+    },
+    /** 修改按钮操作 */
+    handleUpdate(row) {
+      this.reset();
+      const postId = row.postId || this.ids
+      getPost(postId).then(response => {
+        this.form = response.data;
+        this.open = true;
+        this.title = "修改岗位";
+      });
+    },
+    /** 提交按钮 */
+    submitForm: function() {
+      this.$refs["form"].validate(valid => {
+        if (valid) {
+          if (this.form.postId != undefined) {
+            updatePost(this.form).then(response => {
+              this.msgSuccess("修改成功");
+              this.open = false;
+              this.getList();
+            });
+          } else {
+            addPost(this.form).then(response => {
+              this.msgSuccess("新增成功");
+              this.open = false;
+              this.getList();
+            });
+          }
+        }
+      });
+    },
+    /** 删除按钮操作 */
+    handleDelete(row) {
+      const postIds = row.postId || this.ids;
+      this.$confirm('是否确认删除名称为"' + row.name + '"的经销商?', "警告", {
+          confirmButtonText: "确定",
+          cancelButtonText: "取消",
+          type: "warning"
+        }).then(function() {
+          return delPost(postIds);
+        }).then(() => {
+          this.getList();
+          this.msgSuccess("删除成功");
+        }).catch(() => {});
+    },
+
+
+    // 状态修改
+    handleStatusChange(row) {
+      var newStatus = this.getValue(row.status) == 2?1:2
+      let text = this.getValue(row.status) == 2 ? "启用" : "停用";
+      this.$confirm('确认要"' + text + '""' + row.name + '"经销商吗?', "警告", {
+          confirmButtonText: "确定",
+          cancelButtonText: "取消",
+          type: "warning"
+        }).then(function() {
+          var params={
+            channelId:row.channelId,
+            status: newStatus
+          }
+          return updateSaleSiteStatus(params);
+        }).then(() => {
+          this.msgSuccess(text + "成功");
+          this.getList();
+        }).catch(function() {
+          // row.status = row.status === "0" ? "1" : "0";
+        });
+    }
+  }
+};
+</script>

+ 4 - 4
src/views/system/role/index.vue

@@ -110,8 +110,8 @@
       <el-table-column label="角色类型" width="150">
         <template slot-scope="scope">
             <span v-if="scope.row.roleType == '1'">系统角色</span>
-            <span v-if="scope.row.roleType == '2'">门店角色</span>
-            <span v-if="scope.row.roleType == '3'">商角色</span>
+            <span v-if="scope.row.roleType == '2'">渠道角色</span>
+            <span v-if="scope.row.roleType == '3'">经销商角色</span>
         </template>
       </el-table-column>
       <el-table-column label="显示顺序" prop="roleSort" width="100" />
@@ -358,11 +358,11 @@ export default {
         },
         {
           value: "2",
-          label: "门店角色"
+          label: "渠道商角色"
         },
         {
           value: "3",
-          label: "商角色"
+          label: "经销商角色"
         }
       ],
       isDefaultOptions: [