UNPKG

vibe-cli-tool

Version:

VibeCLI v1.9 - 模板商店生态,智能部署生成,多语言支持,交互式学习系统,企业级Web全栈应用CLI工具

37 lines (32 loc) 991 B
import { type ClassValue, clsx } from "clsx" import { twMerge } from "tailwind-merge" export function cn(...inputs: ClassValue[]) { return twMerge(clsx(inputs)) } // 格式化价格 export function formatPrice(price: number): string { return new Intl.NumberFormat('zh-CN', { style: 'currency', currency: 'CNY', }).format(price) } // 生成订单号 export function generateOrderNumber(): string { const timestamp = Date.now().toString() const random = Math.random().toString(36).substring(2, 8).toUpperCase() return `ORD${timestamp}${random}` } // 格式化日期 export function formatDate(date: Date): string { return new Intl.DateTimeFormat('zh-CN', { year: 'numeric', month: '2-digit', day: '2-digit', hour: '2-digit', minute: '2-digit', }).format(date) } // 计算折扣百分比 export function calculateDiscountPercentage(original: number, discounted: number): number { return Math.round(((original - discounted) / original) * 100) }