// packageE/multiplePackages/multiplePackages.js
var app = getApp();
Page({

  /**
     * 页面的初始数据
     */
  data: {
    id:'',
    api:'',
  },

  /**
     * 生命周期函数--监听页面加载
     */
  onLoad: function (options) {
    this.setData({
      id:options.id,
      api: options.api
    });
    this.getData();
  },

  /**
     * 生命周期函数--监听页面初次渲染完成
     */
  onReady: function () {

  },

  /**
     * 生命周期函数--监听页面显示
     */
  onShow: function () {

  },

  /**
     * 生命周期函数--监听页面隐藏
     */
  onHide: function () {

  },

  /**
     * 生命周期函数--监听页面卸载
     */
  onUnload: function () {

  },

  /**
     * 页面相关事件处理函数--监听用户下拉动作
     */
  onPullDownRefresh: function () {

  },

  /**
     * 页面上拉触底事件的处理函数
     */
  onReachBottom: function () {

  },

  /**
     * 用户点击右上角分享
     */
  onShareAppMessage: function () {

  },
  toExpress(e){
    let item = e.currentTarget.dataset.item;
    if(this.options.from && this.options.from=="resend"){
      wx.navigateTo({
        url: '/packageA/member/order/logistics/logistics?from=resend&refund_id='+this.data.id+"&express_id="+item.express_id,
      });
    } else{
      wx.navigateTo({
        url: '/packageA/member/order/logistics/logistics?id=' + this.data.id + "&api=" + this.data.api + "&order_express_id=" + item.order_express_id
      });
    }
    
  },
  getData() {
    var that = this;
    let urlStr = app.getNetAddresss('dispatch.express.getOrderMultiplePackages');
    let json={
      order_id:this.data.id
    };
    if(this.options.from && this.options.from=="resend"){
      delete json.order_id;
      urlStr = app.getNetAddresss('refund.express.resend-list');
      json.refund_id = this.data.id;
    }
    app._postNetWork({
      url: urlStr,
      data:json,
      success: (resdata) => {
        var res = resdata.data;
        if (res.result == 1) {
          that.setData({
            info:res.data
          });
          
        } else {
          wx.showToast({
            title: res.msg,
            icon: 'none'
          });
          console.log(res.msg);
        }
      }
    });
  }
});