Эх сурвалжийг харах

Merge remote-tracking branch 'origin/feature/yc-mobile_maimai-0525' into feature/yc-mobile_maimai-0525

yangc 7 жил өмнө
parent
commit
6f28bd3a0f

+ 1 - 2
assets/scss/mobileCommon.scss

@@ -342,7 +342,7 @@ html {
 /*空状态*/
 .com-none-state{
   text-align: center;
-  padding:1.5rem 0;
+  padding: .6rem 0;
   background: #fff;
   margin-top:.1rem;
   width:100%;
@@ -354,7 +354,6 @@ html {
   p {
     font-size: .32rem;
     color: #999;
-    margin: 1.19rem 0 0 0;
   }
   a {
     display: block;

+ 126 - 0
components/home/displayCard.vue

@@ -0,0 +1,126 @@
+<template>
+  <div class="display-card">
+    <span @click="cardClose" v-if="cardShow" class="cardClose"><img src="/images/all/close.png"></span>
+     <div class="content" v-if="cardShow">
+       <div>
+         <count-box></count-box>
+       </div>
+       <div>
+         <p><span>{{all}}家</span></p>
+       </div>
+       <div>
+         <p v-if="payMoney"><span>{{payMoney}}</span><span v-if="isShow">亿</span><span v-if="isMore">万</span></p>
+         <p v-else><span>0</span></p>
+       </div>
+       <div>
+         <p v-if="allCount[1].count"><span>{{allCount[1].count}}条</span></p>
+         <p v-else><span>0</span></p>
+       </div>
+       <a class="enter" @click="onRegisterClick"><img src="/images/all/enter.png"></a>
+     </div>
+  </div>
+</template>
+<script>
+  import CountBox from '../main/count/Box.vue'
+  export default {
+    name: 'display-card',
+    data () {
+      return {
+        cardShow: true,
+        isShow: false,
+        isMore: false
+      }
+    },
+    components: {
+      CountBox
+    },
+    methods: {
+      cardClose () {
+        this.cardShow = false
+      },
+      formatNumber (num) {
+        if (num > 99999999) {
+          this.isShow = true
+          let str2 = num.toString()
+          num = Math.floor(num / 100000000)
+          if (parseInt(str2.charAt(str2.length - 8)) > 8) {
+            num = num + 1
+          }
+        }
+        if (num > 9999 && num < 99999999) {
+          this.isMore = true
+          let str = num.toString()
+          num = Math.floor(num / 10000)
+          if (parseInt(str.charAt(str.length - 4)) > 4) {
+            num = num + 1
+          }
+        }
+        return num
+      },
+      onRegisterClick () {
+        this.$http.get('/register/page').then(response => {
+          if (response.data) {
+            window.location.href = response.data.content
+          }
+        })
+      }
+    },
+    computed: {
+      allCount () {
+        return this.$store.state.count.allCount.data
+      },
+      payMoney () {
+        return this.formatNumber(this.allCount[0].count)
+      },
+      all () {
+        let count = this.$store.state.supplier.merchant.merchantAll.data
+        let supplierCount = count.content ? count.totalElements + '' : '0'
+        return supplierCount
+      }
+    }
+  }
+</script>
+<style lang="scss" scoped>
+  .display-card{
+    position: fixed;
+    right: 100px;
+    top: 115px;
+    width: 144px;
+    height: 527px;
+    z-index: 100;
+    .cardClose{
+      position: absolute;
+      right: 0px;
+      top: 0px;
+      opacity: 0.8;
+    }
+    .content{
+      margin-top: 10px;
+      width: 143px;
+      height: 517px;
+      background: url('/images/all/displayCard.png') no-repeat;
+      div{
+        height: 110px;
+        padding-top: 55px;
+        &:first-child{
+          height: 110px;
+          padding-top: 1px;
+        }
+        p{
+          width: 100%;
+          text-align: center;
+          font-size: 26px;
+          color: #fff;
+        }
+      }
+      .enter{
+        width: 100%;
+        display: inline-block;
+        position: absolute;
+        bottom: 48px;
+        left: -4px;
+        text-align: center;
+      }
+    }
+  }
+</style>

+ 2 - 1
components/home/index.js

@@ -1,8 +1,9 @@
 import KindCategory from './KindCategory.vue'
+import displayCard from './displayCard.vue'
 import Carousel from './Carousel.vue'
 import Advert from './Advert.vue'
 import FloorList from './floor/FloorList.vue'
 import Partner from './Partner.vue'
 import News from './News.vue'
 
-export { KindCategory, Carousel, Advert, FloorList, Partner, News }
+export { KindCategory, displayCard, Carousel, Advert, FloorList, Partner, News }

+ 2 - 2
components/main/Header.vue

@@ -15,9 +15,9 @@
         <search-box></search-box>
       </div>
       <!--统计-->
-      <div class="header-count pull-right">
+     <!-- <div class="header-count pull-right">
         <count-box></count-box>
-      </div>
+      </div>-->
     </div>
   </div>
 </template>

+ 3 - 6
components/main/count/Box.vue

@@ -52,17 +52,13 @@
   .count-box {
     position: relative;
     top: 20px;
-    float: right;
-    width: 210px;
-    height: 40px;
+    width: 136px;
+    height: 100px;
     margin-right: 65px;
     overflow: hidden;
     border-radius: 3px;
-    background: url("/images/all/count_bg.png") no-repeat;
-    /*background: #7299E8;*/
   .swiper-slide{
     width: 100%;
-    /*background: #83c5f8;*/
     border-radius: 3px;
   }
 
@@ -71,3 +67,4 @@
   }
   }
 </style>
+

+ 49 - 67
components/main/count/Item.vue

@@ -2,9 +2,7 @@
   <div class="count-item">
     <span class="title">{{ title }}</span>
     <div class="count-content">
-      <span v-for="(num, index) in nums" :class="num == ',' ? 'separator' : nums.length - len > index ? 'zero num' : 'num'">{{ num }}</span>
-      <!-- <span v-if="nums.length < 7">个</span>
-       <span v-if="nums.length > 7">万</span>-->
+      <span>{{ nums }}</span>
       <span v-text="isMore?'万':'个'" v-if="!isShow"></span>
       <span v-if="isShow">亿</span>
     </div>
@@ -31,7 +29,7 @@
     },
     methods: {
       formatNumber (num) {
-        let re = /(\d+)(\d{3})/
+//        let re = /(\d+)(\d{3})/
         if (num > 99999999) {
           this.isShow = true
           let str2 = num.toString()
@@ -51,10 +49,10 @@
         let length = String(num).length
         this.len = length > 3 ? length + 1 : length
         num = (Array(7 - length).join(0) + num)
-        while (re.test(num)) {
-          num = num.replace(re, '$1,$2')
-        }
-        num = num.split('')
+//        while (re.test(num)) {
+//          num = num.replace(re, '$1,$2')
+//        }
+//        num = num.split('')
 //        console.log(num)
         return num
       }
@@ -70,64 +68,48 @@
   @import '~assets/scss/variables';
 
   .count-item {
-    text-align: center;
-    line-height: 20px;
-
-  .title {
-    display: inline-block;
-    width: 55px;
-    float: left;
-    font-weight: bold;
-    line-height: 40px;
-    color: #fff;
-    font-size: 14px;
-  }
-  .separator, .num {
-    display: inline-block;
-  }
-  .separator {
-    font-size: 12px;
-    color: #7299E8;
-    line-height: 38px !important;
-    margin: 0 5px 0 -5px;
-    width: 3px;
-  }
-  .count-content{
-    width: 150px;
-    /*background: #fff;*/
-    float: right;
-    height: 30px;
-    margin-top: 5px;
-    padding-left: 3px;
-    margin-right: 5px;
-  span{
-    float: left;
-    line-height: 24px;
-    font-weight: bold;
-  }
-  span.zero{
-    color: #9EBCF7;
-  }
-  span:first-child{
-    margin-left: 3px;
-  }
-  span:last-child{
-    line-height: 30px;
-    color: #7299E8;
-    margin-left: 2px;
-  }
-  }
-  .num {
-    background: #7299E8;
-    width: 18px;
-    height: 24px;
-    margin-right: 2px;
-    line-height: 24px;
-    text-align: center;
-    color: $white;
-    font-weight: bold;
-    border-radius: 2px;
-    margin-top: 3px;
-  }
+    width: 100%;
+    height: auto;
+    .title {
+      display: inline-block;
+      width: 100%;
+      text-align: center;
+      line-height: 40px;
+      color: #fff000;
+      font-size: 21px;
+      font-family: MicrosoftYaHei-Bold;
+    }
+    .count-content{
+      width: 100%;
+      height: 40px;
+      margin-top: -5px;
+      background: url('/images/all/count1.png') no-repeat center;
+      span:first-child{
+        position: relative;
+        top: 11px;
+        left: 14px;
+        display: block;
+        text-align: center;
+        width: 87px;
+        height: 23px;
+        line-height: 23px;
+        font-family: MicrosoftYaHei-Bold;
+        font-size: 21px;
+        color: #fff;
+        background-color: #376ef3;
+        border-radius: 2px;
+      }
+      span:last-child{
+        position: relative;
+        top: -17px;
+        right: 15px;
+        float: right;
+        line-height: 30px;
+        font-size: 16px;
+        color: #376ef3;
+        font-family: MicrosoftYaHei-Bold;
+      }
+    }
   }
 </style>
+

+ 19 - 7
components/mobile/store/StoreDetail.vue

@@ -10,7 +10,16 @@
       <span :class="activeType=='product'?'mobile-switch-btn active':'mobile-switch-btn'" @click="activeType='product'">产品</span>
       <span :class="activeType=='detail'?'mobile-switch-btn active':'mobile-switch-btn'" @click="activeType='detail'">介绍</span>
     </div>
-    <div class="store-info" v-if="activeType=='detail' && store.description && store.description.length">
+    <div class="store-info" v-if="activeType=='detail'">
+      <div class="store-description">
+        <h4>主营产品</h4>
+        <p class="content" v-if="store.description">
+          {{store.description}}
+        </p>
+        <div class="com-none-state" v-else>
+          <p>抱歉,暂无企业简介</p>
+        </div>
+      </div>
      <div class="contact-info">
       <h4>联系我们</h4>
       <ul class="list-unstyled clearfix">
@@ -48,16 +57,19 @@
      </div>
       <div class="store-description">
         <h4>企业简介</h4>
-        <p>
+        <p class="content" v-if="store.description">
           {{store.description}}
         </p>
+        <div class="com-none-state" v-else>
+          <p>抱歉,暂无企业简介</p>
+        </div>
       </div>
     </div>
-    <div class="com-none-state" v-if="activeType=='detail' && (!store.description || !store.description.length)">
+  <!--  <div class="com-none-state" v-if="activeType=='detail'">
       <img src="/images/mobile/@2x/empty-collect.png">
       <p>抱歉,暂无店铺简介</p>
       <nuxt-link to="/">返回首页</nuxt-link>
-    </div>
+    </div>-->
     <div class="product-store" v-if="activeType == 'product'">
       <table v-if="commodities.content&&commodities.content.length > 0">
         <thead id="product-head" >
@@ -407,17 +419,17 @@
         width: 6.96rem;
         margin: .2rem auto;
         border-radius: .1rem;
-        p {
+        .content {
           text-indent:2em;
           background: #fff;
           margin: .2rem auto 0;
-          padding: .04rem .34rem;
+          padding: .04rem .34rem .4rem .34rem;
           width: 100%;
           font-size: .28rem;
           color: #666;
           text-align: left;
           height: 95%;
-          box-shadow: 0 .03rem .01rem 0 #cdcbcb96;
+          /*box-shadow: 0 .03rem .01rem 0 #cdcbcb96;*/
           line-height: .5rem;
           word-break: break-all;
         }

+ 5 - 1
pages/index.vue

@@ -8,6 +8,7 @@
      <!-- <new-year></new-year>-->
       <carousel>
         <kind-category @loadchild="loadProductKinds"></kind-category>
+        <display-card></display-card>
       </carousel>
       <advert></advert>
       <floor-list></floor-list>
@@ -18,7 +19,7 @@
   </div>
 </template>
 <script>
-  import { KindCategory, Carousel, Advert, FloorList, Partner, News } from '~components/home'
+  import { KindCategory, displayCard, Carousel, Advert, FloorList, Partner, News } from '~components/home'
 //  import { Christmas, NewYear } from '~components/default'
   import { Home } from '~components/mobile'
 
@@ -61,6 +62,7 @@
     },
     components: {
       KindCategory,
+      displayCard,
       Carousel,
       Advert,
       FloorList,
@@ -76,6 +78,8 @@
         store.dispatch('loadBanners', {type: 'home'}),
         store.dispatch('loadProductKinds', { id: 0 }),
         store.dispatch('loadNewsSnapshot', { page: 1, pageSize: 10 }),
+        store.dispatch('supplier/loadVendorAll', {page: 1, size: 20}),
+        store.dispatch('loadAllCount', {_status: 'actived', usedFor: 'mall_home_banner'}),
         store.dispatch('loadBatchCommodities', {batchCodeList: store.state.option.url === 'http://www.usoftmall.com' ? [
           'BT2018013000000043',
           'BT2018013000000026',

BIN
static/images/all/close.png


BIN
static/images/all/count1.png


BIN
static/images/all/displayCard.png


BIN
static/images/all/enter.png


+ 19 - 0
store/count.js

@@ -0,0 +1,19 @@
+export const state = () => ({
+  allCount: {
+    fetching: false,
+    data: []
+  }
+})
+
+export const mutations = {
+  REQUEST_ALLCOUNT (state) {
+    state.allCount.fetching = true
+  },
+  GET_ALLCOUNT_FAILURE (state) {
+    state.allCount.fetching = false
+  },
+  GET_ALLCOUNT_SUCCESS (state, result) {
+    state.allCount.fetching = false
+    state.allCount.data = result
+  }
+}

+ 8 - 10
store/index.js

@@ -437,16 +437,14 @@ export const actions = {
         commit('option/REQUEST_STORE_STATUS_FAILURE', err)
       })
   },
-
-  // 保存微信信息
-  GerWechatInfo({ commit }, params = {}) {
-    commit('option/REQUEST_WECHATINFO_STATUS')
-    return axios.get('/wx/getWxUserInfo', { params: params })
-      .then(response => {
-        commit('option/REQUEST_WECHATINFO_STATUS_SUCCESS', response.data)
-        localStorage.setItem('USOFTMALLWECHATINFO', JSON.stringify(response.data))
-      }, err => {
-        commit('option/REQUEST_WECHATINFO_STATUS_FAILURE', err)
+  // 获取首页悬浮计数器
+  loadAllCount ({commit}, params) {
+    commit('count/REQUEST_ALLCOUNT')
+    return axios.get('/api/product/commoncount', {params})
+      .then(res => {
+        commit('count/GET_ALLCOUNT_SUCCESS', res.data)
+      }, (err) => {
+        commit('count/GET_ALLCOUNT_FAILURE', err)
       })
   }
 }