123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199 |
- // pages/partner/mineEarnings/mineEarnings.js
- var that;
- var Util = require('../../utils/util.js');
- var app = getApp();
- Page({
- data: {
- urlHttp: '',
- hiddenmodal: true, //提示弹窗
- userPhoto: '', //用户头像
- userName: '', //用户昵称
- recordList : {},//提现记录
- accountList:{},//账户信息
- allMoney : 0, //账户总金额
- allEarnings : 0, //累计收益
- allInviteNum : 0, //邀请数量
-
- },
- onLoad: function (options) {
- var that = this;
- var host = getApp().globalData.servsers;
- var un_id = getApp().globalData.un_id;
- var openid = getApp().globalData.openid;
- console.log("un_id:" + un_id);
- console.log("openid:" + openid);
- if ((un_id == undefined || un_id == '' || un_id == null) || (openid == undefined || openid == '' || openid == null)) {
- wx.navigateTo({
- url: '/pages/authorize/authorize?link=partnerMineEarnings',
- })
- }else{
- console.log(getApp().globalData.userInfo);
- var userPhoto = getApp().globalData.userInfo.avatarUrl;
- var userName = getApp().globalData.userInfo.nickName;
- that.setData({
- urlHttp: host,
- userPhoto: userPhoto,
- userName: userName
- })
- }
- },
- onShow: function () {
- var that = this;
- var host = getApp().globalData.servsers;
- var un_id = getApp().globalData.un_id;
- var openid = getApp().globalData.openid;
- var userRole = getApp().globalData.userRole;
- // //获取用户账户信息
- wx.request({
- url: host + "api/distributeSell/getMyEarnInfo",
- data: {
- userId : un_id, //当前用户userId
- userRole: userRole, //用户角色
- },
- method: 'GET', // OPTIONS, GET, HEAD, POST, PUT, DELETE, TRACE, CONNECT
- header: {
- 'Accept': 'application/json'
- },
- success: function (res) {
- console.log(res);
- if (res.data.code == '200') {
- that.setData({
- allMoney: res.data.data.accountBalance, //账户总金额
- allEarnings: res.data.data.accumulativeTotalEarn, //累计收益
- allInviteNum: res.data.data.sharePersonNum, //邀请数量
- })
- }
- if (res == null || res.data == null) {
- console.error('网络请求失败');
- return;
- }
- }
- })
- // //提现记录
- // wx.request({
- // url: host + "api/distributeSell/getExtractApplyList",
- // data: {
- // userId : un_id, //当前用户userId
- // userRole: userRole, //用户角色
- // },
- // method: 'GET', // OPTIONS, GET, HEAD, POST, PUT, DELETE, TRACE, CONNECT
- // header: {
- // 'Accept': 'application/json'
- // },
- // success: function (res) {
- // if(res.data.code == '200'){
- // that.setData({
- // recordList: res.data.data.rows
- // })
- // }
- // if (res == null || res.data == null) {
- // console.error('网络请求失败');
- // return;
- // }
- // }
- // })
- },
- //邀请数量 、 累计收益 : 详情入口
- inviteRecord:function(e){
- var that = this;
- var id = e.currentTarget.dataset.id;
- wx.navigateTo({
- url: '/pages/partnerCommonRecord/partnerCommonRecord?id=' + id,
- })
- },
- //申请提现
- applyWithdrawal:function(e){
- var that = this;
- that.setData({
- hiddenmodal: false,
- modalCont: '账户金额不足提现最低金额'
- })
- setTimeout(function () {
- that.setData({
- hiddenmodal: true
- })
- }, 1000)
- },
- //邀请好友 - 页面分享
- // onShareAppMessage: function (res) {
- // var that = this;
- // var host = getApp().globalData.servsers;
- // var un_id = getApp().globalData.un_id;
- // var fromUserPhoto = getApp().globalData.userInfo.avatarUrl;
- // var fromUserName = getApp().globalData.userInfo.nickName;
- // if (res.from === 'button') {
- // // 来自页面内转发按钮
- // }
- // return {
- // title: that.data.title,
- // path: '/pages/partnerShare/partnerShare?fromUserId=' + un_id + '&fromUserPhoto=' + fromUserPhoto + '&fromUserName=' + fromUserName,
- // imageUrl: '',
- // success: function (res) {
- // // 转发成功
- // that.setData({
- // hiddenmodal: false,
- // modalCont: '分享成功'
- // })
- // setTimeout(function () {
- // that.setData({
- // hiddenmodal: true
- // })
- // }, 1000)
- // },
- // fail: function (res) {
- // // 取消分享、转发失败
- // }
- // }
- // },
- onShareAppMessage: function (res) {
- var that = this;
- var host = getApp().globalData.servsers;
- var un_id = getApp().globalData.un_id;
- var fromUserPhoto = getApp().globalData.userInfo.avatarUrl;
- var fromUserName = getApp().globalData.userInfo.nickName;
- var fromUserRole = getApp().globalData.userRole;
- console.log("share-un_id:" + un_id);
- if (res.from === 'button') {
- // 来自页面内转发按钮
- }
- return {
- title: that.data.title,
- path: '/pages/midAutumn/midAutumn?fromUserId=' + un_id + '&fromUserRole=' + fromUserRole,
- imageUrl: '/images/share_img.jpg',
- success: function (res) {
- // 转发成功
- that.setData({
- hiddenmodal: false,
- modalCont: '分享成功'
- })
- setTimeout(function () {
- that.setData({
- hiddenmodal: true
- })
- }, 1000)
- },
- fail: function (res) {
- // 取消分享、转发失败
- }
- }
- },
- })
|