Compare commits

...

2 Commits

Author SHA1 Message Date
xiaomai
d151bd78ca refactor(config): simplify service definitions with factory functions
Refactored the service configuration to reduce code duplication and separate data from logic.

- Created a shared `useWhatsappMsgSender` composable to handle WhatsApp URL generation and opening.
- Introduced `createService` and `createPlan` helper functions to programmatically add button actions.
- This eliminates the need to manually define `onClick` handlers for every pricing plan, making the service data purely declarative and easier to maintain.
2025-10-22 09:10:47 +08:00
xiaomai
20f1775eaf refactor(pricing): extract web development services to a config file
Moved all web development service and pricing plan data from `web-design/index.vue` to a new `config/web-dev-services.ts` file.

- Centralizes service definitions for easier maintenance and scalability.
- Simplifies the `web-design` page by making it data-driven.
- Replaces static links with dynamic `onClick` handlers that generate a pre-filled WhatsApp message for inquiries.
2025-10-21 17:27:07 +08:00
3 changed files with 272 additions and 147 deletions

View File

@@ -0,0 +1,18 @@
import { createSharedComposable } from "@vueuse/core";
const _useWhatsappMsgSender = () => {
// --- WhatsApp 自动消息逻辑 ---
const sendMessage = (message: string) => {
const text = encodeURIComponent(message);
const url = `https://api.whatsapp.com/send?phone=+601157753558&text=${text}`;
window.open(url, "_blank");
};
return {
sendMessage,
};
};
export const useWhatsappMsgSender = createSharedComposable(
_useWhatsappMsgSender
);

View File

@@ -0,0 +1,235 @@
import type { TabsItem, PricingPlanProps } from "@nuxt/ui";
interface Service extends TabsItem {
plans: PricingPlanProps[];
}
const { sendMessage } = useWhatsappMsgSender();
function generateWhatsAppMessage(
service: string,
plan: PricingPlanProps
): string {
const featureList = plan.features?.slice(0, 3).join("、");
return `您好!我对您的【${service}】服务中的【${plan.title}】方案感兴趣。
方案详情:
💰 价格:${plan.price}
📋 描述:${plan.description}
✨ 主要功能:${featureList}${
plan.features?.length ?? 0 > 3 ? `${plan.features?.length}项功能` : ""
}
请提供更多详细信息,谢谢!`;
}
// --- 通用创建函数 ---
function createPlan(service: string, plan: PricingPlanProps): PricingPlanProps {
return {
...plan,
button: {
label: plan.button?.label || "立即咨询",
onClick: () => sendMessage(generateWhatsAppMessage(service, plan)),
},
};
}
function createService(service: Service): Service {
const serviceName = service.label ? service.label : "网页网站开发";
return {
...service,
plans: service.plans.map((p) => createPlan(serviceName, p)),
};
}
// --- 数据配置(纯数据) ---
export const services: Service[] = [
createService({
id: "landing-page",
label: "Landing Page",
icon: "lucide:mouse-pointer-click",
plans: [
{
title: "基础版",
description: "适合个人、小型商家,快速上线单页展示网站。",
price: "RM499 起",
tagline: "含域名与服务器",
features: [
"单页面结构1-3 屏)",
"响应式设计(手机 / 平板 / 桌面)",
"基本图文排版",
"联系表单或 WhatsApp 按钮",
"Google Analytics 整合",
"1 次免费修改",
"7 日内交付",
],
},
{
title: "标准版",
description: "为品牌与创业项目打造高转化页面。",
price: "RM1,499 起",
tagline: "含域名与服务器",
highlight: true,
features: [
"多区块结构4-6 屏)",
"品牌定制风格与配色",
"轻量动画与动效展示",
"SEO 优化 + 加载性能优化",
"整合追踪代码GA / Pixel",
"2 次免费修改",
"14 日内交付",
],
button: { label: "预约报价" },
},
{
title: "高级定制",
description: "为成熟品牌提供全面视觉与营销升级方案。",
price: "RM2,999 起",
features: [
"专属视觉设计与交互体验",
"完整品牌风格系统",
"A/B 测试与转化优化",
"营销工具整合邮件、统计、CRM",
"多语言 / 动态内容支持",
],
button: { label: "预约定制方案" },
},
],
}),
createService({
id: "official-web",
label: "Official Website",
icon: "lucide:globe",
plans: [
{
title: "基础官网",
description: "为中小型企业建立专业在线形象。",
price: "RM4,999 起",
tagline: "含域名与服务器",
features: [
"最多 5 个页面(首页、关于、服务、联系等)",
"响应式设计(桌面 / 平板 / 手机)",
"基础 SEO 设置",
"联系表单 + 地图 + 社交媒体链接",
],
},
{
title: "标准官网",
description: "适合品牌升级与内容扩展型企业。",
price: "RM8,999 起",
tagline: "含域名与服务器",
highlight: true,
features: [
"约 8-12 个页面(案例、博客、团队等)",
"品牌定制风格 + UI/UX 优化",
"轻量 CMS 后台管理系统",
"进阶 SEO 优化与性能加速",
],
button: { label: "预约标准方案" },
},
{
title: "企业定制",
description: "专属视觉、功能与交互体验整合。",
price: "RM15,000 起",
features: [
"完全定制 UI / 动效设计",
"多语言支持 / 客户登录模块",
"API / 第三方系统整合",
"增强安全与自动备份机制",
],
button: { label: "预约企业方案" },
},
],
}),
createService({
id: "web-tools",
label: "Web 工具 / 内部系统",
icon: "lucide:cpu",
plans: [
{
title: "自动化工具开发",
description: "简化工作流程,提升效率的内部工具。",
price: "RM3,000 起",
features: [
"定制化前端逻辑与交互",
"数据处理 / 报表系统",
"轻量 API 与后端支持",
"导出功能Excel / CSV / PDF",
],
button: { label: "提交需求" },
},
{
title: "Web App 项目",
description: "打造实用、可持续扩展的轻量 Web 应用。",
price: "RM5,000 起",
highlight: true,
features: [
"完整 SPA 结构Vue / Nuxt",
"用户系统 / 登录 / 权限控制",
"API 整合与动态数据展示",
],
button: { label: "预约开发" },
},
{
title: "企业系统方案",
description: "大型模块化系统或跨平台整合项目。",
price: "RM20,000+",
features: [
"多模块架构CMS / ERP / Dashboard",
"API、数据库与外部服务整合",
"专属后端与数据安全机制",
],
button: { label: "申请合作" },
},
],
}),
createService({
id: "game-dev",
label: "游戏展示 / 交互项目",
icon: "lucide:gamepad-2",
plans: [
{
title: "展示页",
description: "专为游戏作品打造的宣传与展示网站。",
price: "RM1,999 起",
tagline: "含域名与服务器",
highlight: true,
features: [
"游戏介绍与截图展示区",
"视频 / 预告片嵌入",
"交互式 Canvas 动画或 WebGL 特效",
],
button: { label: "预约展示开发" },
},
{
title: "互动式 Demo",
description: "用于作品集、游戏原型或活动宣传。",
price: "RM3,999 起",
features: [
"玩家交互逻辑Canvas / WebGL / Three.js",
"音效与动画系统整合",
"数据记录或排行榜系统",
],
button: { label: "提交项目需求" },
},
{
title: "完整游戏项目",
description: "定制游戏系统开发与跨平台发布。",
price: "价格面议",
features: [
"多人协作开发",
"完整引擎与关卡系统",
"发布至多平台Web / 桌面 / 移动)",
],
button: { label: "咨询游戏项目" },
},
],
}),
];
// --- 全局备注 ---
export const note =
"所有方案均含基础域名与服务器部署(首年)。若服务器负载过高,将协助迁移至更稳定的第三方环境。";

View File

@@ -1,154 +1,26 @@
<template> <template>
<div>
<UContainer> <UContainer>
<UTabs :items="servicesProvided"> <UPageHero
<template #landing-page> title="客制化网站设计"
<UPricingPlans :plans="landingPagePlans" /> description="为您的品牌量身定做一套线上门户,增加产品曝光率与转化率。"
</template> />
<template #official-web> <p class="text-muted py-4 text-center">{{ note }}</p>
<UPricingPlans :plans="officialWebsitePlans" />
<UTabs :items="tabItems">
<template v-for="service in services" :key="service.id" #[service.id]>
<UPricingPlans :plans="service.plans" />
</template> </template>
</UTabs> </UTabs>
</UContainer> </UContainer>
</div>
</template> </template>
<script lang="ts" setup> <script lang="ts" setup>
const servicesProvided = [ import { services, note } from "~/config/web-dev-services";
{
label: "Landing Page",
icon: "lucide:mouse-pointer-click",
slot: "landing-page",
},
{
label: "Official Web",
icon: "lucide:globe",
slot: "official-web",
},
];
const landingPagePlans = ref([ const tabItems = services.map((s) => ({
{ label: s.label,
title: "基础版 Landing Page", icon: s.icon,
description: "适合个人、小型商家,快速上线单页网站。", slot: s.id,
price: "RM499 起", }));
features: [
"单页面结构13 屏)",
"响应式设计(手机/平板/桌面)",
"基本图文排版",
"联系表单或 WhatsApp 按钮",
"Google Analytics 整合",
"1 次免费修改",
"7 日内交付",
],
button: {
label: "立即咨询",
href: "/contact",
},
},
{
title: "标准版 Landing Page",
description: "适合中小企业与创业团队,提升品牌形象与转化率。",
price: "RM1,499 起",
features: [
"自定义设计风格与品牌配色",
"多区块结构46 屏)",
"文案优化与视觉建议",
"基础 SEO 与性能优化",
"Facebook Pixel / GA 追踪整合",
"基础动画与动效展示",
"2 次免费修改",
"14 日内交付",
],
featured: true,
button: {
label: "预约报价",
href: "/quote",
},
},
{
title: "高定版 Landing Page",
description: "为成熟品牌量身打造高转化率页面,强化视觉冲击与数据转化。",
price: "RM3,000+",
features: [
"完全定制设计与交互效果",
"品牌策略与信息架构规划",
"A/B 测试与用户体验优化",
"高级 SEO / 性能与加载优化",
"营销工具整合邮件、CRM、自动化",
"多语言或动态内容支持",
"后期维护与数据报告",
"项目顾问全程支持",
],
button: {
label: "申请合作",
href: "/consult",
},
},
]);
const officialWebsitePlans = ref([
{
title: "官方网站 · 基础版",
description: "适合小型公司、工作室或创业品牌,建立专业在线形象。",
price: "RM5,000 起",
features: [
"最多 5 个页面(首页、关于、服务、联系等)",
"响应式设计(手机 / 平板 / 桌面)",
"基本 SEO 设置(标题、描述、关键词)",
"联系表单 + 地图 + 社交媒体链接",
"客户提供图片与文字内容",
"1 次免费修改",
"基础性能与加载优化",
],
button: {
label: "获取报价",
href: "/contact",
},
},
{
title: "官方网站 · 标准版",
description: "适合中小企业,强化品牌形象与转化效果。",
price: "RM12,000 起",
features: [
"约 812 个页面(首页、关于、团队、服务、案例、博客、联系等)",
"品牌定制设计风格 + UI/UX 优化",
"响应式与性能优化,兼容多设备",
"内容撰写与素材协助(客户与设计师协作)",
"可自主管理的后台系统CMS",
"进阶 SEO 优化(结构、速度、关键词)",
"互动功能(表单、预约、客户登录、多语言)",
"23 次免费修改",
"项目交付后 36 个月技术支持与维护",
],
featured: true,
button: {
label: "预约标准方案",
href: "/quote",
},
},
{
title: "官方网站 · 高定版",
description: "为成熟品牌量身打造高转化、高性能、高颜值的专属官网。",
price: "RM25,000 起",
features: [
"完全定制视觉与交互设计(含动画与动效)",
"品牌策略与信息架构规划",
"多语言 / 会员系统 / 客户登录 / 支付整合",
"整合外部 API、CRM、ERP、自动化系统",
"大型内容库 / 媒体管理 / 定制图像与视频",
"高级 SEO + 转化率优化(含 A/B 测试)",
"1 年内持续维护、安全与内容更新",
"企业级安全与备份机制",
"专属项目经理全程对接",
],
button: {
label: "申请高定方案",
href: "/consult",
},
},
]);
</script> </script>
<style></style>