demand.vue
5.04 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
<template>
<view class="page">
<view class="main">
<view class="top">
<image src="../../static/img/supply2.png" @click="toPostDemand()" mode="widthFix"></image>
</view>
<view class="titleall-box">
<view class="search-head">
<view class="search">
<image src="../../static/fdj1.png"></image>
<text></text>
<input type="text" v-model="keyWord" placeholder="搜索关键词" @input="selectPro()" />
</view>
<!-- 显示公司选项 -->
<view class="btn" @click="selectPro()">
<text>搜索</text>
</view>
</view>
<mo-hu-search :show="selectShow" :list="comList" @select="select" label-name="name"
value-name="id"></mo-hu-search>
<view class="title-screen">
<scroll-view scroll-x="true" class="scrollview-box">
<!-- 下方的红线 -->
<!-- <view ref="line" class="line" ></view> -->
<view :class="['title-screen-box',{'red_line':nowShow === 1}]" @click="allPro(1,'全部')">
<view>全部</view>
</view>
<view :class="['title-screen-box',{'red_line':nowShow === 2}]" @click="metalPro(2,'金属')">
<view>金属</view>
</view>
<view :class="['title-screen-box',{'red_line':nowShow === 3}]" @click="devicePro(3,'专用设备')">
<view>专用设备</view>
</view>
<view :class="['title-screen-box',{'red_line':nowShow === 4}]" @click="tranPro(4,'交通运输')">
<view>交通运输</view>
</view>
<view :class="['title-screen-box',{'red_line':nowShow === 5}]" @click="elecPro(5,'电气机械')">
<view>电气机械</view>
</view>
<view :class="['title-screen-box',{'red_line':nowShow === 6}]" @click="commuPro(6,'电子及通讯')">
<view>电子及通讯</view>
</view>
</scroll-view>
<view class="title-screen-box" style="background-color: #fff;margin-right: 0;text-align: center;">
<view class="title-screen-box-btn">
<image src="../../static/supply.png"></image>
</view>
</view>
</view>
</view>
<view class="recommend-info">
<view class="goods-list">
<view class="list" @click="ArticleDetails(item)" v-for="(item,index) in demandList" :key="index">
<view class="title-tag">
<view class="tag">
{{item.subTitle}}
</view>
<view class="tag-small">
{{item.subTitle}}
</view>
</view>
<view class="price-info">
<view class="user-price">
<view class="goods-city">
<image src="../../static/image/default_logo.jpg"></image>{{item.comanyName}}
</view>
<view class="goods-city-img">
<image src="../../static/right2.png"></image>
</view>
</view>
<view class="vip-price">
</view>
</view>
</view>
</view>
</view>
</view>
</view>
</template>
<script>
import moHuSearch from '../../components/qj-fuzzy-search/index.vue'
export default {
components: {
moHuSearch
},
data() {
return {
demandList: [],
nowShow: 1,
comList:[],
selectShow:false,
keyWord:''
}
},
mounted() {
let that = this
this.getDemandList()
this.allPro()
},
// onLoad() {
// let that = this
// this.getDemandList()
// this.allPro()
// },
methods: {
selectPro(){
let that = this
this.selectShow = true
that.API.getDemandList({
keyword:this.keyWord,
pageSize: 10000,
}).then(res => {
console.log(res)
let arr = res.data.list
this.comList = arr.map(it=>{
return {
...it,
name:it.title
}
})
})
},
select(item) {
// this.selectName = item.name;
// this.selectId = item.id
// this.categoryId = item.categoryId
// console.log("栏目ID",this.categoryId)
this.ArticleDetails(item)
this.selectShow = false;
},
// 点击全部
allPro(index, name) {
let that = this
this.nowShow = index
console.log(name)
},
// 点击金属
metalPro(index, name) {
let that = this
that.nowShow = index
console.log(name)
},
// 点击专用设备
devicePro(index, name) {
let that = this
that.nowShow = index
console.log(name)
},
// 点击交通运输
tranPro(index, name) {
let that = this
that.nowShow = index
console.log(name)
},
// 点击电气机械
elecPro(index, name) {
let that = this
that.nowShow = index
console.log(name)
},
// 点击电子及通讯
commuPro(index, name) {
let that = this
that.nowShow = index
console.log(name)
},
// 获取全部需求数据
getDemandList() {
let that = this
that.API.getDemandList({
pageSize: 10000,
}).then(res => {
console.log(res)
that.demandList = res.data.list
})
},
ArticleDetails(it) {
uni.navigateTo({
url: `/pages/ArticleDetails/ArticleDetails?data=${JSON.stringify(it)}`
})
},
// 去需求发布页面
toPostDemand() {
uni.navigateTo({
url: '/pages/postDemand/postDemand'
})
}
}
};
</script>
<style scoped lang="scss">
@import 'demand.scss';
</style>