123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596 |
- var app = getApp()
- Page({
- data: {
- balance:'0.00',//显示余额
- imgUrl:'http://resource.weilaibike.com/xiaobanma/walletBg.png',
- show:false,
- money:''
- },
- getBalance:function (e) {
- var that = this;
- console.log(1=='1')
- wx.login({
- success: function (res) {
- // 发送 res.code 到后台换取 openId, sessionKey, unionId
- console.log(res.code)
- var data = {
- 'code': res.code
- };
- wx.request({
- url: 'https://yutang.web.ximengnaikang.com/api/login',
- method: 'POST',
- data:data,
- header: {
- 'content-type': 'application/x-www-form-urlencoded'
- },
- success: function (res) {
- console.log(res)
- that.setData({balance:res.data.data.user.wallet_money})
- wx.setStorageSync('userInfo', res.data.data.user)
- }
- })
- }
- })
- //获取实名认证状态
- },
- walletDetail: function () {
- wx.navigateTo({
- url: '/pages/wallet_details/wallet_details',
- })
- },
- input:function(e){
- console.log(e.detail.value>0.01)
- if(e.detail.value>0.01){
- this.setData({money:e.detail.value})
- }else{
- this.setData({money:''})
- }
-
- },
- tixian:function(){
- this.setData({show:true})
- },
- cencal:function(){
- this.setData({show:false,money:''})
- },
- submit:function(){
- wx.showToast({
- title: '暂不支持~',
- icon:'none'
- })
- },
- quanbu:function(){
- if(this.data.balance>=0.01){
- this.setData({money:this.data.balance})
- }else{
- wx.showToast({
- title: '当前余额不足',
- icon:'none'
- })
- }
- },
- onLoad: function (options) {
- },
- onReady: function () {
- },
- onShow: function () {
- this.getBalance();
- },
- onHide: function () {
- },
- onUnload: function () {
- },
- onPullDownRefresh: function () {
- },
- onReachBottom: function () {
- },
- onShareAppMessage: function () {
-
- }
- })
|