Files
points-mall/supplied-h5/src/view/joyful-selection/product-data.js
T
2026-07-28 10:08:15 +08:00

136 lines
7.1 KiB
JavaScript

import bluetoothEarbudsImage from '@/assets/joyful-selection/products/bluetooth-earbuds.png'
import miniOvenImage from '@/assets/joyful-selection/products/mini-oven.png'
import smartSpeakerImage from '@/assets/joyful-selection/products/smart-speaker.png'
import giftBoxImage from '@/assets/joyful-selection/products/gift-box.png'
const productImages = {
bluetoothEarbuds: bluetoothEarbudsImage,
miniOven: miniOvenImage,
smartSpeaker: smartSpeakerImage,
giftBox: giftBoxImage
}
const createProduct = ({ id, name, desc, detail, price, sales, image, categoryId, category, tag = '赠品' }) => ({
id,
name,
desc,
detail: detail || desc,
price,
originPrice: (Number(price) * 1.25).toFixed(2),
sales,
image,
categoryId,
category,
tag
})
export const joyfulCategories = [
{ id: 'recommend', name: '推荐' },
{ id: 'homeLiving', name: '居家生活' },
{ id: 'digitalAppliance', name: '数码家电' },
{ id: 'beautyCare', name: '美妆个护' },
{ id: 'foodDrink', name: '食品饮料' },
{ id: 'motherBaby', name: '母婴玩具' },
{ id: 'fashionBag', name: '服饰鞋包' },
{ id: 'sportsOutdoor', name: '运动户外' }
]
const categoryNameMap = joyfulCategories.reduce((map, category) => {
map[category.id] = category.name
return map
}, {})
const rawProducts = [
['cream-oven', '奶油白家用迷你烤箱', '小巧不占地,早餐烘焙好帮手', '129.00', '1.2万件', productImages.miniOven, 'homeLiving'],
['cotton-bedding', '100%纯棉舒适四件套', '柔软亲肤,安心睡眠', '179.00', '6453件', productImages.miniOven, 'homeLiving'],
['aroma-gift', '橙意香薰礼盒套装', '淡雅留香,装点居家空间', '59.90', '8321件', productImages.giftBox, 'homeLiving'],
['desktop-vase', '简约北欧陶瓷花瓶', '清新配色,点亮桌面角落', '39.90', '3180件', productImages.giftBox, 'homeLiving'],
['earbuds-air2', '小米蓝牙耳机 Air2 SE', '轻盈半入耳,通勤运动都好听', '69.90', '1.2万件', productImages.bluetoothEarbuds, 'digitalAppliance'],
['smart-speaker-pro', '黑曜智能音箱 Pro', '语音唤醒,沉浸听感', '99.00', '2.1万件', productImages.smartSpeaker, 'digitalAppliance'],
['electric-toothbrush', '智能声波电动牙刷', '高频洁净,呵护口腔', '129.00', '2.1万件', productImages.bluetoothEarbuds, 'digitalAppliance'],
['dual-charger', '双口快充充电器 30W', '小巧便携,多设备快充', '69.00', '5632件', productImages.smartSpeaker, 'digitalAppliance'],
['skin-care-box', '植萃保湿护肤礼盒', '水润修护,清爽不粘腻', '99.90', '4820件', productImages.giftBox, 'beautyCare'],
['aroma-wash', '香氛洗护旅行套装', '温和清洁,清新留香', '59.90', '7932件', productImages.giftBox, 'beautyCare'],
['makeup-mirror', '便携补光化妆镜', '高清镜面,随时补妆', '49.90', '3651件', productImages.smartSpeaker, 'beautyCare'],
['hand-cream', '滋润护手霜三支装', '细腻滋养,轻柔香气', '39.90', '5280件', productImages.giftBox, 'beautyCare'],
['orange-gift', '橙意惊喜零食礼盒', '精致包装,送礼更有心意', '59.90', '6324件', productImages.giftBox, 'foodDrink'],
['coffee-cup', '咖啡随行杯组合', '锁温防漏,醇香随行', '49.90', '3520件', productImages.bluetoothEarbuds, 'foodDrink'],
['tea-snack', '下午茶点心礼盒', '多种风味,一盒满足', '69.90', '4891件', productImages.giftBox, 'foodDrink'],
['fruit-drink', '轻享果饮礼盒', '清爽酸甜,聚会常备', '79.90', '2976件', productImages.giftBox, 'foodDrink'],
['baby-bottle', '安心防摔儿童水杯', '轻巧易握,出门好携带', '39.90', '4250件', productImages.bluetoothEarbuds, 'motherBaby'],
['toy-blocks', '益智拼搭积木套装', '色彩柔和,陪伴成长', '89.00', '2186件', productImages.giftBox, 'motherBaby'],
['kids-night-light', '柔光儿童陪伴夜灯', '温和光线,安心入睡', '69.90', '3548件', productImages.smartSpeaker, 'motherBaby'],
['baby-towel', '纯棉柔软浴巾两件装', '亲肤吸水,日常必备', '59.90', '2761件', productImages.miniOven, 'motherBaby'],
['laptop-backpack', '大容量双肩电脑背包', '分区收纳,通勤出行轻松装', '149.00', '1.6万件', productImages.giftBox, 'fashionBag'],
['mini-bag', '轻巧通勤斜挎小包', '简洁百搭,日常实用', '79.90', '5321件', productImages.giftBox, 'fashionBag'],
['silk-scarf', '柔软撞色丝巾礼盒', '细腻亲肤,点亮穿搭', '69.90', '2680件', productImages.giftBox, 'fashionBag'],
['canvas-tote', '简约帆布托特包', '大容量开口,随手能装', '49.90', '6412件', productImages.giftBox, 'fashionBag'],
['sport-bottle', '运动便携保温水杯', '长效锁温,户外随行', '49.90', '7342件', productImages.bluetoothEarbuds, 'sportsOutdoor'],
['neck-massager', '筋膜放松按摩仪 Mini', '轻巧便携,舒缓酸胀', '99.00', '3921件', productImages.smartSpeaker, 'sportsOutdoor'],
['camping-light', '户外便携露营灯', '多档照明,夜晚更安心', '79.00', '2568件', productImages.smartSpeaker, 'sportsOutdoor'],
['fitness-band', '弹力健身拉力带套装', '居家训练,轻松塑形', '29.90', '4396件', productImages.miniOven, 'sportsOutdoor']
]
export const joyfulProductList = rawProducts.map(([id, name, desc, price, sales, image, categoryId]) =>
createProduct({
id,
name,
desc,
price,
sales,
image,
categoryId,
category: categoryNameMap[categoryId]
})
)
export const joyfulProducts = [
{
id: 'bluetooth-earbuds',
name: '小米蓝牙耳机 Air2 SE',
desc: '轻盈半入耳,通勤运动都好听',
detail: '舒适半入耳设计,配合便携充电盒,日常通勤、运动和在线会议都能保持清晰稳定的聆听体验。',
price: '69.90',
originPrice: '99.90',
category: '数码家电',
tag: '积分兑换',
image: bluetoothEarbudsImage
},
{
id: 'mini-oven',
name: '奶油白家用迷你烤箱',
desc: '小巧不占地,早餐烘焙好帮手',
detail: '紧凑台式机身搭配可视化炉门,适合烤吐司、蛋挞和小份点心,让厨房日常更轻松。',
price: '129.00',
originPrice: '169.00',
category: '居家生活',
tag: '新品上架',
image: miniOvenImage
},
{
id: 'smart-speaker',
name: '黑曜智能音箱 Pro',
desc: '语音唤醒,沉浸听感',
detail: '圆柱一体式声学结构,支持语音互动和日常音乐播放,适合卧室、书房与办公桌面使用。',
price: '99.00',
originPrice: '139.00',
category: '数码家电',
tag: '热门推荐',
image: smartSpeakerImage
},
{
id: 'gift-box',
name: '橙意惊喜礼盒',
desc: '精致包装,送礼更有心意',
detail: '亮橙礼盒搭配丝带包装,适合节日福利、积分兑换礼和日常心意礼赠场景。',
price: '59.90',
originPrice: '89.90',
category: '食品饮料',
tag: '品质精选',
image: giftBoxImage
},
...joyfulProductList
]
export const getJoyfulProduct = id => joyfulProducts.find(item => item.id === id) || joyfulProducts[0]