index.vue 21 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730
  1. <template>
  2. <view class="diet-page">
  3. <scroll-view class="content" scroll-y>
  4. <!-- ===== 今日餐桌主视觉 ===== -->
  5. <view class="dining-hero">
  6. <view class="hero-top">
  7. <view class="hero-icon-wrap"><text class="hero-icon">🍳</text></view>
  8. <view class="hero-text">
  9. <text class="hero-title">今日共餐</text>
  10. <text class="hero-subtitle">{{ heroSubtitle }}</text>
  11. </view>
  12. </view>
  13. <view class="hero-meals" v-if="hasMealConfig">
  14. <view class="hero-meal" v-for="m in heroMeals" :key="m.key">
  15. <text class="hero-meal-emoji">{{ m.emoji }}</text>
  16. <text class="hero-meal-label">{{ m.label }}</text>
  17. <text class="hero-meal-count">{{ m.count || '—' }}</text>
  18. </view>
  19. </view>
  20. <view class="hero-empty" v-else @tap="navTo('/pages/diet/meal-config')">
  21. <text class="hero-empty-text">还没设置共餐?点这里安排家人一起吃饭</text>
  22. <view class="hero-empty-btn">去设置共餐</view>
  23. </view>
  24. </view>
  25. <!-- 食材推荐器 -->
  26. <view class="card">
  27. <view class="card-header">
  28. <view class="card-basket-icon"><text class="card-basket-emoji">🧺</text></view>
  29. <text class="card-title">今日菜篮</text>
  30. </view>
  31. <view class="card-body">
  32. <view class="action-bar">
  33. <view class="action-btn" @tap="refreshIngredients">
  34. <text class="action-btn-text">🔄 换一批</text>
  35. </view>
  36. <view class="action-btn action-btn-primary" @tap="showFoodPicker">
  37. <text class="action-btn-text-primary">+ 添加食材</text>
  38. </view>
  39. <view class="action-btn action-btn-accent" @tap="generateRecipe" :class="{'action-btn-disabled': selectedIngredients.length === 0}">
  40. <text class="action-btn-text-accent">✨ 生成食谱</text>
  41. </view>
  42. </view>
  43. <view class="ingredient-list" v-if="ingredients.length > 0">
  44. <view class="ingredient-item" v-for="(item, index) in ingredients" :key="getIngredientKey(item, index)">
  45. <view class="ingredient-left">
  46. <view class="ingredient-badge">
  47. <text class="ingredient-badge-text">{{ index + 1 }}</text>
  48. </view>
  49. <view class="ingredient-info">
  50. <text class="ingredient-name">{{ item.name }}</text>
  51. <text class="ingredient-reason" v-if="item.reason">{{ item.reason }}</text>
  52. </view>
  53. </view>
  54. <view class="ingredient-remove" @tap="removeIngredient(index)">
  55. <text class="remove-text">✕</text>
  56. </view>
  57. </view>
  58. </view>
  59. <view class="empty-state" v-else>
  60. <text class="empty-icon">🥬</text>
  61. <text class="empty-text">{{ ingredientsLoading ? '加载中...' : '暂无推荐食材' }}</text>
  62. <text class="empty-sub" v-if="!ingredientsLoading">点击「添加食材」或「换一批」获取推荐</text>
  63. </view>
  64. </view>
  65. </view>
  66. <!-- 快捷入口 -->
  67. <view class="section-label">
  68. <text class="section-label-text">常用功能</text>
  69. </view>
  70. <view class="nav-grid">
  71. <view class="nav-item" @tap="navTo('/pages/diet/food-query')">
  72. <view class="nav-icon-wrap nav-icon-green">
  73. <text class="nav-icon">🥗</text>
  74. </view>
  75. <text class="nav-label">食材查询</text>
  76. </view>
  77. <view class="nav-item" @tap="navTo('/pages/diet/records')">
  78. <view class="nav-icon-wrap nav-icon-blue">
  79. <text class="nav-icon">📝</text>
  80. </view>
  81. <text class="nav-label">饮食记录</text>
  82. </view>
  83. <view class="nav-item" @tap="navTo('/pages/diet/preferences')">
  84. <view class="nav-icon-wrap nav-icon-orange">
  85. <text class="nav-icon">📋</text>
  86. </view>
  87. <text class="nav-label">调研表</text>
  88. </view>
  89. <view class="nav-item" @tap="navTo('/pages/diet/meal-config')">
  90. <view class="nav-icon-wrap nav-icon-purple">
  91. <text class="nav-icon">👨‍👩‍👧</text>
  92. </view>
  93. <text class="nav-label">共餐配置</text>
  94. </view>
  95. <view class="nav-item" @tap="navTo('/pages/diet/recommendation')">
  96. <view class="nav-icon-wrap nav-icon-red">
  97. <text class="nav-icon">🍽️</text>
  98. </view>
  99. <text class="nav-label">食谱推荐</text>
  100. </view>
  101. </view>
  102. <!-- 本周趋势 -->
  103. <view class="card" v-if="trendData.days > 0">
  104. <view class="card-header">
  105. <view class="card-dot"></view>
  106. <text class="card-title">本周饮食</text>
  107. </view>
  108. <view class="card-body">
  109. <view class="trend-row">
  110. <view class="trend-item">
  111. <text class="trend-num">{{ trendData.totalCalories || 0 }}</text>
  112. <text class="trend-unit">kcal</text>
  113. <text class="trend-label">总摄入</text>
  114. </view>
  115. <view class="trend-divider"></view>
  116. <view class="trend-item">
  117. <text class="trend-num">{{ trendData.days }}</text>
  118. <text class="trend-unit">天</text>
  119. <text class="trend-label">记录天数</text>
  120. </view>
  121. </view>
  122. </view>
  123. </view>
  124. <!-- 底部留白 -->
  125. <view class="bottom-space"></view>
  126. </scroll-view>
  127. <!-- 食材选择弹窗 -->
  128. <view class="modal" v-if="showPicker" @tap="closePicker">
  129. <view class="modal-mask"></view>
  130. <view class="modal-content" @tap.stop>
  131. <view class="modal-header">
  132. <text class="modal-title">选择食材</text>
  133. <view class="modal-close" @tap="closePicker">
  134. <text class="close-text">✕</text>
  135. </view>
  136. </view>
  137. <view class="search-wrap">
  138. <input class="search-input" placeholder="搜索食材..." placeholder-style="color:#bbb" v-model="searchQuery" @input="searchFood" />
  139. </view>
  140. <scroll-view class="food-list" scroll-y>
  141. <view class="food-item" v-for="food in searchResults" :key="food.id" @tap="addFood(food)">
  142. <text class="food-name">{{ food.name }}</text>
  143. <text class="food-tag">{{ food.category }}</text>
  144. </view>
  145. </scroll-view>
  146. <view class="empty-state" v-if="searchResults.length === 0 && searchQuery">
  147. <text class="empty-text">未找到匹配食材</text>
  148. </view>
  149. </view>
  150. </view>
  151. </view>
  152. </template>
  153. <script>
  154. import { getDietIngredients, refreshDietIngredients, addDietIngredient, removeDietIngredient, generateDietRecommendation, getMealConfig, searchDietFoods } from '@/utils/api.js'
  155. import { parseDate } from '@/utils/format.js'
  156. export default {
  157. data: function() {
  158. return {
  159. familyId: null,
  160. familyMemberId: null,
  161. ingredients: [],
  162. selectedIngredients: [],
  163. ingredientsLoading: false,
  164. mealSummary: {},
  165. trendData: {},
  166. showPicker: false,
  167. searchQuery: '',
  168. searchResults: [],
  169. uploadPromptShown: false
  170. }
  171. },
  172. computed: {
  173. heroSubtitle: function() {
  174. var self = this
  175. var parts = this.heroMeals.filter(function(m) { return m.count && m.count !== '' })
  176. var count = parts.length > 0 ? (parts[0].count || '') : ''
  177. return (self.isWeekend(new Date()) ? '周末' : '工作日') + ' · ' + (count ? count : '全家一起吃饭')
  178. },
  179. heroMeals: function() {
  180. var defs = [
  181. { key: 'breakfast', label: '早餐', emoji: '🌅' },
  182. { key: 'lunch', label: '午餐', emoji: '☀️' },
  183. { key: 'dinner', label: '晚餐', emoji: '🌙' }
  184. ]
  185. var self = this
  186. return defs.map(function(d) {
  187. return { key: d.key, label: d.label, emoji: d.emoji, count: self.mealSummary[d.key] || '' }
  188. })
  189. },
  190. hasMealConfig: function() {
  191. return !!(this.mealSummary.breakfast || this.mealSummary.lunch || this.mealSummary.dinner)
  192. }
  193. },
  194. onLoad: function() {
  195. this.familyId = uni.getStorageSync('familyId')
  196. this.familyMemberId = uni.getStorageSync('currentChildId') || uni.getStorageSync('currentMemberId') || uni.getStorageSync('userId')
  197. this.loadIngredients()
  198. this.loadMealSummary()
  199. },
  200. onShow: function() {
  201. // onLoad 已加载过,onShow 只刷新食材(共餐配置不重复请求)
  202. this.loadIngredients()
  203. },
  204. methods: {
  205. navTo: function(url) {
  206. uni.navigateTo({ url: url })
  207. },
  208. getIngredientKey: function(item, index) {
  209. return 'ing-' + (item.id || index)
  210. },
  211. loadIngredients: function() {
  212. var self = this
  213. self.ingredientsLoading = true
  214. getDietIngredients().then(function(res) {
  215. self.ingredientsLoading = false
  216. if (res && res.code === 200 && res.data && res.data.ingredients) {
  217. self.ingredients = res.data.ingredients
  218. self.selectedIngredients = self.ingredients
  219. if (self.ingredients.length === 0 && !self.uploadPromptShown) {
  220. self.uploadPromptShown = true
  221. uni.showModal({
  222. title: '暂无推荐食材',
  223. content: '还未上传菌群报告,无法生成个性化食材推荐。是否前往上传报告?',
  224. confirmText: '去上传',
  225. cancelText: '稍后',
  226. success: function(modalRes) {
  227. if (modalRes.confirm) {
  228. uni.navigateTo({ url: '/pages/health/report-upload' })
  229. }
  230. }
  231. })
  232. }
  233. }
  234. }).catch(function() {
  235. self.ingredientsLoading = false
  236. })
  237. },
  238. refreshIngredients: function() {
  239. var self = this
  240. self.ingredientsLoading = true
  241. refreshDietIngredients().then(function(res) {
  242. self.ingredientsLoading = false
  243. if (res && res.code === 200 && res.data && res.data.ingredients) {
  244. self.ingredients = res.data.ingredients
  245. self.selectedIngredients = self.ingredients
  246. }
  247. }).catch(function() {
  248. self.ingredientsLoading = false
  249. })
  250. },
  251. addIngredient: function(index) {
  252. var self = this
  253. var item = this.ingredients[index]
  254. addDietIngredient({ food_id: item.foodId, name: item.name }).then(function(res) {
  255. self.loadIngredients()
  256. })
  257. },
  258. removeIngredient: function(index) {
  259. var self = this
  260. var item = this.ingredients[index]
  261. removeDietIngredient({ food_id: item.foodId }).then(function(res) {
  262. self.loadIngredients()
  263. })
  264. },
  265. generateRecipe: function() {
  266. var self = this
  267. var foodIds = this.ingredients.map(function(item) { return { food_id: item.foodId, name: item.name } })
  268. generateDietRecommendation({
  269. date: self.formatDate(new Date()),
  270. meal_type: 'all',
  271. selected_foods: JSON.stringify(foodIds)
  272. }).then(function(res) {
  273. if (res && res.data && res.data.id) {
  274. uni.showToast({ title: '食谱生成成功', icon: 'success' })
  275. setTimeout(function() {
  276. self.navTo('/pages/diet/recommendation')
  277. }, 1000)
  278. } else {
  279. uni.showToast({ title: (res && res.message) || '生成失败', icon: 'none' })
  280. }
  281. })
  282. },
  283. formatDate: function(date) {
  284. var d = parseDate(date)
  285. if (!d) return ''
  286. var m = (d.getMonth() + 1).toString()
  287. if (m.length < 2) m = '0' + m
  288. var day = d.getDate().toString()
  289. if (day.length < 2) day = '0' + day
  290. return d.getFullYear() + '-' + m + '-' + day
  291. },
  292. loadMealSummary: function() {
  293. var self = this
  294. var dateType = self.isWeekend(new Date()) ? 'weekend' : 'weekday'
  295. Promise.all([
  296. getMealConfig({ date_type: dateType, meal_type: 'breakfast' }),
  297. getMealConfig({ date_type: dateType, meal_type: 'lunch' }),
  298. getMealConfig({ date_type: dateType, meal_type: 'dinner' })
  299. ]).then(function(results) {
  300. self.mealSummary.breakfast = self.parseMembers(results[0])
  301. self.mealSummary.lunch = self.parseMembers(results[1])
  302. self.mealSummary.dinner = self.parseMembers(results[2])
  303. })
  304. },
  305. parseMembers: function(result) {
  306. if (!result || result.code !== 200 || !result.data) return ''
  307. var config = result.data
  308. if (!config || !config.participantMemberIds) return ''
  309. try {
  310. var ids = JSON.parse(config.participantMemberIds)
  311. return '共 ' + ids.length + ' 人'
  312. } catch (e) {
  313. return ''
  314. }
  315. },
  316. isWeekend: function(date) {
  317. var day = date.getDay()
  318. return day === 0 || day === 6
  319. },
  320. showFoodPicker: function() {
  321. this.showPicker = true
  322. },
  323. closePicker: function() {
  324. this.showPicker = false
  325. this.searchQuery = ''
  326. this.searchResults = []
  327. },
  328. searchFood: function() {
  329. var self = this
  330. var kw = (this.searchQuery || '').trim()
  331. if (!kw) {
  332. this.searchResults = []
  333. return
  334. }
  335. searchDietFoods(kw).then(function(res) {
  336. if (res && res.code === 200 && res.data && res.data.foods) {
  337. self.searchResults = res.data.foods
  338. }
  339. })
  340. },
  341. addFood: function(food) {
  342. var self = this
  343. addDietIngredient({ food_id: food.id, name: food.name }).then(function(res) {
  344. self.closePicker()
  345. self.loadIngredients()
  346. })
  347. }
  348. }
  349. }
  350. </script>
  351. <style scoped>
  352. /* ===== 页面令牌(暖灶·家的味道) ===== */
  353. .diet-page {
  354. min-height: 100vh;
  355. background: linear-gradient(180deg, #FFF7ED 0%, #FFF3E6 100%);
  356. overflow: hidden;
  357. }
  358. .dining-hero {
  359. background: linear-gradient(135deg, #FF8C42, #FFB366);
  360. border-radius: 32rpx;
  361. padding: 36rpx 32rpx;
  362. margin-bottom: 24rpx;
  363. box-shadow: 0 8rpx 32rpx rgba(255, 140, 66, 0.25);
  364. }
  365. .hero-top { display: flex; align-items: center; margin-bottom: 24rpx; }
  366. .hero-icon-wrap {
  367. width: 88rpx; height: 88rpx; border-radius: 50%;
  368. background: rgba(255,255,255,0.22);
  369. display: flex; align-items: center; justify-content: center;
  370. margin-right: 20rpx; flex-shrink: 0;
  371. }
  372. .hero-icon { font-size: 44rpx; }
  373. .hero-title { font-size: 38rpx; font-weight: 700; color: #FFFFFF; display: block; }
  374. .hero-subtitle { font-size: 24rpx; color: rgba(255,255,255,0.85); margin-top: 6rpx; display: block; }
  375. .hero-meals { display: flex; }
  376. .hero-meal {
  377. flex: 1; margin: 0 8rpx;
  378. background: rgba(255,255,255,0.18);
  379. border-radius: 20rpx; padding: 20rpx 8rpx;
  380. display: flex; flex-direction: column; align-items: center;
  381. }
  382. .hero-meal:first-child { margin-left: 0; }
  383. .hero-meal:last-child { margin-right: 0; }
  384. .hero-meal-emoji { font-size: 40rpx; margin-bottom: 8rpx; }
  385. .hero-meal-label { font-size: 24rpx; color: #FFFFFF; }
  386. .hero-meal-count { font-size: 22rpx; color: rgba(255,255,255,0.9); margin-top: 6rpx; font-weight: 600; }
  387. .hero-empty { display: flex; flex-direction: column; align-items: center; padding: 12rpx 0; }
  388. .hero-empty-text { font-size: 26rpx; color: #FFFFFF; margin-bottom: 20rpx; }
  389. .hero-empty-btn {
  390. background: #FFFFFF; color: #C2410C; font-size: 28rpx; font-weight: 600;
  391. padding: 18rpx 44rpx; border-radius: 999rpx;
  392. }
  393. .content {
  394. padding: 24rpx 32rpx;
  395. box-sizing: border-box;
  396. width: 100%;
  397. overflow: hidden;
  398. }
  399. /* 共餐格子 */
  400. .card {
  401. background: #FFFFFF;
  402. border-radius: 24rpx;
  403. margin-bottom: 24rpx;
  404. box-shadow: 0 4rpx 20rpx rgba(255, 140, 66, 0.08);
  405. overflow: hidden;
  406. box-sizing: border-box;
  407. width: 100%;
  408. }
  409. .card-header {
  410. display: flex;
  411. align-items: center;
  412. padding: 28rpx 28rpx 0;
  413. }
  414. .card-basket-icon {
  415. width: 64rpx; height: 64rpx; border-radius: 18rpx;
  416. background: linear-gradient(135deg, #FF8C42, #FFB366);
  417. display: flex; align-items: center; justify-content: center;
  418. margin-right: 16rpx; flex-shrink: 0;
  419. }
  420. .card-basket-emoji { font-size: 32rpx; }
  421. .card-title {
  422. font-size: 30rpx;
  423. font-weight: 600;
  424. color: #333;
  425. }
  426. .card-body {
  427. padding: 24rpx 28rpx 28rpx;
  428. }
  429. /* 操作按钮栏 */
  430. .action-bar {
  431. display: flex;
  432. margin-bottom: 24rpx;
  433. box-sizing: border-box;
  434. width: 100%;
  435. }
  436. .action-btn {
  437. padding: 14rpx 24rpx;
  438. border-radius: 32rpx;
  439. background: #F5F5F5;
  440. margin-right: 16rpx;
  441. }
  442. .action-btn:last-child {
  443. margin-right: 0;
  444. }
  445. .action-btn-primary {
  446. background: #FF8C42;
  447. }
  448. .action-btn-accent { background: linear-gradient(135deg, #10B981, #34D399); }
  449. .action-btn-text-accent { font-size: 24rpx; color: #FFFFFF; }
  450. .action-btn-disabled {
  451. opacity: 0.4;
  452. }
  453. .action-btn-text {
  454. font-size: 24rpx;
  455. color: #666;
  456. }
  457. .action-btn-text-primary {
  458. font-size: 24rpx;
  459. color: #FFFFFF;
  460. }
  461. /* 食材列表 */
  462. .ingredient-list {
  463. margin-top: 8rpx;
  464. }
  465. .ingredient-item:active { background: #FFF9F0; }
  466. .ingredient-item {
  467. display: flex;
  468. align-items: center;
  469. justify-content: space-between;
  470. padding: 20rpx 0;
  471. border-bottom: 1rpx solid #F5F5F5;
  472. }
  473. .ingredient-item:last-child {
  474. border-bottom: none;
  475. }
  476. .ingredient-left {
  477. display: flex;
  478. align-items: center;
  479. flex: 1;
  480. }
  481. .ingredient-badge {
  482. width: 40rpx;
  483. height: 40rpx;
  484. border-radius: 12rpx;
  485. background: linear-gradient(135deg, #FF8C42, #FFB366);
  486. display: flex;
  487. align-items: center;
  488. justify-content: center;
  489. margin-right: 20rpx;
  490. flex-shrink: 0;
  491. }
  492. .ingredient-badge-text {
  493. font-size: 20rpx;
  494. color: #FFFFFF;
  495. font-weight: 600;
  496. }
  497. .ingredient-info {
  498. display: flex;
  499. flex-direction: column;
  500. flex: 1;
  501. }
  502. .ingredient-name {
  503. font-size: 28rpx;
  504. color: #333;
  505. font-weight: 500;
  506. }
  507. .ingredient-reason {
  508. font-size: 22rpx;
  509. color: #999;
  510. margin-top: 4rpx;
  511. }
  512. .ingredient-remove {
  513. width: 48rpx;
  514. height: 48rpx;
  515. display: flex;
  516. align-items: center;
  517. justify-content: center;
  518. flex-shrink: 0;
  519. }
  520. .remove-text {
  521. font-size: 28rpx;
  522. color: #ccc;
  523. }
  524. /* 区域标签 */
  525. .section-label {
  526. padding: 8rpx 0 16rpx;
  527. }
  528. .section-label-text {
  529. font-size: 28rpx;
  530. font-weight: 600;
  531. color: #333;
  532. }
  533. /* 快捷入口网格 */
  534. .nav-grid {
  535. display: flex;
  536. flex-wrap: wrap;
  537. margin-bottom: 24rpx;
  538. box-sizing: border-box;
  539. width: 100%;
  540. }
  541. .nav-item {
  542. width: 20%;
  543. display: flex;
  544. flex-direction: column;
  545. align-items: center;
  546. padding: 20rpx 0;
  547. position: relative;
  548. z-index: 1;
  549. }
  550. .nav-icon-wrap {
  551. width: 88rpx;
  552. height: 88rpx;
  553. border-radius: 24rpx;
  554. display: flex;
  555. align-items: center;
  556. justify-content: center;
  557. margin-bottom: 12rpx;
  558. transition: transform 0.15s ease;
  559. }
  560. .nav-icon-green { background: linear-gradient(135deg, #FFF1E6, #FFE0C0); }
  561. .nav-icon-blue { background: linear-gradient(135deg, #FFF7ED, #FFEEDD); }
  562. .nav-icon-orange{ background: linear-gradient(135deg, #FF8C42, #FFB366); }
  563. .nav-icon-purple{ background: linear-gradient(135deg, #FFE8D6, #FFD4B0); }
  564. .nav-icon-red { background: linear-gradient(135deg, #E8F8F1, #C8F0E0); }
  565. .nav-item:active .nav-icon-wrap { transform: scale(0.92); }
  566. .nav-icon {
  567. font-size: 36rpx;
  568. }
  569. .nav-label {
  570. font-size: 22rpx;
  571. color: #333;
  572. }
  573. /* 趋势卡片 */
  574. .trend-row {
  575. display: flex;
  576. align-items: center;
  577. box-sizing: border-box;
  578. width: 100%;
  579. }
  580. .trend-item {
  581. flex: 1;
  582. display: flex;
  583. flex-direction: column;
  584. align-items: center;
  585. }
  586. .trend-divider {
  587. width: 1rpx;
  588. height: 60rpx;
  589. background: #FDE8D0;
  590. }
  591. .trend-num {
  592. font-size: 48rpx;
  593. font-weight: 700;
  594. color: #FF8C42;
  595. }
  596. .trend-unit {
  597. font-size: 22rpx;
  598. color: #999;
  599. margin-top: 4rpx;
  600. }
  601. .trend-label {
  602. font-size: 22rpx;
  603. color: #666;
  604. margin-top: 4rpx;
  605. }
  606. /* 空状态 */
  607. .empty-state {
  608. display: flex;
  609. flex-direction: column;
  610. align-items: center;
  611. padding: 40rpx 0;
  612. }
  613. .empty-icon {
  614. font-size: 48rpx;
  615. margin-bottom: 12rpx;
  616. }
  617. .empty-text {
  618. font-size: 26rpx;
  619. color: #999;
  620. }
  621. .empty-sub {
  622. font-size: 22rpx;
  623. color: #ccc;
  624. margin-top: 8rpx;
  625. }
  626. /* 弹窗 */
  627. .modal {
  628. position: fixed;
  629. top: 0;
  630. left: 0;
  631. right: 0;
  632. bottom: 0;
  633. z-index: 999;
  634. display: flex;
  635. align-items: flex-end;
  636. justify-content: center;
  637. }
  638. .modal-mask {
  639. position: fixed;
  640. top: 0;
  641. left: 0;
  642. right: 0;
  643. bottom: 0;
  644. background: rgba(0, 0, 0, 0.5);
  645. }
  646. .modal-content {
  647. position: relative;
  648. width: 100%;
  649. max-height: 80vh;
  650. background: #FFFFFF;
  651. border-radius: 32rpx 32rpx 0 0;
  652. padding: 32rpx;
  653. z-index: 1;
  654. }
  655. .modal-header {
  656. display: flex;
  657. align-items: center;
  658. justify-content: space-between;
  659. margin-bottom: 24rpx;
  660. }
  661. .modal-title {
  662. font-size: 32rpx;
  663. font-weight: 600;
  664. color: #333;
  665. }
  666. .modal-close {
  667. width: 48rpx;
  668. height: 48rpx;
  669. display: flex;
  670. align-items: center;
  671. justify-content: center;
  672. }
  673. .close-text {
  674. font-size: 32rpx;
  675. color: #999;
  676. }
  677. .search-wrap {
  678. margin-bottom: 20rpx;
  679. }
  680. .search-input {
  681. border: 1rpx solid #eee;
  682. border-radius: 40rpx;
  683. padding: 20rpx 28rpx;
  684. font-size: 28rpx;
  685. background: #F8F8F8;
  686. }
  687. .food-list {
  688. max-height: 500rpx;
  689. }
  690. .food-item {
  691. display: flex;
  692. align-items: center;
  693. justify-content: space-between;
  694. padding: 24rpx 0;
  695. border-bottom: 1rpx solid #F5F5F5;
  696. }
  697. .food-name {
  698. font-size: 28rpx;
  699. color: #333;
  700. }
  701. .food-tag {
  702. font-size: 22rpx;
  703. color: #FF8C42;
  704. background: #FFF0E0;
  705. padding: 6rpx 16rpx;
  706. border-radius: 20rpx;
  707. }
  708. /* 底部留白 */
  709. .bottom-space {
  710. height: 40rpx;
  711. }
  712. </style>