support tablet
This commit is contained in:
@@ -1,13 +1,13 @@
|
||||
<template>
|
||||
<div class="page-layout navbar">
|
||||
<div class="tui-page-layout tui-navbar">
|
||||
<t-navbar
|
||||
fixed
|
||||
:z-index="20"
|
||||
title="兑换详情"
|
||||
left-arrow
|
||||
@left-click="$router.back()"
|
||||
@left-click="goBack"
|
||||
/>
|
||||
<main class="page-content scroll column">
|
||||
<main class="tui-page-content scroll column">
|
||||
<div v-can="permissionCodes.pointRedemption.create" class="redemption-detail">
|
||||
<customer-profile-card
|
||||
v-if="customer"
|
||||
@@ -80,7 +80,7 @@
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import { BottomPopup } from "timi-tdesign-mobile";
|
||||
import { BottomPopup, useExpandToMaster, usePane } from "timi-tdesign-mobile";
|
||||
import { useUserStore } from "timi-web-api";
|
||||
import CustomerAPI from "@/api/CustomerAPI";
|
||||
import PointAPI from "@/api/PointAPI";
|
||||
@@ -99,7 +99,37 @@ import { permissionCodes } from "@/utils/permission";
|
||||
|
||||
defineOptions({ name: "PointRedemptionDetail" });
|
||||
|
||||
const props = withDefaults(defineProps<{
|
||||
/** 指定 ID 时忽略路由参数,用于平板主从分栏的内联渲染。 */
|
||||
redemptionId?: string;
|
||||
}>(), {
|
||||
redemptionId: ""
|
||||
});
|
||||
|
||||
const route = useRoute();
|
||||
const router = useRouter();
|
||||
|
||||
function resolveId(): string {
|
||||
return props.redemptionId || String(route.params.id || "");
|
||||
}
|
||||
|
||||
// 竖屏整页进来后转成横屏:回到列表页并恢复右栏选中,而不是继续停在整页详情
|
||||
useExpandToMaster({
|
||||
path: "/management/points/redemptions",
|
||||
id: () => resolveId()
|
||||
});
|
||||
/** 非空说明当前被内联在主从分栏的右栏里 */
|
||||
const pane = usePane();
|
||||
|
||||
function goBack(): void {
|
||||
if (pane) {
|
||||
pane.close();
|
||||
return;
|
||||
}
|
||||
|
||||
void router.back();
|
||||
}
|
||||
|
||||
const userStore = useUserStore();
|
||||
const item = ref<PointRedemption>();
|
||||
const customer = ref<Customer>();
|
||||
@@ -132,7 +162,7 @@ function remaining(): string {
|
||||
}
|
||||
|
||||
async function load(): Promise<void> {
|
||||
const id = String(route.params.id || "");
|
||||
const id = resolveId();
|
||||
if (!id) {
|
||||
return;
|
||||
}
|
||||
@@ -223,6 +253,7 @@ function timeText(value?: number): string {
|
||||
}
|
||||
|
||||
onMounted(load);
|
||||
watch(() => [props.redemptionId, route.params.id], load);
|
||||
</script>
|
||||
|
||||
<style scoped lang="less">
|
||||
|
||||
Reference in New Issue
Block a user