<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: {}
			},
			marketingId: {
				type: [String],
				default: {}
			},
			
		},
		data() {
			return {
				closeShow: false,
			};
		},
		onShow(){
			// this.activity()
		},
		methods: {
			activity() {
				console.log(this.marketingId);
				console.log(this.inviteCode);
			},
			
			//关闭
			close() {
				this.$emit('close')
			},
			
			success(id) {
				this.$emit('success', id)
			},
			
			activityHelp() {
				console.log(this.marketingId);
				console.log(this.inviteCode);
				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
					} 
					this.close()
				})
			}
		},
	}
</script>

<style lang="scss" scoped>

</style>