Explorar o código

买卖家求购页面

yangc %!s(int64=7) %!d(string=hai) anos
pai
achega
7cde4d2914

+ 1 - 1
components/mobile/applyPurchase/SayPrice.vue

@@ -97,7 +97,7 @@
         //   document.body.style.left = '0'
         //   document.body.style.right = '0'
         // } else {
-        document.body.style.position = 'relative'
+//        document.body.style.position = 'relative'
         // }
         this.resetSayPrice()
       }

+ 2 - 2
components/mobile/applyPurchase/SayPriceInfo.vue

@@ -146,7 +146,7 @@
     components: {
       RemindBox
     },
-    props: ['agreed'],
+    props: ['agreed', 'userType'],
     filters: {
       date: function (date) {
         if (date) {
@@ -172,7 +172,7 @@
         return this.$store.state.option.user
       },
       isBuyer () {
-        return this.$route.query.type === 'buyer'
+        return this.$route.query.type === 'buyer' || this.userType === 'buyer'
       }
     },
     methods: {

+ 19 - 17
components/mobile/applyPurchase/SeekList.vue

@@ -50,13 +50,13 @@
         </div>
       </li>
     </ul>
-    <div class="none-state" v-if="!purchaseManListData || !purchaseManListData.length && !isDataChange">
+    <div class="none-state" v-if="!purchaseManListData || purchaseManListData.length == 0 && !isDataChange">
       <img src="/images/mobile/@2x/car@2x.png">
       <p v-text="'抱歉,暂无求购信息'"></p>
     </div>
     <login-box @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"></say-price-info>
+    <say-price-info v-if="showSayPriceInfoBox" :agreed="agreed" @cancelSayPriceInfoAction="onSayPriceInfoCancel" :userType="userType"></say-price-info>
     <remind-box :title="remindText" :timeoutCount="timeoutCount"></remind-box>
   </div>
 </template>
@@ -64,12 +64,6 @@
 import { LoginBox, RemindBox } from '~components/mobile/common'
 import { SayPrice, SayPriceInfo } from '~components/mobile/applyPurchase'
 export default {
-  components: {
-    LoginBox,
-    SayPrice,
-    RemindBox,
-    SayPriceInfo
-  },
   data() {
     return {
       showLoginBox: false,
@@ -82,6 +76,12 @@ export default {
       purchaseManListData: []
     }
   },
+  components: {
+    LoginBox,
+    SayPrice,
+    RemindBox,
+    SayPriceInfo
+  },
   props: ['userType', 'seekType', 'purchaseManList', 'isDataChange'],
   filters: {
     date: function(date) {
@@ -163,15 +163,17 @@ export default {
       return false
     },
     goSayPriceInfo: function(id, agreed, index) {
-      this.userType === 'buyer'
-        ? this.$store.dispatch('applyPurchase/loadBuyerInquiryDetail', {
-            id: id
-          })
-        : this.$store.dispatch('applyPurchase/loadVendorInquiryDetail', {
-            id: id,
-            enuu: this.user.data.enterprise.uu,
-            useruu: this.user.data.userUU
-          })
+      if (this.userType === 'buyer') {
+        this.$store.dispatch('applyPurchase/loadBuyerInquiryDetail', {
+          id: id
+        })
+      } else {
+        this.$store.dispatch('applyPurchase/loadVendorInquiryDetail', {
+          id: id,
+          enuu: this.user.data.enterprise.uu,
+          useruu: this.user.data.userUU
+        })
+      }
       this.agreed = agreed
       this.showSayPriceInfoBox = true
       this.activeIndex = index

+ 93 - 0
components/mobile/center/Seek.vue

@@ -0,0 +1,93 @@
+<template>
+  <div class="seek">
+    <div class="com-mobile-header">
+      <a @click="goLastPage"><i class="iconfont icon-fanhui"></i></a>
+      <p>{{seekType === 'wait' ? '待报价' : '已报价'}}</p>
+    </div>
+    <div class="mobile-content">
+      <div class="search-content">
+        <input type="text" v-model="seekKeyword" placeholder="型号/品牌/类目/规格/公司" @keyup.13="onSearch">
+        <span @click="onSearch"><i class="iconfont icon-sousuo"></i></span>
+      </div>
+      <seek-list :userType="userType" :seekType="seekType" :purchaseManList="purchaseManListData"></seek-list>
+      <pull-up :searchMore="fetching" :allPage="allPage" :page="page" @pullUpAction="onPullUpAction"></pull-up>
+    </div>
+  </div>
+</template>
+<script>
+  import SeekList from '~components/mobile/applyPurchase/SeekList.vue'
+  import { PullUp } from '~components/mobile/common'
+  export default {
+    layout: 'mobileNoHeader',
+    middleware: 'authenticated',
+    data () {
+      return {
+        seekKeyword: '',
+        purchaseManListData: [],
+        page: 1,
+        count: 10,
+        isChange: false
+      }
+    },
+    props: ['userType'],
+    components: {
+      SeekList,
+      PullUp
+    },
+    watch: {
+      '$store.state.applyPurchase.purchaseManList.purchaseManList.data': {
+        handler: function (val) {
+          let list = val.content ? val.content.slice() : []
+          if (this.isChange) {
+            this.purchaseManListData = list
+            this.isChange = false
+          } else {
+            this.purchaseManListData = this.purchaseManListData.concat(list)
+          }
+        },
+        immediate: true
+      }
+    },
+    computed: {
+      seekType () {
+        return this.$route.query.seekType
+      },
+      purchase () {
+        return this.$store.state.applyPurchase.purchaseManList.purchaseManList
+      },
+      fetching () {
+        return this.purchase.fetching
+      },
+      allPage () {
+        return Math.floor(this.purchase.data.totalElements / this.purchase.data.size) + Math.floor(this.purchase.data.totalElements % this.purchase.data.size > 0 ? 1 : 0)
+      }
+    },
+    methods: {
+      onSearch: function () {
+        this.page = 1
+        this.isChange = true
+        this.reloadData()
+      },
+      reloadData: function () {
+        this.$emit('reloadAction', this.page, this.count, this.seekKeyword, this.seekType)
+      },
+      onPullUpAction: function () {
+        this.page++
+        this.reloadData()
+      }
+    }
+  }
+</script>
+<style lang="scss" scoped>
+  .search-content {
+    text-align: center;
+    padding: .25rem 0 0 0;
+    input {
+      border: 1px solid #376ff3;
+    }
+    span {
+      height: .46rem;
+      line-height: .46rem;
+    }
+  }
+</style>

+ 2 - 0
components/mobile/center/index.js

@@ -0,0 +1,2 @@
+import Seek from './Seek.vue'
+export { Seek }

+ 2 - 15
components/mobile/common/PullUp.vue

@@ -3,19 +3,7 @@
 </template>
 <script>
   export default {
-    data () {
-      return {
-        isSearchingMore: false
-      }
-    },
     props: ['searchMore', 'allPage', 'page'],
-    watch: {
-      'searchMore': {
-        handler: function (val) {
-          this.isSearchingMore = val
-        }
-      }
-    },
     mounted () {
       let _this = this
       _this.$nextTick(function () {
@@ -27,13 +15,12 @@
     methods: {
       scroll: function () {
         let scrolled = document.documentElement.scrollTop || window.pageYOffset || document.body.scrollTop
-        if (Math.ceil(scrolled + window.screen.availHeight) >= document.body.scrollHeight && !this.isSearchingMore && this.page < this.allPage) {
+        if (Math.ceil(scrolled + window.screen.availHeight) >= document.body.scrollHeight && !this.searchMore && this.page < this.allPage) {
           this.getMore()
         }
       },
       getMore: function () {
-        if (!this.isSearchingMore) {
-          this.isSearchingMore = true
+        if (!this.searchMore) {
           this.$emit('pullUpAction')
         }
       }

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

@@ -15,14 +15,14 @@
       <div class="block-wrap seek-operation">
         <p><i></i>我的求购</p>
         <ul>
-          <nuxt-link to="/mobile/center/user/seek?type=wait" tag="li">
+          <nuxt-link to="/mobile/center/user/seek?seekType=wait" tag="li">
             <img src="/images/mobile/center/user/wait.png" alt="">
             <p>待报价</p>
           </nuxt-link>
-          <li>
+          <nuxt-link to="/mobile/center/user/seek?seekType=done" tag="li">
             <img src="/images/mobile/center/user/done.png" alt="">
             <p>已报价</p>
-          </li>
+          </nuxt-link>
           <li @click="showPublishBox = true">
             <img src="/images/mobile/center/user/pub.png" alt="">
             <p>发布求购</p>

+ 27 - 57
pages/mobile/center/user/seek.vue

@@ -1,66 +1,36 @@
 <template>
-  <div class="seek">
-    <div class="com-mobile-header">
-      <a @click="goLastPage"><i class="iconfont icon-fanhui"></i></a>
-      <p>待报价</p>
-    </div>
-    <div class="mobile-content">
-      <div class="search-content">
-        <input type="text" v-model="seekKeyword" placeholder="型号/品牌/类目/规格/公司" @keyup.13="onSearch">
-        <span @click="onSearch"><i class="iconfont icon-sousuo"></i></span>
-      </div>
-      <seek-list v-show="purchaseManListData.length" :userType="userType" :seekType="seekType" :purchaseManList="purchaseManListData" :isDataChange="isDataChange"></seek-list>
-    </div>
-  </div>
+  <seek :userType="'buyer'" @reloadAction="reloadData"></seek>
 </template>
 <script>
-  import { SeekList } from '~components/mobile/applyPurchase'
+  import { Seek } from '~components/mobile/center'
   export default {
     layout: 'mobileNoHeader',
     middleware: 'authenticated',
-    data () {
-      return {
-        seekKeyword: '',
-        purchaseManListData: [],
-        userType: 'saler',
-        isDataChange: false,
-        page: 1,
-        count: 10,
-        isChange: false
-      }
-    },
-    fetch ({ store }) {
+    fetch ({ store, query }) {
       let user = store.state.option.user.data
       let params = {
         pageNumber: 1,
-        pageSize: 10,
-        state: 'todo'
+        pageSize: 10
       }
       if (user.enterprise.uu) {
         params.enUU = user.enterprise.uu
       } else {
         params.userUU = user.userUU
       }
-      return Promise.all([
-        store.dispatch('applyPurchase/loadBuyerUnSayPricePurchaseManList', params)
-      ])
+      if (query.seekType === 'wait') {
+        params.state = 'todo'
+        return Promise.all([
+          store.dispatch('applyPurchase/loadBuyerUnSayPricePurchaseManList', params)
+        ])
+      } else {
+        params._state = 'done'
+        return Promise.all([
+          store.dispatch('applyPurchase/loadBuyerPurchaseManList', params)
+        ])
+      }
     },
     components: {
-      SeekList
-    },
-    watch: {
-      '$store.state.applyPurchase.purchaseManList.purchaseManList.data': {
-        handler: function (val) {
-          let list = val.content ? val.content.slice() : []
-          if (this.isChange) {
-            this.purchaseManListData = list
-            this.isChange = false
-          } else {
-            this.purchaseManListData = this.purchaseManListData.concat(list)
-          }
-        },
-        immediate: true
-      }
+      Seek
     },
     computed: {
       seekType () {
@@ -68,24 +38,24 @@
       }
     },
     methods: {
-      onSearch: function () {
-        this.page = 1
-        this.isChange = true
-        this.reloadData()
-      },
-      reloadData: function () {
+      reloadData: function (page = 1, count = 10, keyword) {
         let params = {
-          pageNumber: this.page,
-          pageSize: this.count,
-          state: 'todo',
-          keyword: this.seekKeyword
+          pageNumber: page,
+          pageSize: count,
+          keyword: keyword
         }
         if (this.user.data.enterprise.uu) {
           params.enUU = this.user.data.enterprise.uu
         } else {
           params.userUU = this.user.data.userUU
         }
-        this.$store.dispatch('applyPurchase/loadBuyerUnSayPricePurchaseManList', params)
+        if (this.seekType === 'done') {
+          params._state = 'done'
+          this.$store.dispatch('applyPurchase/loadBuyerPurchaseManList', params)
+        } else {
+          params.state = 'todo'
+          this.$store.dispatch('applyPurchase/loadBuyerUnSayPricePurchaseManList', params)
+        }
       }
     }
   }

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

@@ -32,14 +32,14 @@
       <div class="block-wrap seek-operation">
         <p><i></i>我的商机</p>
         <ul>
-          <li>
+          <nuxt-link to="/mobile/center/vendor/seek?seekType=wait" tag="li">
             <img src="/images/mobile/center/vendor/all.png" alt="">
             <p>我的商机</p>
-          </li>
-          <li>
+          </nuxt-link>
+          <nuxt-link to="/mobile/center/vendor/seek?seekType=done" tag="li">
             <img src="/images/mobile/center/vendor/seek-done.png" alt="">
             <p>已报价</p>
-          </li>
+          </nuxt-link>
         </ul>
       </div>
       <div class="block-wrap collect-block">

+ 87 - 0
pages/mobile/center/vendor/seek.vue

@@ -0,0 +1,87 @@
+<template>
+  <seek :userType="'saler'" @reloadAction="reloadData"></seek>
+</template>
+<script>
+  import { Seek } from '~components/mobile/center'
+  export default {
+    layout: 'mobileNoHeader',
+    middleware: 'authenticated',
+    fetch ({ store, query }) {
+      let user = store.state.option.user.data
+      let params = {
+        pageNumber: 1,
+        pageSize: 10
+      }
+      if (query.seekType === 'wait') {
+        params.enuu = user.enterprise.uu
+        params.useruu = user.userUU
+        return Promise.all([
+          store.dispatch('applyPurchase/loadVendorPushList', params)
+        ])
+      } else {
+        params._state = 'done'
+        params.filter = {
+          vendUU: user.enterprise.uu,
+          fromDate: null,
+          endDate: null,
+          keyword: null
+        }
+        params.overdue = 1
+        return Promise.all([
+          store.dispatch('applyPurchase/loadVendorPurchaseManList', params)
+        ])
+      }
+    },
+    components: {
+      Seek
+    },
+    computed: {
+      seekType () {
+        return this.$route.query.seekType
+      }
+    },
+    methods: {
+      reloadData: function (page = 1, count = 10, keyword) {
+        let store = this.$store
+        let user = store.state.option.user.data
+        let params = {
+          pageNumber: page,
+          pageSize: count
+        }
+        if (this.seekType === 'wait') {
+          params.enuu = user.enterprise.uu
+          params.useruu = user.userUU
+          params.keyword = keyword
+          return Promise.all([
+            store.dispatch('applyPurchase/loadVendorPushList', params)
+          ])
+        } else {
+          params._state = 'done'
+          params.filter = {
+            vendUU: user.enterprise.uu,
+            fromDate: null,
+            endDate: null,
+            keyword: keyword
+          }
+          params.overdue = 1
+          return Promise.all([
+            store.dispatch('applyPurchase/loadVendorPurchaseManList', params)
+          ])
+        }
+      }
+    }
+  }
+</script>
+<style lang="scss" scoped>
+  .search-content {
+    text-align: center;
+    padding: .25rem 0 0 0;
+    input {
+      border: 1px solid #376ff3;
+    }
+    span {
+      height: .46rem;
+      line-height: .46rem;
+    }
+  }
+</style>

+ 1 - 1
store/applyPurchase.js

@@ -85,7 +85,7 @@ export const actions = {
         commit('purchaseManList/GET_VENDOR_INQUIRY_DETAIL_FAILURE', err)
       })
   },
-  /* 获取家报价信息 */
+  /* 获取家报价信息 */
   loadBuyerInquiryDetail ({ commit }, params = {}) {
     commit('purchaseManList/REQUEST_BUYER_INQUIRY_DETAIL')
     return axios.get('/inquiry/buyer/quotation', {params})