zhaoxiaoqiang
2021-05-17 af0d8cd16a8292959ee47f875b6fda4c71dcf62f
src/views/mine/stores/storeOprs-detail.vue
New file
@@ -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>