From 734dfe9eb0a2176103dce8245c69b1194574c68e Mon Sep 17 00:00:00 2001
From: admin <weikou2014>
Date: 星期一, 29 七月 2024 20:16:15 +0800
Subject: [PATCH] 代理新功能完善

---
 src/main/resources/static/agent/js/index.js |   98 ++++++++++++++++++++++++++++++++++++++++++-------
 1 files changed, 84 insertions(+), 14 deletions(-)

diff --git a/src/main/resources/static/agent/js/index.js b/src/main/resources/static/agent/js/index.js
index 2cea975..3e3a5ef 100644
--- a/src/main/resources/static/agent/js/index.js
+++ b/src/main/resources/static/agent/js/index.js
@@ -8,23 +8,30 @@
 			screen_time_index: 0,
 			orders: [],
 			hasMore: true,
-			withdraw_records: [1, 1, 1, 1, 1],
+			withdraw_records: [],
 			order_statistic: {
 				user_count: 0,
 				order_count: 0,
 				total_money: 0.00
-			}
+			},
+			config:{}
 		},
 		mounted: function() {
 
 			this.$nextTick(function() {
-
+				app.getConfig();
 				app.search();
 			});
 		},
 		methods: {
+			to_miandan:function(){
+				window.location.href=app.config.submitKeyUrl;
+			},
 			change_mode: function(mode) {
 				app.mode = mode;
+				if(mode==1){
+					app.withdrawList();
+				}
 			},
 			open_screen: function() {
 				app.temp_screen_time_index = app.screen_time_index;
@@ -61,20 +68,28 @@
 			setAlipayAccount: function() {
 				window.location.href = "alipay_account_setting.html";
 			},
-			search: function() {
-				app.current_page = 1;
-				app.orders = [];
-				app.order_statistic = {
-					user_count: 0,
-					order_count: 0,
-					total_money: 0.00
-				};
+			
+			getConfig:function(){
+				http_util.post("/agentapi/admin/getConfig", {
+				}, function(res) {
+					if (res.code == 0) {
+						app.config = res.data;
+					}
+				
+				}, function(res) {
+				
+				});
+			},
+			requestOrders: function() {
 				http_util.post("/agentapi/admin/orderList", {
 					key: $("#search_key").val(),
 					timeIndex: app.screen_time_index,
 					page: app.current_page
 				}, function(res) {
 					if (res.code == 0) {
+						if (app.current_page == 1) {
+							app.orders = [];
+						}
 						app.orders = app.orders.concat(res.data.list);
 						app.order_statistic.order_count = res.data.count;
 						app.order_statistic.user_count = res.data.statistic.count;
@@ -90,15 +105,70 @@
 
 				});
 			},
+			requestWithdraw: function() {
+				http_util.post("/agentapi/admin/withdrawList", {
+					page: app.current_page
+				}, function(res) {
+					if (res.code == 0) {
+						if (app.current_page == 1) {
+							app.withdraw_records = [];
+						}
+						app.withdraw_records = app.withdraw_records.concat(res.data.list);
+						if (app.withdraw_records.length <res.data.count) {
+							app.hasMore = true;
+						} else {
+							app.hasMore = false;
+						}
+					}
+				}, function(res) {
+			
+				});
+			},
+			search: function() {
+				app.current_page = 1;
+				app.order_statistic = {
+					user_count: 0,
+					order_count: 0,
+					total_money: 0.00
+				};
+				app.requestOrders();
+			},
+			withdrawList:function(){
+				app.current_page = 1;
+				app.requestWithdraw();
+			},
+		
 			loadOrder: function() {
-
+				if(!app.hasMore){
+					return;
+				}
+				app.current_page += 1;
+				app.requestOrders();
 			},
 			loadWidthdraw: function() {
-
+				if(!app.hasMore){
+					return;
+				}
+				app.current_page += 1;
+				app.requestWithdraw();
+			},
+			withdraw:function(id){
+				http_util.post("/agentapi/admin/withdraw", {
+					id: id
+				}, function(res) {
+					if (res.code == 0) {
+						app.withdrawList();
+					}else{
+						layer.msg(res.msg);
+					}
+				}, function(res) {
+							
+				});
+				
 			}
 
 		}
 
 	});
 
-});
\ No newline at end of file
+});

--
Gitblit v1.8.0