Browse Source

Merge remote-tracking branch 'origin/dev' into dev

dongbw 8 years ago
parent
commit
98e86eab64

+ 2 - 2
src/main/resources/prod/sys.properties

@@ -11,7 +11,7 @@ reportPrintUrl=http://print.ubtob.com/report/print?userName=B2B%s&profile=${prof
 reportUploadUrl=http://print.ubtob.com/report/fileUpload?userName=B2B%s
 
 #product service url
-productServiceUrl=https://api-product.usoftmall.com
+productServiceUrl=https://api-product.usoftmall.com/ 
 
 #inquiry service url
-inquiryServiceUrl=https://api-inquiry.usoftmall.com
+inquiryServiceUrl=https://api-inquiry.usoftmall.com/

+ 1 - 1
src/main/resources/test/sys.properties

@@ -12,7 +12,7 @@ reportUploadUrl=http://print.ubtob.com/report/fileUpload?userName=B2B%s
 
 #product service url
 ## test http://218.17.158.219:24000
-productServiceUrl=http://192.168.253.102:8080
+productServiceUrl=http://218.17.158.219:24000
 
 #inquiry service url
 inquiryServiceUrl=http://218.17.158.219:24000

+ 62 - 25
src/main/webapp/resources/js/index/app.js

@@ -5583,14 +5583,27 @@ define(['toaster', 'charts', 'ngTable', 'common/services', 'common/directives',
 
         // 增加一列分段报价
         $scope.addStep = function (inquiryItem) {
-            $scope.replyPrices.push(true);
-            if (inquiryItem.replies.length >= 5) {
-                toaster.pop('warning', '提示', '最多支持5个分段!');
-            } else {
-                inquiryItem.replies.push({});
-                if (inquiryItem.replies.length != 1) {
-                    $scope.replyPrices.push(true);
-                    $scope.replylapQtys.push(true);
+            var check = true;
+            angular.forEach(inquiryItem.replies, function(reply) {
+                if (reply.lapQty == null) {
+                    toaster.pop('error', '提示', '存在未填写分段数量的分段,请先填写分段数量');
+                    check = false;
+                }
+                if (check && reply.price == null) {
+                    toaster.pop('error', '提示', '存在未填写价格的分段,请先填写价格');
+                    check = false;
+                }
+            });
+            if (check) {
+                $scope.replyPrices.push(true);
+                if (inquiryItem.replies.length >= 5) {
+                    toaster.pop('warning', '提示', '最多支持5个分段!');
+                } else {
+                    inquiryItem.replies.push({});
+                    if (inquiryItem.replies.length != 1) {
+                        $scope.replyPrices.push(true);
+                        $scope.replylapQtys.push(true);
+                    }
                 }
             }
         };
@@ -5609,26 +5622,50 @@ define(['toaster', 'charts', 'ngTable', 'common/services', 'common/directives',
 
         // 保存报价信息
         $scope.save = function(inquiryItem, method) {
-            var file = $scope.myFiles, file = file && file.length > 0 ? file[0] : null;// 可以不传附件
-            $upload.upload({
-                url: 'pubInquiry/turnToQuotation',
-                file: file,
-                method: 'POST',
-                data: {
-                    item: inquiryItem,
-                    method: method
+            var replies = [];
+            // 判断分段数是否合法
+            var valid = true;
+            var validLapQty = 0;
+            angular.forEach(inquiryItem.replies, function (r, i) {
+                if ((i > 0 ? r.lapQty : 1) || r.price) {
+                    replies.push(r);
                 }
-            }).success(function (data) {
-                if (data.item) {
-                    item = data.item;
+                // 直接比较是字符串比较,需要先转换再比较  2017年9月7日 15:05:51
+                if (i > 0 && parseInt(r.lapQty) <= parseInt(inquiryItem.replies[i - 1].lapQty) || r.lapQty == null) {
+                    valid = false;
+                    validLapQty = r.lapQty;
                 }
-                $scope.loading = false;
-                toaster.pop('info', '提示', '报价成功');
-                $modalInstance.close();
-            }).error(function (data) {
-                $scope.loading = false;
-                toaster.pop('error', '附件上传失败');
             });
+            inquiryItem.replies = replies;
+            $scope.loading = true;
+            if (!valid) {
+                if (validLapQty) {
+                    toaster.pop('error', '提示', '分段' + validLapQty + '小于等于了上一分段数,不能保存!');
+                } else {
+                    toaster.pop('error', '提示', '分段数量不合法,不能报价!');
+                }
+            } else {
+                var file = $scope.myFiles, file = file && file.length > 0 ? file[0] : null;// 可以不传附件
+                $upload.upload({
+                    url: 'pubInquiry/turnToQuotation',
+                    file: file,
+                    method: 'POST',
+                    data: {
+                        item: inquiryItem,
+                        method: method
+                    }
+                }).success(function (data) {
+                    if (data.item) {
+                        item = data.item;
+                    }
+                    $scope.loading = false;
+                    toaster.pop('info', '提示', '报价成功');
+                    $modalInstance.close();
+                }).error(function (data) {
+                    $scope.loading = false;
+                    toaster.pop('error', '附件上传失败');
+                });
+            }
         }
 
         $scope.previewShow = false;