var user_id = localStorage.getItem('user_id'); var token = ''; $().ready(function(){ // wxLogin(); getToken(); //获取token }) //获取token function getToken(){ $.ajax({ type: "post", url: "/api/v2/yys/getUserToken", data:{ user_id : user_id, flag : hex_md5(hex_md5(user_id + 'ysekey') + 'ysrkey') }, success:function(res){ if(res.errno == "0" && res.rst){ token = res.rst.data; myEarnings(token); } } }) } //我的收益 function myEarnings(token){ console.log(token) $.ajax({ type: "post", url: "/api/v2/users/myEarnings", headers:{ token : token }, success:function(res){ console.log(res) var data=res.rst ,moneyHtml='' , day_estimateHtml='' , month_estimateHtml='' , month_accumulativeHtml='',balanceHtml = ''; console.log(data) if(res.errno == "0" && res.rst){ moneyHtml += ' ¥ '+ data.all_settlement_income +'共'+ data.all_settlement_order_count +'笔' ; day_estimateHtml += '
今日预估收入
'+ data.this_day_order_count +'订单¥'+ data.this_day_forecast_income +'佣金昨日预估收入
'+ data.last_day_order_count +'订单¥'+ data.last_day_forecast_income +'佣金本月预估收入
'+ data.this_month_order_count +'订单¥'+ data.this_month_forecast_income +'佣金上月预估收入
'+ data.last_month_order_count +'订单¥'+ data.last_month_forecast_income +'佣金本月结算收入
'+ data.this_month_settlement_order_count +'订单¥'+ data.this_month_settlement_income +'佣金上月结算收入
'+ data.last_month_settlement_order_count +'订单¥'+ data.last_month_settlement_income +'佣金