index.vue 20 KB

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