Browse Source

求购模块-卖家中心

liusw 8 years ago
parent
commit
e21cfb5a5d

+ 20 - 56
src/main/webapp/resources/js/vendor/controllers/forstore/purchase_offer_ctrl.js

@@ -12,69 +12,33 @@ define(['app/app'], function(app) {
             toaster.pop('error', '错误', response.data);
         });
 
-        // 获取当前卖家求购推送列表
-        $scope.getSeekPushGoodsPageInfo = function (){
-            $scope.seekPurchaseTableParams = new ngTableParams({
-                page : 1,
-                count : 5
-            }, {
-                total : 0,
-                getData : function ($defer, params) {
-                    const param = BaseService.parseParams(params.url());
-                    param.deadline = $scope.deadline;
-                    param.status = $scope.status;
-                    param.keyWord = $scope.keyWord;
-                    param.minReleaseDate = $scope.startDate ? $scope.startDate.getTime() : null;
-                    param.maxReleaseDate = $scope.endDate ? $scope.endDate.getTime() : null;
-                    seekPurchase.getSeekPushGoodsPageInfo(param, function (data) {
-                        params.total(data.totalElements);
-                        $defer.resolve(data.content);
-                    }, function (response) {
-                        toaster.pop('error', '获取求购列表失败');
-                    });
-                }
-            });
-        }
-
         // 获取我的报价列表
-        $scope.getMyOfferPageInfo = function () {
-            $scope.seekPurchaseTableParams = new ngTableParams({
-                page : 1,
-                count : 5
-            }, {
-                total : 0,
-                getData : function ($defer, params) {
-                    const param = BaseService.parseParams(params.url());
-                    param.deadline = $scope.deadline;
-                    param.status = $scope.status;
-                    param.keyWord = $scope.keyWord;
-                    param.minReleaseDate = $scope.startDate ? $scope.startDate.getTime() : null;
-                    param.maxReleaseDate = $scope.endDate ? $scope.endDate.getTime() : null;
-                    seekPurchase.getMyOfferPageInfo(param, function (data) {
-                        params.total(data.totalElements);
-                        $defer.resolve(data.content);
-                    }, function (response) {
-                        toaster.pop('error', '获取求购列表失败');
-                    });
-                }
-            });
-        }
+        $scope.seekPurchaseTableParams = new ngTableParams({
+            page : 1,
+            count : 5
+        }, {
+            total : 0,
+            getData : function ($defer, params) {
+                const param = BaseService.parseParams(params.url());
+                param.deadline = $scope.deadline;
+                param.status = $scope.status;
+                param.keyWord = $scope.keyWord;
+                param.minReleaseDate = $scope.startDate ? $scope.startDate.getTime() : null;
+                param.maxReleaseDate = $scope.endDate ? $scope.endDate.getTime() : null;
+                seekPurchase.getMyOfferPageInfo(param, function (data) {
+                    params.total(data.totalElements);
+                    $defer.resolve(data.content);
+                }, function (response) {
+                    toaster.pop('error', '获取求购列表失败');
+                });
+            }
+        });
 
         // 搜索
         $scope.onSearch = function(){
             $scope.seekPurchaseTableParams.reload();
         }
 
-        // 保存报价
-        $scope.saveOffer = function (){
-            seekPurchase.saveOffer($scope.offer, function(data) {
-                $scope.setSeekActive(null, false);
-                toaster.pop('success', '报价成功');
-            }, function (res) {
-                toaster.pop('error', '报价失败');
-            });
-        }
-
         $scope.condition = {endDateOpen:false, startDateOpen: false};
 
         $scope.openDatePicker = function ($event, item, openParam,status) {

+ 23 - 55
src/main/webapp/resources/js/vendor/controllers/forstore/seek_purchase_ctrl.js

@@ -5,60 +5,27 @@ define(['app/app'], function(app) {
         $scope.seekPurchaseRate = {};
         $scope.offer = {};
 
-        // 获取当前卖家求购成交率
-        seekPurchase.getSeekPurchaseRate(function(data) {
-          $scope.seekPurchaseRate = data;
-        }, function(response) {
-          toaster.pop('error', '错误', response.data);
-        });
-
         // 获取当前卖家求购推送列表
-        $scope.getSeekPushGoodsPageInfo = function (){
-          $scope.seekPurchaseTableParams = new ngTableParams({
-            page : 1,
-            count : 5
-          }, {
-            total : 0,
-            getData : function ($defer, params) {
-              const param = BaseService.parseParams(params.url());
-              param.deadline = $scope.deadline;
-              param.status = $scope.status;
-              param.keyWord = $scope.keyWord;
-              param.minReleaseDate = $scope.startDate ? $scope.startDate.getTime() : null;
-              param.maxReleaseDate = $scope.endDate ? $scope.endDate.getTime() : null;
-              seekPurchase.getSeekPushGoodsPageInfo(param, function (data) {
-                params.total(data.totalElements);
-                $defer.resolve(data.content);
-              }, function (response) {
-                toaster.pop('error', '获取求购列表失败');
-              });
-            }
-          });
-        }
-
-        // 获取我的报价列表
-        $scope.getMyOfferPageInfo = function () {
-          $scope.seekPurchaseTableParams = new ngTableParams({
-            page : 1,
-            count : 5
-          }, {
-            total : 0,
-            getData : function ($defer, params) {
-              const param = BaseService.parseParams(params.url());
-              param.deadline = $scope.deadline;
-              param.status = $scope.status;
-              param.keyWord = $scope.keyWord;
-              param.minReleaseDate = $scope.startDate ? $scope.startDate.getTime() : null;
-              param.maxReleaseDate = $scope.endDate ? $scope.endDate.getTime() : null;
-              seekPurchase.getMyOfferPageInfo(param, function (data) {
-                params.total(data.totalElements);
-                $defer.resolve(data.content);
-              }, function (response) {
-                toaster.pop('error', '获取求购列表失败');
-              });
-            }
-          });
-        }
+        $scope.seekPurchaseTableParams = new ngTableParams({
+          page : 1,
+          count : 5
+        }, {
+          total : 0,
+          getData : function ($defer, params) {
+            const param = BaseService.parseParams(params.url());
+            param.deadline = $scope.deadline;
+            param.status = $scope.status;
+            param.keyWord = $scope.keyWord;
+            param.minReleaseDate = $scope.startDate ? $scope.startDate.getTime() : null;
+            param.maxReleaseDate = $scope.endDate ? $scope.endDate.getTime() : null;
+            seekPurchase.getSeekPushGoodsPageInfo(param, function (data) {
+              params.total(data.totalElements);
+              $defer.resolve(data.content);
+            }, function (response) {
+              toaster.pop('error', response.data);
+            });
+          }
+        });
 
         // 搜索
         $scope.onSearch = function(){
@@ -66,9 +33,10 @@ define(['app/app'], function(app) {
         }
 
         // 保存报价
-        $scope.saveOffer = function (){
+        $scope.saveOffer = function (seek){
           seekPurchase.saveOffer($scope.offer, function(data) {
-            $scope.setSeekActive(null, false);
+            $scope.setSeekActive(seek, false);
+            $scope.seekPurchaseTableParams.reload();
             toaster.pop('success', '报价成功');
           }, function (res) {
             toaster.pop('error', '报价失败');

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

@@ -416,7 +416,7 @@
                 </div>
             </div>
         </div>
-        <table ng-table="seekPurchaseTableParams" ng-if="status == 'seek'">
+        <table ng-table="seekPurchaseTableParams">
             <thead>
             <tr>
                 <th width="104">发布时间</th>
@@ -468,33 +468,6 @@
                     <div style="width: 271px;">生产时间:{{seek.seekPurchaseOffer.produceDate}}</div>
                 </td>
             </tr>
-            <tr class="say-price">
-                <td colspan="10">
-                    <div>
-                        <div>报价</div>
-                        <div>
-                            <i>*</i>单价
-                            <!--<select ng-model="offer.currency">-->
-                            <!--<option value="RMB">¥</option>-->
-                            <!--<option value="USD">$</option>-->
-                            <!--</select>-->
-                            <div ng-model="offer.currency">¥</div>
-                            <input type="text" class="form-control" ng-model="offer.unitPrice">
-                        </div>
-                        <div>
-                            <i>*</i>交期&nbsp;
-                            <input type="number" class="form-control" ng-model="offer.minDay">&nbsp;-&nbsp;<input type="number" class="form-control" ng-model="offer.maxDay">&nbsp;天
-                        </div>
-                        <div>
-                            生产日期&nbsp;<input type="text" class="form-control" ng-model="offer.produceDate">
-                        </div>
-                        <div>
-                            <span ng-click="setSeekActive(seek, false)">取消</span>
-                            <span ng-click="saveOffer(offer.spId)">提交</span>
-                        </div>
-                    </div>
-                </td>
-            </tr>
             </tbody>
         </table>
     </div>

+ 3 - 17
src/main/webapp/resources/view/vendor/forstore/seekPurchase.html

@@ -365,7 +365,7 @@
                 </div>
             </div>
         </div>
-        <table ng-table="seekPurchaseTableParams" ng-if="status == 'seek'">
+        <table ng-table="seekPurchaseTableParams">
             <thead>
                 <tr>
                     <th width="104">发布时间</th>
@@ -386,9 +386,7 @@
                         <span ng-bind="seek.releaseDate | date:'yyyy-MM-dd'"></span>
                         <span ng-bind="seek.releaseDate | date:'HH:mm:ss'"></span>
                         <div class="seek-status">
-                            <div ng-show="!seek.goodsEnuu" class="no-grounding">未上架</div>
-                            <a ng-show="!seek.goodsEnuu" ng-click="goGrounding(seek)">去上架>></a>
-                            <div ng-show="seek.goodsEnuu">已上架</div>
+                            <div>已上架</div>
                         </div>
                     </td>
                     <td class="user-name"><div title="{{seek.userName}}" ng-bind="seek.userName"></div></td>
@@ -409,24 +407,12 @@
                         <img ng-switch-when="202" src="static/img/seekPurchase/recieved.png" alt="">
                     </td>
                 </tr>
-                <tr class="expand-row">
-                    <td colspan="10">
-                        <div style="width: 173px;">历史报价</div>
-                        <div style="width: 180px;">单价:<span ng-bind="(seek.seekPurchaseOffer.currency=='RMB'?'¥':'$')+seek.seekPurchaseOffer.unitPrice"></span></div>
-                        <div style="width: 182px;">交期:<span ng-bind="seek.seekPurchaseOffer.minDay+'-'"></span><span ng-bind="seek.seekPurchaseOffer.maxDay+'天'"></span></div>
-                        <div style="width: 271px;">生产时间:{{seek.seekPurchaseOffer.produceDate}}</div>
-                    </td>
-                </tr>
                 <tr class="say-price">
                     <td colspan="10">
                         <div>
                             <div>报价</div>
                             <div>
                                 <i>*</i>单价
-                                <!--<select ng-model="offer.currency">-->
-                                   <!--<option value="RMB">¥</option>-->
-                                   <!--<option value="USD">$</option>-->
-                                 <!--</select>-->
                                 <div ng-model="offer.currency">¥</div>
                                 <input type="text" class="form-control" ng-model="offer.unitPrice">
                             </div>
@@ -439,7 +425,7 @@
                             </div>
                             <div>
                                 <span ng-click="setSeekActive(seek, false)">取消</span>
-                                <span ng-click="saveOffer(offer.spId)">提交</span>
+                                <span ng-click="saveOffer(seek)">提交</span>
                             </div>
                         </div>
                     </td>