zhxy-jzd/src/pages/base/course-selection/club-selection.vue

194 lines
4.3 KiB
Vue
Raw Normal View History

2025-05-07 09:44:23 +08:00
<template>
<view class="interest-course">
2025-05-16 16:16:41 +08:00
<!-- 选课信息头部 - 固定部分 -->
2025-05-07 09:44:23 +08:00
<view class="selection-header">
<view class="header-content">
2025-06-29 19:24:41 +08:00
<!-- 选课类型选择部分 -->
2025-06-30 23:44:07 +08:00
<XkPicker title="俱乐部信息" :is-qk="true" xklx-id="816059832" :xs-id="curXs.id" @change="switchXk" />
2025-05-16 16:16:41 +08:00
<!-- 学生选择部分 -->
2025-06-29 19:24:41 +08:00
<XsPicker :is-bar="true" />
<!-- 倒计时-->
2025-06-29 21:31:05 +08:00
<XkCountdown :xk="curXk" @over="xkTimeOver" v-if="curXk && curXk.id" />
2025-05-07 09:44:23 +08:00
</view>
</view>
2025-05-16 16:16:41 +08:00
<!-- 可滚动的内容区域 -->
<view class="scrollable-content">
2025-06-30 23:44:07 +08:00
<XkkcList :xk="curXk" :can-selected="true" :multiple="true" @change="changeXkkc" />
2025-05-07 09:44:23 +08:00
</view>
2025-06-29 19:24:41 +08:00
2025-06-29 21:31:05 +08:00
<!-- 底部报名按钮 - 固定部分 -->
<view class="register-btn-container">
<view class="selected-count-info" v-if="selectedXkkcIds && selectedXkkcIds.length > 0">
已选 {{ selectedXkkcIds.length }} 门课程
</view>
<view class="register-btn" @click="submit">点击报名</view>
</view>
2025-06-29 19:24:41 +08:00
</view>
2025-05-07 09:44:23 +08:00
</template>
<script setup lang="ts">
2025-06-29 19:24:41 +08:00
import XsPicker from "@/pages/base/components/XsPicker/index.vue"
import XkPicker from "@/pages/base/components/XkPicker/index.vue"
import XkCountdown from "@/pages/base/components/XkCountdown/index.vue"
2025-06-29 21:31:05 +08:00
import XkkcList from "@/pages/base/components/XkkcList/index.vue"
2025-06-30 23:44:07 +08:00
import { jzXkQkjApi } from "@/api/base/server";
2025-05-16 16:16:41 +08:00
import { useUserStore } from "@/store/modules/user";
2025-06-30 23:44:07 +08:00
import { useDataStore } from "@/store/modules/data";
2025-05-16 16:16:41 +08:00
2025-06-30 23:44:07 +08:00
const { getCurXs, getUser } = useUserStore();
const { setData, getData } = useDataStore();
const { sign_file } = getData;
2025-05-16 16:16:41 +08:00
2025-06-29 19:24:41 +08:00
const curXs = computed(() => getCurXs);
2025-06-29 21:31:05 +08:00
const curXk = ref<any>({});
const selectedXkkcIds = ref<any>([]);
2025-06-29 19:24:41 +08:00
// 切换选课
const switchXk = (xk: any) => {
curXk.value = xk;
2025-05-16 16:16:41 +08:00
}
2025-06-29 19:24:41 +08:00
// 选课时间结束
const xkTimeOver = (val: any) => {
console.log(val);
2025-05-16 16:16:41 +08:00
}
2025-06-29 21:31:05 +08:00
// 选中课程
const changeXkkc = (ids: any) => {
selectedXkkcIds.value = ids;
}
2025-05-16 16:16:41 +08:00
2025-06-29 21:31:05 +08:00
// 提交选课
2025-06-30 23:44:07 +08:00
const submit = async () => {
// 判断是否已选课
if (selectedXkkcIds.value.length === 0) {
uni.showToast({
title: "请选择课程!",
icon: "none",
});
return;
}
uni.showLoading({
title: "抢课中...",
});
const params = {
xsId: curXs.value.id,
xm: curXs.value.xm,
xkId: curXk.value.id,
xkkcIds: selectedXkkcIds.value,
jzId: getUser.jzId,
qmFile: sign_file ? sign_file.value : "",
};
const res = await jzXkQkjApi(params);
uni.hideLoading();
if (res.resultCode === 1) {
// 跳转到支付页面
setData(res.result);
uni.reLaunch({
url: "/pages/base/course-selection/payment",
});
} else {
uni.showToast({
title: res.message,
icon: "none",
});
}
2025-06-29 21:31:05 +08:00
}
2025-05-07 09:44:23 +08:00
</script>
<style lang="scss" scoped>
.interest-course {
2025-05-16 16:16:41 +08:00
min-height: 100%;
2025-05-07 09:44:23 +08:00
background-color: #f5f7fa;
2025-05-16 16:16:41 +08:00
display: flex;
flex-direction: column;
height: 100%;
overflow: hidden;
2025-05-07 09:44:23 +08:00
}
.nav-bar {
display: flex;
align-items: center;
justify-content: space-between;
padding: 15px;
height: 44px;
background-color: #fff;
.nav-left {
width: 40px;
height: 40px;
display: flex;
align-items: center;
}
.nav-title {
font-size: 18px;
font-weight: 500;
color: #333;
}
.nav-right {
width: 40px;
display: flex;
justify-content: flex-end;
}
}
.selection-header {
2025-05-16 16:16:41 +08:00
background: linear-gradient(135deg, #4a90e2, #2879ff);
2025-05-07 09:44:23 +08:00
padding: 20px 15px;
2025-05-16 16:16:41 +08:00
color: #fff;
border-radius: 0 0 15px 15px;
box-shadow: 0 4px 12px rgba(40, 121, 255, 0.2);
position: sticky;
top: 0;
left: 0;
right: 0;
z-index: 10;
2025-05-07 09:44:23 +08:00
.header-content {
display: flex;
2025-05-16 16:16:41 +08:00
flex-direction: column;
gap: 15px;
2025-05-07 09:44:23 +08:00
}
2025-05-16 16:16:41 +08:00
}
// 可滚动内容区域样式
.scrollable-content {
flex: 1;
overflow-y: auto;
-webkit-overflow-scrolling: touch; // 增强iOS滚动体验
2025-05-07 09:44:23 +08:00
}
.register-btn-container {
2025-05-16 16:16:41 +08:00
position: sticky;
2025-05-07 09:44:23 +08:00
bottom: 0;
left: 0;
right: 0;
padding: 15px;
background-color: #fff;
2025-06-29 21:31:05 +08:00
z-index: 1;
2025-05-16 16:16:41 +08:00
box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.05);
2025-06-29 21:31:05 +08:00
.selected-count-info {
font-size: 14px;
color: #666;
margin-bottom: 8px;
}
2025-05-07 09:44:23 +08:00
.register-btn {
height: 50px;
line-height: 50px;
text-align: center;
background-color: #2879ff;
color: #fff;
border-radius: 25px;
font-size: 16px;
font-weight: 500;
}
2025-05-16 16:16:41 +08:00
}
2025-05-07 09:44:23 +08:00
</style>