Browse Source

修改求购信息剩余时间计算方法。

yangc 8 years ago
parent
commit
3e977dbe44
1 changed files with 3 additions and 3 deletions
  1. 3 3
      components/applyPurchase/ApplyInfo.vue

+ 3 - 3
components/applyPurchase/ApplyInfo.vue

@@ -24,7 +24,7 @@
           <span>{{purchaseMan.userName}}</span>
           <span>{{purchaseMan.userName}}</span>
           <span>{{purchaseMan.code}}</span>
           <span>{{purchaseMan.code}}</span>
           <span>{{purchaseMan.brand}}</span>
           <span>{{purchaseMan.brand}}</span>
-          <span class="date-content"><span>剩余&nbsp;</span><span v-text="getDay(purchaseMan.deadline - purchaseMan.releaseDate)"></span>&nbsp;天&nbsp;<span v-text="getHours(purchaseMan.deadline - purchaseMan.releaseDate)"></span>&nbsp;小时</span>
+          <span class="date-content"><span>剩余&nbsp;</span><span v-text="getDay(purchaseMan.deadline)"></span>&nbsp;天&nbsp;<span v-text="getHours(purchaseMan.deadline)"></span>&nbsp;小时</span>
           <span class="number-content"><img src="/images/applyPurchase/hot-fire.png" alt="" v-if="purchaseMan.offerAmount > 10"><span :style="purchaseMan.offerAmount > 10 ? 'color: #ff9a00': ''">{{purchaseMan.offerAmount || 0}}</span>&nbsp;条</span>
           <span class="number-content"><img src="/images/applyPurchase/hot-fire.png" alt="" v-if="purchaseMan.offerAmount > 10"><span :style="purchaseMan.offerAmount > 10 ? 'color: #ff9a00': ''">{{purchaseMan.offerAmount || 0}}</span>&nbsp;条</span>
           <span class="btn-content">
           <span class="btn-content">
             <a>联系买家</a>
             <a>联系买家</a>
@@ -120,10 +120,10 @@
     },
     },
     methods: {
     methods: {
       getDay: function (timeStamp) {
       getDay: function (timeStamp) {
-        return Math.floor(timeStamp / (1000 * 60 * 60 * 24))
+        return Math.floor((timeStamp - new Date().getTime()) / (1000 * 60 * 60 * 24))
       },
       },
       getHours: function (timeStamp) {
       getHours: function (timeStamp) {
-        return Math.floor((timeStamp / (1000 * 60 * 60)) % 24)
+        return Math.floor(((timeStamp - new Date().getTime()) / (1000 * 60 * 60)) % 24)
       },
       },
       listenPage: function (page) {
       listenPage: function (page) {
         this.nowPage = page
         this.nowPage = page