From af0d8cd16a8292959ee47f875b6fda4c71dcf62f Mon Sep 17 00:00:00 2001
From: zhaoxiaoqiang
Date: Mon, 17 May 2021 16:54:02 +0800
Subject: [PATCH] Merge branch '20120518-daili' into dev

---
 src/views/mine/stores/storeOprs-detail.vue |  147 ++++++++++++++
 src/views/mine/stores/storeOprs.vue        |  180 ++++++++++++++++++
 src/router/routes.js                       |   28 ++
 src/views/mine/stores/stores-add.vue       |    6 
 src/api/index.js                           |    7 
 src/store/index.js                         |    3 
 src/views/mine/stores/stores.vue           |   36 +++
 src/views/mine/toggle-identity.vue         |    4 
 src/views/mine/account/account-add.vue     |    2 
 src/views/mine/stores/storeOprs-add.vue    |  117 +++++++++++
 src/router/index.js                        |    2 
 src/views/mine/mer/mer-manager.vue         |   15 +
 12 files changed, 526 insertions(+), 21 deletions(-)

diff --git a/src/api/index.js b/src/api/index.js
index 47527c6..2fbebf4 100644
--- a/src/api/index.js
+++ b/src/api/index.js
@@ -139,6 +139,9 @@
     storeStoreList(data) {
         return $http.post('/store/storeList', data);
     },
+    storeStorePersonList(data) {
+        return $http.post('/agency/userList', data);
+    },
     //门店详情
     storeDtl(data) {
         return $http.post('/store/dtl', data);
@@ -151,7 +154,9 @@
     storeAdd(data) {
         return $http.post('/store/add', data);
     },
-
+    agencyAddUser(data){
+        return $http.post('/agency/addUser', data); 
+    },
 
 
 
diff --git a/src/router/index.js b/src/router/index.js
index 4f0c3da..2bb7ea4 100644
--- a/src/router/index.js
+++ b/src/router/index.js
@@ -47,10 +47,8 @@
                 }else{
                     var appToken = str
                 }
-
             }
         }
-        console.log('token:',localStorage.hjToken)
         let user_pwd = localStorage.user_pwd;
         let hjToken = localStorage.hjToken;
         // let appToken = sessionStorage.appToken;
diff --git a/src/router/routes.js b/src/router/routes.js
index ea23242..33fadd4 100644
--- a/src/router/routes.js
+++ b/src/router/routes.js
@@ -191,11 +191,20 @@
       name:'stores-detail',
       component:()=>import("@/views/mine/stores/stores-detail.vue")
     },
-
     {
-        path:"/order/wxScore",
-        name:'order-wxScore',
-        component:()=>import("@/views/order/wxScore.vue")
+        path:"/mine/storesOprs",
+        name:'storeOprs',
+        component:()=>import("@/views/mine/stores/storeOprs.vue")
+    },
+    {
+        path:"/mine/storeOprs-add",
+        name:'stores-add',
+        component:()=>import("@/views/mine/stores/storeOprs-add.vue")
+    },
+    {
+        path:"/mine/storeOprs-detail",
+        name:'stores-detail',
+        component:()=>import("@/views/mine/stores/storeOprs-detail.vue")
     },
     //和微分
     {
@@ -204,6 +213,17 @@
         component:()=>import("@/views/old/store/wx-pay-score.vue")
     },
     {
+        path:"/order/wxScore",
+        name:'order-wxScore',
+        component:()=>import("@/views/order/wxScore.vue")
+    },
+    {
+        path:"/order/wxScore",
+        name:'order-wxScore',
+        component:()=>import("@/views/order/wxScore.vue")
+    },
+    // 添加店员
+    {
         path:"/wx-test-code",
         name:'wxTestCode',
         component:()=>import("@/views/old/store/wx-test-code.vue")
diff --git a/src/store/index.js b/src/store/index.js
index 5be4725..7f2068e 100644
--- a/src/store/index.js
+++ b/src/store/index.js
@@ -323,9 +323,6 @@
                 }
 
 
-
-
-
                 commit(SET_FOOTER_NAV, footernav);
                 commit(SET_USER_PAGE, userPage);
                 commit(SET_USER_INFO, data.body);
diff --git a/src/views/mine/account/account-add.vue b/src/views/mine/account/account-add.vue
index 33bd59d..5478d69 100644
--- a/src/views/mine/account/account-add.vue
+++ b/src/views/mine/account/account-add.vue
@@ -151,7 +151,7 @@
                 this.$api.userUpdate(this.form).then(res => {
                     this.$notify("保存成功");
                 })
-                    .catch(err => {});
+                .catch(err => {});
             },
             //冻结账号
             freeze() {
diff --git a/src/views/mine/mer/mer-manager.vue b/src/views/mine/mer/mer-manager.vue
index ecb29ca..ddb0ea6 100644
--- a/src/views/mine/mer/mer-manager.vue
+++ b/src/views/mine/mer/mer-manager.vue
@@ -28,12 +28,13 @@
                                     <use xlink:href="#iconshanghuguanliliebiao"></use>
                                 </svg>
                             </div>
-                            <div>
+                            <div style="width:120px">
                                 <p class="name" v-text="item.merName">商户名称</p>
                                 <p class="tel" v-text="item.priMblNo">未配置产品</p>
                                 <p class="tel" v-text="item.hbStatusName"></p>
                             </div>
                         </div>
+                        <van-button :style="{background:$store.state.backColor}" class="btn" @click.stop="goStoreMer(item.merId)" v-if="orgType != 2">门店管理</van-button>
                         <van-button :style="{background:$store.state.backColor}" class="btn" @click.stop="goTempDetail(item.merId)" v-if="orgType != 2">产品管理</van-button>
                     </div>
                 </div>
@@ -148,6 +149,15 @@
             goMerDetail(merId){
                 this.$router.push({
                     path:'/mine/mer-info',
+                    query:{
+                        merId
+                    }
+                })
+            },
+            //跳转到模板详情
+            goStoreMer(merId){
+                this.$router.push({
+                    path:'/mine/stores',
                     query:{
                         merId
                     }
@@ -274,7 +284,7 @@
 
         .name {
             font-weight: bold;
-            max-width: 170px;
+            max-width: 120px;
         }
 
         .tel {
@@ -285,6 +295,7 @@
 
         .btn {
             .lh(25px);
+            margin-right: 0px;
             padding: 0 12px;
             background: @c-bg-default;
             border-radius: 13px;
diff --git a/src/views/mine/stores/storeOprs-add.vue b/src/views/mine/stores/storeOprs-add.vue
new file mode 100644
index 0000000..9bd0f46
--- /dev/null
+++ b/src/views/mine/stores/storeOprs-add.vue
@@ -0,0 +1,117 @@
+
+<!--
+    新增门店
+-->
+
+<template>
+  <div class="stores-add-box h-100-g">
+
+    <v-navbar title="新增店员" fixed></v-navbar>
+    <div class="cell-group">
+      <v-cell v-model="form.priName" :max="6" label='负责人姓名' placeholder='请输入负责人姓名'></v-cell>
+      <v-cell v-model="form.priMblNo" :max="11" type="tel" label='负责人手机号' placeholder='请输入负责人手机号'></v-cell>
+    </div>
+    <p class="tip">*该手机号将作为登录用户名,密码将通过短信发至手机</p>
+    <div class="cell-group">
+      <v-cell v-model="form.priEmail" :max="50" label='联系邮箱' placeholder='请输入邮箱地址'></v-cell>
+    </div>
+
+    <footer class="flex-center-g footer">
+      <van-button class="btn" @click="addStore">新增店员</van-button>
+    </footer>
+  </div>
+</template>
+
+<script>
+  import { mapState } from 'vuex';
+  export default {
+    name: "stores-add",
+    data(){
+      return {
+        queryStoreId:"",
+        isShowArea:false,
+        Btn:false,
+        form:{
+          priName:'',   //负责人姓名
+          priEmail:'',  //联系邮箱
+          priMblNo:'',  //负责人手机
+        },
+
+        rule:[
+          {key:"priName",message:"请输入负责人姓名",type:"isEmpty"},
+          {key:"priName",message:"请输入正确的负责人姓名",rule:/^[\u4e00-\u9fa50-9a-zA-Z]{1,6}$/},
+          {key:"priMblNo",message:"请输入负责人手机号",type:"isEmpty"},
+          {key:"priMblNo",message:"请输入正确的手机号",type:"isTel"},
+          {key:"priEmail",message:"请输入联系邮箱",type:"isEmpty"},
+          {key:"priEmail",message:"请输入正确的联系邮箱",type:"isEmail"},
+        ]
+
+      }
+    },
+    computed:{
+      ...mapState(['areaList'])
+    },
+    created() {
+        this.queryStoreId =this.$route.query.storeId;
+    },
+    methods:{
+      // 验证form参数
+      validatorForm(){
+        return this.$validator(this.form,this.rule).check(item=>{
+          this.$notify(item.message)
+        })
+      },
+      // 新增门店
+      addStore(){
+        if(!this.validatorForm()) return
+        if(this.Btn)return
+        let list = {
+          name: this.form.priName,
+          mblNo: this.form.priMblNo,
+          email: this.form.priEmail,
+          orgId:this.queryStoreId
+        };
+        this.$api.agencyAddUser(list).then(() => {
+          this.$notify('新增成功');
+          this.Btn = true;
+          setTimeout(() => this.$router.go(-1), 1000);
+        });
+      }
+    }
+  }
+</script>
+
+<style scoped lang="less">
+.stores-add-box{
+  background-color: @c-bg-f5;
+  padding-top: 44px;
+  .tip {
+    margin: 10px 0 15px 21px;
+    font-size: @font-12;
+    color: @c-text-999;
+  }
+}
+
+
+.cell-group {
+  margin: 10px 8px 0;
+}
+
+.btn {
+  width: 340px;
+  height: 44px;
+  border: none;
+  font-size: @font-16;
+  border-radius: 22px;
+  background-color: @c-bg-default;
+  color: @c-text-fff;
+
+}
+
+.footer {
+  margin-top: 60px;
+  padding-bottom: 30px;
+}
+
+
+</style>
diff --git a/src/views/mine/stores/storeOprs-detail.vue b/src/views/mine/stores/storeOprs-detail.vue
new file mode 100644
index 0000000..1fb2eee
--- /dev/null
+++ b/src/views/mine/stores/storeOprs-detail.vue
@@ -0,0 +1,147 @@
+<template>
+<div class="stores-detail h-100-g">
+
+  <v-navbar title="店员详情" fixed rightText='保存' @right-click="Save"></v-navbar>
+  <div class="cell-group">
+    <v-cell v-model="form.priName" :max="6" label='负责人姓名' :readonly="true" placeholder='负责人姓名'></v-cell>
+    <v-cell v-model="form.priMblNo" :max="11" type="tel" label='负责人手机号' :readonly="true" placeholder='负责人手机号'></v-cell>
+    <v-cell v-model="form.priEmail" :max="50" label='联系邮箱'  placeholder='联系邮箱'></v-cell>
+  </div>
+   <footer class="flex-center-g footer">
+      <van-button class="btn" @click="freeze">{{menText}}</van-button>
+    </footer>
+  <van-dialog
+      class="setting-box-dialog"
+      v-model="dialogShow"
+      show-cancel-button
+      :message='Msg'
+      @confirm="onConfirm"
+  >
+  </van-dialog>
+</div>
+</template>
+
+<script>
+  import { mapState } from 'vuex';
+  export default {
+    name: "stores-detail",
+    data(){
+      return {
+        isShowArea:false,
+        dialogShow:false,
+        menText:'冻结店员',
+        Status:null,
+        Msg:'',
+        Btn:false,
+        form:{
+          priName:'',   //负责人姓名
+          priEmail:'',  //联系邮箱
+          priMblNo:'',  //负责人手机号
+        },
+        rule:[
+          {key:"priEmail",message:"请输入邮箱",type:"isEmpty"},
+        ]
+      }
+    },
+    created(){
+      this.init();
+    },
+    methods:{
+      init(){
+        let mgrId =this.$route.query.mgrId;
+        this.$api.getUserDetail(mgrId).then((res) => {
+          let data = res.body;
+          this.Status = data.status;
+          data.status ? this.menText = '冻结店员':this.menText = '启用店员';
+          this.form = {
+            priName:data.name,   //负责人姓名
+            priEmail:data.email,  //联系邮箱
+            priMblNo:data.mblNo  //负责人手机
+          }
+        })
+      },
+      freeze(){
+        this.dialogShow = !this.dialogShow;
+        this.Msg = `请问是否确认${this.Status ? '冻结' : '启用'}该店员?`;
+      },
+
+      //冻结/启用  门店
+      onConfirm() {
+        if(this.Btn2){return}
+        this.Btn2 = true;
+        this.$api.userFreezeMgr(this.$route.query.mgrId).then((res) => {
+            this.Btn2 = false;
+            this.$notify_success(`${ this.Status ? '冻结' : '启用'}店员成功`)
+            this.Status =  this.Status ? 0 : 1;
+            this.menText = this.Status ? '冻结店员' :'启用店员';
+          });
+      },
+      // 保存门店
+      Save(){
+        if(this.Btn){return}
+        this.Btn = true;
+        let list = {
+          name: this.form.priName,
+          mblNo: this.form.priMblNo,
+          email: this.form.priEmail,
+          orgId:this.queryStoreId,
+          id:this.$route.query.mgrId
+        };
+        if(this.$validator(this.form,this.rule).check(item=>{
+          this.$notify(item.message);
+        })){
+        this.$api.userUpdate(list).then((res) => {
+            this.Btn = false;
+            this.$notify_success('保存成功!');
+        });
+        }
+      },
+      //关闭地区弹窗
+      closeAreaModal(){
+        this.isShowArea = false;
+        this.$refs.Area.reset()
+      },
+      //保存 地区选择
+      setAreaValue(arr){
+        this.form.areaText = arr[0].name + '-' +arr[1].name +'-'+ arr[2].name;
+        this.form.provCode= arr[0].code;
+        this.form.cityCode= arr[1].code;
+        this.form.areaCode= arr[2].code;
+        this.isShowArea = false;
+        this.$refs.Area.reset()
+      },
+
+
+
+    }
+  }
+</script>
+
+<style scoped lang="less">
+.stores-detail{
+  background-color: @c-bg-f5;
+  padding-top: 44px;
+
+  .cell-group {
+    margin: 10px 8px 0;
+  }
+
+  .btn {
+    width: 340px;
+    height: 44px;
+    border: none;
+    font-size: @font-16;
+    border-radius: 22px;
+    background-color: @c-bg-default;
+    color: @c-text-fff;
+
+  }
+
+
+.footer {
+  margin-top: 60px;
+  padding-bottom: 30px;
+}
+
+}
+</style>
diff --git a/src/views/mine/stores/storeOprs.vue b/src/views/mine/stores/storeOprs.vue
new file mode 100644
index 0000000..bc25800
--- /dev/null
+++ b/src/views/mine/stores/storeOprs.vue
@@ -0,0 +1,180 @@
+<!--
+
+  店员管理-主页
+
+-->
+<template>
+  <div class="stores-box h-100-g">
+    <v-navbar title="店员管理" fixed></v-navbar>
+    <van-search class="search" placeholder="负责人姓名/负责人手机号" v-model="value" shape='round' @search="onSearch"/>
+    <div class="item-box">
+      <van-list
+        v-model="loading"
+        :finished="finished"
+        immediate-check='false'
+        offset="50"
+        finished-text="没有更多了"
+        @load="onLoad"
+      >
+        <div class="stores-item flex-start-g" v-for="(item, index) in list" :key="index" @click="go(item.id)">
+          <p class="icon-box flex-center-g">
+            <svg class="icon" aria-hidden="true" style="width:25px;height:25px;fill:#fff" >
+              <use xlink:href="#iconyonghu"></use>
+            </svg>
+          </p>
+          <div>
+            <p class="name" v-text="item.name || ''">店员名称</p>
+            <p class="c-text-666-g font-12-g" v-text="item.mblNo || ''">13586695442</p>
+          </div>
+        </div>
+      </van-list>
+    </div>
+    <van-button class="btn" @click="goAdd">
+      <div class="inner">
+        <van-icon name="plus"/>
+        <span class="text">新增</span>
+      </div>
+    </van-button>
+  </div>
+</template>
+
+<script>
+  export default {
+    name: "stores",
+    data() {
+      return {
+        value: '',
+        list:[],
+        loading:false,
+        finished:false,
+        storeId:'',
+        queryStoreId:""
+      }
+    },
+
+    created(){
+      this.queryStoreId =this.$route.query.storeId;
+      this.init();
+    },
+    methods: {
+      init(){
+        this.loading = true
+        this.$api.storeStorePersonList({
+          searchKey:this.value,
+          orgId:this.queryStoreId,
+        }).then((res) => {
+          if(res.body.length < 10){
+            this.list = [...this.list,...res.body]
+            this.storeId = ''
+            this.finished = true
+            this.loading = false
+          }else{
+            this.list = [...this.list,...res.body]
+            this.storeId = this.list[this.list.length-1].storeId
+            this.finished = false
+            this.loading = false
+          }
+        })
+      },
+      go(id) {
+        this.$router.push({path:'/mine/storeOprs-detail',query:{mgrId:id,storeId:this.queryStoreId}});
+      },
+      goAdd(){
+        console.log(this.storeId)
+        this.$router.push({path:'/mine/storeOprs-add',query:{storeId:this.queryStoreId}})
+      },
+      onLoad(){
+        this.init()
+      },
+      onSearch(val){
+        this.list = []
+        this.loading = true
+        this.$api.storeStorePersonList({
+          searchKey:this.value,
+          orgId:this.queryStoreId,
+        }).then(res=>{
+          if(res.body.length < 10){
+            this.list = [...this.list,...res.body]
+            this.storeId = ''
+            this.finished = true
+            this.loading = false
+          }else{
+            this.list = [...this.list,...res.body]
+            this.storeId = this.list[this.list.length-1].storeId
+            this.finished = false
+            this.loading = false
+          }
+        })
+      }
+
+
+    }
+  }
+</script>
+
+<style scoped lang="less">
+.stores-box {
+
+    background-color: @c-bg-f5;
+    padding-top: 44px;
+    box-sizing: border-box;
+    .btn {
+      position: fixed;
+      width: 50px;
+      height: 50px;
+      padding: 0;
+      right: 8px;
+      bottom: 68px;
+      border-radius: 50%;
+      color: @c-text-f5;
+      z-index: @zIndex-50;
+      box-shadow: 0px 5px 9px 0px rgba(80, 47, 183, 0.2);
+      background: linear-gradient(0deg, rgba(106, 79, 188, 1), rgba(137, 110, 219, 1));
+
+      .inner {
+        display: flex;
+        flex-direction: column;
+      }
+
+      .text {
+        .lh(15px);
+      }
+    }
+
+    //搜索框
+    .search {
+      margin-top: 10px;
+      padding: 15px 8px;
+    }
+
+
+    .item-box {
+      background-color: @c-bg-fff;
+      padding-bottom: 25px;
+    }
+
+
+    .stores-item {
+      height: 67px;
+      margin: 0 8px 10px;
+      padding-left: 12px;
+      box-shadow: 0px 0px 5px 0px rgba(66, 61, 93, 0.08);
+      border-radius: 3px;
+
+      .icon-box {
+        width: 32px;
+        height: 32px;
+        margin-right: 15px;
+        border-radius: 50%;
+        background-color: @c-bg-black;
+      }
+
+      .name {
+        margin-bottom: 5px;
+        font-weight: bold;
+      }
+    }
+
+
+}
+</style>
diff --git a/src/views/mine/stores/stores-add.vue b/src/views/mine/stores/stores-add.vue
index 701c517..d0d8376 100644
--- a/src/views/mine/stores/stores-add.vue
+++ b/src/views/mine/stores/stores-add.vue
@@ -53,7 +53,6 @@
       return {
         isShowArea:false,
         Btn:false,
-
         form:{
           areaText:'',  //地区文字展示
           storeName:'', //门店名称
@@ -88,6 +87,7 @@
       ...mapState(['areaList'])
     },
     created() {
+      this.merId = this.$route.query.merId;
     },
     methods:{
       // 验证form参数
@@ -149,7 +149,9 @@
           priIdNo: this.form.priIdNo,
           outChanNo: this.form.outChanNo,
         };
-
+        if(this.merId){
+          list.merId = this.merId;
+        }
         this.$api.storeAdd(list).then(() => {
           this.$notify('新增成功');
           this.Btn = true;
diff --git a/src/views/mine/stores/stores.vue b/src/views/mine/stores/stores.vue
index 66fb061..e5f00d7 100644
--- a/src/views/mine/stores/stores.vue
+++ b/src/views/mine/stores/stores.vue
@@ -5,7 +5,6 @@
 -->
 <template>
   <div class="stores-box h-100-g">
-
     <v-navbar title="门店管理" fixed></v-navbar>
     <van-search class="search" placeholder="请输入门店名称/负责人姓名/负责人手机号" v-model="value" shape='round' @search="onSearch"/>
     <div class="item-box">
@@ -27,11 +26,12 @@
             <p class="name" v-text="item.storeName || ''">门店名称</p>
             <p class="c-text-666-g font-12-g" v-text="item.priMblNo || ''">13586695442</p>
           </div>
+          <van-button :style="{background:$store.state.backColor}" class="opr-btn" @click.stop="goStoreOprs(item.storeId)" v-if="orgType != 2">店员管理</van-button>
         </div>
       </van-list>
     </div>
 
-    <van-button class="btn" @click="$router.push('/mine/stores-add')">
+    <van-button class="btn" @click="$router.push(`/mine/stores-add?merId=${merId}`)">
       <div class="inner">
         <van-icon name="plus"/>
         <span class="text">新增</span>
@@ -51,19 +51,23 @@
         list:[],
         loading:false,
         finished:false,
-        storeId:''
+        storeId:'',
+        merId:'',
       }
     },
-    
+
     created(){
+      this.merId = this.$route.query.merId;
       this.init();
     },
     methods: {
       init(){
+          console.log("merId:"+this.merId);
         this.loading = true
         this.$api.storeStoreList({
           searchKey:this.value,
           storeId:this.storeId,
+          merId:this.merId,
         }).then((res) => {
           if(res.body.storeList.length < 10){
             this.list = [...this.list,...res.body.storeList]
@@ -78,8 +82,14 @@
           }
         })
       },
-
-
+      goStoreOprs(storeId){
+          this.$router.push({
+              path:'/mine/storesOprs',
+              query:{
+                  storeId:storeId
+              }
+          })
+      },
       go(id) {
         this.$router.push({path:'/mine/stores-detail',query:{storeId:id}});
       },
@@ -92,6 +102,7 @@
         this.loading = true
         this.$api.storeStoreList({
           searchKey:this.value,
+          merId:this.merId,
         }).then(res=>{
           if(res.body.storeList.length < 10){
             this.list = [...this.list,...res.body.storeList]
@@ -172,6 +183,19 @@
       .name {
         margin-bottom: 5px;
         font-weight: bold;
+        width:200px;
+        overflow: hidden;
+        white-space: nowrap;
+        text-overflow: ellipsis;
+      }
+
+      .opr-btn {
+        .lh(25px);
+        margin-right: 0px;
+        padding: 0 12px;
+        background: @c-bg-default;
+        border-radius: 13px;
+        color: @c-text-fff;
       }
     }
 
diff --git a/src/views/mine/toggle-identity.vue b/src/views/mine/toggle-identity.vue
index 326eea0..b0c8ed3 100644
--- a/src/views/mine/toggle-identity.vue
+++ b/src/views/mine/toggle-identity.vue
@@ -155,8 +155,12 @@
         }
 
         .name {
+            width: 200px;
             font-size: @font-16;
             font-weight: bold;
+            overflow: hidden;
+            white-space: nowrap;
+            text-overflow: ellipsis;
         }
 
         .time {

--
Gitblit v1.8.0