123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249 |
- var util = require('../../../utils/util.js');
- var api = require('../../../config/api.js');
- var check = require('../../../utils/check.js');
- var app = getApp();
- Page({
- /**
- * 页面的初始数据
- */
- data: {
- referee: {},
- showAuth: false,
- tipsShow: false,
- teamText: true,
- checked: false,
- tipType: 1,
- topType: 'blance', //头部显示内容
- day: 0 //每月8号 可以提现
- },
- goList() {
- wx.navigateTo({
- url: '/pages/referee/blance/list/list',
- })
- },
- onChange(e) {
- console.log(e);
- this.setData({
- checked: e.detail,
- });
- },
- userProtocol() {
- wx.navigateTo({
- url: '/pages/referee/protocol/protocol'
- });
- },
- goCheckAuth() { //是否实名认证过
- let day = (new Date()).getDate();
- console.log(day);
- // if(day!=8){
- // wx.showModal({
- // title: '非提现时间',
- // showCancel:false,
- // content: '提现申请时间为每月8号,请按时提现。',
- // });
- // return false;
- // }
- let that = this
- util.request(api.RefereeCashoutAuthCheck, {}).then(function (res) {
- if (res.errno === 0 && res.data) {
- that.goCashout();
- } else {
- that.setData({
- showAuth: true
- })
- }
- })
- },
- goCashout() { //提现申请
- let that = this
- wx.showModal({
- title: '提示',
- content: '提现金额为' + that.data.referee.commissionBlance + ',平台通过授权第三方(“云账户”)向您的微信钱包打款,涉及手续费由引荐人自行承担,故最终提现金额应以实际到账金额为准。',
- success: function (sm) {
- if (sm.confirm) {
- util.request(api.RefereeCashoutApply, {
- cashout: that.data.referee.commissionBlance
- }).then(function (res) {
- if (res.errno === 0) {
- wx.showToast({
- title: '提现申请成功',
- icon: 'none',
- duration: 2000
- });
- that.setData({
- showAuth: false
- })
- that.getBlance();
- }
- });
- } else if (sm.cancel) {
- console.log('用户点击取消')
- }
- }
- })
- },
- goCancel() {
- this.setData({
- showAuth: false
- })
- },
- bindinputName(e) {
- let val = e.detail.value;
- this.setData({
- ['referee.refereeName']: val
- });
- },
- bindinputNid(e) {
- let val = e.detail.value;
- this.setData({
- ['referee.refereeNid']: val
- })
- },
- cashoutAuth() {
- if (this.data.referee.refereeName == '') {
- wx.showToast({
- title: '请输入真实姓名',
- icon: 'none',
- duration: 2000
- });
- return false;
- } else if (!check.isCardCheck(this.data.referee.refereeNid)) {
- wx.showToast({
- title: '请输入正确的身份证号',
- icon: 'none',
- duration: 2000
- });
- return false;
- } else if (!this.data.checked) {
- wx.showToast({
- title: '请阅读《用户条款》并勾选',
- icon: 'none',
- duration: 2000
- });
- return false;
- }
- util.request(api.RefereeCashoutAuth, {
- name: this.data.referee.refereeName,
- nid: this.data.referee.refereeNid,
- mobile: this.data.referee.refereeMobile
- }).then(res => {
- if (res.errno == 0) {
- this.goCashout();
- }
- });
- },
- /**
- * 生命周期函数--监听页面加载
- */
- onLoad: function (options) {
- let topType = options.type;
- //如果不等于blance 则将待结算和余额位置调换
- if (topType) {
- this.setData({
- topType: topType
- })
- }
- var now = new Date();
- this.setData({
- day: now.getDate()
- })
- console.info(this.data.day)
- },
- /**
- * 生命周期函数--监听页面初次渲染完成
- */
- onReady: function () {
- },
- /**
- * 生命周期函数--监听页面显示
- */
- onShow: function () {
- this.getBlance();
- },
- getBlance() {
- let that = this;
- util.request(api.RefereeMyBlance, {}).then(function (res) {
- if (res.errno === 0) {
- that.setData({
- referee: res.data
- });
- }
- });
- },
- showTip1() {
- this.setData({
- tipType: 1,
- tipsShow: true,
- })
- },
- showTip2() {
- this.setData({
- tipType: 2,
- tipsShow: true,
- })
- },
- showTip3() {
- this.setData({
- tipType: 3,
- tipsShow: true,
- })
- },
- onClickHide() {
- this.setData({
- tipsShow: false
- })
- },
- /**
- * 生命周期函数--监听页面隐藏
- */
- onHide: function () {
- },
- /**
- * 生命周期函数--监听页面卸载
- */
- onUnload: function () {
- },
- /**
- * 页面相关事件处理函数--监听用户下拉动作
- */
- onPullDownRefresh: function () {
- },
- /**
- * 页面上拉触底事件的处理函数
- */
- onReachBottom: function () {
- },
- /**
- * 用户点击右上角分享
- */
- onShareAppMessage: function () {
- }
- })
|