Browse Source

bug:买卖家订单中心,时间筛选框;在卖家订单中心的时间筛选框,开始时间value可以手动输入比结束时间value晚的时间,该处需做判断调整

wangdy 8 years ago
parent
commit
cbc922c09c

+ 11 - 1
src/main/webapp/resources/js/usercenter/controllers/forstore/buyer_order_ctrl.js

@@ -351,7 +351,7 @@ define(['app/app'], function (app) {
 		};
 
 		// 选择查找日期
-		$scope.onDateCondition = function(){
+		$scope.onDateCondition = function(isStart){
 			if(typeof $scope.startDate == 'undefined' || typeof $scope.endDate == 'undefined'){
 				alert("日期格式错误,请重新输入!");
 				$scope.startDate = null;
@@ -362,6 +362,16 @@ define(['app/app'], function (app) {
 				$scope.endDate = $scope.endDate.toString().replace(/[0-9]{2}:[0-9]{2}:[0-9]{2}/g, '23:59:59');//;'23.59';//DateUtil.yyyyMmDd($scope.endDate.getTime() + 86399000);
 				$scope.endDate = new Date(formatDateTime(new Date($scope.endDate.toString())));
 			}
+			if ($scope.endDate !== null && $scope.startDate>$scope.endDate){
+				if (isStart){
+					alert("开始日期大于结束日期,请重新输入!");
+					$scope.startDate = null;
+				} else {
+					alert("开始日期大于结束日期,请重新输入!");
+					$scope.endDate = null;
+				}
+				return;
+			}
 			$scope.param.startDate = $scope.startDate ? $scope.startDate.getTime() : null;
 			$scope.param.endDate = $scope.endDate ? $scope.endDate.getTime()  : null;
 

+ 12 - 0
src/main/webapp/resources/js/vendor/controllers/forstore/vendor_order_ctrl.js

@@ -576,6 +576,18 @@ define(['app/app'], function (app) {
                 $scope.endDate = $scope.endDate.toString().replace(/[0-9]{2}:[0-9]{2}:[0-9]{2}/g, '23:59:59');//;'23.59';//DateUtil.yyyyMmDd($scope.endDate.getTime() + 86399000);
                 $scope.endDate = new Date(formatDateTime(new Date($scope.endDate.toString())));
             }
+            $scope.vaildDate(false);
+        };
+        $scope.vaildDate = function (isStart) {
+            if ($scope.endDate !== null && $scope.startDate>$scope.endDate){
+                if (isStart){
+                    alert("开始日期大于结束日期,请重新输入!");
+                    $scope.startDate = null;
+                } else {
+                    alert("开始日期大于结束日期,请重新输入!");
+                    $scope.endDate = null;
+                }
+            }
         };
         var formatDateTime = function (date) {
             var y = date.getFullYear();

+ 2 - 2
src/main/webapp/resources/view/usercenter/forstore/buyer_order.html

@@ -601,7 +601,7 @@
 							   max-date="endDate" current-text="今天" clear-text="清除" close-text="关闭"
 							   datepicker-options="{formatDayTitle: 'yyyy年M月', formatMonth: 'M月', showWeeks: false}"
                                ng-click="openDatePicker($event, condition, 'startDateOpen',1)"
-							   ng-change="onDateCondition()"/>
+							   ng-change="onDateCondition(true)"/>
 							<button class="open" ng-click="openDatePicker($event, condition, 'startDateOpen')"></button>
 					</div>
 
@@ -614,7 +614,7 @@
 								 min-date="startDate" current-text="今天" clear-text="清除" close-text="关闭"
 								 datepicker-options="{formatDayTitle: 'yyyy年M月', formatMonth: 'M月', showWeeks: false}"
                                  ng-click="openDatePicker($event, condition, 'endDateOpen',2)"
-								 ng-change="onDateCondition()"/>
+								 ng-change="onDateCondition(false)"/>
 								<button class="open" ng-click="openDatePicker($event, condition, 'endDateOpen')"></button>
 						</div>
 				</div>

+ 1 - 0
src/main/webapp/resources/view/vendor/forstore/vendor_order.html

@@ -666,6 +666,7 @@
 						   max-date="endDate" current-text="今天" clear-text="清除" close-text="关闭"
                                ng-click="openDatePicker($event, condition, 'startDateOpen',1)"
 						   datepicker-options="{formatDayTitle: 'yyyy年M月', formatMonth: 'M月', showWeeks: false}"
+							   ng-change="vaildDate(true)"
 						/>
 						<button class="open" ng-click="openDatePicker($event, condition, 'startDateOpen')"></button>
 					</div>