
<style scoped> 
.clearfix:after{content:".";display:block;height:0;clear:both;visibility:hidden}
.clearfix{overflow:hidden;_zoom:1;}
.text-gray{color:#717171;}
.text-orange{color:#eb7741;}
.text-danger{color:#c03546;}
.comp-login {background-color:#fff;height:100%;height:100vh;}
.input-box {background:#FFF;}
.comp-login {padding:0;margin:0;}
.Owner_StoreView{background: #F3F6FF;}
.layoutInfo{background-color: #fff;margin-bottom:0.3rem;}
.titleClerkInfo{padding:1rem 3%;padding-bottom:0;padding-left:3%; text-indent:1rem;color:#3A8AFB;background: url(http://image.supercarrier8.com/h5_key/icon-info.png) no-repeat 3% 1.1rem;background-size:0.8rem 0.8rem;background-color: #fff;}
.titleClerkInfo.useFunction{background-image: url(http://image.supercarrier8.com/h5_key/icon_function.png);background-size: 0.84rem;}
.titleClerkInfo.storeInfo{background-image: url(http://image.supercarrier8.com/h5_key/icon_managementStore.png);background-size: 0.82rem;}
.titleClerkInfo .btnAdd{float: right;border: 0.04rem solid #3A8AFB;border-radius: 0.6rem;text-align: center;text-indent: 0;width: 3.8rem;}
.productPanel{background-color: #fff;padding: 0 3%;}
.productWay {padding: 0.8rem 0;border-bottom: 0.01rem solid #f5f5f5;display:flex;line-height: 1;}
.functionItem{display: block;background: url(http://image.supercarrier8.com/h5_key/icon_select_2.png) no-repeat center right;background-size:1.1rem;}
.functionItem.selected{background-image: url(http://image.supercarrier8.com/h5_key/icon_selected.png)}
.functionItem.closed{background-image: url(http://image.supercarrier8.com/h5_key/icon_closeRed.png)}
.productWay .titleInfo{margin-right: 0.6rem}
.productWay .titleInfo span{width:4.2rem;display: inline-block;text-align:justify;text-justify:distribute-all-lines;/*ie6-8*/text-align-last:justify;/* ie9*/-moz-text-align-last:justify;/*ff*/-webkit-text-align-last:justify;/*chrome 20+*/}
.productWay .resultInfo{-webkit-box-flex: 1;flex: 1;}/*icon-tel-blue.png */
.productWay .resultInfo .telCode{color:#3A8AFB;margin-left:0.2rem;font-size:0.75rem;padding-right:0.9rem;background: url(http://image.supercarrier8.com/h5_key/icon-tel-blue.png) no-repeat 98% center;background-size:0.8rem 0.8rem;}
/* .functionItem .ifSelect{float:right;width:1.1rem;height: 1.1rem;} */
.mint-button{width:92%;margin:0 auto;margin-top:1rem;background-color:#3A8AFB;border-radius: 0.2rem;}
.mask {position: fixed;top: 0;left: 0;height: 100%;width: 100%;background: rgba(0, 0, 0, 0.5);}
</style>
<style>
.mint-indicator .mint-indicator-mask{z-index:2008;}
</style>
<template> 
  <div class="container comp-login jfBaseSize Owner_StoreView" v-cloak v-bind:style="isShow.vh?'height:100vh':'height: 100%;'">
    <div class="layoutInfo">
      <div class="titleClerkInfo storeInfo">经销商信息</div>
      <div class="productPanel">
        <div class="productWay">
            <div class="titleInfo">
              <span>经销商编号</span>
            </div>
            <div class="resultInfo">
              <span class="text-gray">{{model.DealerInfo.DealerNo}}</span>
            </div>
        </div>
        <div class="productWay">
          <div class="titleInfo">
            <span>经销商名称</span>
          </div>
          <div class="resultInfo">
            <span class="text-gray">{{model.DealerInfo.DealerName}}</span>
          </div>
        </div>
        <div class="productWay">
          <div class="titleInfo">
            <span>所在地址</span>
          </div>
          <div class="resultInfo">
            <span class="text-gray">{{model.DealerInfo.DealerAddressDetail}}</span>
          </div>
        </div>
        <div class="productWay">
          <div class="titleInfo">
            <span>销售区域</span>
          </div>
          <div class="resultInfo">
            <span class="text-gray" v-for="item in model.AddressArea" v-bind:key="item.DealerID">
                  <span v-html="item.SalesArealName" style="padding-right:0.5rem;"></span>
            </span>
          </div>
        </div>
        <div class="productWay">
          <div class="titleInfo">
            <span>注册时间</span>
          </div>
          <div class="resultInfo">
            <span class="text-gray">{{model.DealerInfo.ROW_CREATE_DATE}}</span>
          </div>
        </div>
      </div>
    </div>
    <div class="layoutInfo">
      <div class="titleClerkInfo">负责人信息</div>
      <div class="productPanel">
        <div class="productWay">
          <div class="titleInfo">
            <span>联系人</span>
          </div>
          <div class="resultInfo">
            <span class="text-gray">{{model.DealerInfo.ContactName}}</span>
          </div>
        </div>
        <div class="productWay">
          <div class="titleInfo">
            <span>手机号</span>
          </div>
          <div class="resultInfo">
            <span class="text-gray">{{model.DealerInfo.ContactTel}}</span>
            <a class="telCode" v-bind:href="'tel:'+model.DealerInfo.ContactTel">拨打</a>
          </div>
        </div>
      </div>
    </div>
     <ReturnHome ref="returnhome"></ReturnHome>
  </div>
</template>
<script>
import { Toast,InfiniteScroll } from 'mint-ui';
import {Indicator} from 'mint-ui';
import channelHelper from "@/assets/js/channelHelper.js";
import { base64 } from "@/assets/js/cryptoHelper";
import { debug } from 'util';
import ReturnHome from "@/components/channel/temp001/ReturnHome";
import '@/assets/js/libs/js.cookie';
export default {
  name: "Key_AddStore",
  components: {ReturnHome},
    provide(){       
     return{           
        goPage:this.goPage       
     }   
    },
  props: ["comp", "cfg", "selectedPage"],
  data() { 
    return {
      searchData:{},
      model:{
        DealerInfo:{
            DealerAddressDetail:"",
            ROW_VER:"",
            ROW_CREATE_DATE:"",
            DealerName:"",
            DealerNo:"",
            ContactName:"",
            ContactTel:""
        },
        AddressArea:[]
      },
      isShow:{
        vh:false,
      },
    };
  },
  methods: {
    goPage(pagetype){
        this.$parent.changeSelectedPage(pagetype);
    },
    setUseFunction(i){//设置使用功能
      var that=this;
      if (that.model.useFunction[i].isSelected) {
        that.$set(that.model.useFunction[i],'isSelected',false);
      }else{
        that.$set(that.model.useFunction[i],'isSelected',true);
      }
    },
    setStoreInfo:function(i){//删除门店
      var that=this;
      var storeInfoList=that.model.storeInfoList;
      storeInfoList.splice(i,1);
      that.$set(that.model,'storeInfoList',storeInfoList);
    },
    GetDealerInfoByOrgId:function(){//店员信息
      var that=this;
      Indicator.open();
      var url = "/channel/GetDealerInfoByOrgId";
      var dataParams = that.searchData;
      var cbError=function(){Indicator.close();}
      var cbSuccess = function(res){
          Indicator.close();
          if (res.flag){
            if (res.data&&res.data.DealerInfo&&res.data.DealerInfo.Table.length>0) {
              that.model.DealerInfo=res.data.DealerInfo.Table[0];
              that.model.AddressArea=res.data.SalesAreaList;
            }
          }else{
            Toast(res.msg);
            that.judgeLogin();
          }
      };
      //请求后端
      channelHelper.CommonCallService(url,dataParams,cbSuccess,cbError,null,null);
    },
    judgeLogin:function(){
      var eno = this.sup8.context.enterpriseno;
      if (!channelHelper.CheckLogin(this.$parent,eno,this.sup8.context.entranceid)) {
        this.$parent.changeSelectedPage('Key_Login');
        return false;
      }
    },
  },
  created: function() {
    var that = this;
    var isDesign = location.pathname.indexOf('design');
    if(isDesign!=-1)
    {
        return;
    }
    //判断是否登录
    that.judgeLogin();
    var data=JSON.parse(sessionStorage.getItem("OwnerStoreManager"));
    if (data&&data.ID) {
      that.$set(that,'searchData',{
        UserToken:channelHelper.GetUserToken(),
        EnterpriseNo:that.sup8.context.enterpriseno,
        LanguageType:channelHelper.GetLanguageType(),
        OrganizationId:(data.ID?data.ID:""),
      });
      that.GetDealerInfoByOrgId();
    }
  },
  mounted: function() {
    
  }
};
</script>
