perfect.vue 6.76 KB
<template>
	<view>
		<view class="pd30">
			<uni-steps :options="list1" :active="active" />
			
			<view>
				<uni-forms ref="baseForm" :modelValue="baseFormData" label-width="100">
					<uni-forms-item label="所属协会" required><uni-easyinput v-model="baseFormData.name"
							:disabled="!editIng" placeholder="所属协会" /></uni-forms-item>
					<uni-forms-item label="机构名称" required><uni-easyinput v-model="baseFormData.name"
							:disabled="!editIng" placeholder="机构名称" /></uni-forms-item>
					<uni-forms-item label="单位类型" required>
						<uni-data-select :disabled="!editIng" v-model="baseFormData.type"
							:localdata="typeList"></uni-data-select>
					</uni-forms-item>
					<uni-forms-item label="联系人" required>
						<uni-easyinput v-model="baseFormData.contactPerson" :disabled="!editIng"
							placeholder="请输入联系人姓名" />
					</uni-forms-item>
					<uni-forms-item label="联系方式" required>
						<uni-easyinput v-model="baseFormData.contactTelno" :disabled="!editIng" placeholder="请输入联系方式" />
					</uni-forms-item>
					<uni-forms-item label="所在地区" required>
						<uni-data-picker v-if="editIng" class="fixUniFormItemStyle" :clear-icon="!editIng"
							v-model="regionArr" @change="onchangeRegionId" :localdata="regionsList"
							popup-title="请选择所在地区"></uni-data-picker>
						<uni-easyinput v-model="baseFormData.regionStr" v-else disabled />
					</uni-forms-item>
					<uni-forms-item label="详细地址" required><uni-easyinput v-model="baseFormData.address"
							:disabled="!editIng" placeholder="请输入详细地址" /></uni-forms-item>

	
				</uni-forms>
				<view class="fixedBottom">
					<button class="btn-red" @click="saveMyteam()">下一步</button>
				</view>
			</view>
		</view>
	</view>
</template>

<script setup>
	import {
		ref
	} from 'vue';
	import * as api from '@/common/api.js';
	import {
		onLoad,
		onShow
	} from '@dcloudio/uni-app';
	import {
		tagList,
		typeList,
		comList
	} from '@/static/js/data';
	import config from '@/config.js'
	const app = getApp();
	const baseFormData = ref({

	});
	const dataList = ref([]);
	const memberList = ref([]);
	const regionArr = ref();
	const regionsList = ref([]);
	const ranksList = ref([]);
	const current = ref(0);
	const groupId = ref(0);
	const currIndex = ref(null);
	const cptId = ref();
	const signType = ref();
	const editIng = ref(true);
	const isSign = ref(false);
	const query = ref({
		type: 0
	});
	const active = ref(0)
	const list1 = ref([{
			title: '完善信息'
		}, {
			title: '会员认证'
		}])
	onLoad(option => {
		console.log(option)
	
		getRegionsList();
		getDetail()
	});
	function getDetail(){
		api.getMyOwnMemberInfo().then(res=>{
			  if (!res.data.memberInfo) res.data.memberInfo = {}
			  baseFormData.value = res.data.memberInfo
			  baseFormData.value.coordinates1 = []
			  authenticationStatusa.value = res.data.authenticationStatus
			  if (baseFormData.value.siteProvinceId)baseFormData.value.coordinates1.push(baseFormData.value.siteProvinceId)
			  if (baseFormData.value.siteCityId) baseFormData.value.coordinates1.push(baseFormData.value.siteCityId) 
			  if (baseFormData.value.siteRegionId) baseFormData.value.coordinates1.push(baseFormData.value.siteRegionId) 
			 
		})
	}

	function getRegionsList() {
		api.regionsList().then(res => {
			regionsList.value = res.data;
		});
	}

	function onchangeRegionId(e) {
		console.log(e.detail.value)
		baseFormData.value.regionId = regionArr.value
	}

	function saveMyteam() {
		// 验证必填项
		if (baseFormData.value.imgUrl == '') {
			uni.showToast({
				title: '请上传logo',
				duration: 2000,
				icon: 'none'
			})
			return
		}
		if (baseFormData.value.name == '') {
			uni.showToast({
				title: '请填写团体名称',
				duration: 2000,
				icon: 'none'
			})
			return
		}
		if (baseFormData.value.abreviations == '') {
			uni.showToast({
				title: '请填写简称',
				duration: 2000,
				icon: 'none'
			})
			return
		}
		if (baseFormData.value.type == '') {
			uni.showToast({
				title: '请选择参赛队类型',
				duration: 2000,
				icon: 'none'
			})
			return
		}
		// if(baseFormData.value.type=='3'&&!baseFormData.value.ctype){
		// 	uni.showToast({
		// 		title: '请选择企业性质',
		// 		duration: 2000,
		// 		icon:'none'
		// 	})
		// 	return
		// }
		if (baseFormData.value.contactPerson == '') {
			uni.showToast({
				title: '请填写联系人',
				duration: 2000,
				icon: 'none'
			})
			return
		}
		if (baseFormData.value.contactTelno == '') {
			uni.showToast({
				title: '请填写联系方式',
				duration: 2000,
				icon: 'none'
			})
			return
		}
		var pattern = /^1[3456789]\d{9}$/;
		if (!pattern.test(baseFormData.value.contactTelno)) {
			uni.showToast({
				title: '请输入正确的手机号',
				duration: 2000,
				icon: 'none'
			})
			return
		}

		if (baseFormData.value.regionId == '') {
			uni.showToast({
				title: '选择所在地区',
				duration: 2000,
				icon: 'none'
			})
			return
		}
		if (baseFormData.value.address == '') {
			uni.showToast({
				title: '请填写详细地址',
				duration: 2000,
				icon: 'none'
			})
			return
		}

		for (let n in participantsInfoArr.value) {
			if (participantsInfoArr.value[n].status == 0 && (!participantsInfoArr.value[n].value)) {
				uni.showToast({
					title: '请完善必填字段',
					duration: 2000,
					icon: 'none'
				})
				return
			}

		}



		match.saveMyGroup(baseFormData.value).then(res => {
			groupId.value = res.data
			if (participantsInfoArr.value && participantsInfoArr.value.length > 0) {
				// 保存补充信息
				const obj = {
					cptId: cptId.value,
					groupId: groupId.value,
					groupInfo: JSON.stringify(participantsInfoArr.value)
				}
				match.saveMyGroupExtraInfo(obj).then(res => {

				})
			}

			if (!signType.value) {
				uni.showToast({
					title: '保存成功',
					icon: 'none',
					duration: 2000
				});
				editIng.value = false;
			} else if (signType.value == 1) {
				// 团队
				if (coachOrLeaderFlag.value == "1") {
					uni.navigateTo({
						url: `/pages_match/match/choose_coach?matchId=${cptId.value}&groupId=${groupId.value}&signType=${signType.value}`
					});
				} else {
					// 选运动员
					uni.navigateTo({
						url: `/pages_match/match/choose_sportman?matchId=${cptId.value}&groupId=${groupId.value}&signType=${signType.value}`
					});
				}

			} else if (signType.value == 2) {
				// 队伍
				uni.navigateTo({
					url: `/pages_match/match/add_rank?matchId=${cptId.value}&groupId=${groupId.value}&signType=${signType.value}`
				});
			}
		});
	}
</script>

<style lang="scss">

</style>