mockData.js 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451
  1. /**
  2. * 酒谷小程序模拟数据
  3. * 模拟后台数据结构,便于未来接口替换
  4. *
  5. * 数据来源说明:
  6. * 1. 轮播图:后台 → 维护 → 开发配置 → 组合数据
  7. * 2. 商品数据:后台 → 商品 → 商品管理
  8. * 3. 商品图片:后台 → 维护 → 素材管理
  9. */
  10. // ========== 素材管理模拟数据 ==========
  11. // 模拟后台 → 维护 → 素材管理
  12. export const MOCK_ASSETS = {
  13. // 轮播图素材
  14. banners: {
  15. 'banner_001': 'https://images.unsplash.com/photo-1470337458703-46ad1756a187?w=750&h=400&fit=crop',
  16. 'banner_002': 'https://images.unsplash.com/photo-1569529465841-dfecdab7503b?w=750&h=400&fit=crop',
  17. 'banner_003': 'https://img95.699pic.com/photo/50050/8750.jpg_wh860.jpg',
  18. 'banner_004': 'https://img95.699pic.com/photo/50050/8750.jpg_wh860.jpg',
  19. 'banner_005': 'https://img95.699pic.com/photo/50050/8750.jpg_wh860.jpg',
  20. 'banner_006': 'https://img95.699pic.com/photo/50050/8750.jpg_wh860.jpg'
  21. },
  22. // 商品图片素材
  23. products: {
  24. // 酒谷酒系列
  25. 'product_jg_001': 'http://www.9998.tv/newUpload_File/image/2022/0901/20220901141427852785.jpg',
  26. 'product_jg_002': 'http://www.9998.tv/newUpload_File/image/2022/0901/20220901141427852785.jpg',
  27. 'product_jg_003': 'http://www.9998.tv/newUpload_File/image/2022/0901/20220901141427852785.jpg',
  28. // 茅台酒系列
  29. 'product_mt_001': 'https://image.suning.cn/uimg/sop/commodity/279989701748433590850500_x.jpg',
  30. 'product_mt_002': 'https://image.suning.cn/uimg/sop/commodity/279989701748433590850500_x.jpg',
  31. 'product_mt_003': 'https://image.suning.cn/uimg/sop/commodity/279989701748433590850500_x.jpg',
  32. // 红酒系列
  33. 'product_wine_001': 'https://img95.699pic.com/photo/50050/8750.jpg_wh860.jpg',
  34. 'product_wine_002': 'https://img95.699pic.com/photo/50050/8750.jpg_wh860.jpg',
  35. 'product_wine_003': 'https://img95.699pic.com/photo/50050/8750.jpg_wh860.jpg'
  36. }
  37. }
  38. // ========== 轮播图配置数据 ==========
  39. // 模拟后台 → 维护 → 开发配置 → 组合数据
  40. export const MOCK_BANNER_CONFIG = {
  41. success: true,
  42. data: {
  43. banners: [
  44. {
  45. id: 'banner_config_001',
  46. title: '新春特惠酒水节',
  47. subtitle: '全场酒水满299减50',
  48. assetId: 'banner_001', // 引用素材库ID
  49. linkType: 'product', // 跳转类型:product/category/activity/external
  50. linkTarget: 'product_jg_001', // 跳转目标
  51. status: 1, // 1-启用 0-禁用
  52. sort: 1,
  53. startTime: '2024-01-01 00:00:00',
  54. endTime: '2024-12-31 23:59:59'
  55. },
  56. {
  57. id: 'banner_config_002',
  58. title: '茅台精品推荐',
  59. subtitle: '正品保证,假一赔十',
  60. assetId: 'banner_002',
  61. linkType: 'category',
  62. linkTarget: 'category_maotai',
  63. status: 1,
  64. sort: 2,
  65. startTime: '2024-01-01 00:00:00',
  66. endTime: '2024-12-31 23:59:59'
  67. },
  68. {
  69. id: 'banner_config_003',
  70. title: '进口红酒专场',
  71. subtitle: '品味生活,从一瓶好酒开始',
  72. assetId: 'banner_003',
  73. linkType: 'activity',
  74. linkTarget: 'activity_wine_festival',
  75. status: 1,
  76. sort: 3,
  77. startTime: '2024-01-01 00:00:00',
  78. endTime: '2024-12-31 23:59:59'
  79. },
  80. {
  81. id: 'banner_config_004',
  82. title: '限时秒杀专场',
  83. subtitle: '每日10点开抢,限时优惠',
  84. assetId: 'banner_004',
  85. linkType: 'activity',
  86. linkTarget: 'activity_flash_sale',
  87. status: 1,
  88. sort: 4,
  89. startTime: '2024-01-01 00:00:00',
  90. endTime: '2024-12-31 23:59:59'
  91. },
  92. {
  93. id: 'banner_config_005',
  94. title: '会员专享福利',
  95. subtitle: 'VIP会员专享折扣',
  96. assetId: 'banner_005',
  97. linkType: 'activity',
  98. linkTarget: 'activity_vip_benefits',
  99. status: 1,
  100. sort: 5,
  101. startTime: '2024-01-01 00:00:00',
  102. endTime: '2024-12-31 23:59:59'
  103. },
  104. {
  105. id: 'banner_config_006',
  106. title: '新品首发预告',
  107. subtitle: '酒谷新品即将上市',
  108. assetId: 'banner_006',
  109. linkType: 'product',
  110. linkTarget: 'product_jg_new',
  111. status: 1,
  112. sort: 6,
  113. startTime: '2024-01-01 00:00:00',
  114. endTime: '2024-12-31 23:59:59'
  115. }
  116. ]
  117. }
  118. }
  119. // ========== 商品分类数据 ==========
  120. // 模拟后台 → 商品 → 分类管理
  121. export const MOCK_CATEGORIES = {
  122. success: true,
  123. data: {
  124. categories: [
  125. {
  126. id: 'category_jiugu',
  127. name: '酒谷酒',
  128. sort: 1,
  129. status: 1,
  130. description: '自主品牌酒谷系列'
  131. },
  132. {
  133. id: 'category_maotai',
  134. name: '茅台酒',
  135. sort: 2,
  136. status: 1,
  137. description: '茅台系列白酒'
  138. },
  139. {
  140. id: 'category_wine',
  141. name: '红酒',
  142. sort: 3,
  143. status: 1,
  144. description: '进口和国产红酒'
  145. },
  146. {
  147. id: 'category_baijiu',
  148. name: '白酒',
  149. sort: 4,
  150. status: 1,
  151. description: '传统名牌白酒系列'
  152. }
  153. ]
  154. }
  155. }
  156. // ========== 商品数据 ==========
  157. // 模拟后台 → 商品 → 商品管理
  158. export const MOCK_PRODUCTS = {
  159. success: true,
  160. data: {
  161. products: [
  162. // 酒谷酒系列
  163. {
  164. id: 'product_jg_001',
  165. name: '酒谷陈酿',
  166. categoryId: 'category_jiugu',
  167. assetId: 'product_jg_001', // 引用素材库图片ID
  168. status: 1, // 1-上架 0-下架
  169. sort: 1,
  170. stock: 100,
  171. sales: 256,
  172. createTime: '2024-01-01 10:00:00',
  173. updateTime: '2024-01-15 15:30:00'
  174. },
  175. {
  176. id: 'product_jg_002',
  177. name: '酒谷特酿',
  178. categoryId: 'category_jiugu',
  179. assetId: 'product_jg_002',
  180. status: 1,
  181. sort: 2,
  182. stock: 88,
  183. sales: 189,
  184. createTime: '2024-01-02 11:00:00',
  185. updateTime: '2024-01-16 09:20:00'
  186. },
  187. {
  188. id: 'product_jg_003',
  189. name: '酒谷珍藏',
  190. categoryId: 'category_jiugu',
  191. assetId: 'product_jg_003',
  192. status: 1,
  193. sort: 3,
  194. stock: 45,
  195. sales: 123,
  196. createTime: '2024-01-03 14:00:00',
  197. updateTime: '2024-01-17 16:45:00'
  198. },
  199. {
  200. id: 'product_jg_004',
  201. name: '酒谷典藏版',
  202. categoryId: 'category_jiugu',
  203. assetId: 'product_jg_001',
  204. status: 1,
  205. sort: 4,
  206. stock: 35,
  207. sales: 89,
  208. createTime: '2024-01-10 14:00:00',
  209. updateTime: '2024-01-24 16:45:00'
  210. },
  211. {
  212. id: 'product_jg_005',
  213. name: '酒谷限量版',
  214. categoryId: 'category_jiugu',
  215. assetId: 'product_jg_002',
  216. status: 1,
  217. sort: 5,
  218. stock: 8,
  219. sales: 45,
  220. createTime: '2024-01-11 14:00:00',
  221. updateTime: '2024-01-25 16:45:00'
  222. },
  223. // 茅台酒系列
  224. {
  225. id: 'product_mt_001',
  226. name: '飞天茅台',
  227. categoryId: 'category_maotai',
  228. assetId: 'product_mt_001',
  229. status: 1,
  230. sort: 1,
  231. stock: 20,
  232. sales: 89,
  233. createTime: '2024-01-04 09:00:00',
  234. updateTime: '2024-01-18 11:15:00'
  235. },
  236. {
  237. id: 'product_mt_002',
  238. name: '五星茅台',
  239. categoryId: 'category_maotai',
  240. assetId: 'product_mt_002',
  241. status: 1,
  242. sort: 2,
  243. stock: 15,
  244. sales: 67,
  245. createTime: '2024-01-05 13:00:00',
  246. updateTime: '2024-01-19 10:30:00'
  247. },
  248. {
  249. id: 'product_mt_003',
  250. name: '茅台王子酒',
  251. categoryId: 'category_maotai',
  252. assetId: 'product_mt_003',
  253. status: 1,
  254. sort: 3,
  255. stock: 78,
  256. sales: 234,
  257. createTime: '2024-01-06 16:00:00',
  258. updateTime: '2024-01-20 14:20:00'
  259. },
  260. {
  261. id: 'product_mt_004',
  262. name: '茅台迎宾酒',
  263. categoryId: 'category_maotai',
  264. assetId: 'product_mt_001',
  265. status: 1,
  266. sort: 4,
  267. stock: 120,
  268. sales: 345,
  269. createTime: '2024-01-12 16:00:00',
  270. updateTime: '2024-01-26 14:20:00'
  271. },
  272. {
  273. id: 'product_mt_005',
  274. name: '茅台1935',
  275. categoryId: 'category_maotai',
  276. assetId: 'product_mt_002',
  277. status: 1,
  278. sort: 5,
  279. stock: 12,
  280. sales: 56,
  281. createTime: '2024-01-13 16:00:00',
  282. updateTime: '2024-01-27 14:20:00'
  283. },
  284. // 红酒系列
  285. {
  286. id: 'product_wine_001',
  287. name: '法国波尔多',
  288. categoryId: 'category_wine',
  289. assetId: 'product_wine_001',
  290. status: 1,
  291. sort: 1,
  292. stock: 66,
  293. sales: 145,
  294. createTime: '2024-01-07 12:00:00',
  295. updateTime: '2024-01-21 17:10:00'
  296. },
  297. {
  298. id: 'product_wine_002',
  299. name: '意大利红酒',
  300. categoryId: 'category_wine',
  301. assetId: 'product_wine_002',
  302. status: 1,
  303. sort: 2,
  304. stock: 55,
  305. sales: 98,
  306. createTime: '2024-01-08 15:00:00',
  307. updateTime: '2024-01-22 13:45:00'
  308. },
  309. {
  310. id: 'product_wine_003',
  311. name: '智利红酒',
  312. categoryId: 'category_wine',
  313. assetId: 'product_wine_003',
  314. status: 1,
  315. sort: 3,
  316. stock: 99,
  317. sales: 167,
  318. createTime: '2024-01-09 11:00:00',
  319. updateTime: '2024-01-23 15:55:00'
  320. },
  321. {
  322. id: 'product_wine_004',
  323. name: '澳洲红酒',
  324. categoryId: 'category_wine',
  325. assetId: 'product_wine_001',
  326. status: 1,
  327. sort: 4,
  328. stock: 77,
  329. sales: 134,
  330. createTime: '2024-01-14 11:00:00',
  331. updateTime: '2024-01-28 15:55:00'
  332. },
  333. {
  334. id: 'product_wine_005',
  335. name: '西班牙红酒',
  336. categoryId: 'category_wine',
  337. assetId: 'product_wine_002',
  338. status: 1,
  339. sort: 5,
  340. stock: 43,
  341. sales: 87,
  342. createTime: '2024-01-15 11:00:00',
  343. updateTime: '2024-01-29 15:55:00'
  344. },
  345. // 白酒系列 (新增分类)
  346. {
  347. id: 'product_bj_001',
  348. name: '五粮液',
  349. categoryId: 'category_baijiu',
  350. assetId: 'product_jg_001',
  351. status: 1,
  352. sort: 1,
  353. stock: 45,
  354. sales: 123,
  355. createTime: '2024-01-16 11:00:00',
  356. updateTime: '2024-01-30 15:55:00'
  357. },
  358. {
  359. id: 'product_bj_002',
  360. name: '剑南春',
  361. categoryId: 'category_baijiu',
  362. assetId: 'product_jg_002',
  363. status: 1,
  364. sort: 2,
  365. stock: 67,
  366. sales: 156,
  367. createTime: '2024-01-17 11:00:00',
  368. updateTime: '2024-01-31 15:55:00'
  369. },
  370. {
  371. id: 'product_bj_003',
  372. name: '泸州老窖',
  373. categoryId: 'category_baijiu',
  374. assetId: 'product_jg_003',
  375. status: 1,
  376. sort: 3,
  377. stock: 89,
  378. sales: 234,
  379. createTime: '2024-01-18 11:00:00',
  380. updateTime: '2024-02-01 15:55:00'
  381. }
  382. ]
  383. }
  384. }
  385. // ========== 首页数据组合 ==========
  386. // 模拟后台组合处理后的首页数据结构
  387. export const MOCK_HOMEPAGE_DATA = {
  388. success: true,
  389. message: '数据获取成功',
  390. data: {
  391. banners: MOCK_BANNER_CONFIG.data.banners.map(banner => ({
  392. ...banner,
  393. imageUrl: MOCK_ASSETS.banners[banner.assetId] // 自动组合素材URL
  394. })),
  395. categories: MOCK_CATEGORIES.data.categories.map(category => {
  396. // 获取该分类下的商品
  397. const categoryProducts = MOCK_PRODUCTS.data.products
  398. .filter(product => product.categoryId === category.id && product.status === 1)
  399. .sort((a, b) => a.sort - b.sort)
  400. .slice(0, 3) // 首页每个分类只显示3个商品
  401. .map(product => ({
  402. ...product,
  403. imageUrl: MOCK_ASSETS.products[product.assetId] // 自动组合素材URL
  404. }))
  405. return {
  406. ...category,
  407. products: categoryProducts
  408. }
  409. }).filter(category => category.status === 1)
  410. }
  411. }
  412. /**
  413. * API 接口路径定义
  414. * 未来需要替换为真实接口地址
  415. */
  416. export const API_ENDPOINTS = {
  417. // 首页数据
  418. HOMEPAGE: '/api/homepage/data',
  419. // 轮播图配置
  420. BANNER_CONFIG: '/api/config/banners',
  421. // 商品相关
  422. PRODUCTS: '/api/products',
  423. PRODUCT_DETAIL: '/api/products/:id',
  424. CATEGORIES: '/api/categories',
  425. // 素材管理
  426. ASSETS: '/api/assets',
  427. ASSET_DETAIL: '/api/assets/:id',
  428. // 搜索
  429. SEARCH: '/api/search',
  430. SEARCH_SUGGESTIONS: '/api/search/suggestions',
  431. HOT_SEARCH: '/api/search/hot',
  432. SEARCH_RECORD: '/api/search/record'
  433. }