调整选课查询

This commit is contained in:
ywyonui 2025-06-30 23:44:07 +08:00
parent 829508ba57
commit d20202af6d
7 changed files with 177 additions and 64 deletions

View File

@ -34,6 +34,11 @@ export const xkqddeleteApi = async (params: any) => {
return await post("/api/xkqd/delete?ids=" + params.ids); return await post("/api/xkqd/delete?ids=" + params.ids);
}; };
// 获取配置:家长端是否显示分钟数
export const getJzdShowFs = async (params: any) => {
return await get("/api/comConfig/getJzdShowFs");
};
/** /**
* *
*/ */
@ -58,15 +63,15 @@ export const drpkkbApi = async (params: any) => {
/** /**
* *
*/ */
export const xsXkListApi = async (params: any) => { export const xsKxApi = async (params: any) => {
return await get("/mobile/jz/xsxk/list", params); return await get("/mobile/jz/xkkc/list", params);
}; };
/** /**
* *
*/ */
export const xsXkkcListApi = async (params: any) => { export const xsYxListApi = async (params: any) => {
return await get("/mobile/jz/xkkc/list", params); return await get("/mobile/jz/xsxk/list", params);
}; };
/** /**
@ -83,7 +88,6 @@ export const xsKscjApi = async (params: any) => {
return await get("/mobile/jz/kscj", params); return await get("/mobile/jz/kscj", params);
}; };
/** /**
* *
*/ */

View File

@ -4,7 +4,7 @@
<view class="selection-header"> <view class="selection-header">
<view class="header-content"> <view class="header-content">
<!-- 选课类型选择部分 --> <!-- 选课类型选择部分 -->
<XkPicker title="俱乐部信息" :is-xs="true" xklx-id="816059832" :xs-id="curXs.id" :nj-id="curXs.njId" @change="switchXk" /> <XkPicker title="俱乐部信息" :is-qk="false" xklx-id="816059832" :xs-id="curXs.id" @change="switchXk" />
<!-- 学生选择部分 --> <!-- 学生选择部分 -->
<XsPicker :is-bar="true" /> <XsPicker :is-bar="true" />
</view> </view>
@ -12,7 +12,7 @@
<!-- 可滚动的内容区域 --> <!-- 可滚动的内容区域 -->
<view class="scrollable-content"> <view class="scrollable-content">
<XkkcList :xk="curXk" :can-selected="false" /> <XkkcList :xk="curXk" />
</view> </view>
</view> </view>

View File

@ -31,15 +31,17 @@
<script setup lang="ts"> <script setup lang="ts">
import { ref, watch } from "vue"; import { ref, watch } from "vue";
import { xsXkListApi, xsXkkcListApi } from "@/api/base/server"; import { xsKxApi, xsYxListApi } from "@/api/base/server";
import { useUserStore } from "@/store/modules/user"; import { useUserStore } from "@/store/modules/user";
import { useDataStore } from "@/store/modules/data";
const { getCurXs } = useUserStore(); const { getCurXs } = useUserStore();
const { setData } = useDataStore();
// //
const props = defineProps<{ const props = defineProps<{
isXs: boolean, // isQk: boolean, //
xsId: string, xsId: string,
njId: string,
xklxId: string, // Id962488654 / 816059832 xklxId: string, // Id962488654 / 816059832
title: string, title: string,
}>(); }>();
@ -47,8 +49,6 @@ const props = defineProps<{
// emit // emit
const emit = defineEmits(['change']) const emit = defineEmits(['change'])
const curXs = computed(() => getCurXs);
// //
const xkList = ref<any>([]); const xkList = ref<any>([]);
// //
@ -65,38 +65,56 @@ const loadXkList = async () => {
uni.showLoading({ uni.showLoading({
title: "加载中...", title: "加载中...",
}); });
const func = props.isXs ? xsXkListApi : xsXkkcListApi; const params = {
func({
xsId: props.xsId, xsId: props.xsId,
njId: props.njId, njmcId: getCurXs.njmcId,
xklxId: props.xklxId, xklxId: props.xklxId
}) };
.then((res) => { if (!props.isQk) {
if (res.resultCode == 1) { const res = await xsYxListApi(params);
if (res.result && res.result.length) { uni.hideLoading();
xkList.value = res.result; if (res.resultCode === 1 && res.result && res.result.length) {
curXk.value = res.result[0]; xkList.value = res.result;
switchXk(res.result[0]);
} else {
xkList.value = [];
switchXk({});
}
} else {
const res = await xsKxApi(params);
uni.hideLoading();
if (res.resultCode === 1) {
const result = res.result || {};
if (result.type && result.type === 1) {
if (result.xkList && result.xkList.length) {
xkList.value = result.xkList;
switchXk(result.xkList[0]);
} else { } else {
if (props.isXs) { uni.reLaunch({
xkList.value = []; url: "/pages/base/course-selection/notopen",
curXk.value = {}; });
} else {
uni.reLaunch({
url: "/pages/base/course-selection/notopen",
});
}
} }
switchXk(curXk.value); } else if (result.type && result.type === 2) {
uni.hideLoading(); //
setData(result);
uni.reLaunch({
url: "/pages/base/course-selection/payment",
});
} else {
uni.reLaunch({
url: "/pages/base/course-selection/notopen",
});
} }
}) } else {
.catch(() => { uni.reLaunch({
uni.hideLoading(); url: "/pages/base/course-selection/notopen",
}); });
}
}
} }
// //
function switchXk(xk: any) { const switchXk = (xk: any) => {
curXk.value = xk; curXk.value = xk;
showFlag.value = false; showFlag.value = false;
if (xk && xk.id) { if (xk && xk.id) {
@ -116,7 +134,7 @@ watch(() => props.xsId, (newVal) => {
}); });
// //
if (props.xsId && props.njId) { if (props.xsId) {
loadXkList(); loadXkList();
} }
</script> </script>

View File

@ -43,11 +43,16 @@ import { ref, watch } from "vue";
import { useDataStore } from "@/store/modules/data"; import { useDataStore } from "@/store/modules/data";
const { setKcData } = useDataStore(); const { setKcData } = useDataStore();
// //
const props = defineProps<{ const props = withDefaults(defineProps<{
xk: any, xk: any,
canSelected: boolean, canSelected: boolean,
}>(); multiple: boolean,
}>(), {
xk: () => ({}),
canSelected: false,
multiple: false,
});
// emit // emit
const emit = defineEmits(['change']) const emit = defineEmits(['change'])
@ -63,23 +68,37 @@ const toggleSelection = (xkkc: any) => {
// ID // ID
let selectedXkkcIds = uni.getStorageSync("selectedXkkcIds") || []; let selectedXkkcIds = uni.getStorageSync("selectedXkkcIds") || [];
if (xkkc.isSelected) { if (xkkc.isSelected) {
//
selectedXkkcIds = selectedXkkcIds.filter(
(id: string) => id !== xkkc.id
);
xkkc.isSelected = false; xkkc.isSelected = false;
if (props.multiple) {
//
selectedXkkcIds = selectedXkkcIds.filter(
(id: string) => id !== xkkc.id
);
} else {
//
selectedXkkcIds = [];
}
// xkkc.hasNum--; // xkkc.hasNum--;
} else { } else {
// //
const maxNum = xkkc.maxNum || 0; const maxNum = xkkc.maxNum || 0;
const hasNum = xkkc.hasNum || 0; const hasNum = xkkc.hasNum || 0;
if (maxNum > hasNum) { if (maxNum > hasNum) {
xkkc.isSelected = true; if (props.multiple) {
// //
if (!selectedXkkcIds.includes(xkkc.id)) { if (!selectedXkkcIds.includes(xkkc.id)) {
selectedXkkcIds.push(xkkc.id); selectedXkkcIds.push(xkkc.id);
// xkkc.hasNum++; // xkkc.hasNum++;
}
} else {
//
selectedXkkcIds = [xkkc.id];
//
xkkcList.value.forEach((xkkc: any) => {
xkkc.isSelected = false;
});
} }
xkkc.isSelected = true;
} }
} }
// //
@ -112,6 +131,7 @@ const switchXk = (xk: any) => {
} }
} }
uni.setStorageSync("selectedXkkcIds", newSelectedXkkcIds); uni.setStorageSync("selectedXkkcIds", newSelectedXkkcIds);
emit("change", newSelectedXkkcIds);
} }
// //

View File

@ -4,7 +4,7 @@
<view class="selection-header"> <view class="selection-header">
<view class="header-content"> <view class="header-content">
<!-- 选课类型选择部分 --> <!-- 选课类型选择部分 -->
<XkPicker title="俱乐部信息" :is-xs="false" xklx-id="816059832" :xs-id="curXs.id" :nj-id="curXs.njId" @change="switchXk" /> <XkPicker title="俱乐部信息" :is-qk="true" xklx-id="816059832" :xs-id="curXs.id" @change="switchXk" />
<!-- 学生选择部分 --> <!-- 学生选择部分 -->
<XsPicker :is-bar="true" /> <XsPicker :is-bar="true" />
<!-- 倒计时--> <!-- 倒计时-->
@ -14,7 +14,7 @@
<!-- 可滚动的内容区域 --> <!-- 可滚动的内容区域 -->
<view class="scrollable-content"> <view class="scrollable-content">
<XkkcList :xk="curXk" :can-selected="true" @change="changeXkkc" /> <XkkcList :xk="curXk" :can-selected="true" :multiple="true" @change="changeXkkc" />
</view> </view>
<!-- 底部报名按钮 - 固定部分 --> <!-- 底部报名按钮 - 固定部分 -->
@ -32,9 +32,13 @@ import XsPicker from "@/pages/base/components/XsPicker/index.vue"
import XkPicker from "@/pages/base/components/XkPicker/index.vue" import XkPicker from "@/pages/base/components/XkPicker/index.vue"
import XkCountdown from "@/pages/base/components/XkCountdown/index.vue" import XkCountdown from "@/pages/base/components/XkCountdown/index.vue"
import XkkcList from "@/pages/base/components/XkkcList/index.vue" import XkkcList from "@/pages/base/components/XkkcList/index.vue"
import { jzXkQkjApi } from "@/api/base/server";
import { useUserStore } from "@/store/modules/user"; import { useUserStore } from "@/store/modules/user";
import { useDataStore } from "@/store/modules/data";
const { getCurXs } = useUserStore(); const { getCurXs, getUser } = useUserStore();
const { setData, getData } = useDataStore();
const { sign_file } = getData;
const curXs = computed(() => getCurXs); const curXs = computed(() => getCurXs);
const curXk = ref<any>({}); const curXk = ref<any>({});
@ -51,13 +55,44 @@ const xkTimeOver = (val: any) => {
// //
const changeXkkc = (ids: any) => { const changeXkkc = (ids: any) => {
console.log(ids);
selectedXkkcIds.value = ids; selectedXkkcIds.value = ids;
} }
// //
const submit = () => { const submit = async () => {
console.log(selectedXkkcIds.value); //
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> </script>

View File

@ -4,7 +4,7 @@
<view class="selection-header"> <view class="selection-header">
<view class="header-content"> <view class="header-content">
<!-- 选课类型选择部分 --> <!-- 选课类型选择部分 -->
<XkPicker title="俱乐部信息" :is-xs="false" xklx-id="962488654" :xs-id="curXs.id" :nj-id="curXs.njId" @change="switchXk" /> <XkPicker title="俱乐部信息" :is-qk="true" xklx-id="962488654" :xs-id="curXs.id" @change="switchXk" />
<!-- 学生选择部分 --> <!-- 学生选择部分 -->
<XsPicker :is-bar="true" /> <XsPicker :is-bar="true" />
<!-- 倒计时--> <!-- 倒计时-->
@ -32,9 +32,14 @@ import XsPicker from "@/pages/base/components/XsPicker/index.vue"
import XkPicker from "@/pages/base/components/XkPicker/index.vue" import XkPicker from "@/pages/base/components/XkPicker/index.vue"
import XkCountdown from "@/pages/base/components/XkCountdown/index.vue" import XkCountdown from "@/pages/base/components/XkCountdown/index.vue"
import XkkcList from "@/pages/base/components/XkkcList/index.vue" import XkkcList from "@/pages/base/components/XkkcList/index.vue"
import { jzXkQkjApi } from "@/api/base/server";
import { useUserStore } from "@/store/modules/user"; import { useUserStore } from "@/store/modules/user";
import { useDataStore } from "@/store/modules/data";
const { getCurXs } = useUserStore(); const { getCurXs, getUser } = useUserStore();
const { setData, getData } = useDataStore();
const { sign_file } = getData;
const user = computed(() => getUser);
const curXs = computed(() => getCurXs); const curXs = computed(() => getCurXs);
const curXk = ref<any>({}); const curXk = ref<any>({});
@ -51,13 +56,44 @@ const xkTimeOver = (val: any) => {
// //
const changeXkkc = (ids: any) => { const changeXkkc = (ids: any) => {
console.log(ids);
selectedXkkcIds.value = ids; selectedXkkcIds.value = ids;
} }
// //
const submit = () => { const submit = async () => {
console.log(selectedXkkcIds.value); //
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> </script>

View File

@ -4,7 +4,7 @@
<view class="selection-header"> <view class="selection-header">
<view class="header-content"> <view class="header-content">
<!-- 选课类型选择部分 --> <!-- 选课类型选择部分 -->
<XkPicker title="兴趣课信息" :is-xs="true" xklx-id="962488654" :xs-id="curXs.id" :nj-id="curXs.njId" @change="switchXk" /> <XkPicker title="兴趣课信息" :is-qk="false" xklx-id="962488654" :xs-id="curXs.id" @change="switchXk" />
<!-- 学生选择部分 --> <!-- 学生选择部分 -->
<XsPicker :is-bar="true" /> <XsPicker :is-bar="true" />
</view> </view>
@ -12,7 +12,7 @@
<!-- 可滚动的内容区域 --> <!-- 可滚动的内容区域 -->
<view class="scrollable-content"> <view class="scrollable-content">
<XkkcList :xk="curXk" :can-selected="false" /> <XkkcList :xk="curXk" />
</view> </view>
</view> </view>