const app = getApp()
const baseUrl = app.globalData.baseUrl
// page/component/orders/orders.js
Page({
  // onLoad: function (options) {
  //   this.setData({
  //     orders: [...this.data.orders, options]
  //   });
  // },
  data: {
    address: {},
    hasAddress: false,
    total: 0,
    orders: [],
  },
  onLoad() {
    var self = this
    // 获取订单status为1的待付款订单
    wx.request({
      url: baseUrl + "/order/loadData",
      method: "POST",
      data: {
        userId: 1,
        status: 1
      },
      success(res) {
        self.setData({
          orders: res.data.data,
        })
        console.log('orders',self.data.orders)
      },
    })
  },
  onReady() {
  },

  onShow: function () {
    const self = this
    wx.getStorage({
      key: "address",
      success(res) {
        self.setData({
          address: res.data,
          hasAddress: true,
        })
      },
    })
  },

})
