report-upload.vue 27 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004
  1. <template>
  2. <view class="upload-container">
  3. <!-- 顶部导航 -->
  4. <view class="nav-bar">
  5. <text class="nav-back" @click="goBack">‹ 返回</text>
  6. <text class="nav-title">上传健康报告</text>
  7. <view class="nav-placeholder"></view>
  8. </view>
  9. <!-- 说明提示 -->
  10. <view class="tip-banner">
  11. <text class="tip-icon">📋</text>
  12. <text class="tip-text">上传体检报告或肠道检测报告,AI 将为您解读并提供个性化营养方案</text>
  13. </view>
  14. <!-- PDF解析预览(提取到信息时显示) -->
  15. <view class="parsed-preview" v-if="parsedInfo">
  16. <view class="parsed-title">PDF解析结果</view>
  17. <view class="parsed-row" v-if="parsedInfo.personName">
  18. <text class="parsed-label">被检测人</text>
  19. <text class="parsed-value">{{ parsedInfo.personName }}</text>
  20. </view>
  21. <view class="parsed-row" v-if="parsedInfo.reportNumber">
  22. <text class="parsed-label">报告编号</text>
  23. <text class="parsed-value">{{ parsedInfo.reportNumber }}</text>
  24. </view>
  25. <view class="parsed-row" v-if="parsedInfo.reportDate">
  26. <text class="parsed-label">报告日期</text>
  27. <text class="parsed-value">{{ parsedInfo.reportDate }}</text>
  28. </view>
  29. <!-- 匹配状态 -->
  30. <view class="match-status" v-if="parsedInfo.needManualSelect">
  31. <text class="match-icon">⚠️</text>
  32. <text class="match-text">无法自动匹配到家庭成员,请手动选择</text>
  33. </view>
  34. <view class="match-status success" v-else-if="parsedInfo.matchedMemberName">
  35. <text class="match-icon">✅</text>
  36. <text class="match-text">已自动匹配: {{ parsedInfo.matchedMemberName }}</text>
  37. </view>
  38. </view>
  39. <!-- 家庭成员选择器(需要手动选择时显示) -->
  40. <view class="form-item member-selector" v-if="showMemberSelector">
  41. <text class="form-label">选择成员</text>
  42. <view class="member-list">
  43. <view
  44. class="member-item"
  45. v-for="member in familyMembers"
  46. :key="member.id"
  47. :class="{ 'member-selected': selectedMemberId === (member.userId || member.id) }"
  48. @click="selectMember(member)"
  49. >
  50. <text class="member-avatar">{{ member.nickname ? member.nickname.substring(0, 1) : '?' }}</text>
  51. <text class="member-name">{{ member.nickname || '未知' }}</text>
  52. </view>
  53. </view>
  54. <view class="add-member-btn" v-if="parsedInfo && parsedInfo.personName" @click="chooseRelationAndAdd">
  55. <text class="add-member-text">+ 将「{{ parsedInfo.personName }}」添加为新成员</text>
  56. </view>
  57. </view>
  58. <!-- 表单 -->
  59. <view class="form-section">
  60. <!-- 上传方式:两个入口 -->
  61. <view class="form-item">
  62. <text class="form-label">上传方式</text>
  63. <view class="upload-type-row">
  64. <view class="upload-type-card" @click="pickFile">
  65. <text class="upload-type-icon">📄</text>
  66. <text class="upload-type-name">上传文件</text>
  67. <text class="upload-type-hint">PDF / 图片</text>
  68. </view>
  69. <view class="upload-type-card" @click="takePhoto">
  70. <text class="upload-type-icon">📷</text>
  71. <text class="upload-type-name">拍照上传</text>
  72. <text class="upload-type-hint">舌象 / 报告照片</text>
  73. </view>
  74. </view>
  75. </view>
  76. <!-- 购买推荐 -->
  77. <view class="purchase-section" v-if="recommendedProducts.length > 0">
  78. <view class="purchase-header">
  79. <text class="purchase-icon">📦</text>
  80. <text class="purchase-title">为家人购买检测服务</text>
  81. </view>
  82. <scroll-view class="purchase-scroll" scroll-x enable-flex show-scrollbar="false">
  83. <view
  84. class="purchase-card"
  85. v-for="item in recommendedProducts"
  86. :key="item.id"
  87. @click="goToProduct(item.id)"
  88. >
  89. <image class="purchase-cover" :src="item.coverImage || '/static/default-product.png'" mode="aspectFill" />
  90. <text class="purchase-name">{{ item.name }}</text>
  91. <text class="purchase-price">{{ formatPriceWithSymbol(item.price) }}</text>
  92. <view class="purchase-btn">
  93. <text class="purchase-btn-text">去购买</text>
  94. </view>
  95. </view>
  96. </scroll-view>
  97. </view>
  98. <!-- 已选文件 -->
  99. <view class="form-item" v-if="selectedFile || photoPath">
  100. <text class="form-label">已选文件</text>
  101. <view class="file-info">
  102. <text class="file-name">{{ selectedFile ? (selectedFile.name || '文件') : '照片' }}</text>
  103. <text class="file-size" v-if="selectedFile && selectedFile.size">{{ formatFileSize(selectedFile.size) }}</text>
  104. <text class="file-remove" @click.stop="removeFile">移除</text>
  105. </view>
  106. </view>
  107. <!-- 上传中/分析中 -->
  108. <view class="form-item" v-if="parsingPreview">
  109. <text class="form-label">AI分析中...</text>
  110. <view class="analyzing-status">
  111. <text class="analyzing-text">正在解析文件内容,请稍候...</text>
  112. </view>
  113. </view>
  114. <!-- 备注 -->
  115. <view class="form-item">
  116. <text class="form-label">备注(选填)</text>
  117. <textarea
  118. class="note-input"
  119. v-model="form.description"
  120. placeholder="请输入报告摘要或备注信息..."
  121. maxlength="500"
  122. />
  123. </view>
  124. <!-- 提交按钮 -->
  125. <view class="submit-btn" :class="{ 'btn-disabled': !canSubmit }" @click="doSubmit">
  126. <text v-if="parsingPreview">解析中...</text>
  127. <text v-else-if="submitting">提交中...</text>
  128. <text v-else>提交报告</text>
  129. </view>
  130. </view>
  131. <!-- 底部占位 -->
  132. <view class="bottom-spacer"></view>
  133. </view>
  134. </template>
  135. <script>
  136. import { productList, getFamilyMembers, addFamilyMember } from '../../utils/api.js'
  137. export default {
  138. data() {
  139. return {
  140. childId: null,
  141. familyId: null,
  142. form: {
  143. reportDate: '',
  144. overallScore: 0,
  145. description: ''
  146. },
  147. submitting: false,
  148. selectedFile: null,
  149. parsingPreview: false,
  150. parsedInfo: null,
  151. showMemberSelector: false,
  152. selectedMemberId: null,
  153. familyMembers: [],
  154. // 拍照
  155. photoPath: null,
  156. // 购买推荐
  157. recommendedProducts: [],
  158. loadingProducts: false
  159. }
  160. },
  161. computed: {
  162. canSubmit() {
  163. if (this.parsingPreview) return false
  164. if (this.selectedFile || this.photoPath) {
  165. // 文件已选且解析成功(有draftId且不需要手动选成员)
  166. return this.parsedInfo && this.parsedInfo.draftId && !this.parsedInfo.needManualSelect
  167. }
  168. return false
  169. }
  170. },
  171. onLoad: function(options) {
  172. this.childId = options.childId ? parseInt(options.childId) : null
  173. this.loadRecommendProducts()
  174. },
  175. onShow: function() {
  176. // 每次显示时从store获取familyId和家庭成员
  177. this.loadFamilyInfo()
  178. },
  179. methods: {
  180. loadFamilyInfo() {
  181. var self = this
  182. // 从Vuex获取familyId和家庭成员
  183. var userInfo = uni.getStorageSync('userInfo')
  184. if (userInfo) {
  185. try {
  186. var info = typeof userInfo === 'string' ? JSON.parse(userInfo) : userInfo
  187. this.familyId = info.familyId || null
  188. // 加载家庭成员列表(从本地存储或请求)
  189. var storedMembers = uni.getStorageSync('familyMembers')
  190. if (storedMembers) {
  191. try {
  192. this.familyMembers = typeof storedMembers === 'string' ? JSON.parse(storedMembers) : storedMembers
  193. } catch (e) {
  194. this.familyMembers = []
  195. }
  196. }
  197. } catch (e) {
  198. console.log('解析userInfo失败', e)
  199. }
  200. }
  201. },
  202. // ===== 拍照上传 =====
  203. takePhoto() {
  204. var self = this
  205. uni.chooseImage({
  206. count: 1,
  207. sourceType: ['camera', 'album'],
  208. success: function(res) {
  209. self.photoPath = res.tempFilePaths[0]
  210. // 拍照后直接解析
  211. if (self.familyId) {
  212. self.previewParse()
  213. }
  214. }
  215. })
  216. },
  217. // ===== 文件上传 =====
  218. pickFile() {
  219. var self = this
  220. // 重置解析状态
  221. this.parsedInfo = null
  222. this.showMemberSelector = false
  223. this.selectedMemberId = null
  224. this.form.reportDate = ''
  225. this.form.overallScore = 0
  226. this.photoPath = null
  227. // 从微信聊天记录中选择文件
  228. uni.chooseMessageFile({
  229. count: 1,
  230. type: 'file',
  231. extension: ['pdf'],
  232. success: function(res) {
  233. var files = res.tempFiles
  234. if (files && files.length > 0) {
  235. self.selectedFile = files[0]
  236. if (self.familyId) {
  237. self.previewParse()
  238. }
  239. }
  240. },
  241. fail: function(e) {
  242. console.log('选择文件取消或失败', e)
  243. }
  244. })
  245. },
  246. previewParse() {
  247. var self = this
  248. if (!this.familyId) return
  249. var filePath = this.selectedFile ? this.selectedFile.path : this.photoPath
  250. if (!filePath) return
  251. this.parsingPreview = true
  252. var apiPath = getApp().globalData.baseUrl + '/api/health/report/parse-preview'
  253. if (self.selectedFile) {
  254. // PDF文件上传
  255. uni.uploadFile({
  256. url: apiPath + (self.childId ? '?memberId=' + self.childId : ''),
  257. filePath: filePath,
  258. name: 'file',
  259. header: {
  260. 'Authorization': 'Bearer ' + (uni.getStorageSync('token') || '')
  261. },
  262. success: function(uploadRes) {
  263. var data = JSON.parse(uploadRes.data)
  264. if (data.code === 200 && data.data) {
  265. self.handleParsedResult(data.data)
  266. } else {
  267. self.parsingPreview = false
  268. uni.showToast({ title: data.message || '解析失败', icon: 'none' })
  269. }
  270. },
  271. fail: function() {
  272. self.parsingPreview = false
  273. uni.showToast({ title: '上传失败', icon: 'none' })
  274. }
  275. })
  276. } else if (self.photoPath) {
  277. // 图片上传
  278. uni.uploadFile({
  279. url: apiPath + '?type=image' + (self.childId ? '&memberId=' + self.childId : ''),
  280. filePath: filePath,
  281. name: 'file',
  282. header: {
  283. 'Authorization': 'Bearer ' + (uni.getStorageSync('token') || '')
  284. },
  285. success: function(uploadRes) {
  286. var data = JSON.parse(uploadRes.data)
  287. if (data.code === 200 && data.data) {
  288. self.handleParsedResult(data.data)
  289. } else {
  290. self.parsingPreview = false
  291. uni.showToast({ title: data.message || '解析失败', icon: 'none' })
  292. }
  293. },
  294. fail: function() {
  295. self.parsingPreview = false
  296. uni.showToast({ title: '上传失败', icon: 'none' })
  297. }
  298. })
  299. }
  300. },
  301. handleParsedResult: function(detail) {
  302. this.parsingPreview = false
  303. this.parsedInfo = {
  304. draftId: detail.draftId,
  305. personName: detail.extractedName || '',
  306. extractedGender: detail.extractedGender || '',
  307. extractedAge: detail.extractedAge || '',
  308. reportNumber: detail.extractedReportNumber,
  309. reportDate: detail.extractedReportDate,
  310. needManualSelect: detail.needBind,
  311. payload: detail.payload || {},
  312. matchedMemberId: detail.matchedMemberId,
  313. confidence: detail.confidence,
  314. matchLabel: detail.matchLabel,
  315. candidates: detail.candidates || []
  316. }
  317. if (detail.extractedReportDate) {
  318. this.form.reportDate = detail.extractedReportDate
  319. }
  320. if (detail.needBind) {
  321. this.showMemberSelector = true
  322. this.loadFamilyMembers()
  323. if (this.parsedInfo.personName) {
  324. this.promptAddParsedMember()
  325. }
  326. }
  327. },
  328. loadFamilyMembers() {
  329. var self = this
  330. // 从后端获取真实家庭成员(家长 + 孩子),storage 中并无该数据
  331. getFamilyMembers().then(function(res) {
  332. var data = (res && res.data) || {}
  333. var parents = (data.parents || []).map(function(p) {
  334. return { id: p.id, nickname: p.realName || p.nickname, gender: p.gender, role: 'parent' }
  335. })
  336. var children = (data.children || []).map(function(c) {
  337. return { id: c.id, nickname: c.nickname, gender: c.gender, age: c.age, role: 'child' }
  338. })
  339. self.familyMembers = parents.concat(children)
  340. }).catch(function(e) {
  341. console.log('加载家庭成员失败', e)
  342. self.familyMembers = []
  343. })
  344. },
  345. selectMember(member) {
  346. this.selectedMemberId = member.id || member.userId
  347. this.parsedInfo = this.parsedInfo || {}
  348. // 手动选择的成员通过 matchedMemberId 传递给确认页
  349. this.parsedInfo.matchedMemberId = this.selectedMemberId
  350. this.parsedInfo.needManualSelect = false
  351. this.showMemberSelector = false
  352. },
  353. genderText(gender) {
  354. if (gender === 'male') return '男'
  355. if (gender === 'female') return '女'
  356. return ''
  357. },
  358. // 询问是否将解析到的人添加为家庭成员
  359. promptAddParsedMember() {
  360. var self = this
  361. if (!this.parsedInfo || !this.parsedInfo.personName) return
  362. var name = this.parsedInfo.personName
  363. var desc = name
  364. var extra = []
  365. var g = this.genderText(this.parsedInfo.extractedGender)
  366. if (g) extra.push(g)
  367. if (this.parsedInfo.extractedAge) extra.push(this.parsedInfo.extractedAge + '岁')
  368. if (extra.length > 0) desc = name + '(' + extra.join(',') + ')'
  369. uni.showModal({
  370. title: '未匹配到家庭成员',
  371. content: '是否将解析到的「' + desc + '」添加为家庭成员?',
  372. confirmText: '添加',
  373. cancelText: '手动选择',
  374. success: function(res) {
  375. if (res.confirm) {
  376. self.chooseRelationAndAdd()
  377. }
  378. // 取消则保留下方的手动选择列表
  379. }
  380. })
  381. },
  382. // 选择新成员与家庭的关系(后端要求辈分必填)后添加
  383. chooseRelationAndAdd() {
  384. var self = this
  385. var relOptions = [
  386. { label: '孩子', generationLevel: 'child' },
  387. { label: '配偶', generationLevel: 'peer', peerType: 'spouse' },
  388. { label: '父母', generationLevel: 'parent' },
  389. { label: '兄弟姐妹', generationLevel: 'peer', peerType: 'sibling' },
  390. { label: '祖父母', generationLevel: 'grandparent' }
  391. ]
  392. uni.showActionSheet({
  393. itemList: relOptions.map(function(o) { return o.label }),
  394. success: function(res) {
  395. var rel = relOptions[res.tapIndex]
  396. if (rel) {
  397. self.doAddParsedMember(rel)
  398. }
  399. }
  400. })
  401. },
  402. // 调用后端添加成员,并将其作为本次报告对象
  403. doAddParsedMember(rel) {
  404. var self = this
  405. var name = this.parsedInfo.personName
  406. var dto = {
  407. nickname: name,
  408. gender: this.parsedInfo.extractedGender || '',
  409. generationLevel: rel.generationLevel
  410. }
  411. if (rel.peerType) dto.peerType = rel.peerType
  412. // 由年龄推算大致出生年份(用于展示,用户后续可修改)
  413. var age = parseInt(this.parsedInfo.extractedAge)
  414. if (!isNaN(age) && age > 0 && age < 130) {
  415. dto.birthday = (new Date().getFullYear() - age) + '-01-01'
  416. }
  417. uni.showLoading({ title: '添加成员...' })
  418. addFamilyMember(dto).then(function(res) {
  419. uni.hideLoading()
  420. if (res && res.code === 200) {
  421. var newId = res.data && (res.data.id || res.data.userId)
  422. self.selectedMemberId = newId
  423. self.parsedInfo.matchedMemberId = newId
  424. self.parsedInfo.matchedMemberName = name
  425. self.parsedInfo.needManualSelect = false
  426. self.showMemberSelector = false
  427. self.loadFamilyMembers()
  428. uni.showToast({ title: '已添加并选中', icon: 'success' })
  429. } else {
  430. uni.showToast({ title: (res && res.message) || '添加失败', icon: 'none' })
  431. }
  432. }).catch(function(e) {
  433. uni.hideLoading()
  434. console.log('添加成员失败', e)
  435. uni.showToast({ title: '添加失败,请重试', icon: 'none' })
  436. })
  437. },
  438. removeFile() {
  439. this.selectedFile = null
  440. this.photoPath = null
  441. this.parsedInfo = null
  442. this.showMemberSelector = false
  443. this.selectedMemberId = null
  444. this.form.reportDate = ''
  445. this.form.overallScore = 0
  446. },
  447. loadRecommendProducts: function() {
  448. var self = this
  449. self.loadingProducts = true
  450. productList({ domain: 'body', productType: 'assessment', size: 4 }).then(function(res) {
  451. if (res && res.data && res.data.records) {
  452. self.recommendedProducts = res.data.records
  453. } else {
  454. self.recommendedProducts = []
  455. }
  456. }).catch(function() {
  457. self.recommendedProducts = []
  458. }).finally(function() {
  459. self.loadingProducts = false
  460. })
  461. },
  462. goToProduct: function(productId) {
  463. uni.navigateTo({ url: '/pages/discover/product-detail/product-detail?id=' + productId })
  464. },
  465. formatPriceWithSymbol: function(cents) {
  466. if (cents === null || cents === undefined) return '¥0'
  467. return '¥' + (cents / 100).toFixed(2)
  468. },
  469. formatFileSize(bytes) {
  470. if (!bytes) return ''
  471. if (bytes < 1024) return bytes + 'B'
  472. if (bytes < 1024 * 1024) return (bytes / 1024).toFixed(1) + 'KB'
  473. return (bytes / 1024 / 1024).toFixed(1) + 'MB'
  474. },
  475. goBack() {
  476. uni.navigateBack()
  477. },
  478. doSubmit() {
  479. if (this.submitting) return
  480. var self = this
  481. if (!self.parsedInfo || !self.parsedInfo.draftId) {
  482. uni.showToast({ title: '请先上传文件并等待解析完成', icon: 'none' })
  483. return
  484. }
  485. if (self.parsedInfo.needManualSelect && !self.selectedMemberId) {
  486. uni.showToast({ title: '请先选择成员', icon: 'none' })
  487. return
  488. }
  489. var payloadStr = encodeURIComponent(JSON.stringify(self.parsedInfo.payload || {}))
  490. var candidatesStr = (self.parsedInfo.candidates && self.parsedInfo.candidates.length > 0)
  491. ? encodeURIComponent(JSON.stringify(self.parsedInfo.candidates))
  492. : ''
  493. var params = 'draftId=' + self.parsedInfo.draftId
  494. + '&extractedName=' + encodeURIComponent(self.parsedInfo.personName || '')
  495. + '&extractedGender=' + encodeURIComponent(self.parsedInfo.extractedGender || '')
  496. + '&extractedAge=' + (self.parsedInfo.extractedAge || '')
  497. + '&payload=' + payloadStr
  498. + '&needBind=' + (self.parsedInfo.needManualSelect ? 'true' : 'false')
  499. + '&matchConfidence=' + (self.parsedInfo.confidence || '')
  500. + '&matchLabel=' + encodeURIComponent(self.parsedInfo.matchLabel || '')
  501. + '&candidates=' + candidatesStr
  502. + '&extractedReportDate=' + encodeURIComponent(self.parsedInfo.reportDate || '')
  503. if (self.parsedInfo.matchedMemberId) {
  504. params += '&matchedMemberId=' + self.parsedInfo.matchedMemberId
  505. }
  506. if (self.childId) {
  507. params += '&childId=' + self.childId
  508. }
  509. if (self.familyId) {
  510. params += '&familyId=' + self.familyId
  511. }
  512. uni.navigateTo({ url: '/pages/health/report-confirm?' + params })
  513. }
  514. }
  515. }
  516. </script>
  517. <style scoped>
  518. .upload-container {
  519. min-height: 100vh;
  520. background: #F5F7FA;
  521. }
  522. /* ===== 导航栏 ===== */
  523. .nav-bar {
  524. position: sticky;
  525. top: 0;
  526. background: #fff;
  527. display: flex;
  528. flex-direction: row;
  529. align-items: center;
  530. justify-content: space-between;
  531. padding: 20rpx 30rpx;
  532. box-shadow: 0 2rpx 8rpx rgba(0,0,0,0.06);
  533. z-index: 100;
  534. }
  535. .nav-back {
  536. font-size: 32rpx;
  537. color: #5B9BD5;
  538. }
  539. .nav-title {
  540. font-size: 32rpx;
  541. font-weight: bold;
  542. color: #333;
  543. }
  544. .nav-placeholder {
  545. width: 80rpx;
  546. }
  547. /* ===== 提示条 ===== */
  548. .tip-banner {
  549. display: flex;
  550. flex-direction: row;
  551. align-items: center;
  552. background: #E3F2FD;
  553. margin: 20rpx 30rpx;
  554. padding: 20rpx 24rpx;
  555. border-radius: 16rpx;
  556. }
  557. .tip-icon {
  558. font-size: 32rpx;
  559. margin-right: 16rpx;
  560. flex-shrink: 0;
  561. }
  562. .tip-text {
  563. font-size: 24rpx;
  564. color: #1565C0;
  565. line-height: 1.5;
  566. }
  567. /* ===== 表单 ===== */
  568. .form-section {
  569. margin: 0 30rpx;
  570. }
  571. .form-item {
  572. background: #fff;
  573. border-radius: 16rpx;
  574. padding: 24rpx;
  575. margin-bottom: 20rpx;
  576. }
  577. .form-label {
  578. font-size: 26rpx;
  579. font-weight: bold;
  580. color: #333;
  581. display: block;
  582. margin-bottom: 16rpx;
  583. }
  584. /* 类型选择 */
  585. .type-selector {
  586. display: flex;
  587. flex-direction: row;
  588. gap: 20rpx;
  589. }
  590. .type-option {
  591. flex: 1;
  592. display: flex;
  593. flex-direction: column;
  594. align-items: center;
  595. padding: 24rpx;
  596. border-radius: 16rpx;
  597. background: #F5F7FA;
  598. border: 2rpx solid transparent;
  599. }
  600. .type-selected {
  601. background: #E3F2FD;
  602. border-color: #5B9BD5;
  603. }
  604. .type-icon {
  605. font-size: 40rpx;
  606. margin-bottom: 8rpx;
  607. }
  608. .type-name {
  609. font-size: 26rpx;
  610. color: #333;
  611. font-weight: 500;
  612. }
  613. /* 文件上传 */
  614. .file-upload-area {
  615. border: 2rpx dashed #CBD5E1;
  616. border-radius: 16rpx;
  617. padding: 32rpx 20rpx;
  618. text-align: center;
  619. background: #FAFBFC;
  620. cursor: pointer;
  621. }
  622. .file-upload-area:active {
  623. background: #F1F5F9;
  624. }
  625. .file-upload-placeholder {
  626. display: flex;
  627. flex-direction: column;
  628. align-items: center;
  629. }
  630. .file-upload-icon {
  631. font-size: 48rpx;
  632. margin-bottom: 12rpx;
  633. }
  634. .file-upload-text {
  635. font-size: 28rpx;
  636. color: #5B9BD5;
  637. font-weight: 500;
  638. }
  639. .file-upload-hint {
  640. font-size: 22rpx;
  641. color: #94A3B8;
  642. margin-top: 8rpx;
  643. }
  644. .file-info {
  645. display: flex;
  646. flex-direction: row;
  647. align-items: center;
  648. background: #E3F2FD;
  649. border-radius: 12rpx;
  650. padding: 16rpx 20rpx;
  651. margin-top: 16rpx;
  652. }
  653. .file-name {
  654. flex: 1;
  655. font-size: 24rpx;
  656. color: #1565C0;
  657. overflow: hidden;
  658. text-overflow: ellipsis;
  659. white-space: nowrap;
  660. }
  661. .file-size {
  662. font-size: 22rpx;
  663. color: #64748B;
  664. margin: 0 16rpx;
  665. flex-shrink: 0;
  666. }
  667. .file-remove {
  668. font-size: 24rpx;
  669. color: #EF4444;
  670. flex-shrink: 0;
  671. padding: 4rpx 8rpx;
  672. }
  673. /* 日期 */
  674. .date-display {
  675. display: flex;
  676. flex-direction: row;
  677. align-items: center;
  678. justify-content: space-between;
  679. padding: 16rpx 20rpx;
  680. background: #F5F7FA;
  681. border-radius: 12rpx;
  682. font-size: 28rpx;
  683. color: #333;
  684. }
  685. .date-arrow {
  686. font-size: 32rpx;
  687. color: #999;
  688. }
  689. /* 评分滑块 */
  690. .score-input-wrap {
  691. display: flex;
  692. flex-direction: row;
  693. align-items: center;
  694. }
  695. .score-slider {
  696. flex: 1;
  697. }
  698. .score-value {
  699. font-size: 28rpx;
  700. font-weight: bold;
  701. color: #5B9BD5;
  702. margin-left: 16rpx;
  703. min-width: 80rpx;
  704. text-align: center;
  705. }
  706. /* 备注 */
  707. .note-input {
  708. width: 100%;
  709. min-height: 160rpx;
  710. background: #F5F7FA;
  711. border-radius: 12rpx;
  712. padding: 20rpx;
  713. font-size: 26rpx;
  714. color: #333;
  715. box-sizing: border-box;
  716. }
  717. /* 提交按钮 */
  718. .submit-btn {
  719. background: linear-gradient(135deg, #5B9BD5, #3A7CC4);
  720. color: #fff;
  721. font-size: 30rpx;
  722. font-weight: bold;
  723. text-align: center;
  724. padding: 28rpx;
  725. border-radius: 16rpx;
  726. margin-top: 10rpx;
  727. }
  728. .submit-btn:active {
  729. opacity: 0.85;
  730. }
  731. .btn-disabled {
  732. opacity: 0.5;
  733. }
  734. /* ===== PDF解析预览 ===== */
  735. .parsed-preview {
  736. background: #E8F5E9;
  737. border-radius: 16rpx;
  738. margin: 0 30rpx 20rpx;
  739. padding: 20rpx 24rpx;
  740. border: 2rpx solid #A5D6A7;
  741. }
  742. .parsed-title {
  743. font-size: 24rpx;
  744. font-weight: bold;
  745. color: #2E7D32;
  746. margin-bottom: 12rpx;
  747. }
  748. .parsed-row {
  749. display: flex;
  750. flex-direction: row;
  751. align-items: center;
  752. margin-bottom: 8rpx;
  753. }
  754. .parsed-label {
  755. font-size: 24rpx;
  756. color: #388E3C;
  757. width: 140rpx;
  758. flex-shrink: 0;
  759. }
  760. .parsed-value {
  761. font-size: 24rpx;
  762. color: #1B5E20;
  763. font-weight: 500;
  764. }
  765. .match-status {
  766. display: flex;
  767. flex-direction: row;
  768. align-items: center;
  769. margin-top: 12rpx;
  770. padding: 12rpx 16rpx;
  771. background: #FFF3E0;
  772. border-radius: 8rpx;
  773. }
  774. .match-status.success {
  775. background: #E8F5E9;
  776. }
  777. .match-icon {
  778. font-size: 24rpx;
  779. margin-right: 8rpx;
  780. }
  781. .match-text {
  782. font-size: 24rpx;
  783. color: #E65100;
  784. }
  785. .match-status.success .match-text {
  786. color: #2E7D32;
  787. }
  788. /* ===== 家庭成员选择器 ===== */
  789. .member-selector {
  790. margin: 0 30rpx 20rpx;
  791. }
  792. .member-list {
  793. display: flex;
  794. flex-direction: row;
  795. flex-wrap: wrap;
  796. gap: 16rpx;
  797. }
  798. .member-item {
  799. display: flex;
  800. flex-direction: column;
  801. align-items: center;
  802. padding: 20rpx 24rpx;
  803. background: #F5F7FA;
  804. border-radius: 16rpx;
  805. border: 2rpx solid transparent;
  806. min-width: 120rpx;
  807. }
  808. .member-selected {
  809. background: #E3F2FD;
  810. border-color: #5B9BD5;
  811. }
  812. .member-avatar {
  813. width: 64rpx;
  814. height: 64rpx;
  815. border-radius: 50%;
  816. background: #5B9BD5;
  817. color: #fff;
  818. font-size: 28rpx;
  819. font-weight: bold;
  820. display: flex;
  821. align-items: center;
  822. justify-content: center;
  823. margin-bottom: 8rpx;
  824. }
  825. .member-name {
  826. font-size: 24rpx;
  827. color: #333;
  828. }
  829. .add-member-btn {
  830. margin-top: 16rpx;
  831. padding: 20rpx;
  832. border: 1rpx dashed #4caf50;
  833. border-radius: 12rpx;
  834. text-align: center;
  835. background: #f6fbf6;
  836. }
  837. .add-member-text {
  838. font-size: 26rpx;
  839. color: #4caf50;
  840. }
  841. /* ===== 舌诊拍照区 ===== */
  842. .photo-area {
  843. display: flex;
  844. justify-content: center;
  845. margin-bottom: 16rpx;
  846. }
  847. .photo-placeholder {
  848. width: 400rpx;
  849. height: 400rpx;
  850. border: 4rpx dashed #CBD5E1;
  851. border-radius: 24rpx;
  852. display: flex;
  853. flex-direction: column;
  854. align-items: center;
  855. justify-content: center;
  856. background: #fff;
  857. }
  858. .photo-icon {
  859. font-size: 80rpx;
  860. margin-bottom: 16rpx;
  861. }
  862. .photo-text {
  863. font-size: 28rpx;
  864. color: #64748B;
  865. }
  866. .photo-sub {
  867. font-size: 22rpx;
  868. color: #94A3B8;
  869. margin-top: 12rpx;
  870. text-align: center;
  871. padding: 0 20rpx;
  872. }
  873. .photo-preview {
  874. width: 400rpx;
  875. height: 400rpx;
  876. border-radius: 24rpx;
  877. }
  878. .photo-analyzing {
  879. width: 400rpx;
  880. height: 400rpx;
  881. border-radius: 24rpx;
  882. background: #f5f5f5;
  883. display: flex;
  884. align-items: center;
  885. justify-content: center;
  886. }
  887. .analyzing-text {
  888. font-size: 28rpx;
  889. color: #5B9BD5;
  890. }
  891. .photo-retake {
  892. text-align: center;
  893. font-size: 24rpx;
  894. color: #5B9BD5;
  895. margin-top: 8rpx;
  896. }
  897. /* ===== 底部 ===== */
  898. .bottom-spacer {
  899. height: 60rpx;
  900. }
  901. /* ===== 购买推荐 ===== */
  902. .purchase-section {
  903. background: #F0F9FF;
  904. border-radius: 16rpx;
  905. padding: 24rpx;
  906. margin: 0 30rpx 20rpx;
  907. border: 2rpx solid #BAE6FD;
  908. }
  909. .purchase-header {
  910. display: flex;
  911. flex-direction: row;
  912. align-items: center;
  913. margin-bottom: 16rpx;
  914. }
  915. .purchase-icon {
  916. font-size: 28rpx;
  917. margin-right: 8rpx;
  918. }
  919. .purchase-title {
  920. font-size: 26rpx;
  921. font-weight: bold;
  922. color: #0369A1;
  923. }
  924. .purchase-scroll {
  925. display: flex;
  926. flex-direction: row;
  927. white-space: nowrap;
  928. }
  929. .purchase-card {
  930. display: inline-flex;
  931. flex-direction: column;
  932. width: 220rpx;
  933. background: #fff;
  934. border-radius: 12rpx;
  935. padding: 16rpx;
  936. margin-right: 16rpx;
  937. flex-shrink: 0;
  938. }
  939. .purchase-cover {
  940. width: 188rpx;
  941. height: 120rpx;
  942. border-radius: 8rpx;
  943. background: #F1F5F9;
  944. margin-bottom: 8rpx;
  945. }
  946. .purchase-name {
  947. font-size: 22rpx;
  948. color: #333;
  949. line-height: 1.3;
  950. overflow: hidden;
  951. text-overflow: ellipsis;
  952. white-space: nowrap;
  953. margin-bottom: 4rpx;
  954. }
  955. .purchase-price {
  956. font-size: 24rpx;
  957. color: #EF4444;
  958. font-weight: bold;
  959. margin-bottom: 8rpx;
  960. }
  961. .purchase-btn {
  962. background: #3B82F6;
  963. border-radius: 8rpx;
  964. padding: 8rpx 0;
  965. text-align: center;
  966. }
  967. .purchase-btn-text {
  968. font-size: 22rpx;
  969. color: #fff;
  970. font-weight: 500;
  971. }
  972. </style>