<template>
	<view>
		<!-- 确认助力 -->
		<u-popup :show="activityShow" mode="center" round="17" @close="close" :closeable="true" overlayOpacity="0.5" @touchmove.prevent.stop>
			<view class="choiceShow-wrap">
				<view style="width: 400rpx; height: 400rpx;line-height: 400rpx; text-align: center;">
					是否帮好友助力
				</view>
				<button @click="activityHelp()">确定助力</button>
			</view>
		</u-popup>
		<!-- 助力成功 -->
		<u-popup :show="closeShow" mode="center" round="17" @close="close" :closeable="true" overlayOpacity="0.5" @touchmove.prevent.stop>
			<view class="choiceShow-wrap">
				<view style="width: 400rpx; height: 400rpx;line-height: 400rpx; text-align: center;">
					助力成功
				</view>
				<button @click="close()">取消</button>
			</view>
		</u-popup>
	</view>
</template>

<script>
	import env from '../../config/env.js'
	import $http from '@/utils/request.js'
	export default {
		name:"activity-help",
		props: {
			//显示与隐藏
			activityShow: {
				type: [Boolean],
				default: false
			},
			//邀请码
			inviteCode: {
				type: [String],
				default: {}
			},
			//活动id
			marketingId: {
				type: [String],
				default: {}
			},
			
		},
		data() {
			return {
				closeShow: false,//邀请助力成功隐藏
			};
		},
		methods: {
			//关闭
			close() {
				this.$emit('close')
			},
			//确定助力
			activityHelp() {
				uni.showLoading({
					title: '助力中'
				});
				$http.post('/api/v1/mp/user/marketing/help', {
					inviteCode: this.inviteCode,
					marketingId: this.marketingId
				}).then(res => {
					uni.hideLoading();
					if(res.code == 0){
						this.closeShow = true
					} else if(res.code == 500){
						uni.$u.toast(res.msg);
						this.close()
					}else {
					}
				})
			}
		},
	}
</script>

<style lang="scss" scoped>

</style>