Files
zhxg_app_v1.0/pages/award/award.vue
2025-07-16 15:34:34 +08:00

626 lines
14 KiB
Vue
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<template>
<view>
<view class="award" v-if="notReApply">
<!-- 学生信息 -->
<view class="userinfo">
<view class="left">
<view v-for="(v,i) in score_list" :key="i" style="border-bottom: 1px dotted lightblue;">
<text>学年{{v.stuYearName}}</text><br />
<text>平均学分绩班级排名{{ v.stuClassRank + '/' + v.classCount}}</text><br />
<text>综合素质测评班级排名{{ v.cphClassRank + '/' + v.classCount}}</text>
</view>
</view>
<view class="right">
<button @click="apply">申请</button>
<view class="eye" @click="openPopup">
<image src="../../static/eye.png" mode=""></image>
<text>申请条件</text>
</view>
</view>
</view>
<!-- 学生信息结束 -->
<view class="awardList">
<view @click="doClick(item)" class="List" v-for="(item,index) in awardList" :key="index">
<view class="awardListleft">
<text class="title"> 奖项:{{item.typeName}}</text>
<text>时间:{{item.applyTime}}</text>
<view v-if="item.applyStatus == '10'" style="color: red;font-size: 0.8rem;">
点击重新提交
</view>
<view style="width: 350rpx;border-bottom: 1px dotted lightblue;"
v-if="!isEmpty(item.fdyComment)">
辅导员意见: <br />
<text style="font-size: 12px;">{{item.fdyComment}}</text>
</view>
<view style="width: 350rpx;border-bottom: 1px dotted lightblue;"
v-if="!isEmpty(item.deptComment)">
学院意见:<br />
<text style="font-size: 12px;">{{item.deptComment}}</text>
</view>
<view style="width: 350rpx;border-bottom: 1px dotted lightblue;"
v-if="!isEmpty(item.finalComment)">
学校意见:<br />
<text style="font-size: 12px;">{{item.finalComment}}</text>
</view>
</view>
<view class="awardListright">
<uni-tag :inverted="true" :text="getStatus(item.applyStatus)" type="success" />
</view>
</view>
</view>
</view>
<view v-else class="reApplyForm">
<view class="container">
<!-- 奖项 -->
<view class="form-item">
<text class="label">奖项</text>
<picker :range="options" v-model="selectedOptionIndex" @change="onPickerChange">
<view class="select">{{ options[selectedOptionIndex] || '请选择奖项' }} </view>
</picker>
</view>
<!-- 政治面貌选择 -->
<view class="form-item">
<text class="label">政治面貌</text>
<picker :range="politicalOptions" v-model="selectedPoliticalIndex" @change="onPoliticalChange">
<view class="select">{{ politicalOptions[selectedPoliticalIndex] || '请选择政治面貌' }}</view>
</picker>
</view>
<!-- 职务输入 -->
<view class="form-item">
<text class="label">职务</text>
<input v-model="position" class="uni-input" focus placeholder="请输入职务" />
</view>
<!-- 银行卡号输入 -->
<view class="form-item">
<text class="label">银行卡号</text>
<input v-model="cardID" class="uni-input" focus placeholder="请输入银行卡号" />
</view>
<!-- 开户行 -->
<view class="form-item">
<text class="label">开户行</text>
<input v-model="bank" class="uni-input" focus placeholder="请输入开户行" />
</view>
<!-- 获奖情况 -->
<view class="form-text">
<text class="label">获奖情况</text>
<view class="txt">
<uni-forms-item>
<uni-easyinput type="textarea" v-model="introduction" maxlength="1000"
placeholder="请输入获奖情况" />
</uni-forms-item>
</view>
</view>
<!-- 主要事迹 -->
<view class="form-text">
<text class="label">主要事迹</text>
<view class="txt">
<uni-forms-item>
<uni-easyinput type="textarea" v-model="deeds" maxlength="1000" placeholder="请输入主要事迹" />
</uni-forms-item>
</view>
</view>
<!-- 按钮 -->
<button @click="showPopup">提交申请</button>
</view>
</view>
</view>
</template>
<script>
import {
listOwnScoreClassRank,
listXyjxjCanType,
getOwnPassCountByCode,
getOwnIamCountByCode,
getOwnRankByCode
} from "@/api/good/index.js";
import {
listOwnXyjxjApply,
reApply
} from "@/api/good/xyjxj.js";
import {
getDict,
isEmpty
} from "@/api/helpFunc/index.js";
import {
alipayVali
} from "@/api/helpFunc/bank";
export default {
data() {
return {
isEmpty,
notReApply: true,
credit: "1",
ranking: "1",
year: "2023-2024",
awardList: [],
score_list: [],
can_list: [],
status_list: [],
applyForm: {
},
options: [], // 奖项选项
selectedOptionIndex: 0, // 当前选中的奖项索引
politicalOptions: ['群众', '共青团员', '中共党员'], // 政治面貌选项
selectedPoliticalIndex: 0, // 当前选中的政治面貌索引
position: '', // 职务,
cardID: "", // 银行卡号,
bank: '',
introduction: "",
deeds: "",
}
},
async onShow() {
uni.showLoading();
await this.getDictStatus();
await this.getList();
await this.listCan();
await this.listOwnScoreClassRank();
uni.hideLoading();
},
methods: {
// 当选择发生变化时触发
onPickerChange(event) {
this.selectedOptionIndex = event.detail.value;
},
// 政治面貌选择改变时触发
onPoliticalChange(event) {
this.selectedPoliticalIndex = event.detail.value;
},
async showPopup() {
let sdata = {
applyId: this.applyForm.id,
typeCode: this.can_list[this.selectedOptionIndex].typeCode,
zzmm: this.politicalOptions[this.selectedPoliticalIndex],
classPost: this.position,
bankCard: this.cardID,
bankAddr: this.bank,
goodHis: this.introduction,
mainHis: this.deeds
}
if (isEmpty(sdata.typeCode)) {
uni.showToast({
title: "请选择奖项",
icon: "none"
});
return;
}
if (isEmpty(sdata.zzmm)) {
uni.showToast({
title: "请填写政治面貌",
icon: "none"
});
return;
}
if (isEmpty(sdata.classPost)) {
uni.showToast({
title: "请填写职务",
icon: "none"
});
return;
}
if (isEmpty(sdata.bankCard)) {
uni.showToast({
title: "请填写中国农业银行银行卡号",
icon: "none"
});
return;
}
if (isEmpty(sdata.bankAddr)) {
uni.showToast({
title: "请填写开户行",
icon: "none"
});
return;
}
if (isEmpty(sdata.goodHis)) {
uni.showToast({
title: "请填写获奖记录",
icon: "none"
});
return;
}
if (isEmpty(sdata.mainHis)) {
uni.showToast({
title: "请填写主要事迹",
icon: "none"
});
return;
}
if (sdata.mainHis.length < 100) {
uni.showToast({
title: "主要事迹字数需要100字以上",
icon: "none"
});
return;
}
let card = sdata.bankCard;
let boolCard = await alipayVali(card);
if (boolCard.validated == false) {
uni.showToast({
title: "请输入正确的银行卡号",
icon: "none"
});
return;
}
if (boolCard.bank != "ABC") {
uni.showToast({
title: "请输入正确的中国农业银行银行卡号",
icon: "none"
});
return;
}
uni.showLoading();
let res = await reApply(sdata);
uni.hideLoading();
if (res.code == 200) {
uni.showToast({
title: '申请成功',
icon: 'success',
duration: 2000, // 弹窗持续时间,单位为毫秒
success() {
setTimeout(() => {
uni.navigateTo({
url: '/pages/award/award' // 替换为您要跳转的页面路径
});
}, 1000); // 等待2秒后执行页面跳转确保用户能看到弹窗内容
}
});
} else {
uni.showToast({
title: res.msg,
icon: "error"
});
}
},
doClick(item) {
console.log(item);
if (item.applyStatus == "10") {
this.notReApply = false;
this.applyForm.id = item.id;
this.deeds = item.mainHis;
this.introduction = item.goodHis;
this.cardID = item.bankCard;
this.bank = item.bankAddr;
this.position = item.classPost;
this.can_list.map((v, i) => {
if (v.typeCode == item.typeCode) {
this.selectedOptionIndex = i;
}
});
this.politicalOptions.map((v, i) => {
if (v == item.zzmm) {
this.selectedPoliticalIndex = i;
}
});
}
},
getStatus(status) {
let data = this.status_list.filter(x => x.dictValue == status.toString());
if (data != null && data.length != 0) {
return data[0].dictLabel;
} else {
return "无";
}
},
async getDictStatus() {
let res = await getDict("audius_detail_type");
if (res.code == 200) {
this.status_list = [...res.data];
}
},
async getList() {
let res = await listOwnXyjxjApply();
if (res.code == 200) {
this.awardList = [...res.rows];
}
},
async listCan() {
let res = await listXyjxjCanType();
if (res.code == 200) {
this.can_list = [...res.data];
this.options = this.can_list.map(x => x.typeName);
}
},
async listOwnScoreClassRank() {
let res = await listOwnScoreClassRank();
if (res.code == 200) {
this.score_list = [...res.data]
}
},
async apply() {
uni.showLoading();
let cans = [...this.can_list];
if (cans.length == 0) {
uni.showToast({
title: "当前没有可申请的项目",
icon: "none"
});
uni.hideLoading();
return;
} else {
let code = cans[0].typeCode;
let res1 = await getOwnPassCountByCode(code);
if (res1.code == 200) {
if (isEmpty(res1.data)) {
uni.showToast({
title: "您当前学年的课程成绩暂未结算",
icon: "none"
});
uni.hideLoading();
return;
}
let data1 = res1.data;
if (data1.unpassCount != 0) {
uni.showToast({
title: "您有课程成绩没通过,不能参加评优评先哦",
icon: "none"
});
uni.hideLoading();
return;
}
}
let res2 = await getOwnIamCountByCode(code);
if (res2.code == 200) {
let data2 = res2.data;
if (isEmpty(data2)) {
data2 = {
minusCount: 0
}
}
if (data2.minusCount != 0) {
uni.showToast({
title: "您有思想品德扣分项,不能参加评优评先哦",
icon: "none"
});
uni.hideLoading();
return;
}
}
let res3 = await getOwnRankByCode(code);
if (res3.code == 200) {
if (!isEmpty(res3.data)) {
let rankData = res3.data;
let classCount = rankData.classCount;
let cphClassRank = rankData.cphClassRank;
let stuClassRank = rankData.stuClassRank;
let cphPer = Math.round(cphClassRank / classCount * 10000) / 100;
let stuPer = Math.round(stuClassRank / classCount * 10000) / 100;
if (cphPer > 50) {
uni.showToast({
title: "你的综合素质成绩排名不达标",
icon: "none"
});
uni.hideLoading();
return;
}
if (stuPer > 12) {
uni.showToast({
title: "你的平均学分绩排名不达标",
icon: "none"
});
uni.hideLoading();
return;
}
}
}
}
// 在这里编写申请逻辑
uni.navigateTo({
url: "/pages/awardapply/awardapply"
})
},
openPopup() {
wx.showModal({
title: '申请条件',
content: '一等奖学金:平均学分绩班级排名前3%,学年综合素质测评班级排名前50%\n\n二等奖学金平均学分绩班级排名前6%学年综合素质测评班级排名前50%\n\n三等奖学金平均学分绩班级排名前9%学年综合素质测评班级排名前50%。',
showCancel: false,
confirmText: '关闭',
});
},
}
}
</script>
<style lang="less" scoped>
.reApplyForm {
.container {
display: flex;
flex-direction: column;
align-items: center;
padding: 10rpx;
}
.form-item {
width: 95%;
height: 80rpx;
display: flex;
align-items: center;
margin-bottom: 20rpx;
justify-content: space-between;
border-bottom: 1px solid #ededee;
}
.form-text {
width: 95%;
margin-bottom: 20rpx;
border-bottom: 1px solid #ededee;
}
.txt {
margin-top: 20rpx;
}
.label {
text-align: right;
margin-right: 20rpx;
}
.select {
color: #888889;
}
.uni-input {
/* width: 23%; */
color: #888889;
text-align: right;
}
button {
width: 90%;
background-color: #3388CC;
color: white;
}
}
.award {
width: 100%;
min-height: 100vh;
background-color: #F5F7FB;
.userinfo {
width: 100%;
display: flex;
background-color: #3388CC;
justify-content: space-between;
align-items: center;
.left {
padding: 10rpx 40rpx;
display: flex;
flex-direction: column;
color: white;
text {
/* 强制文本内部换行 */
white-space: pre-wrap;
margin-bottom: 10rpx;
}
}
.right {
display: flex;
flex-direction: column;
margin-right: 15rpx;
align-items: center;
button {
width: 180rpx;
background-color: #E3F4FF;
border: 1px solid #009DFF;
color: #009DFF;
}
.eye {
margin-top: 10rpx;
display: flex;
align-items: center;
color: #FF7979;
image {
width: 40rpx;
height: 40rpx;
}
}
}
}
.awardList {
width: 100%;
margin-top: 20rpx;
display: flex;
align-items: center;
flex-direction: column;
.List {
// align-items: center;
display: flex;
justify-content: space-between;
width: 90%;
background-color: white;
border-radius: 10rpx;
padding: 40rpx 30rpx 30rpx 30rpx;
margin-bottom: 30rpx;
.awardListleft {
display: flex;
flex-direction: column;
.title {
font-size: 40rpx;
color: black;
width: 500rpx;
margin-bottom: 10rpx;
}
text {
padding-bottom: 10rpx;
color: #7c7c7c;
}
}
}
}
}
</style>