Commit e2bf04ba by chenwq

feat: 添加审批结果页面及相关路由,优化任务页面跳转逻辑

1 parent 0f53e89e
......@@ -33,6 +33,15 @@ export const mineRoutes = [
backgroundColor: "#f2f3f7",
},
},
{
path: "approval-result",
name: "mine/approvalResult",
component: () => import("@/views/mine/view/approvalResult.vue"),
meta: {
title: "查看审核结果",
backgroundColor: "#f2f3f7",
},
},
],
},
];
<template>
<div class="approval-result-page">
<div class="result-list">
<div class="result-item">
<div class="label">
任务处理结果
</div>
<div class="status-tag" :class="statusClass">
{{ statusText }}
</div>
</div>
<template v-if="isApproved">
<div class="result-item">
<div class="label">
指定带教督导
</div>
<div class="value">
{{ detail.assignedSupervisorName || '-' }}
</div>
</div>
<div class="result-item">
<div class="label">
带教场景
</div>
<div class="value">
{{ detail.teachingSceneName || '未选择' }}
</div>
</div>
<div class="result-item">
<div class="label">
带教时间
</div>
<div class="value">
{{ detail.teachingTime || '未选择' }}
</div>
</div>
<div class="result-item">
<div class="label">
带教方式
</div>
<div class="value">
{{ detail.teachingMethodName || '未选择' }}
</div>
</div>
<div class="result-item">
<div class="label">
带教主题
</div>
<div class="value">
{{ detail.teachingTopicName || '未选择' }}
</div>
</div>
</template>
<div v-else class="reject-reason">
<div class="label">
驳回理由
</div>
<div class="reason-text">
{{ detail.rejectReason || '-' }}
</div>
</div>
</div>
<div class="section-title">
申请详情
</div>
<div class="detail-list">
<div v-for="item in detailFields"
:key="item.label"
class="detail-item"
:class="{ column: item.type === 'textarea' }">
<div class="label">
{{ item.label }}
</div>
<div v-if="item.type === 'tags'" class="tag-list">
<span v-for="name in toNameList(item.value)"
:key="name"
class="name-tag">
{{ name }}
</span>
<span v-if="!toNameList(item.value).length" class="value muted">-</span>
</div>
<div v-else
class="value"
:class="{ muted: !item.value }">
{{ item.value || '-' }}
</div>
</div>
</div>
</div>
</template>
<script>
import api from "@/api/mine";
import util from "@/utils/util";
export default {
name: "MineApprovalResult",
data() {
return {
userInfo: {},
id: "",
detail: {},
};
},
computed: {
approvalStatus() {
return Number(this.detail.approvalStatus || this.$route.query.status);
},
isApproved() {
return this.approvalStatus === 1;
},
statusText() {
return this.isApproved ? "通过" : "驳回";
},
statusClass() {
return this.isApproved ? "approved" : "rejected";
},
detailFields() {
return [
{ label: "任务类型", value: "专项带教" },
{ label: "归属门店", value: this.detail.merchantName },
{ label: "归属业务", value: this.detail.businessTypeName },
{ label: "需带教驻店人员", value: this.detail.teachingStaffNames, type: "tags" },
{ label: "归属区域督导", value: this.detail.supervisorNames },
{ label: "申请描述", value: this.detail.applyDescription, type: "textarea" },
];
},
},
created() {
this.userInfo = util.getLocalStorage("ww_userInfo") || {};
this.id = this.$route.query.id || "";
this.getDetail();
},
methods: {
async getDetail() {
if (!this.id)
return;
const params = { id: this.id, phone: this.userInfo.phone };
const res = await api.getApprovalDetail(params);
this.detail = res.data || res || {};
},
toNameList(value) {
if (Array.isArray(value))
return value.filter(Boolean);
if (!value)
return [];
return String(value).split(/[,,]/).map(item => item.trim()).filter(Boolean);
},
},
};
</script>
<style lang="scss" scoped>
.approval-result-page {
height: 100%;
overflow: auto;
background: #f2f3f7;
box-sizing: border-box;
padding: 8px 12px 20px;
}
.result-list,
.detail-list {
width: 100%;
}
.result-item,
.detail-item {
min-height: 42px;
background: #fff;
border-radius: 6px;
padding: 0 12px;
margin-bottom: 8px;
box-sizing: border-box;
display: flex;
align-items: center;
justify-content: space-between;
gap: 16px;
&.column {
display: block;
padding-top: 12px;
padding-bottom: 12px;
.value {
margin-top: 10px;
text-align: left;
line-height: 21px;
white-space: pre-wrap;
}
}
}
.label {
flex-shrink: 0;
font-size: 13px;
color: #000000e5;
}
.value {
flex: 1;
text-align: right;
font-size: 13px;
color: #00000066;
line-height: 20px;
word-break: break-all;
&.muted {
color: #00000040;
}
}
.status-tag {
min-width: 42px;
height: 24px;
line-height: 24px;
text-align: center;
border-radius: 4px;
font-size: 13px;
&.approved {
color: #35c376;
background: #eaf9f1;
}
&.rejected {
color: #ee0a24;
background: #fff1f0;
}
}
.reject-reason {
background: #fff;
border-radius: 6px;
padding: 12px;
margin-bottom: 8px;
box-sizing: border-box;
.reason-text {
margin-top: 10px;
font-size: 13px;
line-height: 21px;
color: #00000066;
word-break: break-all;
}
}
.section-title {
height: 28px;
line-height: 28px;
text-align: center;
font-size: 12px;
color: #000000e5;
}
.tag-list {
flex: 1;
display: flex;
justify-content: flex-end;
flex-wrap: wrap;
gap: 6px;
}
.name-tag {
line-height: 22px;
padding: 0 9px;
border-radius: 4px;
background: #f2f3f5;
font-size: 12px;
color: #000000a6;
}
</style>
......@@ -131,8 +131,10 @@ export default {
const id = item.id;
if (!id)
return;
const status = Number(item.approvalStatus);
const routeName = status === 0 ? "mine/approvalDetail" : "mine/approvalResult";
this.$router.push({
name: "mine/approvalDetail",
name: routeName,
query: { id, status: item.approvalStatus },
});
},
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!