goodlianjie.vue
2.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
<template>
<view class="container">
<view class="fuzhi">
<view class="fuzhi">
<text class='step'>第一步</text>
复制口令码
</view>
</view>
<view class='codema'>{{codenumber}}</view>
<view class="copybtn" @click="copy">复制口令码</view>
<view class="fuzhik">
<view class="fuzhi fuzhitwo">
<text class='step steptwo'>第二步</text>
打开{{platform}}点击首页弹窗即可进入
</view>
</view>
<view class="want flextwo">
<view class="goodbox flexone">
<image src="../../static/today.png" mode="" class="todayimg"></image>
<view class="todayname">直播好物推荐</view>
</view>
<!-- <view class="more flexone">
更多
<img src="../../static/yourow.png" alt="" class="yourow">
</view> -->
</view>
<!-- 商品列表 -->
<goodlist :zhigoodlist="zhigoodlist" :notixing="notixing" @tixing='tixing' :dingyuenum="dingyuenum"></goodlist>
</view>
</template>
<script>
import app from "../../App.vue";
import goodlist from "../../compontent/goodlist.vue";
import {
Toast
} from "../../utils/toast.js"
var that
export default {
components: {
goodlist
},
data() {
return {
showpull: true,
page: 1,
zhigoodlist: [],
notixing: '',
codenumber: '',
dingyuenum:[],
platform:'',//平台名字s
}
},
onLoad(options) {
console.log(options)
this.codenumber = options.code;
this.platform=options.platform;
this.getgoodlist()
},
onShow() {
let notixing = uni.getStorageSync("notixing");
this.notixing = notixing;
},
onReachBottom() {
that = this
let newpage = that.page;
newpage++
that.page = newpage;
if (that.showpull == true) {
console.log(38493409)
Toast('没有更多了~')
} else {
that.getgoodlist()
}
},
methods: {
// 接收子组件的值
tixing(e) {
this.zhigoodlist = e
},
// 获取直播好物推荐
getgoodlist() {
let that = this;
var url = "goods/getAnchorTimeGoods"
var param = {
page: 1,
per_page: 20
}
app.post(url, {}, "post").then(res => {
console.log('商品列表', res)
that.zhigoodlist = that.zhigoodlist.concat(res.data);
if (that.page > 1) {
if (res.data.length == 0) {
that.showpull = false
}
}
that.zhigoodlist.forEach(function(value,index,array){
if(value.user_goods==1){
if(that.dingyuenum.indexOf(value.id)==-1){
that.dingyuenum.push(value.id);
that.dingyuenum=that.dingyuenum
}
}
})
}).catch(err => {
console.log(err)
})
},
// 复制到剪贴板
copy() {
uni.setClipboardData({
data: this.codenumber
});
}
}
}
</script>
<style>
@import url("../../style/xinyuan");
.container {
padding: 32rpx;
box-sizing: border-box;
}
</style>