menber.js 3.53 KB
var e = function (e) {
  return e && e.__esModule ? e : {
    default: e
  };
}(require("../../../utils/LoadMore.js")), t = getApp(), a = t.request, o = t.globalData.setting, os = o,
  i = require("../../../utils/util.js"), ut = i, s = require("../../../utils/common.js"), n = new e.default();
var regeneratorRuntime = require('../../../utils/runtime.js');
Page({
  /**
   * 页面的初始数据
   */
  data: {
    url: o.imghost,
    user_money:0.00,
    frozen_money:0.00,
    iurl: o.imghost,
  },

  /**
     * 生命周期函数--监听页面显示
     */
  onShow: function () {
    var th=this;
    //--先判断会员状态--
    var user_info = getApp().globalData.userInfo;
    if (user_info == null || user_info.mobile == undefined || user_info.mobile == "" || user_info.mobile == null) {
      wx.navigateTo({ url: '/pages/togoin/togoin', })
        return false;
      }
     this.init_fir();
      wx.setNavigationBarTitle({
        title: "余额",
     })
      //优惠券要实时更新
      getApp().getConfig2(function(e) {
          var json_d = JSON.parse(e.switch_list);

          th.data.is_closetxbank=json_d.is_closetxbank;
          th.data.is_tx_wx=json_d.is_tx_wx;
      },1)

  },
  init_fir: function () {
    this.myMoney();  //我的资产
  },
  //获取我的资产
  async myMoney() {
    var e = this, frozen_money, user_money;
    var user_id = getApp().globalData.user_id;
    var store_id = os.stoid;

    console.log(user_id, "是什么用户", store_id);
    await getApp().request.promiseGet("/api/weshop/users/getMymoney/" +store_id+ "/" + user_id
      , {
        data: {}
    }).then(res => {
      console.log("1" + res);
      var a = res.data.data;
      var a = res.data.data;
      frozen_money = a.unavailable;
      console.log(a,"s1w" + a.frozen_money);
      user_money = a.liudong_money;
      console.log("menber" + a.user_money );
      getApp().globalData.user_money = user_money;
      console.log("menberssss" + user_money);
      // 赋值getApp().globalData.can_use_money = 10;
      // 取值var can = getApp().globalData.can_use_money;
    })
    this.setData({
      frozen_money: frozen_money, user_money: user_money});
  },
 



//提现记录
  urls: function () {
    wx.navigateTo({
      url: 'cash_record/cash_record',
    })
  },
  //不可用资金明细
  url: function () {
    wx.navigateTo({
      url: 'account_unable/account_unable',
    })
  },
  // 流动资金提现
 jumPage:function(){

    //如果都关闭的情况下,不去提现
    if(this.data.is_closetxbank  &&  !this.data.is_tx_wx ){
        wx.showToast({
            title: "商家暂未开通提现功能,敬请期待!",
            icon: 'none',
            duration: 2000
        })
        return false;
    }

   wx.navigateTo({
     url: 'bring/bring',
   })
 },
  //流动资金明细
  jumPages: function () {
    wx.navigateTo({
      url: 'account/account',
    })
  },
  /**
   * 生命周期函数--监听页面加载
   */
  onLoad: function (options) {

  },

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

  },

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

  },

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

  },

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

  },

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

  },

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

  }
})