Browse Source

Merge remote-tracking branch 'origin/feature-201832-wangcz' into feature-201832-wangcz

wangcz 7 years ago
parent
commit
189a4ca770

+ 4 - 4
src/main/java/com/uas/platform/b2c/trade/order/service/impl/OrderServiceImpl.java

@@ -285,7 +285,7 @@ public class OrderServiceImpl implements OrderService {
             list.add(orderDetail);
             detailIds.add(orderDetail.getDetailid());
         }
-        if(list.size() == 0) {
+        if (list.size() == 0) {
             return new ResultMap(ResultMapType.ORDERDETAIL_UNVALIABLE.getCode(), ResultMapType.ORDERDETAIL_UNVALIABLE.getPhrase());
         }
         Order order = generateSimpleOrder(list);
@@ -298,10 +298,10 @@ public class OrderServiceImpl implements OrderService {
 
         //组装返回给前台的信息
         String str = "";
-        if(unavailable != 0){
+        if (unavailable != 0) {
             str = unavailable + "个失效产品已删除";
         }
-        if(infoUpdate != 0) {
+        if (infoUpdate != 0) {
             if(StringUtils.hasText(str)) {
                 str = str + "," + infoUpdate + "个产品有更新";
             }else {
@@ -359,7 +359,7 @@ public class OrderServiceImpl implements OrderService {
 
         // 发送生成订单站内信
 //        internalMessageService.saveMessage("订单信息", "您已经成功下单", null);
-        if(isInfoUpdate) {//对于在售商品修改了自营等方式
+        if (isInfoUpdate) {//对于在售商品修改了自营等方式
             return new ResultMap(ResultMapType.OK.getCode(), "该产品的信息有更新", order);
         }else {
             return ResultMap.success(order);

+ 11 - 6
src/main/webapp/resources/js/admin/controllers/statsDataCtrl.js

@@ -64,8 +64,8 @@ define([ 'app/app' ], function(app) {
             if (val != 'autoMonth') {
                 initData();
             } else {
-                $scope.startDate = null;
-                $scope.endDate = null;
+                // $scope.startDate = '';
+                // $scope.endDate = '';
             }
         };
 
@@ -86,7 +86,12 @@ define([ 'app/app' ], function(app) {
             item[openParam].open = !item[openParam].open;
         };
 
-        $scope.onDateCondition = function (bool) {
+        $scope.onDateCondition = function (bool, date) {
+            if (bool == 1) {
+                $scope.startDate = date;
+            } else {
+                $scope.endDate = date;
+            }
             var startTime = $scope.startDate ? $scope.startDate.getTime() : null;
             var endTime = $scope.endDate ? $scope.endDate.getTime() : null;
             if (startTime && endTime && startTime > endTime) {
@@ -174,7 +179,7 @@ define([ 'app/app' ], function(app) {
         var getProductData = function () {
             // 上传产品个数
             var defer = $q.defer();
-            Goods.getProductsCmp({fromDate: $scope.startDate.getTime(), toDate: $scope.endDate.getTime()}, function (data) {
+            Goods.getProductsCmp({fromDate: $scope.startDate && $scope.startDate.getTime(), toDate: $scope.endDate && $scope.endDate.getTime()}, function (data) {
                 defer.resolve(data.data);
             }, function (err) {
                 defer.reject(err);
@@ -205,8 +210,8 @@ define([ 'app/app' ], function(app) {
         };
         // 获取不同时间阶段的相关数据
         var initData = function () {
-            var addStartDate = new Date($scope.startDate.getTime() + 24 * 60 * 60 * 1000),
-            addEndDate = new Date($scope.endDate.getTime() + 24 * 60 * 60 * 1000);
+            var addStartDate = $scope.startDate && new Date($scope.startDate.getTime() + 24 * 60 * 60 * 1000),
+            addEndDate = $scope.endDate && new Date($scope.endDate.getTime() + 24 * 60 * 60 * 1000);
             $scope.addStartFormatDate = _formatDate(addStartDate, 'yyyy-MM-dd');
             $scope.addEndFormatDate = _formatDate(addEndDate, 'yyyy-MM-dd');
             $scope.startFormatDate = _formatDate($scope.startDate, 'yyyy-MM-dd');

+ 2 - 2
src/main/webapp/resources/view/admin/stats_data.html

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