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
+175 -163
View File
@@ -1,171 +1,186 @@
<template>
<div v-can="pageAccess" class="sales-order-record-list">
<div class="filters glass">
<t-input
class="customer"
v-model.trim="customerSearchKeyword"
borderless
placeholder="输入客户编码或姓名"
@enter="applyCustomerSearch"
<div class="page-layout navbar sales-order-record-list">
<t-navbar
fixed
:z-index="20"
title="资金流水"
left-arrow
@left-click="$router.back()"
/>
<main v-can="pageAccess" class="page-content scroll list">
<t-pull-down-refresh
class="pull-refresh"
v-model="isRefreshing"
:refresh-timeout="30000"
@refresh="reload"
@scrolltolower="loadMore"
>
<template #suffix-icon>
<div class="actions">
<t-button
v-if="customerId"
shape="circle"
theme="danger"
variant="text"
size="extra-small"
aria-label="清除客户选择"
@click.stop="clearCustomer"
>
<t-icon name="close" size="1rem" />
</t-button>
<t-button
size="extra-small"
theme="primary"
variant="outline"
content="选择客户"
@click.stop="customerSelectorVisible = true"
<div class="filters glass">
<t-input
class="customer"
v-model.trim="customerSearchKeyword"
borderless
placeholder="输入客户编码或姓名"
@enter="applyCustomerSearch"
>
<template #suffix-icon>
<div class="actions">
<t-button
v-if="customerId"
shape="circle"
theme="danger"
variant="text"
size="extra-small"
aria-label="清除客户选择"
@click.stop="clearCustomer"
>
<t-icon name="close" size="1rem" />
</t-button>
<t-button
size="extra-small"
theme="primary"
variant="outline"
content="选择客户"
@click.stop="customerSelectorVisible = true"
/>
</div>
</template>
</t-input>
<t-dropdown-menu class="menus">
<t-dropdown-item
v-model="dateFilterType"
:label="dateFilterLabel"
:options="dateOptions"
@change="selectDateFilter"
/>
</div>
</template>
</t-input>
<t-dropdown-menu class="menus">
<t-dropdown-item
v-model="dateFilterType"
:label="dateFilterLabel"
:options="dateOptions"
@change="selectDateFilter"
/>
<t-dropdown-item
v-if="!isSelfReceiveOnly"
v-model="operationType"
:label="operationFilterLabel"
:options="operationOptions"
@change="selectOperation"
/>
<t-dropdown-item
v-model="status"
label="状态"
:options="statusOptions"
@change="selectStatus"
/>
</t-dropdown-menu>
</div>
<t-pull-down-refresh v-model="isRefreshing" :refresh-timeout="30000" @refresh="reload" @scrolltolower="loadMore">
<t-cell-group v-if="isCustomDate" class="date-summary" theme="card">
<t-cell
title="开始时间"
:note="dateRange[0] || '-'"
arrow
@click="openStartTime"
/>
<t-cell
title="结束时间"
:note="dateRange[1] || '-'"
arrow
@click="openEndTime"
/>
</t-cell-group>
<t-cell-group v-if="recordList.length" class="empty-cell-title-margin" theme="card">
<t-cell
class="item"
v-for="item in recordList"
:key="item.id"
arrow
v-entrance-transition="{ step: 30 }"
@click="toDetail(item)"
>
<template #leftIcon>
<t-image
v-if="getCustomerPhotoURL(item.customer, 64)"
:src="getCustomerPhotoURL(item.customer, 64)"
:alt="getCustomerText(item)"
fit="cover"
class="avatar"
<t-dropdown-item
v-if="!isSelfReceiveOnly"
v-model="operationType"
:label="operationFilterLabel"
:options="operationOptions"
@change="selectOperation"
/>
<div v-else class="avatar fallback" v-text="getCustomerText(item).slice(0, 1)" />
</template>
<template #title>
<div class="title">
<span class="customer clip-text" v-text="getCustomerText(item)" />
<span class="type" :class="getOperationClass(item.operationType)" v-text="getFundOperationText(item.operationType)" />
<t-tag
size="small"
:content="getRecordStatusText(item)"
variant="light-outline"
:theme="getRecordStatusTheme(item)"
<t-dropdown-item
v-model="status"
label="状态"
:options="statusOptions"
@change="selectStatus"
/>
</t-dropdown-menu>
</div>
<t-cell-group v-if="isCustomDate" class="date-summary" theme="card">
<t-cell
title="开始时间"
:note="dateRange[0] || '-'"
arrow
@click="openStartTime"
/>
<t-cell
title="结束时间"
:note="dateRange[1] || '-'"
arrow
@click="openEndTime"
/>
</t-cell-group>
<t-cell-group v-if="recordList.length" class="empty-cell-title-margin" theme="card">
<t-cell
class="item"
v-for="item in recordList"
:key="item.id"
arrow
v-entrance-transition="{ step: 30 }"
@click="toDetail(item)"
>
<template #leftIcon>
<t-image
v-if="getCustomerPhotoURL(item.customer, 64)"
:src="getCustomerPhotoURL(item.customer, 64)"
:alt="getCustomerText(item)"
fit="cover"
class="avatar"
/>
</div>
</template>
<template #description>
<div class="description">
<div class="operator">
<div class="field">
<span class="label">发起人</span>
<span class="text-bold" v-text="getOperatorText(item)" />
</div>
<div v-if="item.verifier" class="field">
<span class="label">核销人</span>
<span class="text-bold" v-text="getVerifierText(item)" />
</div>
<pass-time-label :timestamp="item.occurredAt" underline />
<div v-else class="avatar fallback" v-text="getCustomerText(item).slice(0, 1)" />
</template>
<template #title>
<div class="title">
<span class="customer clip-text" v-text="getCustomerText(item)" />
<span class="type" :class="getOperationClass(item.operationType)" v-text="getFundOperationText(item.operationType)" />
<t-tag
size="small"
:content="getRecordStatusText(item)"
variant="light-outline"
:theme="getRecordStatusTheme(item)"
/>
</div>
<div class="amounts">
<div class="order-amount">
<span class="label">订单总价</span>
<span>¥</span>
<span v-text="formatPackageAmount(item.salesOrderAmount)" />
</template>
<template #description>
<div class="description">
<div class="operator">
<div class="field">
<span class="label">发起人</span>
<span class="text-bold" v-text="getOperatorText(item)" />
</div>
<div v-if="item.verifier" class="field">
<span class="label">核销人</span>
<span class="text-bold" v-text="getVerifierText(item)" />
</div>
<pass-time-label :timestamp="item.occurredAt" underline />
</div>
<div class="unpaid-amount">
<span class="label">剩余待收</span>
<span>¥</span>
<span v-text="formatPackageAmount(item.salesOrderUnpaidAmountSnapshot)" />
</div>
<div class="record-amount">
<span class="label">流水金额</span>
<span class="red">¥</span>
<span class="value red" v-text="formatPackageAmount(item.amount)" />
<div class="amounts">
<div class="order-amount">
<span class="label">订单总价</span>
<span>¥</span>
<span v-text="formatPackageAmount(item.salesOrderAmount)" />
</div>
<div class="unpaid-amount">
<span class="label">剩余待收</span>
<span>¥</span>
<span v-text="formatPackageAmount(item.salesOrderUnpaidAmountSnapshot)" />
</div>
<div class="record-amount">
<span class="label">流水金额</span>
<span class="red">¥</span>
<span class="value red" v-text="formatPackageAmount(item.amount)" />
</div>
</div>
</div>
</div>
</template>
</t-cell>
</t-cell-group>
<div v-else class="empty" v-text="loading ? '正在加载资金流水' : '暂无资金流水'" />
<div class="center-tips" v-text="loadStateText" />
</t-pull-down-refresh>
</template>
</t-cell>
</t-cell-group>
<div v-else class="empty" v-text="loading ? '正在加载资金流水' : '暂无资金流水'" />
<div class="center-tips" v-text="loadStateText" />
</t-pull-down-refresh>
</main>
<customer-selector
v-model="customerId"
v-model:visible="customerSelectorVisible"
@change="handleCustomerChange"
/>
<t-popup v-model="startVisible" placement="bottom">
<t-date-time-picker
v-if="startVisible"
v-model="startDraft"
format="YYYY-MM-DD HH:mm"
:mode="['date', 'minute']"
title="开始时间"
:default-value="dateRange[0]"
@cancel="cancelStartTime"
@confirm="confirmStartTime"
/>
</t-popup>
<t-popup v-model="endVisible" placement="bottom">
<t-date-time-picker
v-if="endVisible"
v-model="endDraft"
format="YYYY-MM-DD HH:mm"
:mode="['date', 'minute']"
title="结束时间"
:default-value="dateRange[1]"
@cancel="cancelEndTime"
@confirm="confirmEndTime"
/>
</t-popup>
</div>
<customer-selector
v-model="customerId"
v-model:visible="customerSelectorVisible"
@change="handleCustomerChange"
/>
<t-popup v-model="startVisible" placement="bottom">
<t-date-time-picker
v-if="startVisible"
v-model="startDraft"
format="YYYY-MM-DD HH:mm"
:mode="['date', 'minute']"
title="开始时间"
:default-value="dateRange[0]"
@cancel="cancelStartTime"
@confirm="confirmStartTime"
/>
</t-popup>
<t-popup v-model="endVisible" placement="bottom">
<t-date-time-picker
v-if="endVisible"
v-model="endDraft"
format="YYYY-MM-DD HH:mm"
:mode="['date', 'minute']"
title="结束时间"
:default-value="dateRange[1]"
@cancel="cancelEndTime"
@confirm="confirmEndTime"
/>
</t-popup>
</template>
<script setup lang="ts">
@@ -175,8 +190,6 @@ import { useUserStore } from "timi-web-api";
import CustomerAPI from "@/api/CustomerAPI";
import SalesOrderAPI from "@/api/SalesOrderAPI";
import CustomerSelector from "@/components/CustomerSelector.vue";
import { useNavBarStore } from "@/store/navBarStore";
import type { Customer } from "@/types/Customer";
import type { FundOperationType, FundRecord, FundRecordStatus } from "@/types/SalesOrder";
import { buildPresetDateRange, parseDateFilterType, parseDateTime } from "@/utils/date";
import { getErrorMessage } from "@/utils/error";
@@ -186,13 +199,14 @@ import { Message } from "@/utils/message";
import { permissionCodes } from "@/utils/permission";
import { getCustomerPhotoURL } from "@/utils/customer";
import type { Customer } from "@/types/Customer";
defineOptions({ name: "FundRecordList" });
type DateFilterType = "today" | "yesterday" | "thisWeek" | "thisMonth" | "lastMonth" | "all" | "custom";
const route = useRoute();
const router = useRouter();
const navBarStore = useNavBarStore();
const userStore = useUserStore();
const recordList = ref<FundRecord[]>([]);
const operationType = ref(route.query.operationType === "RECEIVE" ? "RECEIVE" : "ALL");
@@ -503,7 +517,6 @@ function getCurrentRouteDepth(): number {
}
onMounted(async () => {
navBarStore.clearRight();
try {
if (customerId.value) {
selectedCustomer.value = await CustomerAPI.detail(customerId.value);
@@ -515,7 +528,6 @@ onMounted(async () => {
}
});
onUnmounted(() => navBarStore.clearRight());
</script>
<style scoped lang="less">