1
This commit is contained in:
36
_sql/add_pricing_plans_menu.sql
Normal file
36
_sql/add_pricing_plans_menu.sql
Normal file
@@ -0,0 +1,36 @@
|
||||
-- 在用户管理菜单下添加"价格套餐管理"菜单项
|
||||
-- 参考其他菜单项的配置格式
|
||||
|
||||
INSERT INTO sys_menu (
|
||||
name,
|
||||
parent_id,
|
||||
model_id,
|
||||
form_id,
|
||||
icon,
|
||||
path,
|
||||
component,
|
||||
api_path,
|
||||
is_show_menu,
|
||||
is_show,
|
||||
type,
|
||||
sort,
|
||||
create_time,
|
||||
last_modify_time,
|
||||
is_delete
|
||||
) VALUES (
|
||||
'价格套餐管理', -- 菜单名称
|
||||
120, -- parent_id: 用户管理菜单的ID
|
||||
0, -- model_id
|
||||
0, -- form_id
|
||||
'md-pricetags', -- icon: 价格标签图标
|
||||
'pricing_plans', -- path: 路由路径
|
||||
'system/pricing_plans.vue', -- component: 组件路径(已在 component-map.js 中定义)
|
||||
'system/pricing_plans_server.js', -- api_path: API 服务文件路径
|
||||
1, -- is_show_menu: 1=显示在菜单栏
|
||||
1, -- is_show: 1=启用
|
||||
'页面', -- type: 页面类型
|
||||
3, -- sort: 排序(可根据实际情况调整)
|
||||
NOW(), -- create_time: 创建时间
|
||||
NOW(), -- last_modify_time: 最后修改时间
|
||||
0 -- is_delete: 0=未删除
|
||||
);
|
||||
24
_sql/create_pricing_plans_table.sql
Normal file
24
_sql/create_pricing_plans_table.sql
Normal file
@@ -0,0 +1,24 @@
|
||||
-- 创建价格套餐表
|
||||
-- 用于存储各种价格套餐的配置信息
|
||||
|
||||
CREATE TABLE `pricing_plans` (
|
||||
`id` INT(11) NOT NULL AUTO_INCREMENT COMMENT '价格套餐ID',
|
||||
`name` VARCHAR(100) NOT NULL DEFAULT '' COMMENT '套餐名称(如:体验套餐、月度套餐等)',
|
||||
`duration` VARCHAR(50) NOT NULL DEFAULT '' COMMENT '时长描述(如:7天、30天、永久)',
|
||||
`days` INT(11) NOT NULL DEFAULT 0 COMMENT '天数(-1表示永久,0表示无限制)',
|
||||
`price` DECIMAL(10,2) NOT NULL DEFAULT 0.00 COMMENT '售价(元)',
|
||||
`original_price` DECIMAL(10,2) NULL DEFAULT NULL COMMENT '原价(元),可为空表示无原价',
|
||||
`unit` VARCHAR(20) NOT NULL DEFAULT '元' COMMENT '价格单位',
|
||||
`discount` VARCHAR(50) NULL DEFAULT NULL COMMENT '折扣描述(如:8.3折、超值)',
|
||||
`features` TEXT NOT NULL COMMENT '功能特性列表(JSON字符串数组)',
|
||||
`featured` TINYINT(1) NOT NULL DEFAULT 0 COMMENT '是否为推荐套餐(1=推荐,0=普通)',
|
||||
`is_active` TINYINT(1) NOT NULL DEFAULT 1 COMMENT '是否启用(1=启用,0=禁用)',
|
||||
`sort_order` INT(11) NOT NULL DEFAULT 0 COMMENT '排序顺序(越小越靠前)',
|
||||
`create_time` DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
|
||||
`last_modify_time` DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '最后修改时间',
|
||||
`is_delete` TINYINT(1) NOT NULL DEFAULT 0 COMMENT '是否删除(1=已删除,0=未删除)',
|
||||
PRIMARY KEY (`id`),
|
||||
INDEX `idx_is_active` (`is_active`),
|
||||
INDEX `idx_is_delete` (`is_delete`),
|
||||
INDEX `idx_sort_order` (`sort_order`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='价格套餐表';
|
||||
89
_sql/insert_pricing_plans_data.sql
Normal file
89
_sql/insert_pricing_plans_data.sql
Normal file
@@ -0,0 +1,89 @@
|
||||
-- 插入初始价格套餐数据
|
||||
-- 基于原有前端接口 /config/pricing-plans 中的硬编码数据
|
||||
|
||||
INSERT INTO `pricing_plans` (
|
||||
`name`,
|
||||
`duration`,
|
||||
`days`,
|
||||
`price`,
|
||||
`original_price`,
|
||||
`unit`,
|
||||
`discount`,
|
||||
`features`,
|
||||
`featured`,
|
||||
`is_active`,
|
||||
`sort_order`,
|
||||
`create_time`,
|
||||
`last_modify_time`,
|
||||
`is_delete`
|
||||
) VALUES
|
||||
(
|
||||
'体验套餐',
|
||||
'7天',
|
||||
7,
|
||||
28.00,
|
||||
28.00,
|
||||
'元',
|
||||
NULL,
|
||||
'["7天使用权限", "全功能体验", "技术支持"]',
|
||||
0,
|
||||
1,
|
||||
1,
|
||||
NOW(),
|
||||
NOW(),
|
||||
0
|
||||
),
|
||||
(
|
||||
'月度套餐',
|
||||
'30天',
|
||||
30,
|
||||
99.00,
|
||||
120.00,
|
||||
'元',
|
||||
'约8.3折',
|
||||
'["30天使用权限", "全功能使用", "优先技术支持", "性价比最高"]',
|
||||
1,
|
||||
1,
|
||||
2,
|
||||
NOW(),
|
||||
NOW(),
|
||||
0
|
||||
),
|
||||
(
|
||||
'季度套餐',
|
||||
'90天',
|
||||
90,
|
||||
269.00,
|
||||
360.00,
|
||||
'元',
|
||||
'7.5折',
|
||||
'["90天使用权限", "全功能使用", "优先技术支持", "更优惠价格"]',
|
||||
0,
|
||||
1,
|
||||
3,
|
||||
NOW(),
|
||||
NOW(),
|
||||
0
|
||||
),
|
||||
(
|
||||
'终生套餐',
|
||||
'永久',
|
||||
-1,
|
||||
888.00,
|
||||
NULL,
|
||||
'元',
|
||||
'超值',
|
||||
'["永久使用权限", "全功能使用", "终身技术支持", "一次购买,终身使用", "最划算选择"]',
|
||||
0,
|
||||
1,
|
||||
4,
|
||||
NOW(),
|
||||
NOW(),
|
||||
0
|
||||
);
|
||||
|
||||
-- 查询验证插入结果
|
||||
SELECT id, name, duration, price, original_price, featured, is_active, sort_order
|
||||
FROM pricing_plans
|
||||
WHERE is_delete = 0
|
||||
ORDER BY sort_order ASC;
|
||||
Reference in New Issue
Block a user