194 lines
4.3 KiB
Vue
194 lines
4.3 KiB
Vue
<template>
|
|
<view class="interest-course">
|
|
<!-- 选课信息头部 - 固定部分 -->
|
|
<view class="selection-header">
|
|
<view class="header-content">
|
|
<!-- 选课类型选择部分 -->
|
|
<XkPicker title="俱乐部信息" :is-qk="true" xklx-id="816059832" :xs-id="curXs.id" @change="switchXk" />
|
|
<!-- 学生选择部分 -->
|
|
<XsPicker :is-bar="true" />
|
|
<!-- 倒计时-->
|
|
<XkCountdown :xk="curXk" @over="xkTimeOver" v-if="curXk && curXk.id" />
|
|
</view>
|
|
</view>
|
|
|
|
<!-- 可滚动的内容区域 -->
|
|
<view class="scrollable-content">
|
|
<XkkcList :xk="curXk" :can-selected="true" :multiple="true" @change="changeXkkc" />
|
|
</view>
|
|
|
|
<!-- 底部报名按钮 - 固定部分 -->
|
|
<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>
|
|
</view>
|
|
</template>
|
|
|
|
<script setup lang="ts">
|
|
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"
|
|
import XkkcList from "@/pages/base/components/XkkcList/index.vue"
|
|
import { jzXkQkjApi } from "@/api/base/server";
|
|
import { useUserStore } from "@/store/modules/user";
|
|
import { useDataStore } from "@/store/modules/data";
|
|
|
|
const { getCurXs, getUser } = useUserStore();
|
|
const { setData, getData } = useDataStore();
|
|
const { sign_file } = getData;
|
|
|
|
const curXs = computed(() => getCurXs);
|
|
const curXk = ref<any>({});
|
|
const selectedXkkcIds = ref<any>([]);
|
|
// 切换选课
|
|
const switchXk = (xk: any) => {
|
|
curXk.value = xk;
|
|
}
|
|
|
|
// 选课时间结束
|
|
const xkTimeOver = (val: any) => {
|
|
console.log(val);
|
|
}
|
|
|
|
// 选中课程
|
|
const changeXkkc = (ids: any) => {
|
|
selectedXkkcIds.value = ids;
|
|
}
|
|
|
|
// 提交选课
|
|
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",
|
|
});
|
|
}
|
|
}
|
|
|
|
</script>
|
|
|
|
<style lang="scss" scoped>
|
|
.interest-course {
|
|
min-height: 100%;
|
|
background-color: #f5f7fa;
|
|
display: flex;
|
|
flex-direction: column;
|
|
height: 100%;
|
|
overflow: hidden;
|
|
}
|
|
|
|
.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 {
|
|
background: linear-gradient(135deg, #4a90e2, #2879ff);
|
|
padding: 20px 15px;
|
|
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;
|
|
|
|
.header-content {
|
|
display: flex;
|
|
flex-direction: column;
|
|
gap: 15px;
|
|
|
|
}
|
|
}
|
|
|
|
// 可滚动内容区域样式
|
|
.scrollable-content {
|
|
flex: 1;
|
|
overflow-y: auto;
|
|
-webkit-overflow-scrolling: touch; // 增强iOS滚动体验
|
|
}
|
|
|
|
.register-btn-container {
|
|
position: sticky;
|
|
bottom: 0;
|
|
left: 0;
|
|
right: 0;
|
|
padding: 15px;
|
|
background-color: #fff;
|
|
z-index: 1;
|
|
box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.05);
|
|
|
|
.selected-count-info {
|
|
font-size: 14px;
|
|
color: #666;
|
|
margin-bottom: 8px;
|
|
}
|
|
|
|
.register-btn {
|
|
height: 50px;
|
|
line-height: 50px;
|
|
text-align: center;
|
|
background-color: #2879ff;
|
|
color: #fff;
|
|
border-radius: 25px;
|
|
font-size: 16px;
|
|
font-weight: 500;
|
|
}
|
|
}
|
|
|
|
</style>
|