goodlianjie.vue 2.8 KB
<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>