Преглед изворни кода

渠道管理添加渠道功能

guanglong пре 3 година
родитељ
комит
416ef33159

+ 3 - 3
src/api/admin/channel.js

@@ -33,7 +33,7 @@ export function listAllChannel() {
 // 新增渠道
 export function addChannel(data) {
   return request({
-    url: '/api/v1/mp/channel/create',
+    url: '/api/v1/mp/admin/channel/create',
     method: 'post',
     data: data
   })
@@ -42,7 +42,7 @@ export function addChannel(data) {
 // 修改渠道
 export function updateChannel(data) {
   return request({
-    url: '/api/v1/mp/channel/update',
+    url: '/api/v1/mp/admin/channel/update',
     method: 'post',
     data: data
   })
@@ -52,7 +52,7 @@ export function updateChannel(data) {
 //编辑渠道用户状态信息
 export function updateChannelStatus(data) {
   return request({
-    url: '/api/v1/mp/channel/status',
+    url: '/api/v1/mp/admin/channel/status',
     method: 'post',
     data: data
   })

+ 3 - 3
src/api/admin/salesite.js

@@ -15,7 +15,7 @@ export function listSaleSite(urlParams, data) {
 // 新增经销商
 export function addSaleSite(data) {
   return request({
-    url: '/api/v1/mp/salesite/create',
+    url: '/api/v1/mp/admin/salesite/create',
     method: 'post',
     data: data
   })
@@ -24,7 +24,7 @@ export function addSaleSite(data) {
 // 修改经销商
 export function updateSaleSite(data) {
   return request({
-    url: '/api/v1/mp/salesite/update',
+    url: '/api/v1/mp/admin/salesite/update',
     method: 'post',
     data: data
   })
@@ -34,7 +34,7 @@ export function updateSaleSite(data) {
 //编辑经销商用户状态信息
 export function updateSaleSiteStatus(data) {
   return request({
-    url: '/api/v1/mp/salesite/status',
+    url: '/api/v1/mp/admin/salesite/status',
     method: 'post',
     data: data
   })

+ 0 - 117
src/views/business/channel/authRole.vue

@@ -1,117 +0,0 @@
-<template>
-  <div class="app-container">
-    <h4 class="form-header h4">基本信息</h4>
-    <el-form ref="form" :model="form" label-width="80px">
-      <el-row>
-        <el-col :span="8" :offset="2">
-          <el-form-item label="用户昵称" prop="nickName">
-            <el-input v-model="form.nickName" disabled />
-          </el-form-item>
-        </el-col>
-        <el-col :span="8" :offset="2">
-          <el-form-item label="登录账号" prop="phonenumber">
-            <el-input  v-model="form.userName" disabled />
-          </el-form-item>
-        </el-col>
-      </el-row>
-    </el-form>
-
-    <h4 class="form-header h4">角色信息</h4>
-    <el-table v-loading="loading" :row-key="getRowKey" @row-click="clickRow" ref="table" @selection-change="handleSelectionChange" :data="roles.slice((pageNum-1)*pageSize,pageNum*pageSize)">
-      <el-table-column label="序号" type="index" align="center">
-        <template slot-scope="scope">
-          <span>{{(pageNum - 1) * pageSize + scope.$index + 1}}</span>
-        </template>
-      </el-table-column>
-      <el-table-column type="selection" :reserve-selection="true" width="55"></el-table-column>
-      <el-table-column label="角色编号" align="center" prop="roleId" />
-      <el-table-column label="角色名称" align="center" prop="roleName" />
-      <el-table-column label="权限字符" align="center" prop="roleKey" />
-      <el-table-column label="创建时间" align="center" prop="createTime" width="180">
-        <template slot-scope="scope">
-          <span>{{ parseTime(scope.row.createTime) }}</span>
-        </template>
-      </el-table-column>
-    </el-table>
-    
-    <pagination v-show="total>0" :total="total" :page.sync="pageNum" :limit.sync="pageSize" />
-
-    <el-form label-width="100px">
-      <el-form-item style="text-align: center;margin-left:-120px;margin-top:30px;">
-        <el-button type="primary" @click="submitForm()">提交</el-button>
-        <el-button @click="close()">返回</el-button>
-      </el-form-item>
-    </el-form>
-  </div>
-</template>
-
-<script>
-import { getAuthRole, updateAuthRole } from "@/api/system/user";
-
-export default {
-  name: "AuthRole",
-  data() {
-    return {
-       // 遮罩层
-      loading: true,
-      // 分页信息
-      total: 0,
-      pageNum: 1,
-      pageSize: 10,
-      // 选中角色编号
-      roleIds:[],
-      // 角色信息
-      roles: [],
-      // 用户信息
-      form: {}
-    };
-  },
-  created() {
-    const userId = this.$route.params && this.$route.params.userId;
-    if (userId) {
-      this.loading = true;
-      getAuthRole(userId).then((response) => {
-        this.form = response.user;
-        this.roles = response.roles;
-        this.total = this.roles.length;
-        this.$nextTick(() => {
-          this.roles.forEach((row) => {
-            if (row.flag) {
-              this.$refs.table.toggleRowSelection(row);
-            }
-          });
-        });
-        this.loading = false;
-      });
-    }
-  },
-  methods: {
-    /** 单击选中行数据 */
-    clickRow(row) {
-      this.$refs.table.toggleRowSelection(row);
-    },
-    // 多选框选中数据
-    handleSelectionChange(selection) {
-      this.roleIds = selection.map((item) => item.roleId);
-    },
-    // 保存选中的数据编号
-    getRowKey(row) {
-      return row.roleId;
-    },
-    /** 提交按钮 */
-    submitForm() {
-      const userId = this.form.userId;
-      const roleIds = this.roleIds.join(",");
-      updateAuthRole({ userId: userId, roleIds: roleIds }).then((response) => {
-        this.msgSuccess("授权成功");
-        this.close();
-      });
-    },
-    /** 关闭按钮 */
-    close() {
-      this.$store.dispatch("tagsView/delView", this.$route);
-      this.$router.push({ path: "/system/user" });
-    },
-  },
-};
-</script>

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

@@ -0,0 +1,431 @@
+<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"
+            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: {},
+      feeItems: [],
+      checkedItems: [],
+      custOptions: [],
+      storeOptions: [],
+      typeOptions: [],
+      // 表单校验
+      rules: {
+        name: [
+          { required: true, message: "请输入渠道名称", trigger: "blur" }
+        ],
+        mobile: [
+          { required: true, message: "请输入手机号码", trigger: "blur" }
+        ],
+        parentId: [{ required: true, message: "请选择上级渠道", trigger: "change" }],
+        contact: [
+          { required: true, message: "请输入联系人", trigger: "blur" }
+        ],
+        commRate: [
+          { required: true, message: "请输入佣金比例", trigger: "blur" }
+        ],
+        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 || [];
+      });
+    },
+
+    getCityList(){
+      this.cityList = []
+      this.areaList = []
+      this.form.cityId = ""
+      this.form.areaId = ""
+      var provinceId = this.form.provinceId
+      listAreaByPid(provinceId).then(response => {
+        console.log("getCityList"+JSON.stringify(response))
+         this.cityList = response || [];
+      });
+    },
+
+    getAreaList(){
+      var cityId = this.form.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;
+      }
+    },
+
+
+    // /** 查询可分配的门店 */
+    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>

+ 110 - 442
src/views/business/channel/index.vue

@@ -2,24 +2,20 @@
   <div class="app-container">
     <el-row :gutter="20">
       <!--部门数据-->
-      <el-col :span="4" :xs="24">
+      <el-col :span="4" :xs="24" >
         <div class="head-container">
-          <el-input
-            v-model="deptName"
-            placeholder="请输入部门名称"
+        <!--  <el-input
+            v-model="channelName"
+            placeholder="请输入渠道名称"
             clearable
             size="small"
             prefix-icon="el-icon-search"
             style="margin-bottom: 20px"
-          />
+          /> -->
         </div>
-        <div class="head-container">
-          <!-- :data="deptOptions" -->
-          <!--           :expand-on-click-node="true"
-                     :filter-node-method="filterNode" -->
+        <div class="head-container" style="overflow-x:scroll">
           <el-tree
             :props="defaultProps"
-
             ref="tree"
             :load="loadNode"
             lazy
@@ -104,12 +100,13 @@
               v-hasPermi="['system:user:add']"
             >添加渠道</el-button>
           </el-col>
-          <right-toolbar :showSearch.sync="showSearch" @queryTable="getList" :columns="columns"></right-toolbar>
+          <right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
         </el-row>
 
-        <el-table v-loading="loading" :data="channelList" @selection-change="handleSelectionChange">
-          <el-table-column label="渠道ID" prop="channelId" width="140px" />
+        <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}}%
@@ -123,14 +120,10 @@
           <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"
-                active-value="0"
-                inactive-value="1"
-                @change="handleStatusChange(scope.row)"
-              ></el-switch>
-            </template>
+           <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="操作"
@@ -142,40 +135,34 @@
               <el-button
                 size="mini"
                 type="text"
-                @click="handleUpdate(scope.row)"
-                v-hasPermi="['system:user:edit']"
+                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="['system:user:edit']"
+                v-hasPermi="['admin:channel:edit']"
               >编辑</el-button>
-       <!--       <el-button
+              <el-button
                 size="mini"
                 type="text"
-                icon="el-icon-delete"
-                @click="handleDelete(scope.row)"
-                v-hasPermi="['system:user:remove']"
-              >删除</el-button> -->
+                @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="handleDelete(scope.row)"
-                v-hasPermi="['system:user:remove']"
+                @click="handleAdd(scope.row)"
+                v-hasPermi="['admin:channel:add']"
               >添加子渠道</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>
-                <el-dropdown-menu slot="dropdown">
-                  <el-dropdown-item command="handleResetPwd" icon="el-icon-key"
-                    v-hasPermi="['system:user:resetPwd']">重置密码</el-dropdown-item>
-                  <el-dropdown-item command="handleAuthRole" icon="el-icon-circle-check"
-                    v-hasPermi="['system:user:edit']">分配角色</el-dropdown-item>
-                </el-dropdown-menu>
-              </el-dropdown> -->
             </template>
           </el-table-column>
         </el-table>
@@ -189,159 +176,41 @@
         />
       </el-col>
     </el-row>
+    <!-- 新建 -->
+    <channel-create
+      v-if="createShow"
+      :dialog-visible="createShow"
+      :edit-id="editId"
+      @saveSuccess="submitSuccess"
+      @close="hideDialog"
+    />
 
-    <!-- 添加或修改参数配置对话框 -->
-    <el-dialog :title="title" :visible.sync="open" width="600px" append-to-body>
-      <el-form ref="form" :model="form" :rules="rules" label-width="80px">
-        <el-row>
-          <el-col :span="12">
-            <el-form-item label="用户昵称" prop="nickName">
-              <el-input v-model="form.nickName" placeholder="请输入用户昵称" maxlength="30" />
-            </el-form-item>
-          </el-col>
-          <el-col :span="12">
-            <el-form-item label="归属部门" prop="deptId">
-              <treeselect v-model="form.deptId" :options="deptOptions" :show-count="true" placeholder="请选择归属部门" />
-            </el-form-item>
-          </el-col>
-        </el-row>
-        <el-row>
-          <el-col :span="12">
-            <el-form-item label="手机号码" prop="phonenumber">
-              <el-input v-model="form.phonenumber" placeholder="请输入手机号码" maxlength="11" />
-            </el-form-item>
-          </el-col>
-          <el-col :span="12">
-            <el-form-item label="邮箱" prop="email">
-              <el-input v-model="form.email" placeholder="请输入邮箱" maxlength="50" />
-            </el-form-item>
-          </el-col>
-        </el-row>
-        <el-row>
-          <el-col :span="12">
-            <el-form-item v-if="form.userId == undefined" label="用户名称" prop="userName">
-              <el-input v-model="form.userName" placeholder="请输入用户名称" maxlength="30" />
-            </el-form-item>
-          </el-col>
-          <el-col :span="12">
-            <el-form-item v-if="form.userId == undefined" label="用户密码" prop="password">
-              <el-input v-model="form.password" placeholder="请输入用户密码" type="password" maxlength="20" show-password/>
-            </el-form-item>
-          </el-col>
-        </el-row>
-        <el-row>
-          <el-col :span="12">
-            <el-form-item label="用户性别">
-              <el-select v-model="form.sex" placeholder="请选择">
-                <el-option
-                  v-for="dict in sexOptions"
-                  :key="dict.dictValue"
-                  :label="dict.dictLabel"
-                  :value="dict.dictValue"
-                ></el-option>
-              </el-select>
-            </el-form-item>
-          </el-col>
-          <el-col :span="12">
-            <el-form-item label="状态">
-              <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-col>
-        </el-row>
-        <el-row>
-          <el-col :span="12">
-            <el-form-item label="岗位">
-              <el-select v-model="form.postIds" multiple placeholder="请选择">
-                <el-option
-                  v-for="item in postOptions"
-                  :key="item.postId"
-                  :label="item.postName"
-                  :value="item.postId"
-                  :disabled="item.status == 1"
-                ></el-option>
-              </el-select>
-            </el-form-item>
-          </el-col>
-          <el-col :span="12">
-            <el-form-item label="角色">
-              <el-select v-model="form.roleIds" multiple placeholder="请选择">
-                <el-option
-                  v-for="item in roleOptions"
-                  :key="item.roleId"
-                  :label="item.roleName"
-                  :value="item.roleId"
-                  :disabled="item.status == 1"
-                ></el-option>
-              </el-select>
-            </el-form-item>
-          </el-col>
-        </el-row>
-        <el-row>
-          <el-col :span="24">
-            <el-form-item label="备注">
-              <el-input v-model="form.remark" type="textarea" placeholder="请输入内容"></el-input>
-            </el-form-item>
-          </el-col>
-        </el-row>
-      </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>
+    <!-- 详情 -->
+    <channel-detail
+      v-if="detailShow"
+      :dialog-visible="detailShow"
+      :edit-id="editId"
+      @close="hideDialog"
+    />
 
-    <!-- 用户导入对话框 -->
-    <el-dialog :title="upload.title" :visible.sync="upload.open" width="400px" append-to-body>
-      <el-upload
-        ref="upload"
-        :limit="1"
-        accept=".xlsx, .xls"
-        :headers="upload.headers"
-        :action="upload.url + '?updateSupport=' + upload.updateSupport"
-        :disabled="upload.isUploading"
-        :on-progress="handleFileUploadProgress"
-        :on-success="handleFileSuccess"
-        :auto-upload="false"
-        drag
-      >
-        <i class="el-icon-upload"></i>
-        <div class="el-upload__text">将文件拖到此处,或<em>点击上传</em></div>
-        <div class="el-upload__tip text-center" slot="tip">
-          <div class="el-upload__tip" slot="tip">
-            <el-checkbox v-model="upload.updateSupport" /> 是否更新已经存在的用户数据
-          </div>
-          <span>仅允许导入xls、xlsx格式文件。</span>
-          <el-link type="primary" :underline="false" style="font-size:12px;vertical-align: baseline;" @click="importTemplate">下载模板</el-link>
-        </div>
-      </el-upload>
-      <div slot="footer" class="dialog-footer">
-        <el-button @click="upload.open = false">取 消</el-button>
-        <el-button type="primary" @click="submitFileForm">确 定</el-button>
-      </div>
-    </el-dialog>
   </div>
 </template>
 
 <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";
-
+import ChannelCreate from './components/Create'
+import ChannelDetail from './components/Detail'
 export default {
-  name: "User",
-  components: { Treeselect },
+  name: "ChannelIndex",
+  components: {
+    Treeselect,
+    ChannelCreate,
+    ChannelDetail
+  },
   data() {
     return {
       // 遮罩层
@@ -350,61 +219,31 @@ export default {
       exportLoading: false,
       // 选中数组
       ids: [],
-
+      // 创建编辑
+      createShow: false,
+      // 详情
+      detailShow: false,
       provinceList:[],
       cityList:[],
       areaList:[],
-      // 非单个禁用
-      single: true,
-      // 非多个禁用
-      multiple: true,
+      // 编辑项ID
+      editId: null,
       // 显示搜索条件
       showSearch: true,
       // 总条数
       total: 0,
       // 用户表格数据
       channelList: null,
-      // 弹出层标题
-      title: "",
-      // 部门树选项
-      deptOptions: undefined,
-      // 是否显示弹出层
-      open: false,
-      // 部门名称
-      deptName: undefined,
-      // 默认密码
-      initPassword: undefined,
-      // 日期范围
-      dateRange: [],
+
+      channelName:"",
       // 状态数据字典
       statusOptions: [],
-      // 性别状态字典
-      sexOptions: [],
-      // 岗位选项
-      postOptions: [],
-      // 角色选项
-      roleOptions: [],
       // 表单参数
       form: {},
       defaultProps: {
         children: "children",
         label: "name"
       },
-      // 用户导入参数
-      upload: {
-        // 是否显示弹出层(用户导入)
-        open: false,
-        // 弹出层标题(用户导入)
-        title: "",
-        // 是否禁用上传
-        isUploading: false,
-        // 是否更新已经存在的用户数据
-        updateSupport: 0,
-        // 设置上传的请求头部
-        headers: { Authorization: "Bearer " + getToken() },
-        // 上传的地址
-        url: process.env.VUE_APP_BASE_API + "/system/user/importData"
-      },
       // 查询参数
       queryParams: {
         name: "",
@@ -416,50 +255,12 @@ export default {
       pageParams: {
         pageNum: 1,
         pageSize: 10
-      },
-      // 列信息
-      columns: [
-        { key: 0, label: `用户编号`, visible: true },
-        { key: 1, label: `用户名称`, visible: true },
-        { key: 2, label: `用户昵称`, visible: true },
-        { key: 3, label: `部门`, visible: true },
-        { key: 4, label: `手机号码`, visible: true },
-        { key: 5, label: `状态`, visible: true },
-        { key: 6, label: `创建时间`, visible: true }
-      ],
-      // 表单校验
-      rules: {
-        userName: [
-          { required: true, message: "用户名称不能为空", trigger: "blur" },
-          { min: 2, max: 20, message: '用户名称长度必须介于 2 和 20 之间', trigger: 'blur' }
-        ],
-        nickName: [
-          { required: true, message: "用户昵称不能为空", trigger: "blur" }
-        ],
-        password: [
-          { required: true, message: "用户密码不能为空", trigger: "blur" },
-          { min: 5, max: 20, message: '用户密码长度必须介于 5 和 20 之间', trigger: 'blur' }
-        ],
-        email: [
-          {
-            type: "email",
-            message: "'请输入正确的邮箱地址",
-            trigger: ["blur", "change"]
-          }
-        ],
-        phonenumber: [
-          {
-            pattern: /^1[3|4|5|6|7|8|9][0-9]\d{8}$/,
-            message: "请输入正确的手机号码",
-            trigger: "blur"
-          }
-        ]
       }
     };
   },
   watch: {
-    // 根据名称筛选部门
-    deptName(val) {
+    // 根据渠道名称筛选渠道树
+    channelName(val) {
       this.$refs.tree.filter(val);
     }
   },
@@ -468,16 +269,6 @@ export default {
   },
   created() {
     this.getList();
-   // 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: {
     /** 查询用户列表 */
@@ -490,31 +281,18 @@ export default {
         }
       );
     },
-    /** 查询部门下拉树结构 */
-    getChannelTree(data) {
-      treeChannel(data).then(response => {
-        this.deptOptions = response.data;
-      });
-    },
-    // 筛选节点
-    filterNode(value, data) {
-      if (!value) return true;
-      return data.label.indexOf(value) !== -1;
-    },
     // 节点单击事件
     handleNodeClick(data) {
       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
         }
@@ -557,44 +335,28 @@ export default {
       });
     },
 
-    // 用户状态修改
+    // 状态修改
     handleStatusChange(row) {
-      let text = row.status === "0" ? "启用" : "停用";
-      this.$confirm('确认要"' + text + '""' + row.userName + '"用户吗?', "警告", {
+      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() {
-          return changeUserStatus(row.userId, row.status);
+          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";
+          // row.status = row.status === "0" ? "1" : "0";
         });
     },
-    // 取消按钮
-    cancel() {
-      this.open = false;
-      this.reset();
-    },
-    // 表单重置
-    reset() {
-      this.form = {
-        userId: undefined,
-        deptId: undefined,
-        userName: undefined,
-        nickName: undefined,
-        password: undefined,
-        phonenumber: undefined,
-        email: undefined,
-        sex: undefined,
-        status: "0",
-        remark: undefined,
-        postIds: [],
-        roleIds: []
-      };
-      this.resetForm("form");
-    },
+
     /** 搜索按钮操作 */
     handleQuery() {
       this.queryParams.pageNum = 1;
@@ -614,147 +376,53 @@ export default {
       this.resetForm("queryForm");
       this.handleQuery();
     },
-    // 多选框选中数据
-    handleSelectionChange(selection) {
-      this.ids = selection.map(item => item.userId);
-      this.single = selection.length != 1;
-      this.multiple = !selection.length;
-    },
-    // 更多操作触发
-    handleCommand(command, row) {
-      switch (command) {
-        case "handleResetPwd":
-          this.handleResetPwd(row);
-          break;
-        case "handleAuthRole":
-          this.handleAuthRole(row);
-          break;
-        default:
-          break;
-      }
+    handleDetail(row){
+
     },
     /** 新增按钮操作 */
     handleAdd() {
-      this.reset();
-      this.getTreeselect();
-      getUser().then(response => {
-        this.postOptions = response.posts;
-        this.roleOptions = response.roles;
-        this.open = true;
-        this.title = "添加用户";
-        this.form.password = this.initPassword;
-      });
+      this.createShow = true
+      this.editId = null
     },
     /** 修改按钮操作 */
     handleUpdate(row) {
-      this.reset();
-      this.getTreeselect();
-      const userId = row.userId || this.ids;
-      getUser(userId).then(response => {
-        this.form = response.data;
-        this.postOptions = response.posts;
-        this.roleOptions = response.roles;
-        this.form.postIds = response.postIds;
-        this.form.roleIds = response.roleIds;
-        this.open = true;
-        this.title = "修改用户";
-        this.form.password = "";
-      });
+
     },
-    /** 重置密码按钮操作 */
-    handleResetPwd(row) {
-      this.$prompt('请输入"' + row.userName + '"的新密码', "提示", {
-        confirmButtonText: "确定",
-        cancelButtonText: "取消",
-        closeOnClickModal: false,
-        inputPattern: /^.{5,20}$/,
-        inputErrorMessage: "用户密码长度必须介于 5 和 20 之间",
-      }).then(({ value }) => {
-          resetUserPwd(row.userId, value).then(response => {
-            this.msgSuccess("修改成功,新密码是:" + value);
-          });
-        }).catch(() => {});
+    // 保存后的操作
+    submitSuccess(){
+      this.getList();
     },
-    /** 分配角色操作 */
-    handleAuthRole: function(row) {
-      const userId = row.userId;
-      this.$router.push("/system/user-auth/role/" + userId);
+    /**关闭弹窗*/
+    hideDialog(){
+      this.createShow = false
+      this.detailShow = false
     },
-    /** 提交按钮 */
-    submitForm: function() {
-      this.$refs["form"].validate(valid => {
-        if (valid) {
-          if (this.form.userId != undefined) {
-            updateUser(this.form).then(response => {
-              this.msgSuccess("修改成功");
-              this.open = false;
-              this.getList();
-            });
-          } else {
-            addUser(this.form).then(response => {
-              this.msgSuccess("新增成功");
-              this.open = false;
-              this.getList();
-            });
-          }
-        }
-      });
+
+    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 userIds = row.userId || this.ids;
-      this.$confirm('是否确认删除用户编号为"' + userIds + '"的数据项?', "警告", {
-          confirmButtonText: "确定",
-          cancelButtonText: "取消",
-          type: "warning"
-        }).then(function() {
-          return delUser(userIds);
-        }).then(() => {
-          this.getList();
-          this.msgSuccess("删除成功");
-        }).catch(() => {});
-    },
-    /** 导出按钮操作 */
-    handleExport() {
-      const queryParams = this.queryParams;
-      this.$confirm('是否确认导出所有用户数据项?', "警告", {
-          confirmButtonText: "确定",
-          cancelButtonText: "取消",
-          type: "warning"
-        }).then(() => {
-          this.exportLoading = true;
-          return exportUser(queryParams);
-        }).then(response => {
-          this.download(response.msg);
-          this.exportLoading = false;
-        }).catch(() => {});
-    },
-    /** 导入按钮操作 */
-    handleImport() {
-      this.upload.title = "用户导入";
-      this.upload.open = true;
-    },
-    /** 下载模板操作 */
-    importTemplate() {
-      importTemplate().then(response => {
-        this.download(response.msg);
-      });
-    },
-    // 文件上传中处理
-    handleFileUploadProgress(event, file, fileList) {
-      this.upload.isUploading = true;
-    },
-    // 文件上传成功处理
-    handleFileSuccess(response, file, fileList) {
-      this.upload.open = false;
-      this.upload.isUploading = false;
-      this.$refs.upload.clearFiles();
-      this.$alert(response.msg, "导入结果", { dangerouslyUseHTMLString: true });
-      this.getList();
-    },
-    // 提交上传文件
-    submitFileForm() {
-      this.$refs.upload.submit();
+      const channelId = row.channelId;
+      // this.$confirm('是否确认删除编号为"' + channelId + '"的数据项?', "警告", {
+      //     confirmButtonText: "确定",
+      //     cancelButtonText: "取消",
+      //     type: "warning"
+      //   }).then(function() {
+      //     return delUser(userIds);
+      //   }).then(() => {
+      //     this.getList();
+      //     this.msgSuccess("删除成功");
+      //   }).catch(() => {});
     }
   }
 };

+ 0 - 96
src/views/business/channel/profile/index.vue

@@ -1,96 +0,0 @@
-<template>
-  <div class="app-container">
-    <el-row :gutter="20">
-      <el-col :span="8" :xs="24">
-        <el-card class="box-card">
-          <div slot="header" class="clearfix">
-            <span>个人信息</span>
-          </div>
-          <div>
-            <div class="text-center">
-              <userAvatar :user="user" />
-            </div>
-            <ul class="list-group list-group-striped">
-              <li class="list-group-item">
-                <i class="el-icon-user-solid" />用户名
-                <div class="pull-right">{{ user.userName }}</div>
-              </li>
-              <li class="list-group-item">
-                <i class="el-icon-user" />用户昵称
-                <div class="pull-right">{{ user.nickName }}</div>
-              </li>
-              <li class="list-group-item">
-                <svg-icon icon-class="phone" />手机号码
-                <div class="pull-right">{{ user.phonenumber }}</div>
-              </li>
-              <li class="list-group-item">
-                <svg-icon icon-class="email" />用户邮箱
-                <div class="pull-right">{{ user.email }}</div>
-              </li>
-              <li class="list-group-item">
-                <svg-icon icon-class="tree" />所属部门
-                <div class="pull-right" v-if="user.dept">{{ user.dept.deptName }} / {{ postGroup }}</div>
-              </li>
-              <li class="list-group-item">
-                <svg-icon icon-class="peoples" />所属角色
-                <div class="pull-right">{{ roleGroup }}</div>
-              </li>
-              <li class="list-group-item">
-                <svg-icon icon-class="date" />创建日期
-                <div class="pull-right">{{ user.createTime | moment("YYYY-MM-DD") }}</div>
-              </li>
-            </ul>
-          </div>
-        </el-card>
-      </el-col>
-      <el-col :span="16" :xs="24">
-        <el-card>
-          <div slot="header" class="clearfix">
-            <span>基本资料</span>
-          </div>
-          <el-tabs v-model="activeTab">
-            <el-tab-pane label="基本资料" name="userinfo">
-              <userInfo :user="user" />
-            </el-tab-pane>
-            <el-tab-pane label="修改密码" name="resetPwd">
-              <resetPwd :user="user" />
-            </el-tab-pane>
-          </el-tabs>
-        </el-card>
-      </el-col>
-    </el-row>
-  </div>
-</template>
-
-<script>
-import moment from 'moment'
-import userAvatar from "./userAvatar";
-import userInfo from "./userInfo";
-import resetPwd from "./resetPwd";
-import { getUserProfile } from "@/api/system/user";
-
-export default {
-  name: "Profile",
-  components: { userAvatar, userInfo, resetPwd },
-  data() {
-    return {
-      user: {},
-      roleGroup: {},
-      postGroup: {},
-      activeTab: "userinfo"
-    };
-  },
-  created() {
-    this.getUser();
-  },
-  methods: {
-    getUser() {
-      getUserProfile().then(response => {
-        this.user = response.data;
-        this.roleGroup = response.roleGroup;
-        this.postGroup = response.postGroup;
-      });
-    }
-  }
-};
-</script>

+ 0 - 165
src/views/business/channel/profile/resetPwd.vue

@@ -1,165 +0,0 @@
-<template>
-  <el-form ref="form" :model="form" :rules="rules" label-width="100px">
-    <el-form-item label="手机号码" prop="mobile">
-      <el-input v-model="user.phonenumber" placeholder="请输入手机号码" type="text" :disabled="true" />
-    </el-form-item>
-   <!-- <el-form-item prop="status">
-      <JcRange ref="jcr" status="status" :successFun="onMpanelSuccess" :errorFun="onMpanelError"></JcRange>
-    </el-form-item> -->
-    <el-form-item label="验证码" prop="authCode">
-      <el-row>
-        <el-col :span="24">
-             <el-input ref="authCode" v-model="form.authCode" type="text" placeholder="请输入短信验证码" name="authCode" abindex="2"
-              maxlength="6" auto-complete="off" style="width: 55%;float: left;">
-             <!-- <svg-icon slot="prefix" icon-class="validCode" /> -->
-            </el-input>
-            <span style="float: left; padding-left: 10px;">
-              <el-button :loading="sending" :disabled="sendDisabled" size="medium" @click="onSendSms">
-                {{ sendButtonText }}
-              </el-button>
-            </span>
-        </el-col>
-      </el-row>
-    </el-form-item>
-    <el-form-item label="新密码" prop="newPassword">
-      <el-input v-model="form.newPassword" placeholder="请输入新密码" type="password" show-password/>
-    </el-form-item>
-    <el-form-item label="确认密码" prop="confirmPassword">
-      <el-input v-model="form.confirmPassword" placeholder="请确认密码" type="password" show-password/>
-    </el-form-item>
-    <el-form-item>
-      <el-button type="primary" size="mini" @click="submit">保存</el-button>
-      <el-button type="danger" size="mini" @click="close">关闭</el-button>
-    </el-form-item>
-  </el-form>
-</template>
-
-<script>
-import { updateUserPwd,resetPwd } from "@/api/system/user";
-import {sendSms} from "@/api/login";
-import JcRange from "@/components/JcRange/index.vue";
-import Cookies from "js-cookie";
-
-export default {
-  components: {
-    JcRange
-  },
-  props: {
-    user: {
-      type: Object
-    }
-  },
-  data() {
-    const equalToPassword = (rule, value, callback) => {
-      if (this.form.newPassword !== value) {
-        callback(new Error("两次输入的密码不一致"));
-      } else {
-        callback();
-      }
-    };
-    return {
-      sending: false,
-      sendDisabled: false,
-      timer: 0,
-      test: "1test",
-      status: false,
-      form: {
-        messageId:'',
-        authCode: undefined,
-        newPassword: undefined,
-        confirmPassword: undefined
-      },
-      // 表单校验
-      rules: {
-        authCode: [
-          { required: true, message: "验证码不能为空", trigger: "blur" }
-        ],
-        newPassword: [
-          { required: true, message: "新密码不能为空", trigger: "blur" },
-          { min: 6, max: 20, message: "长度在 6 到 20 个字符", trigger: "blur" }
-        ],
-        confirmPassword: [
-          { required: true, message: "确认密码不能为空", trigger: "blur" },
-          { required: true, validator: equalToPassword, trigger: "blur" }
-        ]
-      }
-    };
-  },
-  computed: {
-    sendButtonText() {
-      if (this.timer === 0) {
-        this.sendDisabled = false
-        return "发送验证码";
-      } else {
-        return `${this.timer}秒后重发`;
-      }
-    }
-  },
-  watch: {
-    timer(num) {
-      if (num > 0) {
-        setTimeout(() => {
-          this.timer = --num;
-        }, 1000);
-      }
-    }
-  },
-  methods: {
-
-    // 发送短信
-    onSendSms() {
-      if(this.user.phonenumber){
-        // if(!this.status){
-        //   this.$message.warning("请拖住滑块,拖动到最右边");
-        //   return false;
-        // }
-        this.sending = true;
-        this.sendDisabled = true
-        const mobile = this.user.phonenumber;
-        sendSms(mobile)
-          .then(res => {
-            this.timer = 60;
-            this.form.messageId = res.data;
-            this.$message.success("短信发送成功,请注意查收");
-            Cookies.set("last-send-time", new Date());
-          })
-          .catch(e => {
-            this.$message.error("网络异常");
-            this.timer = 0;
-            this.sendDisabled = false;
-            // console.log(e);
-          })
-          .finally(() => (this.sending = false));
-      }else{
-         this.$message.success("发送失败,手机号码异常,请联系管理员");
-      }
-
-    },
-
-    onMpanelSuccess(){
-      // console.log("onMpanelSuccess 验证成功 =====")
-      this.status = true
-    },
-    onMpanelError(){
-       // console.log("onMpanelError 验证失败 =====")
-       this.status = false
-    },
-
-    submit() {
-      this.$refs["form"].validate(valid => {
-        if (valid) {
-          resetPwd(this.form.messageId,this.form.authCode, this.form.newPassword).then(
-            response => {
-              this.msgSuccess("修改成功");
-            }
-          );
-        }
-      });
-    },
-    close() {
-      this.$store.dispatch("tagsView/delView", this.$route);
-      this.$router.push({ path: "/index" });
-    }
-  }
-};
-</script>

+ 0 - 209
src/views/business/channel/profile/userAvatar.vue

@@ -1,209 +0,0 @@
-<template>
-  <div>
-    <div class="user-info-head" @click="editCropper()"><img v-bind:src="options.img" title="点击上传头像" class="img-circle img-lg" /></div>
-    <el-dialog :title="title" :visible.sync="open" width="800px" append-to-body @opened="modalOpened"  @close="closeDialog()">
-      <el-row>
-        <el-col :xs="24" :md="12" :style="{height: '350px'}">
-          <vue-cropper
-            ref="cropper"
-            :img="options.img"
-            :info="true"
-            :autoCrop="options.autoCrop"
-            :autoCropWidth="options.autoCropWidth"
-            :autoCropHeight="options.autoCropHeight"
-            :fixedBox="options.fixedBox"
-            @realTime="realTime"
-            v-if="visible"
-          />
-        </el-col>
-        <el-col :xs="24" :md="12" :style="{height: '350px'}">
-          <div class="avatar-upload-preview">
-            <img :src="previews.url" :style="previews.img" />
-          </div>
-        </el-col>
-      </el-row>
-      <br />
-      <el-row>
-        <el-col :lg="2" :md="2">
-          <el-upload action="#" :http-request="requestUpload" :show-file-list="false" :before-upload="beforeUpload">
-            <el-button size="small">
-              选择
-              <i class="el-icon-upload el-icon--right"></i>
-            </el-button>
-          </el-upload>
-        </el-col>
-        <el-col :lg="{span: 1, offset: 2}" :md="2">
-          <el-button icon="el-icon-plus" size="small" @click="changeScale(1)"></el-button>
-        </el-col>
-        <el-col :lg="{span: 1, offset: 1}" :md="2">
-          <el-button icon="el-icon-minus" size="small" @click="changeScale(-1)"></el-button>
-        </el-col>
-        <el-col :lg="{span: 1, offset: 1}" :md="2">
-          <el-button icon="el-icon-refresh-left" size="small" @click="rotateLeft()"></el-button>
-        </el-col>
-        <el-col :lg="{span: 1, offset: 1}" :md="2">
-          <el-button icon="el-icon-refresh-right" size="small" @click="rotateRight()"></el-button>
-        </el-col>
-        <el-col :lg="{span: 2, offset: 6}" :md="2">
-          <el-button type="primary" size="small" @click="uploadImg()">提 交</el-button>
-        </el-col>
-      </el-row>
-    </el-dialog>
-  </div>
-</template>
-
-<script>
-import store from "@/store";
-import { VueCropper } from "vue-cropper";
-import { uploadAvatar } from "@/api/system/user";
-import { publicFileGetUrl} from '@/api/common'
-
-export default {
-  components: { VueCropper },
-  props: {
-    user: {
-      type: Object
-    }
-  },
-  data() {
-    return {
-      // 是否显示弹出层
-      open: false,
-      // 是否显示cropper
-      visible: false,
-      // 弹出层标题
-      title: "修改头像",
-      options: {
-        img: store.getters.avatar, //裁剪图片的地址
-        autoCrop: true, // 是否默认生成截图框
-        autoCropWidth: 200, // 默认生成截图框宽度
-        autoCropHeight: 200, // 默认生成截图框高度
-        fixedBox: true // 固定截图框大小 不允许改变
-      },
-      previews: {}
-    };
-  },
-  computed: {
-    publicFileGetUrl() {
-      return publicFileGetUrl
-    }
-  },
-  methods: {
-    // 编辑头像
-    editCropper() {
-      this.open = true;
-    },
-    // 打开弹出层结束时的回调
-    modalOpened() {
-      this.visible = true;
-      let _this = this;
-      // 设置头像base64
-      // 其中this.avatar为当前头像
-      this.setAvatarBase64(this.options.img, (base64) => {
-        _this.options.img = base64;
-      });
-    },
-    // 覆盖默认的上传行为
-    requestUpload() {
-    },
-    // 向左旋转
-    rotateLeft() {
-      this.$refs.cropper.rotateLeft();
-    },
-    // 向右旋转
-    rotateRight() {
-      this.$refs.cropper.rotateRight();
-    },
-    // 图片缩放
-    changeScale(num) {
-      num = num || 1;
-      this.$refs.cropper.changeScale(num);
-    },
-    // 上传预处理
-    beforeUpload(file) {
-      if (file.type.indexOf("image/") == -1) {
-        this.msgError("文件格式错误,请上传图片类型,如:JPG,PNG后缀的文件。");
-      } else {
-        const reader = new FileReader();
-        reader.readAsDataURL(file);
-        reader.onload = () => {
-          this.options.img = reader.result;
-        };
-      }
-    },
-    // 上传图片
-    uploadImg() {
-      this.$refs.cropper.getCropBlob(data => {
-        let formData = new FormData();
-        formData.append("avatarfile", data);
-        uploadAvatar(formData).then(response => {
-          this.open = false;
-          this.options.img = this.publicFileGetUrl + response.imgUrl;
-          store.commit('SET_AVATAR', this.options.img);
-          this.msgSuccess("修改成功");
-          this.visible = false;
-        });
-      });
-    },
-    // 实时预览
-    realTime(data) {
-      this.previews = data;
-    },
-    // 关闭窗口
-    closeDialog() {
-      this.options.img = store.getters.avatar
-	    this.visible = false;
-    },
-    // 设置头像base64
-    setAvatarBase64(src, callback) {
-      // console.log("setAvatarBase64 src == "+src)
-      let _this = this;
-      let image = new Image();
-      // 处理缓存
-      image.src = src;
-      // 支持跨域图片
-      image.crossOrigin = "*";
-      image.onload = function () {
-        let base64 = _this.transBase64FromImage(image);
-         // console.log("setAvatarBase64 base64 == "+base64)
-        callback && callback(base64);
-      }
-    },
-    // 将网络图片转换成base64格式
-    transBase64FromImage(image) {
-      let canvas = document.createElement("canvas");
-      canvas.width = image.width;
-      canvas.height = image.height;
-      let ctx = canvas.getContext("2d");
-      ctx.drawImage(image, 0, 0, image.width, image.height);
-      // 可选其他值 image/jpeg
-      return canvas.toDataURL("image/png");
-    }
-  }
-};
-</script>
-<style scoped lang="scss">
-.user-info-head {
-  position: relative;
-  display: inline-block;
-  height: 120px;
-}
-
-.user-info-head:hover:after {
-  content: '+';
-  position: absolute;
-  left: 0;
-  right: 0;
-  top: 0;
-  bottom: 0;
-  color: #eee;
-  background: rgba(0, 0, 0, 0.5);
-  font-size: 24px;
-  font-style: normal;
-  -webkit-font-smoothing: antialiased;
-  -moz-osx-font-smoothing: grayscale;
-  cursor: pointer;
-  line-height: 110px;
-  border-radius: 50%;
-}
-</style>

+ 0 - 79
src/views/business/channel/profile/userInfo.vue

@@ -1,79 +0,0 @@
-<template>
-  <el-form ref="form" :model="user" :rules="rules" label-width="100px">
-    <el-form-item label="用户昵称" prop="nickName">
-      <el-input v-model="user.nickName" maxlength="30" />
-    </el-form-item>
-    <el-form-item label="手机号码" prop="phonenumber">
-      <el-input v-model="user.phonenumber" maxlength="11" :disabled="true"/>
-    </el-form-item>
-    <el-form-item label="邮箱" prop="email">
-      <el-input v-model="user.email" maxlength="50" />
-    </el-form-item>
-    <el-form-item label="性别">
-      <el-radio-group v-model="user.sex">
-        <el-radio label="0">男</el-radio>
-        <el-radio label="1">女</el-radio>
-      </el-radio-group>
-    </el-form-item>
-    <el-form-item>
-      <el-button type="primary" size="mini" @click="submit">保存</el-button>
-      <el-button type="danger" size="mini" @click="close">关闭</el-button>
-    </el-form-item>
-  </el-form>
-</template>
-
-<script>
-import { updateUserProfile } from "@/api/system/user";
-
-export default {
-  props: {
-    user: {
-      type: Object
-    }
-  },
-  data() {
-    return {
-      // 表单校验
-      rules: {
-        nickName: [
-          { required: true, message: "用户昵称不能为空", trigger: "blur" }
-        ],
-        email: [
-          { required: true, message: "邮箱地址不能为空", trigger: "blur" },
-          {
-            type: "email",
-            message: "'请输入正确的邮箱地址",
-            trigger: ["blur", "change"]
-          }
-        ],
-        phonenumber: [
-          { required: true, message: "手机号码不能为空", trigger: "blur" },
-          {
-            pattern: /^1[3|4|5|6|7|8|9][0-9]\d{8}$/,
-            message: "请输入正确的手机号码",
-            trigger: "blur"
-          }
-        ]
-      }
-    };
-  },
-  created() {
-    // console.log("created =======================================")
-  },
-  methods: {
-    submit() {
-      this.$refs["form"].validate(valid => {
-        if (valid) {
-          updateUserProfile(this.user).then(response => {
-            this.msgSuccess("修改成功");
-          });
-        }
-      });
-    },
-    close() {
-      this.$store.dispatch("tagsView/delView", this.$route);
-      this.$router.push({ path: "/index" });
-    }
-  }
-};
-</script>

+ 34 - 25
src/views/business/salesite/index.vue

@@ -26,7 +26,7 @@
       <el-form-item label="经销商名称" prop="name" label-width="90px">
         <el-input
           v-model="queryParams.name"
-          placeholder="请输入经销商名称"
+          placeholder="请输入经销商名称"
           clearable
           size="small"
           @keyup.enter.native="handleQuery"
@@ -84,13 +84,13 @@
         <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>
@@ -114,34 +114,36 @@
       <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>
+             <span v-if="getValue(row.status) == 2" 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>
-        </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="['system:post:edit']"
+            v-hasPermi="['admin:salesite:read']"
           >查看</el-button>
           <el-button
             size="mini"
             type="text"
+            disabled
             @click="handleUpdate(scope.row)"
-            v-hasPermi="['system:post:edit']"
+            v-hasPermi="['admin:salesite:edit']"
           >编辑</el-button>
           <el-button
             size="mini"
             type="text"
-            @click="handleDelete(scope.row)"
-            v-hasPermi="['system:post:remove']"
-          >停用</el-button>
+            @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>
@@ -174,14 +176,13 @@
 </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'
 export default {
-  name: "SaleSite",
+  name: "SaleSiteIndex",
   components: {
    SiteCreate,
    SiteDetail
@@ -445,20 +446,28 @@ export default {
           this.msgSuccess("删除成功");
         }).catch(() => {});
     },
-    /** 导出按钮操作 */
-    handleExport() {
-      const queryParams = this.queryParams;
-      this.$confirm('是否确认导出所有岗位数据项?', "警告", {
+
+
+    // 状态修改
+    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.exportLoading = true;
-          return exportPost(queryParams);
-        }).then(response => {
-          this.download(response.msg);
-          this.exportLoading = false;
-        }).catch(() => {});
+          this.msgSuccess(text + "成功");
+          this.getList();
+        }).catch(function() {
+          // row.status = row.status === "0" ? "1" : "0";
+        });
     }
   }
 };