更新密码找回uniapp

This commit is contained in:
hero920103 committed 2026-11-16 17:22:50 +08:00
1 parent 7f9a66da0f
commit 3fdda89833
1304 files changed
+3503 -26132

No files matched your search

-26
View File
@@ -4,7 +4,6 @@
<text class="state-text">加载中...</text>
</view>
<template v-else-if="detail">
<!-- 单据信息 -->
<view class="detail-card">
<view class="head-row">
<text class="head-amount">¥{{ moneyText(detail.total_amount) }}</text>
@@ -35,7 +34,6 @@
</view>
</view>
<!-- 费用明细 -->
<view class="block-card">
<view class="block-head">
<text class="block-title">费用明细</text>
@@ -74,7 +72,6 @@
</view>
</view>
<!-- 审批记录(与审批中心一致的审批流样式) -->
<view class="block-card">
<view class="block-head">
<text class="block-title">审批记录</text>
@@ -112,7 +109,6 @@
</view>
</template>
<!-- 操作按钮:草稿可删除/编辑/提交;审批通过后由报销人确认到账 -->
<view v-if="detail && isDraft" class="footer">
<view class="footer-btn">
<u-button type="error" plain icon="trash" text="删除" @click="onDelete" />
@@ -125,7 +121,6 @@
</view>
</view>
<!-- 审批通过:等待报销人确认款项是否已到账 -->
<view v-else-if="detail && isApproved" class="footer">
<view class="footer-btn">
<u-button type="success" icon="checkmark-circle" text="确认到账" @click="onConfirmPaid" />
@@ -162,7 +157,6 @@ const myTask = ref(null)
const loading = ref(false)
const isDraft = computed(() => Number(detail.value?.status) === EXPENSE_STATUS.DRAFT)
// 审批通过:等待报销人本人确认款项到账
const isApproved = computed(() => Number(detail.value?.status) === EXPENSE_STATUS.APPROVED)
const descText = computed(() => {
@@ -170,7 +164,6 @@ const descText = computed(() => {
return desc || ''
})
/** 审批记录 -> 审批流节点:每条记录一个节点,末尾补「流程结束」节点展示单据当前状态 */
const flowNodes = computed(() => {
const nodes = (records.value || []).map((record, index) => {
const action = Number(record.action)
@@ -199,7 +192,6 @@ const flowNodes = computed(() => {
return nodes
})
/** 末尾「流程结束」节点:显示单据当前状态,让申请人一眼看出流程是否走完 */
function buildEndNode() {
const status = Number(detail.value?.status)
const map = {
@@ -230,7 +222,6 @@ function avatarOf(name) {
return text ? text.slice(0, 1) : '系'
}
/** 动作角标:1提交/2通过 -> 绿✓;3驳回 -> 红✕;4转审 -> 橙;5撤回 -> 灰 */
function badgeClassOfAction(action) {
if (action === 3) return 'badge-reject'
if (action === 1 || action === 2) return 'badge-pass'
@@ -245,7 +236,6 @@ function badgeIconOfAction(action) {
return '—'
}
/** 时间只展示到分钟 */
function shortTime(value) {
if (!value) return ''
return String(value).slice(0, 16)
@@ -262,11 +252,8 @@ onShow(() => {
if (expenseId.value) loadDetail()
})
// 监听审批通过 / 确认到账后的刷新事件。
// 新版 uni-app 已不再导出 onUniAppEvent,改用全局事件总线并在页面卸载时解绑。
function handleExpenseUpdated(data) {
if (data?.id === expenseId.value) {
// 延迟一点刷新,确保后端数据已同步
setTimeout(() => loadDetail(), 300)
}
}
@@ -276,7 +263,6 @@ onUnload(() => {
uni.$off('expense-updated', handleExpenseUpdated)
})
/** 后端时间字段可能为 "YYYY-MM-DD HH:mm:ss" 格式,iOS 需转 T 分隔 */
function formatTime(value) {
if (!value) return ''
return String(value).replace(' ', 'T').slice(0, 16).replace('T', ' ')
@@ -294,7 +280,6 @@ async function loadDetail() {
detail.value = data
items.value = data.items || []
records.value = await fetchExpenseRecords(expenseId.value)
// 审批人视角:审批中的单据查询自己是否有待办任务(非审批人静默返回 null)
try {
myTask.value = Number(data.status) === EXPENSE_STATUS.APPROVING
? await fetchMyApproveTask(expenseId.value)
@@ -309,7 +294,6 @@ async function loadDetail() {
}
}
/** 图片预览:只把图片类发票给 previewImage,PDF 不参与 */
function previewReceipt(receipts, index) {
const current = receipts?.[index]
const urls = (receipts || [])
@@ -320,7 +304,6 @@ function previewReceipt(receipts, index) {
uni.previewImage({ urls, current: current && !isPdfReceipt(current) ? current.url : urls[0] })
}
/** PDF 发票:下载后用文档查看器打开(image 组件无法渲染 PDF,会被 ORB 拦截) */
function openReceiptFile(file) {
if (!file?.url) return
uni.showLoading({ title: '打开中...' })
@@ -354,13 +337,11 @@ function onSubmit() {
uni.showToast({ title: '已提交审批', icon: 'success' })
loadDetail()
} catch (e) {
// request 封装已弹出服务端错误提示
}
}
})
}
/** 报销人确认款项已到账:确认后单据状态变为「已打款」 */
async function onConfirmPaid() {
const confirmed = await new Promise((resolve) => {
uni.showModal({
@@ -379,7 +360,6 @@ async function onConfirmPaid() {
await loadDetail()
uni.$emit('expense-updated', { id: expenseId.value })
} catch (e) {
// request 封装已弹出服务端错误提示
}
}
@@ -394,13 +374,11 @@ function onDelete() {
uni.showToast({ title: '已删除', icon: 'success' })
setTimeout(() => uni.navigateBack(), 400)
} catch (e) {
// request 封装已弹出服务端错误提示
}
}
})
}
/** 通过当前审批节点:成功后按引擎提示刷新(会签等待/流转/完成) */
function onApprove() {
uni.showModal({
title: '通过审批',
@@ -412,13 +390,11 @@ function onApprove() {
uni.showToast({ title: result?.message || '已通过', icon: 'none' })
loadDetail()
} catch (e) {
// request 封装已弹出服务端错误提示
}
}
})
}
/** 驳回报销单:填写审批意见(可空) */
function onReject() {
uni.showModal({
title: '驳回',
@@ -431,7 +407,6 @@ function onReject() {
uni.showToast({ title: '已驳回', icon: 'none' })
loadDetail()
} catch (e) {
// request 封装已弹出服务端错误提示
}
}
})
@@ -627,7 +602,6 @@ function onReject() {
color: $color-text-muted;
}
/* 审批记录沿用审批中心的审批流样式 */
@include flow-timeline;
.footer {
-10
View File
@@ -1,6 +1,5 @@
<template>
<view class="page">
<!-- 基本信息 -->
<view class="form-card">
<view class="field">
<text class="field-label">申请日期 <text class="required">*</text></text>
@@ -24,7 +23,6 @@
</view>
</view>
<!-- 费用明细 -->
<view class="items-card">
<view class="items-head">
<text class="items-title">费用明细</text>
@@ -73,7 +71,6 @@
/>
</view>
<!-- 明细编辑弹层 -->
<view v-if="itemEditorVisible" class="mask" @tap="closeItemEditor">
<view class="sheet" @tap.stop>
<view class="sheet-head">
@@ -187,7 +184,6 @@ const form = reactive({
description: ''
})
/** 本地明细列表:编辑已有明细时带 id,保存时全量重建 */
const items = ref([])
const typeOptions = ref([])
@@ -366,7 +362,6 @@ function onRemoveReceipt(index) {
itemForm.receipts.splice(index, 1)
}
/** 上传发票:选择图片(拍照/相册)或从聊天文件选 PDF */
function onUploadReceipt() {
if (uploading.value) return
uni.showActionSheet({
@@ -390,7 +385,6 @@ function chooseImageReceipt() {
})
}
/** 小程序沙箱内选择本地 PDF 只能走微信会话文件(chooseMessageFile) */
function chooseFileReceipt() {
if (typeof uni.chooseMessageFile !== 'function') {
uni.showToast({ title: '当前环境不支持选择文件', icon: 'none' })
@@ -406,7 +400,6 @@ function chooseFileReceipt() {
await uploadReceipts(paths)
},
fail: () => {
// 用户取消选择,静默处理
}
})
}
@@ -421,7 +414,6 @@ async function uploadReceipts(paths) {
}
uni.showToast({ title: '上传成功', icon: 'success' })
} catch (e) {
// 上传封装已提示错误
} finally {
uploading.value = false
}
@@ -439,7 +431,6 @@ async function onSave() {
const payload = { applyDate: form.applyDate, description: form.description }
if (id) {
await updateExpense(id, payload)
// 明细全量重建:先删旧再逐条新增(草稿单,明细量少)
const oldItems = await getExpense(id)
for (const item of oldItems?.items || []) {
await deleteExpenseItem(id, item.id)
@@ -453,7 +444,6 @@ async function onSave() {
uni.showToast({ title: '保存成功', icon: 'success' })
setTimeout(() => uni.navigateBack(), 400)
} catch (e) {
// request 封装已弹出服务端错误提示
} finally {
saving.value = false
}
-4
View File
@@ -1,6 +1,5 @@
<template>
<view class="page">
<!-- 搜索 + 状态筛选 -->
<view class="filter-bar">
<view class="search-box">
<FaIcon name="magnifying-glass" color="#94a3b8" :size="16" />
@@ -28,7 +27,6 @@
</scroll-view>
</view>
<!-- 报销单列表 -->
<view v-if="loading && !list.length" class="state-box">
<text class="state-text">加载中...</text>
</view>
@@ -61,7 +59,6 @@
</view>
</template>
<!-- 新建入口 -->
<view class="fab" @tap="openCreate">
<FaIcon name="plus" color="#ffffff" :size="22" />
<text>新建报销</text>
@@ -82,7 +79,6 @@ import {
const PAGE_SIZE = 20
// -1 为「待我审批」约定值(后端按当前用户运行中审批待办过滤)
const tabs = [{ value: -1, label: '待我审批' }, { value: '', label: '全部' }, ...EXPENSE_STATUS_OPTIONS]
const list = ref([])