|  | @@ -1,13 +1,26 @@
 | 
	
		
			
				|  |  |  <template>
 | 
	
		
			
				|  |  |  	<!-- 类型type 0-个人,1团队 -->
 | 
	
		
			
				|  |  | -	<zs-tabs type="underline" :menus="menusItems" activeColor="#222222" @change="changeTab"></zs-tabs>
 | 
	
		
			
				|  |  | +	<zs-tabs type="underline" :menus="menusItems" @change="changeTab"></zs-tabs>
 | 
	
		
			
				|  |  |  	<view class="content">
 | 
	
		
			
				|  |  |  		<view class="r-card-list">
 | 
	
		
			
				|  |  |  			<view class="r-title">选择报名项目</view>
 | 
	
		
			
				|  |  | -			<view class="r-list-box" v-if="individualEvents[0]">
 | 
	
		
			
				|  |  | -				<view class="r-events"
 | 
	
		
			
				|  |  | -					v-for="(item, index) in (selectTabs == 0 ? individualEvents[0].gamePriceRulesVOList : teamsEvents[0].gamePriceRulesVOList)"
 | 
	
		
			
				|  |  | -					:key="index" @click="toggleSelect(item, index)" :class="{ 'selected-item': selectEvents == index }">
 | 
	
		
			
				|  |  | +			<!-- 个人赛项目 -->
 | 
	
		
			
				|  |  | +			<view v-if="selectTabs === 0 || menusItems.length === 1" class="r-list-box">
 | 
	
		
			
				|  |  | +				<view class="r-events" v-for="(item, index) in individualEvents[0]?.gamePriceRulesVOList" :key="index"
 | 
	
		
			
				|  |  | +					@click="toggleSelect(item, index)" :class="{ 'selected-item': selectEvents == index }">
 | 
	
		
			
				|  |  | +					<view class="events-type">
 | 
	
		
			
				|  |  | +						<view class="r-check">
 | 
	
		
			
				|  |  | +							<zzx-icon :name="selectEvents == index ? 'selected' : 'unchecked'" size="14"></zzx-icon>
 | 
	
		
			
				|  |  | +						</view>
 | 
	
		
			
				|  |  | +						<view>{{ item.categoryName }}</view>
 | 
	
		
			
				|  |  | +					</view>
 | 
	
		
			
				|  |  | +					<view class="events-price">¥{{ item.sellingPrice }}/人</view>
 | 
	
		
			
				|  |  | +				</view>
 | 
	
		
			
				|  |  | +			</view>
 | 
	
		
			
				|  |  | +			<!-- 团队赛项目 -->
 | 
	
		
			
				|  |  | +			<view v-if="selectTabs === 1 || menusItems.length === 1" class="r-list-box">
 | 
	
		
			
				|  |  | +				<view class="r-events" v-for="(item, index) in teamsEvents[0]?.gamePriceRulesVOList" :key="index"
 | 
	
		
			
				|  |  | +					@click="toggleSelect(item, index)" :class="{ 'selected-item': selectEvents == index }">
 | 
	
		
			
				|  |  |  					<view class="events-type">
 | 
	
		
			
				|  |  |  						<view class="r-check">
 | 
	
		
			
				|  |  |  							<zzx-icon :name="selectEvents == index ? 'selected' : 'unchecked'" size="14"></zzx-icon>
 | 
	
	
		
			
				|  | @@ -63,16 +76,15 @@
 | 
	
		
			
				|  |  |  			<view class="g-teamBadge">
 | 
	
		
			
				|  |  |  				<view class="team-badge" style="margin-left: 20rpx;">队徽</view>
 | 
	
		
			
				|  |  |  				<view class="">
 | 
	
		
			
				|  |  | -					<sunui-upimg :url="upPicUrl" :header="{ 'x-access-token': cache.get('TOKEN') }" ref="upload1"
 | 
	
		
			
				|  |  | -						title="店铺logo" @upload="handleLoaded" @change="handleChange" :number="9"></sunui-upimg>
 | 
	
		
			
				|  |  | +					<sunui-upimg :header="{ 'x-access-token': cache.get('TOKEN') }" ref="upload1" title="店铺logo"
 | 
	
		
			
				|  |  | +						@upload="handleLoaded" @change="handleChange" :number="9"></sunui-upimg>
 | 
	
		
			
				|  |  |  				</view>
 | 
	
		
			
				|  |  |  			</view>
 | 
	
		
			
				|  |  |  			<view class="g-teamBadge" v-for="(item, index) in aptitudesList" :key="index">
 | 
	
		
			
				|  |  |  				<view class="team-badge"><text style="color: #FB5B5B ;">*</text>{{ item }}</view>
 | 
	
		
			
				|  |  |  				<view class="">
 | 
	
		
			
				|  |  | -					<sunui-upimg :url="upPicUrl" :header="{ 'x-access-token': cache.get('TOKEN') }"
 | 
	
		
			
				|  |  | -						:ref="'upload' + index" :title="item"
 | 
	
		
			
				|  |  | -						@upload="(imageList: any) => handleLoaded1(imageList, index)"
 | 
	
		
			
				|  |  | +					<sunui-upimg :header="{ 'x-access-token': cache.get('TOKEN') }" :ref="'upload' + index"
 | 
	
		
			
				|  |  | +						:title="item" @upload="(imageList: any) => handleLoaded1(imageList, index)"
 | 
	
		
			
				|  |  |  						@change="(imageList: any) => handleChangeList(imageList, index)" :number="9"></sunui-upimg>
 | 
	
		
			
				|  |  |  				</view>
 | 
	
		
			
				|  |  |  			</view>
 | 
	
	
		
			
				|  | @@ -93,7 +105,7 @@
 | 
	
		
			
				|  |  |  					</view>
 | 
	
		
			
				|  |  |  					<view class="r-insurance-type">保险公司:{{ item.insuranceName_dictText }}</view>
 | 
	
		
			
				|  |  |  					<view class="r-insurance-price">
 | 
	
		
			
				|  |  | -						<view class="r-price">¥{{ insurePrice }}/天·人</view>
 | 
	
		
			
				|  |  | +						<view class="r-price">¥{{ item.priceDataList[0].insurePrice }}/天·人</view>
 | 
	
		
			
				|  |  |  						<view class="r-insurance-btn" v-if="insureData.length < 1"
 | 
	
		
			
				|  |  |  							@click="gotoInsuracePage(item, item.priceDataList)">去投保
 | 
	
		
			
				|  |  |  						</view>
 | 
	
	
		
			
				|  | @@ -165,14 +177,13 @@
 | 
	
		
			
				|  |  |  <script lang="ts" setup>
 | 
	
		
			
				|  |  |  import { ref, onMounted, computed } from 'vue';
 | 
	
		
			
				|  |  |  import { http } from '@/utils/http';
 | 
	
		
			
				|  |  | -import { RouterUtils, TipsUtils, idCardHide,debounce } from '@/utils/util';
 | 
	
		
			
				|  |  | +import { RouterUtils, TipsUtils, idCardHide, debounce } from '@/utils/util';
 | 
	
		
			
				|  |  |  import { onLoad } from '@dcloudio/uni-app';
 | 
	
		
			
				|  |  |  import zsTabs from "@/components/zzx-tabs/zzx-tabs.vue";
 | 
	
		
			
				|  |  |  import { useCacheStore } from '@/stores/cache';
 | 
	
		
			
				|  |  |  const cache = useCacheStore()
 | 
	
		
			
				|  |  |  const insurePopup = ref()
 | 
	
		
			
				|  |  |  const select_insurance = ref(false)
 | 
	
		
			
				|  |  | -const upPicUrl = ref('http://192.168.0.11:8080/jeecg-boot/sys/common/upload')
 | 
	
		
			
				|  |  |  onLoad((options) => {
 | 
	
		
			
				|  |  |  	eventId.value = options.id;
 | 
	
		
			
				|  |  |  	orderFormData.value.orderType = 3
 | 
	
	
		
			
				|  | @@ -210,6 +221,7 @@ const toggleSelect = (item: any, index: number) => {
 | 
	
		
			
				|  |  |  	orderFormData.value.productIds = item.id
 | 
	
		
			
				|  |  |  	peopleNum.value = item.peopleNum
 | 
	
		
			
				|  |  |  	selectEvents.value = index;
 | 
	
		
			
				|  |  | +	countTotal.value = 1
 | 
	
		
			
				|  |  |  };
 | 
	
		
			
				|  |  |  const to_play = () => {
 | 
	
		
			
				|  |  |  	submitOrder()
 | 
	
	
		
			
				|  | @@ -226,12 +238,14 @@ const countTotal = ref(1)
 | 
	
		
			
				|  |  |  const reduceNum = () => {
 | 
	
		
			
				|  |  |  	if (countTotal.value > 1) {
 | 
	
		
			
				|  |  |  		countTotal.value--
 | 
	
		
			
				|  |  | +		peopleNum.value = countTotal.value
 | 
	
		
			
				|  |  |  		orderFormData.value.amount = countTotal.value
 | 
	
		
			
				|  |  |  	}
 | 
	
		
			
				|  |  |  }
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |  const addNum = () => {
 | 
	
		
			
				|  |  |  	countTotal.value++
 | 
	
		
			
				|  |  | +	peopleNum.value = countTotal.value
 | 
	
		
			
				|  |  |  	orderFormData.value.amount = countTotal.value || 1
 | 
	
		
			
				|  |  |  }
 | 
	
		
			
				|  |  |  
 | 
	
	
		
			
				|  | @@ -261,7 +275,7 @@ const handleChangeList = (e1: any, e2: any) => {
 | 
	
		
			
				|  |  |  };
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  | -const userData = ref()
 | 
	
		
			
				|  |  | +const userData = ref([])
 | 
	
		
			
				|  |  |  const get_userData = () => {
 | 
	
		
			
				|  |  |  	uni.$on('userData', function (data) {
 | 
	
		
			
				|  |  |  		userData.value = data
 | 
	
	
		
			
				|  | @@ -278,6 +292,9 @@ const deleteUser = async (e) => {
 | 
	
		
			
				|  |  |  	let res = await TipsUtils.tips_alert('确定删除该用户吗?', true)
 | 
	
		
			
				|  |  |  	if (res.confirm) {
 | 
	
		
			
				|  |  |  		userData.value = userData.value.filter(user => user.id !== e.id)
 | 
	
		
			
				|  |  | +		console.log(userData.value, '删除后的列表');
 | 
	
		
			
				|  |  | +		let familyIds = userData.value.map(item => item.id)
 | 
	
		
			
				|  |  | +		orderFormData.value.familyIds = familyIds.join(',')
 | 
	
		
			
				|  |  |  	}
 | 
	
		
			
				|  |  |  }
 | 
	
		
			
				|  |  |  
 | 
	
	
		
			
				|  | @@ -298,24 +315,31 @@ const individualEvents = ref([]) // 个人赛项目
 | 
	
		
			
				|  |  |  const teamsEvents = ref([]) // 团队赛项目
 | 
	
		
			
				|  |  |  const aptitudesList = ref([]) // 资质列表
 | 
	
		
			
				|  |  |  const insureIdList = ref([])  // 保险列表
 | 
	
		
			
				|  |  | -const insurePrice = ref() // 保险价格
 | 
	
		
			
				|  |  | -const menusItems=ref([])
 | 
	
		
			
				|  |  | +const menusItems = ref([]) // 菜单列表
 | 
	
		
			
				|  |  | +const eventsTypeList = ref([]) // 项目类型列表
 | 
	
		
			
				|  |  |  const get_eventsInfoDetail = () => {
 | 
	
		
			
				|  |  |  	http.get('/game/findByGameId', { data: { id: eventId.value }, loading: true }).then((res: any) => {
 | 
	
		
			
				|  |  | +		eventsTypeList.value = res.result.gamePriceRulesTypeVOList
 | 
	
		
			
				|  |  |  		individualEvents.value = res.result.gamePriceRulesTypeVOList.filter((item: any) => item.type == 0)
 | 
	
		
			
				|  |  |  		teamsEvents.value = res.result.gamePriceRulesTypeVOList.filter((item: any) => item.type == 1)
 | 
	
		
			
				|  |  | +		console.log(teamsEvents.value, '团队赛');
 | 
	
		
			
				|  |  |  		aptitudesList.value = res.result.aptitudesList
 | 
	
		
			
				|  |  | -		menusItems.value= res.result.gamePriceRulesTypeVOList.map((e)=>{
 | 
	
		
			
				|  |  | -			return e.typeName
 | 
	
		
			
				|  |  | -		})
 | 
	
		
			
				|  |  | +		// 动态生成菜单项
 | 
	
		
			
				|  |  | +		menusItems.value = []
 | 
	
		
			
				|  |  | +		if (individualEvents.value.length > 0) {
 | 
	
		
			
				|  |  | +			menusItems.value.push('个人赛项目')
 | 
	
		
			
				|  |  | +		}
 | 
	
		
			
				|  |  | +		if (teamsEvents.value.length > 0) {
 | 
	
		
			
				|  |  | +			menusItems.value.push('团队赛项目')
 | 
	
		
			
				|  |  | +		}
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +		// 如果只有一种类型,默认显示该类型
 | 
	
		
			
				|  |  | +		if (menusItems.value.length === 1) {
 | 
	
		
			
				|  |  | +			selectTabs.value = individualEvents.value.length > 0 ? 0 : 1
 | 
	
		
			
				|  |  | +		}
 | 
	
		
			
				|  |  |  		res.result.insureIdList.map((item: any) => {
 | 
	
		
			
				|  |  |  			item.insuranceObvious = JSON.parse(item.insuranceObvious)
 | 
	
		
			
				|  |  |  			item.insuranceObvious = [item.insuranceObvious]
 | 
	
		
			
				|  |  | -			item.priceDataList.map((item2: any) => {
 | 
	
		
			
				|  |  | -				if (item2.insureDay === 1) {
 | 
	
		
			
				|  |  | -					insurePrice.value = item2.insurePrice
 | 
	
		
			
				|  |  | -				}
 | 
	
		
			
				|  |  | -			})
 | 
	
		
			
				|  |  |  		})
 | 
	
		
			
				|  |  |  		insureIdList.value = res.result.insureIdList
 | 
	
		
			
				|  |  |  	})
 | 
	
	
		
			
				|  | @@ -395,12 +419,28 @@ let orderFormData = ref({
 | 
	
		
			
				|  |  |  	}
 | 
	
		
			
				|  |  |  })
 | 
	
		
			
				|  |  |  const submitOrderImpl = () => {
 | 
	
		
			
				|  |  | +	if (selectTabs.value == 0) {
 | 
	
		
			
				|  |  | +		orderFormData.value.orderType = 3
 | 
	
		
			
				|  |  | +	} else {
 | 
	
		
			
				|  |  | +		orderFormData.value.orderType = 4
 | 
	
		
			
				|  |  | +	}
 | 
	
		
			
				|  |  |  	if (!peopleNum.value) return TipsUtils.tips_toast('请选择项目')
 | 
	
		
			
				|  |  | +	if (peopleNum.value != userData.value.length) return TipsUtils.tips_toast('请选择' + peopleNum.value + '位用户')
 | 
	
		
			
				|  |  |  	if (!userData.value) return TipsUtils.tips_toast('请添加用户信息')
 | 
	
		
			
				|  |  |  	if (selectTabs.value == 1) {
 | 
	
		
			
				|  |  |  		if (!orderFormData.value.gameCertificationForm.teamName) return TipsUtils.tips_toast('请输入队名')
 | 
	
		
			
				|  |  | +		// 校验资质证明图片
 | 
	
		
			
				|  |  | +		const certificationDTOS = orderFormData.value.gameCertificationForm.certificationDTOS
 | 
	
		
			
				|  |  | +		if (!certificationDTOS || certificationDTOS.length !== aptitudesList.value.length) {
 | 
	
		
			
				|  |  | +			return TipsUtils.tips_toast('请上传所有必传的资质证明图片')
 | 
	
		
			
				|  |  | +		}
 | 
	
		
			
				|  |  | +		// 校验每个资质证明是否都已上传图片
 | 
	
		
			
				|  |  | +		for (let i = 0; i < certificationDTOS.length; i++) {
 | 
	
		
			
				|  |  | +			if (!certificationDTOS[i].certificationImg) {
 | 
	
		
			
				|  |  | +				return TipsUtils.tips_toast(`请上传${certificationDTOS[i].name}的图片`)
 | 
	
		
			
				|  |  | +			}
 | 
	
		
			
				|  |  | +		}
 | 
	
		
			
				|  |  |  	}
 | 
	
		
			
				|  |  | -
 | 
	
		
			
				|  |  |  	let data = { ...orderFormData.value };
 | 
	
		
			
				|  |  |  	if (selectTabs.value !== 1) {
 | 
	
		
			
				|  |  |  		delete data.gameCertificationForm;
 | 
	
	
		
			
				|  | @@ -414,38 +454,38 @@ const submitOrderImpl = () => {
 | 
	
		
			
				|  |  |  	}
 | 
	
		
			
				|  |  |  	// orPayOrder0-免费/试听 1-调起支付
 | 
	
		
			
				|  |  |  	http.post('/order/createOrder', data, { loading: true }).then((res) => {
 | 
	
		
			
				|  |  | -		getOrderQuery(res.result.orderCode,res.result.orderId)
 | 
	
		
			
				|  |  | +		getOrderQuery(res.result.orderCode, res.result.orderId)
 | 
	
		
			
				|  |  |  	})
 | 
	
		
			
				|  |  |  }
 | 
	
		
			
				|  |  |  const submitOrder = debounce(submitOrderImpl, 500)
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |  // code编码 "100001支付成功";"100002查询失败"; "100003查询中 "; "100004支付失败"
 | 
	
		
			
				|  |  | -const getOrderQuery = (orderCode: string,orderId:string, retryCount = 0) => {
 | 
	
		
			
				|  |  | -    http.get('/order/orderQuery', { data: { orderCode: orderCode }, loading: true }).then((res) => {
 | 
	
		
			
				|  |  | -        if (res.result == '100001') {
 | 
	
		
			
				|  |  | -            RouterUtils.to_page(`/pages/index/toBeUsed/index?orderId=${orderId}&orderType=${orderFormData.value.orderType}`)
 | 
	
		
			
				|  |  | -        } else if (retryCount <= 3) {
 | 
	
		
			
				|  |  | -            setTimeout(() => {
 | 
	
		
			
				|  |  | -                getOrderQuery(orderCode,orderId, retryCount + 1)
 | 
	
		
			
				|  |  | -            }, 1000)
 | 
	
		
			
				|  |  | -        } else {
 | 
	
		
			
				|  |  | -            if (res.result == '100003') {
 | 
	
		
			
				|  |  | -                console.log('查询中,但已达到最大查询次数')
 | 
	
		
			
				|  |  | -            } else if (res.result == '100002') {
 | 
	
		
			
				|  |  | -                console.log('查询失败')
 | 
	
		
			
				|  |  | -            } else if (res.result == '100004') {
 | 
	
		
			
				|  |  | -                console.log('支付失败')
 | 
	
		
			
				|  |  | +const getOrderQuery = (orderCode: string, orderId: string, retryCount = 0) => {
 | 
	
		
			
				|  |  | +	http.get('/order/orderQuery', { data: { orderCode: orderCode }, loading: true }).then((res) => {
 | 
	
		
			
				|  |  | +		if (res.result == '100001') {
 | 
	
		
			
				|  |  | +			RouterUtils.to_page(`/pages/index/toBeUsed/index?orderId=${orderId}&orderType=${orderFormData.value.orderType}`)
 | 
	
		
			
				|  |  | +		} else if (retryCount <= 3) {
 | 
	
		
			
				|  |  | +			setTimeout(() => {
 | 
	
		
			
				|  |  | +				getOrderQuery(orderCode, orderId, retryCount + 1)
 | 
	
		
			
				|  |  | +			}, 1000)
 | 
	
		
			
				|  |  | +		} else {
 | 
	
		
			
				|  |  | +			if (res.result == '100003') {
 | 
	
		
			
				|  |  | +				console.log('查询中,但已达到最大查询次数')
 | 
	
		
			
				|  |  | +			} else if (res.result == '100002') {
 | 
	
		
			
				|  |  | +				console.log('查询失败')
 | 
	
		
			
				|  |  | +			} else if (res.result == '100004') {
 | 
	
		
			
				|  |  | +				console.log('支付失败')
 | 
	
		
			
				|  |  |  				TipsUtils.tips_toast('支付失败')
 | 
	
		
			
				|  |  | -            }
 | 
	
		
			
				|  |  | -        }
 | 
	
		
			
				|  |  | -    }).catch((error) => {
 | 
	
		
			
				|  |  | -        console.error('查询订单失败:', error)
 | 
	
		
			
				|  |  | -        if (retryCount < 2) { 
 | 
	
		
			
				|  |  | -            setTimeout(() => {
 | 
	
		
			
				|  |  | -                getOrderQuery(orderCode,orderId, retryCount + 1)
 | 
	
		
			
				|  |  | -            }, 1000)
 | 
	
		
			
				|  |  | -        }
 | 
	
		
			
				|  |  | -    })
 | 
	
		
			
				|  |  | +			}
 | 
	
		
			
				|  |  | +		}
 | 
	
		
			
				|  |  | +	}).catch((error) => {
 | 
	
		
			
				|  |  | +		console.error('查询订单失败:', error)
 | 
	
		
			
				|  |  | +		if (retryCount < 2) {
 | 
	
		
			
				|  |  | +			setTimeout(() => {
 | 
	
		
			
				|  |  | +				getOrderQuery(orderCode, orderId, retryCount + 1)
 | 
	
		
			
				|  |  | +			}, 1000)
 | 
	
		
			
				|  |  | +		}
 | 
	
		
			
				|  |  | +	})
 | 
	
		
			
				|  |  |  }
 | 
	
		
			
				|  |  |  </script>
 | 
	
		
			
				|  |  |  
 |