buy.vue
10.1 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
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
<template>
<view>
<view class="nevbg">
<view class="back"
:style="[{paddingTop:titleTop+'rpx'},{height:bgHeight+'rpx'},{lineheight:titleHeight+'rpx'}]">
<text>设备乐</text>
</view>
</view>
<view style="height:186rpx"></view>
<view class="top">
<view class="flexBox" style="padding: 24rpx 24rpx 0 24rpx;">
<view class="" style="width: 65vw;" @click.stop="goRot('/pages/subPages/moreSearch')">
<view class="searchcity">
<view class="flexBox oneh" style="justify-content: center;" @click.stop="goRot('/pages/subPages/moreChoose')">
<view class="city " style="max-width: 120rpx;overflow: hidden;text-overflow: ellipsis;">
{{city_name ? city_name : '城市'}}
</view>
<image class="img1" src="/static/icon/xia.png" mode=""></image>
</view>
<view class="searchline">
|
</view>
<image class="img2" src="/static/icon/search.png" mode=""></image>
<input type="text" placeholder="输入关键词搜索" disabled placeholder-style="font-size: 26rpx;font-weight: 400;">
</view>
</view>
<button style="width: 30vw;" shape="circle" class="btn" size="small" @click="goHub">免费发布</button>
</view>
<view class="boxs" style="padding: 0 24rpx; justify-content: space-evenly">
<view class="item" v-for="item in list.slice(0,3)"
@click="goRot('/pages/subPages/moreSearch',item.name)">
<view class="imgbtn">
<image :src="item.icon_url" class="img" mode=""></image>
</view>
<p style="font-size: 24rpx; margin-top: 16rpx;">{{item.name}}</p>
</view>
<view class="item" style="margin-right: 0;" @click="goRot('/pages/subPages/more?val=1')">
<image src="../../static/Frame/175.png" class="img" mode=""></image>
<p style="font-size: 24rpx; margin-top: 16rpx;">更多</p>
</view>
</view>
</view>
<view class="flexBox navBox" style="margin-bottom: 12rpx;">
<view class="left" :class="active == '出租' ? 'activeBox' : ''" @click="type = 3; active ='出租'; getList()">
<p class="title">出租</p>
<p class="tip">免押金</p>
</view>
<view class="right" :class="active == '出售' ? 'activeBox' : ''" @click="type = 4;active ='出售'; getList()">
<p class="title">出售</p>
<p class="tip">老板直聊</p>
</view>
</view>
<view class="">
<view class="" v-if="list1 && list1.length>0">
<view class="list" v-for="item in list1">
<item :info="item"></item>
</view>
</view>
<view v-else class="" style="margin-top: 30%;">
<u-empty></u-empty>
</view>
</view>
<u-overlay :show="show" @click="show = false">
<view class="warp">
<view class="rect flexBox" style="flex-direction: column;" @tap.stop>
<image src="/static/image/fabu/2896.png" mode=""
style="width: 622rpx; margin-bottom: 32rpx;height: 152rpx;"
@click="goRot('/pages/sellAndBuy/hire','1')"></image>
<image src="../../static/image/fabu/2897.png"
style="width: 622rpx;margin-bottom: 32rpx;height: 152rpx;"
@click="goRot('/pages/sellAndBuy/hire','2')" mode=""></image>
<view class="flexBox">
<view class="box1 flexBox" style="justify-content: center;margin-right: 5%;padding: 0 5rpx; color: white;"
@click="goRot('/pages/sellAndBuy/hub', '3')">
<image src="../../static/image/fabu/188.png"
style="width: 64rpx;height: 64rpx; margin-right: 16rpx;" mode=""></image>
设备求租
</view>
<view class="box1 flexBox" style="justify-content: center;padding: 0 5rpx;color: white;"
@click="goRot('/pages/sellAndBuy/hub', '4')">
<image src="../../static/image/fabu/187.png"
style="width: 64rpx;height: 64rpx; margin-right: 16rpx;" mode=""></image>
设备求购
</view>
</view>
<view class="bbox" style=" margin: 10px 0 0 530rpx; text-align: center; padding-top: 2;" @click="show = false">
<image src="../../static/close@2x.png" style="width: 40rpx;height: 40rpx;margin-top: 20rpx;" mode=""></image>
</view>
</view>
</view>
</u-overlay>
</view>
</template>
<script>
import item from '@/component/listItem/listItem.vue'
export default {
components: {
item
},
data() {
return {
//顶部文字
titleTop: '',
titleHeight: '',
bgHeight: '',
keyword: '',
show: false,
city_id: null,
city_name: null,
value: '',
type: 3,
active: '出租',
list: [
],
list1: [],
lat: '',
lng: ''
}
},
methods: {
// 标题文字居中
getWxTitleTop() {
let menuButtonInfo = uni.getMenuButtonBoundingClientRect()
this.titleTop = (menuButtonInfo.top) //标题文字的position:top
this.titleHeight = (menuButtonInfo.height) //标题文字的高度
//背景的高度=top+height+需要的下方高度
this.bgHeight = (menuButtonInfo.top) + (menuButtonInfo.height) + 75
},
goHub() {
this.show = true
},
goRot(url, val) {
uni.navigateTo({
url: url + '?val=' + val
})
this.show = false
},
change() {
this.getList()
},
getList() {
uni.$u.http.post('/api/equip/equip_list', {
orderby: 1,
// page: 1,
// pagenum: 10,
lat: this.lat,
lng: this.lng,
keyword: this.keyword,
type: this.type
}).then(res => {
console.log(res);
this.list1 = res.data.data
}).catch(err => {
console.log(err);
})
}
},
onShow() {
let pagearr = getCurrentPages(); //获取应用页面栈
let currentPage = pagearr[pagearr.length - 1]; //获取当前页面信息
console.log('option:', currentPage) //获取页面传递的信息
this.city_id = currentPage.$vm.city_id
this.city_name = currentPage.$vm.city_name
this.lat = currentPage.$vm.lat
this.lng = currentPage.$vm.lng
this.getList()
},
onLoad(option) {
console.log(option);
if (option.val = '买') {
uni.switchTab({
url: '/pages/index/buy'
})
} else {
uni.switchTab({
url: '/pages/index/sell'
})
}
this.getWxTitleTop()
this.getList()
uni.$u.http.get('/api/index/rec_index').then(res => {
console.log(res);
this.list = res.data
console.log(this.list);
}).catch(err => {
console.log(err);
})
}
}
</script>
<style scoped lang="scss">
.top {
height: 300rpx;
background: linear-gradient(180deg, #d0e3ef 0%, #e0eaf2 100%);
.searchcity {
display: flex;
align-items: center;
width: 466rpx;
height: 68rpx;
border-radius: 48rpx;
opacity: 1;
border: 1rpx solid #c1ddedff;
background: #ffffffff;
padding: 32rpx 24rpx;
box-sizing: border-box;
.city {
color: #000000e6;
font-size: 26rpx;
font-weight: 400;
}
.img1 {
margin-left: 4rpx;
width: 32rpx;
height: 32rpx;
}
.searchline {
opacity: 0.6;
margin:0 10rpx;
}
.img2 {
margin-left: 4rpx;
margin-top: 4rpx;
width: 40rpx;
height: 40rpx;
}
input{
margin-top: 4rpx;
flex:1;
margin-left: 16rpx;
}
}
}
.nevbg {
position: fixed;
height: 186rpx;
width: 100%;
z-index: 99;
opacity: 1;
overflow: hidden;
background: linear-gradient(180deg, #cde2ef 0%, #d0e3ef 100%);
}
.bbox{
width: 80rpx;
height: 80rpx;
border-radius: 8rpx;
opacity: 1;
background: #ffffff47;
}
.back {
position: fixed;
display: flex;
align-items: center;
z-index: 999;
width: 100%;
image {
position: absolute;
top: 50%;
left: 32rpx;
transform: translate(-50%);
width: 48rpx;
height: 48rpx;
}
text {
margin-left: 32rpx;
color: #000000e6;
font-size: 48rpx;
font-weight: 700;
text-align: left;
font-family: "Alibaba PuHuiTi";
}
}
.flexBox {
display: flex;
align-items: center;
justify-content: space-between;
}
.bum {}
.box1 {
width: 298rpx;
height: 136rpx;
border-radius: 8rpx;
opacity: 1;
background: #ffffff47;
}
.btn {
width: 212rpx;
height: 64rpx;
line-height: 64rpx;
border-radius: 48rpx;
font-size: 28rpx;
margin-left: 16rpx;
opacity: 1;
color: white;
background: linear-gradient(134.7deg, #46baecff 0%, #2f67d3ff 100%);
}
.listBox_top {
display: flex;
}
.listBox_right {
width: 100%;
}
.line {
height: 1rpx;
opacity: 1;
background: #f0f2f5ff;
margin: 24rpx 0 17rpx 0;
}
.font {
color: #e63d27ff;
font-size: 40rpx;
font-weight: 500;
text-align: right;
}
.search {
background-color: white;
}
/deep/ .u-search__action {
display: none;
}
.boxs {
display: flex;
align-items: center;
justify-content: flex-start;
margin-top: 32rpx;
}
.title {
color: #00000066;
font-size: 40rpx;
font-weight: 700;
}
.tips {
color: #00000099;
font-size: 26rpx;
font-weight: 400;
}
.listBox_cont {
display: flex;
align-items: center;
margin: 16rpx 0;
}
.tip {
color: #00000066;
font-size: 28rpx;
font-weight: 500;
}
.item {
.imgbtn{
width: 104rpx;
height: 104rpx;
border-radius: 16rpx;
background-color: #ffffff;
.img {
width: 104rpx;
height: 104rpx;
}
}
.img {
width: 104rpx;
height: 104rpx;
}
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
margin-right: 42rpx;
}
.warp {
height: 100vh;
background: linear-gradient(180deg, #091a343d 0%, #091a34e0 100%);
backdrop-filter: blur(24rpx);
}
.rect {
position: fixed;
bottom: 10%;
left: 10%
}
.navBox {
height: 132rpx;
opacity: 1;
}
.left {
width: 50%;
height: 132rpx;
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
}
.activeBox {
background: url("/static/image/Rectangle 38.png");
background-size: 100% 100%;
.title{
color: #3375D8;
}
.tip{
color: #3375D8;
}
}
.oneh{
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
}
.right {
width: 50%;
height: 132rpx;
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
}
.list {
background: #f6f6f6ff;
padding: 8rpx 24rpx;
}
.listBox {
height: 324rpx;
border-radius: 8rpx;
opacity: 1;
background: #ffffffff;
margin-bottom: 24rpx;
padding: 24rpx 24rpx 0 24rpx;
}
/deep/ .u-input {
height: 34rpx
}
</style>