refactor(UI): fund record list cell
This commit is contained in:
@@ -89,71 +89,15 @@
|
|||||||
@click="openEndTime"
|
@click="openEndTime"
|
||||||
/>
|
/>
|
||||||
</t-cell-group>
|
</t-cell-group>
|
||||||
<t-cell-group v-if="recordList.length" class="empty-cell-title-margin" theme="card">
|
<div v-if="recordList.length" class="records">
|
||||||
<t-cell
|
<fund-record-list-cell
|
||||||
class="item"
|
|
||||||
v-for="item in recordList"
|
v-for="item in recordList"
|
||||||
:key="item.id"
|
:key="item.id"
|
||||||
arrow
|
|
||||||
v-entrance-transition="{ step: 30 }"
|
v-entrance-transition="{ step: 30 }"
|
||||||
@click="toDetail(item)"
|
:item="item"
|
||||||
>
|
@detail="toDetail(item)"
|
||||||
<template #leftIcon>
|
/>
|
||||||
<t-image
|
</div>
|
||||||
v-if="getCustomerPhotoURL(item.customer, 64)"
|
|
||||||
:src="getCustomerPhotoURL(item.customer, 64)"
|
|
||||||
:alt="getCustomerText(item)"
|
|
||||||
fit="cover"
|
|
||||||
class="avatar"
|
|
||||||
/>
|
|
||||||
<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>
|
|
||||||
</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>
|
|
||||||
<time-label :timestamp="item.occurredAt" underline />
|
|
||||||
</div>
|
|
||||||
<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>
|
|
||||||
</template>
|
|
||||||
</t-cell>
|
|
||||||
</t-cell-group>
|
|
||||||
<center-tips v-else :content="loading ? '正在加载资金流水' : '暂无资金流水'" />
|
<center-tips v-else :content="loading ? '正在加载资金流水' : '暂无资金流水'" />
|
||||||
<center-tips :content="loadStateText" />
|
<center-tips :content="loadStateText" />
|
||||||
</t-pull-down-refresh>
|
</t-pull-down-refresh>
|
||||||
@@ -201,7 +145,8 @@
|
|||||||
import { MasterDetailPage, useMasterDetailPane } from "timi-tdesign-mobile";
|
import { MasterDetailPage, useMasterDetailPane } from "timi-tdesign-mobile";
|
||||||
import { type DropdownValue } from "tdesign-mobile-vue";
|
import { type DropdownValue } from "tdesign-mobile-vue";
|
||||||
import FundRecordDetail from "@/pages/salesOrder/FundRecordDetail.vue";
|
import FundRecordDetail from "@/pages/salesOrder/FundRecordDetail.vue";
|
||||||
import { TimeLabel, Time } from "timi-web";
|
import FundRecordListCell from "@/pages/salesOrder/component/FundRecordListCell.vue";
|
||||||
|
import { Time } from "timi-web";
|
||||||
import { useUserStore } from "timi-web-api";
|
import { useUserStore } from "timi-web-api";
|
||||||
import CustomerAPI from "@/api/CustomerAPI";
|
import CustomerAPI from "@/api/CustomerAPI";
|
||||||
import SalesOrderAPI from "@/api/SalesOrderAPI";
|
import SalesOrderAPI from "@/api/SalesOrderAPI";
|
||||||
@@ -210,11 +155,8 @@ import type { FundOperationType, FundRecord, FundRecordStatus } from "@/types/Sa
|
|||||||
import { buildPresetDateRange, parseDateFilterType, parseDateTime } from "@/utils/date";
|
import { buildPresetDateRange, parseDateFilterType, parseDateTime } from "@/utils/date";
|
||||||
import { DATE_FILTER_OPTIONS as dateOptions, type DateFilterType } from "@/utils/dateFilter";
|
import { DATE_FILTER_OPTIONS as dateOptions, type DateFilterType } from "@/utils/dateFilter";
|
||||||
import { getErrorMessage } from "@/utils/error";
|
import { getErrorMessage } from "@/utils/error";
|
||||||
import { formatPackageAmount } from "@/utils/package";
|
|
||||||
import { getFundOperationText, getFundStatusText } from "@/utils/salesOrder";
|
|
||||||
import { Message } from "@/utils/message";
|
import { Message } from "@/utils/message";
|
||||||
import { permissionCodes } from "@/utils/permission";
|
import { permissionCodes } from "@/utils/permission";
|
||||||
import { getCustomerPhotoURL } from "@/utils/customer";
|
|
||||||
|
|
||||||
import type { Customer } from "@/types/Customer";
|
import type { Customer } from "@/types/Customer";
|
||||||
|
|
||||||
@@ -475,39 +417,6 @@ function buildUnixRange(): [number | undefined, number | undefined] {
|
|||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
function getOperatorText(item: FundRecord): string {
|
|
||||||
return item.operator?.nick || item.operator?.name || item.operatorUserId || "未知";
|
|
||||||
}
|
|
||||||
|
|
||||||
function getVerifierText(item: FundRecord): string {
|
|
||||||
return item.verifier?.nick || item.verifier?.name || item.verifierUserId || "未核销";
|
|
||||||
}
|
|
||||||
|
|
||||||
function getCustomerText(item: FundRecord): string {
|
|
||||||
return item.customer?.name || item.customer?.code || item.customerId || "未知客户";
|
|
||||||
}
|
|
||||||
|
|
||||||
function getOperationClass(type?: FundOperationType): string {
|
|
||||||
return ({
|
|
||||||
RECEIVE: "receive",
|
|
||||||
REFUND: "refund",
|
|
||||||
CONFIRM_NO_REFUND: "confirm-no-refund",
|
|
||||||
REVOKE: "revoke"
|
|
||||||
} as Record<string, string>)[type || ""] || "unknown";
|
|
||||||
}
|
|
||||||
|
|
||||||
function getStatusTheme(statusValue?: FundRecordStatus): "success" | "warning" | "danger" | "default" {
|
|
||||||
return statusValue === "VERIFIED" ? "success" : statusValue === "PENDING" ? "warning" : statusValue === "REJECTED" ? "danger" : "default";
|
|
||||||
}
|
|
||||||
|
|
||||||
function getRecordStatusText(item: FundRecord): string {
|
|
||||||
return item.revokeRecordId ? "已被冲正" : getFundStatusText(item.status);
|
|
||||||
}
|
|
||||||
|
|
||||||
function getRecordStatusTheme(item: FundRecord): "success" | "warning" | "danger" | "default" {
|
|
||||||
return item.revokeRecordId ? "danger" : getStatusTheme(item.status);
|
|
||||||
}
|
|
||||||
|
|
||||||
async function toDetail(item: FundRecord): Promise<void> {
|
async function toDetail(item: FundRecord): Promise<void> {
|
||||||
openDetail(item.id || "");
|
openDetail(item.id || "");
|
||||||
}
|
}
|
||||||
@@ -530,121 +439,13 @@ onMounted(async () => {
|
|||||||
.sales-order-record-list {
|
.sales-order-record-list {
|
||||||
padding: var(--tui-nav-height) 0 1rem;
|
padding: var(--tui-nav-height) 0 1rem;
|
||||||
|
|
||||||
|
.records {
|
||||||
.item {
|
gap: .5rem;
|
||||||
|
margin: .75rem;
|
||||||
.avatar {
|
display: flex;
|
||||||
width: 3.5rem;
|
flex-direction: column;
|
||||||
height: 3.5rem;
|
|
||||||
}
|
|
||||||
|
|
||||||
.title {
|
|
||||||
gap: .25rem;
|
|
||||||
display: flex;
|
|
||||||
font-size: .75rem;
|
|
||||||
align-items: center;
|
|
||||||
justify-content: space-between;
|
|
||||||
|
|
||||||
.customer {
|
|
||||||
font-weight: 600;
|
|
||||||
}
|
|
||||||
|
|
||||||
.type {
|
|
||||||
font-weight: 700;
|
|
||||||
|
|
||||||
&.receive {
|
|
||||||
color: #15803d;
|
|
||||||
}
|
|
||||||
|
|
||||||
&.refund {
|
|
||||||
color: #dc2626;
|
|
||||||
}
|
|
||||||
|
|
||||||
&.confirm-no-refund {
|
|
||||||
color: #2563eb;
|
|
||||||
}
|
|
||||||
|
|
||||||
&.revoke {
|
|
||||||
color: #7c3aed;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
.description {
|
|
||||||
display: flex;
|
|
||||||
align-items: start;
|
|
||||||
justify-content: space-between;
|
|
||||||
|
|
||||||
.operator {
|
|
||||||
gap: 0;
|
|
||||||
color: var(--td-text-color-secondary);
|
|
||||||
display: flex;
|
|
||||||
font-size: .75rem;
|
|
||||||
flex-wrap: wrap;
|
|
||||||
line-height: 1.5;
|
|
||||||
flex-direction: column;
|
|
||||||
|
|
||||||
.field {
|
|
||||||
gap: .25rem;
|
|
||||||
display: inline-flex;
|
|
||||||
}
|
|
||||||
|
|
||||||
.label {
|
|
||||||
color: var(--td-text-color-placeholder);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
.amounts {
|
|
||||||
display: flex;
|
|
||||||
font-size: .75rem;
|
|
||||||
line-height: 1.5;
|
|
||||||
align-items: end;
|
|
||||||
flex-direction: column;
|
|
||||||
|
|
||||||
.label {
|
|
||||||
color: var(--td-text-color-placeholder);
|
|
||||||
}
|
|
||||||
|
|
||||||
.order-amount,
|
|
||||||
.unpaid-amount,
|
|
||||||
.record-amount {
|
|
||||||
display: flex;
|
|
||||||
align-items: baseline;
|
|
||||||
white-space: nowrap;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
:deep(.sales-order-record-list .avatar .t-image__img) {
|
|
||||||
width: 100%;
|
|
||||||
height: 100%;
|
|
||||||
object-fit: cover;
|
|
||||||
border-radius: inherit;
|
|
||||||
}
|
|
||||||
|
|
||||||
:global(html.theme-dark) .sales-order-record-list {
|
|
||||||
.fallback {
|
|
||||||
background: #115e59;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
.operation-type {
|
|
||||||
&.receive {
|
|
||||||
color: #86efac;
|
|
||||||
}
|
|
||||||
|
|
||||||
&.refund {
|
|
||||||
color: #fca5a5;
|
|
||||||
}
|
|
||||||
|
|
||||||
&.confirm-no-refund {
|
|
||||||
color: #93c5fd;
|
|
||||||
}
|
|
||||||
|
|
||||||
&.revoke {
|
|
||||||
color: #c4b5fd;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
</style>
|
</style>
|
||||||
|
|||||||
@@ -0,0 +1,199 @@
|
|||||||
|
<template>
|
||||||
|
<div class="item">
|
||||||
|
<div class="header">
|
||||||
|
<t-image v-if="getCustomerPhotoURL(item.customer, 64)" :src="getCustomerPhotoURL(item.customer, 64)"
|
||||||
|
:alt="getCustomerText(item)" fit="cover" class="avatar" />
|
||||||
|
<div v-else class="avatar fallback" v-text="getCustomerText(item).slice(0, 1)" />
|
||||||
|
<div class="main">
|
||||||
|
<div class="customer-status">
|
||||||
|
<strong class="customer clip-text" v-text="getCustomerText(item)" />
|
||||||
|
<div class="tags">
|
||||||
|
<t-tag
|
||||||
|
size="small"
|
||||||
|
variant="light"
|
||||||
|
:theme="item.operationType === 'RECEIVE' ? 'success' : item.operationType === 'REFUND' ? 'danger' : 'default'"
|
||||||
|
:content="getFundOperationText(item.operationType)"
|
||||||
|
/>
|
||||||
|
<t-tag size="small" :content="getRecordStatusText(item)" variant="light-outline"
|
||||||
|
:theme="getRecordStatusTheme(item)" />
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="record-line">
|
||||||
|
<time-label class="time" :timestamp="item.occurredAt" underline />
|
||||||
|
<div class="amount">
|
||||||
|
<span class="red">¥</span>
|
||||||
|
<strong class="value red" v-text="formatPackageAmount(item.amount)" />
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<t-divider />
|
||||||
|
<div class="amounts">
|
||||||
|
<span>订单总价 <strong v-text="`¥${formatPackageAmount(item.salesOrderAmount)}`" /></span>
|
||||||
|
<span>剩余待收 <strong v-text="`¥${formatPackageAmount(item.salesOrderUnpaidAmountSnapshot)}`" /></span>
|
||||||
|
</div>
|
||||||
|
<t-divider />
|
||||||
|
<div class="people-actions">
|
||||||
|
<div class="person"><span class="label">发起人</span><strong v-text="getOperatorText(item)" /></div>
|
||||||
|
<div v-if="item.verifier" class="person"><span class="label">核销人</span><strong
|
||||||
|
v-text="getVerifierText(item)" /></div>
|
||||||
|
<div class="actions">
|
||||||
|
<t-button theme="primary" size="extra-small" content="详情" @click.stop="emit('detail')" />
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script setup lang="ts">
|
||||||
|
import { TimeLabel } from "timi-web";
|
||||||
|
import type { FundRecord, FundRecordStatus } from "@/types/SalesOrder";
|
||||||
|
import { getCustomerPhotoURL } from "@/utils/customer";
|
||||||
|
import { formatPackageAmount } from "@/utils/package";
|
||||||
|
import { getFundOperationText, getFundStatusText } from "@/utils/salesOrder";
|
||||||
|
|
||||||
|
defineOptions({ name: "FundRecordListCell" });
|
||||||
|
defineProps<{ item: FundRecord }>();
|
||||||
|
const emit = defineEmits<{ detail: [] }>();
|
||||||
|
|
||||||
|
function getOperatorText(item: FundRecord): string {
|
||||||
|
return item.operator?.nick || item.operator?.name || item.operatorUserId || "未知";
|
||||||
|
}
|
||||||
|
|
||||||
|
function getVerifierText(item: FundRecord): string {
|
||||||
|
return item.verifier?.nick || item.verifier?.name || item.verifierUserId || "未核销";
|
||||||
|
}
|
||||||
|
|
||||||
|
function getCustomerText(item: FundRecord): string {
|
||||||
|
return item.customer?.name || item.customer?.code || item.customerId || "未知客户";
|
||||||
|
}
|
||||||
|
|
||||||
|
function getStatusTheme(statusValue?: FundRecordStatus): "success" | "warning" | "danger" | "default" {
|
||||||
|
return statusValue === "VERIFIED" ? "success" : statusValue === "PENDING" ? "warning" : statusValue === "REJECTED" ? "danger" : "default";
|
||||||
|
}
|
||||||
|
|
||||||
|
function getRecordStatusText(item: FundRecord): string {
|
||||||
|
return item.revokeRecordId ? "已被冲正" : getFundStatusText(item.status);
|
||||||
|
}
|
||||||
|
|
||||||
|
function getRecordStatusTheme(item: FundRecord): "success" | "warning" | "danger" | "default" {
|
||||||
|
return item.revokeRecordId ? "danger" : getStatusTheme(item.status);
|
||||||
|
}
|
||||||
|
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style scoped lang="less">
|
||||||
|
.item {
|
||||||
|
gap: .5rem;
|
||||||
|
padding: .625rem;
|
||||||
|
display: flex;
|
||||||
|
background: var(--td-bg-color-container);
|
||||||
|
flex-direction: column;
|
||||||
|
border-radius: 1rem;
|
||||||
|
|
||||||
|
.header {
|
||||||
|
gap: .5rem;
|
||||||
|
display: flex;
|
||||||
|
|
||||||
|
.avatar {
|
||||||
|
width: 3.5rem;
|
||||||
|
height: 3.5rem;
|
||||||
|
}
|
||||||
|
|
||||||
|
.main {
|
||||||
|
gap: .5rem;
|
||||||
|
flex: 1;
|
||||||
|
display: flex;
|
||||||
|
min-width: 0;
|
||||||
|
flex-direction: column;
|
||||||
|
}
|
||||||
|
|
||||||
|
.customer-status, .record-line {
|
||||||
|
gap: .5rem;
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: space-between;
|
||||||
|
}
|
||||||
|
|
||||||
|
.customer {
|
||||||
|
min-width: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.tags {
|
||||||
|
gap: .5rem;
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
}
|
||||||
|
|
||||||
|
.record-line {
|
||||||
|
|
||||||
|
.time {
|
||||||
|
color: var(--td-text-color-secondary);
|
||||||
|
font-size: .75rem;
|
||||||
|
}
|
||||||
|
|
||||||
|
.amount {
|
||||||
|
|
||||||
|
.value {
|
||||||
|
font-size: 1.25rem;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.amounts {
|
||||||
|
gap: 1rem;
|
||||||
|
display: flex;
|
||||||
|
font-size: .75rem;
|
||||||
|
flex-wrap: wrap;
|
||||||
|
}
|
||||||
|
|
||||||
|
.people-actions {
|
||||||
|
gap: .75rem;
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: space-between;
|
||||||
|
|
||||||
|
.person {
|
||||||
|
gap: .25rem;
|
||||||
|
display: flex;
|
||||||
|
min-width: 0;
|
||||||
|
font-size: .75rem;
|
||||||
|
align-items: baseline;
|
||||||
|
|
||||||
|
.label {
|
||||||
|
color: var(--td-text-color-secondary);
|
||||||
|
flex: 0 0 auto;
|
||||||
|
}
|
||||||
|
|
||||||
|
strong {
|
||||||
|
max-width: 10rem;
|
||||||
|
overflow: hidden;
|
||||||
|
white-space: nowrap;
|
||||||
|
text-overflow: ellipsis;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.actions {
|
||||||
|
--td-button-border-radius: .5rem;
|
||||||
|
display: flex;
|
||||||
|
justify-content: end;
|
||||||
|
|
||||||
|
.t-button {
|
||||||
|
padding-left: 1.5rem;
|
||||||
|
padding-right: 1.5rem;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
:deep(.avatar .t-image__img) {
|
||||||
|
width: 100%;
|
||||||
|
height: 100%;
|
||||||
|
object-fit: cover;
|
||||||
|
border-radius: inherit;
|
||||||
|
}
|
||||||
|
|
||||||
|
:global(html.theme-dark) .item .fallback {
|
||||||
|
background: #115e59;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
Reference in New Issue
Block a user