{
  template:'${tmpl}',
  data:function(){
      return {
        from:"",
        order:{},
        icpcustomerinfo:{},
        apply:{},
        serviceitem:{},
        price:"暂无",
        orderNum:"",
        zjname:"证件扫描件",
        d: {},
        action: "",
      }
  },
  computed: Vuex.mapState({
    count:state=>state.count,
    headStyle:function(){
      return {"background-color":"white"};
    }
  }),
  created:function(){
    console.log("currentUser++++++++++++++++++++++++++++++");
    console.log(this.currentUser);
    var currentUser = this.currentUser;
    if(currentUser){
      var roles = currentUser.roles;
      if(roles){
        this.roleList=roles.split(",");
      }
    }
    if(this.roleList && this.roleList.length>0){
      for(var i=0;i<this.roleList.length;i++){
        if(this.roleList[i]=="bizemp"){
          this.isBizemp=true;
        }
      }
    }
    var orderNum=this.$router.history.current.query.orderNum;
    this.from=this.$router.history.current.query.from;
    if(!orderNum){
      this.$message.warning("订单号参数错误");
      return ;
    }
    this.orderNum = orderNum;
    this.getOrderDetail();
  },
  mounted:function(){
    var that = this;
    that.toTop();
    this.$root.postReq("/web/uploadCtl/getOssConfig", "").then(function (d) {
      that.d["key"] = "key";
      that.d["Bucket"] = d.Bucket;
      that.d["OSSAccessKeyId"] = d.OSSAccessKeyId;
      that.d["Signature"] = d.Signature;
      that.d["policy"] = d.policy;
      that.d["success_action_status"] = d.success_action_status;
      that.action = d.url;
    });
  },
  methods:{
    getOrderDetail:function(){
      var orderNum = this.orderNum;
      var that=this;
      this.$root.showMask();
      this.$root.getReq("/web/orderCtl/getIcpOrderDetail",{orderNum:orderNum}).then(function(d){
        console.log(d);
        if(d && d.code==1){
          var data = d.data;
          that.order = data.order;
          that.icpcustomerinfo = data.icpcustomerinfo;
          if(data.order && data.order.serviceitem){
            that.serviceitem = data.serviceitem;
            that.price = data.serviceitem.price;
          }else{
            that.getServiceItem();
          }
        }
        that.$root.hideMask();
      }).catch(function(e){
        that.$root.hideMask();
      });
    },
    showUrl(url){
      window.open(url);
    },
    formatTime(data){
      if(data){
        var d = new Date(data);
        var datetime=d.getFullYear() + '-' + (d.getMonth() + 1) + '-' + d.getDate() + ' ' + d.getHours() + ':' + d.getMinutes() + ':' + d.getSeconds();
        return datetime;
      }else{
        return "";
      }
      
    },
    error(err){
      this.$message.warning(`上传失败，请重新上传`);
      console.log(err);
    },
    openUrl(flag){
      var that = this;
      if (flag == "yyzz") {
        window.open(that.icpcustomerinfo["businessLicensePic"]);
      }
      if (flag == "zzdxywsqb") {
        window.open(that.icpcustomerinfo["valueAddedTelecomBusinessApplicationForm"]);
      }
      if (flag == "frsfz") {
        window.open(that.icpcustomerinfo["legalRepresentativeCertificatePic"]);
      }
      if (flag == "zrrgdsfz") {
        window.open(that.icpcustomerinfo["naturalPersonShareholderIdCard"]);
      }
      if (flag == "tgxyidc") {
        window.open(that.icpcustomerinfo["trusteeshipAgreementAndIDC"]);
      }
      if (flag == "ymzs") {
        window.open(that.icpcustomerinfo["domainNameCertificate"]);
      }
      if (flag == "zfxypz") {
        window.open(that.icpcustomerinfo["paymentAgreementAndLicense"]);
      }
      if (flag == "zjlxsmsjrzmb") {
        window.open(that.icpcustomerinfo["capitalFlowDesAndMerchantPresenceTemp"]);
      }
    },
    changeOrderStatus(v){
      console.log(v);
      console.log(this.order.orderStatus);
    },
    uploadsuccess(obj){
      console.log(obj, "bbbbbbbbbbbbbbbbbbbbbbbbbbb");
      var that = this;
      if (obj.flag == "yyzz") {
        that.icpcustomerinfo["businessLicensePic"] = obj.result;
      }
      if (obj.flag == "zzdxywsqb") {
        that.icpcustomerinfo["valueAddedTelecomBusinessApplicationForm"] = obj.result;
      }
      if (obj.flag == "frsfz") {
        that.icpcustomerinfo["legalRepresentativeCertificatePic"] = obj.result;
      }
      if (obj.flag == "zrrgdsfz") {
        that.icpcustomerinfo["naturalPersonShareholderIdCard"] = obj.result;
      }
      if (obj.flag == "tgxyidc") {
        that.icpcustomerinfo["trusteeshipAgreementAndIDC"] = obj.result;
      }
      if (obj.flag == "ymzs") {
        that.icpcustomerinfo["domainNameCertificate"] = obj.result;
      }
      if (obj.flag == "zfxypz") {
        that.icpcustomerinfo["paymentAgreementAndLicense"] = obj.result;
      }
      if (obj.flag == "zjlxsmsjrzmb") {
        that.icpcustomerinfo["capitalFlowDesAndMerchantPresenceTemp"] = obj.result;
      }
    },
    beforeUpload(file){

    },
    setKey(name, flag){
      console.log("setKey+++++++++++++++++++++++++++");
      console.log(name);
      console.log(flag);
      name = name.substring(name.length - 5);
      var myDate = new Date();
      var key = "zc_" + flag + Math.round(Math.random() * 10000) + myDate.getTime() + myDate.getFullYear() + myDate.getMonth() + myDate.getDate() + name;

      this.$refs[flag].d.key = key;
    },
    toTop(){
      $('#app').animate({ scrollTop: 0 }, 10);
    },
    save(){
      var that = this;
      if(this.orderNum){
        var form = {
          orderNum:this.orderNum,
          orderStatus:this.order.orderStatus,
          businessLicensePic:that.icpcustomerinfo["businessLicensePic"],
          valueAddedTelecomBusinessApplicationForm:that.icpcustomerinfo["valueAddedTelecomBusinessApplicationForm"],
          legalRepresentativeCertificatePic:that.icpcustomerinfo["legalRepresentativeCertificatePic"],
          naturalPersonShareholderIdCard:that.icpcustomerinfo["naturalPersonShareholderIdCard"],
          trusteeshipAgreementAndIDC:that.icpcustomerinfo["trusteeshipAgreementAndIDC"],
          domainNameCertificate:that.icpcustomerinfo["domainNameCertificate"],
          paymentAgreementAndLicense:that.icpcustomerinfo["paymentAgreementAndLicense"],
          capitalFlowDesAndMerchantPresenceTemp:that.icpcustomerinfo["capitalFlowDesAndMerchantPresenceTemp"]
        };
        this.$root.showMask();
        this.$root.postReq("/web/orderCtl/saveIcpOrder",form).then(d=>{
          console.log(d);
          if(d && d.code==1){
            this.$message.warning("保存成功");
          }else{
            this.$message.warning("保存失败");
          }
          that.$root.hideMask();
        }).catch(function(e){
          that.$root.hideMask();
          this.$message.warning("保存失败");
        });
      }else{
        this.$message.warning("订单号参数错误");
        return;
      }
      

    }
  },

  vname:"gsb-icpOrderDetail"
}
