瀏覽代碼

店铺搜索

yangc 7 年之前
父節點
當前提交
fbcba74142

+ 30 - 0
assets/scss/mobileCommon.scss

@@ -337,3 +337,33 @@ html {
     }
   }
 }
+
+/*空状态*/
+.com-none-state{
+  text-align: center;
+  padding:1.5rem 0;
+  background: #fff;
+  margin-top:.1rem;
+  width:100%;
+  img{
+    margin:0 auto;
+    width: 4.08rem;
+    height: 2.62rem;
+  }
+  p {
+    font-size: .32rem;
+    color: #999;
+    margin: 1.19rem 0 0 0;
+  }
+  a {
+    display: block;
+    font-size: .28rem;
+    color: #fff;
+    width: 1.88rem;
+    height: .54rem;
+    line-height: .54rem;
+    background: #418bf6;
+    margin: .7rem auto 0;
+    border-radius: .05rem;
+  }
+}

+ 18 - 13
components/mobile/Home.vue

@@ -14,7 +14,7 @@
           <div class="swiper-pagination swiper-pagination-bullets"></div>
         </div>
         <div class="search-content">
-          <input type="text" placeholder="请输入您要查找的型号或品牌" @click="onHomeSearchClick()">
+          <input type="text" placeholder="请输入您要查找的型号、品牌或店铺" @click="onHomeSearchClick()">
           <span>
         <i class="iconfont icon-sousuo"></i>
       </span>
@@ -23,23 +23,28 @@
       </div>
       <ul class="link-list">
         <li>
-          <nuxt-link to="/mobile/shop">
-            <img src="/images/mobile/@2x/applyPurchase/home/shop.png" alt="">
-            <span>店铺列表</span>
-            <i></i>
+          <nuxt-link to="/mobile/applyPurchase/list">
+            <img src="/images/mobile/@2x/home/supplier.png" alt="">
+            <span>供应商</span>
           </nuxt-link>
         </li>
         <li>
-          <nuxt-link to="/mobile/brand/brandCenter/ABCD">
-            <img src="/images/mobile/@2x/applyPurchase/home/brand.png" alt="">
-            <span>品牌列表</span>
-            <i></i>
+          <nuxt-link to="/mobile/applyPurchase/list/businessOpportunity">
+            <img src="/images/mobile/@2x/home/seek.png" alt="">
+            <span>我的商机</span>
           </nuxt-link>
         </li>
         <li>
-          <nuxt-link to="/mobile/applyPurchase/list">
-            <img src="/images/mobile/@2x/applyPurchase/home/seek.png" alt="">
-            <span>求购询价</span>
+          <nuxt-link to="/mobile/shop">
+            <img src="/images/mobile/@2x/home/store.png" alt="">
+            <span>店铺列表</span>
+           <!-- <i></i>-->
+          </nuxt-link>
+        </li>
+        <li>
+          <nuxt-link to="/mobile/brand/brandCenter/ABCD">
+            <img src="/images/mobile/@2x/home/brand.png" alt="">
+            <span>品牌中心</span>
           </nuxt-link>
         </li>
       </ul>
@@ -145,7 +150,7 @@
       li {
         position: relative;
         display: inline-block;
-        width: 33.3%;
+        width: 25%;
         text-align: center;
         float: left;
         height: 1.36rem;

+ 67 - 8
components/mobile/search/MainSearch.vue

@@ -1,6 +1,13 @@
 <template>
-  <div class="main-search" @touchstart="cancelFocus" id="main-search">
+  <div class="main-search" @touchstart="cancelFocus" @click="setShowSearchType(false)" id="main-search">
     <div class="main-search-header">
+      <div class="options" @click="setShowSearchType(!showSearchType, $event)">
+        {{searchType == 'product' ? '产品' : '店铺'}}
+        <i></i>
+        <ul v-if="showSearchType">
+          <li @click="setSearchType(searchType == 'product' ? 'store' : 'product', $event)">{{searchType == 'product' ? '店铺' : '产品'}}</li>
+        </ul>
+      </div>
       <input type="text" id="search-box" v-model="keyword" placeholder="请输入您要查找的型号或品牌" @keyup.13="onSearch()">
       <span @click="onSearch()">搜索</span>
       <a @click="cancelSearch">取消</a>
@@ -40,7 +47,9 @@
         keyword: '',
         associate: {
           show: false
-        }
+        },
+        searchType: 'product',
+        showSearchType: false
       }
     },
     props: {
@@ -73,7 +82,11 @@
           this.keyword = key
         }
         if (this.keyword) {
-          this.$router.push({path: '/mobile/search?w=' + encodeURIComponent(this.keyword)})
+          if (this.searchType === 'product') {
+            this.$router.push('/mobile/search?w=' + encodeURIComponent(this.keyword))
+          } else if (this.searchType === 'store') {
+            this.$router.push('/mobile/shop?keyword=' + encodeURIComponent(this.keyword))
+          }
         }
       },
       onChange () {
@@ -88,8 +101,10 @@
         }
       },
       searchKeywords () {
-        this.$store.dispatch('searchKeywords', { keyword: this.keyword })
-        this.associate.show = true
+        if (this.searchType === 'product') {
+          this.$store.dispatch('searchKeywords', { keyword: this.keyword })
+          this.associate.show = true
+        }
       },
       onAssociateClick (word) {
         this.keyword = word
@@ -105,6 +120,18 @@
         this.$http.delete('/search/searchHistory').then(response => {
           this.$store.dispatch('searchData/getSearchHistory')
         })
+      },
+      setSearchType (type, $event) {
+        $event.stopPropagation()
+        this.searchType = type
+        this.setShowSearchType(false)
+        this.associate.show = false
+      },
+      setShowSearchType (flag, e) {
+        if (e) {
+          e.stopPropagation()
+        }
+        this.showSearchType = flag
       }
     },
     created () {
@@ -148,6 +175,7 @@
     top: -2rem;
     bottom: 0;
     .main-search-header {
+      position: relative;
       height: .88rem;
       background: #3e82f5;
       padding-left: .5rem;
@@ -159,7 +187,7 @@
         line-height: .62rem;
         font-size: .28rem;
         color: #999;
-        padding-left: .2rem;
+        padding-left: .82rem;
         border: .04rem solid #fff;
         background: #fff;
         outline: none;
@@ -167,8 +195,8 @@
         float: left;
         margin-top: .12rem;
         -webkit-appearance: none;
-        border-top-left-radius: .05rem;
-        border-bottom-left-radius: .05rem;
+        border-top-left-radius: .14rem;
+        border-bottom-left-radius: .14rem;
       }
       span {
         display: inline-block;
@@ -190,6 +218,37 @@
         color: #fff;
         margin-left: .2rem;
       }
+      .options {
+        position: absolute;
+        left: .5rem;
+        font-size: .28rem;
+        width: .8rem;
+        text-align: center;
+        background: url('/images/mobile/@2x/search/select-arrow.png') no-repeat;
+        background-size: .14rem .12rem;
+        background-position: .63rem .36rem;
+        i {
+          height: .46rem;
+          width: .01rem;
+          background: #eceef0;
+          display: block;
+          float: right;
+          margin-top: .18rem;
+        }
+        ul {
+          position: absolute;
+          li {
+            width: .82rem;
+            height: .59rem;
+            border-radius: .02rem;
+            background: rgba(0, 0, 0, .6);
+            font-size: .23rem;
+            color: rgba(255, 255, 255, .89);
+            text-align: center;
+            line-height: .59rem;
+          }
+        }
+      }
     }
     .associate-list {
       background: #fff;

+ 1 - 1
nuxt.config.js

@@ -1,6 +1,6 @@
 const path = require('path')
 const isProdMode = Object.is(process.env.NODE_ENV, 'production')
-const baseUrl = process.env.BASE_URL || (isProdMode ? 'http://api.usoftmall.com/' : 'http://192.168.253.121:9090/platform-b2c')
+const baseUrl = process.env.BASE_URL || (isProdMode ? 'http://api.usoftmall.com/' : 'http://10.1.51.124:8080/platform-b2c')
 const commonUrl = process.env.COMMON_URL || (isProdMode ? 'https://api-inquiry.usoftmall.com/' : 'http://218.17.158.219:24000/')
 const materialUrl = process.env.MATERIAL_URL || (isProdMode ? 'https://api-product.usoftmall.com/' : 'http://218.17.158.219:24000/')
 

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

@@ -0,0 +1,157 @@
+<template>
+  <div class="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="seekKeyword" placeholder="请输入您要查找的型号或品牌" @keyup.13="searchSeek" ref="searchSeekInput" @focus="inputGetFocus()" @blur="blur()">
+        <span @click="searchSeek">
+        <i class="iconfont icon-sousuo"></i>
+        </span>
+      </div>
+    </div>
+    <div class="seek-title">
+      <img src="/images/mobile/@2x/applyPurchase/opportunity.png" alt="">
+      <span>我的商机</span>
+    </div>
+    <seek-list v-if="purchaseManListData && purchaseManListData.length" :purchaseManList="purchaseManListData" :isDataChange="isDataChange"></seek-list>
+    <div class="com-none-state" v-else>
+      <img src="/images/mobile/@2x/car@2x.png">
+      <p>暂无求购信息</p>
+      <nuxt-link to="/">返回首页</nuxt-link>
+    </div>
+    <loading v-show="isSearchSearchingMore"></loading>
+    <div v-if="purchaseManList && false"></div>
+  </div>
+</template>
+<script>
+  import SeekList from '~components/mobile/applyPurchase/SeekList.vue'
+  import {Loading} from '~components/mobile/common'
+  export default {
+    layout: 'mobile',
+    components: {
+      SeekList,
+      Loading
+    },
+    data () {
+      return {
+        isSearchSearchingMore: false,
+        page: 1,
+        size: 10,
+        purchaseManListData: [],
+        showSeekSearch: true,
+        seekKeyword: '',
+        isChange: false,
+        isDataChange: false
+      }
+    },
+    mounted: function () {
+      this.$nextTick(() => {
+        window.addEventListener('scroll', this.scroll, false)
+      })
+    },
+//    watch: {
+//      $route: function (val, oldVal) {
+//        window.removeEventListener('scroll', this.scroll, false)
+//      }
+//    },
+    fetch ({store}) {
+      return Promise.all([
+          store.dispatch('applyPurchase/loadVendorPushList', {pageNumber: 1, pageSize: 10, sorting: {'releaseDate': 'DESC'}, enuu: store.state.option.user.data.enterprise ? store.state.option.user.data.enterprise.uu : null, useruu: store.state.option.user.data.userUU})
+      ])
+    },
+    computed: {
+      purchaseManList () {
+        let list = this.$store.state.applyPurchase.purchaseManList.purchaseManList.data
+        if (this.isChange) {
+          this.purchaseManListData = []
+          this.seekPage = 1
+          this.isChange = false
+          this.isDataChange = true
+        } else {
+          this.purchaseManListData = this.purchaseManListData.concat(list.content || [])
+          this.isSearchSearchingMore = false
+          this.isDataChange = false
+        }
+        return this.$store.state.applyPurchase.purchaseManList.purchaseManList.data
+      },
+      allPage () {
+        return Math.floor(this.purchaseManList.totalElements / this.purchaseManList.size) + Math.floor(this.purchaseManList.totalElements % this.purchaseManList.size > 0 ? 1 : 0)
+      }
+    },
+    methods: {
+      scroll: function () {
+        let scrolled = document.documentElement.scrollTop || window.pageYOffset || document.body.scrollTop
+        if (Math.ceil(scrolled + window.screen.availHeight) >= document.body.scrollHeight && !this.isSearchSearchingMore && this.page < this.allPage) {
+          this.getMoreSearch()
+        }
+        if (this.$refs.searchSeekInput && this.$store.state.mobile.InputGetFocus) {
+          this.$refs.searchSeekInput.blur()
+        }
+      },
+      blur: function() {
+        // setTimeout(() => {
+        this.$store.dispatch('mobile/SetInputGetFocus', false)
+        // }, 300)
+      },
+      inputGetFocus: function() {
+        setTimeout(() => {
+          this.$store.dispatch('mobile/SetInputGetFocus', true)
+        }, 300)
+      },
+      getMoreSearch: function () {
+        this.page++
+        this.isSearchSearchingMore = true
+        this.reloadData()
+      },
+      reloadData: function () {
+        this.$store.dispatch('applyPurchase/loadVendorPushList', {pageNumber: this.page, pageSize: this.size, sorting: {'releaseDate': 'DESC'}, keyword: this.seekKeyword, enuu: this.user.data.enterprise ? this.$store.state.option.user.data.enterprise.uu : null, useruu: this.user.data.userUU})
+      },
+      goLastPage: function () {
+        window.history.back(-1)
+      },
+      searchSeek: function () {
+        this.page = 1
+        this.isChange = true
+        this.reloadData()
+      }
+    }
+  }
+</script>
+<style lang="scss" scoped>
+  .mobile-content {
+    .mobile-header {
+      position: fixed;
+      top: 0;
+      z-index: 10;
+      width:100%;
+      height:.88rem;
+      line-height: .88rem;
+      background: #3e82f5;
+      padding:0 .2rem 0 .1rem;
+      color:#fff;
+      > a {
+        font-size:.28rem;
+        color:#fff;
+        position: absolute;
+        i {
+          font-size: .48rem;
+          margin-right: -.1rem;
+        }
+      }
+      .search-content {
+        margin-left: .5rem;
+        line-height: normal;
+        padding-top: .14rem;
+        input {
+          color: #333;
+          width: 5.78rem;
+          line-height: normal;
+        }
+        span {
+          height: .46rem;
+          line-height: .46rem;
+        }
+      }
+    }
+  }
+</style>

+ 4 - 4
pages/mobile/shop/index.vue

@@ -71,9 +71,9 @@
       Loading,
       LoginBox
     },
-    fetch ({ store }) {
+    fetch ({ store, query }) {
       return Promise.all([
-        store.dispatch('provider/findStoreListInMobil', { page: 1, count: 10, types: 'ORIGINAL_FACTORY-DISTRIBUTION-AGENCY-CONSIGNMENT' })
+        store.dispatch('provider/findStoreListInMobil', { page: 1, count: 10, types: 'ORIGINAL_FACTORY-DISTRIBUTION-AGENCY-CONSIGNMENT', keyword: query.keyword || null })
       ])
     },
     computed: {
@@ -115,7 +115,7 @@
         if (!this.isSearchingMore) {
           this.page++
           this.isSearchingMore = true
-          this.$store.dispatch('provider/findStoreListInMobil', { page: this.page, count: this.count, types: this.types })
+          this.$store.dispatch('provider/findStoreListInMobil', { page: this.page, count: this.count, types: this.types, keyword: this.$route.query.keyword || null })
         }
       },
       isType (type) {
@@ -149,7 +149,7 @@
         } else if (type === 'ORIGINAL_FACTORY-DISTRIBUTION-AGENCY-CONSIGNMENT') {
           this.downName = '全部'
         }
-        this.$store.dispatch('provider/findStoreListInMobil', { page: 1, count: 10, types: type })
+        this.$store.dispatch('provider/findStoreListInMobil', { page: 1, count: 10, types: type, keyword: this.$route.query.keyword || null })
       },
       focusStore: function (item, $event) {
 //        item.isFocus = item.isFocus === 'false' ? 'true' : 'false'

+ 13 - 7
pages/mobile/user/index.vue

@@ -131,21 +131,27 @@
     },
     fetch ({ store, route }) {
       let user = store.state.option.user.data
+      let isSaler = route.query.type === 'saler'
       let params = {
         pageNumber: 1,
         pageSize: 10,
-        state: (!route.query.type || route.query.type === 'buyer') ? 'todo' : null
+        state: !isSaler ? 'todo' : null
       }
-      if (user.enterprise.uu) {
-        params.enUU = user.enterprise.uu
+      if (!isSaler) {
+        if (user.enterprise.uu) {
+          params.enUU = user.enterprise.uu
+        } else {
+          params.userUU = user.userUU
+        }
       } else {
-        params.userUU = user.userUU
+        params.enuu = user.enterprise.uu
+        params.useruu = user.userUU
       }
 //      console.log(params)
       return Promise.all([
         store.dispatch('product/saveStores', { count: 100, page: 1, type: 'component' }),
         store.dispatch('shop/StoreFocusPage', { count: 100, page: 1 }),
-        store.dispatch(route.query.type === 'saler' ? 'applyPurchase/loadPurchaseManList' : 'applyPurchase/loadBuyerUnSayPricePurchaseManList', params)
+        store.dispatch(route.query.type === 'saler' ? 'applyPurchase/loadVendorPushList' : 'applyPurchase/loadBuyerUnSayPricePurchaseManList', params)
       ])
     },
     watch: {
@@ -278,7 +284,7 @@
           }
         } else {
           if (type === 'wait') {
-            this.$store.dispatch('applyPurchase/loadPurchaseManList', {pageNumber: this.seekPage, pageSize: this.seekSize, enUU: this.$store.state.option.user.data.enterprise.uu, keyword: this.seekKeyword})
+            this.$store.dispatch('applyPurchase/loadVendorPushList', {pageNumber: this.seekPage, pageSize: this.seekSize, enuu: this.user.data.enterprise.uu, useruu: this.user.data.userUU, keyword: this.seekKeyword})
           } else if (type === 'done') {
             this.$store.dispatch('applyPurchase/loadVendorPurchaseManList', {pageNumber: this.seekPage, pageSize: this.seekSize, _state: 'done', filter: {vendUU: this.$store.state.option.user.data.enterprise.uu, fromDate: null, endDate: null, keyword: this.seekKeyword}, overdue: 1})
           } else {
@@ -359,7 +365,7 @@
         return this.$store.state.applyPurchase.purchaseManList.purchaseManList
       },
       purchaseManList () {
-        let list = this.purchase.data.content.slice()
+        let list = this.purchase.data.content ? this.purchase.data.content.slice() : []
         if (this.isChange) {
           this.purchaseManListData = []
           this.seekPage = 1

二進制
static/images/mobile/@2x/applyPurchase/opportunity.png


二進制
static/images/mobile/@2x/home/brand.png


二進制
static/images/mobile/@2x/home/seek.png


二進制
static/images/mobile/@2x/home/store.png


二進制
static/images/mobile/@2x/home/supplier.png


二進制
static/images/mobile/@2x/search/select-arrow.png


+ 10 - 0
store/applyPurchase.js

@@ -122,6 +122,16 @@ export const actions = {
         commit('purchaseManList/GET_PURCHASEMAN_FAILURE', err)
       })
   },
+  // 卖家精准推送求购列表
+  loadVendorPushList ({ commit }, params = {}) {
+    commit('purchaseManList/REQUEST_PURCHASEMAN')
+    return axios.get('/inquiry/sale/remind', {params})
+      .then(response => {
+        commit('purchaseManList/GET_PURCHASEMAN_SUCCESS', response.data)
+      }, err => {
+        commit('purchaseManList/GET_PURCHASEMAN_FAILURE', err)
+      })
+  },
   // 求购排行榜
   loadPurchaseApplyRank ({ commit }, params = {}) {
     commit('purchaseApplyRank/REQUEST_PURCHASERANK', params)