wuliu.js 1.11 KB
var os=getApp().globalData.setting;
Page({
  data:{
      isLoad:0,
      url: os.imghost,
      show:0
  },
  onLoad:function(t){
      var th=this;
      var order_id=t.order_id;
      getApp().promiseGet('/api/weshop/order/getWaybillToken/'+os.stoid+'/'+order_id,{}).then(res=>{

          if(res.data.code==0){
              th.data.isLoad=1;
              this.setData({show:0});
              setTimeout(()=>{
                  var plugin = requirePlugin("logisticsPlugin");
                  plugin.openWaybillTracking({
                      waybillToken: res.data.data
                  });
              },100)
          }else{
              var msg="查询物流失败";
              if(res.data.msg) msg=res.data.msg;
              wx.showToast({
                  title: msg,
                  icon: 'none',
                  duration: 1000,
              });
          }
      })
  },
  onShow: function(){
      this.setData({show:0})
      if(this.data.isLoad){
          this.data.isLoad=0;
          wx.navigateBack({ delta: 1 })  //返回上一页
          return false;
      }
      this.setData({show:1})


  }


});