StatisticsService.js 3.1 KB
"use strict";
var StatisticsService = angular.module('StatisticsService',[]);

StatisticsService.service("StatisticsService", [
	'$rootScope',
	'BaseService',
	function ($rootScope,BaseService) {
		var _service = {
				products:[],
				orderStatictis:{},
				productSearchs:[],
            	memberShopcarts:[],
				pagerProduct:function(productQuery) {
					BaseService.request({
						url:BaseService.url.pagerStatProduct_url,
						method:'post',
						mark:true,
						data:productQuery,
						fn:function(response) {
							if(response.code == 0) {
								_service.products = response.data;
								$rootScope.$broadcast('product.list');
							}
						}
					});
				},
				pagerProductList:function(productQuery) {
					BaseService.request({
						url:BaseService.url.pagerStatProductList_url,
						method:'post',
						mark:true,
						data:productQuery,
						fn:function(response) {
							if(response.code == 0) {
								_service.products = response.data;
								$rootScope.$broadcast('product.list');
							}
						}
					});
				},
				getCurrentOrderStatictis:function() {
					BaseService.request({
						url:BaseService.url.orderStatictis_url+"?isCurrentDay=111",
						method:'get',
						mark:true,
						fn:function(response) {
							if(response.code == 0) {
								_service.orderStatictis = response.data;
								$rootScope.$broadcast('orderCount:statictis');
							}
						}
					});
				}
				,
				getIntegralOrderStatictis:function() {
					BaseService.request({
						url:BaseService.url.orderStatictis_url+"?orderType=integral",
						method:'get',
						mark:true,
						fn:function(response) {
							if(response.code == 0) {
								_service.orderStatictis = response.data;
								$rootScope.$broadcast('integralOrderCount:statictis');
							}
						}
					});
				}
				,
				getMoneyOrderStatictis:function() {
					BaseService.request({
						url:BaseService.url.orderStatictis_url+"?orderType=money",
						method:'get',
						mark:true,
						fn:function(response) {
							if(response.code == 0) {
								_service.orderStatictis = response.data;
								$rootScope.$broadcast('moneyOrderCount:statictis');
							}
						}
					});
				},
				listProductSearch:function(pageNow, pageSize, searchStartDt, searchEndDt) {
					BaseService.request({
						url:BaseService.url.productSearch_url+"?pageNow="+pageNow+"&pageSize="+pageSize+"&searchStartDt="+searchStartDt+"&searchEndDt="+searchEndDt,
						method:'get',
						mark:true,
						fn:function(response) {
							if(response.code == 0) {
								_service.productSearchs = response.data;
								$rootScope.$broadcast('productSearchs.list');
							}
						}
					});
				},
				listMemberShopcart:function(pageNow, pageSize, searchStartDt, searchEndDt) {
					BaseService.request({
						url:BaseService.url.memberShopcart_url+"?pageNow="+pageNow+"&pageSize="+pageSize+"&searchStartDt="+searchStartDt+"&searchEndDt="+searchEndDt,
						method:'get',
						mark:true,
						fn:function(response) {
							if(response.code == 0) {
								_service.memberShopcarts = response.data;
								$rootScope.$broadcast('memberShopcarts.list');
							}
						}
					});
				},
		};
		return _service;
}]);