Explorar o código

首页计数器添加店铺字段

gaoxm %!s(int64=7) %!d(string=hai) anos
pai
achega
0629396fab
Modificáronse 2 ficheiros con 34 adicións e 38 borrados
  1. 33 38
      components/home/count/displayCard.vue
  2. 1 0
      pages/index.vue

+ 33 - 38
components/home/count/displayCard.vue

@@ -9,38 +9,16 @@
            </li>
          </ul>
          <ul class="list-unstyled">
-           <li v-for="(c, index) in counts.data" :style="'top: -' + 30 * timerIndex + 'px'" :class="{'top': isTop}">
-             <count-item :value ="c.count"></count-item>
+           <li v-for="(c, index) in counts" :style="'top: -' + 30 * timerIndex + 'px'" :class="{'top': isTop}">
+             <count-item :value ="c"></count-item>
            </li>
          </ul>
        </div>
-       <div>
-         <p><span v-html="all"></span><span style="color: #333">家</span>
-         </p>
-       </div>
-       <div>
-         <p v-if="payMoney">
-           <span v-html="payMoney"></span>
-         </p>
-         <p v-else><span>0元</span></p>
-       </div>
-       <div>
-         <p v-if="payMoneyLast">
-           <span v-html="payMoneyLast"></span>
-         </p>
-         <p v-else><span>0元</span></p>
-       </div>
-       <div>
-         <p v-if="inquirySheet">
-           <span v-html="inquirySheet"></span><span style="color: #333">条</span>
-         </p>
-         <p v-else><span>0条</span></p>
-       </div>
-       <div>
-         <p v-if="inquirySheetLast">
-           <span v-html="inquirySheetLast"></span><span style="color: #333">条</span>
+       <div v-for="item in itemCounts">
+         <p><span v-html="item.count"></span>
+           <span style="color: #333" v-if="item.type === 3">家</span>
+           <span style="color: #333" v-if="item.type === 2">条</span>
          </p>
-         <p v-else><span>0条</span></p>
        </div>
        <a class="enter" @click="goStoreApply()">
          <img src="/images/all/enter2.png">
@@ -58,7 +36,7 @@
         timerIndex: 0,
         isTop: false, // 判断是否滚动至顶,
         timer: {}, // 定时器实体
-        title: [ '品牌', '现货', '规格书' ]
+        title: [ '品牌', '现货', '规格书', '店铺' ]
       }
     },
     components: {
@@ -74,7 +52,7 @@
         if (flag) {
           this.timer = setInterval(() => {
             this.timerIndex ++
-            this.isTop = (this.timerIndex % 3 === 0)
+            this.isTop = (this.timerIndex % 4 === 0)
             if (this.isTop) {
               this.timerIndex = 0
             }
@@ -123,9 +101,9 @@
             num = arr[0] * Math.pow(10, arr[1])
           }
           if (num > 99999999) {
-            num = (num / 100000000).toFixed(2).slice(num.length - 1, 4) + '亿'
+            num = (num / 100000000).toFixed(2).slice(num.length - 1, 4) + '<span style="color: #333">亿</span>'
           } else if (num > 9999) {
-            num = (num / 10000).toFixed(2).slice(num.length - 1, 4) + '万'
+            num = (num / 10000).toFixed(2).slice(num.length - 1, 4) + '<span style="color: #333"></span>'
           } else {
             num += ''
           }
@@ -155,20 +133,37 @@
         return this.allCount[1] ? this.formatNumber(this.allCount[1].count, 1) : 0
       },
       inquirySheet () {
-        let sheetNum = this.$store.state.count.inquirySheet.data.count
-        return this.formatDouble(sheetNum)
+        let sheetNum = this.$store.state.count.inquirySheet.data
+        return sheetNum ? this.formatDouble(sheetNum.count) : 0
       },
       inquirySheetLast () {
-        let lastSheetNum = this.$store.state.count.inquirySheetLast.data.count
-        return this.formatDouble(lastSheetNum)
+        let lastSheetNum = this.$store.state.count.inquirySheetLast.data
+        return lastSheetNum ? this.formatDouble(lastSheetNum.count) : 0
       },
       all () {
         let count = this.$store.state.supplier.merchant.merchantAll.data
-        let supplierCount = count.content ? count.totalElements + '' : '0'
+        let supplierCount = count.content ? count.totalElements + '' : 0
         return this.formatNumber(supplierCount, 0)
       },
+      itemCounts () {
+        let arr = []
+        arr.push({count: this.all ? this.all : 0, type: 3}, {count: this.payMoney ? this.payMoney : 0, type: 1}, {count: this.payMoneyLast ? this.payMoneyLast : 0, type: 1}, {count: this.inquirySheet ? this.inquirySheet : 0, type: 2}, {count: this.inquirySheetLast ? this.inquirySheetLast : 0, type: 2})
+        return arr
+      },
+      list () {
+        let list = JSON.parse(JSON.stringify(this.$store.state.provider.stores.storeList.data))
+        return list
+      },
       counts () {
-        return this.$store.state.product.common.counts
+        let arr = []
+        let countM = this.$store.state.product.common.counts.data
+        if (countM) {
+          countM.forEach((value, key, $data) => {
+            arr.push(value.count)
+          })
+        }
+        arr.push(this.list.totalElements)
+        return arr
       },
       enterprise () {
         return this.user.data.enterprise

+ 1 - 0
pages/index.vue

@@ -87,6 +87,7 @@
         store.dispatch('loadAllCount', {_status: 'actived', usedFor: 'mall_home_banner'}),
         store.dispatch('loadInquirySheet', {year: nowYear, month: nowMonth}),
         store.dispatch('loadInquirySheetLast', {year: nowYear, month: LastMonth}),
+        store.dispatch('provider/findStoreListInMobil', {page: 1, count: 10, type: 'ORIGINAL_FACTORY-DISTRIBUTION-AGENCY-CONSIGNMENT', keyword: ''}),
         store.dispatch('loadBatchCommodities', {batchCodeList: store.state.option.url === 'http://www.usoftmall.com' ? [
           'BT2018013000000043',
           'BT2018013000000026',