
var app = getApp()
var that=null
var sopenFrame=null
Page( {
  data: {
    loadingHidden:false,
    items:[],
    times:"",
    status:0,
    tconut:0,
    orderydh:"",
    orderkdgs:"",
    zftype:0,
    orderid:0, 
    apiurl:""
  },

  onLoad: function(options) {
      that = this
      that.rdata(options.wlxx)
  },rdata: function(xx) {
      var userId = wx.getStorageSync("userId")
      var LoginId = wx.getStorageSync("LoginId")
      var wlxx=xx.split("|")
      if(wlxx[0]!="auto"){
      wx.request({
        url: app.globalData.apiurl + "/xapiajax.ashx", 
        data: { 
          action:"kdchaxun",
          kdgs:wlxx[0], 
          ydh:wlxx[2],
          userId:(userId==null?"":userId),
          LoginId:(LoginId==null?"":LoginId)
        },
        method:"GET",
        dataType:"json", 
        header: { 
          "content-type": "application/json" // 默认值
        },
        success (res) { 
          
            if(res.data.success){ 
               
              var items=res.data.items.reverse()
              for(var i=0;i<items.length;i++){
                   var list=items[i].lists.reverse()
                   items[i].lists=list
              }
              that.setData({
                  items:items,
                  times:res.data.times,
                  status:parseInt(res.data.status == null ? res.data.items[0].status : res.data.status),
                  tconut:items.length,
                  orderydh:wlxx[2],
                  orderkdgs:wlxx[1],
                  apiurl:app.globalData.apiurl,
                  loadingHidden0:false,
                  loadingHidden:true
              })
             
          }else{
            wx.showToast({
              title:res.data.msg,
              icon: "none",
              duration: 30000
           })  
           that.setData({
            orderydh:wlxx[2],
            orderkdgs:wlxx[1],
            loadingHidden0:true,
            loadingHidden:true
           })
          }
          }
      })
    }else{
      that.setData({
        orderydh:wlxx[2],
        orderkdgs:wlxx[1],
        loadingHidden0:true,
        loadingHidden:true
       })
    }
    },copyText:function(e) {
      wx.setClipboardData({
        data: e.currentTarget.dataset.text,
        success: function (res) {
          wx.getClipboardData({
            success: function (res) {
              wx.showToast({
                title: '复制成功'
              })
            }
          })
        }
      })
    }
})
