Browse Source

修正产品详情页

shenjj 7 years ago
parent
commit
eaf1aa6a6a

+ 6 - 13
components/mobile/applyPurchase/SayPrice.vue

@@ -95,18 +95,10 @@
     watch: {
       showSayPriceBox: function (val, old) {
          if (val) {
-//           document.body.style.position = 'fixed'
-//           document.body.style.left = '0'
-//           document.body.style.right = '0'
-//           document.documentElement.style['overflow'] = 'hidden'
-//           document.body.style.overflow = 'hidden'
-//           document.documentElement.addEventListener('touchmove', function(event) {
-//             event.preventDefault()
-//           }, false)
-         } else {
-//          document.body.style.position = 'static'
-//           document.documentElement.style['overflow'] = 'auto'
-//           document.body.style.overflow = 'auto'
+           this.$nextTick(() => {
+             this._initscroll()
+             this.initSctoll.scrollTo(0, 0, 0)
+           })
          }
         this.resetSayPrice()
       }
@@ -329,9 +321,10 @@
         overflow: hidden;
         height: 90%;
         .form-list {
-          height: 7.53rem;
+          /*height: 7.53rem;*/
           background: #fff;
           padding-top: .2rem;
+          padding-bottom: 0.4rem;
           > div {
             height: .7rem;
             line-height: .7rem;

+ 1 - 0
pages/mobile/applyPurchase/list/businessOpportunity.vue

@@ -51,6 +51,7 @@
     },
     mounted: function () {
       this.$nextTick(() => {
+        localStorage.removeItem('RETURNURL')
         window.addEventListener('scroll', this.scroll, false)
       })
     },

+ 249 - 0
pages/mobile/center/vendor/attentionBus.vue

@@ -0,0 +1,249 @@
+<template>
+    <div class="attention-bus-wrap" id="attention-bus-wrap">
+      <div class="product-switch-item">
+        <span :class="activeType==='attention'?'mobile-switch-btn active':'mobile-switch-btn'" @click="ChangeTab('attention')">已关注</span>
+        <span :class="activeType==='isattention'?'mobile-switch-btn active':'mobile-switch-btn'" @click="ChangeTab('isattention')">未关注</span>
+      </div>
+      <div class="search-content" style="padding-bottom: 0.25rem">
+        <input type="text" placeholder="请输入您要查找的品牌或型号" v-model="keyword" @keyup.13="searchSeek">
+        <span @click="searchSeek" >
+          <i class="iconfont icon-sousuo"></i>
+          </span>
+      </div>
+      <div class="attention-bus-list">
+        <ul>
+          <li v-for="item in attentionList">
+            <div class="item">
+              <div class="name">
+                {{ item.nameCn | filterStr}}
+              </div>
+              <div class="attention-button" @click="attentionFn(item)">
+                <i class="iconfont icon-shoucang" :class="{'active': item.status}"></i>
+                <p v-if="item.status === 1">取消关注</p>
+                <p v-else>关注</p>
+              </div>
+            </div>
+          </li>
+        </ul>
+      </div>
+      <div class="fixedAlert" v-show="isShowAlert">
+        关注类目,商机无限!
+        <i class="iconfont icon-guanbi" @click="isShowAlert = false"></i>
+      </div>
+      <remind-box :title="collectResult" :timeoutCount="timeoutCount"></remind-box>
+      <pull-up :fixId="'attention-bus-wrap'" :searchMore="isSearchSearchingMore" :allPage="allPage" :page="page" @pullUpAction="getMoreSearch"></pull-up>
+    </div>
+</template>
+<script>
+    import { RemindBox, PullUp } from '~components/mobile/common'
+    export default {
+      name: 'attention-Bus',
+      layout: 'mobile',
+      middleware: 'authenticated',
+      fetch({store}) {
+        return Promise.all([
+          store.dispatch('product/getUserCollectCode', {keyword: '', count: 10, page: 1, type: 'yes', enUU: store.state.option.user.data.enterprise.uu})
+        ])
+      },
+      data() {
+        return {
+          activeType: 'attention',
+          keyword: '',
+          collectResult: '',
+          timeoutCount: 0,
+          page: 1,
+          attentionList: [],
+          isShowAlert: true,
+          isSearchSearchingMore: false
+        }
+      },
+      watch: {
+        'getkindConcernList.data': {
+          handler: function (val) {
+            if (this.isChange) {
+              this.attentionList = val.content
+              this.isChange = false
+            } else {
+              this.attentionList = [...this.attentionList, ...val.content]
+            }
+            this.isSearchSearchingMore = false
+          },
+          immediate: true
+        }
+      },
+      computed: {
+        allPage() {
+          return Math.ceil(this.$store.state.product.component.collectCode.data.totalElements / 10)
+        },
+        getkindConcernList() {
+          return this.$store.state.product.component.collectCode
+        }
+      },
+      methods: {
+        ChangeTab(a) {
+          this.activeType = a
+          this.attentionList = []
+          this.page = 1
+          this.getAttentionListArray(this.page)
+        },
+        searchSeek() {
+          this.page = 0
+          this.attentionList = []
+          this.getMoreSearch()
+        },
+        attentionFn(item) {
+          if (item.status === 1) {
+            this.$http.post('/kind/concern', {kindConcern: item, type: 'del'}).then(res => {
+              this.collectResult = '取消成功'
+              this.timeoutCount++
+            })
+          } else {
+            this.$http.post('/kind/concern', {indConcern: item, type: 'add'}).then(res => {
+              this.collectResult = '关注成功'
+              this.timeoutCount++
+            })
+          }
+        },
+        getAttentionListArray(page) {
+          this.isSearchSearchingMore = true
+          if (this.activeType === 'attention') {
+            this.$store.dispatch('product/getUserCollectCode', {keyword: this.keyword, count: 10, page: page, type: 'yes', enUU: this.$store.state.option.user.data.enterprise.uu})
+          } else {
+            this.$store.dispatch('product/getUserCollectCode', {keyword: this.keyword, count: 10, page: page, type: 'no', enUU: this.$store.state.option.user.data.enterprise.uu})
+          }
+        },
+        getMoreSearch() {
+          this.page++
+          this.getAttentionListArray(this.page)
+        }
+      },
+      components: {
+        RemindBox,
+        PullUp
+      },
+      filters: {
+        filterStr(val) {
+          if (val.length > 30) {
+            return val.substr(0, 30) + '...'
+          }
+          return val
+        }
+      }
+    }
+</script>
+<style scoped lang='scss'>
+  .attention-bus-wrap {
+    background: #f1f3f6;
+    margin: 1.26rem 0 0.98rem 0;
+    height: calc(100vh - 1.26rem - 0.98rem);
+    overflow-y: auto;
+    padding-bottom: 0.2rem;
+    .product-switch-item {
+      text-align: center;
+      background: #fff;
+      border-bottom: 1px solid #d8d8d8;
+      box-shadow: 0 1px 3px #ddd;
+      .mobile-switch-btn {
+        background: #fff;
+        color: #333;
+        display: inline-block;
+        height: .72rem;
+        line-height: .72rem;
+        font-size: .28rem;
+        width: 1.4rem;
+        &:first-child {
+          margin-right: 1.78rem;
+        }
+        &.active {
+          color: #3f84f6;
+          border-bottom: .04rem solid #3f84f6;
+        }
+      }
+    }
+    .search-content {
+      text-align: center;
+      padding: .25rem 0 0 0;
+      input {
+        width: 7.1rem;
+        border: 1px solid #376ff3;
+      }
+      span {
+        height: .46rem;
+        line-height: .46rem;
+      }
+    }
+    .attention-bus-list {
+      border: 0.01rem solid #e3e5e8;
+      border-radius: 4px;
+      background: #fff;
+      width: 7.1rem;
+      margin: 0 auto;
+      ul {
+        li {
+          display: table;
+          border-bottom: 1px solid #d3d3d3;
+          margin: 0 0.24rem;
+          height: 1.1rem;
+          &:nth-last-of-type(1) {
+            border-bottom: 0;
+          }
+          div {
+            display: table-cell;
+            vertical-align: middle;
+            position: relative;
+            word-wrap: break-word;
+            &.name {
+              font-size: 0.28rem;
+              color: #666;
+              width: 5.48rem;
+              overflow : hidden;
+            }
+            &.attention-button {
+              width: 1.2rem;
+              font-size: 0.24rem;
+              color: #666;
+              text-align: center;
+              .icon-shoucang {
+                &.active {
+                  color: #ff7800
+                }
+                color: #dadada;
+                font-size: 0.5rem;
+              }
+            }
+          }
+        }
+      }
+    }
+    .fixedAlert {
+      position: fixed;
+      z-index: 11;
+      width: 4.91rem;
+      height: 0.7rem;
+      line-height:0.7rem;
+      left: 50%;
+      margin-left: -2.455rem;
+      background: rgba(82, 147, 255, 0.9);
+      border-radius: 0.7rem;
+      font-size: 0.32rem;
+      color: #fff;
+      text-align: center;
+      top: 2.6rem;
+      i {
+        font-size: 0.4rem;
+        position: absolute;
+        right: -0.15rem;
+        top: -0.28rem;
+        color: rgba(61, 61, 61, 0.76);
+        &:after {
+          position: absolute;
+          top: -0.1rem;
+          right: -0.1rem;
+          left: -0.1rem;
+          bottom: -0.1rem;
+          content: ' ';
+        }
+      }
+    }
+  }
+</style>

+ 4 - 0
pages/mobile/center/vendor/index.vue

@@ -37,6 +37,10 @@
             <img src="/images/mobile/center/vendor/seek-done.png" alt="">
             <p>已报价</p>
           </nuxt-link>
+          <nuxt-link to="/mobile/center/vendor/attentionBus" tag="li">
+            <img src="/images/mobile/center/vendor/attention-bu.png" alt="">
+            <p>商机关注</p>
+          </nuxt-link>
         </ul>
       </div>
       <div class="block-wrap collect-block">

+ 3 - 1
pages/mobile/wechat/index.vue

@@ -81,7 +81,9 @@
     },
     mounted() {
       let info = localStorage.getItem('USOFTMALLWECHATINFO')
-      localStorage.setItem('RETURNURL', this.$route.query.url || '')
+      if (this.$route.query.url) {
+        localStorage.setItem('RETURNURL', this.$route.query.url || '')
+      }
       if (!info && !this.$route.query.code) {
         window.location.href = `https://open.weixin.qq.com/connect/oauth2/authorize?appid=wxb3274b676737a319&redirect_uri=https://www.usoftmall.com/mobile/wechat&response_type=code&scope=snsapi_userinfo&state=STATE#wechat_redirect`
       } else if (info) {

BIN
static/images/mobile/center/vendor/attention-bu.png


+ 10 - 0
store/product.js

@@ -185,5 +185,15 @@ export const actions = {
       }, err => {
         commit('component/REQUEST_COLLECT_FAILURE', err)
       })
+  },
+  // 获取用户收藏类目数据
+  getUserCollectCode({ commit }, params = {}) {
+    commit('component/REQUEST_COLLECTCODE')
+    return axios.get('/kind/concern/list', { params: params })
+      .then(response => {
+        commit('component/REQUEST_COLLECTCODE_SUCCESS', response.data)
+      }, err => {
+        commit('component/REQUEST_COLLECTCODE_FAILURE', err)
+      })
   }
 }

+ 15 - 0
store/product/component.js

@@ -6,6 +6,11 @@ export const state = () => ({
   collectCount: {
     fetching: false,
     data: []
+  },
+  collectCode: {
+    // 类目关注
+    fetching: false,
+    data: []
   }
 })
 
@@ -29,5 +34,15 @@ export const mutations = {
   },
   REQUEST_COLLECT_FAILURE (state) {
     state.fetching = false
+  },
+  REQUEST_COLLECTCODE (state) {
+    state.collectCode.fetching = true
+  },
+  REQUEST_COLLECTCODE_SUCCESS (state, result) {
+    state.collectCode.fetching = false
+    state.collectCode.data = result
+  },
+  REQUEST_COLLECTCODE_FAILURE (state) {
+    state.collectCode = false
   }
 }