feat ui设计稿bug修复
This commit is contained in:
@@ -2,7 +2,7 @@
|
||||
import { computed, onMounted, ref } from 'vue'
|
||||
import { storeToRefs } from 'pinia'
|
||||
import { ElMessage } from 'element-plus'
|
||||
import { AppButton, ConfirmDialog } from '@/components'
|
||||
import { ConfirmDialog } from '@/components'
|
||||
// 页面容器:数据只经 store,不直接 import api
|
||||
import { useFinanceStore } from '@/stores/modules/finance'
|
||||
import type { InvoiceTitle, InvoiceTitlePayload } from '@/types/business/finance'
|
||||
@@ -12,28 +12,27 @@ import InvoiceTitleDialog from './cpns/InvoiceTitleDialog.vue'
|
||||
const financeStore = useFinanceStore()
|
||||
const { titles } = storeToRefs(financeStore)
|
||||
|
||||
type TypeFilter = 'all' | InvoiceTitle['type']
|
||||
|
||||
const typeFilter = ref<TypeFilter>('all')
|
||||
|
||||
const TYPE_TABS: Array<{ label: string; value: TypeFilter }> = [
|
||||
{ label: '全部', value: 'all' },
|
||||
{ label: '企业单位', value: '企业单位' },
|
||||
{ label: '非企业单位', value: '非企业单位' },
|
||||
]
|
||||
|
||||
const filteredTitles = computed(() =>
|
||||
typeFilter.value === 'all'
|
||||
? titles.value
|
||||
: titles.value.filter((item) => item.type === typeFilter.value),
|
||||
)
|
||||
|
||||
const dialogVisible = ref(false)
|
||||
const editing = ref<InvoiceTitle | undefined>(undefined)
|
||||
|
||||
const confirmVisible = ref(false)
|
||||
const pendingDeleteId = ref('')
|
||||
|
||||
const PAGE_SIZE = 2
|
||||
const page = ref(1)
|
||||
|
||||
const pageCount = computed(() => Math.max(1, Math.ceil(titles.value.length / PAGE_SIZE)))
|
||||
const pagedTitles = computed(() =>
|
||||
titles.value.slice((page.value - 1) * PAGE_SIZE, page.value * PAGE_SIZE),
|
||||
)
|
||||
/** 页码序列:设计 35 实取 1~5 */
|
||||
const pages = computed(() => Array.from({ length: Math.max(5, pageCount.value) }, (_, i) => i + 1))
|
||||
|
||||
function go(next: number): void {
|
||||
if (next < 1 || next > pageCount.value) return
|
||||
page.value = next
|
||||
}
|
||||
|
||||
function onCreate(): void {
|
||||
editing.value = undefined
|
||||
dialogVisible.value = true
|
||||
@@ -69,12 +68,8 @@ async function onConfirmDelete(): Promise<void> {
|
||||
async function onSetDefault(id: string): Promise<void> {
|
||||
const item = titles.value.find((title) => title.id === id)
|
||||
if (!item) return
|
||||
if (item.isDefault) {
|
||||
ElMessage.info('演示环境暂不支持取消默认,可设其他抬头为默认')
|
||||
return
|
||||
}
|
||||
await financeStore.setDefaultTitle(id)
|
||||
ElMessage.success('已设为默认抬头')
|
||||
ElMessage.success(item.isDefault ? '已取消默认抬头' : '已设为默认抬头')
|
||||
}
|
||||
|
||||
onMounted(() => {
|
||||
@@ -84,46 +79,58 @@ onMounted(() => {
|
||||
|
||||
<template>
|
||||
<div class="invoice-titles">
|
||||
<nav class="invoice-titles__breadcrumb text-secondary">
|
||||
<RouterLink to="/finance" class="link">
|
||||
财务中心
|
||||
</RouterLink>
|
||||
<span> > </span>
|
||||
<span>发票抬头</span>
|
||||
</nav>
|
||||
<div class="container">
|
||||
<!-- 面包屑 (70,124)「财务中心 /」13/400 #9CA3AF +「发票抬头管理」13/500 #4B5563 -->
|
||||
<nav class="invoice-titles__breadcrumb">
|
||||
<RouterLink to="/finance" class="invoice-titles__breadcrumb-link">
|
||||
财务中心 /
|
||||
</RouterLink>
|
||||
<span class="invoice-titles__breadcrumb-current">发票抬头管理</span>
|
||||
</nav>
|
||||
|
||||
<header class="invoice-titles__head">
|
||||
<h2 class="invoice-titles__title">
|
||||
发票管理
|
||||
</h2>
|
||||
<div class="invoice-titles__filters">
|
||||
<button
|
||||
v-for="tab in TYPE_TABS"
|
||||
:key="tab.value"
|
||||
class="invoice-titles__filter"
|
||||
:class="{ 'is-active': typeFilter === tab.value }"
|
||||
@click="typeFilter = tab.value"
|
||||
>
|
||||
{{ tab.label }}
|
||||
<!-- 标题条 (70,153) 1780×62:标题 x106 y174 15/700 + 右侧「+ 新增抬头」 -->
|
||||
<header class="invoice-titles__head">
|
||||
<h2 class="invoice-titles__title">
|
||||
发票管理
|
||||
</h2>
|
||||
<button class="invoice-titles__create" @click="onCreate">
|
||||
+ 新增抬头
|
||||
</button>
|
||||
<AppButton type="primary" @click="onCreate">
|
||||
+新增抬头
|
||||
</AppButton>
|
||||
</div>
|
||||
</header>
|
||||
</header>
|
||||
|
||||
<div class="invoice-titles__grid">
|
||||
<InvoiceTitleCard
|
||||
v-for="item in filteredTitles"
|
||||
:key="item.id"
|
||||
:invoice-title="item"
|
||||
@set-default="onSetDefault"
|
||||
@edit="onEdit"
|
||||
@delete="onDelete"
|
||||
/>
|
||||
<p v-if="filteredTitles.length === 0" class="invoice-titles__empty text-secondary">
|
||||
暂无发票抬头,点击右上角新增
|
||||
</p>
|
||||
<!-- 抬头卡列表 (70,229) 起 1780×129 / (70,372) 1780×88 -->
|
||||
<div class="invoice-titles__list">
|
||||
<InvoiceTitleCard
|
||||
v-for="item in pagedTitles"
|
||||
:key="item.id"
|
||||
:invoice-title="item"
|
||||
@set-default="onSetDefault"
|
||||
@edit="onEdit"
|
||||
@delete="onDelete"
|
||||
/>
|
||||
<p v-if="pagedTitles.length === 0" class="invoice-titles__empty">
|
||||
暂无发票抬头,点击右上角新增
|
||||
</p>
|
||||
</div>
|
||||
|
||||
<!-- 分页 (1684.93~1881.07,505) 12/400 -->
|
||||
<nav class="invoice-titles__pager" aria-label="分页">
|
||||
<button class="invoice-titles__page" :disabled="page <= 1" @click="go(page - 1)">
|
||||
‹
|
||||
</button>
|
||||
<button
|
||||
v-for="item in pages"
|
||||
:key="item"
|
||||
class="invoice-titles__page"
|
||||
:class="{ 'is-active': item === page }"
|
||||
@click="go(item)"
|
||||
>
|
||||
{{ item }}
|
||||
</button>
|
||||
<button class="invoice-titles__page" :disabled="page >= pageCount" @click="go(page + 1)">
|
||||
›
|
||||
</button>
|
||||
</nav>
|
||||
</div>
|
||||
|
||||
<InvoiceTitleDialog
|
||||
@@ -144,107 +151,120 @@ onMounted(() => {
|
||||
</template>
|
||||
|
||||
<style lang="less" scoped>
|
||||
// 设计 35/36 发票抬头管理(1920 画布 1:1)——内容区 x70→1850 = 1780
|
||||
.invoice-titles {
|
||||
.flex(column, flex-start);
|
||||
align-items: stretch;
|
||||
gap: @spacing-base;
|
||||
width: 100%;
|
||||
max-width: @container-width;
|
||||
margin: 0 auto;
|
||||
padding: @spacing-lg @spacing-base @spacing-xxl;
|
||||
padding-bottom: 459px; // 分页底 521 → 页脚 1087
|
||||
background: @contract-page-bg;
|
||||
|
||||
// 设计 35/36:面包屑 13 设计px → 11px,前缀灰、当前页深灰
|
||||
// 面包屑 (70,124)
|
||||
&__breadcrumb {
|
||||
font-size: 11px;
|
||||
color: @text-color-disabled;
|
||||
.flex(row, flex-start, center);
|
||||
height: 81px; // 顶栏 72 → 标题条 153,面包屑盒 72..133
|
||||
padding-top: 36px;
|
||||
font-size: 13px;
|
||||
font-weight: 400;
|
||||
line-height: 17px;
|
||||
color: @project-muted;
|
||||
box-sizing: border-box;
|
||||
}
|
||||
|
||||
> span:last-child {
|
||||
color: @text-color;
|
||||
&__breadcrumb-link {
|
||||
color: @project-muted;
|
||||
|
||||
&:hover {
|
||||
color: @primary-strong;
|
||||
}
|
||||
}
|
||||
|
||||
// 顶部「发票管理」白卡条(设计 35:蓝竖条标题 + 右侧按钮组)
|
||||
&__breadcrumb-current {
|
||||
margin-left: 5.25px; // 「财务中心 /」墨迹宽 65.25 → 发票抬头管理 x135.25
|
||||
color: @finance-entry-text;
|
||||
font-weight: 500;
|
||||
}
|
||||
|
||||
// 标题条 (70,153) 1780×62
|
||||
&__head {
|
||||
.flex(row, space-between, center);
|
||||
flex-wrap: wrap;
|
||||
gap: @spacing-base;
|
||||
padding: 14px 20px;
|
||||
height: 62px;
|
||||
padding: 0 33.56px 0 36px; // 标题 x106;按钮右缘 1822
|
||||
border: 1px solid @finance-card-line;
|
||||
border-radius: @radius-base;
|
||||
background: @white;
|
||||
box-shadow: @shadow-base;
|
||||
box-sizing: border-box;
|
||||
}
|
||||
|
||||
&__title {
|
||||
position: relative;
|
||||
padding-left: 10px;
|
||||
font-size: 12px;
|
||||
font-size: 15px;
|
||||
font-weight: 700;
|
||||
color: @heading-color;
|
||||
|
||||
&::before {
|
||||
content: '';
|
||||
position: absolute;
|
||||
top: 50%;
|
||||
left: 0;
|
||||
width: 4px;
|
||||
height: 14px;
|
||||
border-radius: @radius-round;
|
||||
background: @primary-strong;
|
||||
transform: translateY(-50%);
|
||||
}
|
||||
line-height: 20px;
|
||||
color: @finance-ink;
|
||||
}
|
||||
|
||||
&__filters {
|
||||
.flex(row, flex-end, center);
|
||||
gap: @spacing-sm;
|
||||
}
|
||||
|
||||
&__filter {
|
||||
height: 26px;
|
||||
padding: 0 14px;
|
||||
border: 1px solid @border-color;
|
||||
border-radius: @radius-sm;
|
||||
background: @white;
|
||||
color: @text-color;
|
||||
font-size: 11px;
|
||||
transition: all 0.2s;
|
||||
|
||||
&:hover {
|
||||
border-color: @primary-strong;
|
||||
color: @primary-strong;
|
||||
}
|
||||
|
||||
&.is-active {
|
||||
border-color: @primary-strong;
|
||||
background: @primary-strong;
|
||||
color: @white;
|
||||
}
|
||||
}
|
||||
|
||||
// 「+ 新增抬头」:设计 35 实底 #024FFF 小按钮
|
||||
:deep(.app-button--primary) {
|
||||
height: 26px;
|
||||
padding: 0 12px;
|
||||
border-radius: @radius-sm;
|
||||
// 「+ 新增抬头」(1735.56,167) 110.44×34
|
||||
&__create {
|
||||
width: 110.44px;
|
||||
height: 34px;
|
||||
margin-right: -5px; // 按钮右缘 1822 → 卡内缩 33.56 得 1816.44,再右移 5
|
||||
border: none;
|
||||
border-radius: 4px;
|
||||
background: @primary-strong;
|
||||
font-size: 11px;
|
||||
color: @white;
|
||||
font-size: 12px;
|
||||
font-weight: 500;
|
||||
transition: background 0.2s;
|
||||
|
||||
&:hover {
|
||||
background: @primary-color;
|
||||
}
|
||||
}
|
||||
|
||||
// 抬头卡纵排铺满(设计 35 一行一张)
|
||||
&__grid {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: @spacing-base;
|
||||
// 抬头卡纵排:首卡 (70,229)、次卡 (70,372) → 间距 14
|
||||
&__list {
|
||||
.flex(column, flex-start, stretch);
|
||||
gap: 14px;
|
||||
margin-top: 14px; // 标题条底 215 → 首卡 229
|
||||
}
|
||||
|
||||
&__empty {
|
||||
padding: @spacing-xl 0;
|
||||
font-size: 11px;
|
||||
padding: 60px 0;
|
||||
color: @project-muted;
|
||||
font-size: 13px;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
// 分页:右对齐到内容区右缘,页码 12/400
|
||||
&__pager {
|
||||
.flex(row, flex-end, center);
|
||||
gap: 3.7px;
|
||||
margin-top: 8px; // 次卡底 460 → 页码 ink 505
|
||||
padding-right: 2.4px; // 末位「›」右缘 1881.07 → 内容右缘 1850
|
||||
}
|
||||
|
||||
&__page {
|
||||
min-width: 21.45px;
|
||||
height: 16px;
|
||||
padding: 0 3px;
|
||||
border: none;
|
||||
border-radius: 0;
|
||||
background: transparent;
|
||||
color: @finance-muted-text;
|
||||
font-size: 12px;
|
||||
font-weight: 400;
|
||||
transition: color 0.2s;
|
||||
|
||||
&:hover:not(:disabled) {
|
||||
color: @primary-strong;
|
||||
}
|
||||
|
||||
&.is-active {
|
||||
color: @primary-strong;
|
||||
}
|
||||
|
||||
&:disabled {
|
||||
cursor: not-allowed;
|
||||
opacity: 0.5;
|
||||
}
|
||||
}
|
||||
}
|
||||
</style>
|
||||
|
||||
Reference in New Issue
Block a user