total value in t-cell

This commit is contained in:
Timi
2026-09-15 13:11:56 +08:00
parent a6577482ac
commit b8bb44e62a
+32 -44
View File
@@ -47,19 +47,22 @@
@scrolltolower="load" @scrolltolower="load"
> >
<div class="list-wrap"> <div class="list-wrap">
<t-cell-group v-if="isCustomDate" class="date-summary" theme="card"> <t-cell-group class="date-summary" theme="card" v-entrance-transition>
<t-cell <template v-if="isCustomDate">
title="开始时间" <t-cell
:note="dateRange[0] || '-'" title="开始时间"
arrow :note="dateRange[0] || '-'"
@click="openStartTime" arrow
/> @click="openStartTime"
<t-cell />
title="结束时间" <t-cell
:note="dateRange[1] || '-'" title="结束时间"
arrow :note="dateRange[1] || '-'"
@click="openEndTime" arrow
/> @click="openEndTime"
/>
</template>
<t-cell title="总数据量" :note="Text.display(result.total)" />
</t-cell-group> </t-cell-group>
<div v-if="result.list.length" class="items"> <div v-if="result.list.length" class="items">
<t-cell-group theme="card"> <t-cell-group theme="card">
@@ -68,7 +71,7 @@
:key="item.id" :key="item.id"
class="item" class="item"
arrow arrow
v-entrance-transition="index * 30" v-entrance-transition="70 + index * 30"
@click="toDetail(item)" @click="toDetail(item)"
> >
<template #left-icon> <template #left-icon>
@@ -95,8 +98,11 @@
/> />
</div> </div>
</template> </template>
<template #note>
<span class="orange" v-text="formatPoint(item.actualPointCost)" />
</template>
<template #description> <template #description>
<span v-text="`${item.customer?.name || item.customerId || '未知客户'} · ${quantityText(item.quantity)} ${item.unitSnapshot || ''} · 实扣 ${formatPoint(item.actualPointCost)}`" /> <span v-text="`${item.customer?.name || item.customerId || '未知客户'} · ${quantityText(item.quantity)} ${item.unitSnapshot || ''}`" />
</template> </template>
</t-cell> </t-cell>
</t-cell-group> </t-cell-group>
@@ -105,7 +111,6 @@
v-else v-else
:description="loading ? '正在加载兑换记录' : hasFilter ? '未找到匹配的兑换记录' : '暂无兑换记录'" :description="loading ? '正在加载兑换记录' : hasFilter ? '未找到匹配的兑换记录' : '暂无兑换记录'"
/> />
<div class="tips" v-text="`共 ${result.total} 条兑换记录`" />
</div> </div>
</t-pull-down-refresh> </t-pull-down-refresh>
</div> </div>
@@ -146,7 +151,7 @@
<script setup lang="ts"> <script setup lang="ts">
import { type DropdownValue } from "tdesign-mobile-vue"; import { type DropdownValue } from "tdesign-mobile-vue";
import { Time } from "timi-web"; import { Text, Time, Toolkit } from "timi-web";
import CustomerAPI from "@/api/CustomerAPI"; import CustomerAPI from "@/api/CustomerAPI";
import PointAPI from "@/api/PointAPI"; import PointAPI from "@/api/PointAPI";
import CustomerSelector from "@/components/CustomerSelector.vue"; import CustomerSelector from "@/components/CustomerSelector.vue";
@@ -188,7 +193,6 @@ const index = ref(0);
const loading = ref(false); const loading = ref(false);
const refreshing = ref(false); const refreshing = ref(false);
const noMore = ref(false); const noMore = ref(false);
let keywordTimer: number | undefined;
let reloadRequested = false; let reloadRequested = false;
const dateFilterLabel = computed(() => dateOptions.find(item => item.value === dateFilterType.value)?.label || "时间范围"); const dateFilterLabel = computed(() => dateOptions.find(item => item.value === dateFilterType.value)?.label || "时间范围");
const isCustomDate = computed(() => dateFilterType.value === "custom"); const isCustomDate = computed(() => dateFilterType.value === "custom");
@@ -443,15 +447,16 @@ onMounted(async () => {
} }
}); });
const reloadByKeyword = Toolkit.debounce(async () => {
await reload();
}, false);
watch(keyword, () => { watch(keyword, () => {
window.clearTimeout(keywordTimer); reloadByKeyword();
keywordTimer = window.setTimeout(async () => {
await reload();
}, 300);
}); });
onUnmounted(() => { onUnmounted(() => {
window.clearTimeout(keywordTimer); reloadByKeyword.cancel();
navBarStore.clearRight(); navBarStore.clearRight();
}); });
</script> </script>
@@ -506,22 +511,11 @@ onUnmounted(() => {
} }
.list-wrap { .list-wrap {
gap: 1rem;
display: flex;
min-height: 70vh;
padding-top: 1rem; padding-top: 1rem;
flex-direction: column;
.date-summary {
:deep(.t-cell__title) {
flex: 0 0 4.5rem;
}
:deep(.t-cell__note) {
flex: 1 1 0;
min-width: 0;
overflow: hidden;
text-align: right;
text-overflow: ellipsis;
white-space: nowrap;
}
}
.items { .items {
gap: 1rem; gap: 1rem;
@@ -546,12 +540,6 @@ onUnmounted(() => {
} }
} }
} }
.tips {
color: var(--td-text-color-secondary);
padding: 1rem;
text-align: center;
}
} }
} }