Browse Source

求购首页

yangc 7 years ago
parent
commit
da3c9cb217
2 changed files with 30 additions and 13 deletions
  1. 1 1
      components/applyPurchase/SayPrice.vue
  2. 29 12
      components/home/floor/FloorList.vue

+ 1 - 1
components/applyPurchase/SayPrice.vue

@@ -60,7 +60,7 @@
   import Loading from '~components/common/loading/PageLoading.vue'
   export default {
     props: {
-      purchase: Array,
+      purchase: Object,
       current: Number
     },
     data () {

+ 29 - 12
components/home/floor/FloorList.vue

@@ -3,6 +3,7 @@
     <div class="container">
       <floor-bar :floors="floors"></floor-bar>
       <!--<a href="/store/33069557578d44e69bd91ad12d28a8d4" target="_blank"><img src="/images/all/banner-cuxiao.png" alt=""></a>-->
+      <div v-if="purchaseManListData && false"></div>
       <div class="banner">
         <ul class="seek-banner">
           <li><a href="/store/33069557578d44e69bd91ad12d28a8d4" target="_blank"><img src="/images/all/banner-cuxiao01.png" alt=""></a></li>
@@ -22,7 +23,7 @@
                   <li v-for="(purchaseMan, index) in purchaseManList.content" :style="'top: -' + 32 * timerIndex + 'px'">
                     <div>{{purchaseMan.date | date}}</div>
                     <div>
-                      <span v-if="purchaseMan.inquiry.enterprise && purchaseMan.inquiry.enterprise.enName">{{purchaseMan.inquiry.enterprise.enName | enterpriseFilter}}</span>
+                      <span v-if="purchaseMan.inquiry && purchaseMan.inquiry.enterprise && purchaseMan.inquiry.enterprise.enName">{{purchaseMan.inquiry.enterprise.enName | enterpriseFilter}}</span>
                       <span v-else>{{purchaseMan.userName | userNameFilter}}</span>
                     </div>
                     <div :title="purchaseMan.cmpCode">{{purchaseMan.cmpCode}}</div>
@@ -91,28 +92,39 @@
         timerIndex: 0,
         pageSize: 50,
         nowPage: 1,
-        currentSayPriceIndex: -1
+        currentSayPriceIndex: -1,
+        purchaseManList: {
+          content: []
+        },
+        listTemplate: []
       }
     },
     mounted () {
       setInterval(() => {
-        this.timerIndex ++
-        if (this.timerIndex > 45) {
-          this.timerIndex = 0
+        let _this = this
+        _this.timerIndex ++
+        if (_this.timerIndex % 45 === 0) {
+          for (let i = 0; i < _this.listTemplate.content.length; i++) {
+            this.purchaseManList.content.push(_this.listTemplate.content[i])
+          }
         }
       }, 3000)
     },
     filters: {
       date: function (date) {
-        const now = new Date()
-        const day = (date - now.getTime()) - 1000 * 60 * 60 * 24
-        return day < 0 ? '今天' : day + '天前'
+        const now = new Date().getDate()
+        const day = (new Date(date).getDate() - now)
+        return day <= 0 ? '今天' : day + '天前'
       },
       enterpriseFilter (str) {
-        return str.length > 4 ? str.substring(0, 2) + '**' + str.substring(str.length - 2, str.length) : str
+        if (str) {
+          return str.length > 4 ? str.substring(0, 2) + '**' + str.substring(str.length - 2, str.length) : str
+        } else {
+          return '-'
+        }
       },
       userNameFilter (str) {
-        return str.substring(0, 1) + '**'
+        return str ? str.substring(0, 1) + '**' : '-'
       }
     },
     computed: {
@@ -162,8 +174,13 @@
         }
         return false
       },
-      purchaseManList () {
-        return this.$store.state.applyPurchase.purchaseManList.purchaseManList.data
+      purchaseManListData () {
+        let list = this.$store.state.applyPurchase.purchaseManList.purchaseManList.data
+        for (let i = 0; i < list.content.length; i++) {
+          this.purchaseManList.content.push(list.content[i])
+        }
+        this.listTemplate = list
+        return list
       },
       user () {
         return this.$store.state.option.user