Files
gaoYuJournal/miniprogram/types/Travel.ts
2025-12-23 14:27:51 +08:00

188 lines
4.2 KiB
TypeScript
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

import { Attachment } from "./Attachment";
import { Model, QueryPage } from "./Model";
import { MediaItem } from "./UI";
/** 交通类型 */
export enum TransportationType {
PLANE = "PLANE",
TRAIN = "TRAIN",
CAR = "CAR",
SHIP = "SHIP",
SELF_DRIVING = "SELF_DRIVING",
OTHER = "OTHER"
}
/** 交通类型中文映射 */
export const TransportationTypeLabel: Record<TransportationType, string> = {
[TransportationType.PLANE]: "飞机",
[TransportationType.TRAIN]: "火车",
[TransportationType.CAR]: "汽车",
[TransportationType.SHIP]: "轮船",
[TransportationType.SELF_DRIVING]: "自驾",
[TransportationType.OTHER]: "其他"
};
/** 交通类型图标映射 */
export const TransportationTypeIcon: Record<TransportationType, string> = {
[TransportationType.PLANE]: "flight-takeoff",
[TransportationType.TRAIN]: "map-route",
[TransportationType.CAR]: "vehicle",
[TransportationType.SHIP]: "anchor",
[TransportationType.SELF_DRIVING]: "vehicle",
[TransportationType.OTHER]: "compass"
};
/** 出行状态 */
export enum TravelStatus {
PLANNING = "PLANNING",
ONGOING = "ONGOING",
COMPLETED = "COMPLETED"
}
/** 出行状态中文映射 */
export const TravelStatusLabel: Record<TravelStatus, string> = {
[TravelStatus.PLANNING]: "计划中",
[TravelStatus.ONGOING]: "进行中",
[TravelStatus.COMPLETED]: "已完成"
};
/** 出行状态图标映射 */
export const TravelStatusIcon: Record<TravelStatus, string> = {
[TravelStatus.PLANNING]: "calendar",
[TravelStatus.ONGOING]: "play-circle",
[TravelStatus.COMPLETED]: "check-circle"
};
/** 出行计划实体 */
export interface Travel extends Model {
/** 交通类型 */
transportationType?: TransportationType;
/** 标题 */
title?: string;
/** 内容 */
content?: string;
/** 出行时间戳 */
travelAt?: number | null;
/** 天数 */
days?: number | null;
/** 状态 */
status?: TravelStatus;
/** 格式化的出行日期 */
travelDate?: string;
/** 格式化的出行时间 */
travelTime?: string;
}
/** 出行分页查询 */
export interface TravelPage extends QueryPage {
/** 条件过滤 */
equalsExample?: {
status?: TravelStatus;
};
}
/** 地点类型 */
export enum TravelLocationType {
FOOD = "FOOD",
HOTEL = "HOTEL",
TRANSPORT = "TRANSPORT",
ATTRACTION = "ATTRACTION",
MALL = "MALL",
SHOPPING = "SHOPPING",
PLAY = "PLAY",
LIFE = "LIFE"
}
/** 地点类型中文映射 */
export const TravelLocationTypeLabel: Record<TravelLocationType, string> = {
[TravelLocationType.FOOD]: "美食",
[TravelLocationType.HOTEL]: "酒店",
[TravelLocationType.TRANSPORT]: "交通",
[TravelLocationType.ATTRACTION]: "景点",
[TravelLocationType.MALL]: "商场",
[TravelLocationType.SHOPPING]: "购物",
[TravelLocationType.PLAY]: "玩乐",
[TravelLocationType.LIFE]: "生活"
};
/** 地点类型图标映射 */
export const TravelLocationTypeIcon: Record<TravelLocationType, string> = {
[TravelLocationType.FOOD]: "chicken",
[TravelLocationType.HOTEL]: "city-8",
[TravelLocationType.TRANSPORT]: "map-route-planning",
[TravelLocationType.ATTRACTION]: "image-1",
[TravelLocationType.MALL]: "chart-3d",
[TravelLocationType.SHOPPING]: "shop",
[TravelLocationType.PLAY]: "ferris-wheel",
[TravelLocationType.LIFE]: "location"
};
/** 出行地点实体 */
export interface TravelLocation extends Model {
/** 关联的出行计划 ID */
travelId?: number;
/** 地点类型 */
type?: TravelLocationType;
/** 标题 */
title?: string;
/** 说明 */
description?: string;
/** 纬度 */
lat?: number;
/** 经度 */
lng?: number;
/** 位置描述 */
location?: string;
/** 费用 */
amount?: number;
/** 是否需要身份证 */
requireIdCard?: boolean;
/** 是否需要预约 */
requireAppointment?: boolean;
/** 评分 */
score?: number | null;
/** 重要程度 */
importance?: number | null;
/** 附件 */
items?: Attachment[];
/** 保留的附件 ID 列表(更新时使用) */
attachmentIds?: number[];
/** 临时文件 ID 列表(创建/更新时上传附件用) */
tempFileIds?: string[];
// ---------- 视图属性 ----------
/** 类型标签 */
typeLabel?: string;
/** 类型图标 */
typeIcon?: string;
/** 分列后的 items用于瀑布流展示 */
columnedItems?: MediaItem[][];
/** 媒体项(由附件转) */
mediaItems?: MediaItem[];
}