<template>
	<view>
		<diyC ref="diy" v-if="isDiy" @pullResh="pullResh"></diyC>
	</view>
</template>

<script>
import diyC from './diy/index_mall.vue'
export default {
	data() {
		return {
			isDiy: uni.getStorageSync('is_diy'),
			shareInfo: {}
		}
	},
	components: {
		diyC
	},
	onShow() {
		uni.$on('is_diy', (data) => {
			this.isDiy = data
		})

	},
	onHide() {
		// this.isDiy = -1
	},
	onPullDownRefresh() {
		this.$refs.diy.pullResh();
		// uni.stopPullDownRefresh()
	},
	onLoad(){
		// wx.showShareMenu({
		// 	withShareTicket:true,
		// 	//设置下方的Menus菜单，才能够让发送给朋友与分享到朋友圈两个按钮可以点击
		// 	menus:["shareAppMessage","shareTimeline"]
		// })
	},
	methods: {
	},
	// onReachBottom: function() {
	// 	if (this.isDiy) {
	// 		this.$refs.diy.onsollBotton()
	// 	}
	// },
	//#ifdef MP
	//发送给朋友
	onShareAppMessage: function (option) {
		console.log(option)
		let groupon = option.target.dataset.groupon;
		let userInfo = this.$Cache.get("USER_INFO", true)
		let that = this;
		return {
			title: groupon.mainTitle,
			imageUrl: groupon.shareImage || groupon.slideshow[0],
			path: `/pages/groupbuying_details/index?id=${groupon.id}&selfTakeId=${that.selfTakeId}&organizerUserId=${that.organizerUserId}&inviteUserId=${userInfo.userId}`,
			success(res) {
				uni.showToast({
					title: '分享成功'
				})
			},
			fail(res) {
				uni.showToast({
					title: '分享失败',
					icon: 'none'
				})
			}
		};
	},
	//分享到朋友圈
	// onShareTimeline(option) {
	// 	console.log(option)
	// 	let groupon = option.target.dataset.groupon;
	// 	let userInfo = this.$Cache.get("USER_INFO", true)
	// 	let that = this;
	// 	return {
	// 		title: groupon.shareImage || groupon.slideshow[0],
	// 		imageUrl: groupon.slideshow[0],
	// 		path: `/pages/groupbuying_details/index?id=${groupon.id}&selfTakeId=${that.selfTakeId}&organizerUserId=${that.organizerUserId}&inviteUserId=${userInfo.userId}`,
	// 		success(res) {
	// 			uni.showToast({
	// 				title: '分享成功'
	// 			})
	// 		},
	// 		fail(res) {
	// 			uni.showToast({
	// 				title: '分享失败',
	// 				icon: 'none'
	// 			})
	// 		}
	// 	};
	// },
	//#endif
}
</script>

<style></style>
