health-plan-summary.vue 59 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767
  1. <template>
  2. <view class="plan-page">
  3. <!-- 步骤指示器 -->
  4. <view class="steps-bar" v-if="!viewMode">
  5. <view class="step" v-for="(s, i) in steps" :key="i"
  6. :class="{ active: step === i + 1, done: step > i + 1 }">
  7. <text class="step-num">{{ i + 1 }}</text>
  8. <text class="step-label">{{ s }}</text>
  9. </view>
  10. </view>
  11. <!-- Step 1: 选人 + 目标 -->
  12. <view class="section" v-if="step === 1 && !viewMode">
  13. <view class="section-title-row">
  14. <text class="section-title">选择服务对象</text>
  15. <text class="selected-count-badge" v-if="selectedMemberIds.length > 0">{{ selectedMemberIds.length }} 人已选</text>
  16. </view>
  17. <view class="hint-text">选择方案针对的家庭成员</view>
  18. <member-chip-picker
  19. ref="memberPicker"
  20. :selected-ids="selectedMemberIds"
  21. @change="onPickerChange"
  22. @loaded="onPickerLoaded"
  23. @add-member="onAddMember"
  24. />
  25. <view class="section-title" style="margin-top:20rpx">健康目标</view>
  26. <view class="hint-text">描述您希望改善的方向,AI将为您定制方案</view>
  27. <textarea class="goal-textarea" v-model="userGoal" placeholder="例如:孩子最近睡眠不好,希望改善睡眠质量,同时提升免疫力..."
  28. :maxlength="300" auto-height :disabled="loading" @input="onGoalInput"></textarea>
  29. <view class="goal-footer">
  30. <text class="goal-count">{{ goalLen }}/300</text>
  31. <button class="btn-next" :disabled="!canGenerate" @click="goToStep2">{{ loading ? '加载中...' : '下一步' }}</button>
  32. </view>
  33. </view>
  34. <!-- Step 2: 健康问卷 (嵌入式) -->
  35. <view class="section" v-if="step === 2 && !viewMode">
  36. <view class="section-title">📋 健康问卷</view>
  37. <view class="hint-text">填写健康现状,方案将参考这些信息。可跳过,但填写后方案更精准。</view>
  38. <!-- 多成员分别填写:成员切换 tab -->
  39. <view class="member-tabs" v-if="selectedMembers.length > 1">
  40. <view v-for="m in selectedMembers" :key="m.memberId"
  41. class="member-tab" :class="{ active: m.memberId === activeFormMemberId }"
  42. @click="switchMember(m.memberId)">
  43. <text>{{ m.name }}</text>
  44. </view>
  45. </view>
  46. <view class="form-member-hint" v-if="selectedMembers.length > 1">
  47. <text class="form-member-label">正在为「{{ currentMemberName }}」填写</text>
  48. <text class="form-member-save">每个成员独立保存,切换后自动保留</text>
  49. </view>
  50. <!-- 基础体征 -->
  51. <view class="form-section">
  52. <view class="form-title">基础体征</view>
  53. <view class="form-row">
  54. <text class="form-label">身高 (cm)</text>
  55. <input class="form-input" type="digit" v-model="form.heightCm" placeholder="如 170" />
  56. </view>
  57. <view class="form-row">
  58. <text class="form-label">体重 (kg)</text>
  59. <input class="form-input" type="digit" v-model="form.weightKg" placeholder="如 60" />
  60. </view>
  61. <view class="form-row">
  62. <text class="form-label">血压</text>
  63. <input class="form-input" type="text" v-model="form.bloodPressure" placeholder="如 120/80" />
  64. </view>
  65. <view class="form-row">
  66. <text class="form-label">空腹血糖 (mmol/L)</text>
  67. <input class="form-input" type="digit" v-model="form.bloodGlucose" placeholder="如 5.6" />
  68. </view>
  69. </view>
  70. <!-- 血脂 -->
  71. <view class="form-section">
  72. <view class="form-title">血脂</view>
  73. <view class="form-row">
  74. <text class="form-label">总胆固醇 (mmol/L)</text>
  75. <input class="form-input" type="digit" v-model="lipidCholesterol" placeholder="如 4.5" />
  76. </view>
  77. </view>
  78. <!-- 疾病史 -->
  79. <view class="form-section">
  80. <view class="form-title">疾病史</view>
  81. <view v-for="(group, gi) in diseaseGroups" :key="group.key" class="disease-group">
  82. <view class="group-head" @click="toggleGroup(group.key)">
  83. <text class="group-title">{{ group.title }}</text>
  84. <text class="group-arrow">{{ expandedGroups.indexOf(group.key) >= 0 ? '收起' : '展开' }}</text>
  85. </view>
  86. <view v-if="expandedGroups.indexOf(group.key) >= 0" class="tag-wrap">
  87. <view
  88. v-for="(item, ii) in group.items"
  89. :key="item.name"
  90. class="tag-item"
  91. :class="{ 'tag-active': selectedNames.indexOf(item.name) >= 0 }"
  92. @click="toggleDisease(item.name)">
  93. <text>{{ item.name }}</text>
  94. <text v-if="item.risk" class="risk-badge" @click.stop="showRiskTip(item.name)">★</text>
  95. </view>
  96. </view>
  97. </view>
  98. <view class="custom-row">
  99. <input class="custom-input" type="text" v-model="diseaseInput" placeholder="输入其他疾病" />
  100. <text class="add-link" @click="addCustomDisease">添加</text>
  101. </view>
  102. <view v-if="selectedDiseases.length > 0" class="selected-area">
  103. <view class="selected-title">已选疾病({{ selectedDiseases.length }})</view>
  104. <view v-for="(item, si) in selectedDiseases" :key="getSelKey(si)" class="sel-row">
  105. <text class="sel-name">{{ item.name }}</text>
  106. <picker mode="date" fields="month" :value="item.diagnosedAt || currentMonth" :end="monthEnd" @change="onDiagChange(si, $event)">
  107. <view class="sel-diag">{{ item.diagnosedAt ? item.diagnosedAt : '设确诊时间' }}</view>
  108. </picker>
  109. <text class="sel-del" @click="removeSelected(si)">×</text>
  110. </view>
  111. </view>
  112. </view>
  113. <!-- 在服药物/治疗 -->
  114. <view class="form-section">
  115. <view class="form-title">在服药物/治疗</view>
  116. <view v-for="(med, idx) in medRows" :key="idx" class="med-row">
  117. <view class="med-line">
  118. <input class="med-name" type="text" v-model="med.name" placeholder="药物品牌,如 立普妥" />
  119. <text class="med-del" @click="removeMed(idx)">删除</text>
  120. </view>
  121. <view class="med-line">
  122. <picker mode="date" fields="month" :value="med.startDate || currentMonth" :end="monthEnd" @change="onMedStartChange(idx, $event)">
  123. <view class="med-picker">{{ med.startDate ? med.startDate : '选择开始日期' }}</view>
  124. </picker>
  125. <text class="med-forget" @click="onForgetClick(idx)">记不清</text>
  126. </view>
  127. <view class="med-line" v-if="med.durationText">
  128. <text class="med-duration">已服时长:{{ med.durationText }}</text>
  129. </view>
  130. <view class="med-line">
  131. <input class="med-time" type="text" v-model="med.time" placeholder="服药时间,如 早饭后一次" />
  132. </view>
  133. </view>
  134. <text class="add-link" @click="addMed">+ 添加药物/治疗</text>
  135. </view>
  136. <!-- 其他补充 -->
  137. <view class="form-section">
  138. <view class="form-title">其他补充</view>
  139. <textarea class="notes-area" v-model="form.notes" placeholder="其他想补充的健康信息(选填)" :maxlength="500" />
  140. </view>
  141. <!-- 底部按钮 -->
  142. <view class="btn-pair">
  143. <button class="btn-skip" @click="skipToGenerate">跳过</button>
  144. <button class="btn-generate" :disabled="loading" @click="saveAndGenerate">{{ loading ? '生成中...' : '保存并生成' }}</button>
  145. </view>
  146. </view>
  147. <!-- Step 3: 生成方案 -->
  148. <view class="section" v-if="step === 3 && !viewMode">
  149. <view class="section-title">📊 方案生成</view>
  150. <!-- 加载中 -->
  151. <view v-if="loading" class="loading-state">
  152. <text class="loading-icon">⏳</text>
  153. <text class="loading-text">AI 正在为您生成个性化健康方案...</text>
  154. <text class="loading-hint">预计需要 10-30 秒,请耐心等待</text>
  155. </view>
  156. <!-- 方案预览 -->
  157. <view v-else>
  158. <view class="overview-card" v-if="planData.overview">
  159. <text class="overview-text">{{ planData.overview }}</text>
  160. </view>
  161. <view v-else class="empty-state"><text class="empty-text">方案生成失败,请重试</text></view>
  162. <view class="section-title" style="margin-top:20rpx">方案结构</view>
  163. <view class="section-preview-list">
  164. <view v-for="(sec, i) in sectionKeys" :key="i" class="section-preview-item">
  165. <view class="sec-icon">{{ secIcons[i] }}</view>
  166. <view class="sec-info">
  167. <text class="sec-title">{{ secTitles[i] }}</text>
  168. <text class="sec-status" :class="{ done: sections[sec].confirmed }">{{ sections[sec].confirmed ? '已确认' : '待确认' }}</text>
  169. </view>
  170. </view>
  171. </view>
  172. <!-- 两个并排按钮:修改确认 / 选择规划师 -->
  173. <view class="btn-pair">
  174. <button class="btn-confirm" :disabled="loading" @click="startEdit">{{ loading ? '处理中...' : '修改确认' }}</button>
  175. <button class="btn-teacher" @click="goToTeacherService">选择规划师</button>
  176. </view>
  177. <view class="back-link" @click="step = 2">← 返回修改问卷</view>
  178. </view>
  179. </view>
  180. <!-- Step 3 编辑模式:各 section 编辑 -->
  181. <view class="section" v-if="editing && !viewMode">
  182. <view class="section-title-row">
  183. <text class="section-title">{{ currentSectionTitle }}</text>
  184. <text class="section-badge">{{ currentSectionKey }}</text>
  185. </view>
  186. <view class="hint-text">{{ currentSectionHint }}</view>
  187. <textarea class="edit-textarea" v-model="sections[currentSectionKey].content"
  188. :disabled="loading" auto-height></textarea>
  189. <view class="feedback-row">
  190. <input class="feedback-input" v-model="sectionFeedback" placeholder="如有修改意见请填写(可选)..." />
  191. </view>
  192. <view class="section-actions">
  193. <button class="btn-edit" @click="regenerateCurrentSection" :disabled="loading">🔄 重新生成</button>
  194. <button class="btn-confirm" @click="confirmCurrentSection" :disabled="loading">保存</button>
  195. </view>
  196. <view class="back-link" @click="exitEditMode">← 返回方案预览</view>
  197. </view>
  198. <!-- 最终确认保存 (所有 section 确认后) -->
  199. <view class="section" v-if="step === 3 && allConfirmed && !editing && !loading && !viewMode">
  200. <view class="section-title">📋 确认方案</view>
  201. <view class="hint-text">所有板块已确认,点击保存生成最终方案</view>
  202. <view class="final-review">
  203. <view v-for="(sec, i) in sectionKeys" :key="i" class="review-item">
  204. <text class="review-title">{{ secTitles[i] }}</text>
  205. <text class="review-preview">{{ sections[sec].content.substring(0, 80) }}{{ sections[sec].content.length > 80 ? '...' : '' }}</text>
  206. </view>
  207. </view>
  208. <view class="btn-pair">
  209. <button class="btn-confirm full-btn" :disabled="loading" @click="submitPlan">{{ loading ? '保存中...' : '确认保存' }}</button>
  210. <button class="btn-teacher" @click="goToTeacherService">选择规划师</button>
  211. </view>
  212. <view class="back-link" @click="startEdit">← 继续修改</view>
  213. </view>
  214. <!-- 查看模式 -->
  215. <view class="section plan-view-section" v-if="viewMode && planDetail">
  216. <view class="section-header">
  217. <text class="section-title">📊 健康方案</text>
  218. </view>
  219. <view class="plan-meta">
  220. <text class="plan-meta-item">目标:{{ planDetail.goal || '—' }}</text>
  221. <text class="plan-meta-item" v-if="planDetail.memberName">成员:{{ planDetail.memberName }}</text>
  222. <text class="plan-meta-item" v-if="planDetail.createdAt">制定于 {{ formatTime(planDetail.createdAt) }}</text>
  223. <text class="plan-meta-item" v-if="planDetail.status === 'confirmed' || planDetail.status === 'published'">状态:已发布</text>
  224. <text class="plan-meta-item" v-if="planDetail.status === 'draft'">状态:待确认</text>
  225. <text class="plan-meta-item" v-if="planDetail.status === 'pending_review'">状态:待规划师审核</text>
  226. <text class="plan-meta-item" v-if="planDetail.status === 'rejected'">状态:已驳回</text>
  227. <text class="plan-meta-item" v-if="planDetail.reviewComment && planDetail.status !== 'draft'">审核备注:{{ planDetail.reviewComment }}</text>
  228. </view>
  229. <view v-if="planDetail.planContent" class="plan-preview">
  230. <text class="plan-preview-text">{{ planDetail.planContent }}</text>
  231. </view>
  232. <!-- 待确认:点「确定」分解任务(任务在首页/任务中心查看,不在方案下方展示);「申请规划师」预留 -->
  233. <view class="btn-pair plan-confirm-actions" v-if="needsTaskConfirm">
  234. <button class="btn-confirm" :disabled="confirmingTasks" @click="confirmPlanTasks">{{ confirmingTasks ? '处理中...' : '确定' }}</button>
  235. <button class="btn-teacher" @click="applyForTeacher">申请规划师</button>
  236. </view>
  237. </view>
  238. <!-- 成功遮罩 -->
  239. <view v-if="taskSubmitted" class="success-overlay">
  240. <view class="success-card">
  241. <text class="success-icon">✓</text>
  242. <text class="success-title">{{ planDetail && (planDetail.status === 'published' || planDetail.status === 'confirmed') ? '方案已发布' : '方案已提交审核' }}</text>
  243. <text class="success-sub">已为您创建日常任务</text>
  244. <button class="btn-done" @click="goBack">完成</button>
  245. </view>
  246. </view>
  247. </view>
  248. </template>
  249. <script>
  250. import { generateHealthPlan, regenerateSection, confirmPlan, saveHealthPlan, getHealthPlanDetail, approvePlan } from '../../utils/api'
  251. import { getHealthStatus, saveHealthStatus } from '../../utils/api'
  252. import MemberChipPicker from '../../components/MemberChipPicker.vue'
  253. // v2: 预置疾病清单(菌群报告病症风险 ★ + 互联网统计常见病 两源合并去重,8 组 54 项)
  254. var DISEASE_GROUPS = [
  255. { key: 'cardio', title: '心血管代谢', items: [
  256. { name: '高血压', risk: false },
  257. { name: '糖尿病', risk: false },
  258. { name: '血脂异常', risk: false },
  259. { name: '冠心病', risk: false },
  260. { name: '脑卒中', risk: false },
  261. { name: '心力衰竭', risk: false },
  262. { name: '心房颤动', risk: false },
  263. { name: '慢阻肺', risk: false },
  264. { name: '心脑血管疾病', risk: true },
  265. { name: 'II型糖尿病', risk: true },
  266. { name: '肥胖', risk: true },
  267. { name: '超重', risk: false },
  268. { name: '高尿酸血症', risk: false },
  269. { name: '骨质疏松', risk: false }
  270. ]},
  271. { key: 'digest', title: '消化系统', items: [
  272. { name: '幽门螺杆菌感染', risk: false },
  273. { name: '脂肪肝', risk: false },
  274. { name: '慢性胃炎', risk: false },
  275. { name: '胃食管反流', risk: false },
  276. { name: '肠易激综合征', risk: true },
  277. { name: '炎症性肠炎', risk: true },
  278. { name: '慢性便秘', risk: true },
  279. { name: '感染性腹泻', risk: true },
  280. { name: '胆结石', risk: false },
  281. { name: '炎症性肠病', risk: false },
  282. { name: '肝病', risk: true },
  283. { name: '胃病', risk: true },
  284. { name: '胆病', risk: true },
  285. { name: '肾病', risk: true },
  286. { name: '腹胀', risk: true }
  287. ]},
  288. { key: 'immune', title: '过敏免疫', items: [
  289. { name: '过敏性鼻炎', risk: true },
  290. { name: '哮喘', risk: false },
  291. { name: '湿疹', risk: false },
  292. { name: '食物过敏', risk: false },
  293. { name: '自体免疫病', risk: true }
  294. ]},
  295. { key: 'neuro', title: '精神神经', items: [
  296. { name: '抑郁症', risk: true },
  297. { name: '失眠', risk: true },
  298. { name: '焦虑障碍', risk: false },
  299. { name: '偏头痛', risk: false },
  300. { name: '自闭症', risk: true }
  301. ]},
  302. { key: 'resp', title: '呼吸系统', items: [
  303. { name: '肺部感染或疾病', risk: true },
  304. { name: '肺部疾病', risk: true }
  305. ]},
  306. { key: 'tumor', title: '肿瘤', items: [
  307. { name: '结直肠癌', risk: true },
  308. { name: '肺癌', risk: false },
  309. { name: '甲状腺癌', risk: false },
  310. { name: '肝癌', risk: false },
  311. { name: '胃癌', risk: false },
  312. { name: '乳腺癌', risk: false },
  313. { name: '食管癌', risk: false }
  314. ]},
  315. { key: 'child', title: '儿童青少年', items: [
  316. { name: '近视', risk: false },
  317. { name: '龋齿', risk: false },
  318. { name: '注意缺陷多动障碍', risk: false },
  319. { name: '甲状腺疾病', risk: true }
  320. ]},
  321. { key: 'other', title: '其他', items: [
  322. { name: '缺铁性贫血', risk: false },
  323. { name: '贫血', risk: false }
  324. ]}
  325. ]
  326. export default {
  327. components: { MemberChipPicker },
  328. data() {
  329. return {
  330. // 步骤控制
  331. step: 1,
  332. // 成员选择(字段名对齐 report-list,避免 executors 在部分基础库 setData 异常)
  333. selectedMemberIds: [],
  334. pickerMembers: [],
  335. needReloadMembers: false,
  336. // 目标
  337. userGoal: '',
  338. goalLen: 0,
  339. // 健康问卷表单
  340. form: {
  341. heightCm: '',
  342. weightKg: '',
  343. bloodPressure: '',
  344. bloodGlucose: '',
  345. notes: ''
  346. },
  347. lipidCholesterol: '',
  348. // 疾病清单很大,不放进首屏 data,避免微信 setData 超限导致成员列表无法渲染
  349. expandedGroups: [],
  350. selectedDiseases: [],
  351. diseaseInput: '',
  352. medRows: [{ name: '', startDate: '', durationText: '', time: '' }],
  353. currentMonth: '',
  354. monthEnd: '',
  355. // 多成员分别填写:memberId → 各自的表单快照 { form, lipidCholesterol, selectedDiseases, medRows }
  356. memberFormMap: {},
  357. activeFormMemberId: '',
  358. // 方案数据
  359. planData: {},
  360. sections: {
  361. nutrition: { content: '', confirmed: false },
  362. diet: { content: '', confirmed: false },
  363. exercise: { content: '', confirmed: false }
  364. },
  365. sectionFeedback: '',
  366. editing: false,
  367. // 查看模式
  368. viewMode: false,
  369. planDetail: null,
  370. planId: null,
  371. confirmingTasks: false,
  372. // UI 状态
  373. loading: false,
  374. taskSubmitted: false
  375. }
  376. },
  377. computed: {
  378. // 仅在问卷步骤暴露疾病清单,减小 step1 的 setData 体积
  379. diseaseGroups: function() {
  380. return this.step >= 2 ? DISEASE_GROUPS : []
  381. },
  382. canGenerate: function() {
  383. return this.selectedMemberIds.length > 0 && this.goalLen > 0 && !this.loading
  384. },
  385. allConfirmed: function() {
  386. return this.sections.nutrition.confirmed && this.sections.diet.confirmed && this.sections.exercise.confirmed
  387. },
  388. needsTaskConfirm: function() {
  389. return !!(this.planDetail && this.planDetail.status === 'draft')
  390. },
  391. steps: function() { return ['选人', '问卷', '方案'] },
  392. sectionKeys: function() { return ['nutrition', 'diet', 'exercise'] },
  393. sectionTitles: function() { return ['营养补充建议', '饮食建议', '运动计划'] },
  394. sectionIcons: function() { return ['💊', '🍽️', '🏃'] },
  395. sectionHints: function() { return [
  396. '包含益生菌、维生素、矿物质等营养补充建议',
  397. '包含早餐、午餐、晚餐的饮食建议',
  398. '包含有氧运动、力量训练等运动计划'
  399. ]},
  400. currentSectionKey: function() {
  401. var idx = this.step - 3
  402. return this.sectionKeys[idx] || ''
  403. },
  404. currentSectionTitle: function() {
  405. var idx = this.step - 3
  406. return this.sectionTitles[idx] || ''
  407. },
  408. currentSectionHint: function() {
  409. var idx = this.step - 3
  410. return this.sectionHints[idx] || ''
  411. },
  412. selectedNames: function() {
  413. return this.selectedDiseases.map(function(d) { return d.name })
  414. },
  415. selectedMembers: function() {
  416. var self = this
  417. var out = []
  418. this.selectedMemberIds.forEach(function(id) {
  419. var found = null
  420. for (var i = 0; i < self.pickerMembers.length; i++) {
  421. var mid = self.pickerMembers[i].memberId || self.pickerMembers[i].id
  422. if (String(mid) === String(id)) { found = self.pickerMembers[i]; break }
  423. }
  424. // 规整为标准结构(兼容 pickerMembers 只用 id 或 nickname 的情况)
  425. if (found) {
  426. out.push({
  427. memberId: String(found.memberId || found.id),
  428. name: found.name || found.nickname || '成员'
  429. })
  430. }
  431. })
  432. return out
  433. },
  434. currentMemberName: function() {
  435. var members = this.selectedMembers
  436. for (var i = 0; i < members.length; i++) {
  437. if (String(members[i].memberId) === String(this.activeFormMemberId)) {
  438. return members[i].name
  439. }
  440. }
  441. return '成员'
  442. }
  443. },
  444. onLoad: function(options) {
  445. var self = this
  446. // 处理初始成员ID
  447. if (options.initialMemberIds) {
  448. this.selectedMemberIds = options.initialMemberIds.split(',').filter(function(id) { return id }).map(function(id) { return String(parseInt(id) || id) })
  449. } else if (options.memberId) {
  450. this.selectedMemberIds = [String(options.memberId)]
  451. }
  452. // 处理 planId 查看模式
  453. this.planId = options.planId ? parseInt(options.planId) : null
  454. if (this.planId) {
  455. this.viewMode = true
  456. this.loadPlanDetail()
  457. }
  458. // 初始化健康问卷时间
  459. var now = new Date()
  460. var y = now.getFullYear()
  461. var m = now.getMonth() + 1
  462. var mStr = m < 10 ? '0' + m : '' + m
  463. this.currentMonth = y + '-' + mStr
  464. var lastDay = new Date(y, m, 0).getDate()
  465. this.monthEnd = y + '-' + mStr + '-' + (lastDay < 10 ? '0' + lastDay : '' + lastDay)
  466. // 健康问卷数据在成员选择组件 loaded 后按成员异步加载
  467. // 自动执行
  468. if (options.autoExecute === '1') {
  469. setTimeout(function() { self.doAutoExecute() }, 1500)
  470. }
  471. },
  472. onShow: function() {
  473. var self = this
  474. // 从购买/开通页返回:自动继续生成方案
  475. if (uni.getStorageSync('PLAN_RESUME_AFTER_PURCHASE') === '1') {
  476. uni.removeStorageSync('PLAN_RESUME_AFTER_PURCHASE')
  477. if (this.selectedMemberIds && this.selectedMemberIds.length > 0 && !this.viewMode) {
  478. setTimeout(function() { self.doAutoExecute() }, 800)
  479. }
  480. }
  481. if (this.needReloadMembers) {
  482. this.needReloadMembers = false
  483. if (this.$refs.memberPicker && this.$refs.memberPicker.reload) {
  484. this.$refs.memberPicker.reload()
  485. }
  486. }
  487. },
  488. methods: {
  489. onGoalInput: function(e) {
  490. var val = (e && e.detail && e.detail.value) || this.userGoal || ''
  491. this.goalLen = String(val).length
  492. },
  493. onPickerChange: function(payload) {
  494. if (!payload) return
  495. this.selectedMemberIds = payload.selectedIds || []
  496. this.pickerMembers = payload.members || []
  497. },
  498. onPickerLoaded: function(payload) {
  499. if (!payload) return
  500. this.selectedMemberIds = payload.selectedIds || []
  501. this.pickerMembers = payload.members || []
  502. var formId = (payload.selectedIds && payload.selectedIds[0]) || ''
  503. if (formId) {
  504. this.activeFormMemberId = String(formId)
  505. var self = this
  506. setTimeout(function() { self.loadHealthForm(formId) }, 100)
  507. }
  508. },
  509. onAddMember: function() {
  510. this.needReloadMembers = true
  511. },
  512. // ===== 时间格式化 =====
  513. formatTime: function(iso) {
  514. if (!iso) return ''
  515. var s = String(iso)
  516. if (s.length >= 19) s = s.substring(0, 19)
  517. return s.replace('T', ' ')
  518. },
  519. // ===== 步骤导航 =====
  520. goToStep2: function() {
  521. if (this.expandedGroups.length === 0) {
  522. this.expandedGroups = DISEASE_GROUPS.slice(0, 3).map(function(g) { return g.key })
  523. }
  524. // 多成员调研:确保 activeFormMemberId 指向第一个选中成员,并加载其表单
  525. if (!this.activeFormMemberId && this.selectedMemberIds.length > 0) {
  526. this.activeFormMemberId = String(this.selectedMemberIds[0])
  527. var self = this
  528. setTimeout(function() { self.loadHealthForm(self.activeFormMemberId) }, 100)
  529. }
  530. this.step = 2
  531. },
  532. skipToGenerate: function() {
  533. this.step = 3
  534. this.generatePlan()
  535. },
  536. // ===== 健康问卷方法 (从 health-status-form.vue 移植,支持按成员加载) =====
  537. loadHealthForm: function(memberId) {
  538. var self = this
  539. var mid = memberId || self.activeFormMemberId || ''
  540. // 已有该成员的本地快照 → 直接恢复
  541. if (mid && self.memberFormMap[mid]) {
  542. self.applyFormSnapshot(self.memberFormMap[mid])
  543. return
  544. }
  545. getHealthStatus(mid || undefined).then(function(res) {
  546. if (res && res.code === 200 && res.data) {
  547. var d = res.data
  548. var snapshot = {
  549. form: {
  550. heightCm: d.heightCm || '',
  551. weightKg: d.weightKg || '',
  552. bloodPressure: d.bloodPressure || '',
  553. bloodGlucose: d.bloodGlucose || '',
  554. notes: d.notes || ''
  555. },
  556. lipidCholesterol: self.parseLipidCholesterol(d.bloodLipids),
  557. selectedDiseases: [],
  558. medRows: self.parseMeds(d.medications)
  559. }
  560. self.memberFormMap[mid || '__account'] = snapshot
  561. self.loadDiseasesInto(snapshot.selectedDiseases, d.diseaseHistory)
  562. if (mid) self.applyFormSnapshot(snapshot)
  563. else self.applyFormSnapshot({
  564. form: snapshot.form,
  565. lipidCholesterol: snapshot.lipidCholesterol,
  566. selectedDiseases: snapshot.selectedDiseases,
  567. medRows: snapshot.medRows
  568. })
  569. }
  570. }).catch(function() {})
  571. },
  572. // 切换成员时先保存当前编辑内容,再加载目标成员快照
  573. switchMember: function(memberId) {
  574. var self = this
  575. if (String(memberId) === String(self.activeFormMemberId)) return
  576. // 保存当前成员到快照
  577. self.memberFormMap[self.activeFormMemberId || '__account'] = {
  578. form: JSON.parse(JSON.stringify(self.form)),
  579. lipidCholesterol: self.lipidCholesterol,
  580. selectedDiseases: JSON.parse(JSON.stringify(self.selectedDiseases)),
  581. medRows: JSON.parse(JSON.stringify(self.medRows))
  582. }
  583. self.activeFormMemberId = String(memberId)
  584. // 目标成员已有快照 → 恢复;无则按该成员从服务端加载
  585. if (self.memberFormMap[self.activeFormMemberId]) {
  586. self.applyFormSnapshot(self.memberFormMap[self.activeFormMemberId])
  587. } else {
  588. self.resetFormFields()
  589. self.loadHealthForm(self.activeFormMemberId)
  590. }
  591. },
  592. applyFormSnapshot: function(snapshot) {
  593. if (!snapshot) return
  594. this.form = JSON.parse(JSON.stringify(snapshot.form || {}))
  595. this.lipidCholesterol = snapshot.lipidCholesterol || ''
  596. this.selectedDiseases = JSON.parse(JSON.stringify(snapshot.selectedDiseases || []))
  597. this.medRows = snapshot.medRows && snapshot.medRows.length > 0 ? JSON.parse(JSON.stringify(snapshot.medRows)) : [{ name: '', startDate: '', durationText: '', time: '' }]
  598. var self = this
  599. this.selectedDiseases.forEach(function(item) {
  600. var gk = self.findGroupKey(item.name)
  601. if (gk && self.expandedGroups.indexOf(gk) < 0) self.expandedGroups.push(gk)
  602. })
  603. },
  604. resetFormFields: function() {
  605. this.form = { heightCm: '', weightKg: '', bloodPressure: '', bloodGlucose: '', notes: '' }
  606. this.lipidCholesterol = ''
  607. this.selectedDiseases = []
  608. this.medRows = [{ name: '', startDate: '', durationText: '', time: '' }]
  609. this.diseaseInput = ''
  610. },
  611. parseLipidCholesterol: function(json) {
  612. try {
  613. var arr = JSON.parse(json || '[]')
  614. if (arr instanceof Array && arr.length > 0 && arr[0].value) {
  615. return String(arr[0].value)
  616. }
  617. } catch (e) {}
  618. return ''
  619. },
  620. loadDiseasesInto: function(targetList, json) {
  621. var self = this
  622. try {
  623. var arr = JSON.parse(json || '[]')
  624. if (arr instanceof Array) {
  625. arr.forEach(function(item) {
  626. if (item.name && self.selectedNames.indexOf(item.name) < 0) {
  627. targetList.push({
  628. name: item.name,
  629. diagnosedAt: item.diagnosedAt || '',
  630. custom: false
  631. })
  632. var gk = self.findGroupKey(item.name)
  633. if (gk && self.expandedGroups.indexOf(gk) < 0) {
  634. self.expandedGroups.push(gk)
  635. }
  636. }
  637. })
  638. }
  639. } catch (e) {}
  640. },
  641. parseMeds: function(json) {
  642. var list = []
  643. try {
  644. var arr = JSON.parse(json || '[]')
  645. if (arr instanceof Array) {
  646. arr.forEach(function(item) {
  647. list.push({
  648. name: item.name || '',
  649. startDate: item.startDate || '',
  650. durationText: item.durationText || '',
  651. time: item.time || ''
  652. })
  653. })
  654. }
  655. } catch (e) {}
  656. if (list.length === 0) list.push({ name: '', startDate: '', durationText: '', time: '' })
  657. return list
  658. },
  659. toggleGroup: function(key) {
  660. var idx = this.expandedGroups.indexOf(key)
  661. if (idx >= 0) this.expandedGroups.splice(idx, 1)
  662. else this.expandedGroups.push(key)
  663. },
  664. findGroupKey: function(name) {
  665. for (var i = 0; i < DISEASE_GROUPS.length; i++) {
  666. var items = DISEASE_GROUPS[i].items
  667. for (var j = 0; j < items.length; j++) {
  668. if (items[j].name === name) return DISEASE_GROUPS[i].key
  669. }
  670. }
  671. return ''
  672. },
  673. toggleDisease: function(name) {
  674. var idx = -1
  675. for (var i = 0; i < this.selectedDiseases.length; i++) {
  676. if (this.selectedDiseases[i].name === name) { idx = i; break }
  677. }
  678. if (idx >= 0) {
  679. this.selectedDiseases.splice(idx, 1)
  680. } else {
  681. this.selectedDiseases.push({ name: name, diagnosedAt: '', custom: false })
  682. var gk = this.findGroupKey(name)
  683. if (gk && this.expandedGroups.indexOf(gk) < 0) {
  684. this.expandedGroups.push(gk)
  685. }
  686. }
  687. },
  688. showRiskTip: function(name) {
  689. uni.showModal({
  690. title: '菌群报告关联',
  691. content: '「' + name + '」与肠道菌群报告相关,勾选后出方案时可结合菌群报告风险值评估。',
  692. showCancel: false
  693. })
  694. },
  695. addCustomDisease: function() {
  696. var name = (this.diseaseInput || '').trim()
  697. if (!name) return
  698. if (this.selectedNames.indexOf(name) < 0) {
  699. this.selectedDiseases.push({ name: name, diagnosedAt: '', custom: true })
  700. }
  701. this.diseaseInput = ''
  702. },
  703. getSelKey: function(i) { return 's' + i },
  704. removeSelected: function(idx) {
  705. this.selectedDiseases.splice(idx, 1)
  706. },
  707. onDiagChange: function(idx, e) {
  708. this.selectedDiseases[idx].diagnosedAt = e.detail.value
  709. },
  710. addMed: function() {
  711. this.medRows.push({ name: '', startDate: '', durationText: '', time: '' })
  712. },
  713. onMedStartChange: function(idx, e) {
  714. var start = e.detail.value
  715. this.medRows[idx].startDate = start
  716. this.medRows[idx].durationText = this.calcDuration(start)
  717. },
  718. onForgetClick: function(idx) {
  719. var self = this
  720. uni.showModal({
  721. title: '记不清开始日期',
  722. editable: true,
  723. placeholderText: '如:约 3 个月',
  724. success: function(res) {
  725. if (res.confirm && res.content) {
  726. self.medRows[idx].durationText = res.content.trim()
  727. }
  728. }
  729. })
  730. },
  731. calcDuration: function(startDate) {
  732. if (!startDate) return ''
  733. var parts = startDate.split('-')
  734. if (parts.length !== 2) return ''
  735. var sy = parseInt(parts[0], 10)
  736. var sm = parseInt(parts[1], 10)
  737. var now = new Date()
  738. var months = (now.getFullYear() - sy) * 12 + (now.getMonth() + 1 - sm)
  739. if (months < 1) months = 1
  740. if (months < 12) return '已服 ' + months + ' 个月'
  741. return '已服 ' + Math.floor(months / 12) + ' 年'
  742. },
  743. removeMed: function(idx) {
  744. if (this.medRows.length > 1) this.medRows.splice(idx, 1)
  745. },
  746. buildHealthPayload: function(snapshot) {
  747. var s = snapshot || {
  748. form: this.form,
  749. lipidCholesterol: this.lipidCholesterol,
  750. selectedDiseases: this.selectedDiseases,
  751. medRows: this.medRows
  752. }
  753. var lipids = []
  754. if (s.lipidCholesterol) {
  755. lipids.push({ name: '总胆固醇', value: parseFloat(s.lipidCholesterol), unit: 'mmol/L', note: '' })
  756. }
  757. var diseases = []
  758. ;(s.selectedDiseases || []).forEach(function(item) {
  759. var d = { name: item.name }
  760. if (item.diagnosedAt) d.diagnosedAt = item.diagnosedAt
  761. diseases.push(d)
  762. })
  763. var meds = []
  764. ;(s.medRows || []).forEach(function(item) {
  765. if (item.name) {
  766. var m = { name: item.name }
  767. if (item.startDate) m.startDate = item.startDate
  768. if (item.durationText) m.durationText = item.durationText
  769. if (item.time) m.time = item.time
  770. meds.push(m)
  771. }
  772. })
  773. var payload = {}
  774. if (s.form.heightCm) payload.heightCm = Number(s.form.heightCm)
  775. if (s.form.weightKg) payload.weightKg = Number(s.form.weightKg)
  776. if (s.form.bloodPressure) payload.bloodPressure = s.form.bloodPressure
  777. if (s.form.bloodGlucose) payload.bloodGlucose = Number(s.form.bloodGlucose)
  778. if (lipids.length > 0) payload.bloodLipids = JSON.stringify(lipids)
  779. if (diseases.length > 0) payload.diseaseHistory = JSON.stringify(diseases)
  780. if (meds.length > 0) payload.medications = JSON.stringify(meds)
  781. if (s.form.notes) payload.notes = s.form.notes
  782. return payload
  783. },
  784. // 当前成员快照(无改动数据时返回 null)
  785. snapshotForMember: function(memberId) {
  786. var key = String(memberId)
  787. // 优先用已保存的成员快照,其次当前活动表单
  788. if (this.memberFormMap[key]) {
  789. var s = this.memberFormMap[key]
  790. var p = this.buildHealthPayload(s)
  791. return this.hasPayload(p) ? p : null
  792. }
  793. // 活动成员直接用当前表单
  794. if (key === String(this.activeFormMemberId)) {
  795. var activePayload = this.buildHealthPayload()
  796. return this.hasPayload(activePayload) ? activePayload : null
  797. }
  798. return null
  799. },
  800. hasPayload: function(payload) {
  801. if (!payload) return false
  802. return payload.heightCm || payload.weightKg || payload.bloodPressure || payload.bloodGlucose ||
  803. payload.bloodLipids || payload.diseaseHistory || payload.medications || payload.notes
  804. },
  805. // 先保存当前活动成员的编辑内容到快照,再逐个成员保存健康档案,最后生成方案
  806. saveAndGenerate: function() {
  807. var self = this
  808. // 保存当前活动成员到快照
  809. if (self.activeFormMemberId) {
  810. self.memberFormMap[self.activeFormMemberId] = {
  811. form: JSON.parse(JSON.stringify(self.form)),
  812. lipidCholesterol: self.lipidCholesterol,
  813. selectedDiseases: JSON.parse(JSON.stringify(self.selectedDiseases)),
  814. medRows: JSON.parse(JSON.stringify(self.medRows))
  815. }
  816. }
  817. // 血压格式校验(检查所有成员)
  818. var members = self.selectedMemberIds.slice()
  819. for (var i = 0; i < members.length; i++) {
  820. var payload = self.snapshotForMember(members[i])
  821. if (payload && payload.bloodPressure && !/^\d{2,3}\/\d{2,3}$/.test(payload.bloodPressure)) {
  822. uni.showToast({ title: '血压格式应为 120/80', icon: 'none' })
  823. return
  824. }
  825. }
  826. self.loading = true
  827. var saveTasks = []
  828. members.forEach(function(mid) {
  829. var payload = self.snapshotForMember(mid)
  830. if (!payload) return
  831. payload.memberId = mid
  832. saveTasks.push(saveHealthStatus(payload))
  833. })
  834. if (saveTasks.length === 0) {
  835. // 无健康数据,直接生成方案
  836. self.loading = false
  837. self.generatePlan()
  838. return
  839. }
  840. Promise.all(saveTasks).then(function() {
  841. uni.showToast({ title: '健康信息已保存', icon: 'success' })
  842. self.loading = false
  843. self.generatePlan()
  844. }).catch(function() {
  845. // 保存失败也继续生成
  846. self.loading = false
  847. self.generatePlan()
  848. })
  849. },
  850. // ===== 方案生成与编辑 (保持原有逻辑) =====
  851. generatePlan: function() {
  852. var self = this
  853. if (!self.canGenerate) return
  854. self.loading = true
  855. var params = {
  856. memberIds: self.selectedMemberIds.join(','),
  857. dimensions: 'body',
  858. goal: self.userGoal.trim()
  859. }
  860. generateHealthPlan(params).then(function(res) {
  861. self.loading = false
  862. if (res && res.code === 200 && res.data) {
  863. var data = res.data
  864. if (typeof data === 'string') {
  865. self.planData = { overview: data }
  866. self.step = 3
  867. } else if (data.overview) {
  868. self.planData = data
  869. if (data.sections && data.sections instanceof Array) {
  870. data.sections.forEach(function(sec) {
  871. if (sec.key && self.sections[sec.key]) {
  872. self.sections[sec.key].content = sec.content || ''
  873. self.sections[sec.key].items = sec.items || []
  874. }
  875. })
  876. }
  877. self.step = 3
  878. } else if (data.raw) {
  879. self.planData = { overview: data.raw.substring(0, 200) }
  880. self.step = 3
  881. } else {
  882. uni.showToast({ title: '生成失败,请重试', icon: 'none' })
  883. }
  884. } else {
  885. uni.showToast({ title: res && res.message ? res.message : '生成失败', icon: 'none' })
  886. }
  887. }).catch(function(err) {
  888. self.loading = false
  889. // 付费墙:家庭会员或健康启航计划均未开通(request 封装对非 200 code 统一 reject,此处拿到 err.code)
  890. if (err && err.code === 4001) {
  891. self.showPaywallSheet()
  892. } else {
  893. uni.showToast({ title: '请求失败,请检查网络', icon: 'none' })
  894. }
  895. })
  896. },
  897. // 付费墙引导:三选一(购买家庭会员 / 购买健康启航计划 / 取消)
  898. showPaywallSheet: function() {
  899. uni.showActionSheet({
  900. itemList: ['购买家庭会员', '购买健康启航计划'],
  901. success: function(sheetRes) {
  902. if (sheetRes.tapIndex === 0) {
  903. uni.setStorageSync('PLAN_RESUME_AFTER_PURCHASE', '1')
  904. uni.navigateTo({ url: '/pages/membership/upgrade' })
  905. } else if (sheetRes.tapIndex === 1) {
  906. uni.setStorageSync('PLAN_RESUME_AFTER_PURCHASE', '1')
  907. uni.navigateTo({ url: '/pages/purchase/index' })
  908. }
  909. }
  910. })
  911. },
  912. doAutoExecute: function() {
  913. if (this.selectedMemberIds.length === 0) return
  914. if (!this.userGoal) this.userGoal = '基于菌群检测报告的个性化健康管理方案'
  915. this.generatePlan()
  916. },
  917. regenerateCurrentSection: function() {
  918. var self = this
  919. var key = self.currentSectionKey
  920. var existing = self.sections[key].content
  921. if (!existing) return
  922. self.loading = true
  923. var params = {
  924. section: key,
  925. feedback: self.sectionFeedback || '',
  926. existing_section_content: existing,
  927. memberIds: self.selectedMemberIds.join(','),
  928. dimensions: 'body',
  929. goal: self.userGoal.trim()
  930. }
  931. regenerateSection(params).then(function(res) {
  932. self.loading = false
  933. if (res && res.code === 200 && res.data) {
  934. self.sections[key].content = res.data.content || res.data
  935. if (res.data.tasks) {
  936. self.sections[key].tasks = res.data.tasks
  937. }
  938. uni.showToast({ title: '生成成功', icon: 'success' })
  939. } else {
  940. uni.showToast({ title: res && res.message ? res.message : '生成失败', icon: 'none' })
  941. }
  942. }).catch(function() {
  943. self.loading = false
  944. uni.showToast({ title: '请求失败', icon: 'none' })
  945. })
  946. },
  947. confirmCurrentSection: function() {
  948. var self = this
  949. self.sections[self.currentSectionKey].confirmed = true
  950. self.editing = false
  951. self.sectionFeedback = ''
  952. // 检查是否全部确认
  953. if (self.allConfirmed) {
  954. // 保持在 step 3,显示最终确认区域
  955. }
  956. },
  957. startEdit: function() {
  958. this.editing = true
  959. this.sectionFeedback = ''
  960. },
  961. exitEditMode: function() {
  962. this.editing = false
  963. this.sectionFeedback = ''
  964. },
  965. submitPlan: function() {
  966. var self = this
  967. self.loading = true
  968. var planJson = JSON.stringify({
  969. overview: self.planData.overview || '',
  970. sections: self.sectionKeys.map(function(key) {
  971. return { key: key, content: self.sections[key].content, items: self.sections[key].items || [], tasks: self.sections[key].tasks || [] }
  972. })
  973. })
  974. var saveData = {
  975. memberIds: self.selectedMemberIds.join(','),
  976. dimensions: 'body',
  977. goal: self.userGoal.trim(),
  978. planContent: self.buildPlanContent(),
  979. planJson: planJson,
  980. status: 'published'
  981. }
  982. saveHealthPlan(saveData).then(function(res) {
  983. self.loading = false
  984. if (res && res.code === 200) {
  985. uni.showToast({ title: '方案已生成', icon: 'none', duration: 2000 })
  986. setTimeout(function() { uni.navigateBack() }, 1200)
  987. self.taskSubmitted = true
  988. } else {
  989. uni.showToast({ title: res && res.message ? res.message : '保存失败', icon: 'none' })
  990. }
  991. }).catch(function() {
  992. self.loading = false
  993. uni.showToast({ title: '请求失败', icon: 'none' })
  994. })
  995. },
  996. buildPlanContent: function() {
  997. var sb = []
  998. if (this.planData.overview) {
  999. sb.push('## 方案概述\n\n' + this.planData.overview + '\n\n')
  1000. }
  1001. var titles = { nutrition: '营养补充建议', diet: '饮食建议', exercise: '运动计划' }
  1002. var self = this
  1003. this.sectionKeys.forEach(function(key) {
  1004. if (self.sections[key].content) {
  1005. sb.push('## ' + (titles[key] || key) + '\n\n' + self.sections[key].content + '\n\n')
  1006. }
  1007. })
  1008. return sb.join('')
  1009. },
  1010. goToTeacherService: function() {
  1011. uni.navigateTo({ url: '/pages/health/teacher-service' })
  1012. },
  1013. // ===== 查看模式 (保持原有) =====
  1014. loadPlanDetail: function() {
  1015. var self = this
  1016. getHealthPlanDetail({ planId: self.planId }).then(function(res) {
  1017. if (res && res.code === 200 && res.data) {
  1018. self.planDetail = res.data
  1019. self.userGoal = res.data.goal != null ? String(res.data.goal) : ''
  1020. if (res.data.memberIds) {
  1021. self.selectedMemberIds = res.data.memberIds.split(',').filter(function(id) { return id }).map(function(id) { return String(parseInt(id) || id) })
  1022. }
  1023. try {
  1024. var pj = JSON.parse(res.data.planJson || '{}')
  1025. if (pj.overview) self.planData.overview = pj.overview
  1026. if (pj.sections && pj.sections instanceof Array) {
  1027. pj.sections.forEach(function(sec) {
  1028. if (sec.key && self.sections[sec.key]) {
  1029. self.sections[sec.key].content = sec.content || ''
  1030. self.sections[sec.key].items = sec.items || []
  1031. self.sections[sec.key].confirmed = true
  1032. }
  1033. })
  1034. }
  1035. } catch (e) {
  1036. if (res.data.planContent) {
  1037. self.planData.overview = res.data.planContent.substring(0, 200)
  1038. }
  1039. }
  1040. }
  1041. }).catch(function() {
  1042. uni.showToast({ title: '方案加载失败', icon: 'none' })
  1043. setTimeout(function() { uni.navigateBack() }, 1500)
  1044. })
  1045. },
  1046. confirmPlanTasks: function() {
  1047. var self = this
  1048. if (!self.planId || self.confirmingTasks) return
  1049. self.confirmingTasks = true
  1050. uni.showLoading({ title: '正在分解任务...' })
  1051. confirmPlan({ planId: self.planId }).then(function(res) {
  1052. uni.hideLoading()
  1053. self.confirmingTasks = false
  1054. if (res && res.code === 200) {
  1055. // 同步当前查看成员为方案执行成员,便于首页/任务中心看到新任务
  1056. var planMemberId = self.getPlanMemberId(null)
  1057. if (planMemberId) {
  1058. uni.setStorageSync('currentMemberId', planMemberId)
  1059. uni.setStorageSync('currentChildId', planMemberId)
  1060. }
  1061. self.loadPlanDetail()
  1062. uni.showModal({
  1063. title: '提示',
  1064. content: '任务已生成,请前往首页-任务中打卡',
  1065. showCancel: false,
  1066. confirmText: '知道了'
  1067. })
  1068. } else {
  1069. uni.showToast({ title: (res && res.message) || '操作失败', icon: 'none' })
  1070. }
  1071. }).catch(function() {
  1072. uni.hideLoading()
  1073. self.confirmingTasks = false
  1074. uni.showToast({ title: '请求失败', icon: 'none' })
  1075. })
  1076. },
  1077. applyForTeacher: function() {
  1078. // 预留:申请规划师接口与业务待定
  1079. },
  1080. getPlanMemberId: function(item) {
  1081. if (item && item.familyMemberId) {
  1082. return item.familyMemberId
  1083. }
  1084. if (this.planDetail && this.planDetail.memberIds) {
  1085. var parts = this.planDetail.memberIds.split(',')
  1086. if (parts.length > 0 && parts[0]) {
  1087. return parseInt(parts[0]) || parts[0]
  1088. }
  1089. }
  1090. var stored = uni.getStorageSync('currentChildId') || uni.getStorageSync('currentMemberId')
  1091. return stored || null
  1092. },
  1093. completePlanTask: function(item) {
  1094. var self = this
  1095. if (!item || !item.id || item.status === 'completed' || item.status === 'pending_review') {
  1096. return
  1097. }
  1098. var memberId = self.getPlanMemberId(item)
  1099. if (!memberId) {
  1100. uni.showToast({ title: '未找到执行成员', icon: 'none' })
  1101. return
  1102. }
  1103. uni.showModal({
  1104. title: '完成任务',
  1105. content: '确定完成「' + item.title + '」吗?',
  1106. success: function(res) {
  1107. if (!res.confirm) return
  1108. completeTask(item.id, memberId, '').then(function(r) {
  1109. if (r && r.code === 200) {
  1110. var needReview = r.data && r.data.needReview
  1111. if (needReview) {
  1112. uni.showToast({ title: '已提交,待审核', icon: 'none' })
  1113. } else {
  1114. var points = (r.data && r.data.pointsEarned) || item.points || 0
  1115. uni.showToast({ title: '获得 ' + points + ' 积分', icon: 'success' })
  1116. }
  1117. self.loadPlanTasks()
  1118. } else {
  1119. uni.showToast({ title: (r && r.message) || '完成失败', icon: 'none' })
  1120. }
  1121. }).catch(function() {
  1122. uni.showToast({ title: '完成失败', icon: 'none' })
  1123. })
  1124. }
  1125. })
  1126. },
  1127. goToTaskCenter: function() {
  1128. uni.navigateTo({ url: '/pages/tasks/tasks' })
  1129. },
  1130. reCreate: function() {
  1131. this.step = 1
  1132. this.viewMode = false
  1133. this.planId = null
  1134. this.planDetail = null
  1135. this.taskSubmitted = false
  1136. this.editing = false
  1137. this.sectionFeedback = ''
  1138. this.selectedMemberIds = []
  1139. this.userGoal = ''
  1140. this.planData = {}
  1141. this.sections = {
  1142. nutrition: { content: '', confirmed: false },
  1143. diet: { content: '', confirmed: false },
  1144. exercise: { content: '', confirmed: false }
  1145. }
  1146. // 重置健康问卷
  1147. this.form = { heightCm: '', weightKg: '', bloodPressure: '', bloodGlucose: '', notes: '' }
  1148. this.lipidCholesterol = ''
  1149. this.selectedDiseases = []
  1150. this.diseaseInput = ''
  1151. this.medRows = [{ name: '', startDate: '', durationText: '', time: '' }]
  1152. this.expandedGroups = DISEASE_GROUPS.slice(0, 3).map(function(g) { return g.key })
  1153. this.memberFormMap = {}
  1154. this.activeFormMemberId = ''
  1155. this.pickerMembers = []
  1156. this.goalLen = 0
  1157. if (this.$refs.memberPicker && this.$refs.memberPicker.reload) {
  1158. this.$refs.memberPicker.reload()
  1159. }
  1160. },
  1161. goBack: function() {
  1162. uni.navigateBack()
  1163. }
  1164. }
  1165. }
  1166. </script>
  1167. <style scoped>
  1168. .plan-page {
  1169. min-height: 100vh;
  1170. background: #F5F7FA;
  1171. padding-bottom: 40rpx;
  1172. }
  1173. /* 步骤条 */
  1174. .steps-bar {
  1175. display: flex;
  1176. align-items: center;
  1177. padding: 24rpx 20rpx;
  1178. background: #fff;
  1179. margin-bottom: 4rpx;
  1180. overflow-x: auto;
  1181. }
  1182. .step {
  1183. display: flex;
  1184. flex-direction: column;
  1185. align-items: center;
  1186. flex-shrink: 0;
  1187. min-width: 80rpx;
  1188. }
  1189. .step-num {
  1190. width: 44rpx;
  1191. height: 44rpx;
  1192. border-radius: 22rpx;
  1193. background: #e0e0e0;
  1194. color: #999;
  1195. font-size: 24rpx;
  1196. font-weight: bold;
  1197. display: flex;
  1198. align-items: center;
  1199. justify-content: center;
  1200. transition: all 0.3s;
  1201. }
  1202. .step.active .step-num { background: #F97316; color: #fff; }
  1203. .step.done .step-num { background: #4CAF50; color: #fff; }
  1204. .step-label {
  1205. font-size: 20rpx;
  1206. color: #999;
  1207. white-space: nowrap;
  1208. margin-top: 4rpx;
  1209. }
  1210. .step.active .step-label, .step.done .step-label { color: #333; font-weight: 500; }
  1211. /* 通用区块 */
  1212. .section {
  1213. margin: 20rpx 30rpx;
  1214. background: #fff;
  1215. border-radius: 20rpx;
  1216. padding: 28rpx;
  1217. box-shadow: 0 2rpx 12rpx rgba(0,0,0,0.06);
  1218. }
  1219. .section-title-row {
  1220. display: flex;
  1221. align-items: center;
  1222. justify-content: space-between;
  1223. margin-bottom: 10rpx;
  1224. }
  1225. .section-title {
  1226. font-size: 30rpx;
  1227. font-weight: bold;
  1228. color: #333;
  1229. }
  1230. .section-badge {
  1231. font-size: 22rpx;
  1232. color: #F97316;
  1233. background: #FFF3E0;
  1234. padding: 4rpx 16rpx;
  1235. border-radius: 20rpx;
  1236. }
  1237. .hint-text {
  1238. font-size: 24rpx;
  1239. color: #999;
  1240. margin-bottom: 20rpx;
  1241. }
  1242. /* 成员选择 chips(与 report-list 同模式) */
  1243. .member-scroll {
  1244. width: 100%;
  1245. white-space: nowrap;
  1246. margin-bottom: 16rpx;
  1247. }
  1248. .member-chips {
  1249. display: inline-flex;
  1250. flex-direction: row;
  1251. padding: 4rpx 0;
  1252. }
  1253. .member-chip {
  1254. display: inline-flex;
  1255. align-items: center;
  1256. justify-content: center;
  1257. padding: 12rpx 28rpx;
  1258. margin-right: 16rpx;
  1259. border-radius: 32rpx;
  1260. background: #F1F5F9;
  1261. border: 2rpx solid transparent;
  1262. }
  1263. .member-chip-on {
  1264. background: #FFF7ED;
  1265. border-color: #F97316;
  1266. }
  1267. .member-chip-text {
  1268. font-size: 26rpx;
  1269. color: #334155;
  1270. font-weight: 600;
  1271. }
  1272. .member-chip-on .member-chip-text {
  1273. color: #F97316;
  1274. }
  1275. /* 目标输入 */
  1276. .goal-textarea {
  1277. width: 100%;
  1278. min-height: 320rpx;
  1279. font-size: 28rpx;
  1280. color: #333;
  1281. background: #F5F7FA;
  1282. border: none;
  1283. border-radius: 16rpx;
  1284. padding: 24rpx 28rpx;
  1285. line-height: 1.7;
  1286. box-sizing: border-box;
  1287. }
  1288. .goal-footer {
  1289. display: flex;
  1290. align-items: center;
  1291. justify-content: space-between;
  1292. margin-top: 20rpx;
  1293. }
  1294. .goal-count { font-size: 24rpx; color: #bbb; }
  1295. .goal-footer .btn-next {
  1296. width: auto;
  1297. min-width: 200rpx;
  1298. height: 72rpx;
  1299. line-height: 72rpx;
  1300. padding: 0 48rpx;
  1301. border-radius: 36rpx;
  1302. font-size: 28rpx;
  1303. }
  1304. /* 按钮 */
  1305. .btn-next, .btn-confirm, .btn-edit, .btn-done, .btn-teacher, .btn-skip, .btn-generate {
  1306. width: 100%;
  1307. height: 88rpx;
  1308. line-height: 88rpx;
  1309. border-radius: 44rpx;
  1310. border: none;
  1311. font-size: 30rpx;
  1312. text-align: center;
  1313. }
  1314. .btn-next, .btn-confirm, .btn-done, .btn-generate {
  1315. background: linear-gradient(135deg, #F97316, #FB923C);
  1316. color: #fff;
  1317. }
  1318. .btn-next[disabled], .btn-confirm[disabled], .btn-generate[disabled] { opacity: 0.4; }
  1319. .btn-edit {
  1320. background: #fff;
  1321. color: #F97316;
  1322. font-size: 28rpx;
  1323. border: 2rpx solid #F97316;
  1324. margin-bottom: 16rpx;
  1325. }
  1326. .btn-teacher {
  1327. background: #fff;
  1328. color: #3B82F6;
  1329. border: 2rpx solid #3B82F6;
  1330. }
  1331. .btn-skip {
  1332. background: #fff;
  1333. color: #999;
  1334. border: 2rpx solid #E5E7EB;
  1335. }
  1336. .full-btn { margin-top: 20rpx; }
  1337. /* 并排按钮容器 */
  1338. .btn-pair {
  1339. display: flex;
  1340. gap: 16rpx;
  1341. margin-top: 20rpx;
  1342. }
  1343. .btn-pair .btn-confirm,
  1344. .btn-pair .btn-teacher,
  1345. .btn-pair .btn-skip,
  1346. .btn-pair .btn-generate {
  1347. flex: 1;
  1348. margin-top: 0;
  1349. }
  1350. /* 加载状态 */
  1351. .loading-state {
  1352. display: flex;
  1353. flex-direction: column;
  1354. align-items: center;
  1355. padding: 80rpx 20rpx;
  1356. }
  1357. .loading-icon { font-size: 80rpx; margin-bottom: 20rpx; }
  1358. .loading-text { font-size: 30rpx; color: #333; margin-bottom: 8rpx; }
  1359. .loading-hint { font-size: 24rpx; color: #999; }
  1360. /* 总览卡片 */
  1361. .overview-card {
  1362. background: #FFF7ED;
  1363. border-radius: 16rpx;
  1364. padding: 24rpx;
  1365. border-left: 4rpx solid #F97316;
  1366. margin-bottom: 20rpx;
  1367. }
  1368. .overview-text {
  1369. font-size: 28rpx;
  1370. color: #555;
  1371. line-height: 1.8;
  1372. }
  1373. /* section 预览列表 */
  1374. .section-preview-list {
  1375. display: flex;
  1376. flex-direction: column;
  1377. gap: 16rpx;
  1378. margin: 20rpx 0;
  1379. }
  1380. .section-preview-item {
  1381. display: flex;
  1382. align-items: center;
  1383. gap: 16rpx;
  1384. padding: 20rpx;
  1385. background: #FAFAFA;
  1386. border-radius: 16rpx;
  1387. border: 2rpx solid #eee;
  1388. }
  1389. .sec-icon { font-size: 40rpx; }
  1390. .sec-info { flex: 1; }
  1391. .sec-title { font-size: 28rpx; color: #333; font-weight: 600; display: block; }
  1392. .sec-status { font-size: 22rpx; color: #999; }
  1393. .sec-status.done { color: #4CAF50; }
  1394. .sec-arrow { color: #ccc; font-size: 28rpx; }
  1395. /* content 展示/编辑 */
  1396. .content-display {
  1397. background: #F5F7FA;
  1398. border-radius: 16rpx;
  1399. padding: 24rpx;
  1400. margin-bottom: 20rpx;
  1401. }
  1402. .content-text {
  1403. font-size: 28rpx;
  1404. color: #333;
  1405. line-height: 1.8;
  1406. white-space: pre-wrap;
  1407. word-break: break-all;
  1408. }
  1409. .edit-textarea {
  1410. width: 100%;
  1411. min-height: 300rpx;
  1412. font-size: 28rpx;
  1413. color: #333;
  1414. background: #F5F7FA;
  1415. border: 2rpx solid #F97316;
  1416. border-radius: 16rpx;
  1417. padding: 20rpx 24rpx;
  1418. line-height: 1.7;
  1419. box-sizing: border-box;
  1420. margin-bottom: 16rpx;
  1421. }
  1422. .feedback-input {
  1423. width: 100%;
  1424. height: 80rpx;
  1425. background: #FFF7ED;
  1426. border: 2rpx solid #F97316;
  1427. border-radius: 40rpx;
  1428. padding: 0 24rpx;
  1429. font-size: 26rpx;
  1430. color: #333;
  1431. box-sizing: border-box;
  1432. }
  1433. .section-actions {
  1434. display: flex;
  1435. gap: 16rpx;
  1436. margin-top: 16rpx;
  1437. }
  1438. .section-actions .btn-edit, .section-actions .btn-confirm {
  1439. flex: 1;
  1440. margin-bottom: 0;
  1441. }
  1442. .back-link {
  1443. text-align: center;
  1444. font-size: 26rpx;
  1445. color: #999;
  1446. margin-top: 20rpx;
  1447. }
  1448. .back-link:active { opacity: 0.7; }
  1449. /* 最终确认 */
  1450. .final-review {
  1451. display: flex;
  1452. flex-direction: column;
  1453. gap: 16rpx;
  1454. margin: 20rpx 0;
  1455. }
  1456. .review-item {
  1457. background: #FAFAFA;
  1458. border-radius: 16rpx;
  1459. padding: 20rpx;
  1460. border: 2rpx solid #eee;
  1461. }
  1462. .review-title {
  1463. font-size: 28rpx;
  1464. font-weight: 600;
  1465. color: #333;
  1466. display: block;
  1467. margin-bottom: 8rpx;
  1468. }
  1469. .review-preview {
  1470. font-size: 24rpx;
  1471. color: #888;
  1472. line-height: 1.6;
  1473. }
  1474. /* 查看模式 */
  1475. .plan-view-section { margin-top: 0; }
  1476. .plan-meta {
  1477. display: flex;
  1478. flex-direction: column;
  1479. gap: 6rpx;
  1480. padding: 16rpx 20rpx;
  1481. background: #FFF7ED;
  1482. border-radius: 12rpx;
  1483. margin-bottom: 20rpx;
  1484. }
  1485. .plan-meta-item { font-size: 24rpx; color: #92400E; }
  1486. .plan-preview {
  1487. background: #F5F7FA;
  1488. border-radius: 16rpx;
  1489. padding: 24rpx;
  1490. margin-bottom: 20rpx;
  1491. }
  1492. .plan-preview-text {
  1493. font-size: 28rpx;
  1494. color: #333;
  1495. line-height: 1.8;
  1496. white-space: pre-wrap;
  1497. }
  1498. .plan-confirm-actions {
  1499. margin-bottom: 20rpx;
  1500. }
  1501. /* 成功遮罩 */
  1502. .success-overlay {
  1503. position: fixed;
  1504. top: 0; left: 0; right: 0; bottom: 0;
  1505. background: rgba(0,0,0,0.55);
  1506. display: flex;
  1507. align-items: center;
  1508. justify-content: center;
  1509. z-index: 100;
  1510. }
  1511. .success-card {
  1512. background: #fff;
  1513. border-radius: 32rpx;
  1514. padding: 60rpx 48rpx;
  1515. display: flex;
  1516. flex-direction: column;
  1517. align-items: center;
  1518. width: 560rpx;
  1519. }
  1520. .success-icon { font-size: 100rpx; color: #4CAF50; margin-bottom: 20rpx; }
  1521. .success-title { font-size: 36rpx; font-weight: bold; color: #333; margin-bottom: 12rpx; }
  1522. .success-sub { font-size: 28rpx; color: #888; margin-bottom: 40rpx; }
  1523. /* ===== 多成员调研 tab 页签 ===== */
  1524. .member-tabs {
  1525. display: flex;
  1526. flex-wrap: wrap;
  1527. gap: 16rpx;
  1528. margin-bottom: 16rpx;
  1529. }
  1530. .member-tab {
  1531. padding: 14rpx 32rpx;
  1532. border-radius: 32rpx;
  1533. background: #F1F5F9;
  1534. border: 2rpx solid transparent;
  1535. font-size: 26rpx;
  1536. color: #334155;
  1537. font-weight: 500;
  1538. transition: all 0.2s;
  1539. }
  1540. .member-tab.active {
  1541. background: #FFF7ED;
  1542. border-color: #F97316;
  1543. color: #F97316;
  1544. font-weight: 600;
  1545. }
  1546. .form-member-hint {
  1547. display: flex;
  1548. align-items: center;
  1549. justify-content: space-between;
  1550. margin-bottom: 20rpx;
  1551. padding: 16rpx 20rpx;
  1552. background: #FFF7ED;
  1553. border-radius: 12rpx;
  1554. }
  1555. .form-member-label {
  1556. font-size: 26rpx;
  1557. color: #92400E;
  1558. font-weight: 600;
  1559. }
  1560. .form-member-save {
  1561. font-size: 22rpx;
  1562. color: #B45309;
  1563. }
  1564. /* ===== 健康问卷样式 (从 health-status-form.vue 移植) ===== */
  1565. .form-section {
  1566. margin: 0 0 24rpx;
  1567. background: #fff;
  1568. border-radius: 16rpx;
  1569. padding: 24rpx;
  1570. }
  1571. .form-title {
  1572. font-size: 30rpx;
  1573. font-weight: bold;
  1574. color: #333;
  1575. margin-bottom: 20rpx;
  1576. }
  1577. .form-row {
  1578. display: flex;
  1579. align-items: center;
  1580. justify-content: space-between;
  1581. margin-bottom: 20rpx;
  1582. }
  1583. .form-label {
  1584. font-size: 28rpx;
  1585. color: #555;
  1586. }
  1587. .form-input {
  1588. flex: 1;
  1589. margin-left: 30rpx;
  1590. height: 68rpx;
  1591. background: #F5F7FA;
  1592. border-radius: 10rpx;
  1593. padding: 0 20rpx;
  1594. font-size: 28rpx;
  1595. text-align: right;
  1596. }
  1597. /* 疾病标签 */
  1598. .disease-group { margin-bottom: 8rpx; }
  1599. .group-head {
  1600. display: flex;
  1601. align-items: center;
  1602. justify-content: space-between;
  1603. padding: 12rpx 0;
  1604. }
  1605. .group-title { font-size: 28rpx; font-weight: bold; color: #333; }
  1606. .group-arrow { font-size: 24rpx; color: #999; }
  1607. .risk-badge { margin-left: 6rpx; color: #E64340; font-size: 24rpx; }
  1608. .tag-wrap { display: flex; flex-wrap: wrap; }
  1609. .tag-item {
  1610. padding: 12rpx 24rpx;
  1611. background: #F5F7FA;
  1612. border-radius: 30rpx;
  1613. font-size: 26rpx;
  1614. color: #666;
  1615. margin: 0 16rpx 16rpx 0;
  1616. }
  1617. .tag-active { background: #F97316; color: #fff; }
  1618. /* 已选疾病 */
  1619. .selected-area { margin-top: 16rpx; padding: 16rpx; background: #FFF7E6; border-radius: 12rpx; }
  1620. .selected-title { font-size: 26rpx; color: #8A6D3B; margin-bottom: 8rpx; }
  1621. .sel-row {
  1622. display: flex;
  1623. align-items: center;
  1624. justify-content: space-between;
  1625. padding: 10rpx 0;
  1626. border-bottom: 1rpx solid #F0E6D0;
  1627. }
  1628. .sel-name { font-size: 28rpx; color: #333; flex: 1; }
  1629. .sel-diag { font-size: 26rpx; color: #F97316; }
  1630. .sel-del { font-size: 30rpx; color: #E64340; margin-left: 16rpx; }
  1631. /* 自定义疾病输入 */
  1632. .custom-row { display: flex; align-items: center; margin-top: 8rpx; }
  1633. .custom-input {
  1634. flex: 1;
  1635. height: 64rpx;
  1636. background: #F5F7FA;
  1637. border-radius: 10rpx;
  1638. padding: 0 20rpx;
  1639. font-size: 26rpx;
  1640. margin-right: 20rpx;
  1641. }
  1642. .add-link { font-size: 28rpx; color: #F97316; }
  1643. /* 药物行 */
  1644. .med-row {
  1645. border: 1rpx solid #F0F0F0;
  1646. border-radius: 12rpx;
  1647. padding: 16rpx;
  1648. margin-bottom: 16rpx;
  1649. }
  1650. .med-line {
  1651. display: flex;
  1652. align-items: center;
  1653. margin-bottom: 12rpx;
  1654. }
  1655. .med-line:last-child { margin-bottom: 0; }
  1656. .med-name {
  1657. flex: 1;
  1658. height: 64rpx;
  1659. background: #F5F7FA;
  1660. border-radius: 10rpx;
  1661. padding: 0 16rpx;
  1662. font-size: 26rpx;
  1663. margin-right: 12rpx;
  1664. }
  1665. .med-picker {
  1666. font-size: 26rpx;
  1667. color: #F97316;
  1668. padding: 8rpx 16rpx;
  1669. background: #F5F7FA;
  1670. border-radius: 10rpx;
  1671. }
  1672. .med-forget { font-size: 26rpx; color: #999; margin-left: 16rpx; }
  1673. .med-duration { font-size: 26rpx; color: #8A6D3B; }
  1674. .med-time {
  1675. flex: 1;
  1676. height: 64rpx;
  1677. background: #F5F7FA;
  1678. border-radius: 10rpx;
  1679. padding: 0 16rpx;
  1680. font-size: 26rpx;
  1681. margin-right: 12rpx;
  1682. }
  1683. .med-del { font-size: 26rpx; color: #E64340; }
  1684. /* 备注 */
  1685. .notes-area {
  1686. width: 100%;
  1687. height: 160rpx;
  1688. background: #F5F7FA;
  1689. border-radius: 10rpx;
  1690. padding: 16rpx 20rpx;
  1691. font-size: 26rpx;
  1692. box-sizing: border-box;
  1693. }
  1694. /* 空状态 */
  1695. .empty-state {
  1696. width: 100%;
  1697. display: flex;
  1698. flex-direction: column;
  1699. align-items: center;
  1700. padding: 40rpx 0 24rpx;
  1701. box-sizing: border-box;
  1702. }
  1703. .empty-text { font-size: 26rpx; color: #999; }
  1704. .member-load-hint {
  1705. font-size: 22rpx;
  1706. color: #F97316;
  1707. margin-bottom: 12rpx;
  1708. }
  1709. .empty-action {
  1710. margin-top: 20rpx;
  1711. padding: 12rpx 32rpx;
  1712. font-size: 26rpx;
  1713. color: #F97316;
  1714. border: 2rpx solid #F97316;
  1715. border-radius: 32rpx;
  1716. }
  1717. </style>