Browse Source

订单;赛事

学习?学个屁 1 week ago
parent
commit
2befc4ee08

+ 4 - 4
src/pages/index/courseDetail/index.vue

@@ -136,14 +136,14 @@
 				</view>
 			</view>
 			<block v-else>
-				<view class="buy">
+				<view class="buy" @click="toOrderPage(0)">
 					<view class="buy-text">直接购买</view>
 					<view class="buy-price">
 						<text>¥{{courseDetailInfo.sellingPrice}}</text>
 						<text>省10</text>
 					</view>
 				</view>
-				<view class="gratis" @click="toOrderPage">
+				<view class="gratis" @click="toOrderPage(1)">
 					免费试听
 				</view>
 			</block>
@@ -254,8 +254,8 @@
 		});
 	}
 
-	const toOrderPage = () => {
-		RouterUtils.to_page(`/pages/index/gymPay/index?courseId=${courseId.value}&type=${type.value}&orderType=2`)
+	const toOrderPage = (buyType : number) => {
+		RouterUtils.to_page(`/pages/index/gymPay/index?courseId=${courseId.value}&type=${type.value}&orderType=2&buyType=${buyType}`)
 	}
 
 	const courseId = ref()

+ 4 - 5
src/pages/index/eventsDetail/index.vue

@@ -34,13 +34,13 @@
 		<view class="d-timedown-card">
 			<view class="d-title">距离报名结束</view>
 			<view class="timedown">
-				<view class="time">{{ days || '--' }}</view>
+				<view class="time">{{ days? days: '--' }}</view>
 				<view class="unit">天</view>
-				<view class="time">{{ hours || '--' }}</view>
+				<view class="time">{{ hours? hours:'--' }}</view>
 				<view class="unit">:</view>
-				<view class="time">{{ minutes || '--' }}</view>
+				<view class="time">{{ minutes ? minutes: '--' }}</view>
 				<view class="unit">:</view>
-				<view class="time">{{ seconds || '--' }}</view>
+				<view class="time">{{ seconds ? seconds: '--' }}</view>
 			</view>
 			<view class="timedown-tips">
 				<view class="tips-icon">!</view>
@@ -314,7 +314,6 @@ const updateCountdown = () => {
   seconds.value = String(calcSeconds).padStart(2, '0');
 };
 // 获取详情数据
-const eventsId = ref()
 const eventsInfoObj = ref({})
 const formData = ref({
 	id: 0,

+ 106 - 45
src/pages/index/eventsRegister/index.vue

@@ -17,12 +17,12 @@
 				</view>
 			</view>
 			<view class="r-team-tips" v-if="peopleNum && selectTabs == 1">该团队赛需{{ peopleNum }}位一组报名参赛</view>
-			<view class="r-shoping">
+			<view class="r-shoping" v-if="selectEvents != null && selectTabs == 0">
 				<view class="shoping-title">购买数量</view>
 				<view class="shoping-num">
 					<view class="num-btn" @click="reduceNum">-</view>
 					<view class="num-input">
-						<input type="number">
+						<input v-model="countTotal" disabled type="number" />
 					</view>
 					<view class="num-btn" @click="addNum">+</view>
 				</view>
@@ -55,7 +55,7 @@
 			<view class="g-teamName">
 				<view class="team-name"><text style="color: #FB5B5B ;">*</text> 队名</view>
 				<view class="name-input">
-					<input type="text" placeholder="请输入队名(20字以内)" class="team-name-input" />
+					<input type="text" v-model="teamNameInfo" placeholder="请输入队名(20字以内)" class="team-name-input" />
 				</view>
 			</view>
 			<view class="g-teamBadge">
@@ -91,7 +91,7 @@
 					<view class="r-insurance-price">
 						<view class="r-price">¥{{ insurePrice }}/天·人</view>
 						<view class="r-insurance-btn" v-if="insureData.length < 1"
-							@click="gotoInsuracePage(item.priceDataList)">去投保
+							@click="gotoInsuracePage(item, item.priceDataList)">去投保
 						</view>
 					</view>
 				</view>
@@ -101,17 +101,21 @@
 				<view class="r-insurance-adduser" v-for="(insureUser, index) in insureData" :key="index">
 					<view class="r-adduser-btn">
 						<view class="r-celar" @click="clearUser">清除</view>
-						<view class="r-edit" @click="RouterUtils.to_page(`/pages/index/insure/index?priceDataList=${JSON.stringify(item.priceDataList)}`)">修改</view>
+						<view class="r-edit"
+							@click="RouterUtils.to_page(`/pages/index/insure/index?priceDataList=${JSON.stringify(item.priceDataList)}`)">
+							修改</view>
 					</view>
 					<view class="r-userinfo-list">
 						<view class="r-userinfo-item">
 							<view class="r-item-title">被保人</view>
-							<view class="r-item-info">{{ insureUser.userData.length }}人(<text v-for="user in insureUser.userData"
-									:key="user.id">{{ user.fullName }},</text>)</view>
+							<view class="r-item-info">{{ insureUser.userData.length }}人(<text
+									v-for="user in insureUser.userData" :key="user.id">{{ user.fullName }},</text>)
+							</view>
 						</view>
 						<view class="r-userinfo-item">
 							<view class="r-item-title">生效时间</view>
-							<view class="r-item-info">{{ insureUser.slectObj.day }}天({{ insureUser.startDate }}-{{ insureUser.endDate }})
+							<view class="r-item-info">{{ insureUser.slectObj.day }}天({{ insureUser.startDate }}-{{
+								insureUser.endDate }})
 							</view>
 						</view>
 						<view class="r-userinfo-item">
@@ -137,33 +141,10 @@
 		</view>
 	</view>
 	<uni-popup ref="insurePopup" type="center">
-		<view class="r-center-popup">
-			<view class="r-popup-title">无保险免责声明</view>
+		<view class="r-center-popup" v-if="agreementContent">
+			<view class="r-popup-title">{{ agreementContent.protocolName }}</view>
 			<view class="r-popup-content">
-				一、本声明的目的是为了使用体育场地的人员明确
-				知晓体育活动所存在的风险,凡签署本声明的人员,
-				均视为已经仔细阅读和完全理解并同意接受本声明
-				的全部条款。对于违反国家相关法规、恶意侵犯他
-				人或其他涉及犯罪行为的事件,均不在本声明范国
-				内跟覆篮戏娇须由个人承担相应的法律责任。
-				一、本声明的目的是为了使用体育场地的人员明确
-				知晓体育活动所存在的风险,凡签署本声明的人员,
-				均视为已经仔细阅读和完全理解并同意接受本声明
-				的全部条款。对于违反国家相关法规、恶意侵犯他
-				人或其他涉及犯罪行为的事件,均不在本声明范国
-				内跟覆篮戏娇须由个人承担相应的法律责任。
-				一、本声明的目的是为了使用体育场地的人员明确
-				知晓体育活动所存在的风险,凡签署本声明的人员,
-				均视为已经仔细阅读和完全理解并同意接受本声明
-				的全部条款。对于违反国家相关法规、恶意侵犯他
-				人或其他涉及犯罪行为的事件,均不在本声明范国
-				内跟覆篮戏娇须由个人承担相应的法律责任。
-				一、本声明的目的是为了使用体育场地的人员明确
-				知晓体育活动所存在的风险,凡签署本声明的人员,
-				均视为已经仔细阅读和完全理解并同意接受本声明
-				的全部条款。对于违反国家相关法规、恶意侵犯他
-				人或其他涉及犯罪行为的事件,均不在本声明范国
-				内跟覆篮戏娇须由个人承担相应的法律责任。
+				<rich-text :nodes="agreementContent.protocolContent"></rich-text>
 			</view>
 			<view class="r-popup-footer">
 				<view class="r-popup-needbtn" @click="toNeed">我需要购买保险</view>
@@ -185,8 +166,11 @@ import { onLoad } from '@dcloudio/uni-app';
 import zsTabs from "@/components/zzx-tabs/zzx-tabs.vue";
 const insurePopup = ref()
 const select_insurance = ref(false)
+const teamNameInfo=ref('')
 onLoad((options) => {
 	eventId.value = options.id;
+	orderFormData.value.orderType = 3
+	orderFormData.value.amount = 1
 })
 onMounted(() => {
 	get_userData()
@@ -197,23 +181,44 @@ onMounted(() => {
 const selectEvents = ref()
 const peopleNum = ref()
 const toggleSelect = (item: any, index: number) => {
+	orderFormData.value.productIds = item.id
 	peopleNum.value = item.peopleNum
 	selectEvents.value = index;
 };
 const to_play = () => {
-	uni.navigateTo({
-		url: '/pages/index/eventsOrder/index'
-	})
+	submitOrder()
+	// uni.navigateTo({
+	// 	url: '/pages/index/eventsOrder/index'
+	// })
 }
 
 const toUserList = () => {
 	RouterUtils.to_page('/pages/index/userList/index')
 }
 
+const countTotal = ref(1)
+const reduceNum = () => {
+	if (countTotal.value > 1) {
+		countTotal.value--
+		orderFormData.value.amount = countTotal.value
+	}
+}
+
+const addNum = () => {
+	countTotal.value++
+	orderFormData.value.amount = countTotal.value || 1
+}
+
 const userData = ref()
 const get_userData = () => {
 	uni.$on('userData', function (data) {
 		userData.value = data
+		if (data.length > 0) {
+			let familyIds = data.map(item => item.id)
+			orderFormData.value.familyIds = familyIds.join(',')
+		} else {
+			orderFormData.value.familyIds = []
+		}
 	})
 }
 
@@ -227,6 +232,13 @@ const deleteUser = async (e) => {
 const selectTabs = ref(0);
 const changeTab = (e: any) => {
 	selectTabs.value = e;
+	selectEvents.value = null
+	peopleNum.value = null
+	if (e == 0) {
+		orderFormData.value.orderType = 3 // 个人赛
+	} else {
+		orderFormData.value.orderType = 4 // 团队赛
+	}
 }
 
 const eventId = ref()
@@ -254,9 +266,18 @@ const get_eventsInfoDetail = () => {
 }
 
 const priceDataListData = ref([])
-const gotoInsuracePage = (e: any) => {
-	priceDataListData.value = e
-	insurePopup.value.open()
+const gotoInsuracePage = (e1: any, e2: any) => {
+	getFindByType(e1.insuranceName)
+	priceDataListData.value = e2
+	orderFormData.value.insureOrderInfoForm.insureId = e1.id
+}
+
+const agreementContent = ref()
+const getFindByType = (insuranceName: any) => {
+	http.get('/my/feedback/findByType', { data: { insuranceName: insuranceName, protocolType: 0 }, loading: true }).then((res: any) => {
+		agreementContent.value = res.result
+		insurePopup.value.open()
+	})
 }
 
 const toNeed = () => {
@@ -276,17 +297,56 @@ const insureData = ref([])
 const getInsureData = () => {
 	uni.$on('insureData', function (data) {
 		insureData.value = data
-		console.log(insureData.value, '投保信息');
-
+		console.log(insureData.value, '投保人信息');
+		orderFormData.value.insureOrderInfoForm.assertStartTime = insureData.value[0].startDate
+		orderFormData.value.insureOrderInfoForm.assertEndTime = insureData.value[0].endDate
+		orderFormData.value.insureOrderInfoForm.insurePriceId = insureData.value[0].slectObj.id
+		if (data.length > 0) {
+			let familyMembersIds = data[0].userData.map(item => item.id)
+			orderFormData.value.insureOrderInfoForm.familyMembersIds = familyMembersIds.join(',')
+		} else {
+			orderFormData.value.insureOrderInfoForm.familyMembersIds = []
+		}
 	})
 }
 
 const clearUser = async () => {
-	let res:any = await TipsUtils.tips_alert('确定清除投保人信息吗?', true)
+	let res: any = await TipsUtils.tips_alert('确定清除投保人信息吗?', true)
 	if (res.confirm) {
 		insureData.value = []
 	}
 }
+
+let orderFormData = ref({
+	type: 1,
+	productIds: null,
+	orderType: null,
+	amount: null,
+	familyIds: null,
+	insureOrderInfoForm: {
+		insureId: null,
+		assertStartTime: null,
+		assertEndTime: null,
+		insurePriceId: null,
+		familyMembersIds: null,
+	},
+	// gameCertificationForm:{
+	// 	teamName:'',
+	// 	teamEmblemImg: '',
+	// 	certificationDTOS:[{
+	// 		name: '',
+	// 		certificationImg: '',
+	// 	}]
+	// }
+})
+const submitOrder = () => {
+	// orderFormData.value.gameCertificationForm.teamName=teamNameInfo.value
+	if (!peopleNum.value) return TipsUtils.tips_toast('请选择项目')
+	if (!userData.value) return TipsUtils.tips_toast('请添加用户信息')
+	http.post('/order/createOrder', orderFormData.value, { loading: true }).then((res) => {
+
+	})
+}
 </script>
 
 <style lang="less" scoped>
@@ -366,6 +426,7 @@ const clearUser = async () => {
 
 			.num-input {
 				width: 80rpx;
+				text-align: center;
 			}
 		}
 	}
@@ -720,7 +781,7 @@ const clearUser = async () => {
 
 .r-center-popup {
 	width: 646rpx;
-	height: 1220rpx;
+	max-height: 1220rpx;
 	background: #F6F6F6;
 	border-radius: 32rpx;
 	padding: 20rpx;
@@ -736,7 +797,7 @@ const clearUser = async () => {
 		margin-top: 28rpx;
 		font-size: 28rpx;
 		color: #222222;
-		height: 800rpx;
+		max-height: 800rpx;
 		overflow: auto;
 	}
 

+ 5 - 4
src/pages/index/gymPay/index.vue

@@ -193,10 +193,14 @@ import { http } from '@/utils/http'
 const insurePopup = ref()
 const select_insurance = ref(false)
 const loadType = ref(1)
+const buyType=ref()
 onLoad((options) => {
 	loadType.value = options.type
 	courseId.value = options.courseId
+	buyType.value=options.buyType
 	orderFormData.value.type = options.orderType
+	orderFormData.value.orFreeOrder = options.buyType
+	orderFormData.value.amount=1
 })
 onMounted(() => {
 	get_previewOrderCourse()
@@ -244,11 +248,8 @@ const minusNum = () => {
 	}
 }
 
-// const subtotal=computed(()=>{
-// 	return (previewCourseInfo.value.subtotal*countTotal.value).toFixed(2)-previewCourseInfo.value.
-// })
-
 const addNum = () => {
+	if(buyType.value==1) return TipsUtils.tips_toast('试听课程不支持多个购买')
 	get_checkCourseLimitNum(countTotal.value + 1)
 	orderFormData.value.amount = countTotal.value+1
 }

+ 6 - 7
src/pages/index/insure/index.vue

@@ -91,7 +91,6 @@ import ZzxIcon from '@/components/zzx-icon/zzx-icon.vue';
 const priceDataList = ref<any[]>([]);
 onLoad((option) => {
   priceDataList.value = JSON.parse(option.priceDataList || '[]')
-  console.log(priceDataList.value);
 
 })
 onMounted(() => {
@@ -105,10 +104,10 @@ const get_userData = () => {
 }
 
 const deleteUser = async (e) => {
-	let res = await TipsUtils.tips_alert('确定删除该用户吗?', true)
-	if (res.confirm) {
-		insureuserData.value = insureuserData.value.filter(user => user.id !== e.id)
-	}
+  let res = await TipsUtils.tips_alert('确定删除该用户吗?', true)
+  if (res.confirm) {
+    insureuserData.value = insureuserData.value.filter(user => user.id !== e.id)
+  }
 }
 
 
@@ -133,8 +132,8 @@ const submitInfo = () => {
     userData: insureuserData.value,
     slectObj: slectObj.value,
     startDate: selectDate.value,
-    endDate: DateUtils.addDays(selectDate.value, slectObj.value.day),
-    totalPrice: (insureuserData.value.length * slectObj.value.price).toFixed(2)
+    endDate: DateUtils.addDays(selectDate.value, slectObj.value.insureDay),
+    totalPrice: (insureuserData.value.length * slectObj.value.insurePrice).toFixed(2)
   })
   uni.$emit('insureData', submitData.value)
   RouterUtils.back()

+ 2 - 2
src/utils/http/index.ts

@@ -179,9 +179,9 @@ export class HttpClient {
 
 // 创建实例
 export const http = new HttpClient({
-  // baseURL: 'http://192.168.1.34:8080/jeecg-boot/app',
+  baseURL: 'http://192.168.1.34:8080/jeecg-boot/app',
   // baseURL: 'http://192.168.1.166:8080/jeecg-boot/app',
-  baseURL: 'http://192.168.0.11:8080/jeecg-boot/app',
+  // baseURL: 'http://192.168.0.11:8080/jeecg-boot/app',
   headers: {
     'Content-Type': 'application/json'
   }