123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451 |
- /**
- * 酒谷小程序模拟数据
- * 模拟后台数据结构,便于未来接口替换
- *
- * 数据来源说明:
- * 1. 轮播图:后台 → 维护 → 开发配置 → 组合数据
- * 2. 商品数据:后台 → 商品 → 商品管理
- * 3. 商品图片:后台 → 维护 → 素材管理
- */
- // ========== 素材管理模拟数据 ==========
- // 模拟后台 → 维护 → 素材管理
- export const MOCK_ASSETS = {
- // 轮播图素材
- banners: {
- 'banner_001': 'https://images.unsplash.com/photo-1470337458703-46ad1756a187?w=750&h=400&fit=crop',
- 'banner_002': 'https://images.unsplash.com/photo-1569529465841-dfecdab7503b?w=750&h=400&fit=crop',
- 'banner_003': 'https://img95.699pic.com/photo/50050/8750.jpg_wh860.jpg',
- 'banner_004': 'https://img95.699pic.com/photo/50050/8750.jpg_wh860.jpg',
- 'banner_005': 'https://img95.699pic.com/photo/50050/8750.jpg_wh860.jpg',
- 'banner_006': 'https://img95.699pic.com/photo/50050/8750.jpg_wh860.jpg'
- },
-
- // 商品图片素材
- products: {
- // 酒谷酒系列
- 'product_jg_001': 'http://www.9998.tv/newUpload_File/image/2022/0901/20220901141427852785.jpg',
- 'product_jg_002': 'http://www.9998.tv/newUpload_File/image/2022/0901/20220901141427852785.jpg',
- 'product_jg_003': 'http://www.9998.tv/newUpload_File/image/2022/0901/20220901141427852785.jpg',
-
- // 茅台酒系列
- 'product_mt_001': 'https://image.suning.cn/uimg/sop/commodity/279989701748433590850500_x.jpg',
- 'product_mt_002': 'https://image.suning.cn/uimg/sop/commodity/279989701748433590850500_x.jpg',
- 'product_mt_003': 'https://image.suning.cn/uimg/sop/commodity/279989701748433590850500_x.jpg',
-
- // 红酒系列
- 'product_wine_001': 'https://img95.699pic.com/photo/50050/8750.jpg_wh860.jpg',
- 'product_wine_002': 'https://img95.699pic.com/photo/50050/8750.jpg_wh860.jpg',
- 'product_wine_003': 'https://img95.699pic.com/photo/50050/8750.jpg_wh860.jpg'
- }
- }
- // ========== 轮播图配置数据 ==========
- // 模拟后台 → 维护 → 开发配置 → 组合数据
- export const MOCK_BANNER_CONFIG = {
- success: true,
- data: {
- banners: [
- {
- id: 'banner_config_001',
- title: '新春特惠酒水节',
- subtitle: '全场酒水满299减50',
- assetId: 'banner_001', // 引用素材库ID
- linkType: 'product', // 跳转类型:product/category/activity/external
- linkTarget: 'product_jg_001', // 跳转目标
- status: 1, // 1-启用 0-禁用
- sort: 1,
- startTime: '2024-01-01 00:00:00',
- endTime: '2024-12-31 23:59:59'
- },
- {
- id: 'banner_config_002',
- title: '茅台精品推荐',
- subtitle: '正品保证,假一赔十',
- assetId: 'banner_002',
- linkType: 'category',
- linkTarget: 'category_maotai',
- status: 1,
- sort: 2,
- startTime: '2024-01-01 00:00:00',
- endTime: '2024-12-31 23:59:59'
- },
- {
- id: 'banner_config_003',
- title: '进口红酒专场',
- subtitle: '品味生活,从一瓶好酒开始',
- assetId: 'banner_003',
- linkType: 'activity',
- linkTarget: 'activity_wine_festival',
- status: 1,
- sort: 3,
- startTime: '2024-01-01 00:00:00',
- endTime: '2024-12-31 23:59:59'
- },
- {
- id: 'banner_config_004',
- title: '限时秒杀专场',
- subtitle: '每日10点开抢,限时优惠',
- assetId: 'banner_004',
- linkType: 'activity',
- linkTarget: 'activity_flash_sale',
- status: 1,
- sort: 4,
- startTime: '2024-01-01 00:00:00',
- endTime: '2024-12-31 23:59:59'
- },
- {
- id: 'banner_config_005',
- title: '会员专享福利',
- subtitle: 'VIP会员专享折扣',
- assetId: 'banner_005',
- linkType: 'activity',
- linkTarget: 'activity_vip_benefits',
- status: 1,
- sort: 5,
- startTime: '2024-01-01 00:00:00',
- endTime: '2024-12-31 23:59:59'
- },
- {
- id: 'banner_config_006',
- title: '新品首发预告',
- subtitle: '酒谷新品即将上市',
- assetId: 'banner_006',
- linkType: 'product',
- linkTarget: 'product_jg_new',
- status: 1,
- sort: 6,
- startTime: '2024-01-01 00:00:00',
- endTime: '2024-12-31 23:59:59'
- }
- ]
- }
- }
- // ========== 商品分类数据 ==========
- // 模拟后台 → 商品 → 分类管理
- export const MOCK_CATEGORIES = {
- success: true,
- data: {
- categories: [
- {
- id: 'category_jiugu',
- name: '酒谷酒',
- sort: 1,
- status: 1,
- description: '自主品牌酒谷系列'
- },
- {
- id: 'category_maotai',
- name: '茅台酒',
- sort: 2,
- status: 1,
- description: '茅台系列白酒'
- },
- {
- id: 'category_wine',
- name: '红酒',
- sort: 3,
- status: 1,
- description: '进口和国产红酒'
- },
- {
- id: 'category_baijiu',
- name: '白酒',
- sort: 4,
- status: 1,
- description: '传统名牌白酒系列'
- }
- ]
- }
- }
- // ========== 商品数据 ==========
- // 模拟后台 → 商品 → 商品管理
- export const MOCK_PRODUCTS = {
- success: true,
- data: {
- products: [
- // 酒谷酒系列
- {
- id: 'product_jg_001',
- name: '酒谷陈酿',
- categoryId: 'category_jiugu',
- assetId: 'product_jg_001', // 引用素材库图片ID
- status: 1, // 1-上架 0-下架
- sort: 1,
- stock: 100,
- sales: 256,
- createTime: '2024-01-01 10:00:00',
- updateTime: '2024-01-15 15:30:00'
- },
- {
- id: 'product_jg_002',
- name: '酒谷特酿',
- categoryId: 'category_jiugu',
- assetId: 'product_jg_002',
- status: 1,
- sort: 2,
- stock: 88,
- sales: 189,
- createTime: '2024-01-02 11:00:00',
- updateTime: '2024-01-16 09:20:00'
- },
- {
- id: 'product_jg_003',
- name: '酒谷珍藏',
- categoryId: 'category_jiugu',
- assetId: 'product_jg_003',
- status: 1,
- sort: 3,
- stock: 45,
- sales: 123,
- createTime: '2024-01-03 14:00:00',
- updateTime: '2024-01-17 16:45:00'
- },
- {
- id: 'product_jg_004',
- name: '酒谷典藏版',
- categoryId: 'category_jiugu',
- assetId: 'product_jg_001',
- status: 1,
- sort: 4,
- stock: 35,
- sales: 89,
- createTime: '2024-01-10 14:00:00',
- updateTime: '2024-01-24 16:45:00'
- },
- {
- id: 'product_jg_005',
- name: '酒谷限量版',
- categoryId: 'category_jiugu',
- assetId: 'product_jg_002',
- status: 1,
- sort: 5,
- stock: 8,
- sales: 45,
- createTime: '2024-01-11 14:00:00',
- updateTime: '2024-01-25 16:45:00'
- },
-
- // 茅台酒系列
- {
- id: 'product_mt_001',
- name: '飞天茅台',
- categoryId: 'category_maotai',
- assetId: 'product_mt_001',
- status: 1,
- sort: 1,
- stock: 20,
- sales: 89,
- createTime: '2024-01-04 09:00:00',
- updateTime: '2024-01-18 11:15:00'
- },
- {
- id: 'product_mt_002',
- name: '五星茅台',
- categoryId: 'category_maotai',
- assetId: 'product_mt_002',
- status: 1,
- sort: 2,
- stock: 15,
- sales: 67,
- createTime: '2024-01-05 13:00:00',
- updateTime: '2024-01-19 10:30:00'
- },
- {
- id: 'product_mt_003',
- name: '茅台王子酒',
- categoryId: 'category_maotai',
- assetId: 'product_mt_003',
- status: 1,
- sort: 3,
- stock: 78,
- sales: 234,
- createTime: '2024-01-06 16:00:00',
- updateTime: '2024-01-20 14:20:00'
- },
- {
- id: 'product_mt_004',
- name: '茅台迎宾酒',
- categoryId: 'category_maotai',
- assetId: 'product_mt_001',
- status: 1,
- sort: 4,
- stock: 120,
- sales: 345,
- createTime: '2024-01-12 16:00:00',
- updateTime: '2024-01-26 14:20:00'
- },
- {
- id: 'product_mt_005',
- name: '茅台1935',
- categoryId: 'category_maotai',
- assetId: 'product_mt_002',
- status: 1,
- sort: 5,
- stock: 12,
- sales: 56,
- createTime: '2024-01-13 16:00:00',
- updateTime: '2024-01-27 14:20:00'
- },
-
- // 红酒系列
- {
- id: 'product_wine_001',
- name: '法国波尔多',
- categoryId: 'category_wine',
- assetId: 'product_wine_001',
- status: 1,
- sort: 1,
- stock: 66,
- sales: 145,
- createTime: '2024-01-07 12:00:00',
- updateTime: '2024-01-21 17:10:00'
- },
- {
- id: 'product_wine_002',
- name: '意大利红酒',
- categoryId: 'category_wine',
- assetId: 'product_wine_002',
- status: 1,
- sort: 2,
- stock: 55,
- sales: 98,
- createTime: '2024-01-08 15:00:00',
- updateTime: '2024-01-22 13:45:00'
- },
- {
- id: 'product_wine_003',
- name: '智利红酒',
- categoryId: 'category_wine',
- assetId: 'product_wine_003',
- status: 1,
- sort: 3,
- stock: 99,
- sales: 167,
- createTime: '2024-01-09 11:00:00',
- updateTime: '2024-01-23 15:55:00'
- },
- {
- id: 'product_wine_004',
- name: '澳洲红酒',
- categoryId: 'category_wine',
- assetId: 'product_wine_001',
- status: 1,
- sort: 4,
- stock: 77,
- sales: 134,
- createTime: '2024-01-14 11:00:00',
- updateTime: '2024-01-28 15:55:00'
- },
- {
- id: 'product_wine_005',
- name: '西班牙红酒',
- categoryId: 'category_wine',
- assetId: 'product_wine_002',
- status: 1,
- sort: 5,
- stock: 43,
- sales: 87,
- createTime: '2024-01-15 11:00:00',
- updateTime: '2024-01-29 15:55:00'
- },
-
- // 白酒系列 (新增分类)
- {
- id: 'product_bj_001',
- name: '五粮液',
- categoryId: 'category_baijiu',
- assetId: 'product_jg_001',
- status: 1,
- sort: 1,
- stock: 45,
- sales: 123,
- createTime: '2024-01-16 11:00:00',
- updateTime: '2024-01-30 15:55:00'
- },
- {
- id: 'product_bj_002',
- name: '剑南春',
- categoryId: 'category_baijiu',
- assetId: 'product_jg_002',
- status: 1,
- sort: 2,
- stock: 67,
- sales: 156,
- createTime: '2024-01-17 11:00:00',
- updateTime: '2024-01-31 15:55:00'
- },
- {
- id: 'product_bj_003',
- name: '泸州老窖',
- categoryId: 'category_baijiu',
- assetId: 'product_jg_003',
- status: 1,
- sort: 3,
- stock: 89,
- sales: 234,
- createTime: '2024-01-18 11:00:00',
- updateTime: '2024-02-01 15:55:00'
- }
- ]
- }
- }
- // ========== 首页数据组合 ==========
- // 模拟后台组合处理后的首页数据结构
- export const MOCK_HOMEPAGE_DATA = {
- success: true,
- message: '数据获取成功',
- data: {
- banners: MOCK_BANNER_CONFIG.data.banners.map(banner => ({
- ...banner,
- imageUrl: MOCK_ASSETS.banners[banner.assetId] // 自动组合素材URL
- })),
-
- categories: MOCK_CATEGORIES.data.categories.map(category => {
- // 获取该分类下的商品
- const categoryProducts = MOCK_PRODUCTS.data.products
- .filter(product => product.categoryId === category.id && product.status === 1)
- .sort((a, b) => a.sort - b.sort)
- .slice(0, 3) // 首页每个分类只显示3个商品
- .map(product => ({
- ...product,
- imageUrl: MOCK_ASSETS.products[product.assetId] // 自动组合素材URL
- }))
-
- return {
- ...category,
- products: categoryProducts
- }
- }).filter(category => category.status === 1)
- }
- }
- /**
- * API 接口路径定义
- * 未来需要替换为真实接口地址
- */
- export const API_ENDPOINTS = {
- // 首页数据
- HOMEPAGE: '/api/homepage/data',
-
- // 轮播图配置
- BANNER_CONFIG: '/api/config/banners',
-
- // 商品相关
- PRODUCTS: '/api/products',
- PRODUCT_DETAIL: '/api/products/:id',
- CATEGORIES: '/api/categories',
-
- // 素材管理
- ASSETS: '/api/assets',
- ASSET_DETAIL: '/api/assets/:id',
-
- // 搜索
- SEARCH: '/api/search',
- SEARCH_SUGGESTIONS: '/api/search/suggestions',
- HOT_SEARCH: '/api/search/hot',
- SEARCH_RECORD: '/api/search/record'
- }
|