| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130 | var http = require("../../utils/http.js");Page({  /**   * 页面的初始数据   */  data: {    settledAmount: 0,    amount: null,    "frequency": 0, //天数    "number": 0, //提现次数    "amountMax": 0, //最大金额    "amountMin": 0, //最低金额    "paymentExplain": '' //其他提示  },  /**   * 生命周期函数--监听页面加载   */  onLoad: function(options) {    this.getDisInfoData();    this.loadWithdrawCashRule(); //提现规则  },  /**   * 获取用户钱包数据   */  getDisInfoData: function() {    wx.showLoading();    var params = {      url: "/p/distribution/user/info",      method: "GET",      // data: {      //   shopId: 1      // },      callBack: res => {        console.log(res)        this.setData({          settledAmount: res.distributionUserWallet.settledAmount,          addupAmount: res.distributionUserWallet.addupAmount        });        wx.hideLoading();      }    }    http.request(params);  },  /**   * 确认提现   */  confirmWithdraw: function() {    if (!this.data.amount || this.data.amount <= 0) {      wx.showToast({        title: '请输入正确金额!',        icon: 'none',      })      return;    } else if (this.data.amount > this.data.settledAmount) {      wx.showToast({        title: '余额不足',        icon: "none"      })      return;    }    wx.showLoading({      mask: true    })    http.request({      url: "/p/distribution/withdrawCash/apply",      method: "POST",      data: {        // shopId: 1,        amount: this.data.amount      },      callBack: res => {        wx.hideLoading();        wx.showModal({          content: '提现申请已提交',          showCancel: false,          complete: function() {            wx.navigateBack();          }        })      }    });  },  onAmountInput: function(e) {    this.setData({      amount: e.detail.value    });  },  onAllWithdraw: function() {    this.setData({      amount: this.data.settledAmount    });  },  /**   * 加载提现规则   */  loadWithdrawCashRule: function() {    var ths = this;    wx.showLoading();    var params = {      url: "/p/distribution/withdrawCash/info",      method: "GET",      // data: {      //   shopId: 1      // },      callBack: function(res) {        wx.hideLoading();        ths.setData({          frequency: res.frequency,          number: res.number,          amountMax: res.amountMax,          amountMin: res.amountMin,          paymentExplain: res.paymentExplain        });      }    };    http.request(params);  }})
 |