123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193 |
- var util = require('../../utils/util.js');
- var app = getApp()
- Page({
-
- data: {
- hasRefesh: false,
- LoadingComplete: true,
- list: [],
- state: -1,
- pageNum: 0,
- info: []
- },
-
- onLoad: function (options) {
- var token = wx.getStorageSync('token');
- var that = this;
- wx.setNavigationBarTitle({
- title: '超级团长'
- });
- app.util.request({
- 'url': 'entry/wxapp/user',
- 'data': {
- controller: 'user.get_tixian_info',
- 'token': token
- },
- dataType: 'json',
- success: function (res) {
- if (res.data.code == 0) {
- that.setData({
- info: res.data.data
- })
- }
- }
- })
-
- this.loaddata();
- },
- loaddata: function () {
- let that = this;
- var token = wx.getStorageSync('token');
- var state = this.data.state;
- if (!that.data.hasRefesh) {
- that.setData({
- hasRefesh: true,
- hidetip: false
- });
- app.util.request({
- 'url': 'entry/wxapp/user',
- 'data': {
- controller: 'user.tixian_record',
- 'token': token,
- state: state,
- "page": that.data.pageNum + 1,
- is_index_show: 2
- },
- dataType: 'json',
- success: function (res) {
- if (res.data.code == 0) {
- let list = that.data.list.concat(res.data.data);
- that.setData({
- list: list,
- pageNum: that.data.pageNum + 1,
- hasRefesh: false,
- hidetip: true
- });
- } else {
- that.setData({
- LoadingComplete: false,
- hasRefesh: true,
- tip_html: '^_^没有更多了',
- hidetip: true
- });
- }
- }
- })
-
- }
- },
- tixian_money: function (e) {
- var value = e.detail.value;
- this.setData({
- tixian_money: value
- })
- },
- shenqing: function () {
- var tixian_money = parseFloat(this.data.tixian_money);
- var info = this.data.info;
- var that = this;
- if (tixian_money > parseFloat(info.money)) {
- wx.showToast({
- title: '最多可提现' + info.money + '元',
- icon: 'none',
- })
- return false;
- }
-
- var token = wx.getStorageSync('token');
- app.util.request({
- 'url': 'entry/wxapp/user',
- 'data': {
- controller: 'user.tixian_sub',
- 'token': token,
- "money": tixian_money
- },
- dataType: 'json',
- method: 'POST',
- success: function (res) {
- if (res.data.code == 0) {
- info.money = parseFloat(info.money) - tixian_money;
- that.setData({
- info: info
- })
- wx.showToast({
- title: '申请成功,等待审核',
- icon: 'none'
- })
- } else {
- wx.showToast({
- title: res.data.msg,
- icon: 'none'
- })
- }
- }
- })
-
- },
-
- onReady: function () {
- },
-
- onShow: function () {
- },
-
- onHide: function () {
- },
-
- onUnload: function () {
- },
-
- onPullDownRefresh: function () {
- },
-
- onReachBottom: function () {
- this.loaddata();
- },
-
- onShareAppMessage: function () {
- }
- })
|