Page({
  data: {
    packingRecordList: [],
    packingCategoryList: []
  },
  onShareAppMessage: function (res) {

  },
  onLoad: function () {
  
  },
  /**
   * 生命周期函数--监听页面显示
   */
  onShow: function () {
      var openId = wx.getStorageSync('openId');
      var that = this;
      wx.request({
        url: 'https://m.zuihuibi.cn/api/promotion/userPackingListQry',
        method: 'POST',
        header: { 'X-Authorization': wx.getStorageSync('X-Authorization') },
        data: {
          openid: openId
        },
        success: function (res) {
          var packingRecordList = res.data.data.packingRecordList;
          that.setData({ packingRecordList: packingRecordList });
        }
      })
  },
  goMyList: function (e) {
    var packingNo = e.currentTarget.dataset.packingno;
    var packingRecordList = this.data.packingRecordList;
    var packingCategoryList = this.data.packingCategoryList;
    for (var i = 0; i < packingRecordList.length; i++) {
      if (packingRecordList[i].packingNo == packingNo) {
        packingCategoryList = packingRecordList[i].packingCategoryList;
        wx.setStorageSync('packingCategoryList', packingRecordList[i].packingCategoryList);
      }
    }
    this.setData({ packingRecordList, packingRecordList, packingCategoryList: packingCategoryList });
    wx.navigateTo({
      url: '/pages/myList/myList'
    })
  }
})