소스 검색

Merge remote-tracking branch 'origin/release-201823-wangcz' into release-201823-wangcz

yujia 7 년 전
부모
커밋
de29c7bea6

+ 13 - 0
src/main/webapp/resources/js/common/directives/onFinishRender.js

@@ -0,0 +1,13 @@
+var app = angular.module('on.finish.render',[])
+app.directive('onFinishRender', function ($timeout) {
+  return {
+    restrict: 'A',
+    link: function (scope) {
+      if (scope.$last === true) {
+        $timeout(function () {
+          scope.$emit('ngRepeatFinished');
+        });
+      }
+    }
+  }
+})

+ 13 - 43
src/main/webapp/resources/js/usercenter/controllers/forstore/pay_center_ctrl.js

@@ -166,51 +166,21 @@ define(['app/app'], function(app) {
 		};
 
 		$scope.onDateCondition = function (bool) {
-			// var text = '';
-			// var datePattern = /^(\d{4})-(\d{2})-(\d{2})$/;
-			if (bool == 1){
-				// text = document.getElementById("start").value;
-				// if (text != '' && !datePattern.test(text)){
-				// 	toaster.pop("info", "请输入正确开始时间格式");
-				// 	return;
-				// }
-				// if (text != '' && !validateDate(text)){
-				// 	toaster.pop("info", "请输入正确开始时间格式");
-				// 	return;
-				// }
-				// if (!$scope.startDate && text != ''){
-				// 	$scope.startDate = convertTextToDate(text);
-				// }
-				if ($scope.startDate && !$scope.endDate){
-					var nowTime = new Date();
-					$scope.endDate = new Date(nowTime.getFullYear(), nowTime.getMonth(), nowTime.getDate());
-				}
-				if ($scope.startDate && $scope.endDate){
-					if ($scope.startDate.getTime() > $scope.endDate.getTime()){
-						$scope.endDate = new Date($scope.startDate.getTime() + 86400000);
-					}
-				}
-			}else {
-				// text = document.getElementById("end").value;
-				// if (text != '' && !datePattern.test(text)){
-				// 	// $scope.endDate = text;
-				// 	toaster.pop("info", "请输入正确结束时间格式");
-				// 	return;
-				// }
-				// if (text != '' && !validateDate(text)){
-				// 	// $scope.endDate = text;
-				// 	toaster.pop("info", "请输入正确结束时间格式");
-				// 	return;
-				// }
-				// if (!$scope.endDate && text != ''){
-				// 	$scope.endDate = convertTextToDate(text);
-				// }
-				if ($scope.startDate && $scope.endDate){
-					if ($scope.startDate.getTime() > $scope.endDate.getTime()){
-						$scope.startDate = new Date($scope.endDate.getTime() - 86400000);
-					}
+			var startTime = $scope.startDate ? $scope.startDate.getTime() : null;
+			var endTime = $scope.endDate ? $scope.endDate.getTime() : null;
+			if (startTime && endTime && startTime > endTime) {
+				if (bool == 1) {
+					toaster.pop('info', '起始时间不能大于结束时间');
+					$scope.startDate = null;
+				} else {
+					toaster.pop('info', '结束时间不能小于起始时间');
+					$scope.endDate = null;
 				}
 			}
+			if ($scope.endDate && bool == 2) {
+				$scope.endDate = new Date($scope.endDate.getFullYear(), $scope.endDate.getMonth(), $scope.endDate.getDate())
+				$scope.endDate = new Date($scope.endDate.getTime() + 23 * 60 * 60 * 1000 + 59 * 60 * 1000 + 59 * 1000);
+			}
 			loadPayHistory();
 		};
 

+ 2 - 13
src/main/webapp/resources/js/vendor/app.js

@@ -1,4 +1,4 @@
-define([ 'angularAMD', 'ngLocal', 'common/services', 'common/directives', 'common/query/brand', 'common/query/kind', 'common/query/component', 'common/query/goods', 'common/query/rate','common/query/cart', 'common/query/order', 'common/query/address', 'common/query/invoice', 'common/query/property', 'common/query/kindAdvice', 'common/query/propertyAdvice', 'common/query/return' , 'common/query/change', 'common/query/logistics', 'ui.router', 'ui-bootstrap', 'ui-form', 'ui-jquery','angular-toaster', 'ngDraggable', 'angular-sanitize', 'ngTable', 'dynamicInput', 'jquery-imagezoom', 'file-upload', 'file-upload-shim', 'common/query/urlencryption' , 'common/query/purchase', 'common/query/vendor', 'common/query/goods', 'common/query/bankTransfer', 'common/query/enterprise', 'common/query/bill', 'common/query/receipt', 'common/query/collection', 'common/query/express', 'common/query/bankInfo','common/query/charge', 'common/query/statistics', 'common/query/currency', 'jquery-chart', 'common/query/responseLogistics', 'common/query/goodsPrice', 'common/query/address' , 'common/query/search', 'common/query/urlencryption', 'common/query/releaseProInfo', 'common/query/makerDemand', 'common/query/afterSale', 'common/query/messageBoard', 'common/query/logistics', 'common/query/storeInfo', 'common/query/recommendation', 'common/query/user', 'common/query/logisticsPort', 'common/query/cms', 'common/query/material', 'common/query/storeCms', 'common/query/productImport', 'common/query/stockInOut', 'common/module/store_recommend_product', 'common/module/chat_web_module', 'common/query/standardPutOnAdmin', 'common/query/storeViolations', 'common/query/internalMessage', 'common/query/installments','common/query/product','common/query/seekPurchase','common/query/UASBatchPutOnProperty', 'common/query/authority', 'common/query/attendtion'], function(angularAMD) {
+define([ 'angularAMD', 'ngLocal', 'common/services', 'common/directives', 'common/query/brand', 'common/query/kind', 'common/query/component', 'common/query/goods', 'common/query/rate','common/query/cart', 'common/query/order', 'common/query/address', 'common/query/invoice', 'common/query/property', 'common/query/kindAdvice', 'common/query/propertyAdvice', 'common/query/return' , 'common/query/change', 'common/query/logistics', 'ui.router', 'ui-bootstrap', 'ui-form', 'ui-jquery','angular-toaster', 'ngDraggable', 'angular-sanitize', 'ngTable', 'dynamicInput', 'jquery-imagezoom', 'file-upload', 'file-upload-shim', 'common/query/urlencryption' , 'common/query/purchase', 'common/query/vendor', 'common/query/goods', 'common/query/bankTransfer', 'common/query/enterprise', 'common/query/bill', 'common/query/receipt', 'common/query/collection', 'common/query/express', 'common/query/bankInfo','common/query/charge', 'common/query/statistics', 'common/query/currency', 'jquery-chart', 'common/query/responseLogistics', 'common/query/goodsPrice', 'common/query/address' , 'common/query/search', 'common/query/urlencryption', 'common/query/releaseProInfo', 'common/query/makerDemand', 'common/query/afterSale', 'common/query/messageBoard', 'common/query/logistics', 'common/query/storeInfo', 'common/query/recommendation', 'common/query/user', 'common/query/logisticsPort', 'common/query/cms', 'common/query/material', 'common/query/storeCms', 'common/query/productImport', 'common/query/stockInOut', 'common/module/store_recommend_product', 'common/module/chat_web_module', 'common/query/standardPutOnAdmin', 'common/query/storeViolations', 'common/query/internalMessage', 'common/query/installments','common/query/product','common/query/seekPurchase','common/query/UASBatchPutOnProperty', 'common/query/authority', 'common/query/attendtion', 'onFinishRender'], function(angularAMD) {
 	'use strict';
 	/**
 	 * 自定义Array对象的属性last 方法
@@ -9,18 +9,7 @@ define([ 'angularAMD', 'ngLocal', 'common/services', 'common/directives', 'commo
 	};
 
 	var app = angular.module('myApp', [ 'ui.router', 'ui.bootstrap', 'ng.local', 'ui.form', 'ui.jquery', 'toaster', 'ngDraggable', 'tool.directives', 'ngSanitize', 'common.query.kind', 'common.services', 'brandServices', 'componentServices', 'goodsServices',  'rateServices','cartServices', 'orderServices', 'addressServices', 'invoiceServices', 'common.query.propertyAdvice', 'propertyServices', 'returnServices' , 'changeServices',  'logisticsServices', 'common.query.kindAdvice', 'ngTable', 'ngDynamicInput', 'common.directives', 'angularFileUpload', 'urlencryptionServices', 'purchaseServices', 'vendorServices', 'goodsServices', 'bankTransfer', 'common.query.enterprise', 'billServices', 'receiptServices', 'collection', 'expressServices', 'bankInfo','Charge', 'statisticsServices', 'currencyService', 'responseLogisticsService', 'PriceServices', 'addressServices', 'searchService', 'urlencryptionServices', 'ReleaseProductByBatchService', 'makerDemand', 'afterSaleService', 'messageBoardServices', 'logisticsServices', 'table.directives', 'storeInfoServices', 'recommendation', 'common.query.user', 'logisticsPortService', 'cmsService', 'materialServices', 'StoreCmsServices', 'productImportModule', 'stockInOutModule', 'StoreCmsModule', 'WebChatModule', 'StandardPutOnAdminModule', 'StoreViolationsServices', 'internalMessageServices', 'installmentServices','common.query.product', 'ui.tour', 'seekPurchaseServices', 'UASBatchPutOnPropertyModule', 'authorityServices', 'AttendtionServices'])
-  app.directive('onFinishRender', function ($timeout) {
-    return {
-      restrict: 'A',
-      link: function (scope) {
-        if (scope.$last === true) {
-          $timeout(function () {
-            scope.$emit('ngRepeatFinished');
-          });
-        }
-      }
-    }
-  })
+
 	//初始化,启动时载入app
 	app.init = function() {
 		angularAMD.bootstrap(app);

+ 13 - 45
src/main/webapp/resources/js/vendor/controllers/forstore/pay_center_ctrl.js

@@ -277,53 +277,21 @@ define(['app/app'], function(app) {
         };
 
         $scope.onDateCondition = function (bool) {
-            // var text = '';
-            // var datePattern = /^(\d{4})-(\d{2})-(\d{2})$/;
-            if (bool == 1){
-                // text = document.getElementById("start").value;
-                // if (text != '' && !datePattern.test(text)){
-                //     // $scope.startDate = text;
-                //     toaster.pop("info", "请输入正确开始时间格式");
-                //     return;
-                // }
-                // if (text != '' && !validateDate(text)){
-                //     // $scope.startDate = text;
-                //     toaster.pop("info", "请输入正确开始时间格式");
-                //     return;
-                // }
-                // if (!$scope.startDate && text != ''){
-                //     $scope.startDate = convertTextToDate(text);
-                // }
-                if ($scope.startDate && !$scope.endDate){
-                    var nowTime = new Date();
-                    $scope.endDate = new Date(nowTime.getFullYear(), nowTime.getMonth(), nowTime.getDate());
-                }
-                if ($scope.startDate && $scope.endDate){
-                    if ($scope.startDate.getTime() > $scope.endDate.getTime()){
-                        $scope.endDate = new Date($scope.startDate.getTime() + 86400000);
-                    }
-                }
-            }else {
-                // text = document.getElementById("end").value;
-                // if (text != '' && !datePattern.test(text)){
-                //     // $scope.endDate = text;
-                //     toaster.pop("info", "请输入正确结束时间格式");
-                //     return;
-                // }
-                // if (text != '' && !validateDate(text)){
-                //     // $scope.endDate = text;
-                //     toaster.pop("info", "请输入正确结束时间格式");
-                //     return;
-                // }
-                // if (!$scope.endDate && text != ''){
-                //     $scope.endDate = convertTextToDate(text);
-                // }
-                if ($scope.startDate && $scope.endDate){
-                    if ($scope.startDate.getTime() > $scope.endDate.getTime()){
-                        $scope.startDate = new Date($scope.endDate.getTime() - 86400000);
-                    }
+            var startTime = $scope.startDate ? $scope.startDate.getTime() : null;
+            var endTime = $scope.endDate ? $scope.endDate.getTime() : null;
+            if (startTime && endTime && startTime > endTime) {
+                if (bool == 1) {
+                    toaster.pop('info', '起始时间不能大于结束时间');
+                    $scope.startDate = null;
+                } else {
+                    toaster.pop('info', '结束时间不能小于起始时间');
+                    $scope.endDate = null;
                 }
             }
+            if ($scope.endDate && bool == 2) {
+                $scope.endDate = new Date($scope.endDate.getFullYear(), $scope.endDate.getMonth(), $scope.endDate.getDate())
+                $scope.endDate = new Date($scope.endDate.getTime() + 23 * 60 * 60 * 1000 + 59 * 60 * 1000 + 59 * 1000);
+            }
             loadHistory();
         };
 

+ 4 - 2
src/main/webapp/resources/js/vendor/main.js

@@ -28,7 +28,8 @@ require.config({
 		'file-upload-shim': 'lib/angular/angular-file-upload-shim.min',
 		'showdown' : 'lib/showdown/showdown.min',
 		'calendar': 'lib/calendar/calendar',
-		'big': 'lib/decimal/big.min'
+		'big': 'lib/decimal/big.min',
+    'onFinishRender' : 'js/common/directives/onFinishRender'
 	},
 	shim : {
 		'angular' : {
@@ -65,7 +66,8 @@ require.config({
 		},
 		'file-upload': ['angular', 'file-upload-shim'],
 		'calendar': ['jquery'],
-		'big' : ['jquery']
+		'big' : ['jquery'],
+		'onFinishRender': ['angular']
 	}
 });
 require([ 'app/app', 'common/controllers/commonCtrls' ], function(app) {