<template>
	<view class="page">
		<!-- <dpupop :show="showLsPop" dtitle="LS会员标签" /> -->

		<view class="top"
			:style="{background: `url(${ defBg?picBase+defBg:picUrl+'/static/other/inviteBg.jpg'}) no-repeat;`}">
			<navBar title="" :back="true" color="white" background="rgba(0,0,0,0)" />

			<view class="title">
				{{type=='vip'?'邀约用户成为VIP':type=='ls'?'邀约用户成为L会员':type=='dg'?'邀约用户成为产业电工':type=='hy'?'邀约用户成为会员':'邀约活动用户'}}
			</view>
			<view class="vipBox">
				<view class="top">
					<view class="txt">
						{{type=='vip'?'CUSTOMIZED LIGHTING':type=='ls'?'CUSTOMIZED LIGHTING':type=='dg'?'CUSTOMIZED LIGHTING':'CUSTOMIZED LIGHTING'}}
					</view>
					<view class="con">
						{{type=='vip'?'邀约VIP':type=='ls'?'邀约L会员':type=='dg'?'邀约电工':type=='hy'?'邀约会员':'活动商品'}}
					</view>
				</view>
				<view class="bot">
					<view class="price">
						{{type=='vip'?'邀约用户查看VIP价':type=='ls'?'邀约用户临时查看会员价格':type=='dg'?'邀约用户成为产业电工':type=='hy'?'邀约用户查看会员价格':'邀约用户查看团购活动商品'}}
					</view>
					<view class="btnG" v-if="type=='vip'">
						<view class="main">
							<view class="btn" @click="showBox('vip',1)" v-if="!inviteSvipSuc">
								邀约S-VIP
							</view>
							<button open-type="share" class="btn" v-else>
								分享
							</button>
							<view class="btn" @click="showBox('vip',0)" v-if="!inviteGvipSuc">
								邀约G-VIP
							</view>
							<button open-type="share" class="btn" v-else>
								分享
							</button>
						</view>
						<image :src="picUrl+'/static/other/inviteW.png'" mode="" class="water" style="width: 288rpx;
height: 140rpx;"></image>

					</view>
					<view class="btnG" v-else-if="type=='ls'">
						<view class="main">
							<button open-type="share" class="btn1" v-if="showLshareBtn">
								分享
							</button>
							<view class="btn1" @click="showBox('ls')" v-else>
								邀约L会员
							</view>
						</view>
						<image :src="picUrl+'/static/other/inviteW.png'" mode="" class="water" style="width: 288rpx;
						height: 140rpx;"></image>
					</view>

					<view class="btnG" v-else-if="type=='dg'">
						<view class="main">
							<button open-type="share" class="btn1" v-if="showDgshareBtn">
								分享
							</button>
							<view class="btn1" @click="showBox('dg')" v-else>
								邀约电工
							</view>
						</view>
						<image :src="picUrl+'/static/other/inviteW.png'" mode="" class="water" style="width: 288rpx;
					height: 140rpx;"></image>

					</view>

					<view class="btnG" v-if="type=='yh'">
						<view class="main">
							<button open-type="share" class="btn1" v-if="showYhshareBtn">
								分享
							</button>
							<view class="btn1" v-else @click="showBox('yh')">
								邀约活动用户
							</view>
						</view>
						<image :src="picUrl+'/static/other/inviteW.png'" mode="" class="water" style="width: 288rpx;
						height: 140rpx;"></image>

					</view>

					<view class="btnG" v-if="type=='hy'">
						<view class="main">
							<button open-type="share" class="btn1" v-if="showHyshareBtn">
								分享
							</button>
							<view class="btn1" @click="showBox('hy')" v-else>
								邀约会员
							</view>
						</view>
						<image :src="picUrl+'/static/other/inviteW.png'" mode="" class="water" style="width: 288rpx;
						height: 140rpx;"></image>

					</view>
				</view>
			</view>
		</view>

		<view class="botDes">
			<view class="tab">
				<view class="item " :class="[currTabIndex==0?'act':'']" @click="currTabIndex=0">
					邀约成功({{sucList.length}})
				</view>
				<view class="line">

				</view>
				<view class="item" :class="[currTabIndex==1?'act':'']" @click="currTabIndex=1">
					邀约未成功({{failList.length}})
				</view>
			</view>

			<!-- 提交邀约申请成功，请点击上方分享按钮分享至微信 -->
			<view class="scroll" style="overflow-y: scroll;height: calc(100% - 104rpx + 36rpx);" v-if="currTabIndex==0">
				<view class="top1">
					<view class="titleL">
						<view class="item1">
							邀约时间
						</view>
						<view class="item1">
							姓名
						</view>
						<view class="item1">
							电话
						</view>
					</view>
				</view>

				<uni-collapse style="" v-if="type=='vip'||type=='ls'||type=='hy'">
					<uni-collapse-item titleBorder="none" v-for="(item,index) in sucList">
						<template v-slot:title>
							<view class="list2" :style="{'margin-bottom':index==-1?'208rpx':''}">
								<view class="item1">
									{{item.invite_time}}
								</view>
								<view class="item1">
									{{item.name}}
								</view>
								<view class="item1">
									<text>{{item.phone}}</text>
								</view>
							</view>
						</template>
						<view class="card">
							<view class="con" v-if="type=='vip'">
								<view class="item">
									<view class="label">
										任职公司
									</view>
									<view class="des">
										{{item.company?item.company:'暂无'}}
									</view>
								</view>
								<view class="item">
									<view class="label">
										VIP
									</view>
									<view class="des">
										{{item.status}}
									</view>
								</view>
								<view class="item">
									<view class="label">
										备注
									</view>
									<view class="des">
										{{item.remark?item.remark:'暂无'}}
									</view>
								</view>
							</view>

							<view class="con" v-if="type=='ls'||type=='hy'" style="height: 84rpx;">
								<view class="item">
									<view class="label">
										项目名称
									</view>
									<view class="des" style="color: #333;font-weight: bold;">
										{{item.project_name?item.project_name:'暂无'}}
									</view>
								</view>
							</view>
						</view>
					</uni-collapse-item>
				</uni-collapse>

				<view class="list2" :style="{'margin-bottom':index==-1?'208rpx':''}" v-else
					v-for="(item,index) in sucList">
					<view class="item1">
						{{item.invite_time}}
					</view>
					<view class="item1">
						{{item.name}}
					</view>
					<view class="item1">
						<text>{{item.phone}}</text>
					</view>
				</view>
				<u-loadmore v-if="sucList.length!=0" style="" status="false" nomoreText="已经到底啦" color="#CCCCCC"
					lineColor="#CCCCCC" line />
				<view class="pos" style="height:50rpx;">
				</view>

			</view>


			<!--  邀约失败 -->
			<view class="scroll" style="overflow-y: scroll;height: calc(100% - 104rpx + 36rpx);" v-if="currTabIndex==1">
				<view class="top1">
					<view class="titleL">
						<view class="item1" style="width: 192rpx;font-size: 28rpx;font-weight: bold;color: #333333;">
							邀约时间
						</view>
						<view class="item1" style="width: 90rpx;font-size: 28rpx;font-weight: bold;color: #333333;">
							姓名
						</view>
						<view class="item1"
							style="width: 120rpx;font-size: 28rpx;margin-left: 60rpx;font-weight: bold;color: #333333;">
							VIP类别
						</view>
					</view>
				</view>


				<view class="list2" :style="{'margin-bottom':index==-1?'208rpx':''}" v-for="(item,index) in failList">
					<view class="item1" style="width: 192rpx;font-size: 28rpx;">
						{{item.invite_time}}
					</view>
					<view class="item1 nextLine" style="width: 130rpx;font-size: 28rpx;margin-left: 0rpx;">
						{{item.name}}
					</view>
					<view class="item1" style="width: 120rpx;font-size: 28rpx;margin-left:30rpx;">
						<text>{{item.status}}</text>
					</view>

					<view class="item1 aginInvite" style="width: 120rpx;font-size: 28rpx;margin-left: 50rpx;"
						@click="secondInvite(item)">
						再次邀约
					</view>
				</view>
				<u-loadmore v-if="failList.length!=0" style="" status="false" nomoreText="已经到底啦" color="#CCCCCC"
					lineColor="#CCCCCC" line />
				<view class="pos" style="height:50rpx;">
				</view>

			</view>
		</view>

		<u-popup :show="showLsPop" @close="close" @open="open" round='10'>
			<view class="topBar" style="">
				<view class="left">

				</view>
				<view class="cen">
					L会员标签
				</view>
				<view class="close" @click="showLsPop=false">
					<u-icon name="close"></u-icon>
				</view>
			</view>
			<view class="pupopCon">
				<view class="item">
					<view class="label">
						*姓名
					</view>
					<u--input clearable placeholder="请输入姓名" border="surround" v-model="l_xm"
						@change="change"></u--input>
				</view>
				<view class="item">
					<view class="label">
						*电话
					</view>
					<u--input clearable placeholder="请输入电话" border="surround" v-model="l_dh"
						@change="change"></u--input>
				</view>
				<view class="item" style="margin-bottom: 24rpx;">
					<view class="label">
						项目名称
					</view>
					<u--input clearable placeholder="请输入项目名称" border="surround" v-model="l_xmmc"
						@change="change"></u--input>
				</view>
				<button open-type="share" class="orderBtn" :plain="true">
					确定
				</button>
			</view>
		</u-popup>

		<u-popup :show="showYhPop" @close="close" @open="open" round='10'>
			<view class="topBar" style="">
				<view class="left">

				</view>
				<view class="cen">
					活动用户
				</view>
				<view class="close" @click="showYhPop=false">
					<u-icon name="close"></u-icon>
				</view>
			</view>
			<view class="pupopCon">
				<view class="item">
					<view class="label">
						*姓名
					</view>
					<u--input clearable placeholder="请输入姓名" border="surround" v-model="y_xm"
						@change="change"></u--input>
				</view>
				<view class="item">
					<view class="label">
						*电话
					</view>
					<u--input clearable placeholder="请输入电话" border="surround" v-model="y_dh"
						@change="change"></u--input>
				</view>
				<!-- <view class="item" style="margin-bottom: 24rpx;">
					<view class="label">
						项目名称
					</view>
					<u--input clearable placeholder="请输入项目名称" border="surround" v-model="l_xmmc"
						@change="change"></u--input>
				</view> -->
				<button open-type="share" class="orderBtn" :plain="true">
					确定
				</button>
			</view>
		</u-popup>

		<u-popup :show="showHyPop" @close="close" @open="open" round='10'>
			<view class="topBar" style="">
				<view class="left">

				</view>
				<view class="cen">
					会员标签
				</view>
				<view class="close" @click="showHyPop=false">
					<u-icon name="close"></u-icon>
				</view>
			</view>
			<view class="pupopCon">
				<view class="item">
					<view class="label">
						*姓名
					</view>
					<u--input clearable placeholder="请输入姓名" border="surround" v-model="h_xm"
						@change="change"></u--input>
				</view>
				<view class="item">
					<view class="label">
						*电话
					</view>
					<u--input clearable placeholder="请输入电话" border="surround" v-model="h_dh"
						@change="change"></u--input>
				</view>
				<view class="item" style="margin-bottom: 24rpx;">
					<view class="label">
						项目名称
					</view>
					<u--input clearable placeholder="请输入项目名称" border="surround" v-model="h_xmmc"
						@change="change"></u--input>
				</view>
				<button open-type="share" class="orderBtn" :plain="true">
					确定
				</button>
			</view>
		</u-popup>

		<u-popup :show="showDgPop" @close="close" @open="open" round='10'>
			<view class="topBar" style="">
				<view class="left">
				</view>
				<view class="cen">
					产业电工
				</view>
				<view class="close" @click="showDgPop=false">
					<u-icon name="close"></u-icon>
				</view>
			</view>
			<view class="pupopCon">
				<view class="item">
					<view class="label">
						*姓名
					</view>
					<u--input clearable placeholder="请输入姓名" border="surround" v-model="d_xm"
						@change="change"></u--input>
				</view>
				<view class="item">
					<view class="label">
						*电话
					</view>
					<u--input clearable placeholder="请输入电话" border="surround" v-model="d_dh"
						@change="change"></u--input>
				</view>

				<view class="item">
					<view class="label">
						*来源
					</view>
					<uni-data-select placeholder="请选择来源" v-model="d_ly" :localdata="range3"
						@change="change3"></uni-data-select>
				</view>

				<view class="item" style="margin-bottom: 24rpx;height: auto;">
					<view class="label">
						兑奖信息
					</view>
					<u--textarea v-model="d_djxx" placeholder="请输入兑奖信息"></u--textarea>
				</view>

				<!-- <u-button text="确定" color="#333" @click="inviteDgVip(item)"></u-button> -->
				<button open-type="share" class="orderBtn" :plain="true">
					确定
				</button>
			</view>
		</u-popup>

		<u-popup :show="showVipPop" @close="close" @open="open" round='10'>
			<view class="topBar" style="">
				<view class="left">

				</view>
				<view class="cen">
					VIP标签
				</view>
				<view class="close" @click="showVipPop=false">
					<u-icon name="close"></u-icon>
				</view>
			</view>
			<view class="pupopCon">
				<view class="item">
					<view class="label">
						*姓名
					</view>
					<u--input clearable placeholder="请输入姓名" border="surround" v-model="v_xm"
						@change="change"></u--input>
				</view>
				<view class="item">
					<view class="label">
						*电话
					</view>
					<u--input clearable placeholder="请输入电话" border="surround" v-model="v_dh"
						@change="change"></u--input>
				</view>
				<view class="item">
					<view class="label">
						*身份
					</view>
					<view class="sel">
						<uni-data-select placeholder="请选择身份" :clear="true" v-model="v_sf" :localdata="range2"
							@change="change2"></uni-data-select>
					</view>

				</view>
				<view class="item" style="margin-bottom: 24rpx;">
					<view class="label">
						任职公司
					</view>
					<u--input clearable placeholder="请输入任职公司" border="surround" v-model="v_gs"
						@change="change"></u--input>
				</view>
				<view class="item" style="margin-bottom: 24rpx;">
					<view class="label">
						备注
					</view>
					<u--input clearable placeholder="请输入备注" border="surround" v-model="v_bz"
						@change="change"></u--input>
				</view>
				<button open-type="share" class="orderBtn" :plain="true">
					确定
				</button>
			</view>
		</u-popup>
	</view>
</template>

<script>
	import dpupop from '@/components/popup/index.vue'
	import {
		postInviteReq,
		getMyInviteReq,
		addInviteReq,

		getInviteDetailBg
	} from '@/api/test/index.js'
	export default {
		components: {
			dpupop
		},
		data() {
			return {
				defBg: '',
				defVip: '',
				defLs: '',
				defHy: '',
				defYh: '',
				defDg: '',


				picUrl: this.$picUrl,
				picBase: this.$picBase,
				currTabIndex: 0,
				type: '',

				showLsPop: false,
				showDgPop: false,
				showVipPop: false,
				showHyPop: false,
				showYhPop: false,
				showLshareBtn: false,
				showYhshareBtn: false,
				showHyshareBtn: false,
				showDgshareBtn: false,


				// inviteSuc: true

				srcValue: 0,
				value1: 0,

				v_sf: -1,
				v_xm: '',
				v_dh: '',
				v_gs: '',
				v_bz: '',
				range2: [{
						value: 0,
						text: "S-VIP"
					},
					{
						value: 1,
						text: "G-VIP"
					}
				],
				failList: [],
				sucList: [],

				user_roleType: 1,


				l_xm: '',
				l_dh: '',
				l_xmmc: '',


				y_xm: '',
				y_dh: '',

				h_xm: '',
				h_dh: '',
				h_xmmc: '',

				d_xm: '',
				d_dh: '',
				d_djxx: '',
				range3: [{
						value: 0,
						text: "兑奖"
					},
					{
						value: 1,
						text: "到店"
					},
					{
						value: 2,
						text: "朋友"
					},
					{
						value: 3,
						text: "其他"
					},
				],
				d_ly: -1,

				inviteSvipSuc: false,
				inviteGvipSuc: false,
				fromBtn: -1,

				inviteId: '',

				forbidQuickClick: false
			}
		},
		async onLoad(o) {
			// 获取自定义图
			let res = await getInviteDetailBg()
			if (res.code == 0) {
				console.log('获取邀请详情页背景图返回值：', res);
				res.data[0].forEach((item, index) => {
					if (item.share_type == "vip") {
						this.defVip = item.head_image
					} else if (item.share_type == "ls") {
						this.defLs = item.head_image
					} else if (item.share_type == "hy") {
						this.defHy = item.head_image
					} else if (item.share_type == "hd") {
						this.defYh = item.head_image
					} else if (item.share_type == "dg") {
						this.defDg = item.head_image
					} else {
						this.defBg = item.head_image
					}
				})
			} else {
				this.$toast(res.message)
			}

			this.type = o.type

			if (o.type == 'vip') {
				this.user_roleType = 1
			} else if (o.type == 'ls') {
				this.user_roleType = 2
			} else if (o.type == 'hy') {
				this.user_roleType = 5
			} else if (o.type == 'yh') {
				this.user_roleType = 4
			} else if (o.type == 'dg') {
				this.user_roleType = 3
			}

			this.getList()
			// this.type = 'vip'
		},
		async onShareAppMessage(params) {

			console.log('触发邀请的inviteId', this.inviteId);
			if (params.from === 'button' || params.from === 'menu') {
				if (this.showVipPop) {
					return this.inviteVip()
				} else if (this.showLsPop) {
					return this.inviteLVip()
				} else if (this.showHyPop) {
					return this.inviteHyVip()
				} else if (this.showYhPop) {
					return this.inviteYhVip()
				} else if (this.showDgPop) {
					return this.inviteDgVip()
				}
			}
		},
		methods: {
			clear() {
				this.v_sf = -1
				this.v_xm = ''
				this.v_dh = ''
				this.v_gs = ''
				this.v_bz = ''

				this.l_xm = ''
				this.l_dh = ''
				this.l_xmmc = ''

				this.h_xm = ''
				this.h_dh = ''
				this.h_xmmc = ''

				this.y_xm = ''
				this.y_dh = ''

				this.d_ly = -1
				this.d_xm = ''
				this.d_dh = ''
				this.d_djxx = ''
			},
			secondInvite(item) {
				this.showLshareBtn = false
				this.showYhshareBtn = false
				this.showHyshareBtn = false
				this.showDgshareBtn = false

				this.inviteSvipSuc = false
				this.inviteGvipSuc = false

				if (item.status == 'Svip') {
					this.fromBtn = 1
				} else {
					this.fromBtn = 0
				}

				// console.log('13123234324', item);
				if (this.user_roleType == 1) {
					this.inviteVip(item)
				} else if (this.user_roleType == 2) {
					this.inviteLVip(item)
				} else if (this.user_roleType == 4) {
					this.inviteYhVip(item)
				} else if (this.user_roleType == 5) {
					this.inviteHyVip(item)
				} else if (this.user_roleType == 3) {
					this.inviteDgVip(item)
				}
			},

			showBox(type, fromBtn) {
				if (type == 'vip') {
					this.v_sf = -1
					this.v_xm = ''
					this.v_dh = ''
					this.v_gs = ''
					this.v_bz = ''
					this.showVipPop = true

					this.fromBtn = fromBtn
				} else if (type == 'ls') {
					this.l_xm = ''
					this.l_dh = ''
					this.l_xmmc = ''
					this.showLsPop = true
				} else if (type == 'hy') {
					this.h_xm = ''
					this.h_dh = ''
					this.h_xmmc = ''
					this.showHyPop = true
				} else if (type == 'yh') {
					this.y_xm = ''
					this.y_dh = ''
					this.showYhPop = true
				} else if (type == 'dg') {
					this.d_ly = -1
					this.d_xm = ''
					this.d_dh = ''
					this.d_djxx = ''
					this.showDgPop = true
				}
			},

			async inviteDgVip(item) {
				let parms = {}
				if (item) {
					this.d_xm = item.name
					this.d_dh = item.phone
					this.d_djxx = item.award_data.award_content
					this.d_ly = item.source - 1

					this.showDgPop = true
					return
				} else {

					let phoneReg = /^[1][3,4,5,7,8,9][0-9]{9}$/
					if (!this.d_xm) {
						return this.$toast('请输入姓名')
					}
					if (!this.d_dh) {
						return this.$toast('请输入电话')
					}
					if (!phoneReg.test(this.d_dh)) {
						return this.$toast('手机号格式不正确')
					}
					if (this.d_ly == -1) {
						return this.$toast('请选择来源')
					}
					// if (this.d_djxx == '') {
					// 	return this.$toast('请输入兑奖信息')
					// }
					parms = {
						type: this.user_roleType,
						name: this.d_xm,
						phone: this.d_dh,
						// status: this.d_ly == 0 ? '兑奖' : this.d_ly == 1 ? '到店' : this.d_ly == 2 ? '朋友' : '其他',
						source: this.d_ly + 1,
						status: '产业电工',
						award_content: this.d_djxx
					}
					this.clear()
				}
				let res = await postInviteReq(parms)
				if (res.code == 0) {
					// this.$toast('提交邀约申请成功，请点击上方分享按钮分享至微信')
					console.log('提交电工邀请返回值: ', res);
					this.showDgPop = false
					this.d_ly = -1
					this.d_xm = ''
					this.d_dh = ''
					this.d_djxx = ''
					this.getList()

					this.inviteId = res.data.inviteId
					// this.showDgshareBtn = true
					return {
						title: this.type == 'vip' ? '邀您成为VIP' : this.type == 'ls' ? '邀您成为L会员' : this.type == 'hy' ?
							'邀您成为会员' : this.type == 'yh' ? '邀您成为活动用户' : '邀您成为产业电工',
						imageUrl: this.$picBase + this.defDg,
						path: '/pages/index?inviteId=' + this.inviteId,
						mpId: this.$appId,
						type: this.$shareType,
					}
				} else {
					uni.showToast({
						title: res.message,
						icon: 'none'
					})
				}
			},
			async inviteHyVip(item) {
				let parms = {}
				if (item) {
					this.h_xm = item.name
					this.h_dh = item.phone
					this.h_xmmc = item.project_name
					this.showHyPop = true
					return
				} else {
					let phoneReg = /^[1][3,4,5,7,8,9][0-9]{9}$/
					if (!this.h_xm) {
						return this.$toast('请输入姓名')
					}
					if (!this.h_dh) {
						return this.$toast('请输入电话')
					}
					if (!phoneReg.test(this.h_dh)) {
						return this.$toast('手机号格式不正确')
					}
					parms = {
						type: this.user_roleType,
						name: this.h_xm,
						phone: this.h_dh,
						project_name: this.h_xmmc,
						status: '会员'
					}
					this.clear()
				}
				let res = await postInviteReq(parms)
				if (res.code == 0) {
					// this.$toast('提交邀约申请成功，请点击上方分享按钮分享至微信')
					console.log('提交会员vip邀请返回值: ', res);
					this.showHyPop = false
					this.h_xm = ''
					this.h_dh = ''
					this.h_xmmc = ''
					this.getList()
					this.inviteId = res.data.inviteId
					// this.showHyshareBtn = true
					return {
						title: this.type == 'vip' ? '邀您成为VIP' : this.type == 'ls' ? '邀您成为L会员' : this.type == 'hy' ?
							'邀您成为会员' : this.type == 'yh' ? '邀您成为活动用户' : '邀您成为产业电工',
						imageUrl: this.$picBase + this.defHy,
						path: '/pages/index?inviteId=' + this.inviteId,
						mpId: this.$appId,
						type: this.$shareType,
					}
				} else {
					uni.showToast({
						title: res.message,
						icon: 'none'
					})
				}
			},
			async inviteYhVip(item) {
				let parms = {}
				if (item) {
					this.y_xm = item.name
					this.y_dh = item.phone
					this.showYhPop = true
					return
				} else {
					let phoneReg = /^[1][3,4,5,7,8,9][0-9]{9}$/
					if (!this.y_xm) {
						return this.$toast('请输入姓名')
					}
					if (!this.y_dh) {
						return this.$toast('请输入电话')
					}
					if (!phoneReg.test(this.y_dh)) {
						return this.$toast('手机号格式不正确')
					}
					parms = {
						type: this.user_roleType,
						name: this.y_xm,
						phone: this.y_dh,
						status: '活动用户'
					}
					this.clear()
				}
				let res = await postInviteReq(parms)
				if (res.code == 0) {
					// this.$toast('提交邀约申请成功，请点击上方分享按钮分享至微信')
					console.log('提交活动用户vip邀请返回值: ', res);
					this.showYhPop = false
					this.y_xm = ''
					this.y_dh = ''
					this.getList()
					this.inviteId = res.data.inviteId
					// this.showYhshareBtn = true
					return {
						title: this.type == 'vip' ? '邀您成为VIP' : this.type == 'ls' ? '邀您成为L会员' : this.type == 'hy' ?
							'邀您成为会员' : this.type == 'yh' ? '邀您成为活动用户' : '邀您成为产业电工',
						// imageUrl: this.$picUrl + '/static/other/inviteBg.jpg',
						imageUrl: this.$picBase + this.defYh,
						path: '/pages/index?inviteId=' + this.inviteId,
						mpId: this.$appId,
						type: this.$shareType,
					}
				} else {
					uni.showToast({
						title: res.message,
						icon: 'none'
					})
				}
			},
			async inviteLVip(item) {
				let parms = {}
				if (item) {
					this.l_xm = item.name
					this.l_dh = item.phone
					this.l_xmmc = item.project_name
					this.showLsPop = true
					return
				} else {
					let phoneReg = /^[1][3,4,5,7,8,9][0-9]{9}$/

					if (!this.l_xm) {
						return this.$toast('请输入姓名')
					}
					if (!this.l_dh) {
						return this.$toast('请输入电话')
					}
					if (!phoneReg.test(this.l_dh)) {
						return this.$toast('手机号格式不正确')
					}
					parms = {
						type: this.user_roleType,
						name: this.l_xm,
						phone: this.l_dh,
						project_name: this.l_xmmc,
					}
					this.clear()
				}
				let res = await postInviteReq(parms)
				if (res.code == 0) {
					// this.$toast('提交邀约申请成功，请点击上方分享按钮分享至微信')
					console.log('提交Lvip邀请返回值: ', res);
					this.showLsPop = false
					this.l_xm = ''
					this.l_dh = ''
					this.l_xmmc = ''
					this.getList()
					this.inviteId = res.data.inviteId
					// this.showLshareBtn = true
					return {
						title: this.type == 'vip' ? '邀您成为VIP' : this.type == 'ls' ? '邀您成为L会员' : this.type == 'hy' ?
							'邀您成为会员' : this.type == 'yh' ? '邀您成为活动用户' : '邀您成为产业电工',
						imageUrl: this.$picBase + this.defLs,
						path: '/pages/index?inviteId=' + this.inviteId,
						mpId: this.$appId,
						type: this.$shareType,
					}
				} else {
					uni.showToast({
						title: res.message,
						icon: 'none'
					})
				}
			},
			async inviteVip(item) {

				let parms = {}
				if (item) {

					this.v_xm = item.name
					this.v_dh = item.phone
					this.v_gs = item.company
					this.v_bz = item.remark

					if (item.status == 'Svip') {
						this.v_sf = 0
					} else {
						this.v_sf = 1
					}
					this.showVipPop = true
					return

				} else {
					let phoneReg = /^[1][3,4,5,7,8,9][0-9]{9}$/
					if (!this.v_xm) {
						return this.$toast('请输入姓名')
					}
					if (!this.v_dh) {
						return this.$toast('请输入电话')
					}
					if (!phoneReg.test(this.v_dh)) {
						return this.$toast('手机号格式不正确')
					}
					if (this.v_sf == -1) {
						return this.$toast('请选择身份')
					}
					parms = {
						type: this.user_roleType,
						name: this.v_xm,
						phone: this.v_dh,
						status: this.v_sf ? 'Gvip' : 'Svip',
						company: this.v_gs,
						remark: this.v_bz,
					}
					this.clear()
				}
				let res = await postInviteReq(parms)
				if (res.code == 0) {
					// this.$toast('提交邀约申请成功，请点击上方分享按钮分享至微信')
					console.log('提交vip邀请返回值: ', res);
					this.showVipPop = false
					this.v_sf = -1
					this.v_xm = ''
					this.v_dh = ''
					this.v_gs = ''
					this.v_bz = ''

					this.getList()
					this.inviteId = res.data.inviteId

					return {
						title: this.type == 'vip' ? '邀您成为VIP' : this.type == 'ls' ? '邀您成为L会员' : this.type == 'hy' ?
							'邀您成为会员' : this.type == 'yh' ? '邀您成为活动用户' : '邀您成为产业电工',
						imageUrl: this.$picBase + this.defVip,
						path: '/pages/index?inviteId=' + this.inviteId,
						mpId: this.$appId,
						type: this.$shareType,
					}
				} else {
					uni.showToast({
						title: res.message,
						icon: 'none'
					})
				}
			},
			change3(e) {
				console.log("e:", e, this.d_ly);
			},

			change2(e) {
				// console.log("e:", e, this.v_sf);
			},

			async getList() {
				let res1 = await getMyInviteReq({
					type: this.user_roleType,
					state: 0,
				})
				if (res1.code == 0) {
					console.log('获取我的邀请返回值-失败: ', res1);

					this.failList = res1.data.data
				} else {
					uni.showToast({
						title: res1.message,
						icon: 'none'
					})
				}
				let res2 = await getMyInviteReq({
					type: this.user_roleType,
					state: 1,
				})
				if (res2.code == 0) {
					console.log('获取我的邀请返回值-成功: ', res2);

					this.sucList = res2.data.data
					// this.sucList = [...res2.data.data, ...res2.data.data, ...res2.data.data, ...res2.data.data]
				} else {
					uni.showToast({
						title: res2.message,
						icon: 'none'
					})
				}
			}
		}
	}
</script>

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