调整选课退费
This commit is contained in:
parent
e5428c663b
commit
c521ced5a0
@ -48,9 +48,9 @@ import { getByYwIdAndYwTypeApi } from "@/api/base/lcglSpApi";
|
||||
const props = withDefaults(defineProps<{
|
||||
ywId: string,
|
||||
ywType: string,
|
||||
showSqr: boolean,
|
||||
showSpr: boolean,
|
||||
showCsr: boolean,
|
||||
showSqr?: boolean,
|
||||
showSpr?: boolean,
|
||||
showCsr?: boolean,
|
||||
}>(), {
|
||||
ywId: '',
|
||||
ywType: '',
|
||||
|
||||
@ -561,6 +561,20 @@
|
||||
"enablePullDownRefresh": false
|
||||
}
|
||||
},
|
||||
{
|
||||
"path": "pages/view/routine/xk/tf/detail",
|
||||
"style": {
|
||||
"navigationBarTitleText": "选课退费详情",
|
||||
"enablePullDownRefresh": false
|
||||
}
|
||||
},
|
||||
{
|
||||
"path": "pages/view/routine/xk/tf/sp",
|
||||
"style": {
|
||||
"navigationBarTitleText": "选课退费审批",
|
||||
"enablePullDownRefresh": false
|
||||
}
|
||||
},
|
||||
{
|
||||
"path": "pages/view/routine/kefuxuncha/xcRecord",
|
||||
"style": {
|
||||
|
||||
146
src/pages/view/routine/xk/components/XkPaySuccessXkkc/index.vue
Normal file
146
src/pages/view/routine/xk/components/XkPaySuccessXkkc/index.vue
Normal file
@ -0,0 +1,146 @@
|
||||
<template>
|
||||
<view class="xkqd-list">
|
||||
<!-- 课程信息卡片 -->
|
||||
<view class="info-card" v-for="(item, index) in dataList" :key="index" @click="handleClick(item)">
|
||||
<view class="card-header">
|
||||
<view class="card-title">课程信息</view>
|
||||
<view class="card-actions" v-if="canSelected">
|
||||
<view class="radio-container">
|
||||
<uni-icons
|
||||
:type="item.selected ? 'checkbox-filled' : 'circle'"
|
||||
:color="item.selected ? '#3FBF72' : '#ccc'"
|
||||
size="30"
|
||||
></uni-icons>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<view class="divider"></view>
|
||||
|
||||
<view class="course-info">
|
||||
<image
|
||||
class="course-image"
|
||||
:src="(item.lxTp || item.lxtp) ? imagUrl((item.lxTp || item.lxtp)) : '/static/base/home/11222.png'"
|
||||
mode="aspectFill"
|
||||
></image>
|
||||
<view class="course-details">
|
||||
<view class="course-name">{{ item.kcmc }}</view>
|
||||
<view class="course-teacher">开课老师:{{ item.jsName }}</view>
|
||||
<view class="course-location">上课地点:{{ item.kcdd }}</view>
|
||||
<view class="course-price" v-if="(item.kcje || item.jfje) > 0"
|
||||
>金额:<text class="price-value">¥{{ item.kcje || item.jfje }}</text></view
|
||||
>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import { imagUrl } from "@/utils";
|
||||
|
||||
// 接收外部传入属性并设置默认值
|
||||
const props = withDefaults(defineProps<{
|
||||
dataList: any[];
|
||||
canSelected?: boolean,
|
||||
}>(), {
|
||||
xk: () => ({}),
|
||||
canSelected: false,
|
||||
});
|
||||
|
||||
const handleClick = (item: any) => {
|
||||
if (!props.canSelected) {
|
||||
return;
|
||||
}
|
||||
item.selected = !item.selected;
|
||||
};
|
||||
|
||||
// 获取已选课程列表
|
||||
const getSelectedList = () => {
|
||||
const list = props.dataList || [];
|
||||
return list.filter((item: any) => item.selected);
|
||||
};
|
||||
|
||||
defineExpose({
|
||||
getSelectedList,
|
||||
});
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.xkqd-list {
|
||||
padding: 0 15px;
|
||||
}
|
||||
|
||||
.info-card {
|
||||
background-color: #fff;
|
||||
border-radius: 10px;
|
||||
padding: 15px;
|
||||
margin-bottom: 20px;
|
||||
}
|
||||
|
||||
.card-header {
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
align-items: center;
|
||||
}
|
||||
|
||||
.card-title {
|
||||
font-size: 18px;
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
.divider {
|
||||
height: 1px;
|
||||
background-color: #eee;
|
||||
margin: 10px 0;
|
||||
}
|
||||
|
||||
.course-info {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
}
|
||||
|
||||
.course-image {
|
||||
width: 100px;
|
||||
height: 100px;
|
||||
border-radius: 5px;
|
||||
margin-right: 15px;
|
||||
}
|
||||
|
||||
.course-details {
|
||||
flex: 1;
|
||||
}
|
||||
|
||||
.course-name {
|
||||
font-size: 16px;
|
||||
font-weight: bold;
|
||||
margin-bottom: 5px;
|
||||
}
|
||||
|
||||
.course-teacher,
|
||||
.course-location {
|
||||
font-size: 14px;
|
||||
color: #666;
|
||||
margin-bottom: 5px;
|
||||
}
|
||||
|
||||
.course-price {
|
||||
font-size: 14px;
|
||||
color: #ff6600;
|
||||
}
|
||||
|
||||
.price-value {
|
||||
font-size: 16px;
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
.radio-container {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
}
|
||||
|
||||
.radio-container uni-icons {
|
||||
transition: all 0.3s ease;
|
||||
}
|
||||
</style>
|
||||
99
src/pages/view/routine/xk/components/XkPayXs/index.vue
Normal file
99
src/pages/view/routine/xk/components/XkPayXs/index.vue
Normal file
@ -0,0 +1,99 @@
|
||||
<template>
|
||||
<view class="info-card">
|
||||
<view class="card-title">报名信息</view>
|
||||
<view class="divider"></view>
|
||||
|
||||
<view class="student-info">
|
||||
<view class="student-avatar">
|
||||
<image :src="curXs.xstxUrl || '/static/base/home/11222.png'" class="tx-img"></image>
|
||||
</view>
|
||||
<view class="student-details">
|
||||
<view class="student-name">
|
||||
{{ curXs.xm }}
|
||||
</view>
|
||||
<view class="student-class"
|
||||
>{{ curXs.njmc }}{{ curXs.bjmc }}</view
|
||||
>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
|
||||
// 接收外部传入属性并设置默认值
|
||||
const props = withDefaults(defineProps<{
|
||||
xs: any;
|
||||
}>(), {
|
||||
xs: () => ({})
|
||||
});
|
||||
|
||||
const curXs = computed(() => {
|
||||
console.log('学生', props.xs);
|
||||
return props.xs;
|
||||
});
|
||||
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
|
||||
.info-card {
|
||||
margin: 15px;
|
||||
background-color: #fff;
|
||||
border-radius: 8px;
|
||||
padding: 15px;
|
||||
box-shadow: 0 2px 6px rgba(0, 0, 0, 0.05);
|
||||
|
||||
.card-title {
|
||||
font-size: 16px;
|
||||
font-weight: bold;
|
||||
color: #333;
|
||||
margin-bottom: 10px;
|
||||
}
|
||||
|
||||
.divider {
|
||||
height: 1px;
|
||||
background-color: #eee;
|
||||
margin-bottom: 15px;
|
||||
}
|
||||
}
|
||||
|
||||
.student-info {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
|
||||
.student-avatar {
|
||||
width: 60px;
|
||||
height: 60px;
|
||||
margin-right: 15px;
|
||||
border-radius: 50%;
|
||||
overflow: hidden;
|
||||
|
||||
image {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
}
|
||||
}
|
||||
|
||||
.student-details {
|
||||
.student-name {
|
||||
font-size: 18px;
|
||||
font-weight: 500;
|
||||
color: #333;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
margin-bottom: 5px;
|
||||
|
||||
.gender-icon {
|
||||
margin-left: 5px;
|
||||
}
|
||||
}
|
||||
|
||||
.student-class {
|
||||
font-size: 14px;
|
||||
color: #666;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
</style>
|
||||
@ -1,22 +1,179 @@
|
||||
<template>
|
||||
<view>
|
||||
|
||||
</view>
|
||||
<BasicLayout>
|
||||
<view class="xkTf-info">
|
||||
<!-- 学生信息卡片 -->
|
||||
<XkPayXs :xs="curXs" />
|
||||
|
||||
<!-- 课程信息卡片 -->
|
||||
<XkPaySuccessXkkc :dataList="xkTfQdList" />
|
||||
|
||||
<!-- 退费信息卡片 -->
|
||||
<view class="xkTf-card">
|
||||
<view class="card-body">
|
||||
<view class="info-column">
|
||||
<text class="label">退费说明:</text>
|
||||
<text class="value">{{ xkTf.tfSm }}</text>
|
||||
</view>
|
||||
<view class="info-column">
|
||||
<text class="label">缴费凭证:</text>
|
||||
<text class="value">
|
||||
<PreviewImage :image-list="jfPzList" empty-text="无缴费凭证" />
|
||||
</text>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
<!-- 审批流程 -->
|
||||
<LcglSpList :yw-id="xkTf.id" yw-type="XK_TF" />
|
||||
</view>
|
||||
<template #bottom>
|
||||
<view class="white-bg-color py-5">
|
||||
<view class="flex-row items-center pb-10 pt-5">
|
||||
<u-button text="返回" class="ml-15 mr-7" :plain="true" @click="goHome" />
|
||||
</view>
|
||||
</view>
|
||||
</template>
|
||||
</BasicLayout>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
|
||||
}
|
||||
<script setup lang="ts">
|
||||
import { onLoad } from "@dcloudio/uni-app";
|
||||
import { useDataStore } from "@/store/modules/data";
|
||||
import { useUserStore } from "@/store/modules/user";
|
||||
import { imagUrl } from "@/utils";
|
||||
import XkPayXs from "../components/XkPayXs/index.vue"
|
||||
import XkPaySuccessXkkc from "../components/XkPaySuccessXkkc/index.vue"
|
||||
import LcglSpList from "@/components/LcglSpList/index.vue";
|
||||
import PreviewImage from "@/components/PreviewImage/index.vue";
|
||||
import { getXkTfDetailByIdApi } from "@/api/base/xkTfApi";
|
||||
import { xxtsFindByIdApi } from "@/api/base/xxtsApi";
|
||||
const { loginByOpenId } = useUserStore();
|
||||
const { getTf, getData } = useDataStore();
|
||||
|
||||
const curXs = ref<any>({});
|
||||
const xkTf = ref<any>({});
|
||||
const xkTfQdList = ref<any>([]);
|
||||
const jfPzList = ref<any>([]);
|
||||
|
||||
// 返回首页
|
||||
const goHome = () => {
|
||||
uni.reLaunch({
|
||||
url: "/pages/base/home/index"
|
||||
});
|
||||
};
|
||||
|
||||
// 初始化数据
|
||||
const initData = (tf: any, xs: any, tfQdList: any[]) => {
|
||||
if (xs) {
|
||||
xs.xstxUrl = imagUrl(xs.xstx) || "";
|
||||
}
|
||||
curXs.value = xs;
|
||||
xkTf.value = tf;
|
||||
xkTfQdList.value = tfQdList;
|
||||
const jfPz = tf.jfPz || '';
|
||||
// 缴费凭证逗号分隔
|
||||
jfPzList.value = jfPz.split(',') || [];
|
||||
};
|
||||
|
||||
// 获取详情
|
||||
const loadData = async (id: string) => {
|
||||
const res = await getXkTfDetailByIdApi(id);
|
||||
if (!res.result) {
|
||||
uni.showToast({ title: '未找到数据', icon: 'none' });
|
||||
goHome();
|
||||
}
|
||||
nextTick(() => {
|
||||
initData(res.result.xkTf, res.result.xs, res.result.xkTfQdList);
|
||||
});
|
||||
};
|
||||
|
||||
// 从待办加载
|
||||
const loadByDb = async (data: any) => {
|
||||
// 检查登录状态
|
||||
const isLoggedIn = await loginByOpenId(data.openId);
|
||||
if (!isLoggedIn) {
|
||||
console.log("用户未登录,跳过处理");
|
||||
return;
|
||||
}
|
||||
try {
|
||||
// 优先从后端根据url中的id去查询Xxts
|
||||
const xxtsRes = await xxtsFindByIdApi({ id: data.id });
|
||||
if (xxtsRes && xxtsRes.result) {
|
||||
const xxts = xxtsRes.result;
|
||||
// 根据主表ID去查询信息
|
||||
await loadData(xxts.xxzbId);
|
||||
}
|
||||
} catch (error) {
|
||||
console.error("获取待办信息失败", error);
|
||||
}
|
||||
};
|
||||
|
||||
onLoad(async (data: any) => {
|
||||
// 从待办过来的,需要从后端获取数据
|
||||
if (data && data.from && data.from == "db") {
|
||||
loadByDb(data);
|
||||
} else if (getTf && getTf.xkTf) {
|
||||
// 表示包含了退费信息
|
||||
initData(getTf.xkTf, getTf.xs, getTf.xkTfQdList);
|
||||
} else if (getData && getData.id) {
|
||||
await loadData(getData.id);
|
||||
}
|
||||
});
|
||||
|
||||
</script>
|
||||
|
||||
<style>
|
||||
<style lang="scss" scoped>
|
||||
.xkTf-info {
|
||||
background-color: #f5f7fa;
|
||||
|
||||
.xkTf-card {
|
||||
margin: 15px;
|
||||
background-color: #fff;
|
||||
border-radius: 8px;
|
||||
padding: 15px;
|
||||
box-shadow: 0 2px 6px rgba(0, 0, 0, 0.05);
|
||||
|
||||
.card-body {
|
||||
|
||||
.info-row {
|
||||
display: flex;
|
||||
margin-bottom: 10px;
|
||||
|
||||
.label {
|
||||
font-size: 14px;
|
||||
color: #bbb;
|
||||
width: 70px;
|
||||
flex-shrink: 0;
|
||||
margin-right: 8px;
|
||||
}
|
||||
|
||||
.value {
|
||||
font-size: 14px;
|
||||
color: #333;
|
||||
flex: 1;
|
||||
}
|
||||
}
|
||||
|
||||
.info-column {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
|
||||
.label {
|
||||
font-size: 14px;
|
||||
color: #bbb;
|
||||
flex-shrink: 0;
|
||||
margin-right: 8px;
|
||||
width: 100%;
|
||||
margin-bottom: 5px;
|
||||
}
|
||||
|
||||
.value {
|
||||
font-size: 14px;
|
||||
color: #333;
|
||||
flex: 1;
|
||||
margin-bottom: 10px;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
</style>
|
||||
|
||||
@ -1,22 +1,210 @@
|
||||
<template>
|
||||
<view>
|
||||
|
||||
</view>
|
||||
<BasicLayout>
|
||||
<view class="xkTf-info">
|
||||
<!-- 学生信息卡片 -->
|
||||
<XkPayXs :xs="curXs" />
|
||||
|
||||
<!-- 课程信息卡片 -->
|
||||
<XkPaySuccessXkkc :dataList="xkTfQdList" />
|
||||
|
||||
<!-- 退费信息卡片 -->
|
||||
<view class="xkTf-card">
|
||||
<view class="card-body">
|
||||
<view class="info-column">
|
||||
<text class="label">退费说明:</text>
|
||||
<text class="value">{{ xkTf.tfSm }}</text>
|
||||
</view>
|
||||
<view class="info-column">
|
||||
<text class="label">缴费凭证:</text>
|
||||
<text class="value">
|
||||
<PreviewImage :image-list="jfPzList" empty-text="无缴费凭证" />
|
||||
</text>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
<!-- 审批流程 -->
|
||||
<LcglSpList :yw-id="xkTf.id" yw-type="XK_TF" />
|
||||
</view>
|
||||
<template #bottom>
|
||||
<view class="white-bg-color py-5">
|
||||
<view class="flex-row items-center pb-10 pt-5">
|
||||
<u-button text="驳回" class="ml-15 mr-7" :plain="true" @click="showDlg" />
|
||||
<u-button text="同意" class="mr-15 mr-7" type="primary" @click="submit" />
|
||||
</view>
|
||||
</view>
|
||||
</template>
|
||||
<!-- 驳回弹窗 -->
|
||||
<u-popup :show="dlgFlag" mode="center" :closeOnClickOverlay="false" @close="closeDlg">
|
||||
<view class="popup-content">
|
||||
<view class="popup-title">驳回原因</view>
|
||||
<u-input v-model="rejectReason" type="textarea" placeholder="请填写驳回原因" :autoHeight="true" maxlength="200" />
|
||||
<view class="popup-actions flex-row justify-end mt-4">
|
||||
<u-button class="mr-2" @click="closeDlg">取消</u-button>
|
||||
<u-button type="primary" @click="handleReject">确定</u-button>
|
||||
</view>
|
||||
</view>
|
||||
</u-popup>
|
||||
</BasicLayout>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
|
||||
}
|
||||
<script setup lang="ts">
|
||||
import { onLoad } from "@dcloudio/uni-app";
|
||||
import { useUserStore } from "@/store/modules/user";
|
||||
import { imagUrl } from "@/utils";
|
||||
import XkPayXs from "../components/XkPayXs/index.vue"
|
||||
import XkPaySuccessXkkc from "../components/XkPaySuccessXkkc/index.vue"
|
||||
import LcglSpList from "@/components/LcglSpList/index.vue";
|
||||
import PreviewImage from "@/components/PreviewImage/index.vue";
|
||||
import { getXkTfDetailByIdApi, xkTfSpApi } from "@/api/base/xkTfApi";
|
||||
import { XkTfPageUtils } from "@/utils/xkTfPageUtils";
|
||||
const { getJs } = useUserStore();
|
||||
|
||||
const curXs = ref<any>({});
|
||||
const xkTf = ref<any>({});
|
||||
const xkTfQdList = ref<any>([]);
|
||||
const jfPzList = ref<any>([]);
|
||||
|
||||
const dbFlag = ref(false);
|
||||
const xkTfId = ref('');
|
||||
|
||||
const dlgFlag = ref(false);
|
||||
const rejectReason = ref("");
|
||||
const showDlg = () => {
|
||||
dlgFlag.value = true;
|
||||
};
|
||||
|
||||
const closeDlg = () => {
|
||||
dlgFlag.value = false;
|
||||
};
|
||||
|
||||
const goHome = () => {
|
||||
uni.reLaunch({
|
||||
url: "/pages/base/service/index"
|
||||
});
|
||||
};
|
||||
|
||||
// 初始化数据
|
||||
const initData = (tf: any, xs: any, tfQdList: any[]) => {
|
||||
if (xs) {
|
||||
xs.xstxUrl = imagUrl(xs.xstx) || "";
|
||||
}
|
||||
console.log('initData学生', xs);
|
||||
curXs.value = xs;
|
||||
xkTf.value = tf;
|
||||
xkTfQdList.value = tfQdList;
|
||||
const jfPz = tf.jfPz || '';
|
||||
// 缴费凭证逗号分隔
|
||||
jfPzList.value = jfPz.split(',') || [];
|
||||
};
|
||||
|
||||
// 获取详情
|
||||
const loadData = async (id: string) => {
|
||||
const res = await getXkTfDetailByIdApi(id);
|
||||
if (!res.result) {
|
||||
uni.showToast({ title: '未找到数据', icon: 'none' });
|
||||
goHome();
|
||||
}
|
||||
nextTick(() => {
|
||||
initData(res.result.xkTf, res.result.xs, res.result.xkTfQdList);
|
||||
});
|
||||
};
|
||||
|
||||
const submit = async () => {
|
||||
const params = {
|
||||
xkTfId: xkTfId.value,
|
||||
jsId: getJs.id,
|
||||
spStatus: "approved",
|
||||
spRemark: "同意",
|
||||
};
|
||||
uni.showLoading({ title: "确认中..." });
|
||||
await xkTfSpApi(params);
|
||||
uni.hideLoading();
|
||||
goHome();
|
||||
};
|
||||
|
||||
// 驳回处理
|
||||
const handleReject = async () => {
|
||||
if (!rejectReason.value.trim()) {
|
||||
uni.showToast({ title: "请填写驳回意见", icon: "none" });
|
||||
return;
|
||||
}
|
||||
const params = {
|
||||
xkTfId: xkTfId.value,
|
||||
jsId: getJs.id,
|
||||
spStatus: "rejected",
|
||||
spRemark: rejectReason.value,
|
||||
};
|
||||
uni.showLoading({ title: "正在驳回..." });
|
||||
await xkTfSpApi(params);
|
||||
uni.hideLoading();
|
||||
closeDlg();
|
||||
goHome();
|
||||
};
|
||||
|
||||
onLoad(async (data?: any) => {
|
||||
const ret = await XkTfPageUtils.init(data);
|
||||
if (!ret || !ret.success) {
|
||||
return;
|
||||
}
|
||||
xkTfId.value = ret.xkTfId;
|
||||
dbFlag.value = ret.dbFlag;
|
||||
await loadData(xkTfId.value);
|
||||
});
|
||||
</script>
|
||||
|
||||
<style>
|
||||
<style lang="scss" scoped>
|
||||
.xkTf-info {
|
||||
background-color: #f5f7fa;
|
||||
|
||||
</style>
|
||||
.xkTf-card {
|
||||
margin: 15px;
|
||||
background-color: #fff;
|
||||
border-radius: 8px;
|
||||
padding: 15px;
|
||||
box-shadow: 0 2px 6px rgba(0, 0, 0, 0.05);
|
||||
|
||||
.card-body {
|
||||
|
||||
.info-row {
|
||||
display: flex;
|
||||
margin-bottom: 10px;
|
||||
|
||||
.label {
|
||||
font-size: 14px;
|
||||
color: #bbb;
|
||||
width: 70px;
|
||||
flex-shrink: 0;
|
||||
margin-right: 8px;
|
||||
}
|
||||
|
||||
.value {
|
||||
font-size: 14px;
|
||||
color: #333;
|
||||
flex: 1;
|
||||
}
|
||||
}
|
||||
|
||||
.info-column {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
|
||||
.label {
|
||||
font-size: 14px;
|
||||
color: #bbb;
|
||||
flex-shrink: 0;
|
||||
margin-right: 8px;
|
||||
width: 100%;
|
||||
margin-bottom: 5px;
|
||||
}
|
||||
|
||||
.value {
|
||||
font-size: 14px;
|
||||
color: #333;
|
||||
flex: 1;
|
||||
margin-bottom: 10px;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
</style>
|
||||
BIN
src/static/base/home/11222.png
Normal file
BIN
src/static/base/home/11222.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 11 KiB |
@ -10,6 +10,7 @@ export const useDataStore = defineStore({
|
||||
file: {},
|
||||
xs: {}, // 学生专用
|
||||
jcBz: {}, // 就餐标准
|
||||
tf: {}
|
||||
}),
|
||||
getters: {
|
||||
getData(): any {
|
||||
@ -33,6 +34,9 @@ export const useDataStore = defineStore({
|
||||
getJcBz(): any {
|
||||
return this.jcBz;
|
||||
},
|
||||
getTf(): any {
|
||||
return this.tf;
|
||||
},
|
||||
},
|
||||
actions: {
|
||||
setData(data: any) {
|
||||
@ -55,6 +59,9 @@ export const useDataStore = defineStore({
|
||||
},
|
||||
setJcBz(data: any) {
|
||||
this.jcBz = data;
|
||||
},
|
||||
setTf(data: any) {
|
||||
this.tf = data;
|
||||
}
|
||||
},
|
||||
persist: {
|
||||
|
||||
64
src/utils/xkTfPageUtils.ts
Normal file
64
src/utils/xkTfPageUtils.ts
Normal file
@ -0,0 +1,64 @@
|
||||
import { xxtsFindByIdApi } from "@/api/base/server";
|
||||
import { useUserStore } from "@/store/modules/user";
|
||||
import { useDataStore } from "@/store/modules/data";
|
||||
|
||||
const { loginByOpenId } = useUserStore();
|
||||
const { getData, setXxts, setData, getXxts } = useDataStore();
|
||||
|
||||
export const XkTfPageUtils = {
|
||||
async init(data?: any) {
|
||||
let ret = {
|
||||
success: true,
|
||||
dbFlag: false,
|
||||
xkTfId: getData.id,
|
||||
};
|
||||
if (!data || !data.from || data.from != "db") {
|
||||
return ret;
|
||||
}
|
||||
// 从待办过来的,需要从后端获取数据
|
||||
ret.dbFlag = true;
|
||||
// 检查登录状态
|
||||
const isLoggedIn = await loginByOpenId(data.openId);
|
||||
if (!isLoggedIn) {
|
||||
console.log("用户未登录,跳过处理");
|
||||
ret.success = false;
|
||||
return ret;
|
||||
}
|
||||
let url = "/pages/base/message/index";
|
||||
try {
|
||||
// 优先从后端根据url中的id去查询Xxts
|
||||
const xxtsRes = await xxtsFindByIdApi({ id: data.id });
|
||||
if (xxtsRes && xxtsRes.result) {
|
||||
const xxts = xxtsRes.result;
|
||||
// 检查待办状态
|
||||
if (xxts.dbZt === "B") {
|
||||
setData({ id: xxts.xxzbId });
|
||||
url = "/pages/view/routine/xk/tf/detail";
|
||||
uni.reLaunch({ url });
|
||||
ret.success = false;
|
||||
} else {
|
||||
setXxts(xxts);
|
||||
ret.xkTfId = xxts.xxzbId;
|
||||
}
|
||||
} else {
|
||||
uni.showToast({
|
||||
title: "获取消息推送数据失败",
|
||||
icon: "error",
|
||||
});
|
||||
uni.reLaunch({ url });
|
||||
ret.success = false;
|
||||
}
|
||||
return ret;
|
||||
} catch (error) {
|
||||
console.error("获取待办信息失败", error);
|
||||
// 如果获取Xxts失败,回退到原来的逻辑
|
||||
const xxtsData = getXxts;
|
||||
if (xxtsData && xxtsData.dbZt === "B") {
|
||||
setData({ id: data.id });
|
||||
uni.reLaunch({ url });
|
||||
ret.success = false;
|
||||
return ret;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Loading…
x
Reference in New Issue
Block a user