update point list style

This commit is contained in:
Timi
2026-08-12 22:52:28 +08:00
parent f9efbd109f
commit a7747b4d21
+45 -39
View File
@@ -18,36 +18,45 @@
</t-dropdown-menu> </t-dropdown-menu>
</div> </div>
<t-pull-down-refresh <t-pull-down-refresh
class="list-wrapper"
v-model="isRefreshing" v-model="isRefreshing"
:refresh-timeout="30000" :refresh-timeout="30000"
@refresh="reload" @refresh="reload"
@scrolltolower="load" @scrolltolower="load"
> >
<t-cell-group v-if="pageResult.list.length" class="rule-list" theme="card"> <t-cell-group v-if="pageResult.list.length" class="list" theme="card">
<t-cell <t-cell
v-for="item in pageResult.list" v-for="item in pageResult.list"
:key="item.id" :key="item.id"
class="rule-item" class="item"
:title="item.name || '未命名规则'"
:description="getRuleDescription(item)"
:note="getRuleNote(item)"
:arrow="canUpdate" :arrow="canUpdate"
:hover="canUpdate" :hover="canUpdate"
@click="toEdit(item)" @click="toEdit(item)"
> >
<template #leftIcon> <template #left-icon>
<div class="priority" v-text="item.priority ?? 0" /> <div class="point">
<t-icon name="money" />
<span v-text="`${item.pointValue ? item.pointValue : '?'}`" />
</div>
</template> </template>
<template #extra> <template #title>
<div class="title">
<h4 class="text" v-text="item.name || '未命名规则'" />
<t-tag <t-tag
:theme="getStatusTheme(item.status)" :theme="getStatusTheme(item.status)"
variant="light-outline" variant="light-outline"
:content="getStatusText(item.status)" :content="getStatusText(item.status)"
/> />
</div>
</template>
<template #description>
<div class="description">
<div v-text="`登记事件:${item.eventId ? eventNameMap.get(item.eventId) : '未绑定事件'}`"></div>
<div v-text="`触发类型:${getTriggerText(item)}`"></div>
</div>
</template> </template>
</t-cell> </t-cell>
</t-cell-group> </t-cell-group>
<div v-else class="empty" v-text="isLoading ? '正在加载积分规则' : '暂无积分规则'" />
<div class="load-state" v-text="loadStateText" /> <div class="load-state" v-text="loadStateText" />
</t-pull-down-refresh> </t-pull-down-refresh>
<t-button v-can="permissionCodes.pointRule.create" class="create" theme="primary" @click="toCreate"> <t-button v-can="permissionCodes.pointRule.create" class="create" theme="primary" @click="toCreate">
@@ -60,14 +69,14 @@
</template> </template>
<script setup lang="ts"> <script setup lang="ts">
import { Toast, type DropdownValue } from "tdesign-mobile-vue"; import { type DropdownValue, Toast } from "tdesign-mobile-vue";
import EventAPI from "@/api/EventAPI"; import EventAPI from "@/api/EventAPI";
import PointAPI from "@/api/PointAPI"; import PointAPI from "@/api/PointAPI";
import { useCurrentStoreStore } from "@/store/currentStoreStore"; import { useCurrentStoreStore } from "@/store/currentStoreStore";
import type { EventItem } from "@/types/EventItem"; import type { EventItem } from "@/types/EventItem";
import type { PointRule, PointRuleStatus } from "@/types/Point"; import type { PointRule, PointRuleStatus } from "@/types/Point";
import { gaoRoleCodes, permissionCodes } from "@/utils/permission"; import { gaoRoleCodes, permissionCodes } from "@/utils/permission";
import { useUserStore, type Page, type PageResult } from "timi-web"; import { type Page, type PageResult, useUserStore } from "timi-web";
const allStoresValue = "__ALL_STORES__"; const allStoresValue = "__ALL_STORES__";
@@ -218,18 +227,6 @@ async function loadEventList(): Promise<void> {
// ---------- 展示与导航 ---------- // ---------- 展示与导航 ----------
function getRuleDescription(rule: PointRule): string {
const eventName = rule.eventId ? eventNameMap.value.get(rule.eventId) || `事件 ${rule.eventId}` : "未绑定事件";
const triggerText = getTriggerText(rule);
const pointText = rule.pointMode === "SOURCE_VALUE" ? "使用登记时填写的积分" : `${rule.pointValue ?? 0} 分`;
return `${eventName}|${triggerText}|${pointText}`;
}
function getRuleNote(rule: PointRule): string {
const priority = `优先级 ${rule.priority ?? 0}`;
return rule.exclusive ? `${priority}|命中后停止匹配` : priority;
}
function getTriggerText(rule: PointRule): string { function getTriggerText(rule: PointRule): string {
const map: Record<string, string> = { const map: Record<string, string> = {
EVERY_TIME: "每次登记", EVERY_TIME: "每次登记",
@@ -310,28 +307,37 @@ onMounted(async () => {
background: var(--td-bg-color-container); background: var(--td-bg-color-container);
} }
.rule-list { .list-wrapper {
margin: 0 1rem; min-height: 70vh;
.rule-item { .list {
.priority {
width: 2rem; .item {
height: 2rem;
.point {
width: 3rem;
display: flex; display: flex;
color: #2563eb;
background: #dbeafe;
border-radius: .75rem;
align-items: center; align-items: center;
font-size: .875rem; flex-direction: column;
justify-content: center; justify-content: space-between;
} }
.title {
width: 100%;
display: flex;
justify-content: space-between;
.text {
margin: 0;
} }
} }
.empty { .description {
color: #52607a; font-size: .75rem;
padding: 2rem 1rem; line-height: 1.25;
text-align: center; }
}
}
} }
.create { .create {
@@ -348,7 +354,7 @@ onMounted(async () => {
color: #94a3b8; color: #94a3b8;
} }
.rule-list .priority { .list .priority {
color: #bfdbfe; color: #bfdbfe;
background: rgba(30, 64, 175, .45); background: rgba(30, 64, 175, .45);
} }