Browse Source

求购模块-卖家中心

liusw 8 years ago
parent
commit
c410b96002

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

@@ -92,6 +92,15 @@ public class SeekPurchaseOfferController {
         return seekPurchaseOfferService.getSeekPushGoodsPageInfo(info, user, minReleaseDate, maxReleaseDate, keyWord, deadline);
     }
 
+    /**
+     * 获取我的报价
+     * @param params
+     * @param minReleaseDate
+     * @param maxReleaseDate
+     * @param keyWord
+     * @param deadline
+     * @return
+     */
     @RequestMapping(value = "/getMyOfferPageInfo", method = RequestMethod.GET)
     public Page<SeekPurchaseOfferGoods> getMyOfferPageInfo(PageParams params, String minReleaseDate, String maxReleaseDate, String keyWord, String deadline) {
         User user = SystemSession.getUser();

+ 20 - 0
src/main/java/com/uas/platform/b2c/trade/seek/model/SeekPurchaseGoods.java

@@ -133,6 +133,12 @@ public class SeekPurchaseGoods {
     @Column(name = "sp_releaseDate")
     private Date releaseDate;
 
+    /**
+     * 剩余时间
+     */
+    @Transient
+    private String remainingTime;
+
     public Long getSpId() {
         return spId;
     }
@@ -284,4 +290,18 @@ public class SeekPurchaseGoods {
     public void setReleaseDate(Date releaseDate) {
         this.releaseDate = releaseDate;
     }
+
+    public String getRemainingTime() {
+        long date = deadline.getTime() - System.currentTimeMillis();
+        long day = date / (1000 * 60 * 60 * 24);
+        long hour = (date / (1000 * 60 * 60) - day * 24);
+        if (day < 0 && hour < 0) {
+            remainingTime = "已截止";
+        } else if (day < 0) {
+            remainingTime = "剩余" + hour + "小时";
+        } else {
+            remainingTime = "剩余" + day + "天" + hour + "小时";
+        }
+        return remainingTime;
+    }
 }

+ 9 - 9
src/main/java/com/uas/platform/b2c/trade/seek/model/SeekPurchaseOffer.java

@@ -67,7 +67,7 @@ public class SeekPurchaseOffer {
      * 生产日期
      */
     @Column(name = "of_produceDate")
-    private Date produceDate;
+    private String produceDate;
 
     /**
      * 卖家企业uu号
@@ -167,14 +167,6 @@ public class SeekPurchaseOffer {
         this.maxDay = maxDay;
     }
 
-    public Date getProduceDate() {
-        return produceDate;
-    }
-
-    public void setProduceDate(Date produceDate) {
-        this.produceDate = produceDate;
-    }
-
     public Long getEnUu() {
         return enUu;
     }
@@ -236,4 +228,12 @@ public class SeekPurchaseOffer {
         }
         return userTel;
     }
+
+    public String getProduceDate() {
+        return produceDate;
+    }
+
+    public void setProduceDate(String produceDate) {
+        this.produceDate = produceDate;
+    }
 }

+ 79 - 0
src/main/java/com/uas/platform/b2c/trade/seek/model/SeekPurchaseOfferGoods.java

@@ -2,6 +2,8 @@ package com.uas.platform.b2c.trade.seek.model;
 
 import com.uas.platform.b2c.common.account.model.Enterprise;
 import com.uas.platform.b2c.common.account.model.User;
+import java.text.DateFormat;
+import java.text.SimpleDateFormat;
 import java.util.Date;
 import javax.persistence.CascadeType;
 import javax.persistence.Column;
@@ -12,6 +14,7 @@ import javax.persistence.JoinColumn;
 import javax.persistence.OneToOne;
 import javax.persistence.Table;
 import javax.persistence.Transient;
+import javax.swing.plaf.basic.BasicInternalFrameTitlePane.SystemMenuBar;
 
 /**
  * 卖家报价与库存的视图
@@ -125,6 +128,36 @@ public class SeekPurchaseOfferGoods {
     @Column(name = "go_enuu")
     private Long goodsEnuu;
 
+    /**
+     * 发布时间
+     */
+    @Column(name = "sp_release_date")
+    private Date releaseDate;
+
+    /**
+     * 求购型号
+     */
+    @Column(name = "sp_code")
+    private String code;
+
+    /**
+     * 求购品牌
+     */
+    @Column(name = "sp_brand")
+    private String brand;
+
+    /**
+     * 求购截止时间
+     */
+    @Column(name = "sp_deadline")
+    private Date deadline;
+
+    /**
+     * 剩余时间
+     */
+    @Transient
+    private String remainingTime;
+
     public Long getId() {
         return id;
     }
@@ -250,4 +283,50 @@ public class SeekPurchaseOfferGoods {
     public void setGoodsEnuu(Long goodsEnuu) {
         this.goodsEnuu = goodsEnuu;
     }
+
+    public Date getReleaseDate() {
+        return releaseDate;
+    }
+
+    public void setReleaseDate(Date releaseDate) {
+        this.releaseDate = releaseDate;
+    }
+
+    public String getCode() {
+        return code;
+    }
+
+    public void setCode(String code) {
+        this.code = code;
+    }
+
+    public String getBrand() {
+        return brand;
+    }
+
+    public void setBrand(String brand) {
+        this.brand = brand;
+    }
+
+    public Date getDeadline() {
+        return deadline;
+    }
+
+    public void setDeadline(Date deadline) {
+        this.deadline = deadline;
+    }
+
+    public String getRemainingTime() {
+        long date = deadline.getTime() - System.currentTimeMillis();
+        long day = date / (1000 * 60 * 60 * 24);
+        long hour = (date / (1000 * 60 * 60) - day * 24);
+        if (day < 0 && hour < 0) {
+            remainingTime = "已截止";
+        } else if (day < 0) {
+            remainingTime = "剩余" + hour + "小时";
+        } else {
+            remainingTime = "剩余" + day + "天" + hour + "小时";
+        }
+        return remainingTime;
+    }
 }

+ 20 - 0
src/main/java/com/uas/platform/b2c/trade/seek/model/SeekPurchasePushGoods.java

@@ -142,6 +142,12 @@ public class SeekPurchasePushGoods {
     @Column(name = "go_enuu")
     private Long goEnUu;
 
+    /**
+     * 剩余时间
+     */
+    @Transient
+    private String remainingTime;
+
     public Long getSpId() {
         return spId;
     }
@@ -302,4 +308,18 @@ public class SeekPurchasePushGoods {
     public void setGoEnUu(Long goEnUu) {
         this.goEnUu = goEnUu;
     }
+
+    public String getRemainingTime() {
+        long date = deadline.getTime() - System.currentTimeMillis();
+        long day = date / (1000 * 60 * 60 * 24);
+        long hour = (date / (1000 * 60 * 60) - day * 24);
+        if (day < 0 && hour < 0) {
+            remainingTime = "已截止";
+        } else if (day < 0) {
+            remainingTime = "剩余" + hour + "小时";
+        } else {
+            remainingTime = "剩余" + day + "天" + hour + "小时";
+        }
+        return remainingTime;
+    }
 }

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

@@ -213,7 +213,7 @@ public class SeekPurchaseOfferServiceImpl implements SeekPurchaseOfferService {
         }
         // 按发布时间降序排序
         pageInfo.sorting("releaseDate", Direction.DESC);
-        pageInfo.filter("uu", user.getEnterprise().getUu());
+        pageInfo.filter("enUu", user.getEnterprise().getUu());
         Page<SeekPurchaseOfferGoods> pages = seekPurchaseOfferGoodsDao
                 .findAll(new Specification<SeekPurchaseOfferGoods>() {
                     public Predicate toPredicate(Root<SeekPurchaseOfferGoods> root, CriteriaQuery<?> query,

+ 4 - 0
src/main/webapp/resources/js/common/query/seekPurchase.js

@@ -30,6 +30,10 @@ define([ 'ngResource' ], function() {
       getSeekPurchaseOfferPageInfo: {
         url: 'seek/offer/getSeekPurchaseOfferPageInfo',
         method: 'GET'
+      },
+      getMyOfferPageInfo: {
+        url: 'seek/offer/getMyOfferPageInfo',
+        method: 'GET'
       }
 		});
 }])

+ 52 - 21
src/main/webapp/resources/js/vendor/controllers/forstore/seek_purchase_ctrl.js

@@ -7,7 +7,12 @@ define(['app/app'], function(app) {
         $scope.offer = {};
 
         $scope.switchStatus = function (status) {
-          $scope.status = status;
+            if (status == 'seek') {
+              $scope.getSeekPushGoodsPageInfo();
+            } else {
+              $scope.getMyOfferPageInfo();
+            }
+            $scope.status = status;
         }
 
         // 获取当前卖家求购成交率
@@ -18,26 +23,52 @@ define(['app/app'], function(app) {
         });
 
         // 获取当前卖家求购推送列表
-        $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.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.onSearch = function(){

+ 8 - 4
src/main/webapp/resources/view/vendor/forstore/seekPurchase.html

@@ -438,7 +438,9 @@
                         <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>已上架</div>
+                            <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>
                     </td>
                     <td class="user-name"><div title="{{seek.userName}}" ng-bind="seek.userName"></div></td>
@@ -451,10 +453,12 @@
                         <div ng-if="!seek.unitPrice || seek.unitPrice == null">-</div>
                         <span ng-if="seek.unitPrice">{{(seek.currency=='RMB'?'¥':'$')+seek.unitPrice | currencyStr}}</span>
                     </td>
-                    <td class="left-time">剩余&nbsp;<span ng-bind="getDay(seek.deadline)"></span>&nbsp;天&nbsp;<span ng-bind="getHours(seek.deadline)">5</span>&nbsp;小时</td>
-                    <td class="operate">
+                    <td class="left-time" ><span ng-if="seek.remainingTime == '已截止'" ng-bind="seek.remainingTime"></span></td>
+                    <td class="operate" ng-switch="seek.status">
                         <a>联系买家 <img src="static/img/seekPurchase/link-buyer.png" alt=""></a>
-                        <div ng-click="setSeekActive(seek, true)">我要报价</div>
+                        <div  ng-switch-when="200" ng-click="setSeekActive(seek, true)">我要报价</div>
+                        <span ng-switch-when="201">已报价 <img src="static/img/seekPurchase/check.png" alt=""></span>
+                        <img ng-switch-when="202" src="static/img/seekPurchase/recieved.png" alt="">
                     </td>
                 </tr>
                 <tr class="expand-row">