Browse Source

首页求购

yangc 7 years ago
parent
commit
dd9af19b58

+ 5 - 2
components/applyPurchase/BatchPublish.vue

@@ -403,6 +403,9 @@
       submitModify: function (index) {
         let checkValid = this.checkAll()
         if (this.getSingleValidInfo(this.modifyObj) && checkValid) {
+          if (this.modifyObj.unitPrice) {
+            this.modifyObj.currency = null
+          }
           this.$http.put('/seek/updateSeekPurchaseByBatch', this.modifyObj)
             .then(response => {
               if (response.data.success) {
@@ -593,8 +596,8 @@
             }
           }
           this.modifyObj.amount = cutOutString(this.modifyObj.amount, chineseIndex)
-        } else if (this.modifyObj.amount.length > 8) {
-          this.modifyObj.amount = cutOutString(this.modifyObj.amount, 8)
+        } else if (this.modifyObj.amount.length > 9) {
+          this.modifyObj.amount = cutOutString(this.modifyObj.amount, 9)
         }
       },
       setCode: function (code) {

+ 2 - 2
components/applyPurchase/PublishApply.vue

@@ -446,8 +446,8 @@
             }
           }
           this.applyObj.amount = cutOutString(this.applyObj.amount, chineseIndex)
-        } else if (this.applyObj.amount.length > 8) {
-          this.applyObj.amount = cutOutString(this.applyObj.amount, 8)
+        } else if (this.applyObj.amount.length > 9) {
+          this.applyObj.amount = cutOutString(this.applyObj.amount, 9)
         }
       },
       onSuccess: function (data) {

+ 46 - 59
components/home/floor/FloorList.vue

@@ -2,8 +2,8 @@
   <div class="floor-list">
     <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 class="banner">
+      <!--<a href="/store/33069557578d44e69bd91ad12d28a8d4" target="_blank"><img src="/images/all/banner-cuxiao.png" alt=""></a>-->
+      <div class="banner">
         <ul>
           <li><a href="/store/33069557578d44e69bd91ad12d28a8d4" target="_blank"><img src="/images/all/banner-cuxiao01.png" alt=""></a></li>
           <li>
@@ -19,19 +19,22 @@
                 </tr>
                 </thead>
                 <tbody>
-                <tr v-for="data in tableData">
-                  <td>{{data.publicTime}}</td>
-                  <td>{{data.name.slice(0, 1) + '**'}}</td>
-                  <td>{{data.productModel | titleFilter}}</td>
-                  <td><a>我要报价</a></td>
+                <tr v-for="purchaseMan in purchaseManList.content.slice(timerIndex, timerIndex + 5)">
+                  <td>{{purchaseMan.date | date}}</td>
+                  <td>
+                    <div v-if="purchaseMan.inquiry.enterprise && purchaseMan.inquiry.enterprise.enName">{{purchaseMan.inquiry.enterprise.enName | enterpriseFilter}}</div>
+                    <div v-else>{{purchaseMan.userName | userNameFilter}}</div>
+                  </td>
+                  <td :title="purchaseMan.cmpCode">{{purchaseMan.cmpCode}}</td>
+                  <td><nuxt-link to="applyPurchase">我要报价</nuxt-link></td>
                 </tr>
                 </tbody>
               </table>
-              <a class="purchase">我要求购</a>
+              <nuxt-link to="applyPurchase" class="purchase">我要求购</nuxt-link>
             </div>
           </li>
         </ul>
-      </div>-->
+      </div>
       <floor :floor="defaultFloors[0]" :isDefault="true" v-if="!isEmpty"></floor>
       <floor :floor="defaultFloors[1]" :isDefault="true" v-if="!isEmpty"></floor>
       <floor v-for="(floor, index) in floors.data" :floor="floor" :isDefault="false" :key="index"></floor>
@@ -50,27 +53,6 @@
     },
     data () {
       return {
-        tableData: [{
-          publicTime: '7分钟前',
-          name: '杨某某',
-          productModel: '9w8r9r'
-        }, {
-          publicTime: '7分钟前',
-          name: '杨某某',
-          productModel: '9w8r9r8r78e'
-        }, {
-          publicTime: '7分钟前',
-          name: '杨某某',
-          productModel: '9w8r9r8r78e'
-        }, {
-          publicTime: '7分钟前',
-          name: '杨某某',
-          productModel: '9w8r9r8r78e'
-        }, {
-          publicTime: '7分钟前',
-          name: '杨某某',
-          productModel: '9w8r9r8r78e'
-        }],
         defaultFloors: [
           {
             items: [
@@ -94,7 +76,29 @@
               }
             ]
           }
-        ]
+        ],
+        timerIndex: 0
+      }
+    },
+    mounted () {
+      setInterval(() => {
+        this.timerIndex ++
+        if (this.timerIndex > 45) {
+          this.timerIndex = 0
+        }
+      }, 3000)
+    },
+    filters: {
+      date: function (date) {
+        const now = new Date()
+        const day = (date - now.getTime()) - 1000 * 60 * 60 * 24
+        return day < 0 ? '今天' : day + '天前'
+      },
+      enterpriseFilter (str) {
+        return str.length > 4 ? str.substring(0, 2) + '**' + str.substring(str.length - 2, str.length) : str
+      },
+      userNameFilter (str) {
+        return str.substring(0, 1) + '**'
       }
     },
     computed: {
@@ -143,6 +147,9 @@
           }
         }
         return false
+      },
+      purchaseManList () {
+        return this.$store.state.applyPurchase.purchaseManList.purchaseManList.data
       }
     },
     methods: {
@@ -153,31 +160,6 @@
           }
         }
       }
-    },
-    filters: {
-      titleFilter: function (title) {
-        if (title === '') {
-          return title
-        }
-        let len = 0
-        let index = 0
-        for (let i = 0; i < title.length; i++) {
-          if (index === 0 && title.charAt(i).charCodeAt(0) > 255) {
-            len = len + 2
-          } else {
-            len++
-          }
-          if (len > 50) {
-            index = i
-            break
-          }
-        }
-        if (index > 0) {
-          return title.substring(0, index) + '...'
-        } else {
-          return title
-        }
-      }
     }
   }
 </script>
@@ -213,7 +195,7 @@
       padding-left: 14px;
       position: relative;
       &:first-child{
-        padding-left: 0px;
+        padding-left: 0;
       }
     }
     .banner-cuxiao {
@@ -222,6 +204,7 @@
       background: url('/images/all/banner-cuxiao02.png') no-repeat;
       table {
         width: 436px;
+        table-layout: fixed;
         caption {
           color: #f57a2e;
           font-size: 20px;
@@ -241,6 +224,7 @@
         }
        tr th, tr td {
           height: 30px;
+         text-align: center;
           &:first-child {
             padding: 6px 7px 6px 16px;
           }
@@ -269,12 +253,15 @@
               border: 1px solid #fd3904;
               background-color: #fd3904;
               color: #fff;
-              -moz-box-shadow: 0px 3px 5px #f57a2e; /* 老的 Firefox */
-              box-shadow: 0px 3px 10px #f57a2e;
+              -moz-box-shadow: 0 3px 5px #f57a2e; /* 老的 Firefox */
+              box-shadow: 0 3px 10px #f57a2e;
             }
           }
         }
         tr td{
+          overflow: hidden;
+          text-overflow: ellipsis;
+          white-space: nowrap;
           &:first-child {
             color: #f57a2e;
           }

+ 2 - 1
pages/index.vue

@@ -99,7 +99,8 @@
             'BT2018012900002056',
             'BT2018012900002056',
             'BT2018012900002056']
-        })
+        }),
+        store.dispatch('applyPurchase/loadPurchaseManList', {pageNumber: 1, pageSize: 50})
       ]) : []
     },
     computed: {