add point account list

This commit is contained in:
Timi
2026-08-22 16:42:32 +08:00
parent e237b71f13
commit 1a333508cd
12 changed files with 523 additions and 342 deletions
+7 -3
View File
@@ -378,7 +378,7 @@ async function loadPointAccount(): Promise<void> {
return;
}
try {
pointAccount.value = await PointAPI.accountDetail(customer.value.id, customer.value.storeId);
pointAccount.value = await PointAPI.detailByCustomerId(customer.value.id, customer.value.storeId);
} catch {
pointAccount.value = undefined;
}
@@ -388,10 +388,14 @@ async function toPointAccount(): Promise<void> {
if (!customer.value?.id) {
return;
}
if (!pointAccount.value?.id) {
await router.push({ name: "PointAccountList" });
return;
}
await router.push({
name: "PointAccount",
name: "PointAccountDetail",
params: { id: pointAccount.value.id },
query: {
customerId: customer.value.id,
storeId: customer.value.storeId || "",
transitionDepth: String(Number(route.meta.depth ?? 0) + 1)
}
+3 -19
View File
@@ -30,9 +30,9 @@
:key="item.id || item.code || index"
class="item"
>
<t-cell
<customer-cell
class="cell"
:title="item.name || item.code || '-'"
:customer="item"
arrow
hover
@click="toCustomerDetail(item)"
@@ -40,17 +40,7 @@
<template #description>
<telephone-link :value="item.telephone" placeholder="未填写电话" />
</template>
<template #leftIcon>
<t-image
v-if="getCustomerPhotoURL(item, 64)"
class="avatar"
:src="getCustomerPhotoURL(item, 64)"
:alt="item.name"
fit="cover"
/>
<div v-else class="avatar fallback" v-text="(item.name || '客').slice(0, 1)" />
</template>
</t-cell>
</customer-cell>
<template #right>
<div v-can="permissionCodes.customer.update" class="remove bg-red white" @click="removeInvitee(item)">删除</div>
</template>
@@ -105,7 +95,6 @@ import CustomerProfileCard from "@/components/CustomerProfileCard.vue";
import CustomerSelector from "@/components/CustomerSelector.vue";
import { useSettingStore } from "@/store/settingStore";
import type { Customer } from "@/types/Customer";
import { getCustomerPhotoURL } from "@/utils/customer";
import { permissionCodes } from "@/utils/permission";
defineOptions({
@@ -322,11 +311,6 @@ watch(() => route.params.id, loadCustomer);
.cell {
padding: 6px 10px 6px 6px;
.avatar {
width: 3.25rem;
height: 3.25rem;
}
}
}
+3 -43
View File
@@ -38,36 +38,18 @@
@scrolltolower="fetch"
>
<t-cell-group class="items" theme="card">
<t-cell
<customer-cell
class="item"
v-for="(item, index) in pageResult.list"
:key="item.id || item.code || index"
:customer="item"
arrow
@click="router.push(`/management/customers/${item.id}`)"
>
<template #left-icon>
<t-image
v-if="getCustomerPhotoURL(item, 64)"
class="avatar"
:src="getCustomerPhotoURL(item, 64)"
:alt="item.name"
fit="cover"
/>
<div v-else class="avatar fallback" v-text="(item.name || item.code || '客').slice(0, 1)" />
</template>
<template #title>
<div class="header">
<div class="left">
<div class="text-bold" v-text="item.name" />
<gender-icon :value="item.gender" size="1.125rem" />
</div>
<span class="gray" v-text="item.code || ''" />
</div>
</template>
<template #description>
<telephone-link :value="item.telephone" />
</template>
</t-cell>
</customer-cell>
</t-cell-group>
<div v-if="!pageResult.list.length" class="load-state" v-text="isLoading ? '正在加载客户' : '暂无客户数据'" />
<div v-if="pageResult.list.length" class="load-state" v-text="isLoading ? '正在加载更多' : isNoMore ? '已经到底了' : '上拉加载更多'" />
@@ -85,14 +67,12 @@
import { Message } from "@/utils/message";
import { type Page, type PageResult, Time, Toolkit, useUserStore } from "timi-web";
import CustomerAPI from "@/api/CustomerAPI";
import GenderIcon from "@/components/GenderIcon.vue";
import TagSelector from "@/components/TagSelector.vue";
import { useCurrentStoreStore } from "@/store/currentStoreStore";
import { useNavBarStore } from "@/store/navBarStore";
import type { Customer } from "@/types/Customer";
import type { NavBarAction } from "@/types/NavBarAction";
import type { Tag } from "@/types/Tag";
import { getCustomerPhotoURL } from "@/utils/customer";
import { corePermissionCodes, gaoRoleCodes, permissionCodes } from "@/utils/permission";
defineOptions({
@@ -304,26 +284,6 @@ async function doExport(): Promise<void> {
.item {
padding: 10px;
.avatar {
width: 3.5rem;
height: 3.5rem;
border-radius: .5rem;
}
.header {
gap: .5rem;
width: 100%;
display: flex;
align-items: center;
justify-content: space-between;
.left {
gap: .5rem;
display: flex;
align-items: center;
}
}
}
}
}