zhaoxiaoqiang
2021-07-20 438088cf1f19324b6c21430f2a64a24b92664b30
src/views/mine/stores/storeOprs-detail.vue
@@ -2,36 +2,14 @@
<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>
    <v-cell v-model="form.priEmail" :max="50" label='联系邮箱'  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>
   <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"
@@ -40,12 +18,6 @@
      @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>
@@ -53,132 +25,88 @@
  import { mapState } from 'vuex';
  export default {
    name: "stores-detail",
    computed: {
      ...mapState(["userinfo"]),
    },
    data(){
      return {
        orgType:"",
        isShowArea:false,
        dialogShow:false,
        menText:'',
        menText:'冻结店员',
        Status:null,
        Msg:'',
        Btn:false,
        form:{
          areaText:'',//地区文字展示
          storeName:'', //门店名称
          dtlAddr:'',   //详细地址
          priName:'',   //负责人姓名
          priEmail:'',  //联系邮箱
          priMblNo:'',  //负责人手机
          priIdNo:'',  //负责人身份证号
          provCode: '',
          cityCode: '',
          areaCode: '',
          outChanNo:'',
          priMblNo:'',  //负责人手机号
        },
        rule:[
          {key:"dtlAddr",message:"请输入详细地址",type:"isEmpty"},
          {key:"priEmail",message:"请输入邮箱",type:"isEmpty"},
        ]
      }
    },
    computed:{
      ...mapState(['areaList'])
    },
    created(){
      this.orgType = this.userinfo.orgType;
      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 = '启用门店';
        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 = {
            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
            priName:data.name,   //负责人姓名
            priEmail:data.email,  //联系邮箱
            priMblNo:data.mblNo  //负责人手机
          }
        })
      },
      freeze(){
        this.dialogShow = !this.dialogShow;
        this.Msg = `请问是否确认${this.Status ? '冻结' : '启用'}该门店?`;
        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.$api.userFreezeMgr(this.$route.query.mgrId).then((res) => {
            this.Btn2 = false;
            this.$notify_success(`${ this.Status ? '冻结' : '启用'}门店成功`)
            this.$notify_success(`${ this.Status ? '冻结' : '启用'}店员成功`)
            this.Status =  this.Status ? 0 : 1;
            this.menText = this.Status ? '冻结门店' :'启用门店';
            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
          name: this.form.priName,
          mblNo: this.form.priMblNo,
          email: this.form.priEmail,
          orgId:this.queryStoreId,
          id:this.$route.query.mgrId
        };
        if(this.$validator(list.addr,this.rule).check(item=>{
        list.menuPower = [100001, 100006]
        if(this.$validator(this.form,this.rule).check(item=>{
          this.$notify(item.message);
        })){
          this.$api.storeEdit(list).then((res) => {
        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;
@@ -204,33 +132,22 @@
    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;
    .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;
      }
    }
  }
.footer {
  margin-top: 60px;
  padding-bottom: 30px;
}
}
</style>