<template>
	<view class="page">

		<view class="list_info">
			<view class="item">
				<view class="avator">
					<image class="icon" :src="info.image" mode="aspectFill">
					</image>
				</view>
				<view class="tit">
					<view class="name">{{info.name}}</view>
					<view class="desc" v-if="false">市场价：¥{{info.price}}</view>
				</view>
				<view class="jindu">
					<view class="bord">
						<view class="active" :style="'width:' + info.num_bfb + '%;'"></view>
					</view>
					<text class="tips">{{info.num_bfb}}%</text>
				</view>
				<view class="title">助力好友</view>
				<view class="list_mem">
					<view class="mem" v-for="(item,index) in info.mem_list">
						<image class="icon" :src="item.avator" mode="aspectFill" />
						<text>{{item.nickname}}</text>
					</view>
				</view>
				<view class="btnList">
					<view class="btn_submit1" @click="goDetail()">我也要许愿</view>
					<view class="btn_submit" @click="goZuli()">助力</view>
				</view>
			</view>

			<view class="blankHeight"></view>
		</view>

		<DialogBox ref="DialogBox"></DialogBox>
		<ToastW3 ref="ToastW3"></ToastW3>
	</view>
</template>

<script>
	export default {
		components: {},
		data() {
			return {
				tab: 1,
				scrollTop: 0,
				old: {
					scrollTop: 0
				},
				info: {}
			}
		},
		onLoad(parms) {
			this.id = parms.id || 16
			// setTimeout(function() {
			// 	uni.setNavigationBarColor({
			// 		frontColor: '#ffffff',
			// 		backgroundColor: '#00000000',
			// 		animation: {
			// 			duration: 400,
			// 			timingFunc: 'easeIn'
			// 		}
			// 	})
			// }, 200);
		},
		onShow() {
			this.loadData();
		},
		methods: {
			onBack() {},
			checkTab(tab) {
				this.tab = tab;
				// this.loadData();
			},
			scroll: function(e) {
				console.log(e)
				this.old.scrollTop = e.detail.scrollTop
			},
			goDetail() {
				uni.navigateTo({
					url: '/pages/my/wishDetail?id=' + this.info.id,
				})
			},
			goZuli() {
				let that = this;
				this.$refs['DialogBox'].confirm({
					title: '助力心愿',
					content: '是否消耗10M币为TA助力心愿',
					DialogType: 'inquiry',
					btn1: '否',
					btn2: '是',
					animation: 0
				}).then((res) => {
					uni.request({
						url: this.$apiHost + "/Wish/helpTA",
						data: {
							uuid: getApp().globalData.uuid,
							myid: this.info.myid
						},
						header: {
							"content-type": "application/json",
							'sign': getApp().globalData.headerSign
						},
						success: (res) => {
							console.log("----", res.data.list);
							// uni.showToast({
							// 	title: res.data.str,
							// 	icon: 'none'
							// })
							that.$refs['ToastW3'].showToast({
								title: res.data.str,
								animation: 0
							});
							if (res.data.success == "yes") {
								that.loadData()
							}
						},
						complete: (com) => {
							uni.hideLoading();
						},
					});
				})
			},
			loadData() {
				uni.request({
					url: this.$apiHost + '/Wish/getMyInfo',
					data: {
						uuid: getApp().globalData.uuid,
						id: this.id,
					},
					header: {
						'content-type': 'application/json',
						'sign': getApp().globalData.headerSign
					},
					success: (res) => {
						console.log("res", res.data)
						this.info = res.data.info;
					}
				});
			},
		}
	}
</script>

<style scoped lang="scss">
	@import 'wishHelp.scss';
</style>