Просмотр исходного кода

Add 添加前端UI的报名审核功能

Yue 2 лет назад
Родитель
Сommit
43e059c714

+ 1 - 1
SERVER/YanZhongXYH/xyh-system/src/main/java/cn/xyh/amActivity/controller/AmActivityController.java

@@ -186,7 +186,7 @@ public class AmActivityController extends BaseController {
     /**
      * 报名
      */
-    @SaCheckPermission(PermissionName.AmActivityActivityApply)
+    @SaCheckPermission(PermissionName.AmActivityActivityQuery)
     @PostMapping("/apply")
     public R<Void> apply(@RequestBody @Validated(AddGroup.class) AmActivityApplyBo bo) {
         return toAjax(amActivityApplyService.insertByBo(bo));

+ 1 - 0
SERVER/YanZhongXYH/xyh-system/src/main/java/cn/xyh/amActivity/service/impl/AmActivityServiceImpl.java

@@ -63,6 +63,7 @@ public class AmActivityServiceImpl implements IAmActivityService {
                 AmActivity::getActivityId,
                 AmActivity::getTitle,
                 AmActivity::getCategory,
+                AmActivity::getNeedCost,
                 AmActivity::getCost,
                 AmActivity::getArea,
                 AmActivity::getAddress,

+ 19 - 0
UI/XYH.VUE/src/api/amActivity/_activity.ts

@@ -90,6 +90,25 @@ class activityApi {
 			successAlert: true
 		})
 	}
+	listApply = (query: any) => {
+		return Rs.get({
+			url: `/amActivity/activity/pageApply`,
+			params: query,
+			loading: false
+		})
+	}
+	auditApply = (applyId: string, status: string) => {
+		return Rs.post({
+			url: `/amActivity/activity/auditApply/${applyId}/${status}`,
+			loading: false
+		})
+	}
+	auditCost = (applyId: string, cost: string) => {
+		return Rs.post({
+			url: `/amActivity/activity/auditCost/${applyId}/${cost}`,
+			loading: false
+		})
+	}
 }
 
 export default activityApi

+ 175 - 9
UI/XYH.VUE/src/views/amActivity/activity/index.vue

@@ -8,6 +8,7 @@ import { permissionNames } from "@@/services/PermissionNames"
 const tableRef = ref()
 const modalRef = ref()
 const detailModalRef = ref()
+const applyModalRef = ref()
 const opts = reactive({
 	columns: [
 		{ field: "activityId", name: "活动id", visible: false },
@@ -414,7 +415,8 @@ function handleAudit(row: any) {
 		detailModalRef.value.show()
 	})
 }
-
+const applyDetailTotal = ref(0)
+const applyDetailList = ref<any[]>([])
 function handleDetail(row: any) {
 	detailType.value = "D"
 	apis.amActivity.activityApi.getActivity(row.activityId).then((res) => {
@@ -424,6 +426,19 @@ function handleDetail(row: any) {
 		}
 		detailModalRef.value.show()
 	})
+	apis.amActivity.activityApi
+		.listApply({
+			activityId: row.activityId,
+			auditStatus: "1",
+			pageNum: 1,
+			pageSize: 10000,
+			orderByColumn: "auditStatus",
+			isAsc: "ascending"
+		})
+		.then((res: any) => {
+			applyDetailTotal.value = res.total
+			applyDetailList.value = res.rows
+		})
 }
 
 function submitDetail() {
@@ -498,7 +513,56 @@ function handleHot(row: any) {
 			row.isHot = row.isHot === "0" ? "1" : "0"
 		})
 }
+const activity = ref<any>({})
+const currrentApplyId = ref()
+const applyAuditList = ref<any[]>([])
+function handleAplly(row: any) {
+	activity.value = row
+	currrentApplyId.value = row.activityId
+	handleQueryApply()
+}
+function handleQueryApply() {
+	apis.amActivity.activityApi
+		.listApply({
+			activityId: currrentApplyId.value,
+			pageNum: 1,
+			pageSize: 10000,
+			orderByColumn: "auditStatus",
+			isAsc: "ascending"
+		})
+		.then((res: any) => {
+			applyAuditList.value = res.rows
+			applyModalRef.value.show()
+		})
+}
+function handleApllyAudit(item: any, status: string) {
+	const text = status === "1" ? "通过" : "拒绝"
+	message.confirm("确认要" + text + " [" + item.name + "] 的报名?").then(() => {
+		apis.amActivity.activityApi.auditApply(item.applyId, status).then(() => {
+			message.msgSuccess(text + "报名成功")
+			handleQueryApply()
+			handleQuery()
+		})
+	})
+}
+
+function handleApllyCost(item: any) {
+	message.prompt("请输入费用(0表示未付费)", "确认付费").then((val: any) => {
+		console.log("val", val, item.applyId)
+		apis.amActivity.activityApi.auditCost(item.applyId, val.value).then(() => {
+			message.msgSuccess("付费审核成功")
+			handleQueryApply()
+			handleQuery()
+		})
+	})
+}
 
+const formatUrl = (url: string) => {
+	if (url) {
+		url = import.meta.env.VITE_APP_BASE_API + url
+	}
+	return url
+}
 function loadCategory() {
 	apis.system.categoryApi.getActivityCategory().then((res) => {
 		categoryColumns.value = []
@@ -574,10 +638,7 @@ onMounted(init)
 					@change="handleHot(row)"></el-switch>
 			</template>
 			<template #actions="{ row }">
-				<vb-tooltip
-					v-if="row.auditStatus != 0 && row.auditStatus != 2"
-					content="详情 "
-					placement="top">
+				<vb-tooltip v-if="row.auditStatus == 1" content="详情 " placement="top">
 					<el-button
 						link
 						type="primary"
@@ -588,6 +649,17 @@ onMounted(init)
 						</template>
 					</el-button>
 				</vb-tooltip>
+				<vb-tooltip v-if="row.auditStatus == 1" content="报名审核 " placement="top">
+					<el-button
+						link
+						type="warning"
+						@click="handleAplly(row)"
+						v-hasPermission="permissionNames.AmActivityActivityApply">
+						<template #icon>
+							<VbIcon icon-name="check-circle" icon-type="duotone" class="fs-3"></VbIcon>
+						</template>
+					</el-button>
+				</vb-tooltip>
 				<vb-tooltip v-else content="审核" placement="top">
 					<el-button
 						link
@@ -602,7 +674,7 @@ onMounted(init)
 				<vb-tooltip v-if="row.isClose == 0" content="关闭 " placement="top">
 					<el-button
 						link
-						type="warning"
+						type="info"
 						@click="handleClose(row)"
 						v-hasPermission="permissionNames.AmActivityActivityClose">
 						<template #icon>
@@ -718,9 +790,103 @@ onMounted(init)
 						]"></vb-select>
 				</div>
 				<div
-					v-else-if="detailType == 'D' && detailData.auditStatus != '0'"
-					class="d-flex align-item-center">
-					<div>报名详情</div>
+					v-else-if="
+						detailType == 'D' && detailData.auditStatus != '0' && applyDetailList.length > 0
+					"
+					class="d-flex flex-column align-item-center py-5">
+					<div class="d-flex align-items-center justify-content-between mb-2">
+						<dl class="mb-0">
+							<dt>报名详情:</dt>
+							<dd>{{ applyDetailTotal }} 人报名</dd>
+						</dl>
+						<el-button type="primary" @click="handleAplly(detailData)">审核报名</el-button>
+					</div>
+					<div class="d-flex flex-wrap px-20">
+						<VbSymbol
+							class="position-relative m-1"
+							:size="50"
+							shape="circle"
+							:src="formatUrl(v.avatar)"
+							:text="v.name"
+							v-for="(v, i) in applyDetailList"
+							:key="i"></VbSymbol>
+					</div>
+				</div>
+			</template>
+		</VbModal>
+		<VbModal
+			modalBodyClass="apply-modal"
+			v-model:modal="applyModalRef"
+			title="报名详情"
+			:shown-event="
+				() => {
+					detailModalRef.hide()
+				}
+			"
+			append-to-body>
+			<template #body>
+				<div class="d-flex flex-wrap justify-content-center">
+					<div
+						class="d-flex my-2 p-3 mx-2 align-items-center"
+						style="border-radius: 8px; background-color: #f2f2f2"
+						v-for="(v, i) in applyAuditList"
+						:key="i">
+						<div class="w-80px d-flex justify-content-center me-2">
+							<VbSymbol
+								class="position-relative m-1"
+								:size="50"
+								shape="circle"
+								:src="formatUrl(v.avatar)"
+								:text="v.name"></VbSymbol>
+						</div>
+						<div class="w-100 d-flex flex-column">
+							<span class="d-flex align-items-center">
+								<span class="me-2">{{ v.name }}</span>
+								<el-tag v-if="v.auditStatus == '0'">待审核</el-tag>
+								<el-tag
+									type="success"
+									v-else-if="v.auditStatus == '1' && activity.needCost == '1' && v.cost > 0">
+									付费:{{ v.cost }}
+								</el-tag>
+								<el-tag
+									type="danger"
+									v-else-if="v.auditStatus == '1' && activity.needCost == '1' && v.cost <= 0">
+									未付费
+								</el-tag>
+								<el-tag type="success" v-else-if="v.auditStatus == '1'">已审核</el-tag>
+								<el-tag type="danger" v-else-if="v.auditStatus == '2'">已拒绝</el-tag>
+							</span>
+							<span class="my-1">{{ v.createTime }}</span>
+						</div>
+						<div
+							v-if="activity.isClose == '0'"
+							class="d-flex w-80px pe-2 flex-column justify-content-around">
+							<el-button
+								type="primary"
+								size="small"
+								class="my-1 mx-0 w-100"
+								@click="handleApllyAudit(v, '1')"
+								v-if="v.auditStatus != '1'">
+								通过
+							</el-button>
+							<el-button
+								type="danger"
+								size="small"
+								class="my-1 mx-0 w-100"
+								@click="handleApllyAudit(v, '2')"
+								v-if="v.auditStatus != '2'">
+								拒绝
+							</el-button>
+							<el-button
+								type="success"
+								size="small"
+								class="my-1 mx-0 w-100"
+								@click="handleApllyCost(v)"
+								v-if="activity.needCost == '1' && v.auditStatus == '1'">
+								付费
+							</el-button>
+						</div>
+					</div>
 				</div>
 			</template>
 		</VbModal>