| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136 |
- <template>
- <div class="seek">
- <div class="com-mobile-header">
- <a @click="goLastPage"><i class="iconfont icon-fanhui"></i></a>
- <p>{{seekTitle}}</p>
- </div>
- <div class="mobile-fix-content" id="mobileFixContent">
- <div class="seek-title com-switch-item">
- <span class="mobile-switch-btn" :class="{'active': activeType=='all'}" @click="switchActiveType('all')">公司商机</span>
- <span class="mobile-switch-btn" :class="{'active': activeType=='self'}" @click="switchActiveType('self')">我的商机</span>
- </div>
- <div class="search-content">
- <input type="text" v-model="seekKeyword" :placeholder="userType == 'buyer' ? '品牌/型号' : '品牌/类目/型号/规格/公司'" @keyup.13="onSearch">
- <span @click="onSearch"><i class="iconfont icon-sousuo"></i></span>
- </div>
- <seek-list :keyword="remindKeyword" :isSearch="isSearch" :userType="userType" :seekType="seekType" :purchaseManList="purchaseManListData"></seek-list>
- <pull-up :fixId="'mobileFixContent'" :searchMore="fetching" :allPage="allPage" :page="page" @pullUpAction="onPullUpAction"></pull-up>
- </div>
- </div>
- </template>
- <script>
- import SeekList from '~components/mobile/applyPurchase/SeekList.vue'
- import { PullUp, EmptyStatus } from '~components/mobile/common'
- export default {
- layout: 'mobileNoHeader',
- middleware: 'authenticated',
- data () {
- return {
- seekKeyword: '',
- purchaseManListData: [],
- page: 1,
- count: 10,
- isChange: false,
- isSearch: false,
- remindKeyword: '',
- activeType: 'all'
- }
- },
- props: ['userType'],
- components: {
- SeekList,
- PullUp,
- EmptyStatus
- },
- watch: {
- 'purchase.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)
- },
- seekTitle () {
- if (this.seekType === 'wait') {
- if (this.userType === 'saler') {
- return '商机管理'
- } else {
- return '待报价'
- }
- } else if (this.seekType === 'done') {
- return '已报价'
- }
- return '已报价'
- }
- },
- methods: {
- onSearch: function () {
- this.isSearch = true
- this.remindKeyword = this.seekKeyword
- this.page = 1
- this.isChange = true
- this.reloadData()
- },
- reloadData: function () {
- this.$emit('reloadAction', this.page, this.count, this.seekKeyword, this.seekType, this.activeType)
- },
- onPullUpAction: function () {
- this.page++
- this.reloadData()
- },
- switchActiveType: function (type) {
- this.activeType = type
- this.isSearch = false
- this.remindKeyword = this.seekKeyword = ''
- this.page = 1
- this.isChange = true
- 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;
- }
- }
- $seekTitleLine: .72rem;
- .seek-title {
- height: $seekTitleLine;
- line-height: $seekTitleLine;
- .mobile-switch-btn {
- height: $seekTitleLine;
- line-height: $seekTitleLine;
- font-size: .28rem;
- /*&.active {
- border-bottom-width: .07rem;
- }*/
- }
- }
- </style>
|