refactor layout

This commit is contained in:
Timi
2026-10-17 12:01:28 +08:00
parent fe467e8781
commit 469c595a7c
134 changed files with 11493 additions and 4437 deletions
+142 -132
View File
@@ -1,143 +1,153 @@
<template>
<div v-can="permissionCodes.point.ledgerRead" class="point-ledger-list">
<div class="filters glass">
<t-input
v-model="customerKeyword"
class="customer"
type="search"
borderless
placeholder="输入客户编码或姓名"
@clear="searchCustomer"
@enter="searchCustomer"
@input="searchCustomer"
<div class="page-layout navbar point-ledger-list">
<t-navbar
fixed
:z-index="20"
title="积分流水"
left-arrow
@left-click="$router.back()"
/>
<main v-can="permissionCodes.point.ledgerRead" class="page-content scroll list">
<t-pull-down-refresh
class="pull-refresh"
v-model="isRefreshing"
:refresh-timeout="30000"
@refresh="reload"
@scrolltolower="load"
>
<template #suffix-icon>
<t-button
size="extra-small"
theme="primary"
variant="outline"
content="选择客户"
@click.stop="selectorVisible = true"
/>
</template>
</t-input>
<t-dropdown-menu class="menus">
<t-dropdown-item
v-model="changeTypeFilter"
label="流水类型"
:options="changeTypeOptions"
@change="selectChangeType"
/>
<t-dropdown-item
v-model="dateFilter"
:label="dateFilterLabel"
:options="dateFilterOptions"
@change="selectDateFilter"
/>
</t-dropdown-menu>
</div>
<t-pull-down-refresh
v-model="isRefreshing"
:refresh-timeout="30000"
@refresh="reload"
@scrolltolower="load"
>
<div class="list-wrap">
<card-container v-if="customer" class="customer">
<customer-profile-card :customer="customer" />
</card-container>
<t-cell-group class="summary" theme="card">
<t-cell
title="开始时间"
:note="dateRange[0] || '-'"
arrow
@click="openStartDate"
/>
<t-cell
title="结束时间"
:note="dateRange[1] || '-'"
arrow
@click="openEndDate"
/>
</t-cell-group>
<t-cell-group v-if="pageResult.list.length" class="list" theme="card">
<t-cell
v-entrance-transition="{ step: 30 }"
v-for="item in pageResult.list"
:key="item.id"
class="item"
:arrow="!!item.id"
:hover="!!item.id"
@click="toDetail(item)"
<div class="filters glass">
<t-input
v-model="customerKeyword"
class="customer"
type="search"
borderless
placeholder="输入客户编码或姓名"
@clear="searchCustomer"
@enter="searchCustomer"
@input="searchCustomer"
>
<template #leftIcon>
<t-image
v-if="getCustomerPhotoURL(item.customer!, 64)"
:src="getCustomerPhotoURL(item.customer!, 64)"
fit="cover"
class="avatar"
<template #suffix-icon>
<t-button
size="extra-small"
theme="primary"
variant="outline"
content="选择客户"
@click.stop="selectorVisible = true"
/>
<div v-else class="avatar fallback" v-text="(item.customer?.name || item.customer?.code || '客').slice(0, 1)" />
</template>
<template #title>
<div class="title">
<t-tag
class="type-icon"
:theme="item.pointDelta && 0 < item.pointDelta ? 'success' : 'danger'"
:content="getLedgerShortType(item)"
variant="outline"
</t-input>
<t-dropdown-menu class="menus">
<t-dropdown-item
v-model="changeTypeFilter"
label="流水类型"
:options="changeTypeOptions"
@change="selectChangeType"
/>
<t-dropdown-item
v-model="dateFilter"
:label="dateFilterLabel"
:options="dateFilterOptions"
@change="selectDateFilter"
/>
</t-dropdown-menu>
</div>
<div class="list-wrap">
<card-container v-if="customer" class="customer">
<customer-profile-card :customer="customer" />
</card-container>
<t-cell-group class="summary" theme="card">
<t-cell
title="开始时间"
:note="dateRange[0] || '-'"
arrow
@click="openStartDate"
/>
<t-cell
title="结束时间"
:note="dateRange[1] || '-'"
arrow
@click="openEndDate"
/>
</t-cell-group>
<t-cell-group v-if="pageResult.list.length" class="list" theme="card">
<t-cell
v-entrance-transition="{ step: 30 }"
v-for="item in pageResult.list"
:key="item.id"
class="item"
:arrow="!!item.id"
:hover="!!item.id"
@click="toDetail(item)"
>
<template #leftIcon>
<t-image
v-if="getCustomerPhotoURL(item.customer!, 64)"
:src="getCustomerPhotoURL(item.customer!, 64)"
fit="cover"
class="avatar"
/>
<div class="name" v-text="item.customer?.name" />
</div>
</template>
<template #description>
<div class="description">
<div>
<span>时间:</span>
<pass-time-label :timestamp="item.occurredAt" underline />
<div v-else class="avatar fallback" v-text="(item.customer?.name || item.customer?.code || '客').slice(0, 1)" />
</template>
<template #title>
<div class="title">
<t-tag
class="type-icon"
:theme="item.pointDelta && 0 < item.pointDelta ? 'success' : 'danger'"
:content="getLedgerShortType(item)"
variant="outline"
/>
<div class="name" v-text="item.customer?.name" />
</div>
<div v-text="`余额:${formatPointValue(item.balanceBefore)} → ${formatPointValue(item.balanceAfter)}`" />
<div v-text="item.remark" />
</div>
</template>
<template #note>
<div class="delta keep-text" :class="getLedgerTheme(item)" v-text="getLedgerDelta(item)" />
</template>
</t-cell>
</t-cell-group>
<div class="center-tips" v-text="loadStateText" />
</div>
</t-pull-down-refresh>
</template>
<template #description>
<div class="description">
<div>
<span>时间:</span>
<pass-time-label :timestamp="item.occurredAt" underline />
</div>
<div v-text="`余额:${formatPointValue(item.balanceBefore)} → ${formatPointValue(item.balanceAfter)}`" />
<div v-text="item.remark" />
</div>
</template>
<template #note>
<div class="delta keep-text" :class="getLedgerTheme(item)" v-text="getLedgerDelta(item)" />
</template>
</t-cell>
</t-cell-group>
<div class="center-tips" v-text="loadStateText" />
</div>
</t-pull-down-refresh>
</main>
<customer-selector
v-model="selectedCustomerId"
v-model:visible="selectorVisible"
@change="handleCustomerChange"
/>
<t-popup v-model="startDateVisible" placement="bottom">
<t-date-time-picker
v-if="startDateVisible"
v-model="startDraft"
format="YYYY-MM-DD HH:mm"
:mode="['date', 'minute']"
title="开始时间"
:default-value="dateRange[0]"
@cancel="cancelStartDate"
@confirm="confirmStartDate"
/>
</t-popup>
<t-popup v-model="endDateVisible" placement="bottom">
<t-date-time-picker
v-if="endDateVisible"
v-model="endDraft"
format="YYYY-MM-DD HH:mm"
:mode="['date', 'minute']"
title="结束时间"
:default-value="dateRange[1]"
@cancel="cancelEndDate"
@confirm="confirmEndDate"
/>
</t-popup>
</div>
<customer-selector
v-model="selectedCustomerId"
v-model:visible="selectorVisible"
@change="handleCustomerChange"
/>
<t-popup v-model="startDateVisible" placement="bottom">
<t-date-time-picker
v-if="startDateVisible"
v-model="startDraft"
format="YYYY-MM-DD HH:mm"
:mode="['date', 'minute']"
title="开始时间"
:default-value="dateRange[0]"
@cancel="cancelStartDate"
@confirm="confirmStartDate"
/>
</t-popup>
<t-popup v-model="endDateVisible" placement="bottom">
<t-date-time-picker
v-if="endDateVisible"
v-model="endDraft"
format="YYYY-MM-DD HH:mm"
:mode="['date', 'minute']"
title="结束时间"
:default-value="dateRange[1]"
@cancel="cancelEndDate"
@confirm="confirmEndDate"
/>
</t-popup>
</template>
<script setup lang="ts">