//获取应用实例
var app = getApp();
Page({

    /**
     * 页面的初始数据
     */
    data: {
        resp:{
            "currentPage": 1,
            "detail": [
                {
                    "account_type_name": "微信提现",
                    "money": "-5.79",
                    "time": "2022-02-24 10:40:03",
                    "type": "-1"
                },
                {
                    "account_type_name": "订单退款",
                    "money": "0.01",
                    "time": "2022-02-23 15:22:05",
                    "type": "1"
                },
                {
                    "account_type_name": "购买商品",
                    "money": "-0.01",
                    "time": "2022-02-23 09:27:31",
                    "type": "-1"
                },
                {
                    "account_type_name": "购买商品",
                    "money": "-0.10",
                    "time": "2022-02-22 11:48:20",
                    "type": "-1"
                },
                {
                    "account_type_name": "订单退款",
                    "money": "0.01",
                    "time": "2022-02-18 16:31:09",
                    "type": "1"
                },
                {
                    "account_type_name": "订单退款",
                    "money": "0.01",
                    "time": "2022-02-17 11:06:04",
                    "type": "1"
                },
                {
                    "account_type_name": "订单退款",
                    "money": "2.00",
                    "time": "2022-02-17 10:59:13",
                    "type": "1"
                },
                {
                    "account_type_name": "购买商品",
                    "money": "-2.00",
                    "time": "2022-02-16 10:31:46",
                    "type": "-1"
                },
                {
                    "account_type_name": "订单退款",
                    "money": "2.00",
                    "time": "2022-02-16 10:25:33",
                    "type": "1"
                },
                {
                    "account_type_name": "购买商品",
                    "money": "-2.00",
                    "time": "2022-02-16 10:01:25",
                    "type": "-1"
                }
            ],
            "erro": 0,
            "lastPage": 6,
            "msg": "获取数据成功",
            "total": 52
        },
        order_list:[],
        navHeight: '',
        menuButtonInfo: {},
        searchMarginTop: 0, // 搜索框上边距
        searchWidth: 0, // 搜索框宽度
        searchHeight: 0 // 搜索框高度
    },
    back(){
        wx.navigateBack()
    },
    /**
     * 生命周期函数--监听页面加载
     */
    onLoad: function (options) {
      wx.setNavigationBarTitle({
        title: '我的钱包'
      })
    
    },

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

    },

    /**
     * 生命周期函数--监听页面显示
     */
    onShow: function () {
      this.getGoodsList();
    },

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

    },

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

    },

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

    },

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

    },

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

    },
       // 跳转详情
       activity(e){
     
        if (e.currentTarget.dataset.id != 0) {
          console.log("你选择的课程id是"+e.currentTarget.dataset.id);
          wx.navigateTo({
              url: "/shopping/pages/goddess/goddess?id=" + e.currentTarget.dataset.id,
          });
      }
   
  },
    //商品列表
    getGoodsList: function () {
        var that = this;

        
    //假数据
    if(this.data.resp.erro==0){
        that.setData({
          order_list:this.data.resp.detail       
      });
      }
  
     
      wx.request({
          url: app.buildUrl("/app/Goddesswechat/getCapitalDetails"),
          header: app.getRequestHeader(),
          method:'POST',
          data: {
            version_number: this.data.version_number,
            uid:wx.getStorageSync('uid'),
            token:wx.getStorageSync('token'),
            page:'1',
            page_size:10,          
          },
          success: function (res) {
              var resp = res.data;
              console.log(resp+"=================dddddddddddddddddddddddddddddddddddddddddddd")
              console.log(resp.erro+"=================dddddddddddddddddddddddddddddddddddddddddddd")
              if(resp.erro==0){
                that.setData({
                  order_list:resp.detail       
              });
              }
          }
      });
  },

})