result.js 2.72 KB
(function($$) {
    "use strict";
    let vm
  
    function init() {
      vm = new Vue({
        el: '#pageDiv',
        data: {
            info: {},

            busiFlag: '--',
            areaCode: ''
        },
        created: function() {
          this.info = JSON.parse(sessionStorage.getItem('huaiAnAppParam'))

          // this.info.campaignId = '54321'
          // sessionStorage.setItem('huaiAnAppParam',JSON.stringify(this.info))
          this.queryOrder()
        },
        methods: {
          httpRequest:function(param){
            let origin = "https://hhzj.lgyzpt.com"
            if(origin.includes('localhost')>0 || origin=='null' || origin.includes('file:')>0 || window.origin.includes('testznzl')){
              origin = 'https://testznzl.lgyzpt.com'
            }

            return new Promise(function(resolve, reject){
                axios ({
                    method: 'get',
                    url:origin + param.url,
                    timeout: param.time||15000,
                    data:param.data,
                    headers: {
                        'Content-Type': 'application/json'
                    }
                }).then((res) => {
                    resolve(res.data)
                }).catch(res => {
                    reject(res)
                })
            })
          },
          queryOrder(){
            this.httpRequest({
              url: '/compass/api/common/maintenance-personnel/code?personnelCode=' + this.info.campaignId
            }).then(res=>{
              if(res.code == 200){
                if(res.data && res.data.id){
                  this.areaCode = res.data.areaCode
                  this.busiFlag = '1'
                }else{
                  this.busiFlag = '2'
                }
              }
            })
          },

          goAdd(){
            let url = 'https://hhzj.lgyzpt.com/zhiJianBusi/zjbPhone/addBusi.html'

            if(window.location.origin.includes('testznzl.lgyzpt.com')){
              url = "https://testznzl.lgyzpt.com/activity/zjbPhone/addBusi.html"
            }
            
            window.location.replace(url+"?source=zhijian&phone="+this.info.accNbr+"&areaCode="+this.areaCode+"&campaignId="+this.info.campaignId)

            // window.location.replace(
            //   `${url}?source=zhijian\
            // &phone=${this.info.accNbr}\
            // &areaCode=${this.areaCode}\
            // &campaignId=${this.info.campaignId}`
            // );
          },
          goBack(){
            history.go(-1)
          }
        }
      })
    }

    init()
    window.vm = vm
  })(window.jQuery)
  

    window.addEventListener('load', function () {
        document.getElementById('pageDiv').style.display = 'block'; // 显示内容
    });