| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190 |
- import common from '../../utils/util';
- import main from '../../utils/main';
- const app = getApp();
- Page({
- data: {
-
- },
- onLoad: function (options) {
- var that = this;
-
- that.setData({
- Containnerheight: main.getWindowHeight(),
- ListType:options.ListType,
- AgentCategory:options.AgentCategory,
- IsWithdraw:false,
- IsPromotion:false,
- User:app.globalData.userInfo,
- RefundTotal:0,
- });
- wx.setNavigationBarTitle({
- title: that.data.ListType
- });
- this.getList();
- },
- getList:function(e){
- var that = this;
- var url="";
- if (that.data.ListType=="近期报名"){
- that.setData({
- Info: app.globalData.NewUserApplyArray,
- });
- getLen(that,app.globalData.NewUserApplyArray.List);
- }
- else if (that.data.ListType=="预估新增收益"){
- that.setData({
- Info: app.globalData.EstimatedNewRevenue,
- Len:app.globalData.EstimatedNewRevenue.Length,
- Total:"0",
- });
- getLen(that,app.globalData.EstimatedNewRevenue.List);
- }
- else if (that.data.ListType=="可提现收益"){
- that.setData({
- Info: app.globalData.WithdrawableEarnings,
- Total:app.globalData.WithdrawableEarnings.Total,
- });
- getLen(that,app.globalData.WithdrawableEarnings.List);
- //查看是否有退款返还奖励
- url="GetRefundList?AgentCategory="+that.data.AgentCategory;
- url+="&UserID=" + app.globalData.userInfo.UserID;
- main.getData(url, function (data) {
- if (data) {
- var list=data.List;
- var num=0,refundTotal=0;
- for(var i=0;i<list.length;i++){
- if (list[i].IsPay===0 && list[i].Money>0){
- num++;
- refundTotal+=list[i].Money;
- }
- }
- that.setData({
- RefundNum:num,
- RefundTotal:refundTotal,
- });
- }
- });
- }
- else{
- if (that.data.ListType=="退款记录")
- url="GetRefundList?AgentCategory="+that.data.AgentCategory;
- else if (that.data.ListType=="未续费记录")
- url="GetIntroducerUserList2?ListType="+that.data.ListType+"&AgentCategory="+that.data.AgentCategory;
- else if (that.data.ListType=="报名步骤没做完")
- url="GetIntroducerUserList2?ListType="+that.data.ListType+"&AgentCategory="+that.data.AgentCategory;
-
- url+="&UserID=" + app.globalData.userInfo.UserID;
- main.getData(url, function (data) {
- if (data) {
- that.setData({
- Info: data,
- });
- getLen(that,data.List);
-
- }
- });
- }
- function getLen(obj,list){
- var len=0;
-
- if (that.data.AgentCategory=="ambassador"){
- for(var i=0;i<list.length;i++){
- len+=list[i].List.length;
- }
- }
- else
- len= list.length;
- that.setData({
- Len:len,
- });
- }
- },
- showWithdraw:function(e){
- this.setData({
- IsWithdraw:!this.data.IsWithdraw,
- TotalAll:common.formatMoney(Number(this.data.Total)-this.data.RefundTotal),
- });
- },
- applyPay:function(e){
- var that=this;
- if (that.data.Total<1){
- wx.showToast({
- title: '满1元才能提现',
- mask: true,
- image: "../../pages/images/universalpic_exclamation_white_120x120.png",
- });
- }
- else{
- wx.showLoading({
- title: '申请保存中',
- mask: true,
- });
- var url="ApplyWithdraw?UserID="+app.globalData.userInfo.UserID+"&AgentCategory="+that.data.AgentCategory;
- main.getData(url, function () {
- var url = "GetMiaoguoAgentRecordList?UserID=" + app.globalData.userInfo.UserID + "&AgentCategory=" + that.data.AgentCategory;
- main.getData(url, function (data) {
- if (data) {
- wx.hideLoading();
- app.globalData.EarningsList = data;
- wx.redirectTo({
- url: "earnings_list?IsCheck=0&AgentCategory="+that.data.AgentCategory,
- });
- }
- });
- });
- }
- },
- onPullDownRefresh: function () {
- wx.stopPullDownRefresh();
- },
- goto: function (e) {
- var url = e.currentTarget.dataset.url;
- var gotoType = e.currentTarget.dataset.type;
- var ispay=e.currentTarget.dataset.ispay;
- if (url.indexOf("earnings_apply")>=0 && ispay==undefined){
- return;
- }
- if (!gotoType) {
- wx.navigateTo({
- url: url,
- });
- } else {
- wx.redirectTo({
- url: url,
- })
- }
- },
- ShowImage:function(e){
- var url=e.currentTarget.dataset.url;
- wx.downloadFile({
- url: url,
- success(res) {
- wx.previewImage({
- current: res.tempFilePath, // 当前显示图片的http链接
- urls: [res.tempFilePath] // 需要预览的图片http链接列表
- });
- }
- });
- },
- onShareAppMessage: function () {
- return {
- title: app.globalData.ShareTitle,
- path: app.globalData.SharePath + '?UserID=' + app.globalData.userInfo.UserID,
- imageUrl: app.globalData.ShareImage,
- }
- },
- })
|