wangcz 7 жил өмнө
parent
commit
b132f3532b

+ 22 - 14
components/home/displayCard.vue

@@ -4,8 +4,8 @@
      <div class="content" v-if="cardShow">
        <div>
          <ul class="list-unstyled">
-           <li ref="pingdanListWrapper" v-for="item in counts"  :style="'top: -' + 30 * timerIndex + 'px'" :class="{'top': isTop}">
-             <span>{{item.item}}</span>
+           <li ref="pingdanListWrapper" v-for="item in title"  :style="'top: -' + 30 * timerIndex + 'px'" :class="{'top': isTop}">
+             <span>{{item}}</span>
            </li>
          </ul>
          <ul class="list-unstyled">
@@ -32,7 +32,8 @@
         cardShow: true,
         timerIndex: 0,
         isTop: false, // 判断是否滚动至顶,
-        timer: {} // 定时器实体
+        timer: {}, // 定时器实体
+        title: ['品  牌', '现  货', '规格书', '店  铺']
       }
     },
     mounted () {
@@ -52,7 +53,9 @@
               _transitionEvent && this.$refs.pingdanListWrapper[0].addEventListener(
                 _transitionEvent, () => {
                   if (isChange) {
+                    let title = this.title.shift()
                     let count = this.counts.shift()
+                    this.title.push(title)
                     this.counts.push(count)
                     this.timerIndex = 0
                     isChange = false
@@ -171,15 +174,16 @@
         let count = this.baseUtils.deepCopy(this.counter)
         if(count.length){
           count.forEach((value) => {
-            if (value.usedFor === 'mall_home_banner') {
-              value.type = value.detno === 2 ? 3: 1
-              value.count = this.formatNumber(value.count)
-              arr.push(value)
+            if (value.item === '供应商') {
+              arr[0] = {id: value.item, count: this.formatNumber(value.count), type: 3}
+            } else if (value.item === '本年交易金额') {
+              arr[1] = {id: value.item, count: this.formatNumber(value.count), type: 1}
+            } else if (value.item === '上年交易金额') {
+              arr[2] = {id: value.item, count: this.formatNumber(value.count), type: 1}
             }
           })
-          arr = arr.sort((a,b) => {return a.detno - b.detno})
-          arr.push({count: this.inquirySheet ? this.inquirySheet : 0, type: 2},
-            {count: this.inquirySheetLast ? this.inquirySheetLast : 0, type: 2})
+          arr[3] = {id: '本月求购数', count: this.inquirySheet ? this.inquirySheet : 0, type: 2}
+          arr[4] = {id: '上月求购数', count: this.inquirySheetLast ? this.inquirySheetLast : 0, type: 2}
         }
         return arr
       },
@@ -188,12 +192,16 @@
         let count = this.baseUtils.deepCopy(this.counter)
         if(count.length) {
           count.forEach((value) => {
-            if (value.usedFor === 'b2c_index') {
-              value.logo = value.detno === 4 ? 0: 1
-              arr.push(value)
+            if (value.item === '品牌') {
+              arr[0] = {id: value.item, count: value.count, logo: 1}
+            } else if (value.item === '现货') {
+              arr[1] = {id: value.item, count: value.count, logo: 1}
+            } else if (value.item === '规格书') {
+              arr[2] = {id: value.item, count: value.count, logo: 1}
+            } else if (value.item === '店铺') {
+              arr[3] = {id: value.item, count: value.count, logo: 0}
             }
           })
-          arr = arr.sort((a,b) => {return a.detno - b.detno})
         }
         return arr
       }

+ 17 - 10
components/mobile/common/StatisticsMobile.vue

@@ -169,20 +169,27 @@
       },
       itemData () {
         let str = []
-        if (this.counter) {
+        if (this.counter.length) {
           this.counter.forEach((value, key, $data) => {
-            if($data[key].item === '店铺' || $data[key].item ==='供应商') {
-              str.push({id: $data[key].item, count: $data[key].count, type: 3})
-            } else if($data[key].item === '本年交易金额' || $data[key].item ==='上年交易金额') {
-              str.push({id: $data[key].item, count: $data[key].count, type: 4})
-            } else {
-              str.push({id: $data[key].item, count: $data[key].count, type: 1})
+            if($data[key].item === '店铺') {
+              str[4] = {id: $data[key].item, count: $data[key].count, type: 3}
+            } else if($data[key].item === '供应商') {
+              str[3] = {id: $data[key].item, count: $data[key].count, type: 3}
+            } else if($data[key].item === '本年交易金额') {
+              str[8] = {id: $data[key].item, count: $data[key].count, type: 4}
+            } else if($data[key].item ==='上年交易金额') {
+              str[7] = {id: $data[key].item, count: $data[key].count, type: 4}
+            } else if($data[key].item === '品牌') {
+              str[1] = {id: $data[key].item, count: $data[key].count, type: 1}
+            } else if($data[key].item === '现货') {
+              str[0] = {id: $data[key].item, count: $data[key].count, type: 1}
+            } else if($data[key].item === '规格书') {
+              str[2] = {id: $data[key].item, count: $data[key].count, type: 1}
             }
           })
         }
-        str.push({id: '本月询价单', count: this.$store.state.count.inquirySheet.data ? this.$store.state.count.inquirySheet.data.count : 0, type: 2})
-        str.push({id: '上月询价单', count: this.$store.state.count.inquirySheetLast.data ? this.$store.state.count.inquirySheetLast.data.count : 0, type: 2})
-        str = [str[1], str[0], str[2], str[4], str[3], str[8], str[7], str[5], str[6]]
+        str[6] = {id: '本月询价单', count: this.$store.state.count.inquirySheet.data ? this.$store.state.count.inquirySheet.data.count : 0, type: 2}
+        str[5] ={id: '上月询价单', count: this.$store.state.count.inquirySheetLast.data ? this.$store.state.count.inquirySheetLast.data.count : 0, type: 2}
         return str
       },
       itemLeft () {