医疗互助补助模块

This commit is contained in:
2026-07-23 18:26:44 +08:00
parent c34dd44bb4
commit 26646395e0
7 changed files with 295 additions and 67 deletions
@@ -20,6 +20,10 @@ module.exports = {
value: {
type: String,
default: ""
},
loadDefault: {
type: Boolean,
default: true
}
},
watch: {
@@ -44,13 +48,17 @@ module.exports = {
}
},
methods: {
async init() {
const {code, data} = await this.$axios.post("/platform/signature/get")
if (code === 0) {
this.signatureContent = data && data.signature
this.$emit("input", this.signatureContent)
}
init() {
this.signatureAddress = origin + "/platform/signature/scanPcCode?id=" + this.id
if (!this.loadDefault || this.value) {
return Promise.resolve()
}
return this.$axios.post("/platform/signature/get").then((resp) => {
if (resp.code === 0) {
this.signatureContent = resp.data && resp.data.signature
this.$emit("input", this.signatureContent)
}
})
},
signatureAgain() {
const val = sessionStorage.getItem("h5-scan-code-signature-" + this.id)
@@ -58,25 +66,26 @@ module.exports = {
this.$emit("input", val)
}
},
async mounted() {
await this.init()
webSocketPubSub.subscribe("h5-scan-code-signature", (data) => {
console.info("ws:收到签字成功消息:", data)
this.signatureContent = data.value
this.$emit("input", data.value)
})
mounted() {
this.init().then(() => {
webSocketPubSub.subscribe("h5-scan-code-signature", (data) => {
console.info("ws:收到签字成功消息:", data)
this.signatureContent = data.value
this.$emit("input", data.value)
})
// 可选:轮询或 watch ready 状态
const checkReady = () => {
if (webSocketPubSub.ws && webSocketPubSub.ws.readyState === WebSocket.OPEN) {
console.info("ws.readyState is open");
this.loading = false;
console.log(this.signatureAddress)
} else {
setTimeout(checkReady, 100);
}
};
checkReady();
// 可选:轮询或 watch ready 状态
const checkReady = () => {
if (webSocketPubSub.ws && webSocketPubSub.ws.readyState === WebSocket.OPEN) {
console.info("ws.readyState is open");
this.loading = false;
console.log(this.signatureAddress)
} else {
setTimeout(checkReady, 100);
}
};
checkReady();
})
}
}
</script>
@@ -130,9 +130,7 @@ layout("/layouts/platform.html"){
</el-descriptions>
</el-form>
<div class="actions">
<el-button @click="goMine">返回</el-button>
<el-button @click="saveDraft">暂存</el-button>
<el-button type="primary" @click="submitApply">提交申请</el-button>
<el-button v-if="isFundMember" type="primary" @click="submitApply">提交申请</el-button>
</div>
</div>
</div>
@@ -145,6 +143,7 @@ layout("/layouts/platform.html"){
return {
loading: false,
diseaseTypes: [],
isFundMember: false,
apiBase: "${base!}/platform/medicalMutualAid/apply/form",
minePath: "${base!}/platform/medicalMutualAid/apply/mine",
formRules: {
@@ -175,6 +174,10 @@ layout("/layouts/platform.html"){
this.$axios.post(this.apiBase + "/initApplyData").then((resp) => {
if (resp.code === 0) {
this.diseaseTypes = resp.data.diseaseTypes || []
this.isFundMember = resp.data.isFundMember === true
if (!this.isFundMember) {
this.$message.warning("本次补助申请仅面向基金会员开放,您目前还不是会员!")
}
}
}).finally(() => {
this.loading = false
@@ -231,6 +234,10 @@ layout("/layouts/platform.html"){
},
// 提交申请,状态仍为未审核,等待互助会审核。
submitApply() {
if (!this.isFundMember) {
this.$message.warning("本次补助申请仅面向基金会员开放,您目前还不是会员!")
return
}
this.$refs.form.validate((valid) => {
if (valid) {
this.$axios.post(this.apiBase + "/submitApply", this.formData).then((resp) => {
@@ -131,7 +131,7 @@ layout("/layouts/platform.html"){
<template slot="label"><span class="required-star">*</span>申请人签字</template>
<el-form-item prop="signFileId">
<div :class="{'signature-readonly': readonlyMode}">
<pc-signature v-model="formData.signFileId"></pc-signature>
<pc-signature v-model="formData.signFileId" :load-default="false"></pc-signature>
</div>
</el-form-item>
</el-descriptions-item>
@@ -167,9 +167,7 @@ layout("/layouts/platform.html"){
<div class="search-panel">
<el-form :inline="true" :model="searchForm" label-width="70px">
<el-form-item label="年度">
<el-select v-model="searchForm.year" clearable placeholder="请选择年度" style="width: 220px">
<el-option v-for="year in yearOptions" :key="year" :label="year" :value="year"></el-option>
</el-select>
<el-date-picker v-model="searchForm.year" type="year" value-format="yyyy" format="yyyy" clearable placeholder="请选择年度" style="width: 220px"></el-date-picker>
</el-form-item>
<el-form-item label="配置名称">
<el-input v-model="searchForm.configName" clearable placeholder="请输入配置名称" style="width: 260px"></el-input>
@@ -235,9 +233,7 @@ layout("/layouts/platform.html"){
<el-row :gutter="28">
<el-col :span="12">
<el-form-item label="年度" prop="year">
<el-select v-model="configForm.year" style="width: 100%" placeholder="请选择年度">
<el-option v-for="year in yearOptions" :key="year" :label="year" :value="year"></el-option>
</el-select>
<el-date-picker v-model="configForm.year" type="year" value-format="yyyy" format="yyyy" placeholder="请选择年度" style="width: 100%"></el-date-picker>
</el-form-item>
</el-col>
<el-col :span="12">
@@ -385,7 +381,6 @@ layout("/layouts/platform.html"){
loading: false,
dialogLoading: false,
dialogSaving: false,
yearOptions: [],
searchForm: {
year: null,
configName: ""
@@ -424,19 +419,12 @@ layout("/layouts/platform.html"){
}
},
methods: {
// 初始化年度选项,列表查询和弹窗年度录入共用同一组选项。
initYearOptions() {
const currentYear = new Date().getFullYear()
const years = []
for (let year = currentYear - 5; year <= currentYear + 2; year++) {
years.push(year)
}
this.yearOptions = years.reverse()
},
// 查询年度配置列表,每年一条配置,供页面主列表展示和检索。
loadConfigList() {
this.loading = true
this.$axios.post(loc() + "/listConfigs", this.searchForm).then((resp) => {
const params = this.copy(this.searchForm)
params.year = this.toYearNumber(params.year)
this.$axios.post(loc() + "/listConfigs", params).then((resp) => {
if (resp.code === 0) {
this.configList = resp.data || []
this.pageNumber = 1
@@ -470,6 +458,7 @@ layout("/layouts/platform.html"){
this.$axios.post(loc() + "/configData", { year: year }).then((resp) => {
if (resp.code === 0) {
this.configForm = resp.data.config || this.defaultConfig(year)
this.configForm.year = this.toYearString(this.configForm.year)
this.memberForm = resp.data.memberConfig || this.defaultMemberConfig()
this.ratioList = resp.data.ratios || []
this.bonusList = resp.data.bonuses || []
@@ -533,7 +522,7 @@ layout("/layouts/platform.html"){
// 先保存基础配置拿到主键,再保存会员缴费、比例和奖励明细。
saveDialogData() {
this.dialogSaving = true
this.$axios.post(loc() + "/saveConfig", this.configForm).then((resp) => {
this.$axios.post(loc() + "/saveConfig", this.buildConfigPayload()).then((resp) => {
if (resp.code !== 0) {
return Promise.reject(resp)
}
@@ -628,11 +617,31 @@ layout("/layouts/platform.html"){
// 新增弹窗默认基础配置,仅设置用户要求保留默认值的基础字段。
defaultConfig(year) {
return {
year: year,
year: this.toYearString(year),
configName: year + "年医疗互助补助配置",
status: 1
}
},
// 年度选择器使用字符串回显,提交接口前再转为数字,避免影响后端年度字段类型。
toYearString(year) {
if (year === null || year === undefined || year === "") {
return null
}
return String(year)
},
// 后端年度字段为整型,查询和保存时统一在此处转换。
toYearNumber(year) {
if (year === null || year === undefined || year === "") {
return null
}
return Number(year)
},
// 基础配置保存前清理年度类型,保持接口参数和实体字段一致。
buildConfigPayload() {
const payload = this.copy(this.configForm)
payload.year = this.toYearNumber(payload.year)
return payload
},
// 会员缴费配置为全局单条配置,未配置时给出可编辑默认值。
defaultMemberConfig() {
return {
@@ -672,7 +681,6 @@ layout("/layouts/platform.html"){
}
},
created() {
this.initYearOptions()
this.loadConfigList()
},
mounted() {