detail.vue 39 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717
  1. <template>
  2. <view class="page">
  3. <view class="pageDecor">
  4. <view class="pageGlow glowA" />
  5. <view class="pageGlow glowB" />
  6. <view class="pageGlow glowC" />
  7. <view class="pageGrain" />
  8. </view>
  9. <!-- 顶部留白:兼容 iOS 刘海 -->
  10. <view class="safeTop" />
  11. <!-- 轻品牌页头:极克制、无导航栏,让独立扫码页有品牌收口 -->
  12. <view class="brandPageHeader">
  13. <view class="brandPageHeaderInner">
  14. <text class="brandPageHeaderName">佳友厚苑</text>
  15. <view class="brandPageHeaderDot" />
  16. <text class="brandPageHeaderLabel">官方溯源 品质可验</text>
  17. </view>
  18. </view>
  19. <view class="hero">
  20. <!-- 完整首屏大卡:品牌信任区 + 商品信息面板 -->
  21. <view class="heroCard">
  22. <!-- Hero 视觉区:商品图 + 品牌氛围 -->
  23. <view class="heroBg">
  24. <!-- 优先商品图,没有则用农场图 -->
  25. <image
  26. class="heroImage"
  27. :src="traceDetail.product?.image || traceDetail.farm?.image"
  28. mode="aspectFill"
  29. />
  30. <!-- 底部大字号水印,营造品牌氛围 -->
  31. <view class="heroBrandAnchor">
  32. <text class="heroBrandAnchorText">JIAYOU</text>
  33. </view>
  34. <!-- 光感层:多层次渐变 + 景深 + 底部暗化 -->
  35. <view class="heroMask" />
  36. </view>
  37. <!-- 商品信息面板:嵌入 Hero 底部,与 Hero 自然过渡 -->
  38. <view v-if="traceDetail.product?.name" class="heroInfoPanel">
  39. <view class="infoPanelInner">
  40. <view class="sectionHeader">
  41. <view class="sectionHeaderLeft">
  42. <text class="sectionEn">Product</text>
  43. <text class="sectionTitle">商品信息</text>
  44. </view>
  45. <view v-if="traceDetail.batch?.statusBadge" class="trustBadge" :class="traceDetail.batch.statusBadge.type">
  46. <!-- 认证徽章 SVG:双圆环 + 对勾,图标主视觉,文字辅助 -->
  47. <svg class="trustBadgeIcon" viewBox="0 0 20 20" fill="none" xmlns="http://www.w3.org/2000/svg">
  48. <circle cx="10" cy="10" r="9" stroke="rgba(27,71,42,0.38)" stroke-width="0.9" />
  49. <circle cx="10" cy="10" r="5.5" stroke="rgba(27,71,42,0.22)" stroke-width="0.7" />
  50. <path d="M6.6 10.4L9.1 12.9L13.8 8" stroke="rgba(27,71,42,0.8)" stroke-width="1.15" stroke-linecap="round" stroke-linejoin="round" />
  51. </svg>
  52. <text class="trustBadgeText">{{ traceDetail.batch.statusBadge.text }}</text>
  53. </view>
  54. </view>
  55. <view class="infoPanelBody">
  56. <text class="infoPanelName">{{ traceDetail.product.name }}</text>
  57. <view v-if="traceDetail.product.spec" class="infoPanelSpec">
  58. <view class="specDot" />
  59. <text class="specText">{{ traceDetail.product.spec }}</text>
  60. </view>
  61. <view v-if="traceDetail.product?.intro" class="infoPanelIntro">
  62. <text>{{ traceDetail.product.intro }}</text>
  63. </view>
  64. </view>
  65. </view>
  66. </view>
  67. </view>
  68. </view>
  69. <scroll-view class="content" scroll-y>
  70. <!-- 农场信息(合并为单卡:图片+名称+地区+介绍连续表达) -->
  71. <view v-if="traceDetail.farm?.name" class="card cardLevel2 cardFarm">
  72. <view class="sectionHeader">
  73. <view class="sectionHeaderLeft">
  74. <text class="sectionEn">Farm</text>
  75. <text class="sectionTitle">农场信息</text>
  76. </view>
  77. </view>
  78. <!-- 农场主体:左图右文结构,融入主体内容 -->
  79. <view class="farmBody">
  80. <view class="farmImageWrap">
  81. <image class="farmImage" :src="traceDetail.farm.image" mode="aspectFill" />
  82. </view>
  83. <view class="farmMeta">
  84. <text class="farmName">{{ traceDetail.farm.name }}</text>
  85. <view v-if="traceDetail.farm.location" class="farmLocation">
  86. <svg class="locationIcon" viewBox="0 0 20 20" fill="none" xmlns="http://www.w3.org/2000/svg">
  87. <path d="M10 2C7.24 2 5 4.24 5 7c0 4 5 11 5 11s5-7 5-11c0-2.76-2.24-5-5-5zm0 6.5c-1.38 0-2.5-1.12-2.5-2.5s1.12-2.5 2.5-2.5 2.5 1.12 2.5 2.5-1.12 2.5-2.5 2.5z" fill="rgba(39,113,76,0.6)"/>
  88. </svg>
  89. <text class="locationText">{{ traceDetail.farm.location }}</text>
  90. </view>
  91. </view>
  92. </view>
  93. <view v-if="traceDetail.farm?.intro" class="farmIntro">
  94. <text>{{ traceDetail.farm.intro }}</text>
  95. </view>
  96. </view>
  97. <!-- 批次信息(可选:batch 可能不存在) -->
  98. <view v-if="traceDetail.batch?.exists" class="card cardLevel1 cardBatch">
  99. <view class="sectionHeader">
  100. <view class="sectionHeaderLeft">
  101. <text class="sectionEn">Batch</text>
  102. <text class="sectionTitle">批次信息</text>
  103. </view>
  104. </view>
  105. <!-- 批次信息主体:左右两列布局,左列标签固定宽度,右列内容左对齐 -->
  106. <view class="batchBody">
  107. <view v-if="traceDetail.batch?.no" class="batchRow">
  108. <text class="batchRowLabel">批次号</text>
  109. <text class="batchRowValue">{{ traceDetail.batch.no }}</text>
  110. </view>
  111. <view v-if="traceDetail.batch?.harvestTime" class="batchRow">
  112. <text class="batchRowLabel">生产/采收时间</text>
  113. <text class="batchRowValue">{{ traceDetail.batch.harvestTime }}</text>
  114. </view>
  115. <view v-if="traceDetail.batch?.packTime" class="batchRow">
  116. <text class="batchRowLabel">包装时间</text>
  117. <text class="batchRowValue">{{ traceDetail.batch.packTime }}</text>
  118. </view>
  119. </view>
  120. </view>
  121. <!-- 批次不存在/已下线的说明 -->
  122. <view v-else-if="traceDetail.batch?.statusBadge" class="card soft cardLevel1 cardBatchState">
  123. <view class="sectionHeader">
  124. <view class="sectionHeaderLeft">
  125. <text class="sectionEn">Batch</text>
  126. <text class="sectionTitle">当前批次状态</text>
  127. </view>
  128. <view class="statusBadge" :class="traceDetail.batch.statusBadge.type">
  129. {{ traceDetail.batch.statusBadge.text }}
  130. </view>
  131. </view>
  132. <view class="emptyText">{{ traceDetail.batch?.emptyMessage || '该批次暂不可查询' }}</view>
  133. <view class="btnRow">
  134. <button class="primaryBtn" @click="goBackToPurchase">返回购买渠道</button>
  135. </view>
  136. </view>
  137. <!-- 检测报告:横向卡片列表 -->
  138. <view v-if="traceDetail.batch?.exists" class="card cardLevel2 cardCredential">
  139. <view class="sectionHeader">
  140. <view class="sectionHeaderLeft">
  141. <text class="sectionEn">Report</text>
  142. <text class="sectionTitle">检测报告</text>
  143. </view>
  144. </view>
  145. <!-- 横向滑动卡片列表 -->
  146. <scroll-view
  147. v-if="reportItems.length"
  148. class="reportCardList"
  149. scroll-x
  150. :show-scrollbar="false"
  151. enhanced
  152. >
  153. <view class="reportCardTrack">
  154. <view
  155. v-for="(item, itemIdx) in reportItems"
  156. :key="`report-card-${itemIdx}`"
  157. class="reportCard"
  158. @click="previewDoc('report', getReportGlobalIndex(itemIdx, 0))"
  159. >
  160. <!-- 报告缩略图(带页数角标) -->
  161. <view class="reportCardThumb">
  162. <image
  163. v-if="item.images && item.images.length"
  164. class="reportCardThumbImg"
  165. :src="item.images[0]"
  166. mode="aspectFit"
  167. />
  168. <view v-else class="reportCardThumbEmpty">
  169. <text class="reportCardThumbEmptyText">暂无图片</text>
  170. </view>
  171. <view v-if="item.images && item.images.length > 1" class="reportCardPages">
  172. 共{{ item.images.length }}页
  173. </view>
  174. </view>
  175. <!-- 报告信息 -->
  176. <view class="reportCardMeta">
  177. <view v-if="item.detectDate" class="reportCardRow">
  178. <text class="reportCardLabel">检测日期</text>
  179. <text class="reportCardValue">{{ item.detectDate }}</text>
  180. </view>
  181. <view v-if="item.no" class="reportCardRow">
  182. <text class="reportCardLabel">报告编号</text>
  183. <text class="reportCardValue reportCardValueNo">{{ item.no }}</text>
  184. </view>
  185. </view>
  186. <!-- 点击提示 -->
  187. <text class="reportCardHint">点击查看大图</text>
  188. </view>
  189. </view>
  190. </scroll-view>
  191. <!-- 待补充状态 -->
  192. <view v-else class="docPlaceholder">
  193. <text class="docPlaceholderTitle">检测报告待补充</text>
  194. <text class="docPlaceholderText">
  195. {{ traceDetail.report?.emptyMessage || '检测报告待补充,请耐心等待。' }}
  196. </text>
  197. </view>
  198. </view>
  199. <!-- 合格证:信息摘要 + 缩略图一体化布局 -->
  200. <view v-if="traceDetail.batch?.exists" class="card cardLevel1 cardCredential">
  201. <view class="sectionHeader">
  202. <view class="sectionHeaderLeft">
  203. <text class="sectionEn">Certificate</text>
  204. <text class="sectionTitle">合格证</text>
  205. </view>
  206. </view>
  207. <!-- 信息与缩略图一体化区域 -->
  208. <view class="certSummary">
  209. <!-- 左侧:信息摘要 -->
  210. <view class="certSummaryInfo">
  211. <view v-if="traceDetail.certificate?.issueDate" class="certSummaryRow">
  212. <text class="certSummaryLabel">开具日期</text>
  213. <text class="certSummaryValue">{{ traceDetail.certificate.issueDate }}</text>
  214. </view>
  215. <view v-if="traceDetail.certificate?.no" class="certSummaryRow">
  216. <text class="certSummaryLabel">合格证编号</text>
  217. <text class="certSummaryValue">{{ traceDetail.certificate.no }}</text>
  218. </view>
  219. </view>
  220. <!-- 右侧:缩略图 -->
  221. <view
  222. v-if="traceDetail.certificate?.status === 'uploaded' && certificateImages.length"
  223. class="certThumbContainer"
  224. @click="previewDoc('certificate', 0)"
  225. >
  226. <view class="certThumbWrap">
  227. <image class="certThumbImage" :src="certificateImages[0]" mode="aspectFit" />
  228. </view>
  229. <text class="certPreviewHint">点击查看</text>
  230. </view>
  231. <!-- 待补充状态:仅显示提示 -->
  232. <view v-else class="certPendingHint">
  233. <text class="certPendingText">
  234. {{ traceDetail.certificate?.emptyMessage || '合格证待补充,请耐心等待。' }}
  235. </text>
  236. </view>
  237. </view>
  238. </view>
  239. <!-- 底部柔和收口渐变 -->
  240. <view class="footerFade" />
  241. <!-- 轻量页脚 -->
  242. <view class="traceFooter">
  243. <view class="traceFooterHint">如需帮助,联系客服</view>
  244. <view class="traceFooterPhone" @click="contactCustomer">
  245. <image class="traceFooterPhoneIcon" src="/static/icons/phone.svg" mode="aspectFit" />
  246. <text class="traceFooterPhoneNum">13379508760</text>
  247. </view>
  248. <view class="traceFooterBrand">佳友厚苑 · 安心之选</view>
  249. </view>
  250. </scroll-view>
  251. </view>
  252. </template>
  253. <script setup>
  254. import { computed, ref } from 'vue'
  255. import { onLoad } from '@dcloudio/uni-app'
  256. import {getTraceDetail } from '@/api/base/index.js'
  257. // 页面状态选择(H5 演示用):通过路由参数传入 state 即可切换 mock 场景
  258. // 例如:/pages/trace/detail?state=reportPending
  259. // 加载状态
  260. const loading = ref(false)
  261. // 数据存储
  262. const traceInfo = ref(null)
  263. const routeOptions = ref({})
  264. const mockStateKey = ref('normal')
  265. const MOCK_TRACE_DETAILS = {
  266. normal: {
  267. product: {
  268. name: '',
  269. spec: '',
  270. image: '',
  271. intro: ''
  272. },
  273. farm: {
  274. name: '',
  275. location: '',
  276. image: '',
  277. intro: ''
  278. },
  279. batch: {
  280. exists: false,
  281. statusBadge: { text: '', type: '' },
  282. no: '',
  283. harvestTime: '',
  284. packTime: ''
  285. },
  286. report: {
  287. status: '',
  288. statusBadge: { text: '', type: '' },
  289. // 每份报告独立 detectDate / no / images
  290. items: [
  291. {
  292. detectDate: '',
  293. no: '',
  294. images: ['']
  295. },
  296. {
  297. detectDate: '',
  298. no: '',
  299. images: ['']
  300. },
  301. {
  302. detectDate: '',
  303. no: '',
  304. images: ['']
  305. }
  306. ]
  307. },
  308. certificate: {
  309. status: '',
  310. statusBadge: { text: '', type: '' },
  311. issueDate: '',
  312. no: '',
  313. fileUrl: '',
  314. images: ['']
  315. }
  316. },
  317. reportPending: {
  318. product: {
  319. name: '',
  320. spec: '',
  321. image: '',
  322. intro: ''
  323. },
  324. farm: {
  325. name: '',
  326. location: '',
  327. image: null,
  328. intro: ''
  329. },
  330. batch: {
  331. exists: false,
  332. statusBadge: { text: '', type: '' },
  333. no: '',
  334. harvestTime: '',
  335. packTime: ''
  336. },
  337. report: {
  338. status: '',
  339. statusBadge: { text: '', type: '' },
  340. emptyMessage: '',
  341. items: []
  342. },
  343. certificate: {
  344. status: '',
  345. statusBadge: { text: '', type: '' },
  346. issueDate: '',
  347. no: '',
  348. fileUrl: '',
  349. images: []
  350. }
  351. },
  352. certificatePending: {
  353. product: {
  354. name: '',
  355. spec: '',
  356. image: '',
  357. intro: ''
  358. },
  359. farm: {
  360. name: '',
  361. location: '',
  362. image: null,
  363. intro: ''
  364. },
  365. batch: {
  366. exists: false,
  367. statusBadge: { text: '', type: '' },
  368. no: '',
  369. harvestTime: '',
  370. packTime: ''
  371. },
  372. report: {
  373. status: '',
  374. statusBadge: { text: '', type: '' },
  375. items: [
  376. {
  377. detectDate: '',
  378. no: '',
  379. images: []
  380. }
  381. ]
  382. },
  383. certificate: {
  384. status: '',
  385. statusBadge: { text: '', type: '' },
  386. emptyMessage: ''
  387. }
  388. },
  389. batchNotFound: {
  390. product: {
  391. name:'',
  392. spec: '',
  393. image: '',
  394. intro: ''
  395. },
  396. farm: {
  397. name: '',
  398. location: '',
  399. image: null,
  400. intro: ''
  401. },
  402. batch: {
  403. exists: false,
  404. statusBadge: { text: '', type: '' },
  405. emptyMessage: ''
  406. },
  407. report: null,
  408. certificate: null
  409. },
  410. batchOfflined: {
  411. product: {
  412. name: '',
  413. spec: '',
  414. image: '',
  415. intro: ''
  416. },
  417. farm: {
  418. name: '',
  419. location: '',
  420. image: null,
  421. intro: ''
  422. },
  423. batch: {
  424. exists: false,
  425. statusBadge: { text: '', type: '' },
  426. emptyMessage: ''
  427. },
  428. report: null,
  429. certificate: null
  430. }
  431. }
  432. function resolveStateKey(opts) {
  433. const raw = (opts?.state || opts?.batchState || opts?.scene || '').toString().trim()
  434. if (!raw) return 'normal'
  435. const allowed = ['normal', 'reportPending', 'certificatePending', 'batchNotFound', 'batchOfflined']
  436. return allowed.includes(raw) ? raw : 'normal'
  437. }
  438. onLoad((opts) => {
  439. // 拿到浏览器路径参数
  440. const fullPath = window.location.pathname
  441. const batchId = fullPath.split('/').filter(Boolean).pop()
  442. // 优先使用路由参数中的 id,其次使用 URL 路径中的 id
  443. const finalId = batchId
  444. loadData(finalId)
  445. routeOptions.value = opts || {}
  446. mockStateKey.value = resolveStateKey(opts || {})
  447. })
  448. const loadData = async (batchId) => {
  449. loading.value = true
  450. try {
  451. // 调用接口
  452. const res = await getTraceDetail(batchId)
  453. traceInfo.value = res.data.data
  454. console.log('接口返回数据:', res)
  455. } catch (error) {
  456. console.error('加载失败', error)
  457. // 错误提示已在拦截器中自动处理
  458. } finally {
  459. // 无论成功失败都关闭 loading
  460. loading.value = false
  461. }
  462. }
  463. const traceDetail = computed(() => {
  464. // 如果没有真实数据,返回 mock 数据
  465. if (!traceInfo.value) {
  466. return MOCK_TRACE_DETAILS[mockStateKey.value] || MOCK_TRACE_DETAILS.normal
  467. }
  468. const data = traceInfo.value
  469. // 解析 certFiles 和 reportFiles(JSON 字符串转数组)
  470. let certFiles = []
  471. let reportFiles = []
  472. try {
  473. if (data.certificate?.certFiles) {
  474. certFiles = JSON.parse(data.certificate.certFiles)
  475. }
  476. } catch (e) {
  477. console.error('解析 certFiles 失败', e)
  478. }
  479. // 构建返回数据结构
  480. return {
  481. product: {
  482. name: data.productName || '',
  483. spec: data.productSpec || '',
  484. image: data.productImage || '',
  485. intro: data.productDesc || ''
  486. },
  487. farm: {
  488. name: data.farmName || '',
  489. location: data.farmRegion || '',
  490. image: data.farmImage || '',
  491. intro: data.farmIntro || ''
  492. },
  493. batch: {
  494. exists: data.status === '2', // status 为 '2' 表示批次正常,已上线
  495. statusBadge: data.status === '2'
  496. ? { text: '检验合格', type: 'ok' }
  497. : { text: '批次不存在', type: 'muted' },
  498. no: data.batchNo || '',
  499. harvestTime: data.produceDate || '',
  500. packTime: data.packageDate || '',
  501. emptyMessage: data.status !== '2' ? '未找到对应溯源批次信息。请确认二维码是否为佳友厚苑正品批次。' : ''
  502. },
  503. report: {
  504. status: data.reports && data.reports.length > 0 ? 'uploaded' : 'pending',
  505. statusBadge: data.reports && data.reports.length > 0
  506. ? { text: '已上传', type: 'ok' }
  507. : { text: '待补充', type: 'wait' },
  508. emptyMessage: '检测报告待补充,上传完成后可查看大图。',
  509. items: (data.reports || []).map(report => {
  510. let images = []
  511. // 处理 reportFiles:可能是字符串 URL、JSON 字符串数组、或已解析的数组
  512. if (report.reportFiles) {
  513. if (typeof report.reportFiles === 'string') {
  514. // 尝试解析 JSON 字符串
  515. try {
  516. const parsed = JSON.parse(report.reportFiles)
  517. // 如果解析成功且是数组,提取 url 字段
  518. if (Array.isArray(parsed)) {
  519. images = parsed.map(item =>
  520. typeof item === 'string' ? item : (item.url || item)
  521. ).filter(Boolean)
  522. } else {
  523. // 解析后不是数组,可能是单个对象
  524. images = [parsed.url || parsed].filter(Boolean)
  525. }
  526. } catch (e) {
  527. // 解析失败,当作普通 URL 字符串处理
  528. images = [report.reportFiles]
  529. }
  530. } else if (Array.isArray(report.reportFiles)) {
  531. // 已经是数组,提取 url 字段
  532. images = report.reportFiles.map(item =>
  533. typeof item === 'string' ? item : (item.url || item)
  534. ).filter(Boolean)
  535. } else if (typeof report.reportFiles === 'object') {
  536. // 单个对象
  537. images = [report.reportFiles.url || report.reportFiles].filter(Boolean)
  538. }
  539. }
  540. return {
  541. detectDate: report.reportDate || '',
  542. no: report.reportNo || '',
  543. images: images
  544. }
  545. })
  546. },
  547. certificate: {
  548. status: data.certificate && certFiles.length > 0 ? 'uploaded' : 'pending',
  549. statusBadge: data.certificate && certFiles.length > 0
  550. ? { text: '已上传', type: 'ok' }
  551. : { text: '待补充', type: 'wait' },
  552. issueDate: data.certificate?.certIssueDate || '',
  553. no: data.certificate?.certNo || '',
  554. fileUrl: certFiles.length > 0 ? certFiles[0].url : '',
  555. images: certFiles.map(f => f.url),
  556. emptyMessage: '合格证待补充,上传完成后可查看大图。'
  557. }
  558. }
  559. })
  560. const reportImages = computed(() => {
  561. const items = traceDetail.value?.report?.items
  562. if (Array.isArray(items)) {
  563. return items.flatMap(item => Array.isArray(item.images) ? item.images : [])
  564. }
  565. return []
  566. })
  567. const reportItems = computed(() => {
  568. return traceDetail.value?.report?.items || []
  569. })
  570. // 计算某份报告内某张图在全局 reportImages 扁平数组中的索引
  571. function getReportGlobalIndex(itemIndex, imgIndex) {
  572. const items = reportItems.value
  573. let offset = 0
  574. for (let i = 0; i < itemIndex; i++) {
  575. const imgArr = items[i]?.images
  576. offset += Array.isArray(imgArr) ? imgArr.length : 0
  577. }
  578. return offset + imgIndex
  579. }
  580. const certificateImages = computed(() => {
  581. const c = traceDetail.value?.certificate
  582. if (!c) return []
  583. if (Array.isArray(c.images) && c.images.length) return c.images
  584. return c.fileUrl ? [c.fileUrl] : []
  585. })
  586. function contactCustomer() {
  587. uni.makePhoneCall({
  588. phoneNumber: '13379508760'
  589. })
  590. }
  591. function goBackToPurchase() {
  592. uni.showModal({
  593. title: '返回购买渠道',
  594. content: 'mock 模式:后续可跳转到直播间/小店页面。',
  595. showCancel: true,
  596. confirmText: '确认返回'
  597. })
  598. }
  599. function previewDoc(kind, index) {
  600. const urls = kind === 'report' ? reportImages.value : certificateImages.value
  601. if (!urls.length) {
  602. uni.showToast({ title: '该文件暂未上传', icon: 'none' })
  603. return
  604. }
  605. uni.previewImage({
  606. urls,
  607. current: urls[index] || urls[0]
  608. })
  609. }
  610. </script>
  611. <style scoped>
  612. .page {
  613. position: relative;
  614. min-height: 100vh;
  615. --bg-cream-1: #f8f2e8;
  616. --bg-cream-2: #f3ebdd;
  617. --bg-cream-3: #ece1ce;
  618. --forest-900: #143a2b;
  619. --forest-800: #1f513b;
  620. --forest-700: #2d6849;
  621. --sage-500: #708f7d;
  622. --gold-320: #ccb086;
  623. --gold-260: #dcc4a0;
  624. --text-900: #233126;
  625. --text-700: #3c4d41;
  626. --text-500: #6b776d;
  627. background: linear-gradient(172deg,
  628. #FAF6EF 0%,
  629. #F4EEE3 38%,
  630. #EDF0EC 68%,
  631. #E8EFE9 100%
  632. );
  633. overflow: hidden;
  634. }
  635. /* 背景氛围层:三层光感(前景/中景/背景)+ grain */
  636. .pageDecor {
  637. position: fixed;
  638. inset: 0;
  639. pointer-events: none;
  640. z-index: 0;
  641. }
  642. .pageGlow {
  643. position: absolute;
  644. border-radius: 50%;
  645. filter: blur(14rpx);
  646. }
  647. /* 背景层:左上森林绿微光 */
  648. .glowA {
  649. width: 780rpx;
  650. height: 780rpx;
  651. top: -280rpx;
  652. left: -300rpx;
  653. background: radial-gradient(circle, rgba(26, 84, 58, 0.18) 0%, rgba(20, 72, 50, 0) 70%);
  654. opacity: 0.85;
  655. }
  656. /* 中景层:右下金色暖光 */
  657. .glowB {
  658. width: 720rpx;
  659. height: 720rpx;
  660. right: -280rpx;
  661. top: 480rpx;
  662. background: radial-gradient(circle, rgba(200, 170, 120, 0.2) 0%, rgba(200, 170, 120, 0) 72%);
  663. opacity: 0.9;
  664. }
  665. /* 前景层:顶部柔和高光,塑造空间感 */
  666. .glowC {
  667. width: 600rpx;
  668. height: 360rpx;
  669. top: -60rpx;
  670. left: 50%;
  671. transform: translateX(-50%);
  672. background: radial-gradient(ellipse at 50% 0%, rgba(255, 252, 246, 0.38), transparent 70%);
  673. filter: blur(20rpx);
  674. opacity: 0.7;
  675. }
  676. /* 纹理叠加层 */
  677. .pageGrain {
  678. position: absolute;
  679. inset: 0;
  680. opacity: 0.55;
  681. background:
  682. radial-gradient(900rpx 380rpx at 48% -4%, rgba(255, 255, 255, 0.55), rgba(255, 255, 255, 0)),
  683. radial-gradient(640rpx 400rpx at 104% 48%, rgba(68, 112, 86, 0.09), rgba(68, 112, 86, 0)),
  684. radial-gradient(700rpx 320rpx at -4% 76%, rgba(210, 180, 130, 0.12), rgba(210, 180, 130, 0)),
  685. linear-gradient(180deg, rgba(248, 244, 236, 0.16) 0%, rgba(228, 242, 232, 0.08) 100%);
  686. }
  687. .safeTop {
  688. height: calc(env(safe-area-inset-top));
  689. position: relative;
  690. z-index: 1;
  691. }
  692. /* 轻品牌页头:透明底,不叠在 Hero 上产生「白雾」;层级低于首屏卡 */
  693. .brandPageHeader {
  694. position: relative;
  695. z-index: 2;
  696. display: flex;
  697. align-items: center;
  698. min-height: 72rpx;
  699. padding: 0 40rpx;
  700. box-sizing: border-box;
  701. border-bottom: 1rpx solid rgba(39, 75, 57, 0.05);
  702. background: transparent;
  703. }
  704. .brandPageHeaderInner {
  705. display: flex;
  706. align-items: center;
  707. gap: 10rpx;
  708. width: 100%;
  709. }
  710. .brandPageHeaderName {
  711. font-size: 22rpx;
  712. font-weight: 600;
  713. line-height: 1.15;
  714. letter-spacing: 0.1em;
  715. color: rgba(27, 41, 33, 0.65);
  716. }
  717. .brandPageHeaderDot {
  718. flex-shrink: 0;
  719. width: 4rpx;
  720. height: 4rpx;
  721. border-radius: 50%;
  722. background: rgba(39, 113, 76, 0.4);
  723. }
  724. .brandPageHeaderLabel {
  725. font-size: 20rpx;
  726. font-weight: 400;
  727. line-height: 1.15;
  728. letter-spacing: 0.06em;
  729. color: rgba(112, 143, 125, 0.7);
  730. }
  731. .hero,
  732. .content {
  733. position: relative;
  734. z-index: 1;
  735. }
  736. .hero {
  737. padding: 0 24rpx;
  738. }
  739. /* 完整首屏大卡:与品牌页头分离,避免负 margin 上提后被页头遮盖 */
  740. .heroCard {
  741. border-radius: 42rpx;
  742. overflow: hidden;
  743. margin-top: 20rpx;
  744. position: relative;
  745. z-index: 4;
  746. box-shadow:
  747. 0 48rpx 120rpx rgba(10, 36, 24, 0.2),
  748. 0 16rpx 48rpx rgba(10, 36, 24, 0.1),
  749. 0 2rpx 0 rgba(255, 255, 255, 0.6) inset;
  750. backdrop-filter: blur(4px);
  751. }
  752. /* Hero 视觉区:多层次光感空间,顶部高光 + 景深 + 底部暗化 */
  753. .heroBg {
  754. position: relative;
  755. width: 100%;
  756. height: 0;
  757. padding-bottom: 56.25%;
  758. overflow: hidden;
  759. background: linear-gradient(160deg, rgba(20, 74, 52, 0.72), rgba(205, 177, 129, 0.3) 70%, rgba(243, 232, 214, 0.36));
  760. }
  761. /* 前景层光晕:右下淡金色微光(提升质感) */
  762. .heroBg::before {
  763. content: '';
  764. position: absolute;
  765. right: -100rpx;
  766. bottom: -72rpx;
  767. width: 520rpx;
  768. height: 280rpx;
  769. border-radius: 50%;
  770. background: radial-gradient(ellipse at 42% 38%, rgba(252, 244, 228, 0.18), transparent 68%);
  771. pointer-events: none;
  772. z-index: 2;
  773. }
  774. .heroImage {
  775. position: absolute;
  776. inset: 0;
  777. width: 100%;
  778. height: 100%;
  779. display: block;
  780. z-index: 1;
  781. }
  782. .heroBrandAnchor {
  783. position: absolute;
  784. right: -48rpx;
  785. bottom: -14rpx;
  786. z-index: 2;
  787. pointer-events: none;
  788. }
  789. .heroBrandAnchorText {
  790. font-size: 164rpx;
  791. font-weight: 760;
  792. letter-spacing: 0.1em;
  793. line-height: 1;
  794. color: rgba(248, 241, 227, 0.045);
  795. transform: rotate(-8deg);
  796. }
  797. /* Hero 遮罩层:提亮后仍保留轻微底部过渡,避免压住真实商品图 */
  798. .heroMask {
  799. position: absolute;
  800. inset: 0;
  801. z-index: 3;
  802. background:
  803. radial-gradient(ellipse 180% 60% at 50% 0%, rgba(255, 252, 248, 0.26), transparent 68%),
  804. radial-gradient(480rpx 240rpx at 90% 8%, rgba(252, 248, 240, 0.2), transparent 62%),
  805. radial-gradient(700rpx 360rpx at 8% 65%, rgba(6, 24, 16, 0.12), transparent 58%),
  806. radial-gradient(560rpx 300rpx at 88% 80%, rgba(205, 177, 129, 0.06), transparent 62%),
  807. linear-gradient(180deg,
  808. rgba(8, 28, 18, 0) 0%,
  809. rgba(8, 28, 18, 0) 62%,
  810. rgba(10, 36, 24, 0.05) 80%,
  811. rgba(8, 26, 18, 0.1) 92%,
  812. rgba(248, 244, 238, 0.12) 100%
  813. );
  814. }
  815. /* 商品信息面板:玻璃浮层效果,负margin上浮 + backdrop-filter */
  816. .heroInfoPanel {
  817. background: rgba(252, 248, 242, 0.88);
  818. backdrop-filter: blur(14px);
  819. -webkit-backdrop-filter: blur(14px);
  820. position: relative;
  821. }
  822. /* 与 Hero 底部自然过渡 */
  823. .heroInfoPanel::before {
  824. content: '';
  825. position: absolute;
  826. top: -56rpx;
  827. left: 0;
  828. right: 0;
  829. height: 56rpx;
  830. background: linear-gradient(180deg,
  831. rgba(252, 248, 242, 0) 0%,
  832. rgba(252, 248, 242, 0.88) 100%
  833. );
  834. pointer-events: none;
  835. z-index: 1;
  836. }
  837. .infoPanelInner {
  838. position: relative;
  839. z-index: 2;
  840. padding: 32rpx 30rpx 30rpx;
  841. }
  842. /* 与下方农场/批次等卡片共用 .sectionHeader / .sectionHeaderLeft 样式 */
  843. .infoPanelBody {
  844. padding-top: 0;
  845. }
  846. .infoPanelName {
  847. display: block;
  848. font-size: 30rpx;
  849. font-weight: 680;
  850. line-height: 1.4;
  851. letter-spacing: 0.01em;
  852. color: rgba(27, 41, 33, 0.92);
  853. }
  854. .infoPanelSpec {
  855. display: inline-flex;
  856. align-items: center;
  857. gap: 10rpx;
  858. margin-top: 14rpx;
  859. padding: 8rpx 16rpx;
  860. border-radius: 20rpx;
  861. background: rgba(39, 113, 76, 0.06);
  862. border: 1rpx solid rgba(39, 113, 76, 0.08);
  863. }
  864. .specDot {
  865. width: 6rpx;
  866. height: 6rpx;
  867. border-radius: 50%;
  868. background: rgba(39, 113, 76, 0.5);
  869. }
  870. .specText {
  871. font-size: 20rpx;
  872. font-weight: 500;
  873. color: rgba(54, 66, 57, 0.85);
  874. }
  875. .infoPanelIntro {
  876. margin-top: 16rpx;
  877. padding-top: 16rpx;
  878. border-top: 1rpx solid rgba(39, 75, 57, 0.06);
  879. font-size: 23rpx;
  880. line-height: 1.8;
  881. color: rgba(54, 66, 57, 0.75);
  882. }
  883. .content {
  884. padding: 20rpx 0 40rpx;
  885. }
  886. /* 基础卡片:半透明玻璃质感 */
  887. .card {
  888. margin: 0 24rpx 22rpx;
  889. padding: 30rpx 28rpx;
  890. border-radius: 36rpx;
  891. background: rgba(252, 250, 244, 0.76);
  892. box-shadow:
  893. 0 16rpx 40rpx rgba(38, 41, 32, 0.07),
  894. 0 1rpx 0 rgba(255, 255, 255, 0.5) inset;
  895. backdrop-filter: blur(8px);
  896. -webkit-backdrop-filter: blur(8px);
  897. }
  898. .card.soft {
  899. background: rgba(252, 248, 244, 0.6);
  900. }
  901. /* Hero 之后第一张卡:适度上浮 */
  902. .cardHeroFirst {
  903. margin-top: -28rpx;
  904. position: relative;
  905. z-index: 3;
  906. }
  907. /* 层级 0:与 Hero 同级,主卡(商品面板) */
  908. .cardLevel0 {
  909. box-shadow:
  910. 0 48rpx 120rpx rgba(10, 36, 24, 0.16),
  911. 0 16rpx 48rpx rgba(10, 36, 24, 0.08),
  912. 0 1rpx 0 rgba(255, 255, 255, 0.6) inset;
  913. }
  914. /* 层级 1:次要信息卡,阴影中等 */
  915. .cardLevel1 {
  916. box-shadow:
  917. 0 20rpx 50rpx rgba(30, 34, 24, 0.09),
  918. 0 8rpx 24rpx rgba(30, 34, 24, 0.05),
  919. 0 1rpx 0 rgba(255, 255, 255, 0.55) inset;
  920. }
  921. /* 层级 2:次次要信息卡,阴影更轻 */
  922. .cardLevel2 {
  923. box-shadow:
  924. 0 14rpx 36rpx rgba(36, 38, 28, 0.065),
  925. 0 1rpx 0 rgba(255, 255, 255, 0.5) inset;
  926. }
  927. /* 层级 3:底部辅助信息卡,最轻 */
  928. .cardLevel3 {
  929. box-shadow:
  930. 0 8rpx 22rpx rgba(42, 44, 30, 0.04),
  931. 0 1rpx 0 rgba(255, 255, 255, 0.44) inset;
  932. }
  933. .cardFarm {
  934. background: rgba(250, 248, 242, 0.82);
  935. }
  936. .cardBatch {
  937. background: rgba(251, 248, 242, 0.8);
  938. }
  939. .cardCredential {
  940. background: rgba(252, 248, 240, 0.84);
  941. }
  942. .cardBatchState {
  943. background: rgba(252, 248, 244, 0.74);
  944. }
  945. /* ================================================
  946. 微动效:让页面"活起来"
  947. ================================================ */
  948. /* Hero 进入:上浮 + 淡入 */
  949. @keyframes heroEnter {
  950. 0% {
  951. opacity: 0;
  952. transform: translateY(28rpx);
  953. }
  954. 100% {
  955. opacity: 1;
  956. transform: translateY(0);
  957. }
  958. }
  959. .heroCard {
  960. animation: heroEnter 0.6s cubic-bezier(0.22, 0.78, 0.35, 1) both;
  961. }
  962. /* 卡片依次入场:延迟递增,制造节奏感 */
  963. @keyframes cardEnter {
  964. 0% {
  965. opacity: 0;
  966. transform: translateY(20rpx);
  967. }
  968. 100% {
  969. opacity: 1;
  970. transform: translateY(0);
  971. }
  972. }
  973. /* 商品面板:稍晚于 Hero */
  974. .heroInfoPanel {
  975. animation: cardEnter 0.5s cubic-bezier(0.22, 0.78, 0.35, 1) 0.15s both;
  976. }
  977. /* 农场卡 */
  978. .cardFarm {
  979. animation: cardEnter 0.5s cubic-bezier(0.22, 0.78, 0.35, 1) 0.25s both;
  980. }
  981. /* 批次卡 */
  982. .cardBatch {
  983. animation: cardEnter 0.5s cubic-bezier(0.22, 0.78, 0.35, 1) 0.35s both;
  984. }
  985. /* 凭证卡 */
  986. .cardCredential {
  987. animation: cardEnter 0.5s cubic-bezier(0.22, 0.78, 0.35, 1) 0.45s both;
  988. }
  989. /* ============================
  990. 检测报告横向卡片列表
  991. ============================ */
  992. .reportCardList {
  993. width: 100%;
  994. overflow-x: auto;
  995. overflow-y: hidden;
  996. -webkit-overflow-scrolling: touch;
  997. white-space: nowrap;
  998. }
  999. .reportCardList::-webkit-scrollbar {
  1000. display: none;
  1001. }
  1002. .reportCardTrack {
  1003. display: inline-flex;
  1004. flex-wrap: nowrap;
  1005. align-items: stretch;
  1006. gap: 16rpx;
  1007. padding: 6rpx 4rpx 10rpx;
  1008. /* 关键:让子项不受 flex 压缩,自然撑开形成横向溢出 */
  1009. width: max-content;
  1010. }
  1011. /* 单张报告卡片 */
  1012. .reportCard {
  1013. flex-shrink: 0;
  1014. width: 220rpx;
  1015. background: #FAFBF9;
  1016. border: 1rpx solid rgba(39, 75, 57, 0.09);
  1017. border-radius: 14rpx;
  1018. padding: 12rpx 12rpx 10rpx;
  1019. display: flex;
  1020. flex-direction: column;
  1021. align-items: stretch;
  1022. box-shadow: 0 2rpx 8rpx rgba(39, 75, 57, 0.04);
  1023. }
  1024. /* 缩略图(带页数角标覆盖层) */
  1025. .reportCardThumb {
  1026. position: relative;
  1027. width: 100%;
  1028. height: 196rpx;
  1029. background: rgba(39, 75, 57, 0.03);
  1030. border-radius: 10rpx;
  1031. overflow: hidden;
  1032. display: flex;
  1033. align-items: center;
  1034. justify-content: center;
  1035. margin-bottom: 10rpx;
  1036. }
  1037. .reportCardThumbImg {
  1038. width: 100%;
  1039. height: 100%;
  1040. }
  1041. .reportCardThumbEmpty {
  1042. width: 100%;
  1043. height: 100%;
  1044. display: flex;
  1045. align-items: center;
  1046. justify-content: center;
  1047. }
  1048. .reportCardThumbEmptyText {
  1049. font-size: 18rpx;
  1050. color: rgba(39, 75, 57, 0.3);
  1051. }
  1052. /* 页数角标:绝对定位在缩略图右下角 */
  1053. .reportCardPages {
  1054. position: absolute;
  1055. bottom: 8rpx;
  1056. right: 8rpx;
  1057. font-size: 15rpx;
  1058. color: rgba(39, 75, 57, 0.65);
  1059. background: rgba(250, 251, 249, 0.88);
  1060. border: 1rpx solid rgba(39, 75, 57, 0.1);
  1061. border-radius: 6rpx;
  1062. padding: 2rpx 8rpx;
  1063. line-height: 1.4;
  1064. }
  1065. /* 报告元信息 */
  1066. .reportCardMeta {
  1067. flex: 1;
  1068. margin-bottom: 6rpx;
  1069. }
  1070. .reportCardRow {
  1071. display: flex;
  1072. justify-content: space-between;
  1073. align-items: baseline;
  1074. gap: 4rpx;
  1075. margin-bottom: 4rpx;
  1076. }
  1077. .reportCardLabel {
  1078. font-size: 16rpx;
  1079. color: rgba(84, 106, 93, 0.6);
  1080. flex-shrink: 0;
  1081. }
  1082. .reportCardValue {
  1083. font-size: 16rpx;
  1084. color: rgba(68, 82, 72, 0.85);
  1085. font-weight: 460;
  1086. text-align: right;
  1087. word-break: break-all;
  1088. }
  1089. .reportCardValueNo {
  1090. font-size: 14rpx;
  1091. color: rgba(68, 82, 72, 0.72);
  1092. }
  1093. /* 点击提示 */
  1094. .reportCardHint {
  1095. font-size: 14rpx;
  1096. color: rgba(39, 75, 57, 0.3);
  1097. text-align: center;
  1098. margin-top: auto;
  1099. }
  1100. /* 底部辅助卡 */
  1101. .cardBatchState {
  1102. animation: cardEnter 0.5s cubic-bezier(0.22, 0.78, 0.35, 1) 0.55s both;
  1103. }
  1104. /* 卡片触摸反馈:阴影增强(模拟按压感) */
  1105. .card:active {
  1106. transition: box-shadow 0.15s ease, transform 0.15s ease;
  1107. }
  1108. /* 触摸时轻微缩小,增加真实感 */
  1109. .card:active:not(.heroInfoPanel) {
  1110. transform: scale(0.99);
  1111. }
  1112. .sectionHeader {
  1113. display: flex;
  1114. align-items: center;
  1115. justify-content: space-between;
  1116. gap: 18rpx;
  1117. margin-bottom: 20rpx;
  1118. }
  1119. .sectionHeaderLeft {
  1120. display: flex;
  1121. flex-direction: column;
  1122. gap: 10rpx;
  1123. position: relative;
  1124. padding-bottom: 8rpx;
  1125. }
  1126. .sectionHeaderLeft::after {
  1127. content: '';
  1128. position: absolute;
  1129. left: 0;
  1130. bottom: 0;
  1131. width: 78rpx;
  1132. height: 2rpx;
  1133. border-radius: 999rpx;
  1134. background: linear-gradient(90deg, rgba(46, 82, 63, 0.3), rgba(203, 176, 128, 0.26), rgba(46, 82, 63, 0));
  1135. pointer-events: none;
  1136. }
  1137. .sectionEn {
  1138. font-size: 15rpx;
  1139. font-weight: 500;
  1140. letter-spacing: 0.24em;
  1141. text-transform: uppercase;
  1142. color: rgba(84, 106, 93, 0.76);
  1143. }
  1144. .sectionTitle {
  1145. font-size: 27rpx;
  1146. font-weight: 680;
  1147. color: rgba(60, 72, 64, 0.82);
  1148. }
  1149. .statusBadge {
  1150. font-size: 18rpx;
  1151. font-weight: 620;
  1152. padding: 9rpx 15rpx;
  1153. border-radius: 999rpx;
  1154. white-space: nowrap;
  1155. border: 1rpx solid transparent;
  1156. box-shadow: 0 1rpx 0 rgba(255, 255, 255, 0.34) inset;
  1157. }
  1158. .statusBadge.ok {
  1159. color: #1d5d40;
  1160. background: rgba(39, 113, 76, 0.12);
  1161. border-color: rgba(39, 113, 76, 0.2);
  1162. }
  1163. .statusBadge.wait {
  1164. color: #715726;
  1165. background: rgba(203, 171, 112, 0.2);
  1166. border-color: rgba(203, 171, 112, 0.26);
  1167. }
  1168. .statusBadge.warning {
  1169. color: #8a5e22;
  1170. background: rgba(214, 174, 95, 0.22);
  1171. border-color: rgba(214, 174, 95, 0.28);
  1172. }
  1173. .statusBadge.muted {
  1174. color: #677069;
  1175. background: rgba(126, 137, 128, 0.14);
  1176. border-color: rgba(126, 137, 128, 0.2);
  1177. }
  1178. /* =============================================
  1179. 商品信息面板专用信任认证徽章:强化图标主视觉、文字辅助
  1180. ============================================= */
  1181. /* 整体:认证章风格,低饱和细边框,无交互感 */
  1182. .trustBadge {
  1183. display: inline-flex;
  1184. align-items: center;
  1185. gap: 7rpx;
  1186. padding: 9rpx 18rpx 9rpx 15rpx;
  1187. border-radius: 999rpx;
  1188. border: 1rpx solid rgba(39, 113, 76, 0.22);
  1189. background: rgba(39, 113, 76, 0.06);
  1190. box-shadow:
  1191. 0 2rpx 6rpx rgba(39, 113, 76, 0.06),
  1192. 0 1rpx 0 rgba(255, 255, 255, 0.55) inset;
  1193. white-space: nowrap;
  1194. cursor: default;
  1195. pointer-events: none;
  1196. user-select: none;
  1197. }
  1198. /* 双圆环认证图标:20×20 viewBox,图标为第一视觉焦点 */
  1199. .trustBadgeIcon {
  1200. width: 30rpx;
  1201. height: 30rpx;
  1202. flex-shrink: 0;
  1203. vertical-align: middle;
  1204. display: inline-block;
  1205. }
  1206. /* 文案:品牌深绿,字重略降,视觉权重低于图标 */
  1207. .trustBadgeText {
  1208. font-size: 18rpx;
  1209. font-weight: 500;
  1210. letter-spacing: 0.05em;
  1211. color: rgba(27, 71, 42, 0.68);
  1212. }
  1213. .kv {
  1214. display: flex;
  1215. flex-direction: column;
  1216. gap: 16rpx;
  1217. }
  1218. .kvRow {
  1219. display: flex;
  1220. align-items: baseline;
  1221. justify-content: space-between;
  1222. gap: 16rpx;
  1223. }
  1224. .kvKey {
  1225. font-size: 22rpx;
  1226. font-weight: 480;
  1227. color: rgba(54, 68, 58, 0.62);
  1228. }
  1229. .kvVal {
  1230. font-size: 24rpx;
  1231. font-weight: 660;
  1232. text-align: right;
  1233. color: rgba(27, 41, 33, 0.92);
  1234. }
  1235. /* 农场主体:左图右文,右栏与图片垂直居中,名称/地址成组 */
  1236. .farmBody {
  1237. display: flex;
  1238. align-items: center;
  1239. gap: 24rpx;
  1240. margin-bottom: 18rpx;
  1241. }
  1242. .farmImageWrap {
  1243. flex-shrink: 0;
  1244. width: 180rpx;
  1245. height: 136rpx;
  1246. border-radius: 22rpx;
  1247. overflow: hidden;
  1248. position: relative;
  1249. box-shadow:
  1250. 0 12rpx 28rpx rgba(24, 41, 30, 0.14),
  1251. 0 2rpx 0 rgba(255, 255, 255, 0.3) inset;
  1252. }
  1253. .farmImage {
  1254. width: 100%;
  1255. height: 100%;
  1256. display: block;
  1257. background: linear-gradient(160deg, rgba(234, 245, 240, 0.9), rgba(220, 238, 228, 0.85));
  1258. }
  1259. .farmMeta {
  1260. flex: 1;
  1261. display: flex;
  1262. flex-direction: column;
  1263. justify-content: center;
  1264. min-width: 0;
  1265. gap: 10rpx;
  1266. }
  1267. .farmName {
  1268. font-size: 28rpx;
  1269. font-weight: 680;
  1270. line-height: 1.45;
  1271. letter-spacing: 0.01em;
  1272. color: rgba(27, 41, 33, 0.94);
  1273. }
  1274. /* 农场地址:普通文本样式,弱于标题;多行时图标与首行对齐 */
  1275. .farmLocation {
  1276. display: flex;
  1277. align-items: flex-start;
  1278. gap: 8rpx;
  1279. }
  1280. /* 定位小图标:略弱、与首行文字视觉对齐 */
  1281. .locationIcon {
  1282. width: 18rpx;
  1283. height: 18rpx;
  1284. flex-shrink: 0;
  1285. margin-top: 6rpx;
  1286. opacity: 0.42;
  1287. }
  1288. .locationText {
  1289. flex: 1;
  1290. min-width: 0;
  1291. font-size: 21rpx;
  1292. font-weight: 400;
  1293. color: rgba(84, 106, 93, 0.82);
  1294. line-height: 1.55;
  1295. letter-spacing: 0.02em;
  1296. }
  1297. /* 农场介绍:融入主体,使用分隔线区分,与商品简介风格统一 */
  1298. .farmIntro {
  1299. padding-top: 18rpx;
  1300. border-top: 1rpx solid rgba(39, 75, 57, 0.06);
  1301. font-size: 23rpx;
  1302. line-height: 1.86;
  1303. color: rgba(54, 68, 58, 0.76);
  1304. }
  1305. .emptyText {
  1306. margin-top: 10rpx;
  1307. font-size: 24rpx;
  1308. line-height: 1.62;
  1309. color: rgba(16, 24, 19, 0.72);
  1310. }
  1311. .btnRow {
  1312. margin-top: 22rpx;
  1313. }
  1314. /* 合格证紧凑缩略图 */
  1315. /* ============================
  1316. 合格证:信息摘要 + 缩略图一体化布局
  1317. ============================ */
  1318. .certSummary {
  1319. display: flex;
  1320. align-items: flex-start;
  1321. gap: 24rpx;
  1322. }
  1323. .certSummaryInfo {
  1324. flex: 1;
  1325. display: flex;
  1326. flex-direction: column;
  1327. gap: 14rpx;
  1328. min-width: 0;
  1329. }
  1330. .certSummaryRow {
  1331. display: flex;
  1332. flex-direction: column;
  1333. gap: 4rpx;
  1334. }
  1335. .certSummaryLabel {
  1336. font-size: 20rpx;
  1337. font-weight: 500;
  1338. color: rgba(39, 75, 57, 0.55);
  1339. letter-spacing: 0.02em;
  1340. }
  1341. .certSummaryValue {
  1342. font-size: 25rpx;
  1343. font-weight: 580;
  1344. color: rgba(27, 41, 33, 0.9);
  1345. line-height: 1.4;
  1346. }
  1347. .certThumbContainer {
  1348. flex: 0 0 auto;
  1349. display: flex;
  1350. flex-direction: column;
  1351. align-items: center;
  1352. gap: 4rpx;
  1353. }
  1354. .certThumbContainer .certThumbWrap {
  1355. /* 与左侧两行摘要区总高约齐平:缩略图 + gap + 提示行 */
  1356. width: 88rpx;
  1357. height: 120rpx;
  1358. border-radius: 8rpx;
  1359. overflow: hidden;
  1360. background: #fff;
  1361. border: 1rpx solid rgba(200, 180, 140, 0.22);
  1362. box-shadow: 0 2rpx 8rpx rgba(30, 36, 26, 0.06);
  1363. }
  1364. .certThumbContainer .certThumbImage {
  1365. width: 100%;
  1366. height: 100%;
  1367. display: block;
  1368. }
  1369. .certPreviewHint {
  1370. font-size: 16rpx;
  1371. line-height: 1.15;
  1372. color: rgba(39, 75, 57, 0.4);
  1373. letter-spacing: 0.01em;
  1374. }
  1375. .certPendingHint {
  1376. flex: 1;
  1377. display: flex;
  1378. align-items: center;
  1379. padding: 12rpx 0;
  1380. }
  1381. .certPendingText {
  1382. font-size: 21rpx;
  1383. color: rgba(39, 75, 57, 0.5);
  1384. line-height: 1.5;
  1385. }
  1386. /* 旧样式保留但隐藏(兼容其他模块) */
  1387. .certPreviewCompact {
  1388. display: flex;
  1389. flex-direction: column;
  1390. align-items: center;
  1391. margin-top: 24rpx;
  1392. }
  1393. .docPlaceholder {
  1394. margin-top: 16rpx;
  1395. padding: 20rpx;
  1396. border-radius: 26rpx;
  1397. background: linear-gradient(160deg, rgba(244, 237, 224, 0.82), rgba(237, 244, 235, 0.72));
  1398. border: 1rpx solid rgba(201, 171, 120, 0.22);
  1399. }
  1400. .docPlaceholderTitle {
  1401. display: block;
  1402. margin-bottom: 12rpx;
  1403. font-size: 22rpx;
  1404. font-weight: 650;
  1405. color: rgba(35, 93, 64, 0.92);
  1406. }
  1407. .docPlaceholderText {
  1408. display: block;
  1409. font-size: 22rpx;
  1410. line-height: 1.75;
  1411. color: rgba(59, 71, 62, 0.82);
  1412. }
  1413. .docBlock {
  1414. margin-top: 14rpx;
  1415. padding: 18rpx;
  1416. border-radius: 22rpx;
  1417. background: rgba(255, 255, 255, 0.46);
  1418. }
  1419. .docBlock:first-of-type {
  1420. margin-top: 4rpx;
  1421. }
  1422. .docTitle {
  1423. display: block;
  1424. margin-bottom: 10rpx;
  1425. font-size: 22rpx;
  1426. font-weight: 620;
  1427. color: rgba(45, 87, 64, 0.84);
  1428. }
  1429. .docText {
  1430. font-size: 22rpx;
  1431. line-height: 1.8;
  1432. color: rgba(64, 75, 67, 0.8);
  1433. }
  1434. /* 批次信息主体:连续信息排版,标签-值对应,与商品信息卡风格统一 */
  1435. .batchBody {
  1436. display: flex;
  1437. flex-direction: column;
  1438. }
  1439. /* 批次信息主体:左右两列布局,左列固定,右列自适应,内容左对齐 */
  1440. .batchBody {
  1441. display: flex;
  1442. flex-direction: column;
  1443. }
  1444. .batchRow {
  1445. display: flex;
  1446. align-items: baseline;
  1447. padding: 16rpx 0;
  1448. }
  1449. .batchRow + .batchRow {
  1450. border-top: 1rpx solid rgba(39, 75, 57, 0.05);
  1451. }
  1452. .batchRowLabel {
  1453. flex-shrink: 0;
  1454. width: 162rpx;
  1455. font-size: 21rpx;
  1456. font-weight: 460;
  1457. color: rgba(84, 106, 93, 0.68);
  1458. letter-spacing: 0.02em;
  1459. line-height: 1.5;
  1460. }
  1461. .batchRowValue {
  1462. flex: 1;
  1463. min-width: 0;
  1464. font-size: 25rpx;
  1465. font-weight: 580;
  1466. line-height: 1.4;
  1467. letter-spacing: 0.01em;
  1468. color: rgba(27, 41, 33, 0.9);
  1469. }
  1470. .cardCredential .certSummary {
  1471. margin-top: 4rpx;
  1472. }
  1473. /* 底部柔和收口渐变 */
  1474. .footerFade {
  1475. position: relative;
  1476. height: 1rpx;
  1477. margin: 0 80rpx;
  1478. background: linear-gradient(90deg,
  1479. transparent 0%,
  1480. rgba(39, 75, 57, 0.15) 30%,
  1481. rgba(39, 75, 57, 0.2) 50%,
  1482. rgba(39, 75, 57, 0.15) 70%,
  1483. transparent 100%
  1484. );
  1485. }
  1486. .footerFade::before {
  1487. content: '';
  1488. position: absolute;
  1489. top: 0;
  1490. left: 50%;
  1491. transform: translateX(-50%);
  1492. width: 60%;
  1493. height: 80rpx;
  1494. background: radial-gradient(ellipse at 50% 100%, rgba(39, 75, 57, 0.06), transparent 70%);
  1495. }
  1496. /* 轻量页脚 */
  1497. .traceFooter {
  1498. padding: 36rpx 32rpx 52rpx;
  1499. display: flex;
  1500. flex-direction: column;
  1501. align-items: center;
  1502. gap: 14rpx;
  1503. }
  1504. .traceFooterHint {
  1505. font-size: 20rpx;
  1506. font-weight: 400;
  1507. color: rgba(88, 100, 92, 0.45);
  1508. letter-spacing: 0.03em;
  1509. }
  1510. .traceFooterPhone {
  1511. display: flex;
  1512. align-items: center;
  1513. gap: 6rpx;
  1514. padding: 8rpx 16rpx;
  1515. border-radius: 6rpx;
  1516. transition: opacity 0.2s ease;
  1517. }
  1518. .traceFooterPhone:active {
  1519. opacity: 0.55;
  1520. }
  1521. .traceFooterPhoneIcon {
  1522. width: 22rpx;
  1523. height: 22rpx;
  1524. opacity: 0.55;
  1525. }
  1526. .traceFooterPhoneNum {
  1527. font-size: 22rpx;
  1528. font-weight: 400;
  1529. color: rgba(39, 75, 57, 0.6);
  1530. letter-spacing: 0.04em;
  1531. }
  1532. .traceFooterBrand {
  1533. font-size: 17rpx;
  1534. font-weight: 400;
  1535. letter-spacing: 0.1em;
  1536. color: rgba(88, 100, 92, 0.3);
  1537. margin-top: 8rpx;
  1538. }
  1539. </style>