Files
lichebao/pages/distribute/cashout/index.js
T
2022-02-24 12:01:37 +08:00

122 lines
2.5 KiB
JavaScript

import _ from '../../../commons/js/commons';
Page({
data: {
info:'',
submitFlag:false,
isShowSuccess:false,
isShowProfile:true,//是否显示授权用户信息按钮
},
onLoad: function (options) {
for (let key in options) {
this.setData({
[key]: options[key]
})
}
this.getUserInfo()
//消息通讯 是否显示授权用户信息按钮
_.eventBus.on("isShowProfile", this, function(res){
this.setData({
isShowProfile:res,
})
})
//this.getDistributionCash()
},
//生命周期函数--监听页面卸载
onUnload: function () {
//卸载消息通讯 是否显示授权用户信息
_.eventBus.remove('isShowProfile',this);
},
//获取用户信息
getUserInfo(){
_.apiQuery.getUserInfo().then(res => {
this.setData({
userInfo: res
})
});
},
//提现信息
getDistributionCash() {
let params = {};
params['page'] = this.data.pageNo;
params['status'] = this.data.tabvalue;
_.apiQuery.getDistributionCash(params).then(res => {
this.setData({
info:res.data,
})
wx.stopPullDownRefresh()
});
},
//佣金提现
putDistributionCash() {
let that = this
wx.showModal({
title: '提示',
content: '是否提现所有佣金',
success(res) {
if (res.confirm) {
that.setData({
submitFlag: true,
})
let params = {};
params['cash_money'] = that.data.info.cash_money.value;
_.apiQuery.putDistributionCash().then(res => {
that.setData({
submitFlag: false,
isShowSuccess:true,
})
that.setData({
list: [],
pageNo: 1,
noData: false,
end: false,
load: true,
loading: false,
flag: that.data.flag + 1
})
that.getDistributionCash()
}).catch(res=>{
that.setData({
submitFlag: false,
})
});
}
}
})
},
//推送链接
pushLink(e){
if(e.currentTarget.dataset.url){
_.$router.openUrlScheme(e.currentTarget.dataset.url)
}
},
//拨打电话
call(e) {
if(e.currentTarget.dataset.tel){
wx.makePhoneCall({
phoneNumber:e.currentTarget.dataset.tel,
})
}
},
//页面相关事件处理函数--监听用户下拉动作
onPullDownRefresh: function () {
this.getDistributionCash()
},
})