report-upload.vue 29 KB

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