support tablet

This commit is contained in:
Timi
2026-11-02 23:12:05 +08:00
parent c48b19bed5
commit d3879c9c77
123 changed files with 4153 additions and 2673 deletions
+89 -72
View File
@@ -1,5 +1,5 @@
<template>
<div class="page-layout navbar redeem-sku-list">
<div class="tui-page-layout tui-navbar redeem-sku-list">
<t-navbar
fixed
:z-index="20"
@@ -18,80 +18,92 @@
/>
</template>
</t-navbar>
<main v-can="permissionCodes.pointRedeemSku.manage" class="page-content scroll column list">
<t-pull-down-refresh
class="pull-refresh"
v-model="isRefreshing"
:refresh-timeout="30000"
@refresh="reload"
@scrolltolower="load"
>
<div class="filters glass">
<t-input
v-model.trim="keyword"
class="keyword"
type="search"
borderless
clearable
placeholder="搜索产品名称、编码或 SKU"
/>
</div>
<t-cell-group v-if="result.list.length" theme="card">
<t-cell
v-for="item in result.list"
:key="item.id"
class="item"
arrow
v-entrance-transition="{ step: 30 }"
@click="toEdit(item)"
>
<template #left-icon>
<t-image
v-if="getProductPhoto(item)"
:src="getProductPhoto(item)"
:alt="item.product?.name || item.sku?.name || '产品图片'"
fit="cover"
class="avatar"
/>
<div
v-else
class="avatar fallback"
v-text="(item.product?.name || item.sku?.name || '产').slice(0, 1)"
/>
</template>
<template #title>
<span class="clip-text" v-text="item.product?.name || item.sku?.name || '未命名产品'" />
</template>
<template #note>
<span class="orange keep-text" v-text="formatPoint(item.defaultPointCost)" />
</template>
<template #description>
<div class="description">
<t-tag
size="small"
:theme="item.status === 'ACTIVE' ? 'success' : 'default'"
:content="statusText(item.status)"
<master-detail-page
v-can="permissionCodes.pointRedeemSku.manage"
class="list"
:split="isWide"
:selected="!!selectedId"
:direction="paneDirection"
>
<template #master>
<t-pull-down-refresh
class="pull-refresh"
v-model="isRefreshing"
:refresh-timeout="30000"
@refresh="reload"
@scrolltolower="load"
>
<div class="filters glass">
<t-input
v-model.trim="keyword"
class="keyword"
type="search"
borderless
clearable
placeholder="搜索产品名称、编码或 SKU"
/>
</div>
<t-cell-group v-if="result.list.length" theme="card">
<t-cell
v-for="item in result.list"
:key="item.id"
class="item"
arrow
v-entrance-transition="{ step: 30 }"
@click="toEdit(item)"
>
<template #left-icon>
<t-image
v-if="getProductPhoto(item)"
:src="getProductPhoto(item)"
:alt="item.product?.name || item.sku?.name || '产品图片'"
fit="cover"
class="avatar"
/>
<product-sku-tags
:product-name="item.product?.name"
:fallback="item.sku?.specSummary || item.sku?.name || '默认 SKU'"
:unit="item.unit?.name"
<div
v-else
class="avatar fallback"
v-text="(item.product?.name || item.sku?.name || '产').slice(0, 1)"
/>
</div>
</template>
</t-cell>
</t-cell-group>
<t-empty v-else :description="isLoading ? '正在加载兑换配置' : '暂无兑换配置'" />
<div class="tips" v-text="isNoMore ? `共 ${result.total} 条配置` : '上拉加载更多'" />
</t-pull-down-refresh>
</main>
</template>
<template #title>
<span class="clip-text" v-text="item.product?.name || item.sku?.name || '未命名产品'" />
</template>
<template #note>
<span class="orange keep-text" v-text="formatPoint(item.defaultPointCost)" />
</template>
<template #description>
<div class="description">
<t-tag
size="small"
:theme="item.status === 'ACTIVE' ? 'success' : 'default'"
:content="statusText(item.status)"
/>
<product-sku-tags
:product-name="item.product?.name"
:fallback="item.sku?.specSummary || item.sku?.name || '默认 SKU'"
:unit="item.unit?.name"
/>
</div>
</template>
</t-cell>
</t-cell-group>
<t-empty v-else :description="isLoading ? '正在加载兑换配置' : '暂无兑换配置'" />
<div class="tips" v-text="isNoMore ? `共 ${result.total} 条配置` : '上拉加载更多'" />
</t-pull-down-refresh>
</template>
<template #detail>
<point-redeem-sku-edit :key="`edit-${selectedId}`" :sku-config-id="selectedId" />
</template>
</master-detail-page>
</div>
</template>
<script setup lang="ts">
import { MasterDetailPage, useMasterDetailPane } from "timi-tdesign-mobile";
import { Toolkit } from "timi-web";
import PointAPI from "@/api/PointAPI";
import PointRedeemSkuEdit from "@/pages/point/PointRedeemSkuEdit.vue";
import ProductSkuTags from "@/components/ProductSkuTags.vue";
import { Message } from "@/utils/message";
import { formatWanInteger } from "@/utils/money";
@@ -101,6 +113,13 @@ import { permissionCodes } from "@/utils/permission";
import type { PointRedeemSku, PointRedeemSkuStatus } from "@/types/Point";
defineOptions({ name: "PointRedeemSkuList" });
// 选中项、编辑态、切换方向、关闭逻辑、转屏、query 同步都在这里;兑换商品没有独立的详情视图,选中即进编辑
const { selectedId, isWide, paneDirection, openDetail } = useMasterDetailPane({
path: "/management/points/redeem-skus",
detail: id => `/management/points/redeem-skus/${id}/edit`
});
const router = useRouter();
const result = reactive({ total: 0, list: [] as PointRedeemSku[] });
const keyword = shallowRef("");
@@ -180,10 +199,8 @@ async function toCreate(): Promise<void> {
await router.push({ name: "PointRedeemSkuCreate" });
}
async function toEdit(item: PointRedeemSku): Promise<void> {
if (item.id) {
await router.push({ name: "PointRedeemSkuEdit", params: { id: item.id } });
}
function toEdit(item: PointRedeemSku): void {
openDetail(item.id || "");
}
onMounted(async () => {
@@ -204,7 +221,7 @@ onUnmounted(() => {
.redeem-sku-list {
gap: 1rem;
display: flex;
padding: var(--app-nav-height) 0 5rem;
padding: var(--tui-nav-height) 0 5rem;
flex-direction: column;