shopdetail.vue
10.7 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
<template>
<view clas="content ">
<view class="shopdetailtop flextwo boxsizing">
<view class="nearitem flexfour">
<view class="nearitemimg">
<image src="../../static/doorin.png" mode=""></image>
</view>
<view class="nearitemname">室外温度</view>
<view class="neardoor">12℃</view>
</view>
<view class="nearitem flexfour">
<view class="nearitemimg">
<image src="../../static/doorin.png" mode=""></image>
</view>
<view class="nearitemname">室内温度</view>
<view class="neardoor">{{shopdetail.temperature}}℃</view>
</view>
<view class="nearitem flexfour">
<view class="nearitemimg">
<image src="../../static/doorin.png" mode=""></image>
</view>
<view class="nearitemname">室内湿度</view>
<view class="neardoor">{{shopdetail.humidity}}%RH</view>
</view>
<view class="nearitem flexfour" @click="shopcomment">
<view class="nearitemimg">
<image src="../../static/doorin.png" mode=""></image>
</view>
<view class="nearitemname">店铺评价</view>
<view class="neardoor" style="height:45rpx;"></view>
</view>
</view>
<view class="detailgood boxsizing flexone" v-if="shexianglist.length!=0">
<view class="detailgooditem" v-for="(item,index) in shexianglist" :key="index" @click="gojiankong(item)">
<image :src="item.image" mode=""></image>
<view class="goodbot flextwo boxsizing">
<view class="goodbotleft">
<image src="../../static/openkai.png" mode=""></image>
</view>
<view class="goodbotleft">
<image src="../../static/play.png" mode=""></image>
</view>
</view>
</view>
<!-- <view class="detailgooditem">
<image src="../../static/shopdetailtop.png" mode=""></image>
<view class="goodbot flextwo boxsizing">
<view class="goodbotleft">
<image src="../../static/openkai.png" mode=""></image>
</view>
<view class="goodbotleft">
<image src="../../static/play.png" mode=""></image>
</view>
</view>
</view>
<view class="detailgooditem">
<image src="../../static/shopdetailtop.png" mode=""></image>
<view class="goodbot flextwo boxsizing">
<view class="goodbotleft">
<image src="../../static/openkai.png" mode=""></image>
</view>
<view class="goodbotleft">
<image src="../../static/play.png" mode=""></image>
</view>
</view>
</view>
<view class="detailgooditem">
<image src="../../static/shopdetailtop.png" mode=""></image>
<view class="goodbot flextwo boxsizing">
<view class="goodbotleft">
<image src="../../static/openkai.png" mode=""></image>
</view>
<view class="goodbotleft">
<image src="../../static/play.png" mode=""></image>
</view>
</view>
</view>
-->
</view>
<view class="addressbox boxsizing">
<view class="addressname">{{shopdetail.name}}</view>
<view class="addressin">
<view class="addressimitem flextwo boxsizing">
<view class="addressinleft flexone">
<view class="addressimg">
<image src="../../static/userpeople.png" mode=""></image>
</view>
<view class="peoplename">{{shopdetail.contact}}</view>
</view>
<view class="collect flexone" v-if="shopdetail.is_collect==2" @click="collet">
<view class="collectimg">
<image src="../../static/collect.png" mode=""></image>
</view>
<view class="collectname">收藏</view>
</view>
<view class="collect flexone yicollect" v-else @click="collet">
<view class="collectimg">
<image src="../../static/yicollect.png" mode=""></image>
</view>
<view class="collectname yiname">取消收藏</view>
</view>
</view>
</view>
<view class="addressin">
<view class="addressimitem boxsizing flexone">
<view class="addressinleft flexone">
<view class="addressimg">
<image src="../../static/phonepeople.png" mode=""></image>
</view>
<view class="peoplename mobilename">{{shopdetail.mobile}}</view>
</view>
<view class="phoneplay" @click="phone">拨号</view>
</view>
</view>
<view class="addressin">
<view class="addressimitem boxsizing flexone">
<view class="addressinleft flexone" >
<view class="addressimg">
<image src="../../static/addresspeope.png" mode=""></image>
</view>
<view class="peoplename">
{{shopdetail.province_name}}{{shopdetail.city_name}}{{shopdetail.county_name}}{{shopdetail.address}}
<text class="phoneplay" @click="choseaddress" style="margin-left:20rpx;padding: 0 10rpx;box-sizing: border-box;">导航</text>
</view>
</view>
</view>
</view>
</view>
<view class="tapnav flextwo">
<view class="tapnavitem" :class="order==0?'tapnavactive':''" @click="kindlist" :data-id="0">分类</view>
<view class="tapnavitem" :class="order==1?'tapnavactive':''" @click="orderrange" :data-id="1">综合</view>
<view class="tapnavitem" :class="order==2?'tapnavactive':''" @click="orderrange" :data-id="2">销量</view>
<view class="tapnavitem flexone" :class="order==3||order==4?'tapnavactive':''" @click="selprice">
<view class="tapprice">价格</view>
<view class="tapbox flexfour">
<view class="tapboxtop">
<image src="../../static/shangsan.png" mode="" v-if="order==3"></image>
<image src="../../static/toprow.png" mode="" v-else></image>
</view>
<view class="tapboxtop">
<image src="../../static/xiasan.png" mode="" v-if="order==4"></image>
<image src="../../static/xiarow.png" mode="" v-else></image>
</view>
</view>
</view>
</view>
<view class="homeshoplist flexone goodboxlist">
<view class="homeshopitem goodboxitem" v-for="(item,index) in goodlist" :key="index" @click="goodtail" :data-id="item.id">
<view class="gooditemimg goodboximg">
<image :src="item.image" mode=""></image>
<view class="sale boxsale">已售{{item.sales}}件</view>
</view>
<view class="goodname hidden boxgoodname">{{item.name}}</view>
<view class="saleprice">¥{{item.price}}</view>
<!-- <view class="flextwo">
<view class="huiyuanprice dikou">抵扣:¥200</view>
<view class="goodshou">已售76</view>
</view> -->
</view>
</view>
</view>
</template>
<script>
import app from "../../App.vue";
export default {
data() {
return {
showbanben: false,
store_id: '',
shopdetail: '',
order: '',
page: 1,
score_category_id: '',
goodlist: [],
shexianglist: []
}
},
onLoad(options) {
console.log(options)
this.store_id = options.shopid,
// 获取店铺详情
this.getshopdetail();
// 获取店铺列表
this.getgoodlist();
// 获取监控列表
this.getjiankonglist()
},
methods: {
// 选择店铺位置
choseaddress() {
console.log(this.shopdetail.latitude);
console.log(this.shopdetail.longitude)
uni.openLocation({
latitude: Number(this.shopdetail.latitude),
longitude: Number(this.shopdetail.longitude),
name:this.shopdetail.name,
address:this.shopdetail.address,
success: function() {
console.log('success');
}
});
},
// 店铺评分
shopcomment() {
uni.navigateTo({
url: '/pages/nearshop/shopcomment?store_id=' + this.store_id
})
},
//获取监控列表
getjiankonglist() {
let that = this;
var url = 'store/get_store_camera';
var params = {
store_id: that.store_id,
}
console.log('参数', params)
app.post(url, params, "post").then((res) => {
console.log(res);
that.shexianglist = res.data.data
}).catch((err) => {
console.log(err)
})
},
// 去监控页面
gojiankong(item) {
uni.navigateTo({
url: "/pages/nearshop/jiankong?src=" + item.url
})
},
// 拨打电话
phone(item) {
uni.makePhoneCall({
phoneNumber: this.shopdetail.mobile //仅为示例
});
},
// 分类
kindlist(e) {
this.order = e.currentTarget.dataset.id;
uni.setStorageSync("selectId", "")
uni.navigateTo({
url: '/pages/homepage/goodkind'
})
},
// 排序
orderrange(e) {
this.order = e.currentTarget.dataset.id;
this.goodlist = [],
this.page = 1;
this.getgoodlist();
},
selprice() {
this.price = !this.price;
if (this.price == true) {
this.order = 3;
} else {
this.order = 4;
}
this.goodlist = [],
this.page = 1;
this.getgoodlist();
},
// 获取店铺详情
getshopdetail() {
let that = this;
var url = 'store/get_store_detail';
var params = {
store_id: that.store_id,
}
console.log('参数diandiandain', params)
app.post(url, params, "post").then((res) => {
console.log('我是商品详情',res);
that.shopdetail = res.data.data
}).catch((err) => {
console.log(err)
})
},
// 收藏和取消收藏
collet() {
let that = this;
var url = 'store/collect';
var params = {
store_id: that.store_id,
}
console.log('参数', params)
app.post(url, params, "post").then((res) => {
if (that.shopdetail.is_collect == 2) {
uni.showToast({
title: '收藏成功',
icon: "none"
})
that.shopdetail.is_collect = 1
} else {
uni.showToast({
title: '取消收藏成功',
icon: "none"
})
that.shopdetail.is_collect = 2
}
that.shopdetail = that.shopdetail;
console.log(res);
// that.shopdetail = res.data.data
}).catch((err) => {
console.log(err)
})
},
// 获取商品列表
getgoodlist() {
let that = this;
var url = 'store_goods/get_store_goods';
var params = {
store_id: that.store_id,
store_category_id: that.store_category_id,
order: that.order,
page: that.page,
pageNum: 10
}
console.log('参数', params)
app.post(url, params, "post").then((res) => {
console.log(res);
that.goodlist = that.goodlist.concat(res.data.data);
console.log(that.goodlist)
}).catch((err) => {
console.log(err)
})
},
// 进入商品详情页
goodtail(e) {
let id = e.currentTarget.dataset.id;
console.log(this.shopdetail)
let obj = {
free_postage: this.shopdetail.free_postage,
postage: this.shopdetail.postage
}
console.log(obj)
obj = JSON.stringify(obj)
// type 1 面访商品 2积分商城商品
uni.navigateTo({
url: '/pages/nearshop/goodtail?id=' + id + '&type=' + 3 + '&obj=' + obj
})
}
},
onShow() {
this.score_category_id = uni.getStorageSync("selectId") != '' ? uni.getStorageSync("selectId") : ''
this.shoplist = [];
this.page = 1;
}
}
</script>
<style>
@import url('../../base/nearshop');
@import url('../../base/homepage');
.mobilename {
margin-right: 10rpx;
}
</style>