detail.vue
17.8 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
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
<template>
<view class="Detail">
<view class="topbg">
<view class="bgimage">
<u-swiper :list="list1" @change="change" @click="onclick" :height="375"></u-swiper>
</view>
<view class="topmain">
<view class="toptitle">
<view class="money">
<text>¥</text>{{detail.price}}
</view>
<view class="topgroup">
<image src="../../static/heart.png" mode="" v-if="detail.is_fav==0" @click="product_favorite">
</image>
<image src="../../static/1.png" mode="" v-else @click="product_favorite"></image>
<image src="../../static/share.png" @click="shareModel=true" mode=""></image>
<image src="../../static/result.png" mode="" @click="show = true"></image>
</view>
</view>
<view class="topcommit">
{{detail.name}}
</view>
<view class="toptype">
<view class="type">
所属分类:{{detail.sort.name}}
</view>
<view class="time">
发布于:{{detail.publishtime}}
</view>
</view>
</view>
</view>
<view class="mainmiss">
<view class="misstop">
<view class="tip">
</view>
<text>卖家信息</text>
</view>
<view class="missbar flexA">
<view class="name">
姓名
</view>
<view class="namelast">
{{detail.seller_name}}
</view>
</view>
<view class="missbar flexA">
<view class="name">
联系电话:
</view>
<view class="namelast">
{{detail.seller_mobile}}
</view>
<view style=" margin-left:8rpx; font-size: 26rpx; color: deepskyblue;" v-if="detail.seller_mobile">
<a :href="'tel:' + detail.seller_mobile">拨号</a>
</view>
</view>
<view class="missbar flexA">
<view class="name">
钱包地址:
</view>
<view class="namelast">
{{detail.package_add}}
</view>
<view @click="copy(detail.package_add)"
style=" margin-left:8rpx; font-size: 26rpx; color: deepskyblue;">
复制
</view>
</view>
<view class="missbar flexA">
<view class="name">
微信号:
</view>
<view class="namelast">
{{detail.wechat_num}}
</view>
<view @click="copy(detail.wechat_num)" style=" margin-left:8rpx; font-size: 26rpx; color: deepskyblue;">
复制
</view>
</view>
</view>
<view class="contail">
<view class="misstop">
<view class="tip">
</view>
<text>商品详情</text>
</view>
<view class="showcontant">
{{detail.description}}
</view>
</view>
<view class="btn">
<view class="paybtn" :class="detail.status==2?'sold':''" @click="product_buy">
{{detail.status==2?'已售出':'立即购买'}}
</view>
</view>
<!-- <u-picker :show="resurtshow" :columns="columns"></u-picker> -->
<u-popup :show="show" @close="close" @open="open" mode="center" :round="12">
<view class="popshow">
<view class="title">
举报
</view>
<view class="showbar">
<view class="name">
举报原因
</view>
<view class="select" @click.stop="showbox">
<text>{{isshowname}}</text>
<image src="../../static/ic-arrow2.png" mode=""></image>
</view>
</view>
<view class="showarear">
<view class="showtltle">
详细描述
</view>
<view class="showcont">
<textarea name="" v-model="content" id="" cols="30" rows="10" placeholder="请输入"></textarea>
</view>
</view>
<view class="btngroup">
<view class="concle" @click="close">
取消
</view>
<view class="requt" @click="product_report">
提交
</view>
</view>
<view class="boxsel" v-if="isshow">
<scroll-view scroll-y="true" style="200rpx">
<view class="selbar" v-for="(item,index) in range" :key="index"
@click="choosritem(item.name,item.id)">{{item.name}} </view>
</scroll-view>
</view>
</view>
</u-popup>
<image class="goTop" @click="goTop" src="/static/top.png" mode=""></image>
<image class="home" @click="goHome" src="/static/home.png" mode=""></image>
<view class="share" v-if="shareModel" @click="shareModel=false">
<image src="../../static/detailShare.png" mode=""></image>
<view class="">
点击这里进行分享
</view>
</view>
</view>
</template>
<script>
var jweixin = require('jweixin-module');
import {
product_detail,
product_favorite,
report_list,
product_report
} from '@/api/index.js'
import {
toa
} from '@/utils/toast.js'
export default {
data() {
return {
id: "",
String: "",
show: false,
value: 0,
detail: {
sort: {
name: ""
}
},
jssdk: {},
list1: [], //轮播图
range: [{
value: 0,
text: "篮球"
},
{
value: 1,
text: "足球"
},
{
value: 2,
text: "游泳"
},
],
//举报弹窗
isshow: false,
isshowname: "请选择",
isid: "",
content: "",
shareModel: false
}
},
onShow() {
},
onLoad(options) {
this.id = options.id
this.product_detail()
this.report_list()
// console.log(!(uni.getSystemInfoSync().platform == 'android'))
// if (!(uni.getSystemInfoSync().platform == 'android')) {
// if (location.href.indexOf("#reloaded") == -1) {
// location.href = location.href + "#reloaded";
// location.reload();
// }
// }
},
methods: {
onclick(index) {
uni.previewImage({
current: index,
urls: this.list1,
});
},
goTop() {
uni.pageScrollTo({
scrollTop: 0
});
},
//复制
copy(it) {
uni.setClipboardData({
data: it,
success: () => {
uni.showToast({
icon: 'none',
title: '复制成功'
});
}
});
},
goHome() {
uni.reLaunch({
url: '/pages/index/index'
})
},
share() {
let that = this;
jweixin.config({
debug: false, // 开启调试模式,调用的所有api的返回值会在客户端alert出来,若要查看传入的参数,可以在pc端打开,参数信息会通过log打出,仅在pc端时才会打印。
appId: that.jssdk.appId, // 必填,公众号的唯一标识
timestamp: that.jssdk.timestamp, // 必填,生成签名的时间戳
nonceStr: that.jssdk.nonceStr, // 必填,生成签名的随机串
signature: that.jssdk.signature, // 必填,签名
jsApiList: that.jssdk.jsApiList // 必填,需要使用的JS接口列表
})
jweixin.error(function(res) {
console.log(res, '错误')
});
console.log('分享了', that.jssdk.signature);
jweixin.ready(function() {
//分享给朋友
jweixin.onMenuShareAppMessage({
title: that.detail.name, // 分享标题
link: window.location.href, // 分享链接,该链接域名或路径必须与当前页面对应的公众号JS安全域名一致
desc: "【琉璃藏宝阁】数字藏品流转平台,顺利“琉”转,藏品“璃”手",
imgUrl: that.detail.images_preview[0], // 分享图标
success: function() {
// 用户点击了分享后执行的回调函数
uni.showToast({
title: '分享成功',
duration: 2000
});
},
cancel: function(res) {
console.log('取消分享')
}
});
jweixin.updateAppMessageShareData({
title: that.detail.name, // 分享标题
link: window.location.href, // 分享链接,该链接域名或路径必须与当前页面对应的公众号JS安全域名一致
desc: "【琉璃藏宝阁】数字藏品流转平台,顺利“琉”转,藏品“璃”手",
imgUrl: that.detail.images_preview[0], // 分享图标
success: function() {
console.log('设置分享给朋友成功')
},
cancel: function(res) {
console.log('取消分享')
}
});
//分享到朋友圈
jweixin.onMenuShareTimeline({
title: that.detail.name, // 分享标题
link: window.location.href, // 分享链接,该链接域名或路径必须与当前页面对应的公众号JS安全域名一致
desc: "【琉璃藏宝阁】数字藏品流转平台,顺利“琉”转,藏品“璃”手",
imgUrl: that.detail.images_preview[0], // 分享图标
success: function() {
// 用户点击了分享后执行的回调函数
uni.showToast({
title: '分享成功',
duration: 2000
});
},
cancel: function(res) {
console.log('取消分享')
}
});
jweixin.updateTimelineShareData({
title: that.detail.name, // 分享标题
link: window.location.href, // 分享链接,该链接域名或路径必须与当前页面对应的公众号JS安全域名一致
desc: "【琉璃藏宝阁】数字藏品流转平台,顺利“琉”转,藏品“璃”手",
imgUrl: that.detail.images_preview[0], // 分享图标
success: function() {
console.log('设置分享到朋友圈成功')
},
cancel: function(res) {
console.log('取消分享')
}
});
});
},
showbox() {
this.isshow = !this.isshow
},
open() {},
close() {
this.show = false
},
change(e) {
// console.log("e:", e);
},
//选中效果
choosritem(name, id) {
this.isshowname = name
this.isid = id
this.isshow = false
},
// 举报原因
async report_list() {
try {
const res = await report_list()
console.log('report_list', res)
this.range = res.list
// 保存数据
} catch (err) {
uni.showToast({
title: err,
icon: 'none'
})
console.log('report_list', err)
}
},
// 举报
async product_report() {
if (!this.isid) return toa.toast('请选择举报原因')
if (!this.content) return toa.toast('请填写举报信息')
let obj = {
product_id: this.id,
report_id: this.isid,
content: this.content,
}
try {
const res = await product_report(obj)
console.log('product_report', res)
toa.toast('举报成功')
this.show = false
// 保存数据
} catch (err) {
uni.showToast({
title: err,
icon: 'none'
})
console.log('product_report', err)
}
},
//收藏、取消收藏
async product_favorite() {
try {
const res = await product_favorite(this.id)
console.log('product_favorite', res)
this.product_detail()
// 保存数据
} catch (err) {
uni.showToast({
title: err,
icon: 'none'
})
console.log('product_favorite', err)
}
},
//详情
async product_detail() {
try {
const res = await product_detail(this.id, window.location.href)
console.log('product_detail', res)
this.detail = res.detail
this.jssdk = res.jssdk
this.list1 = res.detail.images_preview
this.share()
// 保存数据
} catch (err) {
uni.showToast({
title: err,
icon: 'none'
})
console.log('product_detail', err)
}
},
//下单跳转
async product_buy() {
if (this.detail.status == 2) return
uni.navigateTo({
url: "/pages/index/buy?id=" + this.id
})
},
},
}
</script>
<style lang="scss">
page {
background-color: #f0f0f0;
}
.Detail {
padding-bottom: 160rpx;
.topbg {
.bgimage {
width: 750rpx;
height: 750rpx;
}
.topmain {
padding: 32rpx;
background-color: #ffffff;
.toptitle {
display: flex;
align-items: center;
justify-content: space-between;
.money {
font-size: 52rpx;
font-weight: 500;
font-family: "PingFang SC";
color: rgba(248, 83, 23, 1);
text {
color: rgba(248, 83, 23, 1);
font-size: 32rpx;
font-weight: 500;
font-family: "PingFang SC";
}
}
.topgroup {
display: flex;
align-items: center;
image {
margin-right: 32rpx;
width: 40rpx;
height: 40rpx;
}
}
}
.topcommit {
margin-top: 16rpx;
color: rgba(0, 0, 0, 1);
font-size: 36rpx;
font-weight: 600;
font-family: "PingFang SC";
text-align: left;
}
.toptype {
margin-top: 24rpx;
display: flex;
align-items: center;
color: rgba(0, 0, 0, 0.4);
font-size: 26rpx;
font-weight: 400;
font-family: "PingFang SC";
justify-content: space-between;
}
}
}
.mainmiss {
margin-top: 24rpx;
background-color: #ffffff;
border-radius: 24rpx;
padding: 32rpx;
box-sizing: border-box;
.misstop {
display: flex;
align-items: center;
color: rgba(0, 0, 0, 0.9);
font-size: 32rpx;
font-weight: 600;
font-family: "PingFang SC";
.tip {
margin-right: 8rpx;
width: 4rpx;
height: 24rpx;
border-radius: 18rpx;
opacity: 1;
background: rgba(254, 208, 0, 1);
}
}
.showcontant {
margin-top: 24rpx;
color: rgba(0, 0, 0, 0.4);
font-size: 24rpx;
font-weight: 400;
font-family: "PingFang SC";
}
.missbar {
margin-top: 24rpx;
.name {
color: rgba(0, 0, 0, 0.6);
font-size: 28rpx;
font-weight: 400;
font-family: "PingFang SC";
width: 168rpx;
}
.namelast {
width: 420rpx;
word-break: break-all;
color: rgba(0, 0, 0, 1);
font-size: 28rpx;
font-weight: 400;
font-family: "PingFang SC";
}
a {
text-decoration: none;
color: deepskyblue;
}
}
}
.contail {
margin-top: 24rpx;
background-color: #ffffff;
border-radius: 24rpx;
padding: 32rpx;
box-sizing: border-box;
white-space: pre-wrap;
.misstop {
display: flex;
align-items: center;
color: rgba(0, 0, 0, 0.9);
font-size: 32rpx;
font-weight: 600;
font-family: "PingFang SC";
.tip {
margin-right: 8rpx;
width: 4rpx;
height: 24rpx;
border-radius: 18rpx;
opacity: 1;
background: rgba(254, 208, 0, 1);
}
}
}
.btn {
position: fixed;
bottom: 0;
left: 0;
width: 100%;
height: 128rpx;
padding: 16rpx 32rpx;
box-sizing: border-box;
opacity: 1;
background: rgba(255, 255, 255, 1);
.paybtn {
width: 100%;
height: 96rpx;
line-height: 96rpx;
text-align: center;
border-radius: 28rpx;
opacity: 1;
color: rgba(0, 0, 0, 0.9);
font-size: 32rpx;
font-weight: 600;
font-family: "PingFang SC";
background: linear-gradient(134.8deg, rgba(255, 232, 100, 1) 0%, rgba(255, 216, 0, 1) 100%);
}
}
.popshow {
border-radius: 32rpx;
width: 622rpx;
padding: 48rpx;
box-sizing: border-box;
.title {
color: rgba(0, 0, 0, 1);
font-size: 28rpx;
font-weight: 600;
font-family: "PingFang SC";
text-align: center;
}
.showbar {
padding: 24rpx 0;
display: flex;
align-items: center;
justify-content: space-between;
box-sizing: border-box;
border-bottom: 1px solid #f0f0f0;
color: rgba(0, 0, 0, 0.9);
font-size: 28rpx;
font-weight: 400;
.name {
font-family: "PingFang SC";
}
.select {
display: flex;
align-items: center;
image {
width: 24rpx;
height: 16rpx;
}
}
}
.showarear {
text-align: left;
.showtltle {
margin-top: 32rpx;
color: rgba(0, 0, 0, 1);
font-size: 28rpx;
font-weight: 400;
font-family: "PingFang SC";
}
.showcont {
color: rgba(0, 0, 0, 0.4);
font-size: 24rpx;
font-weight: 400;
font-family: "PingFang SC";
text-align: left;
}
textarea {
margin-top: 12rpx;
box-sizing: border-box;
padding: 24rpx;
width: 526rpx;
height: 252rpx;
border: 2rpx solid rgba(0.9407999515533447, 0.9475764036178589, 0.9599999785423279, .1);
}
}
.btngroup {
margin-top: 80rpx;
display: flex;
align-items: center;
justify-content: space-between;
.concle {
width: 240rpx;
height: 76rpx;
border-radius: 16rpx;
opacity: 1;
line-height: 76rpx;
color: rgba(0, 0, 0, 0.9);
font-size: 28rpx;
font-weight: 500;
font-family: "PingFang SC";
text-align: center;
background: rgba(246, 246, 246, 1);
}
.requt {
width: 240rpx;
height: 76rpx;
color: rgba(0, 0, 0, 0.9);
font-size: 28rpx;
font-weight: 500;
font-family: "PingFang SC";
text-align: center;
line-height: 76rpx;
border-radius: 16rpx;
opacity: 1;
background: rgba(254, 208, 0, 1);
}
}
.boxsel {
position: absolute;
top: 75px;
right: 26px;
border: 1px solid #f0f0f0;
padding: 6px;
color: rgba(0, 0, 0, 1);
font-size: 24rpx;
font-weight: 400;
background-color: #ffffff;
.selbar {
padding: 6px;
}
}
}
}
.share {
position: fixed;
left: 0;
top: 0;
width: 100%;
height: 100%;
background: rgba(0, 0, 0, .6);
image {
position: fixed;
right: 80rpx;
top: 4rpx;
width: 188rpx;
height: 262rpx;
}
view {
position: fixed;
right: 80rpx;
top: 300rpx;
color: rgba(255, 255, 255, 1);
font-size: 36rpx;
font-weight: 700;
}
}
.home {
width: 96rpx;
height: 96rpx;
position: fixed;
right: 28rpx;
bottom: 320rpx;
}
.goTop {
width: 96rpx;
height: 96rpx;
position: fixed;
right: 28rpx;
bottom: 186rpx;
}
.sold {
background: rgba(0, 0, 0, .2) !important;
}
</style>