text: //index.js
  //获取应用实例
  var app = getApp()
  Page({
    data: {
  
    },
  
    toDetailsTap: function (e) {
      wx.navigateTo({
        url: "/pages/goods-detail/goods-detail?id=" + e.currentTarget.dataset.id
      })
    },
    onLoad: function (e) {
      wx.showLoading();
      var that = this;
      if (app.globalData.iphone == true) { that.setData({ iphone: 'iphone' }) }
      wx.request({
        url: app.globalData.urls + '/api/shop/goods/listByCategoryId',
        data: {
          categoryId: e.id,
          pageSize: 100
        },
        success: function (res) {
          wx.hideLoading();
          that.setData({
            goods: [],
            loadingMoreHidden: true
          });
          var goods = [];
          if (res.data.code != 0 || res.data.data.length == 0) {
            that.setData({
              loadingMoreHidden: false,
            });
            return;
          }
          for (var i = 0; i < res.data.data.length; i++) {
            goods.push(res.data.data[i]);
          }
          that.setData({
            goods: goods,
          });
        }
      })
    }
  
  })
  