update point list style
This commit is contained in:
@@ -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>
|
||||||
<t-tag
|
<div class="title">
|
||||||
:theme="getStatusTheme(item.status)"
|
<h4 class="text" v-text="item.name || '未命名规则'" />
|
||||||
variant="light-outline"
|
<t-tag
|
||||||
:content="getStatusText(item.status)"
|
:theme="getStatusTheme(item.status)"
|
||||||
/>
|
variant="light-outline"
|
||||||
|
: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,30 +307,39 @@ 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;
|
|
||||||
display: flex;
|
.point {
|
||||||
color: #2563eb;
|
width: 3rem;
|
||||||
background: #dbeafe;
|
display: flex;
|
||||||
border-radius: .75rem;
|
align-items: center;
|
||||||
align-items: center;
|
flex-direction: column;
|
||||||
font-size: .875rem;
|
justify-content: space-between;
|
||||||
justify-content: center;
|
}
|
||||||
|
|
||||||
|
.title {
|
||||||
|
width: 100%;
|
||||||
|
display: flex;
|
||||||
|
justify-content: space-between;
|
||||||
|
|
||||||
|
.text {
|
||||||
|
margin: 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.description {
|
||||||
|
font-size: .75rem;
|
||||||
|
line-height: 1.25;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
.empty {
|
|
||||||
color: #52607a;
|
|
||||||
padding: 2rem 1rem;
|
|
||||||
text-align: center;
|
|
||||||
}
|
|
||||||
|
|
||||||
.create {
|
.create {
|
||||||
left: 1rem;
|
left: 1rem;
|
||||||
right: 1rem;
|
right: 1rem;
|
||||||
@@ -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);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user