liangjin
2021-05-14 362f5c666a7bf22aeec6688bf6b0ca28749a5abd
和微分
3 files added
5 files modified
679 ■■■■■ changed files
src/router/index.js 2 ●●●●● patch | view | raw | blame | history
src/router/routes.js 16 ●●●●● patch | view | raw | blame | history
src/store/index.js 3 ●●●●● patch | view | raw | blame | history
src/views/mine/mer/mer-manager.vue 15 ●●●● patch | view | raw | blame | history
src/views/mine/stores/storeOprs-add.vue 200 ●●●●● patch | view | raw | blame | history
src/views/mine/stores/storeOprs-detail.vue 236 ●●●●● patch | view | raw | blame | history
src/views/mine/stores/storeOprs.vue 180 ●●●●● patch | view | raw | blame | history
src/views/mine/stores/stores.vue 27 ●●●●● patch | view | raw | blame | history
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;
src/router/routes.js
@@ -191,7 +191,21 @@
      name:'stores-detail',
      component:()=>import("@/views/mine/stores/stores-detail.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")
    },
    {
        path:"/order/wxScore",
        name:'order-wxScore',
src/store/index.js
@@ -323,9 +323,6 @@
                }
                commit(SET_FOOTER_NAV, footernav);
                commit(SET_USER_PAGE, userPage);
                commit(SET_USER_INFO, data.body);
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;
src/views/mine/stores/storeOprs-add.vue
New file
@@ -0,0 +1,200 @@
<!--
    新增门店
-->
<template>
  <div class="stores-add-box h-100-g">
    <v-navbar title="新增店员" fixed></v-navbar>
    <div class="cell-group">
      <v-cell v-model="form.storeName" :max="20" label='门店名称' icon='iconyonghu' placeholder='请输入门店名称'></v-cell>
      <v-cell  label='所在地区' icon='icondingwei' @click.native="isShowArea = true;" placeholder='请选择'>
        <div slot="v-cell-right" class="flex-center-g">
          <div v-if="form.areaText">{{form.areaText}}</div>
          <div v-else style="color: #a2a2a2">请选择 </div>
          <svg class="icon" aria-hidden="true" style="width:18px;height:18px;fill:#999;">
            <use xlink:href="#iconyou"></use>
          </svg>
        </div>
      </v-cell>
      <v-cell v-model="form.dtlAddr" :max="30" label='详细地址' icon='icontishi' placeholder='请输入详细地址'></v-cell>
    </div>
    <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>
      <v-cell v-model="form.priIdNo" :max="18" label='负责人身份证号' placeholder='请输入身份证号'></v-cell>
      <v-cell v-model="form.outChanNo" :max="20" 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>
    <van-popup v-model="isShowArea" position="bottom" :close-on-click-overlay="false">
      <van-area ref='Area' :area-list='areaList' @cancel="closeAreaModal" @confirm="setAreaValue"></van-area>
    </van-popup>
  </div>
</template>
<script>
  import { mapState } from 'vuex';
  export default {
    name: "stores-add",
    data(){
      return {
        isShowArea:false,
        Btn:false,
        form:{
          areaText:'',  //地区文字展示
          storeName:'', //门店名称
          dtlAddr:'',   //详细地址
          priName:'',   //负责人姓名
          priEmail:'',  //联系邮箱
          priMblNo:'',  //负责人手机
          priIdNo: '', //身份证号
          provCode: '',
          cityCode: '',
          areaCode: '',
          outChanNo: '',
        },
        rule:[
          {key:"storeName",message:"请输入门店名称",type:"isEmpty"},
          {key:"areaText",message:"请选择地址",type:"isEmpty"},
          {key:"dtlAddr",message:"请输入详细地址",type:"isEmpty"},
          {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:"priIdNo",message:"请输入负责人身份证号",type:"isEmpty"},
          {key:"priIdNo",message:"请输入正确的身份证号",type:"checkIDCard"},
          {key:"priEmail",message:"请输入联系邮箱",type:"isEmpty"},
          {key:"priEmail",message:"请输入正确的联系邮箱",type:"isEmail"},
        ]
      }
    },
    computed:{
      ...mapState(['areaList'])
    },
    created() {
    },
    methods:{
      // 验证form参数
      validatorForm(){
          let v = this.$tool;
          if(v.checkValEmpty(this.form.outChanNo)){
              v.toast('请输入渠道编码');
              return false;
          }
        return this.$validator(this.form,this.rule).check(item=>{
          this.$notify(item.message)
        })
      },
      //关闭地区弹窗
      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.form.provName= arr[0].name;
        this.form.cityName= arr[1].name;
        this.form.areaName= arr[2].name;
        this.isShowArea = false;
        this.$refs.Area.reset()
      },
      // 新增门店
      addStore(){
        if(!this.validatorForm()) return
        if(this.Btn)return
        let list = {
          storeName: this.form.storeName,
          addr:{
            province:{
              code:this.form.provCode,
              name:this.form.provName
            },
            city:{
              code:this.form.cityCode,
              name:this.form.cityName
            },
            area:{
              code:this.form.areaCode,
              name:this.form.areaName
            },
            dtlAddr:this.form.dtlAddr
          },
          priName: this.form.priName,
          priMblNo: this.form.priMblNo,
          priEmail: this.form.priEmail,
          priIdNo: this.form.priIdNo,
          outChanNo: this.form.outChanNo,
        };
        this.$api.storeAdd(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>
src/views/mine/stores/storeOprs-detail.vue
New file
@@ -0,0 +1,236 @@
<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.storeName" :max="20" label='门店名称' :readonly="true" icon='iconyonghu' placeholder='门店名称'></v-cell>
    <v-cell  label='所在地区'  icon='icondingwei'  placeholder='所在地区' @click.native="isShowArea = true;">
      <div slot="v-cell-right" class="flex-center-g">
        <div>{{form.areaText}}</div>
        <svg class="icon" aria-hidden="true" style="width:18px;height:18px;fill:#999;">
          <use xlink:href="#iconyou"></use>
        </svg>
      </div>
    </v-cell>
    <v-cell v-model="form.dtlAddr" :max="30" label='详细地址'  icon='icontishi' placeholder='详细地址'></v-cell>
  </div>
  <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='联系邮箱' :readonly="true" placeholder='联系邮箱'></v-cell>
    <v-cell v-model="form.priIdNo" :max="18" label='负责人身份证号' :readonly="true" placeholder='负责人身份证号'></v-cell>
    <v-cell v-model="form.outChanNo" :max="18" label='渠道编码' :readonly="true" placeholder='渠道编码'></v-cell>
  </div>
  <footer class="flex-center-g footer">
    <van-button class="btn left" @click="freeze">{{ menText }}</van-button>
    <van-button class="btn right" @click="$router.push('/order/wxScore')">订单查询</van-button>
  </footer>
  <van-dialog
      class="setting-box-dialog"
      v-model="dialogShow"
      show-cancel-button
      :message='Msg'
      @confirm="onConfirm"
  >
  </van-dialog>
  <van-popup v-model="isShowArea" position="bottom" :close-on-click-overlay="false">
    <van-area ref='Area' :area-list='areaList' @cancel="closeAreaModal" @confirm="setAreaValue"></van-area>
  </van-popup>
</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:{
          areaText:'',//地区文字展示
          storeName:'', //门店名称
          dtlAddr:'',   //详细地址
          priName:'',   //负责人姓名
          priEmail:'',  //联系邮箱
          priMblNo:'',  //负责人手机
          priIdNo:'',  //负责人身份证号
          provCode: '',
          cityCode: '',
          areaCode: '',
          outChanNo:'',
        },
        rule:[
          {key:"dtlAddr",message:"请输入详细地址",type:"isEmpty"},
        ]
      }
    },
    computed:{
      ...mapState(['areaList'])
    },
    created(){
      this.init();
    },
    methods:{
      init(){
        this.$api.storeDtl({storeId: this.$route.query.storeId}).then((res) => {
          let data = res.body,
              addr = data.addr;
          this.Status = data.freezeStatus;
          data.freezeStatus ? this.menText = '冻结门店':this.menText = '启用门店';
          this.form = {
            areaText:addr.province.name + '-' + addr.city.name + '-' + addr.area.name,  //地区文字展示
            storeName:data.storeName, //门店名称
            dtlAddr:addr.dtlAddr,   //详细地址
            priName:data.priName,   //负责人姓名
            priEmail:data.priEmail,  //联系邮箱
            priMblNo:data.priMblNo,  //负责人手机
            priIdNo:data.priIdNo,  //负责人身份证号
            provCode: addr.province.code,
            cityCode: addr.city.code,
            areaCode: addr.area.code,
            provName:addr.province.name,
            cityName:addr.city.name,
            areaName:addr.area.name,
            outChanNo:data.outChanNo
          }
        })
      },
      freeze(){
        this.dialogShow = !this.dialogShow;
        this.Msg = `请问是否确认${this.Status ? '冻结' : '启用'}该门店?`;
      },
      //冻结/启用  门店
      onConfirm() {
        if(this.Btn2){return}
        this.Btn2 = true;
        this.$api.channSwitchStatus({
            orgId: this.$route.query.storeId,
            orgType: 4,
            statusType: this.Status ? 0 : 1
          })
          .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 = {
          addr:{
            province:{
              code:this.form.provCode,
              name:this.form.provName
            },
            city:{
              code:this.form.cityCode,
              name:this.form.cityName
            },
            area:{
              code:this.form.areaCode,
              name:this.form.areaName
            },
            dtlAddr:this.form.dtlAddr
          },
          storeId:this.$route.query.storeId
        };
        if(this.$validator(list.addr,this.rule).check(item=>{
          this.$notify(item.message);
        })){
          this.$api.storeEdit(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;
  }
  .footer{
    margin-top: 60px;
    padding-bottom: 30px;
    .btn{
      width: 170px;
      height: 44px;
      border: none;
      font-size: @font-16;
      &.left{
        background-color: @c-bg-eee;
        color: @c-text-666;
        border-radius:22px 0px 0px 22px;
      }
      &.right{
        background-color: @c-bg-default;
        color: @c-text-fff;
        border-radius:0px 22px 22px 0px;
      }
    }
  }
}
</style>
src/views/mine/stores/storeOprs.vue
New file
@@ -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.storeId)">
          <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.storeName || ''">店员名称</p>
            <p class="c-text-666-g font-12-g" v-text="item.priMblNo || ''">13586695442</p>
          </div>
        </div>
      </van-list>
    </div>
    <van-button class="btn" @click="$router.push('/mine/stores-add')">
      <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:''
      }
    },
    created(){
      this.init();
    },
    methods: {
      init(){
        this.loading = true
        this.$api.storeStoreList({
          searchKey:this.value,
          storeId:this.storeId,
        }).then((res) => {
          if(res.body.storeList.length < 10){
            this.list = [...this.list,...res.body.storeList]
            this.storeId = ''
            this.finished = true
            this.loading = false
          }else{
            this.list = [...this.list,...res.body.storeList]
            this.storeId = this.list[this.list.length-1].storeId
            this.finished = false
            this.loading = false
          }
        })
      },
      go(id) {
        this.$router.push({path:'/mine/stores-detail',query:{storeId:id}});
      },
      onLoad(){
        this.init()
      },
      onSearch(val){
        this.list = []
        this.loading = true
        this.$api.storeStoreList({
          searchKey:this.value,
        }).then(res=>{
          if(res.body.storeList.length < 10){
            this.list = [...this.list,...res.body.storeList]
            this.storeId = ''
            this.finished = true
            this.loading = false
          }else{
            this.list = [...this.list,...res.body.storeList]
            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;
    .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>
src/views/mine/stores/stores.vue
@@ -27,6 +27,7 @@
            <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>
@@ -51,19 +52,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]
@@ -79,6 +84,15 @@
        })
      },
        //跳转到模板详情
        goStoreOprs(merId){
            this.$router.push({
                path:'/mine/storesOprs',
                query:{
                    storeId:this.storeId
                }
            })
        },
      go(id) {
        this.$router.push({path:'/mine/stores-detail',query:{storeId:id}});
@@ -92,6 +106,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 +187,16 @@
      .name {
        margin-bottom: 5px;
        font-weight: bold;
        width:200px;
      }
      .opr-btn {
        .lh(25px);
        margin-right: 0px;
        padding: 0 12px;
        background: @c-bg-default;
        border-radius: 13px;
        color: @c-text-fff;
      }
    }