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

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

gaoxm 7 жил өмнө
parent
commit
05b1743bc7

+ 6 - 0
assets/scss/common.scss

@@ -735,3 +735,9 @@ img.new-animate{
   display: inline-block;
   vertical-align: middle;
 }
+
+.text-ellipse {
+  overflow: hidden;
+  text-overflow: ellipsis;
+  white-space: nowrap;
+}

+ 19 - 7
components/mobile/Home.vue

@@ -68,7 +68,7 @@
     </div>
     <main-search v-if="showMainSearch" @cancelSearchAction="onCancelSearch"></main-search>
     <remind-box :title="remindText" :timeoutCount="timeoutCount"></remind-box>
-    <login-box @onLoginBoxClose="showLoginBox = false" v-if="showLoginBox"></login-box>
+    <login-box @onLoginBoxClose="showLoginBox = false" v-if="showLoginBox" :url="url"></login-box>
   </div>
 </template>
 <script>
@@ -102,7 +102,8 @@
         size: 5,
         purchaseManListData: [],
         isChange: false,
-        isDataChange: false
+        isDataChange: false,
+        url: ''
       }
     },
     components: {
@@ -111,11 +112,6 @@
       RemindBox,
       LoginBox
     },
-    mounted: function () {
-      this.$nextTick(() => {
-        window.addEventListener('scroll', this.scroll, false)
-      })
-    },
     watch: {
       '$store.state.applyPurchase.purchaseManList.purchaseHomeList.data': {
         handler: function (val) {
@@ -168,6 +164,7 @@
             this.onRemind('抱歉,您暂未开通卖家中心,可前往PC端开通')
           }
         } else {
+          this.url = '/mobile/applyPurchase/list/businessOpportunity'
           this.showLoginBox = true
         }
       },
@@ -183,6 +180,21 @@
         this.isSearchSearchingMore = true
         this.reloadData()
       }
+    },
+    mounted() {
+      this.$nextTick(() => {
+        window.addEventListener('scroll', this.scroll, false)
+        if (this.$route.query.code) {
+          let ua = window.navigator.userAgent.toLowerCase()
+          if (ua.match(/micromessenger/i)[0] === 'micromessenger') {
+            let info = localStorage.getItem('USOFTMALLWECHATINFO')
+            if (info) {
+              this.$store.commit('option/REQUEST_WECHATINFO_STATUS_SUCCESS', JSON.parse(info))
+            }
+            this.$store.dispatch('GerWechatInfo', {code: this.$route.query.code})
+          }
+        }
+      })
     }
   }
 </script>

+ 5 - 12
components/mobile/MobileFooter.vue

@@ -34,7 +34,7 @@
       </a>
     </span>
     <a @click="toTop" v-show="!hideToTop"><i class="iconfont icon-arrow-up icon-xlg"></i></a>
-    <login-box @onLoginBoxClose="showLoginBox = false" v-if="showLoginBox"></login-box>
+    <login-box :url="url" @onLoginBoxClose="showLoginBox = false" v-if="showLoginBox"></login-box>
     <!--<publish-seek :showSayPriceBox="showSayPriceBox" @cancelAction="showSayPriceBox = false" @reloadAction="onReload" @remindAction="onRemind"></publish-seek>-->
     <remind-box :title="remindText" :timeoutCount="timeoutCount"></remind-box>
   </div>
@@ -52,7 +52,8 @@
         showLoginBox: false,
 //        showSayPriceBox: false,
         remindText: '',
-        timeoutCount: 0
+        timeoutCount: 0,
+        url: ''
       }
     },
     components: {
@@ -102,6 +103,7 @@
         scrollTo('body', 300)
       },
       goWithLogin: function (url, isSelf) { // 是否拦截个人
+        this.url = url
         if (this.user.logged) {
           if (isSelf && (!this.user.data.enterprise.uu || this.user.data.enterprise.isVendor !== 313)) {
             this.onRemind('请先前往pc端开通卖家中心')
@@ -109,15 +111,6 @@
             this.$router.push(url)
           }
         } else {
-          let ua = window.navigator.userAgent.toLowerCase()
-          if (ua.match(/micromessenger/i) && ua.match(/micromessenger/i)[0] === 'micromessenger') {
-            if (this.$store.state.option.wechatInfo.data.status === 0) {
-              this.$router.push('/mobile/wechat')
-            } else {
-              // 发送请求
-              console.log('发送请求')
-            }
-          } else {
             this.showLoginBox = true
           }
         }
@@ -142,7 +135,7 @@
         this.timeoutCount ++
       }
     }
-  }
+
 </script>
 <style scoped lang="scss">
   .mobile-footer{

+ 11 - 4
components/mobile/applyPurchase/SayPrice.vue

@@ -93,11 +93,18 @@
     watch: {
       showSayPriceBox: function (val, old) {
          if (val) {
-           document.body.style.position = 'fixed'
-           document.body.style.left = '0'
-           document.body.style.right = '0'
+//           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.body.style.position = 'static'
+//           document.documentElement.style['overflow'] = 'auto'
+//           document.body.style.overflow = 'auto'
          }
         this.resetSayPrice()
       }

+ 4 - 2
components/mobile/applyPurchase/SeekList.vue

@@ -51,7 +51,7 @@
       </li>
     </ul>
     <empty-status v-if="!purchaseManListData || purchaseManListData.length == 0 && !isDataChange" :type="isSearch ? 'search' : 'collect'" :text="isSearch ? `抱歉,暂无与“${keyword}”匹配的求购信息` : '抱歉,暂无求购信息'" :showLink="true"></empty-status>
-    <login-box @onLoginBoxClose="showLoginBox = false" v-if="showLoginBox"></login-box>
+    <login-box :url="url" @onLoginBoxClose="showLoginBox = false" v-if="showLoginBox"></login-box>
     <say-price :showSayPriceBox="showSayPriceBox" @cancelSayPriceAction="onSayPriceCancel"></say-price>
     <say-price-info v-if="showSayPriceInfoBox" :agreed="agreed" @cancelSayPriceInfoAction="onSayPriceInfoCancel" :userType="userType"></say-price-info>
     <remind-box :title="remindText" :timeoutCount="timeoutCount"></remind-box>
@@ -70,7 +70,8 @@ export default {
       remindText: '',
       timeoutCount: 0,
       agreed: 0,
-      purchaseManListData: []
+      purchaseManListData: [],
+      url: ''
     }
   },
   components: {
@@ -156,6 +157,7 @@ export default {
           this.onRemind('个人账户暂不可报价')
         }
       } else {
+        this.url = this.$route.fullPath
         this.showLoginBox = true
       }
       return false

+ 126 - 0
components/mobile/base/SearchHeader.vue

@@ -0,0 +1,126 @@
+<template>
+  <div class="search-content com-mobile-header">
+    <a @click="goLastPage"><i class="iconfont icon-fanhui"></i></a>
+    <input type="text" v-model="keyword" @input="getSimilarList()" :placeholder="placeholder" @keyup.13="onSearch">
+    <span @click="onSearch()"><i class="iconfont icon-sousuo"></i></span>
+    <ul v-if="type == 'supplier' && keyword && keyword !== '' && showSimilarWord">
+      <template v-if="similarList.pCmpCode && similarList.pCmpCode.length">
+        <li class="title text-ellipse">型号</li>
+        <li class="text-ellipse" v-for="code in similarList.pCmpCode.slice(0, 4)" @click="onSearch(code.pCmpCode, 'pCmpCode', $event)">{{code.pCmpCode}}</li>
+      </template>
+      <template v-if="similarList.pBrandEn && similarList.pBrandEn.length">
+        <li class="title text-ellipse">品牌</li>
+        <li class="text-ellipse" v-for="brand in similarList.pBrandEn.slice(0, 4)" @click="onSearch(brand.nameCn, 'pBrandEn', $event)">{{brand.nameCn}}</li>
+      </template>
+      <template v-if="similarList.kind && similarList.kind.length">
+        <li class="title text-ellipse">类目</li>
+        <li class="text-ellipse" v-for="kind in similarList.kind.slice(0, 4)" @click="onSearch(kind.kind, 'kind', $event)">{{kind.kind}}</li>
+      </template>
+    </ul>
+    <ul v-if="type == 'default' && keyword && keyword !== '' && showSimilarWord">
+      <template v-if="similarList.component && similarList.component.length">
+        <li class="title text-ellipse">型号</li>
+        <li class="text-ellipse" v-for="code in similarList.component.slice(0, 4)" @click="onSearch(code.code, 'code', $event)">{{code.code}}</li>
+      </template>
+      <template v-if="similarList.brand && similarList.brand.length">
+        <li class="title text-ellipse">品牌</li>
+        <li class="text-ellipse" v-for="brand in similarList.brand.slice(0, 4)" @click="onSearch(brand.nameCn, 'brand', $event)">{{brand.nameCn}}</li>
+      </template>
+      <template v-if="similarList.kind && similarList.kind.length">
+        <li class="title text-ellipse">类目</li>
+        <li class="text-ellipse" v-for="kind in similarList.kind.slice(0, 4)" @click="onSearch(kind.nameCn, 'kind', $event)">{{kind.nameCn}}</li>
+      </template>
+    </ul>
+  </div>
+</template>
+<script>
+  export default {
+    props: {
+      placeholder: {
+        type: String,
+        default: '请输入要查找的内容'
+      },
+      similarUrl: {
+        type: String,
+        default: '/search/similarKeywords'
+      },
+      type: {
+        type: String,
+        default: 'default'
+      }
+    },
+    data () {
+      return {
+        keyword: '',
+        similarList: {},
+        showSimilarWord: false
+      }
+    },
+    mounted () {
+      this.$nextTick(() => {
+        document.onclick = () => {
+          this.showSimilarWord = false
+        }
+      })
+    },
+    methods: {
+      onSearch: function (key, type, e) {
+        if (e) {
+          e.stopPropagation()
+        }
+        if (key) {
+          this.keyword = key
+          this.$emit('searchAction', {
+            keyword: this.keyword,
+            type: type
+          })
+        } else {
+          this.$emit('searchAction', {
+            keyword: this.keyword
+          })
+        }
+        this.showSimilarWord = false
+      },
+      getSimilarList: function () {
+        if (this.keyword && this.keyword !== '') {
+          this.$http.get(this.similarUrl, {params: {keyword: this.keyword}}).then(
+            res => {
+              this.similarList = res.data
+              this.showSimilarWord = true
+            }
+          )
+        }
+      }
+    }
+  }
+</script>
+<style lang="scss" scoped>
+  .search-content {
+    color: #333;
+    input {
+      margin: 0 0 0 .5rem;
+      line-height: normal;
+    }
+    ul {
+      width: 6.48rem;
+      background: #fff;
+      position: absolute;
+      left: .6rem;
+      top: .72rem;
+      border: 1px solid #ccc;
+      border-radius: .05rem;
+      li {
+        height: .6rem;
+        line-height: .6rem;
+        padding: 0 .1rem;
+        font-size: .26rem;
+        &.title {
+          color: #666;
+          border-bottom: 1px solid #ddd;
+          font-weight: bold;
+          background: #f6f5f5;
+        }
+      }
+    }
+  }
+</style>

+ 3 - 0
components/mobile/base/index.js

@@ -0,0 +1,3 @@
+import SearchHeader from './SearchHeader.vue'
+
+export { SearchHeader }

+ 5 - 2
components/mobile/brand/ComponentDetail.vue

@@ -95,7 +95,7 @@
     </div>
     <remind-box :title="collectResult" :timeoutCount="timeoutCount"></remind-box>
     <loading v-show="isSearchingMore"></loading>
-    <login-box @onLoginBoxClose="showLoginBox = false" v-if="showLoginBox"></login-box>
+    <login-box @onLoginBoxClose="showLoginBox = false" v-if="showLoginBox" :url="url"></login-box>
   </div>
 </template>
 <script>
@@ -123,7 +123,8 @@
         isSearchingMore: false,
         searchLists: [],
         showLoginBox: false,
-        isScrollOverTab: false
+        isScrollOverTab: false,
+        url: ''
       }
     },
     components: {
@@ -263,6 +264,7 @@
             window.location.href = url
           }
         } else {
+          this.url = this.$route.fullPath
           this.showLoginBox = true
         }
       },
@@ -280,6 +282,7 @@
             })
           }
         } else {
+          this.url = this.$route.fullPath
           this.showLoginBox = true
         }
       }

+ 30 - 1
components/mobile/common/LoginBox.vue

@@ -1,5 +1,5 @@
 <template>
-  <div class="mobile-modal">
+  <div class="mobile-modal" v-show="showLogin" @touchmove="touchmove($event)">
     <div class="mobile-modal-box">
       <div class="mobile-modal-header">请登录后再操作<i @click="close" class="icon-guanbi iconfont"></i></div>
       <div class="mobile-modal-content">
@@ -12,7 +12,16 @@
 <script>
   export default {
     name: 'loginBox',
+    props: ['url'],
+    data() {
+      return {
+        showLogin: false
+      }
+    },
     methods: {
+      touchmove(e) {
+        e.preventDefault()
+      },
       close: function () {
         this.$emit('onLoginBoxClose')
       },
@@ -26,6 +35,26 @@
           }
         })
       }
+    },
+    mounted() {
+      // document.querySelector('html').addEventListener('touchmove', function(e) {
+      //   e.preventDefault()
+      // })
+      document.querySelector('.mobile-modal').addEventListener('touchmove', function(e) {
+        e.preventDefault()
+      })
+      let ua = window.navigator.userAgent.toLowerCase()
+      if (ua.match(/micromessenger/i) && ua.match(/micromessenger/i)[0] === 'micromessenger') {
+        if (this.url) {
+          this.$router.push(`/mobile/wechat?url=${this.url}`)
+        } else {
+          this.$router.push(`/mobile/wechat`)
+        }
+      } else {
+        // document.querySelector('html').style = 'overflow-y: hidden'
+        // document.querySelector('body').style = 'overflow-y: hidden'
+        this.showLogin = true
+      }
     }
   }
 </script>

+ 4 - 2
components/mobile/store/StoreDetail.vue

@@ -134,7 +134,7 @@
     </div>
     <remind-box :title="collectResult" :timeoutCount="timeoutCount"></remind-box>
     <loading v-show="isSearchingMore"></loading>
-    <login-box @onLoginBoxClose="showLoginBox = false" v-if="showLoginBox"></login-box>
+    <login-box @onLoginBoxClose="showLoginBox = false" v-if="showLoginBox" :url="url"></login-box>
   </div>
 </template>
 <script>
@@ -151,7 +151,8 @@
         searchLists: [],
         page: 1,
         showLoginBox: false,
-        isScrollOverTab: false
+        isScrollOverTab: false,
+        url: ''
       }
     },
     components: {
@@ -276,6 +277,7 @@
               })
           }
         } else {
+          this.url = this.$route.fullPath
           this.showLoginBox = true
         }
       }

+ 29 - 26
components/mobile/supplier/List.vue

@@ -1,32 +1,27 @@
 <template>
-  <div class="supplier-list mobile-content">
-    <div class="mobile-header">
-      <a @click="goLastPage"><i class="iconfont icon-fanhui"></i></a>
-      <div class="search-content">
-        <input type="text" v-model="keyword" placeholder="请输入您要查找的供应商" @keyup.13="search">
-        <span @click="search">
-        <i class="iconfont icon-sousuo"></i>
-        </span>
+  <div>
+    <search-header @searchAction="search" :similarUrl="similarUrl" :type="'supplier'" :placeholder="'可通过型号/品牌/类目/名称查找供应商'"></search-header>
+    <div class="supplier-list mobile-content">
+      <ul v-if="listData && listData.length">
+        <li v-for="item in listData" @click="goSupplierDetail(item)">
+          <img v-if="item.isStore == 1" class="open" src="/images/mobile/supplier/is-open.png" alt="">
+          <span>{{item.enName}}</span>
+          <!--<img class="tag" src="/images/mobile/supplier/tag.png" alt="">-->
+          <i class="tag iconfont icon-xiangyou"></i>
+        </li>
+      </ul>
+      <div class="com-none-state" v-else>
+        <img src="/images/mobile/@2x/search-empty.png">
+        <p>抱歉,暂无搜索结果</p>
+        <nuxt-link to="/">返回首页</nuxt-link>
       </div>
+      <remind-box :title="remindText" :timeoutCount="timeoutCount"></remind-box>
     </div>
-    <ul v-if="listData && listData.length">
-      <li v-for="item in listData" @click="goSupplierDetail(item)">
-        <img v-if="item.isStore == 1" class="open" src="/images/mobile/supplier/is-open.png" alt="">
-        <span>{{item.enName}}</span>
-        <!--<img class="tag" src="/images/mobile/supplier/tag.png" alt="">-->
-        <i class="tag iconfont icon-xiangyou"></i>
-      </li>
-    </ul>
-    <div class="com-none-state" v-else>
-      <img src="/images/mobile/@2x/search-empty.png">
-      <p>抱歉,暂无搜索结果</p>
-      <nuxt-link to="/">返回首页</nuxt-link>
-    </div>
-    <remind-box :title="remindText" :timeoutCount="timeoutCount"></remind-box>
   </div>
 </template>
 <script>
   import { RemindBox } from '~components/mobile/common'
+  import {SearchHeader} from '~components/mobile/base'
   export default {
     data () {
       return {
@@ -38,11 +33,14 @@
         isChange: false,
         isDataChange: false,
         remindText: '',
-        timeoutCount: 0
+        timeoutCount: 0,
+        similarUrl: '/search/product/similarKeywords',
+        field: null
       }
     },
     components: {
-      RemindBox
+      RemindBox,
+      SearchHeader
     },
     mounted: function () {
       this.$nextTick(() => {
@@ -90,9 +88,14 @@
         this.reloadData()
       },
       reloadData: function () {
-        this.$store.dispatch('supplier/getSupplierList', {keyword: this.keyword, page: this.page, size: this.size})
+        this.$store.dispatch('supplier/getSupplierList', {keyword: this.keyword, page: this.page, size: this.size, field: this.field})
       },
-      search: function () {
+      search: function (searchObj) {
+        if (searchObj) {
+          this.keyword = searchObj.keyword
+          console.log(searchObj)
+          this.field = searchObj.type || null
+        }
         this.page = 1
         this.isChange = true
         this.reloadData()

+ 4 - 2
components/mobile/supplier/SupplierDetail.vue

@@ -72,7 +72,7 @@
     </div>
     <publish-supplier-seek :product="currentProduct" :showPublishBox="showPublishBox" @cancelAction="showPublishBox = false" @remindAction="onRemind"></publish-supplier-seek>
     <remind-box :title="remindText" :timeoutCount="timeoutCount"></remind-box>
-    <login-box @onLoginBoxClose="showLoginBox = false" v-if="showLoginBox"></login-box>
+    <login-box :url="url" @onLoginBoxClose="showLoginBox = false" v-if="showLoginBox"></login-box>
   </div>
 </template>
 <script>
@@ -92,7 +92,8 @@
         remindText: '',
         timeoutCount: 0,
         currentProduct: {},
-        showLoginBox: false
+        showLoginBox: false,
+        url: ''
       }
     },
     components: {
@@ -161,6 +162,7 @@
           this.currentProduct = product
           this.showPublishBox = true
         } else {
+          this.url = this.$route.fullPath
           this.showLoginBox = true
         }
       },

+ 10 - 1
middleware/authenticated.js

@@ -2,6 +2,15 @@ export default function ({ isServer, store, req, redirect, route }) {
   // If nuxt generate, pass this middleware
   if (isServer && !req) return
   if (!store.state.option.user.logged) {
-    return redirect('/auth/login')
+    let ua = req.headers['user-agent'].toLowerCase()
+    if (ua.match(/micromessenger/i) && ua.match(/micromessenger/i)[0] === 'micromessenger' && req.url.indexOf('?code') === -1) {
+      // 判断是浏览器,切不存在code
+      return redirect(`/mobile/wechat/toggle?url=${route.path}`)
+    } else if (ua.match(/micromessenger/i) && ua.match(/micromessenger/i)[0] === 'micromessenger' && req.url.indexOf('?code') > -1) {
+      // 判断是浏览器,切不存在code
+      return redirect(`/mobile/wechat?url=${route.path}`)
+    } else {
+      return redirect(`/auth/login?returnUrl=${'http://' + req.headers.host + route.fullPath}`)
+    }
   }
 }

+ 10 - 0
middleware/wechatInfo.js

@@ -0,0 +1,10 @@
+export default function ({ isServer, store, req, redirect, route }) {
+  if (isServer && !req) return
+  if (!store.state.option.user.logged) {
+    let ua = store.state.option.userAgent.toLowerCase()
+    if (ua.match(/micromessenger/i) && ua.match(/micromessenger/i)[0] === 'micromessenger' && req.url.indexOf('?code') === -1) {
+      // 判断是浏览器,切不存在code
+      return redirect(`/mobile/wechat/toggle?url=${route.path}`)
+    }
+  }
+}

+ 1 - 14
pages/index.vue

@@ -25,6 +25,7 @@
 
   export default {
     name: 'index',
+    middleware: 'wechatInfo',
     layout (context) {
       return context.store.state.option.isMobile ? 'mobile' : 'main'
     },
@@ -121,20 +122,6 @@
         return this.$store.state.option.isMobile
       }
     },
-    mounted() {
-      this.$nextTick(() => {
-        if (this.$route.query.code) {
-          let ua = window.navigator.userAgent.toLowerCase()
-          if (ua.match(/micromessenger/i)[0] === 'micromessenger') {
-            let info = localStorage.getItem('USOFTMALLWECHATINFO')
-            if (info) {
-              this.$store.commit('option/REQUEST_WECHATINFO_STATUS_SUCCESS', JSON.parse(info))
-            }
-            this.$store.dispatch('GerWechatInfo', {code: this.$route.query.code})
-          }
-        }
-      })
-    },
     methods: {
       listenOpen () {
         this.isOpen = false

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

@@ -29,6 +29,7 @@
   import {Loading, EmptyStatus} from '~components/mobile/common'
   export default {
     layout: 'mobile',
+    middleware: 'authenticated',
     components: {
       SeekList,
       Loading,

+ 1 - 1
pages/mobile/center/user/index.vue

@@ -6,7 +6,7 @@
     </div>
     <div class="mobile-fix-content">
       <div class="seek-banner block-wrap">
-        <img src="/images/mobile/center/adv.png" alt="">
+        <img src="/images/mobile/center/user/adv.jpg" alt="">
       </div>
       <div class="block-wrap seek-operation">
         <p><i></i>我的求购</p>

+ 1 - 1
pages/mobile/center/vendor/index.vue

@@ -6,7 +6,7 @@
     </div>
     <div class="mobile-fix-content">
       <div class="seek-banner block-wrap">
-        <img src="/images/mobile/center/adv.png" alt="">
+        <img src="/images/mobile/center/vendor/adv.jpg" alt="">
       </div>
       <div class="block-wrap seek-operation">
         <p><i></i>产品管理</p>

+ 4 - 2
pages/mobile/search/_keycode.vue

@@ -49,7 +49,7 @@
     </div>
     <remind-box :title="collectResult" :timeoutCount="timeoutCount"></remind-box>
     <loading v-show="isSearchSearchingMore"></loading>
-    <login-box @onLoginBoxClose="showLoginBox = false" v-if="showLoginBox"></login-box>
+    <login-box @onLoginBoxClose="showLoginBox = false" v-if="showLoginBox" :url="url"></login-box>
   </div>
 </template>
 
@@ -74,7 +74,8 @@
         searchLists: [],
         isSearchSearchingMore: false,
         showLoginBox: false,
-        isChange: false
+        isChange: false,
+        url: ''
       }
     },
     components: {
@@ -184,6 +185,7 @@
             })
           }
         } else {
+          this.url = this.$route.fullPath
           this.showLoginBox = true
         }
       },

+ 83 - 61
pages/mobile/shop/index.vue

@@ -1,58 +1,62 @@
 <template>
-  <div class="shop mobile-content">
-    <div class="shop-top">
-      <p><i class="iconfont icon-dianpu1"></i><span>{{list.totalElements || 0}}</span>家店铺</p>
-      <span @click="onClick()">{{downName}} <i class="iconfont icon-arrow-down"></i></span>
-      <ul class="supdown" v-if="down">
-        <li @click="onDown('ORIGINAL_FACTORY-DISTRIBUTION-AGENCY-CONSIGNMENT')" v-show="downName !== '全部'">全部</li>
-        <li @click="onDown('ORIGINAL_FACTORY')" v-show="downName !== '原厂'">原厂</li>
-        <li @click="onDown('AGENCY')" v-show="downName !== '代理'">代理</li>
-        <li @click="onDown('DISTRIBUTION')" v-show="downName !== '经销'">经销</li>
-        <li @click="onDown('CONSIGNMENT')" v-show="downName !== '寄售'">寄售</li>
-      </ul>
-    </div>
-    <div v-if="searchLists && searchLists.length">
-      <div class="shop-list" v-for="item in searchLists" @click="goStoreDetail(item.uuid)">
-        <h3>{{item.storeName}}</h3>
-        <div class="list-item">
-          <div class="item-img">
-            <i :style="'background:url(' + isType(item.type) + ')no-repeat 0 0/.65rem .33rem;'"></i>
-            <img :src="item.logoUrl || '/images/component/default.png'">
-          </div>
-          <div class="list-item-phone">
-            <p>电话:<span>{{item.enterprise.enTel}}</span></p>
-            <p>传真:<span>{{item.enterprise.enFax}}</span></p>
-            <!--<p>商家介绍: <nuxt-link :to="'/mobile/merchantDescription/'+item.uuid">点击查看</nuxt-link></p>-->
-            <p>联系商家:<a @click="selectStoreInfo(item, $event)">点击查看</a></p>
-            <i class="iconfont icon-shoucang" :style="item.isFocus=='true'?'color:#ff7800':'color:#bbb'" @click="focusStore(item, $event)"></i>
+  <div>
+    <search-header @searchAction="onSearch" :placeholder="'可通过型号/品牌/类目/名称查找店铺'"></search-header>
+    <div class="shop mobile-content">
+      <div class="shop-top">
+        <p><i class="iconfont icon-dianpu1"></i><span>{{list.totalElements || 0}}</span>家店铺</p>
+        <span @click="onClick($event)">{{downName}} <i class="iconfont icon-arrow-down"></i></span>
+        <ul class="supdown" v-if="down">
+          <li @click="onDown('ORIGINAL_FACTORY-DISTRIBUTION-AGENCY-CONSIGNMENT', $event)" v-show="downName !== '全部'">全部</li>
+          <li @click="onDown('ORIGINAL_FACTORY', $event)" v-show="downName !== '原厂'">原厂</li>
+          <li @click="onDown('AGENCY', $event)" v-show="downName !== '代理'">代理</li>
+          <li @click="onDown('DISTRIBUTION', $event)" v-show="downName !== '经销'">经销</li>
+          <li @click="onDown('CONSIGNMENT', $event)" v-show="downName !== '寄售'">寄售</li>
+        </ul>
+      </div>
+      <div v-if="searchLists && searchLists.length">
+        <div class="shop-list" v-for="item in searchLists" @click="goStoreDetail(item.uuid)">
+          <h3>{{item.storeName}}</h3>
+          <div class="list-item">
+            <div class="item-img">
+              <i :style="'background:url(' + isType(item.type) + ')no-repeat 0 0/.65rem .33rem;'"></i>
+              <img :src="item.logoUrl || '/images/component/default.png'">
+            </div>
+            <div class="list-item-phone">
+              <p>电话:<span>{{item.enterprise.enTel}}</span></p>
+              <p>传真:<span>{{item.enterprise.enFax}}</span></p>
+              <!--<p>商家介绍: <nuxt-link :to="'/mobile/merchantDescription/'+item.uuid">点击查看</nuxt-link></p>-->
+              <p>联系商家:<a @click="selectStoreInfo(item, $event)">点击查看</a></p>
+              <i class="iconfont icon-shoucang" :style="item.isFocus=='true'?'color:#ff7800':'color:#bbb'" @click="focusStore(item, $event)"></i>
+            </div>
           </div>
         </div>
       </div>
-    </div>
-    <div class="com-none-state" v-else>
-      <img src="/images/mobile/@2x/search-empty.png">
-      <p>抱歉,暂无搜索结果</p>
-      <nuxt-link to="/">返回首页</nuxt-link>
-    </div>
-    <remind-box :title="collectResult" :timeoutCount="timeoutCount"></remind-box>
-    <loading v-show="isSearchingMore"></loading>
-    <div class="mobile-modal" v-if="showStoreInfo">
-      <div class="mobile-modal-box">
-        <div class="mobile-modal-header">联系方式<i @click="showStoreInfo = false" class="icon-guanbi iconfont"></i></div>
-        <div class="mobile-modal-content">
-          <div v-if="checkInfo(enterpriseInfo.enAddress || enterpriseInfo.address)">商家地址:{{enterpriseInfo.enAddress || enterpriseInfo.address}}</div>
-          <!--<div class="content-line link-url">在线咨询</div>-->
-          <div v-if="checkInfo(enterpriseInfo.enTel)">致电:<a :href="'tel:' + enterpriseInfo.enTel" target="_blank" class="content-line link-url">{{enterpriseInfo.enTel}}</a></div>
-          <div v-if="checkInfo(enterpriseInfo.enEmail)">邮件:<a :href="'mailto:' + enterpriseInfo.enEmail" target="_blank" class="content-line link-url">{{enterpriseInfo.enEmail}}</a></div>
+      <div class="com-none-state" v-else>
+        <img src="/images/mobile/@2x/search-empty.png">
+        <p>抱歉,暂无搜索结果</p>
+        <nuxt-link to="/">返回首页</nuxt-link>
+      </div>
+      <remind-box :title="collectResult" :timeoutCount="timeoutCount"></remind-box>
+      <loading v-show="isSearchingMore"></loading>
+      <div class="mobile-modal" v-if="showStoreInfo">
+        <div class="mobile-modal-box">
+          <div class="mobile-modal-header">联系方式<i @click="showStoreInfo = false" class="icon-guanbi iconfont"></i></div>
+          <div class="mobile-modal-content">
+            <div v-if="checkInfo(enterpriseInfo.enAddress || enterpriseInfo.address)">商家地址:{{enterpriseInfo.enAddress || enterpriseInfo.address}}</div>
+            <!--<div class="content-line link-url">在线咨询</div>-->
+            <div v-if="checkInfo(enterpriseInfo.enTel)">致电:<a :href="'tel:' + enterpriseInfo.enTel" target="_blank" class="content-line link-url">{{enterpriseInfo.enTel}}</a></div>
+            <div v-if="checkInfo(enterpriseInfo.enEmail)">邮件:<a :href="'mailto:' + enterpriseInfo.enEmail" target="_blank" class="content-line link-url">{{enterpriseInfo.enEmail}}</a></div>
+          </div>
         </div>
       </div>
+      <login-box @onLoginBoxClose="showLoginBox = false" v-if="showLoginBox" :url="url"></login-box>
     </div>
-    <login-box @onLoginBoxClose="showLoginBox = false" v-if="showLoginBox"></login-box>
   </div>
 </template>
 
 <script>
   import {RemindBox, Loading, LoginBox} from '~components/mobile/common'
+  import {SearchHeader} from '~components/mobile/base'
   export default {
     layout: 'mobileNoHeader',
     data () {
@@ -70,28 +74,31 @@
         isChange: false,
         showStoreInfo: false,
         enterpriseInfo: {},
-        showLoginBox: false
+        showLoginBox: false,
+        keyword: '',
+        url: ''
       }
     },
     components: {
       RemindBox,
       Loading,
-      LoginBox
-    },
-    watch: {
-      '$route.query.keyword': {
-        handler: function (val) {
-          this.isChange = true
-          this.page = 1
-          this.type = 'ORIGINAL_FACTORY-DISTRIBUTION-AGENCY-CONSIGNMENT'
-          this.$store.dispatch('provider/findStoreListInMobil', { page: this.page, count: this.count, types: this.types, keyword: this.$route.query.keyword || null })
-        },
-        immediate: false
-      }
+      LoginBox,
+      SearchHeader
     },
+//    watch: {
+//      '$route.query.keyword': {
+//        handler: function (val) {
+//          this.isChange = true
+//          this.page = 1
+//          this.type = 'ORIGINAL_FACTORY-DISTRIBUTION-AGENCY-CONSIGNMENT'
+//          this.$store.dispatch('provider/findStoreListInMobil', { page: this.page, count: this.count, type: this.types, keyword: this.keyword || null })
+//        },
+//        immediate: false
+//      }
+//    },
     fetch ({ store, query }) {
       return Promise.all([
-        store.dispatch('provider/findStoreListInMobil', { page: 1, count: 10, types: 'ORIGINAL_FACTORY-DISTRIBUTION-AGENCY-CONSIGNMENT', keyword: query.keyword || null })
+        store.dispatch('provider/findStoreListInMobil', { page: 1, count: 10, type: 'ORIGINAL_FACTORY-DISTRIBUTION-AGENCY-CONSIGNMENT' })
       ])
     },
     computed: {
@@ -120,6 +127,9 @@
         window.addEventListener('scroll', function () {
           _this.scroll()
         }, false)
+        document.body.onclick = () => {
+          this.down = false
+        }
       })
     },
     methods: {
@@ -133,7 +143,7 @@
         if (!this.isSearchingMore) {
           this.page++
           this.isSearchingMore = true
-          this.$store.dispatch('provider/findStoreListInMobil', { page: this.page, count: this.count, types: this.types, keyword: this.$route.query.keyword || null })
+          this.$store.dispatch('provider/findStoreListInMobil', { page: this.page, count: this.count, type: this.types, keyword: this.keyword || null })
         }
       },
       isType (type) {
@@ -149,10 +159,16 @@
         }
         return bgurl
       },
-      onClick () {
+      onClick (e) {
+        if (e) {
+          e.stopPropagation()
+        }
         this.down = !this.down
       },
-      onDown (type) {
+      onDown (type, e) {
+        if (e) {
+          e.stopPropagation()
+        }
         this.isChange = true
         this.down = !this.down
         this.types = type
@@ -167,7 +183,7 @@
         } else if (type === 'ORIGINAL_FACTORY-DISTRIBUTION-AGENCY-CONSIGNMENT') {
           this.downName = '全部'
         }
-        this.$store.dispatch('provider/findStoreListInMobil', { page: 1, count: 10, types: type, keyword: this.$route.query.keyword || null })
+        this.$store.dispatch('provider/findStoreListInMobil', { page: 1, count: 10, type: type, keyword: this.keyword || null })
       },
       focusStore: function (item, $event) {
 //        item.isFocus = item.isFocus === 'false' ? 'true' : 'false'
@@ -189,6 +205,7 @@
               })
           }
         } else {
+          this.url = this.$route.fullPath
           this.showLoginBox = true
         }
       },
@@ -202,6 +219,11 @@
       },
       checkInfo: function (str) {
         return str && str.trim() !== ''
+      },
+      onSearch: function (keyObj) {
+        this.keyword = keyObj.keyword
+        this.onDown('ORIGINAL_FACTORY-DISTRIBUTION-AGENCY-CONSIGNMENT')
+        this.down = false
       }
     }
   }

+ 1 - 1
pages/mobile/supplier/index.vue

@@ -4,7 +4,7 @@
 <script>
   import { List } from '~components/mobile/supplier'
   export default {
-    layout: 'mobile',
+    layout: 'mobileNoHeader',
     fetch ({ store }) {
       return Promise.all([
         store.dispatch('supplier/getSupplierList', {page: 1, size: 10})

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

@@ -37,11 +37,35 @@
       </nuxt-link>
     </div>
     <remind-box :title="collectResult" :timeoutCount="timeoutCount"></remind-box>
+    <div class="listAlert" ref="userContent" v-show="wechatInfo.enterprises">
+      <ul>
+        <li v-for="(item, index) in wechatInfo.enterprises" @click="clickItem(item)">
+          {{item.enName}}
+        </li>
+        <li @click="clickItem({uu: 0})">
+          <a>个人账户</a>
+        </li>
+      </ul>
+    </div>
   </div>
 </template>
 
 <script>
   import { RemindBox } from '~components/mobile/common'
+  import BScroll from 'better-scroll'
+  // 实现深拷贝
+  function deepCopy(target) {
+    if (typeof target !== 'object') return
+    // 判断目标类型,来创建返回值
+    var newObj = target instanceof Array ? [] : {}
+    for (var item in target) {
+      // 只复制元素自身的属性,不复制原型链上的
+      if (target.hasOwnProperty(item)) {
+        newObj[item] = typeof target[item] === 'object' ? deepCopy(target[item]) : target[item]
+      }
+    }
+    return newObj
+  }
   export default {
     name: 'wechatView',
     layout: 'mobileNoHeader',
@@ -56,10 +80,32 @@
        }
     },
     mounted() {
-      let info = localStorage.getItem('USOFTMALLWECHATINFO')
-      this.$store.commit('option/REQUEST_WECHATINFO_STATUS_SUCCESS', JSON.parse(info))
+      this.$nextTick(() => {
+        let info = localStorage.getItem('USOFTMALLWECHATINFO')
+        this.$store.commit('option/REQUEST_WECHATINFO_STATUS_SUCCESS', JSON.parse(info))
+        if (this.BScroll) {
+          this.BScroll.refresh()
+        } else {
+          this.BScroll = new BScroll(this.$refs.userContent, {
+            click: true
+          })
+        }
+      })
     },
     methods: {
+      clickItem(item) {
+        let userAccount = deepCopy(this.$store.state.option.wechatInfo.data.userAccount)
+        userAccount.spaceUU = item.uu
+        this.$http.get('/newLogin/other', {params: userAccount}).then(res => {
+          this.$store.dispatch('loadUserInfo').then(() => {
+             if (this.$route.query.url && this.$route.query.url !== '') {
+                this.$router.replace(this.$route.query.url)
+             } else {
+               this.goLastPage()
+             }
+          })
+        })
+      },
       telphoneBlur() {
         this.telerror = false
         if (!/^1[3|5|7|8]\d{9}$/.test(this.telphoneNum)) {
@@ -72,7 +118,8 @@
         }
         let openid = this.$store.state.option.wechatInfo.data.openid
         this.$http.post('/wx/bindUser', {userTel: this.telphoneNum, userPwd: this.passwordNum, openId: openid}).then(res => {
-          console.log(res)
+          this.$store.commit('option/REQUEST_WECHATINFO_STATUS_SUCCESS', res.data)
+          localStorage.setItem('USOFTMALLWECHATINFO', JSON.stringify(res.data))
         })
       },
       resgiter() {
@@ -88,10 +135,15 @@
     },
     computed: {
       userName() {
+        // return ''
         return this.$store.state.option.wechatInfo.data.nickname
       },
       headerImg() {
+        // return ''
         return this.$store.state.option.wechatInfo.data.headimgurl
+      },
+      wechatInfo() {
+        return this.$store.state.option.wechatInfo.data
       }
     }
   }
@@ -266,5 +318,21 @@
       }
     }
   }
+  .listAlert {
+    position: fixed;
+    top: 0;
+    left: 0;
+    right: 0;
+    bottom: 0;
+    background: #fff;
+    padding: 0 0.2rem;
+    overflow: hidden;
+    z-index: 10000;
+    li {
+      line-height: 0.98rem;
+      height: 0.98rem;
+      border-bottom: 1px solid #dedede;
+    }
+  }
 }
 </style>

+ 3 - 3
pages/mobile/wechat/toggle.vue

@@ -4,11 +4,11 @@
 
 <script>
   export default {
-    // name: 'wechattoggle',
-    // layout: 'mobileNoHeader',
+    layout: 'mobileNoHeader',
     mounted() {
       this.$nextTick(() => {
-        window.open('https://open.weixin.qq.com/connect/oauth2/authorize?appid=wxd29bbca61728b189&redirect_uri=http://wwpszp.natappfree.cc&response_type=code&scope=snsapi_userinfo&state=STATE#wechat_redirect')
+        // this.$route.query.url
+        window.location.href = `https://open.weixin.qq.com/connect/oauth2/authorize?appid=wxd29bbca61728b189&redirect_uri=http://gmxwni.natappfree.cc${this.$route.query.url}&response_type=code&scope=snsapi_userinfo&state=STATE#wechat_redirect`
       })
     }
   }

BIN
static/images/mobile/center/user/adv.jpg


BIN
static/images/mobile/center/vendor/adv.jpg


+ 1 - 1
store/provider.js

@@ -106,7 +106,7 @@ export const actions = {
       })
   },
   findStoreListInMobil ({ commit }, params = {}) {
-    params.op = 'pageByType'
+    params.op = 'similar'
     commit('stores/REQUEST_STORE_LIST')
     return axios.get('/api/store-service/stores', { params })
       .then(response => {