refactor(login): move match-route logic to dedicated service and fix import
- 提取登录回跳、产品对比的路由匹配逻辑至独立的 match-route.uts 服务 - 修复登录页面导入对比服务的错误,改为导入新的 match-route 模块 - 保持原有的路由参数校验和跳转逻辑不变,仅重构代码结构
This commit is contained in:
@@ -26,9 +26,12 @@
|
||||
<template v-else>
|
||||
<AssessmentSelect label="职业类型" v-model="form.occupation" :options="['企业职员', '事业单位', '公务员', '个体经营', '自由职业', '其他']" />
|
||||
<view class="form-row"><text class="field-label">工作单位</text><input v-model="form.company" class="field-input" placeholder="请输入工作单位" /></view>
|
||||
<view class="form-row"><text class="field-label">月收入(万元)</text><input v-model="form.monthlyIncome" class="field-input" type="digit" placeholder="请输入月收入" /></view>
|
||||
<AssessmentSelect label="社保缴纳" v-model="form.socialSecurity" :options="['连续缴纳 6 个月以上', '缴纳不足 6 个月', '未缴纳']" />
|
||||
<AssessmentSelect label="公积金缴纳" v-model="form.housingFund" :options="['连续缴纳 6 个月以上', '缴纳不足 6 个月', '未缴纳']" />
|
||||
<view class="form-row"><text class="field-label">月收入</text><input v-model="form.monthlyIncome" class="field-input" type="digit" placeholder="请输入月收入" /><text class="field-unit">万元</text></view>
|
||||
<AssessmentSelect label="社保连续缴纳" :modelValue="form.socialSecurity" @update:modelValue="socialSecurityChanged" :options="contributionOptions(form.socialSecurity)" />
|
||||
<view v-if="contributionBaseVisible(form.socialSecurity)" class="form-row"><text class="field-label">社保月基数</text><input v-model="form.socialSecurityBase" class="field-input" type="digit" maxlength="15" placeholder="选填" /><text class="field-unit">万元</text></view>
|
||||
<AssessmentSelect label="公积金连续缴纳" :modelValue="form.housingFund" @update:modelValue="housingFundChanged" :options="contributionOptions(form.housingFund)" />
|
||||
<view v-if="contributionBaseVisible(form.housingFund)" class="form-row"><text class="field-label">公积金月基数</text><input v-model="form.housingFundBase" class="field-input" type="digit" maxlength="15" placeholder="选填" /><text class="field-unit">万元</text></view>
|
||||
<text class="local-note">按当前连续缴纳时长选择。基数是计算缴费的月工资基数,不是个人缴费金额;不清楚可留空。</text>
|
||||
</template>
|
||||
|
||||
</view>
|
||||
@@ -69,8 +72,11 @@
|
||||
import AppHeader from '@/components/AppHeader.uvue'
|
||||
import AppIcon from '@/components/AppIcon.uvue'
|
||||
import AssessmentSelect from '@/packages/finance/components/AssessmentSelect.uvue'
|
||||
import { AssessmentForm, SelectedDocument, DataAuthorization, emptyAssessmentForm, activeAssessmentType, getAssessmentInput, formFromInput, documentsFromInput, setAssessmentInput, showAgreementNotice, assetValidationMessage, clearAssessmentFlow } from '@/services/assessment.uts'
|
||||
import { AssessmentForm, SelectedDocument, DataAuthorization, emptyAssessmentForm, activeAssessmentType, getAssessmentInput, formFromInput, documentsFromInput, setAssessmentInput, showAgreementNotice, assetValidationMessage, contributionValidationMessage, clearAssessmentFlow } from '@/services/assessment.uts'
|
||||
import { contributionOptions as contributionChoices, contributionBaseVisible as baseVisible } from '@/services/contribution.uts'
|
||||
const { bottomStyle, contentStyle, pageStyle } = usePageLayout()
|
||||
const contributionOptions = (current: string): string[] => contributionChoices(current)
|
||||
const contributionBaseVisible = (duration: string): boolean => baseVisible(duration)
|
||||
const showAgreement = (title: string) => { showAgreementNotice(title) }
|
||||
const editId = ref(''); const editError = ref(''); const editLoading = ref(false)
|
||||
let baseRevisionId = ''; let editGeneration = 0
|
||||
@@ -101,6 +107,8 @@
|
||||
if (session == null) uni.redirectTo({ url: '/packages/account/login/login' })
|
||||
return false
|
||||
}
|
||||
const socialSecurityChanged = (value: string) => { if (!ensureOwner()) return; form.value.socialSecurity = value; if (!contributionBaseVisible(value)) form.value.socialSecurityBase = '' }
|
||||
const housingFundChanged = (value: string) => { if (!ensureOwner()) return; form.value.housingFund = value; if (!contributionBaseVisible(value)) form.value.housingFundBase = '' }
|
||||
const startAccountTimer = () => {
|
||||
stopAccountTimer()
|
||||
if (ownerToken.length == 0) return
|
||||
@@ -109,7 +117,7 @@
|
||||
const rememberInput = () => {
|
||||
if (!initialized || !sameOwner()) return
|
||||
const source = form.value
|
||||
const currentForm: AssessmentForm = { name: source.name, idCard: source.idCard, phone: source.phone, city: source.city, maritalStatus: source.maritalStatus, occupation: source.occupation, company: source.company, monthlyIncome: source.monthlyIncome, socialSecurity: source.socialSecurity, housingFund: source.housingFund, house: source.house, car: source.car, savings: source.savings, creditCard: source.creditCard, otherAssets: source.otherAssets, creditLoanCount: source.creditLoanCount, totalDebtBalance: source.totalDebtBalance, monthlyLoanPayment: source.monthlyLoanPayment, creditCardCount: source.creditCardCount, creditCardTotalLimit: source.creditCardTotalLimit, creditCardUsedLimit: source.creditCardUsedLimit, enterpriseName: source.enterpriseName, businessCode: source.businessCode, annualRevenue: source.annualRevenue, operatingYears: source.operatingYears, operatingMonths: source.operatingMonths }
|
||||
const currentForm: AssessmentForm = { name: source.name, idCard: source.idCard, phone: source.phone, city: source.city, maritalStatus: source.maritalStatus, occupation: source.occupation, company: source.company, monthlyIncome: source.monthlyIncome, socialSecurity: source.socialSecurity, housingFund: source.housingFund, socialSecurityBase: source.socialSecurityBase, housingFundBase: source.housingFundBase, house: source.house, car: source.car, savings: source.savings, creditCard: source.creditCard, otherAssets: source.otherAssets, creditLoanCount: source.creditLoanCount, totalDebtBalance: source.totalDebtBalance, monthlyLoanPayment: source.monthlyLoanPayment, creditCardCount: source.creditCardCount, creditCardTotalLimit: source.creditCardTotalLimit, creditCardUsedLimit: source.creditCardUsedLimit, enterpriseName: source.enterpriseName, businessCode: source.businessCode, annualRevenue: source.annualRevenue, operatingYears: source.operatingYears, operatingMonths: source.operatingMonths }
|
||||
if (currentForm.city == '其他城市' && customCity.value.trim().length > 0) currentForm.city = customCity.value.trim()
|
||||
setAssessmentInput(assessmentType.value, step.value, currentForm, documents.value, authorizations.value, documentConsent.value, dataConsent.value, editId.value, baseRevisionId)
|
||||
}
|
||||
@@ -216,6 +224,7 @@
|
||||
const amount = assessmentType.value == 'enterprise' ? form.value.annualRevenue : form.value.monthlyIncome
|
||||
if (!wanAmountValid(amount) || parseFloat(amount) <= 0) message = assessmentType.value == 'enterprise' ? '请输入有效年营收(万元,最多六位小数)' : '请输入有效月收入(万元,最多六位小数)'
|
||||
}
|
||||
if (step.value == 1 && message.length == 0 && assessmentType.value == 'personal') message = contributionValidationMessage(form.value)
|
||||
if (step.value == 2) message = assetValidationMessage(form.value)
|
||||
if (step.value == 3 && documents.value.length > 0 && !documentConsent.value) message = '请阅读并同意资料使用协议,或移除资料'
|
||||
if (step.value == 3 && authorizations.value.some((item) => item.selected) && !dataConsent.value) message = '请阅读并同意数据授权协议,或取消授权选择'
|
||||
|
||||
Reference in New Issue
Block a user