Просмотр исходного кода

求购模块验收问题处理

liusw 8 лет назад
Родитель
Сommit
4acacb55e7

+ 1 - 1
src/main/java/com/uas/platform/b2c/trade/seek/controller/SeekPurchaseOfferController.java

@@ -117,7 +117,7 @@ public class SeekPurchaseOfferController {
      * @param spIds
      * @return
      */
-    @RequestMapping(value = "/getSeekPurchaseOfferList", method = RequestMethod.POST)
+    @RequestMapping(value = "/getSeekPurchaseOfferList", method = RequestMethod.GET)
     @ResponseBody
     public List<SeekPurchaseOffer> getSeekPurchaseOfferList(List<Long> spIds) {
         User user = SystemSession.getUser();

+ 5 - 1
src/main/java/com/uas/platform/b2c/trade/seek/service/impl/SeekPurchaseServiceImpl.java

@@ -154,12 +154,16 @@ public class SeekPurchaseServiceImpl implements SeekPurchaseService {
 
     @Override
     public ResultMap updateSeekPurchaseStatus(Long spId, Long ofId, Double purchaseQuantity) {
+        // 采纳数量 只能输入0-1亿之间的正整数
+        if (purchaseQuantity <= 0 && purchaseQuantity > 100000000) {
+            return new ResultMap(CodeType.PARAMETER_ERROR, "请输入正确的采购数量");
+        }
         // 修改求购表的报价状态
         SeekPurchase seekPurchase = seekPurchasedao.findOne(spId);
         seekPurchase.setStatus(Status.ACCEPTED.getValue());
         seekPurchase.setBoughtAmount(purchaseQuantity);
         seekPurchase.setDeadline(new Date(System.currentTimeMillis()));
-        seekPurchase = seekPurchasedao.save(seekPurchase);
+        seekPurchasedao.save(seekPurchase);
         // 修改报价表的状态
         SeekPurchaseOffer seekPurchaseOffer = seekPurchaseOfferDao.findOne(ofId);
         seekPurchaseOffer.setStatus(Status.ACCEPTED.getValue());

+ 18 - 4
src/main/webapp/resources/js/usercenter/controllers/forstore/seek_purchase_ctrl.js

@@ -155,15 +155,23 @@ define(['app/app'], function (app) {
 
           // 采纳报价
           $scope.adopt = function () {
+            if (!$scope.purchaseQuantity) {
+                toaster.pop('error', "请输入正确的采购数量");
+                return;
+            }
             seekPurchase.updateSeekPurchaseStatus({
               spId: $scope.currentOffer.spId,
               ofId: $scope.currentOffer.id,
               purchaseQuantity: $scope.purchaseQuantity
             }, {}, function (data) {
-              $scope.currentOffer = null;
-              $scope.seekPurchaseTableParams.reload();
-              $scope.showUseFlag = false;
-              toaster.pop('success', '采纳报价成功');
+              if (data.success) {
+                $scope.currentOffer = null;
+                $scope.seekPurchaseTableParams.reload();
+                $scope.showUseFlag = false;
+                toaster.pop('success', '采纳报价成功');
+              } else {
+                toaster.pop('error', data.message);
+              }
             }, function (response) {
               toaster.pop('error', response.data);
             });
@@ -485,6 +493,12 @@ define(['app/app'], function (app) {
             if (flag) {
               $scope.currentOffer = offer;
             }
+            // 如果当前求购数量不为空
+            if ($scope.currentSeek.amount) {
+              $scope.purchaseQuantity = $scope.currentSeek.amount;
+              flag = false;
+              $scope.adopt();
+            }
             $scope.showUseFlag = flag;
           }
 

+ 8 - 4
src/main/webapp/resources/js/vendor/controllers/forstore/seek_purchase_ctrl.js

@@ -123,11 +123,15 @@ define(['app/app'], function (app) {
           // 保存报价
           $scope.saveOffer = function (seek) {
             seekPurchase.saveOffer($scope.offer, function (data) {
-              $scope.setSeekActive(seek, false);
-              $scope.seekPurchaseTableParams.reload();
-              toaster.pop('success', '报价成功');
+              if (data.success) {
+                $scope.setSeekActive(seek, false);
+                $scope.seekPurchaseTableParams.reload();
+                toaster.pop('success', '报价成功');
+              } else {
+                toaster.pop('error', data.message);
+              }
             }, function (res) {
-              toaster.pop('error', '报价失败');
+              toaster.pop('error', res.data);
             });
           }
 

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

@@ -514,7 +514,7 @@
                 <td ng-bind="seek.brand || '-'" title="{{seek.brand}}"></td>
                 <td ng-bind="seek.amount || '-'"></td>
                 <td>
-                    <span ng-class="{'red-text': seek.unitPrice && seek.unitPrice > 0}">{{seek.currency+seek.unitPrice | currencyStr}}</span>
+                    <span>{{seek.currency + seek.unitPrice | currencyStr}}</span>
                 </td>
                 <td ng-bind="seek.encapsulation || '-'">盘装</td>
                 <td ng-bind="seek.produceDate || '-'">2012-12-12</td>
@@ -611,7 +611,7 @@
                                         <td width="173" ng-bind="(of.enterprise).enName"></td>
                                         <td width="186" class="red-text" ng-bind="of.minDay+'-'+of.maxDay">4-6</td>
                                         <td width="186"><span>{{of.currency + of.unitPrice | currencyStr}}</span></td>
-                                        <td width="212" ng-bind="(of.produceDate | date: 'yyyy-MM-dd') || '-'"></td>
+                                        <td width="212" ng-bind="of.produceDate || '-'"></td>
                                         <td width="221" class="operate">
                                             <a href = "of.user.usertTel">联系卖家 <img src="static/img/seekPurchase/link-buyer.png" alt=""></a>
                                             <span ng-if="seek.status != 202" ng-click="setShowUseFlag(true, of)">采纳报价</span>

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

@@ -68,7 +68,7 @@
         margin-right: 11px;
     }
     .seek-purchase .seek-purchase-content .screen .fl select:last-child {
-        width: 72px;
+        width: 88px;
         padding-left: 6px;
     }
     .seek-purchase .seek-purchase-content .screen .sreach >span {

+ 1 - 2
src/main/webapp/resources/view/vendor/forstore/seekPurchase.html

@@ -402,8 +402,7 @@
                     <td ng-bind="seek.produceDate || '--'"></td>
                     <td ng-bind="seek.amount || '--'"></td>
                     <td class="unit-price">
-                        <div ng-if="!seek.unitPrice || seek.unitPrice == null">-</div>
-                        <span ng-if="seek.unitPrice">{{(seek.currency=='RMB'?'¥':'$')+seek.unitPrice | currencyStr}}</span>
+                        <span>{{seek.currency + seek.unitPrice | currencyStr}}</span>
                     </td>
                     <td class="left-time" ng-if="seek.remainingTime > 0">剩余&nbsp;<span ng-bind="getDay(seek.remainingTime)"></span>&nbsp;天&nbsp;<span ng-bind="getHours(seek.remainingTime)">5</span>&nbsp;小时</td>
                     <td class="left-time" ng-if="seek.remainingTime <= 0"><span>已截止</span></td>