detail.vue 91 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008200920102011201220132014201520162017201820192020202120222023202420252026202720282029203020312032203320342035203620372038203920402041204220432044204520462047204820492050205120522053205420552056205720582059206020612062206320642065206620672068206920702071207220732074207520762077207820792080208120822083208420852086208720882089209020912092209320942095209620972098209921002101210221032104210521062107210821092110211121122113211421152116211721182119212021212122212321242125212621272128212921302131213221332134213521362137213821392140214121422143214421452146214721482149215021512152215321542155215621572158215921602161216221632164216521662167216821692170217121722173217421752176217721782179218021812182218321842185218621872188218921902191219221932194219521962197219821992200220122022203220422052206220722082209221022112212221322142215221622172218221922202221222222232224222522262227222822292230223122322233223422352236223722382239224022412242224322442245224622472248224922502251225222532254225522562257225822592260226122622263226422652266226722682269227022712272227322742275227622772278227922802281228222832284228522862287228822892290229122922293229422952296229722982299230023012302230323042305230623072308230923102311231223132314231523162317231823192320232123222323232423252326232723282329233023312332233323342335233623372338233923402341234223432344234523462347234823492350235123522353235423552356235723582359236023612362236323642365236623672368236923702371237223732374237523762377237823792380238123822383238423852386238723882389239023912392239323942395239623972398239924002401240224032404240524062407240824092410241124122413241424152416241724182419242024212422242324242425242624272428242924302431243224332434243524362437243824392440244124422443244424452446244724482449245024512452245324542455245624572458245924602461246224632464246524662467246824692470247124722473247424752476247724782479248024812482248324842485248624872488248924902491249224932494249524962497249824992500250125022503250425052506250725082509251025112512251325142515251625172518251925202521252225232524252525262527252825292530253125322533253425352536253725382539254025412542254325442545254625472548254925502551255225532554255525562557255825592560256125622563256425652566256725682569257025712572257325742575257625772578257925802581258225832584258525862587258825892590259125922593259425952596259725982599260026012602260326042605260626072608260926102611261226132614261526162617261826192620262126222623262426252626262726282629263026312632263326342635263626372638263926402641264226432644264526462647264826492650265126522653265426552656265726582659266026612662266326642665266626672668266926702671267226732674267526762677267826792680268126822683268426852686268726882689269026912692269326942695269626972698269927002701270227032704270527062707270827092710271127122713271427152716271727182719272027212722272327242725272627272728272927302731273227332734273527362737273827392740274127422743274427452746274727482749275027512752275327542755275627572758275927602761276227632764276527662767276827692770277127722773277427752776277727782779278027812782278327842785278627872788278927902791279227932794279527962797279827992800280128022803280428052806280728082809281028112812281328142815281628172818281928202821282228232824282528262827282828292830283128322833283428352836283728382839284028412842284328442845284628472848284928502851285228532854285528562857285828592860286128622863286428652866286728682869287028712872287328742875287628772878287928802881288228832884288528862887288828892890289128922893289428952896289728982899290029012902290329042905290629072908290929102911291229132914291529162917291829192920292129222923292429252926292729282929293029312932293329342935293629372938293929402941294229432944294529462947294829492950295129522953295429552956295729582959296029612962296329642965296629672968296929702971297229732974297529762977297829792980298129822983298429852986298729882989299029912992299329942995299629972998299930003001300230033004300530063007300830093010301130123013301430153016301730183019302030213022302330243025302630273028302930303031303230333034303530363037303830393040304130423043304430453046304730483049305030513052305330543055305630573058305930603061306230633064306530663067306830693070307130723073307430753076307730783079308030813082308330843085308630873088308930903091309230933094309530963097309830993100310131023103310431053106310731083109311031113112311331143115311631173118311931203121312231233124312531263127312831293130313131323133313431353136313731383139314031413142314331443145314631473148314931503151315231533154315531563157315831593160316131623163316431653166316731683169317031713172317331743175317631773178317931803181318231833184318531863187318831893190319131923193319431953196319731983199320032013202320332043205320632073208320932103211321232133214321532163217321832193220322132223223322432253226322732283229323032313232323332343235323632373238323932403241324232433244324532463247324832493250325132523253325432553256325732583259326032613262326332643265326632673268326932703271327232733274327532763277327832793280328132823283328432853286328732883289329032913292329332943295329632973298329933003301330233033304330533063307330833093310331133123313331433153316331733183319332033213322332333243325332633273328332933303331333233333334333533363337333833393340334133423343334433453346334733483349335033513352335333543355335633573358335933603361336233633364336533663367336833693370337133723373337433753376337733783379338033813382338333843385338633873388338933903391339233933394339533963397339833993400340134023403340434053406340734083409341034113412341334143415341634173418341934203421342234233424342534263427342834293430343134323433343434353436343734383439344034413442344334443445344634473448344934503451345234533454345534563457345834593460346134623463346434653466346734683469347034713472347334743475347634773478347934803481348234833484348534863487348834893490349134923493349434953496349734983499350035013502350335043505350635073508350935103511351235133514351535163517351835193520352135223523352435253526352735283529353035313532353335343535353635373538353935403541354235433544354535463547354835493550355135523553355435553556355735583559356035613562356335643565356635673568356935703571357235733574357535763577357835793580358135823583358435853586358735883589359035913592359335943595359635973598359936003601360236033604360536063607360836093610361136123613361436153616361736183619362036213622362336243625362636273628362936303631363236333634363536363637363836393640364136423643364436453646364736483649365036513652365336543655365636573658365936603661366236633664366536663667366836693670367136723673367436753676367736783679368036813682368336843685368636873688368936903691369236933694369536963697369836993700370137023703370437053706370737083709371037113712371337143715371637173718371937203721372237233724372537263727372837293730373137323733373437353736373737383739374037413742374337443745374637473748374937503751375237533754375537563757375837593760376137623763376437653766376737683769377037713772377337743775377637773778377937803781378237833784378537863787378837893790379137923793379437953796379737983799380038013802380338043805380638073808
  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.batch?.exists && traceDetail.traceConclusionCard" class="card cardLevel1 cardConclusion">
  72. <view class="sectionHeader">
  73. <view class="sectionHeaderLeft">
  74. <text class="sectionEn">Conclusion</text>
  75. <text class="sectionTitle">溯源结论</text>
  76. </view>
  77. </view>
  78. <view class="conclusionBody">
  79. <text class="conclusionLead">{{ traceDetail.traceConclusionCard.conclusion }}</text>
  80. <text class="conclusionDesc">{{ traceDetail.traceConclusionCard.desc }}</text>
  81. </view>
  82. </view>
  83. <!-- 农场信息(合并为单卡:图片+名称+地区+介绍连续表达) -->
  84. <view v-if="traceDetail.farm?.name" class="card cardLevel2 cardFarm">
  85. <view class="sectionHeader">
  86. <view class="sectionHeaderLeft">
  87. <text class="sectionEn">Farm</text>
  88. <text class="sectionTitle">农场信息</text>
  89. </view>
  90. </view>
  91. <!-- 农场主体:左图右文结构,融入主体内容 -->
  92. <view class="farmBody">
  93. <view class="farmImageWrap">
  94. <image class="farmImage" :src="traceDetail.farm.image" mode="aspectFill" />
  95. </view>
  96. <view class="farmMeta">
  97. <text class="farmName">{{ traceDetail.farm.name }}</text>
  98. <view v-if="traceDetail.farm.location" class="farmLocation">
  99. <svg class="locationIcon" viewBox="0 0 20 20" fill="none" xmlns="http://www.w3.org/2000/svg">
  100. <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)"/>
  101. </svg>
  102. <text class="locationText">{{ traceDetail.farm.location }}</text>
  103. </view>
  104. </view>
  105. </view>
  106. <view v-if="traceDetail.farm?.intro" class="farmIntro">
  107. <text>{{ traceDetail.farm.intro }}</text>
  108. </view>
  109. </view>
  110. <!-- 农事时间轴:关键种植过程 -->
  111. <view v-if="traceDetail.batch?.exists && traceDetail.farmTimeline?.length" class="card cardLevel1 cardTimeline">
  112. <view class="sectionHeader">
  113. <view class="sectionHeaderLeft">
  114. <text class="sectionEn">Process</text>
  115. <text class="sectionTitle">种植过程记录</text>
  116. </view>
  117. </view>
  118. <view class="timelineList">
  119. <view
  120. v-for="(item, index) in traceDetail.farmTimeline"
  121. :key="`timeline-${index}`"
  122. :class="{
  123. 'timelineItem': true,
  124. 'is-key': item.stage === 'test',
  125. 'is-current': item.stage === 'pack'
  126. }"
  127. >
  128. <view class="timelineLeft">
  129. <view class="timelineDot" />
  130. <view v-if="index !== traceDetail.farmTimeline.length - 1" class="timelineLine" />
  131. </view>
  132. <view class="timelineRight">
  133. <text v-if="item.time" class="timelineTime">{{ item.time }}</text>
  134. <text class="timelineTitle">{{ item.title }}</text>
  135. <text class="timelineDesc">{{ item.desc }}</text>
  136. </view>
  137. </view>
  138. </view>
  139. <view class="timelineFootnote">
  140. <text>以上信息真实有效,可追溯验证</text>
  141. </view>
  142. </view>
  143. <!-- 种植现场实时画面 -->
  144. <view v-if="traceDetail.batch?.exists && traceDetail.camera" class="card cardLevel1 cardLive">
  145. <view class="sectionHeader">
  146. <view class="sectionHeaderLeft">
  147. <text class="sectionEn">Live Scene</text>
  148. <text class="sectionTitle">种植现场</text>
  149. </view>
  150. </view>
  151. <!-- <image
  152. v-if="traceDetail.camera.coverImage"
  153. class="liveCover"
  154. :src="traceDetail.camera.coverImage"
  155. mode="aspectFill"
  156. />
  157. <view v-else class="livePlaceholder">
  158. <view class="livePlayIcon">
  159. <view class="livePlayDot" />
  160. <view class="livePlayDot dot2" />
  161. <view class="livePlayDot dot3" />
  162. </view>
  163. <text class="livePlaceholderMain">实时画面接入中</text>
  164. <text class="livePlaceholderSub">请稍候查看现场情况</text>
  165. </view> -->
  166. <!-- 视频预览区域 -->
  167. <view class="video-section">
  168. <view class="video-container" :class="{'fullscreen-mode': isFullscreen}">
  169. <!-- 默认未播放态背景:深灰绿 + 柔和层次感 -->
  170. <view v-if="!isPlaying" class="video-placeholder-bg"></view>
  171. <!-- 使用跨平台视频播放组件 -->
  172. <!-- #ifdef H5 -->
  173. <view v-if="isPlaying" class="h5-video-wrapper">
  174. <Jessibuca ref="jessibucaRef" :videoUrl="getH5StreamUrl" :hasAudio="true" @error="onVideoError" />
  175. </view>
  176. <!-- #endif -->
  177. <!-- 微信小程序视频播放 -->
  178. <!-- #ifdef MP-WEIXIN -->
  179. <video
  180. v-if="isPlaying"
  181. id="myVideo"
  182. class="video-player"
  183. :src="getAppStreamUrl"
  184. :autoplay="true"
  185. :controls="true"
  186. :show-center-play-btn="true"
  187. :enable-progress-gesture="false"
  188. :object-fit="'contain'"
  189. @error="onVideoError"
  190. @play="onVideoPlay"
  191. @pause="onVideoPause"
  192. @ended="onVideoEnded"
  193. @timeupdate="onTimeUpdate"
  194. @fullscreenchange="onFullscreenChange"
  195. ></video>
  196. <!-- #endif -->
  197. <!-- App端视频播放 -->
  198. <!-- #ifdef APP-PLUS || APP-HARMONY -->
  199. <video
  200. v-if="isPlaying"
  201. id="appVideo"
  202. class="video-player"
  203. :src="getAppStreamUrl"
  204. :autoplay="true"
  205. :controls="true"
  206. :show-center-play-btn="true"
  207. @error="onVideoError"
  208. ></video>
  209. <!-- #endif -->
  210. <!-- 视频控制层 -->
  211. <view class="video-controls">
  212. <view class="control-row top-controls">
  213. <!-- 左上角留空,保持简洁 -->
  214. <!-- 右上角:全屏按钮(仅播放态显示) -->
  215. <view v-if="isPlaying" class="fullscreen-button" @click="toggleFullscreen">
  216. <image src="/static/icons/resize_icon.png" mode="aspectFit"
  217. style="width: 18px; height: 18px;"></image>
  218. </view>
  219. </view>
  220. <view class="control-row center-controls">
  221. <!-- 默认未播放态:圆形播放按钮 -->
  222. <view v-if="!isPlaying" class="play-button" @click="togglePlayState">
  223. <view class="play-btn-circle">
  224. <view class="play-btn-icon"></view>
  225. </view>
  226. </view>
  227. <!-- 播放态:暂停按钮 -->
  228. <view v-else class="center-button-container" @click="togglePlayState">
  229. <view class="pause-icon">
  230. <image src="/static/icons/pause_icon.png" mode="aspectFit"
  231. style="width: 24px; height: 24px;"></image>
  232. </view>
  233. </view>
  234. </view>
  235. <view class="control-row bottom-controls">
  236. <!-- 只在播放时显示时间码 -->
  237. <view v-if="isPlaying" class="video-time">{{ currentTime }}</view>
  238. </view>
  239. </view>
  240. <!-- 实时在线状态标签(固定在右上角,不受其他元素影响) -->
  241. <view class="video-fixed-status">
  242. <view class="liveStatusPill" :class="cameraStatus.value">
  243. <view class="liveStatusDot" />
  244. <text class="liveStatusText">实时在线</text>
  245. </view>
  246. </view>
  247. </view>
  248. </view>
  249. <view class="liveDesc">
  250. <text>现场画面可见,种植状态真实呈现</text>
  251. </view>
  252. </view>
  253. <!-- 种植环境记录 -->
  254. <view v-if="traceDetail.batch?.exists && traceDetail.environment" class="card cardLevel1 cardEnvironment">
  255. <view class="sectionHeader">
  256. <view class="sectionHeaderLeft">
  257. <text class="sectionEn">Environment</text>
  258. <text class="sectionTitle">种植环境记录</text>
  259. </view>
  260. </view>
  261. <view class="environmentSummary">
  262. <text>{{ traceDetail.environment.summary }}</text>
  263. </view>
  264. <!-- 土壤养分趋势图 -->
  265. <view v-if="traceDetail.environment.chart" class="environmentChart">
  266. <view class="environmentChartHead">
  267. <text class="environmentChartTitle">土壤养分变化趋势</text>
  268. <text class="environmentChartSub">氮 / 磷 / 钾 种植期记录</text>
  269. </view>
  270. <view class="environmentChartCanvas">
  271. <!-- SVG 绘图区 -->
  272. <view class="chartPlotArea">
  273. <svg class="chartSvg" viewBox="0 0 700 200" preserveAspectRatio="none">
  274. <!-- 网格线 -->
  275. <line v-for="(line, idx) in svgGridLines" :key="`grid-${idx}`"
  276. class="chartGridLineSvg"
  277. :x1="0" :y1="line" :x2="700" :y2="line"
  278. />
  279. <!-- 定义渐变和发光滤镜 -->
  280. <defs>
  281. <linearGradient id="gradN" x1="0%" y1="0%" x2="100%" y2="0%">
  282. <stop offset="0%" stop-color="rgba(47, 125, 85, 0.3)" />
  283. <stop offset="50%" stop-color="rgba(47, 125, 85, 0.7)" />
  284. <stop offset="100%" stop-color="rgba(47, 125, 85, 0.3)" />
  285. </linearGradient>
  286. <linearGradient id="gradP" x1="0%" y1="0%" x2="100%" y2="0%">
  287. <stop offset="0%" stop-color="rgba(180, 140, 70, 0.3)" />
  288. <stop offset="50%" stop-color="rgba(180, 140, 70, 0.7)" />
  289. <stop offset="100%" stop-color="rgba(180, 140, 70, 0.3)" />
  290. </linearGradient>
  291. <linearGradient id="gradK" x1="0%" y1="0%" x2="100%" y2="0%">
  292. <stop offset="0%" stop-color="rgba(84, 130, 110, 0.3)" />
  293. <stop offset="50%" stop-color="rgba(84, 130, 110, 0.7)" />
  294. <stop offset="100%" stop-color="rgba(84, 130, 110, 0.3)" />
  295. </linearGradient>
  296. <filter id="glow" x="-50%" y="-50%" width="200%" height="200%">
  297. <feGaussianBlur stdDeviation="3" result="blur" />
  298. <feMerge>
  299. <feMergeNode in="blur" />
  300. <feMergeNode in="SourceGraphic" />
  301. </feMerge>
  302. </filter>
  303. </defs>
  304. <!-- 面积渐变层(先绘制,在线下方) -->
  305. <path class="chartAreaN" :d="chartAreas.n" />
  306. <path class="chartAreaP" :d="chartAreas.p" />
  307. <path class="chartAreaK" :d="chartAreas.k" />
  308. <!-- 曲线层(带渐变和发光) -->
  309. <path class="chartPathN" :d="chartPaths.n" stroke="url(#gradN)" />
  310. <path class="chartPathP" :d="chartPaths.p" stroke="url(#gradP)" />
  311. <path class="chartPathK" :d="chartPaths.k" stroke="url(#gradK)" />
  312. <!-- 数据点 -->
  313. <circle v-for="(pt, idx) in chartPoints.n" :key="`n-${idx}`"
  314. class="chartDotN"
  315. cx="0" cy="0" r="3"
  316. :transform="`translate(${pt.x}, ${pt.y})`"
  317. />
  318. <circle v-for="(pt, idx) in chartPoints.p" :key="`p-${idx}`"
  319. class="chartDotP"
  320. cx="0" cy="0" r="3"
  321. :transform="`translate(${pt.x}, ${pt.y})`"
  322. />
  323. <circle v-for="(pt, idx) in chartPoints.k" :key="`k-${idx}`"
  324. class="chartDotK"
  325. cx="0" cy="0" r="3"
  326. :transform="`translate(${pt.x}, ${pt.y})`"
  327. />
  328. </svg>
  329. </view>
  330. <!-- 日期标签:独立于绘图区 -->
  331. <view class="chartLabels">
  332. <text v-for="(label, idx) in traceDetail.environment.chart.labels" :key="`label-${idx}`">{{ label }}</text>
  333. </view>
  334. </view>
  335. <view class="environmentChartLegend">
  336. <view class="legendItem">
  337. <view class="legendDot legendN" />
  338. <text>氮</text>
  339. </view>
  340. <view class="legendItem">
  341. <view class="legendDot legendP" />
  342. <text>磷</text>
  343. </view>
  344. <view class="legendItem">
  345. <view class="legendDot legendK" />
  346. <text>钾</text>
  347. </view>
  348. </view>
  349. </view>
  350. <!-- 环境摘要项 -->
  351. <view class="environmentGrid">
  352. <view
  353. v-for="(item, index) in traceDetail.environment.items"
  354. :key="`env-${index}`"
  355. class="environmentItem"
  356. >
  357. <text class="environmentLabel">{{ item.label }}</text>
  358. <text class="environmentValue">{{ item.value }}</text>
  359. <text class="environmentStatus">{{ item.status }}</text>
  360. </view>
  361. </view>
  362. </view>
  363. <!-- 批次信息(可选:batch 可能不存在) -->
  364. <view v-if="traceDetail.batch?.exists" class="card cardLevel1 cardBatch">
  365. <view class="sectionHeader">
  366. <view class="sectionHeaderLeft">
  367. <text class="sectionEn">Batch</text>
  368. <text class="sectionTitle">批次信息</text>
  369. </view>
  370. </view>
  371. <!-- 批次信息主体:左右两列布局,左列标签固定宽度,右列内容左对齐 -->
  372. <view class="batchBody">
  373. <view v-if="traceDetail.batch?.no" class="batchRow">
  374. <text class="batchRowLabel">批次号</text>
  375. <text class="batchRowValue">{{ traceDetail.batch.no }}</text>
  376. </view>
  377. <view v-if="traceDetail.batch?.harvestTime" class="batchRow">
  378. <text class="batchRowLabel">生产/采收时间</text>
  379. <text class="batchRowValue">{{ traceDetail.batch.harvestTime }}</text>
  380. </view>
  381. <view v-if="traceDetail.batch?.packTime" class="batchRow">
  382. <text class="batchRowLabel">包装时间</text>
  383. <text class="batchRowValue">{{ traceDetail.batch.packTime }}</text>
  384. </view>
  385. </view>
  386. </view>
  387. <!-- 批次不存在/已下线的说明 -->
  388. <view v-else-if="traceDetail.batch?.statusBadge" class="card soft cardLevel1 cardBatchState">
  389. <view class="sectionHeader">
  390. <view class="sectionHeaderLeft">
  391. <text class="sectionEn">Batch</text>
  392. <text class="sectionTitle">当前批次状态</text>
  393. </view>
  394. <view class="statusBadge" :class="traceDetail.batch.statusBadge.type">
  395. {{ traceDetail.batch.statusBadge.text }}
  396. </view>
  397. </view>
  398. <view class="emptyText">{{ traceDetail.batch?.emptyMessage || '该批次暂不可查询' }}</view>
  399. <view class="btnRow">
  400. <button class="primaryBtn" @click="goBackToPurchase">返回购买渠道</button>
  401. </view>
  402. </view>
  403. <!-- 检测报告:横向卡片列表 -->
  404. <view v-if="traceDetail.batch?.exists" class="card cardLevel2 cardCredential">
  405. <view class="sectionHeader">
  406. <view class="sectionHeaderLeft">
  407. <text class="sectionEn">Report</text>
  408. <text class="sectionTitle">检测报告</text>
  409. </view>
  410. </view>
  411. <!-- 横向滑动卡片列表 -->
  412. <scroll-view
  413. v-if="reportItems.length"
  414. class="reportCardList"
  415. scroll-x
  416. :show-scrollbar="false"
  417. enhanced
  418. >
  419. <view class="reportCardTrack">
  420. <view
  421. v-for="(item, itemIdx) in reportItems"
  422. :key="`report-card-${itemIdx}`"
  423. class="reportCard"
  424. @click="previewDoc('report', getReportGlobalIndex(itemIdx, 0))"
  425. >
  426. <!-- 报告缩略图(带页数角标) -->
  427. <view class="reportCardThumb">
  428. <image
  429. v-if="item.images && item.images.length"
  430. class="reportCardThumbImg"
  431. :src="item.images[0]"
  432. mode="aspectFit"
  433. />
  434. <view v-else class="reportCardThumbEmpty">
  435. <text class="reportCardThumbEmptyText">暂无图片</text>
  436. </view>
  437. <view v-if="item.images && item.images.length > 1" class="reportCardPages">
  438. 共{{ item.images.length }}页
  439. </view>
  440. </view>
  441. <!-- 报告信息 -->
  442. <view class="reportCardMeta">
  443. <view v-if="item.detectDate" class="reportCardRow">
  444. <text class="reportCardLabel">检测日期</text>
  445. <text class="reportCardValue">{{ item.detectDate }}</text>
  446. </view>
  447. <view v-if="item.no" class="reportCardRow">
  448. <text class="reportCardLabel">报告编号</text>
  449. <text class="reportCardValue reportCardValueNo">{{ item.no }}</text>
  450. </view>
  451. </view>
  452. <!-- 点击提示 -->
  453. <text class="reportCardHint">点击查看大图</text>
  454. </view>
  455. </view>
  456. </scroll-view>
  457. <!-- 待补充状态 -->
  458. <view v-else class="docPlaceholder">
  459. <text class="docPlaceholderTitle">检测报告待补充</text>
  460. <text class="docPlaceholderText">
  461. {{ traceDetail.report?.emptyMessage || '检测报告待补充,请耐心等待。' }}
  462. </text>
  463. </view>
  464. </view>
  465. <!-- 合格证:信息摘要 + 缩略图一体化布局 -->
  466. <view v-if="traceDetail.batch?.exists" class="card cardLevel1 cardCredential">
  467. <view class="sectionHeader">
  468. <view class="sectionHeaderLeft">
  469. <text class="sectionEn">Certificate</text>
  470. <text class="sectionTitle">合格证</text>
  471. </view>
  472. </view>
  473. <!-- 信息与缩略图一体化区域 -->
  474. <view class="certSummary">
  475. <!-- 左侧:信息摘要 -->
  476. <view class="certSummaryInfo">
  477. <view v-if="traceDetail.certificate?.issueDate" class="certSummaryRow">
  478. <text class="certSummaryLabel">开具日期</text>
  479. <text class="certSummaryValue">{{ traceDetail.certificate.issueDate }}</text>
  480. </view>
  481. <view v-if="traceDetail.certificate?.no" class="certSummaryRow">
  482. <text class="certSummaryLabel">合格证编号</text>
  483. <text class="certSummaryValue">{{ traceDetail.certificate.no }}</text>
  484. </view>
  485. </view>
  486. <!-- 右侧:缩略图 -->
  487. <view
  488. v-if="traceDetail.certificate?.status === 'uploaded' && certificateImages.length"
  489. class="certThumbContainer"
  490. @click="previewDoc('certificate', 0)"
  491. >
  492. <view class="certThumbWrap">
  493. <image class="certThumbImage" :src="certificateImages[0]" mode="aspectFit" />
  494. </view>
  495. <text class="certPreviewHint">点击查看</text>
  496. </view>
  497. <!-- 待补充状态:仅显示提示 -->
  498. <view v-else class="certPendingHint">
  499. <text class="certPendingText">
  500. {{ traceDetail.certificate?.emptyMessage || '合格证待补充,请耐心等待。' }}
  501. </text>
  502. </view>
  503. </view>
  504. </view>
  505. <!-- 底部柔和收口渐变 -->
  506. <view class="footerFade" />
  507. <!-- 轻量页脚 -->
  508. <view class="traceFooter">
  509. <view class="traceFooterHint">如需帮助,联系客服</view>
  510. <view class="traceFooterPhone" @click="contactCustomer">
  511. <image class="traceFooterPhoneIcon" src="/static/icons/phone.svg" mode="aspectFit" />
  512. <text class="traceFooterPhoneNum">13379508760</text>
  513. </view>
  514. <view class="traceFooterBrand">佳友厚苑 · 安心之选</view>
  515. </view>
  516. </scroll-view>
  517. </view>
  518. </template>
  519. <script setup>
  520. import { computed, ref, reactive } from 'vue'
  521. import { onLoad } from '@dcloudio/uni-app'
  522. import {getTraceDetail } from '@/api/base/index.js'
  523. import {
  524. getDeviceCollectorDetail,
  525. getChannels,
  526. playStart,
  527. pause ,
  528. } from '@/api/device.js'
  529. import Jessibuca from '@/components/common/jessibuca.vue'
  530. // 页面状态选择(H5 演示用):通过路由参数传入 state 即可切换 mock 场景
  531. // 例如:/pages/trace/detail?state=reportPending
  532. // 加载状态
  533. const loading = ref(false)
  534. // 数据存储
  535. const traceInfo = ref(null)
  536. const routeOptions = ref({})
  537. const mockStateKey = ref('normal')
  538. const isFullscreen = ref(false)
  539. const isPlaying = ref(false)
  540. const livePlayerContext = ref(null) // 小程序视频上下文
  541. const appLivePlayerContext = ref(null) // App端视频上下文
  542. const jessibucaRef = ref(null)
  543. const isMuted = ref(false)
  544. const isRecording = ref(false)
  545. const isVoiceActive = ref(false)
  546. const isGridView = ref(false)
  547. const isZoomMode = ref(false)
  548. const currentTime = ref('14:30:25')
  549. // 响应式数据
  550. const deviceInfo = reactive({
  551. deviceId: '34020000001110000001',
  552. name: '设备加载中...',
  553. status: 'off',
  554. location: '正在获取位置...',
  555. lastUpdate: '',
  556. deviceType: 'weather', // 默认类型,会根据API返回更新
  557. deviceTypeId: null,
  558. streamUrl: '',
  559. channelId: null, // 当前通道ID
  560. originalStreamUrl: '',
  561. })
  562. const MOCK_TRACE_DETAILS = {
  563. normal: {
  564. product: {
  565. name: '',
  566. spec: '',
  567. image: '',
  568. intro: ''
  569. },
  570. farm: {
  571. name: '',
  572. location: '',
  573. image: '',
  574. intro: ''
  575. },
  576. batch: {
  577. exists: false,
  578. statusBadge: { text: '', type: '' },
  579. no: '',
  580. harvestTime: '',
  581. packTime: ''
  582. },
  583. report: {
  584. status: '',
  585. statusBadge: { text: '', type: '' },
  586. // 每份报告独立 detectDate / no / images
  587. items: [
  588. {
  589. detectDate: '',
  590. no: '',
  591. images: ['']
  592. },
  593. {
  594. detectDate: '',
  595. no: '',
  596. images: ['']
  597. },
  598. {
  599. detectDate: '',
  600. no: '',
  601. images: ['']
  602. }
  603. ]
  604. },
  605. certificate: {
  606. status: '',
  607. statusBadge: { text: '', type: '' },
  608. issueDate: '',
  609. no: '',
  610. fileUrl: '',
  611. images: ['']
  612. },
  613. traceConclusionCard: {
  614. title: '溯源结论',
  615. conclusion: '本批次产品来源清晰,已完成安全检测,过程可查',
  616. desc: '检测材料与溯源数据已展示,可继续查看',
  617. passed: true
  618. },
  619. farmTimeline: [
  620. {
  621. time: '2026-03-01',
  622. stage: 'planting',
  623. title: '开始种植',
  624. desc: '本批次产品进入种植管理阶段'
  625. },
  626. {
  627. time: '2026-03-12',
  628. stage: 'care',
  629. title: '生长期养护',
  630. desc: '已完成灌溉、营养管理等日常养护'
  631. },
  632. {
  633. time: '2026-03-20',
  634. stage: 'inspection',
  635. title: '田间巡检',
  636. desc: '已完成长势检查与种植环境巡检'
  637. },
  638. {
  639. time: '2026-03-30',
  640. stage: 'harvest',
  641. title: '成熟采收',
  642. desc: '本批次产品进入成熟采收阶段'
  643. },
  644. {
  645. time: '2026-03-31',
  646. stage: 'test',
  647. title: '安全检测',
  648. desc: '已完成安全检测,相关结果可查'
  649. },
  650. {
  651. time: '2026-04-01',
  652. stage: 'pack',
  653. title: '包装出库',
  654. desc: '已完成包装整理,进入销售流通环节'
  655. }
  656. ],
  657. camera: {
  658. liveUrl: '',
  659. coverImage: '',
  660. status: 'online',
  661. desc: '来自农场实景画面,种植环境真实呈现'
  662. },
  663. environment: {
  664. summary: '本批次种植期环境稳定,整体处于适宜生长区间',
  665. chart: {
  666. type: 'npk_trend',
  667. labels: ['03-01', '03-06', '03-10', '03-15', '03-21', '03-27', '04-01'],
  668. values: {
  669. n: [26.2, 25.8, 26.4, 25.9, 26.6, 26.1, 26.4],
  670. p: [20.5, 20.1, 20.4, 20.0, 20.3, 20.2, 20.4],
  671. k: [14.2, 14.6, 14.3, 14.7, 14.4, 14.8, 14.5]
  672. }
  673. },
  674. items: [
  675. { label: '气温', value: '22.3℃', status: '种植期平均' },
  676. { label: '湿度', value: '45%', status: '种植期平均' },
  677. { label: '降雨量', value: '118mm', status: '种植期累计' },
  678. { label: '光照', value: '充足', status: '表现稳定' }
  679. ],
  680. current: {
  681. temperature: '24.5℃',
  682. humidity: '42.2%'
  683. }
  684. }
  685. },
  686. reportPending: {
  687. product: {
  688. name: '',
  689. spec: '',
  690. image: '',
  691. intro: ''
  692. },
  693. farm: {
  694. name: '',
  695. location: '',
  696. image: null,
  697. intro: ''
  698. },
  699. batch: {
  700. exists: false,
  701. statusBadge: { text: '', type: '' },
  702. no: '',
  703. harvestTime: '',
  704. packTime: ''
  705. },
  706. report: {
  707. status: '',
  708. statusBadge: { text: '', type: '' },
  709. emptyMessage: '',
  710. items: []
  711. },
  712. certificate: {
  713. status: '',
  714. statusBadge: { text: '', type: '' },
  715. issueDate: '',
  716. no: '',
  717. fileUrl: '',
  718. images: []
  719. },
  720. traceConclusionCard: {
  721. title: '溯源结论',
  722. conclusion: '本批次产品来源清晰,已完成安全检测,过程可查',
  723. desc: '检测材料与溯源数据已展示,可继续查看',
  724. passed: true
  725. },
  726. farmTimeline: []
  727. },
  728. certificatePending: {
  729. product: {
  730. name: '',
  731. spec: '',
  732. image: '',
  733. intro: ''
  734. },
  735. farm: {
  736. name: '',
  737. location: '',
  738. image: null,
  739. intro: ''
  740. },
  741. batch: {
  742. exists: false,
  743. statusBadge: { text: '', type: '' },
  744. no: '',
  745. harvestTime: '',
  746. packTime: ''
  747. },
  748. report: {
  749. status: '',
  750. statusBadge: { text: '', type: '' },
  751. items: [
  752. {
  753. detectDate: '',
  754. no: '',
  755. images: []
  756. }
  757. ]
  758. },
  759. certificate: {
  760. status: '',
  761. statusBadge: { text: '', type: '' },
  762. emptyMessage: ''
  763. },
  764. traceConclusionCard: {
  765. title: '溯源结论',
  766. conclusion: '本批次产品来源清晰,已完成安全检测,过程可查',
  767. desc: '检测材料与溯源数据已展示,可继续查看',
  768. passed: true
  769. },
  770. farmTimeline: []
  771. },
  772. batchNotFound: {
  773. product: {
  774. name:'',
  775. spec: '',
  776. image: '',
  777. intro: ''
  778. },
  779. farm: {
  780. name: '',
  781. location: '',
  782. image: null,
  783. intro: ''
  784. },
  785. batch: {
  786. exists: false,
  787. statusBadge: { text: '', type: '' },
  788. emptyMessage: ''
  789. },
  790. report: null,
  791. certificate: null,
  792. traceConclusionCard: {
  793. title: '溯源结论',
  794. conclusion: '本批次产品来源清晰,已完成安全检测,过程可查',
  795. desc: '检测材料与溯源数据已展示,可继续查看',
  796. passed: true
  797. },
  798. farmTimeline: []
  799. },
  800. batchOfflined: {
  801. product: {
  802. name: '',
  803. spec: '',
  804. image: '',
  805. intro: ''
  806. },
  807. farm: {
  808. name: '',
  809. location: '',
  810. image: null,
  811. intro: ''
  812. },
  813. batch: {
  814. exists: false,
  815. statusBadge: { text: '', type: '' },
  816. emptyMessage: ''
  817. },
  818. report: null,
  819. certificate: null,
  820. traceConclusionCard: {
  821. title: '溯源结论',
  822. conclusion: '本批次产品来源清晰,已完成安全检测,过程可查',
  823. desc: '检测材料与溯源数据已展示,可继续查看',
  824. passed: true
  825. },
  826. farmTimeline: []
  827. }
  828. }
  829. // 加载Jessibuca脚本
  830. const loadJessibucaScript = () => {
  831. // #ifdef H5
  832. const script = document.createElement('script')
  833. script.src = '/static/js/jessibuca/jessibuca.js'
  834. script.onload = () => {
  835. console.log('Jessibuca 脚本加载成功')
  836. }
  837. script.onerror = (error) => {
  838. console.error('Jessibuca 脚本加载失败:', error)
  839. }
  840. document.head.appendChild(script)
  841. // #endif
  842. }
  843. // 获取H5环境使用的流地址
  844. const getH5StreamUrl = computed(() => {
  845. // 确保使用安全的 WSS 协议
  846. let url = deviceInfo.originalStreamUrl
  847. if (url && url.startsWith('ws://')) {
  848. console.warn('检测到不安全的 ws:// 协议,自动转换为 wss://')
  849. url = url.replace('ws://', 'wss://')
  850. }
  851. return url
  852. })
  853. function resolveStateKey(opts) {
  854. const raw = (opts?.state || opts?.batchState || opts?.scene || '').toString().trim()
  855. if (!raw) return 'normal'
  856. const allowed = ['normal', 'reportPending', 'certificatePending', 'batchNotFound', 'batchOfflined']
  857. return allowed.includes(raw) ? raw : 'normal'
  858. }
  859. onLoad((opts) => {
  860. // 拿到浏览器路径参数
  861. const fullPath = window.location.pathname
  862. const batchId = fullPath.split('/').filter(Boolean).pop()
  863. // 优先使用路由参数中的 id,其次使用 URL 路径中的 id
  864. const finalId = batchId || 1
  865. loadData(finalId)
  866. queryChannels()
  867. routeOptions.value = opts || {}
  868. mockStateKey.value = resolveStateKey(opts || {})
  869. startTimeUpdate()
  870. // #ifdef MP-WEIXIN
  871. setTimeout(() => {
  872. livePlayerContext.value = uni.createVideoContext('myVideo')
  873. console.log('微信小程序视频上下文已创建')
  874. }, 500)
  875. // #endif
  876. // #ifdef APP-PLUS || APP-HARMONY
  877. setTimeout(() => {
  878. appLivePlayerContext.value = uni.createVideoContext('appVideo')
  879. console.log('App视频上下文已创建')
  880. }, 500)
  881. // #endif
  882. // #ifdef H5
  883. loadJessibucaScript()
  884. // #endif
  885. })
  886. // 根据设备id获取通道列表
  887. const queryChannels = () => {
  888. getChannels(deviceInfo.deviceId)
  889. .then(response => {
  890. console.log('获取通道列表:', response)
  891. const res = response.data
  892. if (res.code === 0 && res.data.total > 0) {
  893. const channels = res.data.list
  894. deviceInfo.channelId = channels[0].deviceId
  895. deviceInfo.status = channels[0].status
  896. playStart(deviceInfo.deviceId, deviceInfo.channelId).then(res => {
  897. if (res.data.code !== 0) {
  898. console.error('播放开始失败:', res.message)
  899. uni.showToast({
  900. title: '播放失败: ' + res.message,
  901. icon: 'none'
  902. })
  903. return
  904. }
  905. console.log('播放开始:', res)
  906. // #ifdef H5
  907. let streamUrl = res.data.data.wss_flv
  908. if (streamUrl) {
  909. const urlObj = new URL(streamUrl)
  910. // 替换 hostname
  911. urlObj.hostname = 'nxy.gbdfarm.com'
  912. // 替换端口
  913. urlObj.port = '9000'
  914. deviceInfo.originalStreamUrl = urlObj.toString()
  915. console.log("queryChannels - deviceInfo.originalStreamUrl", deviceInfo.originalStreamUrl)
  916. } else {
  917. console.warn('未获取到 wss_flv 流地址')
  918. }
  919. // #endif
  920. // #ifdef MP-WEIXIN
  921. deviceInfo.originalStreamUrl = res.data.data.hls || deviceInfo.originalStreamUrl
  922. // #endif
  923. // #ifdef APP-PLUS || APP-HARMONY
  924. deviceInfo.originalStreamUrl = res.data.data.fmp4 || deviceInfo.originalStreamUrl
  925. // #endif
  926. }).catch(err => {
  927. console.error('播放开始失败:', err)
  928. })
  929. } else {
  930. uni.showToast({
  931. title: '获取通道列表失败: ' + res.data.message,
  932. icon: 'none'
  933. })
  934. return
  935. }
  936. })
  937. .catch(err => {
  938. console.error('获取通道列表错误:', err)
  939. })
  940. }
  941. const loadData = async (batchId) => {
  942. loading.value = true
  943. try {
  944. // 调用接口
  945. const res = await getTraceDetail(batchId)
  946. traceInfo.value = res.data.data
  947. console.log('接口返回数据:', res)
  948. } catch (error) {
  949. console.error('加载失败', error)
  950. // 错误提示已在拦截器中自动处理
  951. } finally {
  952. // 无论成功失败都关闭 loading
  953. loading.value = false
  954. }
  955. }
  956. // 视频播放错误处理
  957. const onVideoError = (e) => {
  958. console.error('视频播放错误:', e)
  959. let errorMsg = '视频加载失败'
  960. // 微信小程序video组件错误码
  961. if (e && e.detail) {
  962. const errCode = e.detail.errCode
  963. switch(errCode) {
  964. case 10001:
  965. errorMsg = '网络错误,请检查网络连接'
  966. break
  967. case 10002:
  968. errorMsg = '视频格式不支持'
  969. break
  970. case 10003:
  971. errorMsg = '视频解码失败'
  972. break
  973. case 10004:
  974. errorMsg = '视频地址无效'
  975. break
  976. default:
  977. errorMsg = `播放失败(错误码:${errCode})`
  978. }
  979. console.error('视频错误详情:', e.detail)
  980. }
  981. uni.showToast({
  982. title: errorMsg,
  983. icon: 'none',
  984. duration: 3000
  985. })
  986. isPlaying.value = false
  987. // #ifdef H5
  988. setTimeout(() => {
  989. if (isPlaying.value && jessibucaRef.value) {
  990. console.log('尝试重新加载视频流')
  991. if (deviceInfo.originalStreamUrl !== config.streamServer.wsFlvServer) {
  992. deviceInfo.streamUrl = config.streamServer.wsFlvServer
  993. }
  994. }
  995. }, 3000)
  996. // #endif
  997. }
  998. // 更新时间
  999. const startTimeUpdate = () => {
  1000. setInterval(() => {
  1001. const now = new Date()
  1002. const hours = String(now.getHours()).padStart(2, '0')
  1003. const minutes = String(now.getMinutes()).padStart(2, '0')
  1004. const seconds = String(now.getSeconds()).padStart(2, '0')
  1005. currentTime.value = `${hours}:${minutes}:${seconds}`
  1006. }, 1000)
  1007. }
  1008. // 播放/暂停切换
  1009. const togglePlayState = () => {
  1010. if (!isPlaying.value) {
  1011. isPlaying.value = true
  1012. // #ifdef MP-WEIXIN
  1013. setTimeout(() => {
  1014. if (livePlayerContext.value) {
  1015. livePlayerContext.value.play()
  1016. console.log('微信小程序开始播放')
  1017. }
  1018. }, 300)
  1019. // #endif
  1020. // #ifdef APP-PLUS || APP-HARMONY
  1021. setTimeout(() => {
  1022. if (appLivePlayerContext.value) {
  1023. appLivePlayerContext.value.play()
  1024. console.log('App开始播放')
  1025. }
  1026. }, 300)
  1027. // #endif
  1028. // #ifdef H5
  1029. setTimeout(() => {
  1030. playStart(deviceInfo.deviceId, deviceInfo.channelId).then(res => {
  1031. if (res.data.code !== 0) {
  1032. console.error('播放开始失败:', res.message)
  1033. uni.showToast({
  1034. title: '播放失败: ' + res.message,
  1035. icon: 'none'
  1036. })
  1037. return
  1038. }
  1039. console.log('播放开始:', res)
  1040. // 使用 wss_flv 并替换域名和端口
  1041. let streamUrl = res.data.data.wss_flv
  1042. if (streamUrl) {
  1043. const urlObj = new URL(streamUrl)
  1044. urlObj.hostname = 'nxy.gbdfarm.com'
  1045. urlObj.port = '9000'
  1046. deviceInfo.originalStreamUrl = urlObj.toString()
  1047. console.log("togglePlayState - deviceInfo.originalStreamUrl", deviceInfo.originalStreamUrl)
  1048. }
  1049. }).catch(err => {
  1050. console.error('播放开始失败:', err)
  1051. })
  1052. uni.vibrateShort()
  1053. }, 300)
  1054. // #endif
  1055. } else {
  1056. // #ifdef H5
  1057. if (jessibucaRef.value) {
  1058. jessibucaRef.value.pause()
  1059. }
  1060. // #endif
  1061. // #ifdef MP-WEIXIN
  1062. if (livePlayerContext.value) {
  1063. livePlayerContext.value.pause()
  1064. }
  1065. // #endif
  1066. // #ifdef APP-PLUS || APP-HARMONY
  1067. if (appLivePlayerContext.value) {
  1068. appLivePlayerContext.value.pause()
  1069. }
  1070. // #endif
  1071. isPlaying.value = false
  1072. uni.showToast({
  1073. title: '视频已暂停',
  1074. icon: 'none',
  1075. duration: 1500
  1076. })
  1077. }
  1078. }
  1079. // 静音切换
  1080. const toggleMute = () => {
  1081. isMuted.value = !isMuted.value
  1082. // #ifdef H5
  1083. if (jessibucaRef.value) {
  1084. if (isMuted.value) {
  1085. jessibucaRef.value.mute()
  1086. } else {
  1087. jessibucaRef.value.cancelMute()
  1088. }
  1089. }
  1090. // #endif
  1091. // #ifndef H5
  1092. // App端的静音通过 live-player 的 muted 属性控制,会自动响应
  1093. uni.showToast({
  1094. title: isMuted.value ? '已静音' : '已取消静音',
  1095. icon: 'none'
  1096. })
  1097. // #endif
  1098. }
  1099. // 全屏切换
  1100. const toggleFullscreen = () => {
  1101. if (!isPlaying.value) {
  1102. togglePlayState()
  1103. setTimeout(() => {
  1104. setFullscreen(true)
  1105. }, 500)
  1106. } else {
  1107. setFullscreen(!isFullscreen.value)
  1108. }
  1109. }
  1110. // 设置全屏状态
  1111. const setFullscreen = (fullscreen) => {
  1112. isFullscreen.value = fullscreen
  1113. // #ifdef H5
  1114. if (isFullscreen.value) {
  1115. const ua = navigator.userAgent.toLowerCase()
  1116. const isMobile = /mobile|android|iphone|ipad/.test(ua)
  1117. if (isMobile && jessibucaRef.value) {
  1118. jessibucaRef.value.fullscreenSwich()
  1119. } else {
  1120. setTimeout(() => {
  1121. if (jessibucaRef.value) {
  1122. jessibucaRef.value.resize()
  1123. }
  1124. }, 300)
  1125. }
  1126. if (window.screen && window.screen.orientation && window.screen.orientation.lock) {
  1127. window.screen.orientation.lock('landscape').catch(err => {
  1128. console.error('无法锁定屏幕方向:', err)
  1129. })
  1130. }
  1131. } else {
  1132. if (jessibucaRef.value) {
  1133. if (jessibucaRef.value.isFullscreen()) {
  1134. jessibucaRef.value.fullscreenSwich()
  1135. }
  1136. setTimeout(() => {
  1137. if (jessibucaRef.value) {
  1138. jessibucaRef.value.resize()
  1139. }
  1140. }, 300)
  1141. }
  1142. if (window.screen && window.screen.orientation && window.screen.orientation.unlock) {
  1143. window.screen.orientation.unlock()
  1144. }
  1145. }
  1146. // #endif
  1147. // #ifdef MP-WEIXIN
  1148. if (livePlayerContext.value) {
  1149. if (isFullscreen.value) {
  1150. livePlayerContext.value.requestFullScreen({
  1151. direction: 90
  1152. })
  1153. } else {
  1154. livePlayerContext.value.exitFullScreen()
  1155. }
  1156. }
  1157. // #endif
  1158. // #ifdef APP-PLUS || APP-HARMONY
  1159. if (appLivePlayerContext.value) {
  1160. if (isFullscreen.value) {
  1161. appLivePlayerContext.value.requestFullScreen({
  1162. direction: 90
  1163. })
  1164. } else {
  1165. appLivePlayerContext.value.exitFullScreen()
  1166. }
  1167. }
  1168. // #endif
  1169. }
  1170. // 截图
  1171. const takeScreenshot = () => {
  1172. // #ifdef H5
  1173. if (jessibucaRef.value && isPlaying.value) {
  1174. jessibucaRef.value.screenshot()
  1175. uni.showToast({
  1176. title: '截图已保存',
  1177. icon: 'success'
  1178. })
  1179. } else {
  1180. uni.showToast({
  1181. title: '请先播放视频',
  1182. icon: 'none'
  1183. })
  1184. }
  1185. // #endif
  1186. // if (livePlayerContext.value && isPlaying.value) {
  1187. // livePlayerContext.value.snapshot({
  1188. // success: (res) => {
  1189. // console.log('截图成功:', res.tempImagePath)
  1190. // uni.saveImageToPhotosAlbum({
  1191. // filePath: res.tempImagePath,
  1192. // success: () => {
  1193. // uni.showToast({
  1194. // title: '截图已保存到相册',
  1195. // icon: 'success'
  1196. // })
  1197. // },
  1198. // fail: (err) => {
  1199. // console.error('保存截图失败:', err)
  1200. // uni.showToast({
  1201. // title: '保存截图失败',
  1202. // icon: 'none'
  1203. // })
  1204. // }
  1205. // })
  1206. // },
  1207. // fail: (err) => {
  1208. // console.error('截图失败:', err)
  1209. // uni.showToast({
  1210. // title: '截图失败',
  1211. // icon: 'none'
  1212. // })
  1213. // }
  1214. // })
  1215. // } else {
  1216. // uni.showToast({
  1217. // title: '请先播放视频',
  1218. // icon: 'none'
  1219. // })
  1220. // }
  1221. // #ifndef H5
  1222. if (appLivePlayerContext.value && isPlaying.value) {
  1223. appLivePlayerContext.value.snapshot({
  1224. success: (res) => {
  1225. console.log('App截图成功:', res.tempImagePath)
  1226. uni.saveImageToPhotosAlbum({
  1227. filePath: res.tempImagePath,
  1228. success: () => {
  1229. uni.showToast({
  1230. title: '截图已保存到相册',
  1231. icon: 'success'
  1232. })
  1233. },
  1234. fail: (err) => {
  1235. console.error('App保存截图失败:', err)
  1236. uni.showToast({
  1237. title: '保存截图失败',
  1238. icon: 'none'
  1239. })
  1240. }
  1241. })
  1242. },
  1243. fail: (err) => {
  1244. console.error('App截图失败:', err)
  1245. uni.showToast({
  1246. title: '截图失败',
  1247. icon: 'none'
  1248. })
  1249. }
  1250. })
  1251. } else {
  1252. uni.showToast({
  1253. title: '请先播放视频',
  1254. icon: 'none'
  1255. })
  1256. }
  1257. // #endif
  1258. }
  1259. // 小程序播放器状态变化处理
  1260. const onVideoPlay = () => {
  1261. console.log('视频开始播放')
  1262. isPlaying.value = true
  1263. }
  1264. const onVideoPause = () => {
  1265. console.log('视频暂停')
  1266. }
  1267. const onVideoEnded = () => {
  1268. console.log('视频播放结束')
  1269. isPlaying.value = false
  1270. }
  1271. const onTimeUpdate = (e) => {
  1272. // 更新播放时间
  1273. if (e && e.detail) {
  1274. const currentSeconds = Math.floor(e.detail.currentTime)
  1275. const hours = String(Math.floor(currentSeconds / 3600)).padStart(2, '0')
  1276. const minutes = String(Math.floor((currentSeconds % 3600) / 60)).padStart(2, '0')
  1277. const seconds = String(currentSeconds % 60).padStart(2, '0')
  1278. currentTime.value = `${hours}:${minutes}:${seconds}`
  1279. }
  1280. }
  1281. const onStateChange = (e) => {
  1282. console.log('播放器状态变化:', e.detail)
  1283. const state = e.detail.code
  1284. switch (state) {
  1285. case 2001:
  1286. console.log('已连接服务器')
  1287. break
  1288. case 2002:
  1289. console.log('开始拉流')
  1290. break
  1291. case 2003:
  1292. console.log('网络接收到首个视频帧')
  1293. break
  1294. case 2004:
  1295. console.log('视频播放开始')
  1296. break
  1297. case 2005:
  1298. console.log('视频播放进度')
  1299. break
  1300. case 2006:
  1301. console.log('视频播放结束')
  1302. isPlaying.value = false
  1303. break
  1304. case 2007:
  1305. console.log('视频播放Loading')
  1306. break
  1307. case 2008:
  1308. console.log('解码器启动')
  1309. break
  1310. case 2009:
  1311. console.log('视频分辨率改变')
  1312. break
  1313. case -2301:
  1314. console.error('网络断连,且重新连接亦不能恢复,播放器已停止')
  1315. isPlaying.value = false
  1316. uni.showToast({
  1317. title: '网络断连,请重试',
  1318. icon: 'none'
  1319. })
  1320. break
  1321. case -2302:
  1322. console.error('获取加速拉流地址失败')
  1323. break
  1324. case 2101:
  1325. console.error('当前视频帧解码失败')
  1326. break
  1327. case 2102:
  1328. console.error('当前音频帧解码失败')
  1329. break
  1330. case 2103:
  1331. console.warn('网络断连, 已启动自动重连')
  1332. break
  1333. case 2104:
  1334. console.warn('网络断连, 重连中...')
  1335. break
  1336. case 2105:
  1337. console.log('网络断连, 重连成功')
  1338. break
  1339. case 2106:
  1340. console.error('网络断连, 重连失败')
  1341. break
  1342. case 2107:
  1343. console.error('播放器连接超时')
  1344. break
  1345. case 2108:
  1346. console.error('获取点播文件信息失败')
  1347. break
  1348. default:
  1349. console.log('其他状态:', state)
  1350. }
  1351. }
  1352. // 小程序全屏状态变化
  1353. const onFullscreenChange = (e) => {
  1354. isFullscreen.value = e.detail.fullScreen
  1355. console.log('全屏状态变化:', isFullscreen.value)
  1356. }
  1357. // 获取App(安卓/鸿蒙)环境使用的流地址
  1358. const getAppStreamUrl = computed(() => {
  1359. // 优先使用 fmp4 格式(微信小程序和App都支持)
  1360. if (deviceInfo.originalStreamUrl) {
  1361. console.log("当前视频流地址:", deviceInfo.originalStreamUrl)
  1362. return deviceInfo.originalStreamUrl
  1363. }
  1364. // 如果没有流地址,返回空字符串
  1365. console.warn('未获取到视频流地址')
  1366. return ''
  1367. })
  1368. const traceDetail = computed(() => {
  1369. // 如果没有真实数据,返回 mock 数据
  1370. if (!traceInfo.value) {
  1371. return MOCK_TRACE_DETAILS[mockStateKey.value] || MOCK_TRACE_DETAILS.normal
  1372. }
  1373. const data = traceInfo.value
  1374. // 解析 certFiles 和 reportFiles(JSON 字符串转数组)
  1375. let certFiles = []
  1376. let reportFiles = []
  1377. try {
  1378. if (data.certificate?.certFiles) {
  1379. certFiles = JSON.parse(data.certificate.certFiles)
  1380. }
  1381. } catch (e) {
  1382. console.error('解析 certFiles 失败', e)
  1383. }
  1384. // 构建返回数据结构
  1385. return {
  1386. product: {
  1387. name: data.productName || '',
  1388. spec: data.productSpec || '',
  1389. image: data.productImage || '',
  1390. intro: data.productDesc || ''
  1391. },
  1392. farm: {
  1393. name: data.farmName || '',
  1394. location: data.farmRegion || '',
  1395. image: data.farmImage || '',
  1396. intro: data.farmIntro || ''
  1397. },
  1398. batch: {
  1399. exists: data.status === '2', // status 为 '2' 表示批次正常,已上线
  1400. statusBadge: data.status === '2'
  1401. ? { text: '检验合格', type: 'ok' }
  1402. : { text: '批次不存在', type: 'muted' },
  1403. no: data.batchNo || '',
  1404. harvestTime: data.produceDate || '',
  1405. packTime: data.packageDate || '',
  1406. emptyMessage: data.status !== '2' ? '未找到对应溯源批次信息。请确认二维码是否为佳友厚苑正品批次。' : ''
  1407. },
  1408. report: {
  1409. status: data.reports && data.reports.length > 0 ? 'uploaded' : 'pending',
  1410. statusBadge: data.reports && data.reports.length > 0
  1411. ? { text: '已上传', type: 'ok' }
  1412. : { text: '待补充', type: 'wait' },
  1413. emptyMessage: '检测报告待补充,上传完成后可查看大图。',
  1414. items: (data.reports || []).map(report => {
  1415. let images = []
  1416. // 处理 reportFiles:可能是字符串 URL、JSON 字符串数组、或已解析的数组
  1417. if (report.reportFiles) {
  1418. if (typeof report.reportFiles === 'string') {
  1419. // 尝试解析 JSON 字符串
  1420. try {
  1421. const parsed = JSON.parse(report.reportFiles)
  1422. // 如果解析成功且是数组,提取 url 字段
  1423. if (Array.isArray(parsed)) {
  1424. images = parsed.map(item =>
  1425. typeof item === 'string' ? item : (item.url || item)
  1426. ).filter(Boolean)
  1427. } else {
  1428. // 解析后不是数组,可能是单个对象
  1429. images = [parsed.url || parsed].filter(Boolean)
  1430. }
  1431. } catch (e) {
  1432. // 解析失败,当作普通 URL 字符串处理
  1433. images = [report.reportFiles]
  1434. }
  1435. } else if (Array.isArray(report.reportFiles)) {
  1436. // 已经是数组,提取 url 字段
  1437. images = report.reportFiles.map(item =>
  1438. typeof item === 'string' ? item : (item.url || item)
  1439. ).filter(Boolean)
  1440. } else if (typeof report.reportFiles === 'object') {
  1441. // 单个对象
  1442. images = [report.reportFiles.url || report.reportFiles].filter(Boolean)
  1443. }
  1444. }
  1445. return {
  1446. detectDate: report.reportDate || '',
  1447. no: report.reportNo || '',
  1448. images: images
  1449. }
  1450. })
  1451. },
  1452. certificate: {
  1453. status: data.certificate && certFiles.length > 0 ? 'uploaded' : 'pending',
  1454. statusBadge: data.certificate && certFiles.length > 0
  1455. ? { text: '已上传', type: 'ok' }
  1456. : { text: '待补充', type: 'wait' },
  1457. issueDate: data.certificate?.certIssueDate || '',
  1458. no: data.certificate?.certNo || '',
  1459. fileUrl: certFiles.length > 0 ? certFiles[0].url : '',
  1460. images: certFiles.map(f => f.url),
  1461. emptyMessage: '合格证待补充,上传完成后可查看大图。'
  1462. },
  1463. traceConclusionCard: {
  1464. title: '溯源结论',
  1465. conclusion: '本批次产品来源清晰,已完成安全检测,过程可查',
  1466. desc: '检测材料与溯源数据已展示,可继续查看',
  1467. passed: true
  1468. },
  1469. // 时间轴逻辑:演示态使用 mock + 真实态使用真实数据
  1470. farmTimeline: (() => {
  1471. // 判断是否有真实时间轴数据
  1472. const hasRealTimeline = Array.isArray(data.farmTimeline) && data.farmTimeline.length > 0
  1473. let timeline = []
  1474. if (!hasRealTimeline) {
  1475. // 演示态:使用完整 mock 时间轴(用于页面展示验证)
  1476. timeline = [
  1477. { time: '2026-03-01', stage: 'planting', title: '开始种植', desc: '本批次产品进入种植管理阶段' },
  1478. { time: '2026-03-12', stage: 'care', title: '生长期养护', desc: '已完成灌溉、营养管理等日常养护' },
  1479. { time: '2026-03-20', stage: 'inspection', title: '田间巡检', desc: '已完成长势检查与种植环境巡检' },
  1480. { time: data.produceDate || '', stage: 'harvest', title: '成熟采收', desc: '本批次产品进入成熟采收阶段' },
  1481. { time: (data.reports?.[0]?.reportDate) || '', stage: 'test', title: '安全检测', desc: '已完成安全检测,相关结果可查' },
  1482. { time: data.packageDate || '', stage: 'pack', title: '包装出库', desc: '已完成包装整理,进入销售流通环节' }
  1483. ]
  1484. } else {
  1485. // 真实态:使用真实数据 + 补充系统节点
  1486. timeline = [...data.farmTimeline]
  1487. const stageSet = new Set(timeline.map(n => n.stage))
  1488. // 成熟采收
  1489. if (data.produceDate && !stageSet.has('harvest')) {
  1490. timeline.push({
  1491. time: data.produceDate,
  1492. stage: 'harvest',
  1493. title: '成熟采收',
  1494. desc: '本批次产品进入成熟采收阶段'
  1495. })
  1496. }
  1497. // 安全检测
  1498. if (data.reports && data.reports.length > 0 && !stageSet.has('test')) {
  1499. const validDates = data.reports
  1500. .map(r => r.reportDate)
  1501. .filter(d => d && /^\d{4}-\d{2}-\d{2}/.test(d))
  1502. .sort()
  1503. if (validDates.length > 0) {
  1504. timeline.push({
  1505. time: validDates[0],
  1506. stage: 'test',
  1507. title: '安全检测',
  1508. desc: '已完成安全检测,相关结果可查'
  1509. })
  1510. }
  1511. }
  1512. // 包装出库
  1513. if (data.packageDate && !stageSet.has('pack')) {
  1514. timeline.push({
  1515. time: data.packageDate,
  1516. stage: 'pack',
  1517. title: '包装出库',
  1518. desc: '已完成包装整理,进入销售流通环节'
  1519. })
  1520. }
  1521. }
  1522. // stage 顺序权重
  1523. const stageOrder = {
  1524. planting: 1,
  1525. care: 2,
  1526. inspection: 3,
  1527. harvest: 4,
  1528. test: 5,
  1529. pack: 6
  1530. }
  1531. // 按业务阶段排序,同 stage 内再按时间
  1532. timeline.sort((a, b) => {
  1533. const orderA = stageOrder[a.stage] || 99
  1534. const orderB = stageOrder[b.stage] || 99
  1535. // 先按 stage 排序
  1536. if (orderA !== orderB) {
  1537. return orderA - orderB
  1538. }
  1539. // 同 stage 再按时间
  1540. if (!a.time) return -1
  1541. if (!b.time) return 1
  1542. return a.time > b.time ? 1 : -1
  1543. })
  1544. return timeline.slice(0, 6)
  1545. })(),
  1546. camera: {
  1547. liveUrl: data.camera?.liveUrl || '',
  1548. coverImage: data.camera?.coverImage || '',
  1549. status: data.camera?.status || 'online',
  1550. desc: data.camera?.liveUrl
  1551. ? '当前为种植现场实时画面,现场环境与种植状态可见'
  1552. : '来自农场实景画面,种植环境真实呈现'
  1553. },
  1554. environment: {
  1555. summary: '本批次种植期环境稳定,整体处于适宜生长区间',
  1556. chart: {
  1557. type: 'npk_trend',
  1558. labels: ['03-01', '03-06', '03-10', '03-15', '03-21', '03-27', '04-01'],
  1559. values: {
  1560. n: [26.2, 25.8, 26.4, 25.9, 26.6, 26.1, 26.4],
  1561. p: [20.5, 20.1, 20.4, 20.0, 20.3, 20.2, 20.4],
  1562. k: [14.2, 14.6, 14.3, 14.7, 14.4, 14.8, 14.5]
  1563. }
  1564. },
  1565. items: [
  1566. { label: '气温', value: '22.3℃', status: '种植期平均' },
  1567. { label: '湿度', value: '45%', status: '种植期平均' },
  1568. { label: '降雨量', value: '118mm', status: '种植期累计' },
  1569. { label: '光照', value: '充足', status: '表现稳定' }
  1570. ],
  1571. current: {
  1572. temperature: '24.5℃',
  1573. humidity: '42.2%'
  1574. }
  1575. }
  1576. }
  1577. })
  1578. // 种植现场状态:三态逻辑
  1579. const cameraStatus = computed(() => {
  1580. const camera = deviceInfo?.status
  1581. if (!camera) return 'off'
  1582. // const hasLiveUrl = !!camera.liveUrl
  1583. // 有 liveUrl 但无封面图 → loading(信号接入中)
  1584. // 有 liveUrl 且有封面图 → online(可播放)
  1585. // 无 liveUrl → offline
  1586. if (camera && camera == 'off') {
  1587. return 'loading'
  1588. }
  1589. if (camera && camera == 'ON') {
  1590. return 'online'
  1591. }
  1592. return 'offline'
  1593. })
  1594. const cameraStatusText = computed(() => {
  1595. const map = {
  1596. loading: '连接中',
  1597. online: '实时在线',
  1598. offline: '暂未连接'
  1599. }
  1600. return map[cameraStatus.value] || '暂未连接'
  1601. })
  1602. // 种植环境记录图表配置
  1603. const CHART_SVG_WIDTH = 700
  1604. const CHART_SVG_HEIGHT = 200
  1605. const CHART_PADDING = 24 // SVG 内边距
  1606. // 动态计算数据范围(从真实数据中获取,并留上下边距)
  1607. const chartValueRange = computed(() => {
  1608. const chart = traceDetail.value?.environment?.chart
  1609. if (!chart?.values) {
  1610. return { min: 0, max: 1 }
  1611. }
  1612. const allValues = [
  1613. ...(chart.values.n || []),
  1614. ...(chart.values.p || []),
  1615. ...(chart.values.k || [])
  1616. ].filter(v => typeof v === 'number' && !Number.isNaN(v))
  1617. if (!allValues.length) {
  1618. return { min: 0, max: 1 }
  1619. }
  1620. const min = Math.min(...allValues)
  1621. const max = Math.max(...allValues)
  1622. // 增加上下留白,避免点贴边
  1623. const padding = (max - min) * 0.18 || 1
  1624. return {
  1625. min: min - padding,
  1626. max: max + padding
  1627. }
  1628. })
  1629. // 计算单个数据点在 SVG 坐标中的 y 值(使用动态范围)
  1630. const getSvgY = (value) => {
  1631. const { min, max } = chartValueRange.value
  1632. const range = max - min
  1633. if (range === 0) return CHART_SVG_HEIGHT / 2
  1634. const normalized = (value - min) / range
  1635. const innerHeight = CHART_SVG_HEIGHT - CHART_PADDING * 2
  1636. const y = CHART_PADDING + innerHeight * (1 - normalized)
  1637. return y
  1638. }
  1639. // 计算单个数据点在 SVG 坐标中的 x 值
  1640. const getSvgX = (idx, dataLength) => {
  1641. if (dataLength <= 1) return CHART_SVG_WIDTH / 2
  1642. const innerWidth = CHART_SVG_WIDTH - CHART_PADDING * 2
  1643. return CHART_PADDING + (idx / (dataLength - 1)) * innerWidth
  1644. }
  1645. // 获取某组数据的所有点位(过滤无效数据)
  1646. const getSvgPoints = (data) => {
  1647. if (!Array.isArray(data) || data.length === 0) return []
  1648. return data
  1649. .filter(v => typeof v === 'number' && !Number.isNaN(v))
  1650. .map((val, idx, arr) => ({
  1651. x: getSvgX(idx, arr.length),
  1652. y: getSvgY(val),
  1653. value: val
  1654. }))
  1655. }
  1656. // Catmull-Rom 转 Bezier 生成平滑曲线路径
  1657. const buildSmoothPath = (points) => {
  1658. if (points.length < 2) return ''
  1659. if (points.length === 2) {
  1660. return `M ${points[0].x} ${points[0].y} L ${points[1].x} ${points[1].y}`
  1661. }
  1662. // 起点
  1663. let d = `M ${points[0].x} ${points[0].y}`
  1664. // 中间点使用 Catmull-Rom 转 Bezier
  1665. for (let i = 0; i < points.length - 1; i++) {
  1666. const p0 = points[Math.max(0, i - 1)]
  1667. const p1 = points[i]
  1668. const p2 = points[i + 1]
  1669. const p3 = points[Math.min(points.length - 1, i + 2)]
  1670. // 控制点计算(张力系数 0.5)
  1671. const cp1x = p1.x + (p2.x - p0.x) / 6
  1672. const cp1y = p1.y + (p2.y - p0.y) / 6
  1673. const cp2x = p2.x - (p3.x - p1.x) / 6
  1674. const cp2y = p2.y - (p3.y - p1.y) / 6
  1675. d += ` C ${cp1x} ${cp1y}, ${cp2x} ${cp2y}, ${p2.x} ${p2.y}`
  1676. }
  1677. return d
  1678. }
  1679. // SVG 网格线 y 坐标
  1680. const svgGridLines = [24, 56, 88, 120, 152, 176]
  1681. // 平滑曲线配置
  1682. const CURVE_TENSION = 0.35 // 张力系数,越小越平滑
  1683. // 统一的图表计算 computed(确保所有依赖正确响应式)
  1684. const chartData = computed(() => {
  1685. const chart = traceDetail.value?.environment?.chart
  1686. if (!chart || !chart.values) {
  1687. return { n: [], p: [], k: [], paths: { n: '', p: '', k: '' }, areas: { n: '', p: '', k: '' } }
  1688. }
  1689. const valuesN = chart.values.n || []
  1690. const valuesP = chart.values.p || []
  1691. const valuesK = chart.values.k || []
  1692. // 收集所有有效数值,计算全局范围
  1693. const allValues = [...valuesN, ...valuesP, ...valuesK]
  1694. .filter(v => typeof v === 'number' && !Number.isNaN(v))
  1695. if (!allValues.length) {
  1696. return { n: [], p: [], k: [], paths: { n: '', p: '', k: '' }, areas: { n: '', p: '', k: '' } }
  1697. }
  1698. const dataMin = Math.min(...allValues)
  1699. const dataMax = Math.max(...allValues)
  1700. const padding = (dataMax - dataMin) * 0.25 || 1 // 增加边距空间
  1701. const minVal = dataMin - padding
  1702. const maxVal = dataMax + padding
  1703. const range = maxVal - minVal || 1
  1704. // 计算坐标的辅助函数
  1705. const calcY = (val) => {
  1706. const normalized = (val - minVal) / range
  1707. const innerHeight = CHART_SVG_HEIGHT - CHART_PADDING * 2
  1708. return CHART_PADDING + innerHeight * (1 - normalized)
  1709. }
  1710. const calcX = (idx, length) => {
  1711. if (length <= 1) return CHART_SVG_WIDTH / 2
  1712. const innerWidth = CHART_SVG_WIDTH - CHART_PADDING * 2
  1713. return CHART_PADDING + (idx / (length - 1)) * innerWidth
  1714. }
  1715. // 异常点平滑处理(简单移动平均)
  1716. const smoothValues = (data) => {
  1717. if (data.length < 3) return data
  1718. return data.map((v, i, arr) => {
  1719. if (i === 0 || i === arr.length - 1) return v
  1720. const prev = arr[i - 1]
  1721. const next = arr[i + 1]
  1722. // 如果与前后差值过大,做轻微平滑
  1723. if (Math.abs(v - prev) > range * 0.3 && Math.abs(v - next) > range * 0.3) {
  1724. return (prev + v + next) / 3
  1725. }
  1726. return v
  1727. })
  1728. }
  1729. // 计算点坐标(带平滑)
  1730. const calcPoints = (data) => {
  1731. if (!data.length) return []
  1732. const smoothed = smoothValues(data.filter(v => typeof v === 'number' && !Number.isNaN(v)))
  1733. return smoothed.map((val, idx, arr) => ({
  1734. x: calcX(idx, arr.length),
  1735. y: calcY(val),
  1736. value: val
  1737. }))
  1738. }
  1739. // 生成平滑曲线路径(使用优化的张力系数)
  1740. const buildPath = (points) => {
  1741. if (points.length < 2) return ''
  1742. if (points.length === 2) {
  1743. return `M ${points[0].x} ${points[0].y} L ${points[1].x} ${points[1].y}`
  1744. }
  1745. let d = `M ${points[0].x} ${points[0].y}`
  1746. for (let i = 0; i < points.length - 1; i++) {
  1747. const p0 = points[Math.max(0, i - 1)]
  1748. const p1 = points[i]
  1749. const p2 = points[i + 1]
  1750. const p3 = points[Math.min(points.length - 1, i + 2)]
  1751. // 使用可配置的张力系数
  1752. const cp1x = p1.x + (p2.x - p0.x) * CURVE_TENSION
  1753. const cp1y = p1.y + (p2.y - p0.y) * CURVE_TENSION
  1754. const cp2x = p2.x - (p3.x - p1.x) * CURVE_TENSION
  1755. const cp2y = p2.y - (p3.y - p1.y) * CURVE_TENSION
  1756. d += ` C ${cp1x} ${cp1y}, ${cp2x} ${cp2y}, ${p2.x} ${p2.y}`
  1757. }
  1758. return d
  1759. }
  1760. // 生成面积渐变路径(曲线下方填充)
  1761. const buildArea = (points) => {
  1762. if (points.length < 2) return ''
  1763. const linePath = buildPath(points)
  1764. const bottomY = CHART_SVG_HEIGHT - CHART_PADDING
  1765. const firstX = points[0].x
  1766. const lastX = points[points.length - 1].x
  1767. return `${linePath} L ${lastX} ${bottomY} L ${firstX} ${bottomY} Z`
  1768. }
  1769. const nPoints = calcPoints(valuesN)
  1770. const pPoints = calcPoints(valuesP)
  1771. const kPoints = calcPoints(valuesK)
  1772. return {
  1773. n: nPoints,
  1774. p: pPoints,
  1775. k: kPoints,
  1776. paths: {
  1777. n: buildPath(nPoints),
  1778. p: buildPath(pPoints),
  1779. k: buildPath(kPoints)
  1780. },
  1781. areas: {
  1782. n: buildArea(nPoints),
  1783. p: buildArea(pPoints),
  1784. k: buildArea(kPoints)
  1785. }
  1786. }
  1787. })
  1788. // 兼容旧接口
  1789. const chartPoints = computed(() => ({
  1790. n: chartData.value.n,
  1791. p: chartData.value.p,
  1792. k: chartData.value.k
  1793. }))
  1794. const chartPaths = computed(() => chartData.value.paths)
  1795. const chartAreas = computed(() => chartData.value.areas)
  1796. const reportImages = computed(() => {
  1797. const items = traceDetail.value?.report?.items
  1798. if (Array.isArray(items)) {
  1799. return items.flatMap(item => Array.isArray(item.images) ? item.images : [])
  1800. }
  1801. return []
  1802. })
  1803. const reportItems = computed(() => {
  1804. return traceDetail.value?.report?.items || []
  1805. })
  1806. // 计算某份报告内某张图在全局 reportImages 扁平数组中的索引
  1807. function getReportGlobalIndex(itemIndex, imgIndex) {
  1808. const items = reportItems.value
  1809. let offset = 0
  1810. for (let i = 0; i < itemIndex; i++) {
  1811. const imgArr = items[i]?.images
  1812. offset += Array.isArray(imgArr) ? imgArr.length : 0
  1813. }
  1814. return offset + imgIndex
  1815. }
  1816. const certificateImages = computed(() => {
  1817. const c = traceDetail.value?.certificate
  1818. if (!c) return []
  1819. if (Array.isArray(c.images) && c.images.length) return c.images
  1820. return c.fileUrl ? [c.fileUrl] : []
  1821. })
  1822. function contactCustomer() {
  1823. uni.makePhoneCall({
  1824. phoneNumber: '13379508760'
  1825. })
  1826. }
  1827. function goBackToPurchase() {
  1828. uni.showModal({
  1829. title: '返回购买渠道',
  1830. content: 'mock 模式:后续可跳转到直播间/小店页面。',
  1831. showCancel: true,
  1832. confirmText: '确认返回'
  1833. })
  1834. }
  1835. function previewDoc(kind, index) {
  1836. const urls = kind === 'report' ? reportImages.value : certificateImages.value
  1837. if (!urls.length) {
  1838. uni.showToast({ title: '该文件暂未上传', icon: 'none' })
  1839. return
  1840. }
  1841. uni.previewImage({
  1842. urls,
  1843. current: urls[index] || urls[0]
  1844. })
  1845. }
  1846. </script>
  1847. <style scoped>
  1848. .page {
  1849. position: relative;
  1850. min-height: 100vh;
  1851. --bg-cream-1: #f8f2e8;
  1852. --bg-cream-2: #f3ebdd;
  1853. --bg-cream-3: #ece1ce;
  1854. --forest-900: #143a2b;
  1855. --forest-800: #1f513b;
  1856. --forest-700: #2d6849;
  1857. --sage-500: #708f7d;
  1858. --gold-320: #ccb086;
  1859. --gold-260: #dcc4a0;
  1860. --text-900: #233126;
  1861. --text-700: #3c4d41;
  1862. --text-500: #6b776d;
  1863. background: linear-gradient(172deg,
  1864. #FAF6EF 0%,
  1865. #F4EEE3 38%,
  1866. #EDF0EC 68%,
  1867. #E8EFE9 100%
  1868. );
  1869. overflow: hidden;
  1870. }
  1871. /* 背景氛围层:三层光感(前景/中景/背景)+ grain */
  1872. .pageDecor {
  1873. position: fixed;
  1874. inset: 0;
  1875. pointer-events: none;
  1876. z-index: 0;
  1877. }
  1878. .pageGlow {
  1879. position: absolute;
  1880. border-radius: 50%;
  1881. filter: blur(14rpx);
  1882. }
  1883. /* 背景层:左上森林绿微光 */
  1884. .glowA {
  1885. width: 780rpx;
  1886. height: 780rpx;
  1887. top: -280rpx;
  1888. left: -300rpx;
  1889. background: radial-gradient(circle, rgba(26, 84, 58, 0.18) 0%, rgba(20, 72, 50, 0) 70%);
  1890. opacity: 0.85;
  1891. }
  1892. /* 中景层:右下金色暖光 */
  1893. .glowB {
  1894. width: 720rpx;
  1895. height: 720rpx;
  1896. right: -280rpx;
  1897. top: 480rpx;
  1898. background: radial-gradient(circle, rgba(200, 170, 120, 0.2) 0%, rgba(200, 170, 120, 0) 72%);
  1899. opacity: 0.9;
  1900. }
  1901. /* 前景层:顶部柔和高光,塑造空间感 */
  1902. .glowC {
  1903. width: 600rpx;
  1904. height: 360rpx;
  1905. top: -60rpx;
  1906. left: 50%;
  1907. transform: translateX(-50%);
  1908. background: radial-gradient(ellipse at 50% 0%, rgba(255, 252, 246, 0.38), transparent 70%);
  1909. filter: blur(20rpx);
  1910. opacity: 0.7;
  1911. }
  1912. /* 纹理叠加层 */
  1913. .pageGrain {
  1914. position: absolute;
  1915. inset: 0;
  1916. opacity: 0.55;
  1917. background:
  1918. radial-gradient(900rpx 380rpx at 48% -4%, rgba(255, 255, 255, 0.55), rgba(255, 255, 255, 0)),
  1919. radial-gradient(640rpx 400rpx at 104% 48%, rgba(68, 112, 86, 0.09), rgba(68, 112, 86, 0)),
  1920. radial-gradient(700rpx 320rpx at -4% 76%, rgba(210, 180, 130, 0.12), rgba(210, 180, 130, 0)),
  1921. linear-gradient(180deg, rgba(248, 244, 236, 0.16) 0%, rgba(228, 242, 232, 0.08) 100%);
  1922. }
  1923. .safeTop {
  1924. height: calc(env(safe-area-inset-top));
  1925. position: relative;
  1926. z-index: 1;
  1927. }
  1928. /* 轻品牌页头:透明底,不叠在 Hero 上产生「白雾」;层级低于首屏卡 */
  1929. .brandPageHeader {
  1930. position: relative;
  1931. z-index: 2;
  1932. display: flex;
  1933. align-items: center;
  1934. min-height: 72rpx;
  1935. padding: 0 40rpx;
  1936. box-sizing: border-box;
  1937. border-bottom: 1rpx solid rgba(39, 75, 57, 0.05);
  1938. background: transparent;
  1939. }
  1940. .brandPageHeaderInner {
  1941. display: flex;
  1942. align-items: center;
  1943. gap: 10rpx;
  1944. width: 100%;
  1945. }
  1946. .brandPageHeaderName {
  1947. font-size: 22rpx;
  1948. font-weight: 600;
  1949. line-height: 1.15;
  1950. letter-spacing: 0.1em;
  1951. color: rgba(27, 41, 33, 0.65);
  1952. }
  1953. .brandPageHeaderDot {
  1954. flex-shrink: 0;
  1955. width: 4rpx;
  1956. height: 4rpx;
  1957. border-radius: 50%;
  1958. background: rgba(39, 113, 76, 0.4);
  1959. }
  1960. .brandPageHeaderLabel {
  1961. font-size: 20rpx;
  1962. font-weight: 400;
  1963. line-height: 1.15;
  1964. letter-spacing: 0.06em;
  1965. color: rgba(112, 143, 125, 0.7);
  1966. }
  1967. .hero,
  1968. .content {
  1969. position: relative;
  1970. z-index: 1;
  1971. }
  1972. .hero {
  1973. padding: 0 24rpx;
  1974. }
  1975. /* 完整首屏大卡:与品牌页头分离,避免负 margin 上提后被页头遮盖 */
  1976. .heroCard {
  1977. border-radius: 42rpx;
  1978. overflow: hidden;
  1979. margin-top: 20rpx;
  1980. position: relative;
  1981. z-index: 4;
  1982. box-shadow:
  1983. 0 48rpx 120rpx rgba(10, 36, 24, 0.2),
  1984. 0 16rpx 48rpx rgba(10, 36, 24, 0.1),
  1985. 0 2rpx 0 rgba(255, 255, 255, 0.6) inset;
  1986. backdrop-filter: blur(4px);
  1987. }
  1988. /* Hero 视觉区:多层次光感空间,顶部高光 + 景深 + 底部暗化 */
  1989. .heroBg {
  1990. position: relative;
  1991. width: 100%;
  1992. height: 0;
  1993. padding-bottom: 56.25%;
  1994. overflow: hidden;
  1995. background: linear-gradient(160deg, rgba(20, 74, 52, 0.72), rgba(205, 177, 129, 0.3) 70%, rgba(243, 232, 214, 0.36));
  1996. }
  1997. /* 前景层光晕:右下淡金色微光(提升质感) */
  1998. .heroBg::before {
  1999. content: '';
  2000. position: absolute;
  2001. right: -100rpx;
  2002. bottom: -72rpx;
  2003. width: 520rpx;
  2004. height: 280rpx;
  2005. border-radius: 50%;
  2006. background: radial-gradient(ellipse at 42% 38%, rgba(252, 244, 228, 0.18), transparent 68%);
  2007. pointer-events: none;
  2008. z-index: 2;
  2009. }
  2010. .heroImage {
  2011. position: absolute;
  2012. inset: 0;
  2013. width: 100%;
  2014. height: 100%;
  2015. display: block;
  2016. z-index: 1;
  2017. }
  2018. .heroBrandAnchor {
  2019. position: absolute;
  2020. right: -48rpx;
  2021. bottom: -14rpx;
  2022. z-index: 2;
  2023. pointer-events: none;
  2024. }
  2025. .heroBrandAnchorText {
  2026. font-size: 164rpx;
  2027. font-weight: 760;
  2028. letter-spacing: 0.1em;
  2029. line-height: 1;
  2030. color: rgba(248, 241, 227, 0.045);
  2031. transform: rotate(-8deg);
  2032. }
  2033. /* Hero 遮罩层:提亮后仍保留轻微底部过渡,避免压住真实商品图 */
  2034. .heroMask {
  2035. position: absolute;
  2036. inset: 0;
  2037. z-index: 3;
  2038. background:
  2039. radial-gradient(ellipse 180% 60% at 50% 0%, rgba(255, 252, 248, 0.26), transparent 68%),
  2040. radial-gradient(480rpx 240rpx at 90% 8%, rgba(252, 248, 240, 0.2), transparent 62%),
  2041. radial-gradient(700rpx 360rpx at 8% 65%, rgba(6, 24, 16, 0.12), transparent 58%),
  2042. radial-gradient(560rpx 300rpx at 88% 80%, rgba(205, 177, 129, 0.06), transparent 62%),
  2043. linear-gradient(180deg,
  2044. rgba(8, 28, 18, 0) 0%,
  2045. rgba(8, 28, 18, 0) 62%,
  2046. rgba(10, 36, 24, 0.05) 80%,
  2047. rgba(8, 26, 18, 0.1) 92%,
  2048. rgba(248, 244, 238, 0.12) 100%
  2049. );
  2050. }
  2051. /* 商品信息面板:玻璃浮层效果,负margin上浮 + backdrop-filter */
  2052. .heroInfoPanel {
  2053. background: rgba(252, 248, 242, 0.88);
  2054. backdrop-filter: blur(14px);
  2055. -webkit-backdrop-filter: blur(14px);
  2056. position: relative;
  2057. }
  2058. /* 与 Hero 底部自然过渡 */
  2059. .heroInfoPanel::before {
  2060. content: '';
  2061. position: absolute;
  2062. top: -56rpx;
  2063. left: 0;
  2064. right: 0;
  2065. height: 56rpx;
  2066. background: linear-gradient(180deg,
  2067. rgba(252, 248, 242, 0) 0%,
  2068. rgba(252, 248, 242, 0.88) 100%
  2069. );
  2070. pointer-events: none;
  2071. z-index: 1;
  2072. }
  2073. .infoPanelInner {
  2074. position: relative;
  2075. z-index: 2;
  2076. padding: 32rpx 30rpx 30rpx;
  2077. }
  2078. /* 与下方农场/批次等卡片共用 .sectionHeader / .sectionHeaderLeft 样式 */
  2079. .infoPanelBody {
  2080. padding-top: 0;
  2081. }
  2082. .infoPanelName {
  2083. display: block;
  2084. font-size: 30rpx;
  2085. font-weight: 680;
  2086. line-height: 1.4;
  2087. letter-spacing: 0.01em;
  2088. color: rgba(27, 41, 33, 0.92);
  2089. }
  2090. .infoPanelSpec {
  2091. display: inline-flex;
  2092. align-items: center;
  2093. gap: 10rpx;
  2094. margin-top: 14rpx;
  2095. padding: 8rpx 16rpx;
  2096. border-radius: 20rpx;
  2097. background: rgba(39, 113, 76, 0.06);
  2098. border: 1rpx solid rgba(39, 113, 76, 0.08);
  2099. }
  2100. .specDot {
  2101. width: 6rpx;
  2102. height: 6rpx;
  2103. border-radius: 50%;
  2104. background: rgba(39, 113, 76, 0.5);
  2105. }
  2106. .specText {
  2107. font-size: 20rpx;
  2108. font-weight: 500;
  2109. color: rgba(54, 66, 57, 0.85);
  2110. }
  2111. .infoPanelIntro {
  2112. margin-top: 16rpx;
  2113. padding-top: 16rpx;
  2114. border-top: 1rpx solid rgba(39, 75, 57, 0.06);
  2115. font-size: 23rpx;
  2116. line-height: 1.8;
  2117. color: rgba(54, 66, 57, 0.75);
  2118. }
  2119. .content {
  2120. padding: 20rpx 0 40rpx;
  2121. }
  2122. /* 基础卡片:半透明玻璃质感 */
  2123. .card {
  2124. margin: 0 24rpx 22rpx;
  2125. padding: 30rpx 28rpx;
  2126. border-radius: 36rpx;
  2127. background: rgba(252, 250, 244, 0.76);
  2128. box-shadow:
  2129. 0 16rpx 40rpx rgba(38, 41, 32, 0.07),
  2130. 0 1rpx 0 rgba(255, 255, 255, 0.5) inset;
  2131. backdrop-filter: blur(8px);
  2132. -webkit-backdrop-filter: blur(8px);
  2133. }
  2134. .card.soft {
  2135. background: rgba(252, 248, 244, 0.6);
  2136. }
  2137. /* Hero 之后第一张卡:适度上浮 */
  2138. .cardHeroFirst {
  2139. margin-top: -28rpx;
  2140. position: relative;
  2141. z-index: 3;
  2142. }
  2143. /* 层级 0:与 Hero 同级,主卡(商品面板) */
  2144. .cardLevel0 {
  2145. box-shadow:
  2146. 0 48rpx 120rpx rgba(10, 36, 24, 0.16),
  2147. 0 16rpx 48rpx rgba(10, 36, 24, 0.08),
  2148. 0 1rpx 0 rgba(255, 255, 255, 0.6) inset;
  2149. }
  2150. /* 层级 1:次要信息卡,阴影中等 */
  2151. .cardLevel1 {
  2152. box-shadow:
  2153. 0 20rpx 50rpx rgba(30, 34, 24, 0.09),
  2154. 0 8rpx 24rpx rgba(30, 34, 24, 0.05),
  2155. 0 1rpx 0 rgba(255, 255, 255, 0.55) inset;
  2156. }
  2157. /* 层级 2:次次要信息卡,阴影更轻 */
  2158. .cardLevel2 {
  2159. box-shadow:
  2160. 0 14rpx 36rpx rgba(36, 38, 28, 0.065),
  2161. 0 1rpx 0 rgba(255, 255, 255, 0.5) inset;
  2162. }
  2163. /* 层级 3:底部辅助信息卡,最轻 */
  2164. .cardLevel3 {
  2165. box-shadow:
  2166. 0 8rpx 22rpx rgba(42, 44, 30, 0.04),
  2167. 0 1rpx 0 rgba(255, 255, 255, 0.44) inset;
  2168. }
  2169. .cardFarm {
  2170. background: rgba(250, 248, 242, 0.82);
  2171. }
  2172. .cardBatch {
  2173. background: rgba(251, 248, 242, 0.8);
  2174. }
  2175. .cardCredential {
  2176. background: rgba(252, 248, 240, 0.84);
  2177. }
  2178. .cardBatchState {
  2179. background: rgba(252, 248, 244, 0.74);
  2180. }
  2181. /* 检测结论卡:结论型卡片,比普通资料卡更有结论感 */
  2182. .cardConclusion {
  2183. background: rgba(252, 250, 244, 0.82);
  2184. }
  2185. .conclusionBody {
  2186. padding-top: 6rpx;
  2187. }
  2188. .conclusionLead {
  2189. display: block;
  2190. font-size: 32rpx;
  2191. font-weight: 680;
  2192. line-height: 1.5;
  2193. letter-spacing: 0.01em;
  2194. color: rgba(24, 38, 30, 0.96);
  2195. margin-bottom: 14rpx;
  2196. }
  2197. .conclusionDesc {
  2198. display: block;
  2199. font-size: 20rpx;
  2200. font-weight: 400;
  2201. line-height: 1.9;
  2202. color: rgba(84, 106, 93, 0.5);
  2203. }
  2204. /* 农事时间轴:关键种植过程 */
  2205. .cardTimeline {
  2206. background: rgba(252, 250, 244, 0.82);
  2207. }
  2208. .timelineList {
  2209. padding-top: 4rpx;
  2210. }
  2211. .timelineItem {
  2212. display: flex;
  2213. padding-bottom: 24rpx;
  2214. }
  2215. .timelineItem:last-child {
  2216. padding-bottom: 0;
  2217. }
  2218. .timelineLeft {
  2219. display: flex;
  2220. flex-direction: column;
  2221. align-items: center;
  2222. width: 40rpx;
  2223. flex-shrink: 0;
  2224. }
  2225. .timelineDot {
  2226. width: 12rpx;
  2227. height: 12rpx;
  2228. border-radius: 50%;
  2229. background: rgba(39, 113, 76, 0.5);
  2230. flex-shrink: 0;
  2231. }
  2232. .timelineLine {
  2233. width: 1rpx;
  2234. flex: 1;
  2235. background: rgba(39, 113, 76, 0.2);
  2236. margin-top: 8rpx;
  2237. }
  2238. .timelineRight {
  2239. flex: 1;
  2240. padding-left: 24rpx;
  2241. }
  2242. .timelineTime {
  2243. display: block;
  2244. font-size: 19rpx;
  2245. font-weight: 400;
  2246. color: rgba(84, 106, 93, 0.5);
  2247. margin-bottom: 6rpx;
  2248. letter-spacing: 0.02em;
  2249. }
  2250. .timelineTitle {
  2251. display: block;
  2252. font-size: 27rpx;
  2253. font-weight: 600;
  2254. color: rgba(27, 41, 33, 0.88);
  2255. margin-bottom: 6rpx;
  2256. line-height: 1.3;
  2257. }
  2258. .timelineDesc {
  2259. display: block;
  2260. font-size: 21rpx;
  2261. font-weight: 400;
  2262. line-height: 1.7;
  2263. color: rgba(84, 106, 93, 0.75);
  2264. }
  2265. /* 关键节点(安全检测):轻强调 */
  2266. .timelineItem.is-key .timelineDot {
  2267. background: rgba(39, 113, 76, 0.7);
  2268. }
  2269. .timelineItem.is-key .timelineTitle {
  2270. font-weight: 600;
  2271. color: rgba(27, 41, 33, 0.9);
  2272. }
  2273. /* 当前节点(包装出库):主高亮 */
  2274. .timelineItem.is-current .timelineDot {
  2275. background: #2f7d55;
  2276. box-shadow: 0 0 0 6rpx rgba(47, 125, 85, 0.12);
  2277. }
  2278. .timelineItem.is-current .timelineTitle {
  2279. font-weight: 700;
  2280. color: rgba(20, 60, 40, 0.95);
  2281. }
  2282. /* 底部可信来源说明 */
  2283. .timelineFootnote {
  2284. margin-top: 20rpx;
  2285. font-size: 20rpx;
  2286. color: rgba(84, 106, 93, 0.45);
  2287. line-height: 1.6;
  2288. }
  2289. /* 种植现场实时画面模块 */
  2290. .cardLive {
  2291. background: rgba(252, 250, 244, 0.82);
  2292. }
  2293. .liveMediaWrap {
  2294. position: relative;
  2295. width: 100%;
  2296. height: 380rpx;
  2297. border-radius: 20rpx;
  2298. overflow: hidden;
  2299. background: linear-gradient(
  2300. 160deg,
  2301. rgba(39, 113, 76, 0.04) 0%,
  2302. rgba(39, 113, 76, 0.015) 50%,
  2303. rgba(39, 113, 76, 0.05) 100%
  2304. );
  2305. border: 1rpx solid rgba(39, 75, 57, 0.08);
  2306. box-shadow: inset 0 2rpx 12rpx rgba(39, 113, 76, 0.04);
  2307. }
  2308. .liveCover {
  2309. width: 100%;
  2310. height: 100%;
  2311. }
  2312. /* 默认未播放态背景:深灰绿 + 墨绿色层次感 */
  2313. .video-placeholder-bg {
  2314. position: absolute;
  2315. top: 0;
  2316. left: 0;
  2317. width: 100%;
  2318. height: 100%;
  2319. background: linear-gradient(
  2320. 165deg,
  2321. rgba(45, 70, 55, 0.78) 0%,
  2322. rgba(35, 55, 45, 0.82) 50%,
  2323. rgba(28, 45, 38, 0.88) 100%
  2324. );
  2325. box-shadow: inset 0 0 100rpx rgba(55, 90, 68, 0.12);
  2326. }
  2327. .livePlaceholder {
  2328. width: 100%;
  2329. height: 100%;
  2330. display: flex;
  2331. flex-direction: column;
  2332. align-items: center;
  2333. justify-content: center;
  2334. background: transparent;
  2335. }
  2336. .livePlayIcon {
  2337. display: flex;
  2338. align-items: center;
  2339. gap: 8rpx;
  2340. margin-bottom: 20rpx;
  2341. }
  2342. .livePlayDot {
  2343. width: 8rpx;
  2344. height: 8rpx;
  2345. border-radius: 50%;
  2346. background: rgba(39, 113, 76, 0.35);
  2347. animation: livePulse 1.4s ease-in-out infinite;
  2348. }
  2349. .livePlayDot.dot2 {
  2350. animation-delay: 0.2s;
  2351. }
  2352. .livePlayDot.dot3 {
  2353. animation-delay: 0.4s;
  2354. }
  2355. @keyframes livePulse {
  2356. 0%, 100% {
  2357. opacity: 0.3;
  2358. transform: scale(0.8);
  2359. }
  2360. 50% {
  2361. opacity: 1;
  2362. transform: scale(1.1);
  2363. }
  2364. }
  2365. .livePlaceholderMain {
  2366. font-size: 26rpx;
  2367. font-weight: 500;
  2368. color: rgba(39, 113, 76, 0.5);
  2369. margin-bottom: 10rpx;
  2370. }
  2371. .livePlaceholderSub {
  2372. font-size: 20rpx;
  2373. color: rgba(84, 106, 93, 0.35);
  2374. }
  2375. /* 实时在线状态标签(视频区内部轻量风格) */
  2376. .liveStatusPill {
  2377. display: flex;
  2378. align-items: center;
  2379. gap: 5rpx;
  2380. padding: 0;
  2381. background: transparent;
  2382. border: none;
  2383. }
  2384. .liveStatusDot {
  2385. width: 6rpx;
  2386. height: 6rpx;
  2387. border-radius: 50%;
  2388. flex-shrink: 0;
  2389. background: #6EDFA3;
  2390. box-shadow: 0 0 6rpx rgba(110, 223, 163, 0.6);
  2391. }
  2392. .liveStatusPill.online .liveStatusDot {
  2393. animation: statusPulse 2s ease-in-out infinite;
  2394. }
  2395. .liveStatusText {
  2396. font-size: 18rpx;
  2397. font-weight: 600;
  2398. color: rgba(235, 245, 240, 0.88);
  2399. letter-spacing: 0.02em;
  2400. text-shadow: 0 1rpx 4rpx rgba(0, 0, 0, 0.25);
  2401. }
  2402. @keyframes statusPulse {
  2403. 0%, 100% {
  2404. opacity: 1;
  2405. box-shadow: 0 0 6rpx rgba(110, 223, 163, 0.6);
  2406. }
  2407. 50% {
  2408. opacity: 0.7;
  2409. box-shadow: 0 0 3rpx rgba(110, 223, 163, 0.3);
  2410. }
  2411. }
  2412. .liveStatusPill.offline .liveStatusDot {
  2413. background: rgba(150, 160, 155, 0.6);
  2414. box-shadow: none;
  2415. }
  2416. .liveDesc {
  2417. margin-top: 14rpx;
  2418. font-size: 18rpx;
  2419. color: rgba(84, 106, 93, 0.45);
  2420. line-height: 1.6;
  2421. }
  2422. /* 种植环境记录模块 */
  2423. .cardEnvironment {
  2424. background: rgba(252, 250, 244, 0.82);
  2425. }
  2426. .environmentSummary {
  2427. font-size: 28rpx;
  2428. font-weight: 500;
  2429. color: rgba(27, 41, 33, 0.8);
  2430. line-height: 1.6;
  2431. margin-bottom: 24rpx;
  2432. }
  2433. /* 土壤养分趋势图 */
  2434. .environmentChart {
  2435. background: rgba(39, 113, 76, 0.03);
  2436. border: 1rpx solid rgba(39, 113, 76, 0.08);
  2437. border-radius: 16rpx;
  2438. padding: 24rpx;
  2439. margin-bottom: 24rpx;
  2440. }
  2441. .environmentChartHead {
  2442. margin-bottom: 20rpx;
  2443. }
  2444. .environmentChartTitle {
  2445. display: block;
  2446. font-size: 26rpx;
  2447. font-weight: 600;
  2448. color: rgba(27, 41, 33, 0.75);
  2449. }
  2450. .environmentChartSub {
  2451. display: block;
  2452. font-size: 20rpx;
  2453. color: rgba(84, 106, 93, 0.45);
  2454. margin-top: 4rpx;
  2455. }
  2456. .environmentChartCanvas {
  2457. position: relative;
  2458. height: 200rpx;
  2459. margin-bottom: 16rpx;
  2460. }
  2461. .chartPlotArea {
  2462. position: absolute;
  2463. top: 0;
  2464. left: 0;
  2465. right: 0;
  2466. bottom: 30rpx;
  2467. }
  2468. /* SVG 图表样式 */
  2469. .chartSvg {
  2470. width: 100%;
  2471. height: 100%;
  2472. }
  2473. /* 网格线(弱化,避免抢视觉) */
  2474. .chartGridLineSvg {
  2475. stroke: rgba(39, 113, 76, 0.05);
  2476. stroke-width: 1;
  2477. }
  2478. /* 面积渐变层(趋势带效果) */
  2479. .chartAreaN {
  2480. fill: rgba(47, 125, 85, 0.08);
  2481. }
  2482. .chartAreaP {
  2483. fill: rgba(180, 140, 70, 0.08);
  2484. }
  2485. .chartAreaK {
  2486. fill: rgba(84, 130, 110, 0.08);
  2487. }
  2488. /* 曲线样式(柔和趋势线) */
  2489. .chartPathN {
  2490. fill: none;
  2491. stroke-width: 2.5;
  2492. stroke-opacity: 0.7;
  2493. stroke-linecap: round;
  2494. stroke-linejoin: round;
  2495. }
  2496. .chartPathP {
  2497. fill: none;
  2498. stroke-width: 2.5;
  2499. stroke-opacity: 0.7;
  2500. stroke-linecap: round;
  2501. stroke-linejoin: round;
  2502. }
  2503. .chartPathK {
  2504. fill: none;
  2505. stroke-width: 2.5;
  2506. stroke-opacity: 0.7;
  2507. stroke-linecap: round;
  2508. stroke-linejoin: round;
  2509. }
  2510. /* 数据点样式(小而柔和) */
  2511. .chartDotN {
  2512. fill: rgba(47, 125, 85, 0.85);
  2513. }
  2514. .chartDotP {
  2515. fill: rgba(180, 140, 70, 0.85);
  2516. }
  2517. .chartDotK {
  2518. fill: rgba(84, 130, 110, 0.85);
  2519. }
  2520. .chartLabels {
  2521. position: absolute;
  2522. bottom: 0;
  2523. left: 0;
  2524. right: 0;
  2525. display: flex;
  2526. justify-content: space-between;
  2527. }
  2528. .chartLabels text {
  2529. font-size: 18rpx;
  2530. color: rgba(84, 106, 93, 0.4);
  2531. }
  2532. .environmentChartLegend {
  2533. display: flex;
  2534. justify-content: center;
  2535. gap: 40rpx;
  2536. }
  2537. .legendItem {
  2538. display: flex;
  2539. align-items: center;
  2540. gap: 10rpx;
  2541. }
  2542. .legendDot {
  2543. width: 8rpx;
  2544. height: 8rpx;
  2545. border-radius: 50%;
  2546. }
  2547. .legendN {
  2548. background: rgba(47, 125, 85, 0.65);
  2549. }
  2550. .legendP {
  2551. background: rgba(180, 140, 70, 0.65);
  2552. }
  2553. .legendK {
  2554. background: rgba(84, 130, 110, 0.65);
  2555. }
  2556. .legendItem text {
  2557. font-size: 22rpx;
  2558. color: rgba(84, 106, 93, 0.55);
  2559. }
  2560. /* 环境摘要项 */
  2561. .environmentGrid {
  2562. display: grid;
  2563. grid-template-columns: repeat(2, minmax(0, 1fr));
  2564. gap: 16rpx;
  2565. }
  2566. .environmentItem {
  2567. display: flex;
  2568. flex-direction: column;
  2569. gap: 6rpx;
  2570. padding: 20rpx;
  2571. border-radius: 14rpx;
  2572. background: rgba(39, 113, 76, 0.04);
  2573. border: 1rpx solid rgba(39, 113, 76, 0.08);
  2574. }
  2575. .environmentLabel {
  2576. font-size: 20rpx;
  2577. color: rgba(84, 106, 93, 0.45);
  2578. }
  2579. .environmentValue {
  2580. font-size: 30rpx;
  2581. font-weight: 600;
  2582. color: rgba(27, 41, 33, 0.8);
  2583. line-height: 1.2;
  2584. }
  2585. .environmentStatus {
  2586. font-size: 18rpx;
  2587. color: rgba(47, 125, 85, 0.55);
  2588. }
  2589. /* ================================================
  2590. 微动效:让页面"活起来"
  2591. ================================================ */
  2592. /* Hero 进入:上浮 + 淡入 */
  2593. @keyframes heroEnter {
  2594. 0% {
  2595. opacity: 0;
  2596. transform: translateY(28rpx);
  2597. }
  2598. 100% {
  2599. opacity: 1;
  2600. transform: translateY(0);
  2601. }
  2602. }
  2603. .heroCard {
  2604. animation: heroEnter 0.6s cubic-bezier(0.22, 0.78, 0.35, 1) both;
  2605. }
  2606. /* 卡片依次入场:延迟递增,制造节奏感 */
  2607. @keyframes cardEnter {
  2608. 0% {
  2609. opacity: 0;
  2610. transform: translateY(20rpx);
  2611. }
  2612. 100% {
  2613. opacity: 1;
  2614. transform: translateY(0);
  2615. }
  2616. }
  2617. /* 商品面板:稍晚于 Hero */
  2618. .heroInfoPanel {
  2619. animation: cardEnter 0.5s cubic-bezier(0.22, 0.78, 0.35, 1) 0.15s both;
  2620. }
  2621. /* 检测结论卡 */
  2622. .cardConclusion {
  2623. animation: cardEnter 0.5s cubic-bezier(0.22, 0.78, 0.35, 1) 0.2s both;
  2624. }
  2625. /* 农场卡 */
  2626. .cardFarm {
  2627. animation: cardEnter 0.5s cubic-bezier(0.22, 0.78, 0.35, 1) 0.25s both;
  2628. }
  2629. /* 批次卡 */
  2630. .cardBatch {
  2631. animation: cardEnter 0.5s cubic-bezier(0.22, 0.78, 0.35, 1) 0.35s both;
  2632. }
  2633. /* 凭证卡 */
  2634. .cardCredential {
  2635. animation: cardEnter 0.5s cubic-bezier(0.22, 0.78, 0.35, 1) 0.45s both;
  2636. }
  2637. /* ============================
  2638. 检测报告横向卡片列表
  2639. ============================ */
  2640. .reportCardList {
  2641. width: 100%;
  2642. overflow-x: auto;
  2643. overflow-y: hidden;
  2644. -webkit-overflow-scrolling: touch;
  2645. white-space: nowrap;
  2646. }
  2647. .reportCardList::-webkit-scrollbar {
  2648. display: none;
  2649. }
  2650. .reportCardTrack {
  2651. display: inline-flex;
  2652. flex-wrap: nowrap;
  2653. align-items: stretch;
  2654. gap: 16rpx;
  2655. padding: 6rpx 4rpx 10rpx;
  2656. /* 关键:让子项不受 flex 压缩,自然撑开形成横向溢出 */
  2657. width: max-content;
  2658. }
  2659. /* 单张报告卡片 */
  2660. .reportCard {
  2661. flex-shrink: 0;
  2662. width: 220rpx;
  2663. background: #FAFBF9;
  2664. border: 1rpx solid rgba(39, 75, 57, 0.09);
  2665. border-radius: 14rpx;
  2666. padding: 12rpx 12rpx 10rpx;
  2667. display: flex;
  2668. flex-direction: column;
  2669. align-items: stretch;
  2670. box-shadow: 0 2rpx 8rpx rgba(39, 75, 57, 0.04);
  2671. }
  2672. /* 缩略图(带页数角标覆盖层) */
  2673. .reportCardThumb {
  2674. position: relative;
  2675. width: 100%;
  2676. height: 196rpx;
  2677. background: rgba(39, 75, 57, 0.03);
  2678. border-radius: 10rpx;
  2679. overflow: hidden;
  2680. display: flex;
  2681. align-items: center;
  2682. justify-content: center;
  2683. margin-bottom: 10rpx;
  2684. }
  2685. .reportCardThumbImg {
  2686. width: 100%;
  2687. height: 100%;
  2688. }
  2689. .reportCardThumbEmpty {
  2690. width: 100%;
  2691. height: 100%;
  2692. display: flex;
  2693. align-items: center;
  2694. justify-content: center;
  2695. }
  2696. .reportCardThumbEmptyText {
  2697. font-size: 18rpx;
  2698. color: rgba(39, 75, 57, 0.3);
  2699. }
  2700. /* 页数角标:绝对定位在缩略图右下角 */
  2701. .reportCardPages {
  2702. position: absolute;
  2703. bottom: 8rpx;
  2704. right: 8rpx;
  2705. font-size: 15rpx;
  2706. color: rgba(39, 75, 57, 0.65);
  2707. background: rgba(250, 251, 249, 0.88);
  2708. border: 1rpx solid rgba(39, 75, 57, 0.1);
  2709. border-radius: 6rpx;
  2710. padding: 2rpx 8rpx;
  2711. line-height: 1.4;
  2712. }
  2713. /* 报告元信息 */
  2714. .reportCardMeta {
  2715. flex: 1;
  2716. margin-bottom: 6rpx;
  2717. }
  2718. .reportCardRow {
  2719. display: flex;
  2720. justify-content: space-between;
  2721. align-items: baseline;
  2722. gap: 4rpx;
  2723. margin-bottom: 4rpx;
  2724. }
  2725. .reportCardLabel {
  2726. font-size: 16rpx;
  2727. color: rgba(84, 106, 93, 0.6);
  2728. flex-shrink: 0;
  2729. }
  2730. .reportCardValue {
  2731. font-size: 16rpx;
  2732. color: rgba(68, 82, 72, 0.85);
  2733. font-weight: 460;
  2734. text-align: right;
  2735. word-break: break-all;
  2736. }
  2737. .reportCardValueNo {
  2738. font-size: 14rpx;
  2739. color: rgba(68, 82, 72, 0.72);
  2740. }
  2741. /* 点击提示 */
  2742. .reportCardHint {
  2743. font-size: 14rpx;
  2744. color: rgba(39, 75, 57, 0.3);
  2745. text-align: center;
  2746. margin-top: auto;
  2747. }
  2748. /* 底部辅助卡 */
  2749. .cardBatchState {
  2750. animation: cardEnter 0.5s cubic-bezier(0.22, 0.78, 0.35, 1) 0.55s both;
  2751. }
  2752. /* 卡片触摸反馈:阴影增强(模拟按压感) */
  2753. .card:active {
  2754. transition: box-shadow 0.15s ease, transform 0.15s ease;
  2755. }
  2756. /* 触摸时轻微缩小,增加真实感 */
  2757. .card:active:not(.heroInfoPanel) {
  2758. transform: scale(0.99);
  2759. }
  2760. .sectionHeader {
  2761. display: flex;
  2762. align-items: center;
  2763. justify-content: space-between;
  2764. gap: 18rpx;
  2765. margin-bottom: 20rpx;
  2766. }
  2767. .sectionHeaderLeft {
  2768. display: flex;
  2769. flex-direction: column;
  2770. gap: 10rpx;
  2771. position: relative;
  2772. padding-bottom: 8rpx;
  2773. }
  2774. .sectionHeaderLeft::after {
  2775. content: '';
  2776. position: absolute;
  2777. left: 0;
  2778. bottom: 0;
  2779. width: 78rpx;
  2780. height: 2rpx;
  2781. border-radius: 999rpx;
  2782. background: linear-gradient(90deg, rgba(46, 82, 63, 0.3), rgba(203, 176, 128, 0.26), rgba(46, 82, 63, 0));
  2783. pointer-events: none;
  2784. }
  2785. .sectionEn {
  2786. font-size: 15rpx;
  2787. font-weight: 500;
  2788. letter-spacing: 0.24em;
  2789. text-transform: uppercase;
  2790. color: rgba(84, 106, 93, 0.76);
  2791. }
  2792. .sectionTitle {
  2793. font-size: 27rpx;
  2794. font-weight: 620;
  2795. color: rgba(60, 72, 64, 0.72);
  2796. }
  2797. .statusBadge {
  2798. font-size: 18rpx;
  2799. font-weight: 620;
  2800. padding: 9rpx 15rpx;
  2801. border-radius: 999rpx;
  2802. white-space: nowrap;
  2803. border: 1rpx solid transparent;
  2804. box-shadow: 0 1rpx 0 rgba(255, 255, 255, 0.34) inset;
  2805. }
  2806. .statusBadge.ok {
  2807. color: #1d5d40;
  2808. background: rgba(39, 113, 76, 0.12);
  2809. border-color: rgba(39, 113, 76, 0.2);
  2810. }
  2811. .statusBadge.wait {
  2812. color: #715726;
  2813. background: rgba(203, 171, 112, 0.2);
  2814. border-color: rgba(203, 171, 112, 0.26);
  2815. }
  2816. .statusBadge.warning {
  2817. color: #8a5e22;
  2818. background: rgba(214, 174, 95, 0.22);
  2819. border-color: rgba(214, 174, 95, 0.28);
  2820. }
  2821. .statusBadge.muted {
  2822. color: #677069;
  2823. background: rgba(126, 137, 128, 0.14);
  2824. border-color: rgba(126, 137, 128, 0.2);
  2825. }
  2826. /* =============================================
  2827. 商品信息面板专用信任认证徽章:强化图标主视觉、文字辅助
  2828. ============================================= */
  2829. /* 整体:认证章风格,低饱和细边框,无交互感 */
  2830. .trustBadge {
  2831. display: inline-flex;
  2832. align-items: center;
  2833. gap: 7rpx;
  2834. padding: 9rpx 18rpx 9rpx 15rpx;
  2835. border-radius: 999rpx;
  2836. border: 1rpx solid rgba(39, 113, 76, 0.22);
  2837. background: rgba(39, 113, 76, 0.06);
  2838. box-shadow:
  2839. 0 2rpx 6rpx rgba(39, 113, 76, 0.06),
  2840. 0 1rpx 0 rgba(255, 255, 255, 0.55) inset;
  2841. white-space: nowrap;
  2842. cursor: default;
  2843. pointer-events: none;
  2844. user-select: none;
  2845. }
  2846. /* 双圆环认证图标:20×20 viewBox,图标为第一视觉焦点 */
  2847. .trustBadgeIcon {
  2848. width: 30rpx;
  2849. height: 30rpx;
  2850. flex-shrink: 0;
  2851. vertical-align: middle;
  2852. display: inline-block;
  2853. }
  2854. /* 文案:品牌深绿,字重略降,视觉权重低于图标 */
  2855. .trustBadgeText {
  2856. font-size: 18rpx;
  2857. font-weight: 500;
  2858. letter-spacing: 0.05em;
  2859. color: rgba(27, 71, 42, 0.68);
  2860. }
  2861. .kv {
  2862. display: flex;
  2863. flex-direction: column;
  2864. gap: 16rpx;
  2865. }
  2866. .kvRow {
  2867. display: flex;
  2868. align-items: baseline;
  2869. justify-content: space-between;
  2870. gap: 16rpx;
  2871. }
  2872. .kvKey {
  2873. font-size: 22rpx;
  2874. font-weight: 480;
  2875. color: rgba(54, 68, 58, 0.62);
  2876. }
  2877. .kvVal {
  2878. font-size: 24rpx;
  2879. font-weight: 660;
  2880. text-align: right;
  2881. color: rgba(27, 41, 33, 0.92);
  2882. }
  2883. /* 农场主体:左图右文,右栏与图片垂直居中,名称/地址成组 */
  2884. .farmBody {
  2885. display: flex;
  2886. align-items: center;
  2887. gap: 24rpx;
  2888. margin-bottom: 18rpx;
  2889. }
  2890. .farmImageWrap {
  2891. flex-shrink: 0;
  2892. width: 180rpx;
  2893. height: 136rpx;
  2894. border-radius: 22rpx;
  2895. overflow: hidden;
  2896. position: relative;
  2897. box-shadow:
  2898. 0 12rpx 28rpx rgba(24, 41, 30, 0.14),
  2899. 0 2rpx 0 rgba(255, 255, 255, 0.3) inset;
  2900. }
  2901. .farmImage {
  2902. width: 100%;
  2903. height: 100%;
  2904. display: block;
  2905. background: linear-gradient(160deg, rgba(234, 245, 240, 0.9), rgba(220, 238, 228, 0.85));
  2906. }
  2907. .farmMeta {
  2908. flex: 1;
  2909. display: flex;
  2910. flex-direction: column;
  2911. justify-content: center;
  2912. min-width: 0;
  2913. gap: 10rpx;
  2914. }
  2915. .farmName {
  2916. font-size: 28rpx;
  2917. font-weight: 680;
  2918. line-height: 1.45;
  2919. letter-spacing: 0.01em;
  2920. color: rgba(27, 41, 33, 0.94);
  2921. }
  2922. /* 农场地址:普通文本样式,弱于标题;多行时图标与首行对齐 */
  2923. .farmLocation {
  2924. display: flex;
  2925. align-items: flex-start;
  2926. gap: 8rpx;
  2927. }
  2928. /* 定位小图标:略弱、与首行文字视觉对齐 */
  2929. .locationIcon {
  2930. width: 18rpx;
  2931. height: 18rpx;
  2932. flex-shrink: 0;
  2933. margin-top: 6rpx;
  2934. opacity: 0.42;
  2935. }
  2936. .locationText {
  2937. flex: 1;
  2938. min-width: 0;
  2939. font-size: 21rpx;
  2940. font-weight: 400;
  2941. color: rgba(84, 106, 93, 0.82);
  2942. line-height: 1.55;
  2943. letter-spacing: 0.02em;
  2944. }
  2945. /* 农场介绍:融入主体,使用分隔线区分,与商品简介风格统一 */
  2946. .farmIntro {
  2947. padding-top: 18rpx;
  2948. border-top: 1rpx solid rgba(39, 75, 57, 0.06);
  2949. font-size: 23rpx;
  2950. line-height: 1.86;
  2951. color: rgba(54, 68, 58, 0.76);
  2952. }
  2953. .emptyText {
  2954. margin-top: 10rpx;
  2955. font-size: 24rpx;
  2956. line-height: 1.62;
  2957. color: rgba(16, 24, 19, 0.72);
  2958. }
  2959. .btnRow {
  2960. margin-top: 22rpx;
  2961. }
  2962. /* 合格证紧凑缩略图 */
  2963. /* ============================
  2964. 合格证:信息摘要 + 缩略图一体化布局
  2965. ============================ */
  2966. .certSummary {
  2967. display: flex;
  2968. align-items: flex-start;
  2969. gap: 24rpx;
  2970. }
  2971. .certSummaryInfo {
  2972. flex: 1;
  2973. display: flex;
  2974. flex-direction: column;
  2975. gap: 14rpx;
  2976. min-width: 0;
  2977. }
  2978. .certSummaryRow {
  2979. display: flex;
  2980. flex-direction: column;
  2981. gap: 4rpx;
  2982. }
  2983. .certSummaryLabel {
  2984. font-size: 20rpx;
  2985. font-weight: 500;
  2986. color: rgba(39, 75, 57, 0.55);
  2987. letter-spacing: 0.02em;
  2988. }
  2989. .certSummaryValue {
  2990. font-size: 25rpx;
  2991. font-weight: 580;
  2992. color: rgba(27, 41, 33, 0.9);
  2993. line-height: 1.4;
  2994. }
  2995. .certThumbContainer {
  2996. flex: 0 0 auto;
  2997. display: flex;
  2998. flex-direction: column;
  2999. align-items: center;
  3000. gap: 4rpx;
  3001. }
  3002. .certThumbContainer .certThumbWrap {
  3003. /* 与左侧两行摘要区总高约齐平:缩略图 + gap + 提示行 */
  3004. width: 88rpx;
  3005. height: 120rpx;
  3006. border-radius: 8rpx;
  3007. overflow: hidden;
  3008. background: #fff;
  3009. border: 1rpx solid rgba(200, 180, 140, 0.22);
  3010. box-shadow: 0 2rpx 8rpx rgba(30, 36, 26, 0.06);
  3011. }
  3012. .certThumbContainer .certThumbImage {
  3013. width: 100%;
  3014. height: 100%;
  3015. display: block;
  3016. }
  3017. .certPreviewHint {
  3018. font-size: 16rpx;
  3019. line-height: 1.15;
  3020. color: rgba(39, 75, 57, 0.4);
  3021. letter-spacing: 0.01em;
  3022. }
  3023. .certPendingHint {
  3024. flex: 1;
  3025. display: flex;
  3026. align-items: center;
  3027. padding: 12rpx 0;
  3028. }
  3029. .certPendingText {
  3030. font-size: 21rpx;
  3031. color: rgba(39, 75, 57, 0.5);
  3032. line-height: 1.5;
  3033. }
  3034. /* 旧样式保留但隐藏(兼容其他模块) */
  3035. .certPreviewCompact {
  3036. display: flex;
  3037. flex-direction: column;
  3038. align-items: center;
  3039. margin-top: 24rpx;
  3040. }
  3041. .docPlaceholder {
  3042. margin-top: 16rpx;
  3043. padding: 20rpx;
  3044. border-radius: 26rpx;
  3045. background: linear-gradient(160deg, rgba(244, 237, 224, 0.82), rgba(237, 244, 235, 0.72));
  3046. border: 1rpx solid rgba(201, 171, 120, 0.22);
  3047. }
  3048. .docPlaceholderTitle {
  3049. display: block;
  3050. margin-bottom: 12rpx;
  3051. font-size: 22rpx;
  3052. font-weight: 650;
  3053. color: rgba(35, 93, 64, 0.92);
  3054. }
  3055. .docPlaceholderText {
  3056. display: block;
  3057. font-size: 22rpx;
  3058. line-height: 1.75;
  3059. color: rgba(59, 71, 62, 0.82);
  3060. }
  3061. .docBlock {
  3062. margin-top: 14rpx;
  3063. padding: 18rpx;
  3064. border-radius: 22rpx;
  3065. background: rgba(255, 255, 255, 0.46);
  3066. }
  3067. .docBlock:first-of-type {
  3068. margin-top: 4rpx;
  3069. }
  3070. .docTitle {
  3071. display: block;
  3072. margin-bottom: 10rpx;
  3073. font-size: 22rpx;
  3074. font-weight: 620;
  3075. color: rgba(45, 87, 64, 0.84);
  3076. }
  3077. .docText {
  3078. font-size: 22rpx;
  3079. line-height: 1.8;
  3080. color: rgba(64, 75, 67, 0.8);
  3081. }
  3082. /* 批次信息主体:连续信息排版,标签-值对应,与商品信息卡风格统一 */
  3083. .batchBody {
  3084. display: flex;
  3085. flex-direction: column;
  3086. }
  3087. /* 批次信息主体:左右两列布局,左列固定,右列自适应,内容左对齐 */
  3088. .batchBody {
  3089. display: flex;
  3090. flex-direction: column;
  3091. }
  3092. .batchRow {
  3093. display: flex;
  3094. align-items: baseline;
  3095. padding: 16rpx 0;
  3096. }
  3097. .batchRow + .batchRow {
  3098. border-top: 1rpx solid rgba(39, 75, 57, 0.05);
  3099. }
  3100. .batchRowLabel {
  3101. flex-shrink: 0;
  3102. width: 162rpx;
  3103. font-size: 21rpx;
  3104. font-weight: 460;
  3105. color: rgba(84, 106, 93, 0.68);
  3106. letter-spacing: 0.02em;
  3107. line-height: 1.5;
  3108. }
  3109. .batchRowValue {
  3110. flex: 1;
  3111. min-width: 0;
  3112. font-size: 25rpx;
  3113. font-weight: 580;
  3114. line-height: 1.4;
  3115. letter-spacing: 0.01em;
  3116. color: rgba(27, 41, 33, 0.9);
  3117. }
  3118. .cardCredential .certSummary {
  3119. margin-top: 4rpx;
  3120. }
  3121. /* 底部柔和收口渐变 */
  3122. .footerFade {
  3123. position: relative;
  3124. height: 1rpx;
  3125. margin: 0 80rpx;
  3126. background: linear-gradient(90deg,
  3127. transparent 0%,
  3128. rgba(39, 75, 57, 0.15) 30%,
  3129. rgba(39, 75, 57, 0.2) 50%,
  3130. rgba(39, 75, 57, 0.15) 70%,
  3131. transparent 100%
  3132. );
  3133. }
  3134. .footerFade::before {
  3135. content: '';
  3136. position: absolute;
  3137. top: 0;
  3138. left: 50%;
  3139. transform: translateX(-50%);
  3140. width: 60%;
  3141. height: 80rpx;
  3142. background: radial-gradient(ellipse at 50% 100%, rgba(39, 75, 57, 0.06), transparent 70%);
  3143. }
  3144. /* 轻量页脚 */
  3145. .traceFooter {
  3146. padding: 36rpx 32rpx 52rpx;
  3147. display: flex;
  3148. flex-direction: column;
  3149. align-items: center;
  3150. gap: 14rpx;
  3151. }
  3152. .traceFooterHint {
  3153. font-size: 20rpx;
  3154. font-weight: 400;
  3155. color: rgba(88, 100, 92, 0.45);
  3156. letter-spacing: 0.03em;
  3157. }
  3158. .traceFooterPhone {
  3159. display: flex;
  3160. align-items: center;
  3161. gap: 6rpx;
  3162. padding: 8rpx 16rpx;
  3163. border-radius: 6rpx;
  3164. transition: opacity 0.2s ease;
  3165. }
  3166. .traceFooterPhone:active {
  3167. opacity: 0.55;
  3168. }
  3169. .traceFooterPhoneIcon {
  3170. width: 22rpx;
  3171. height: 22rpx;
  3172. opacity: 0.55;
  3173. }
  3174. .traceFooterPhoneNum {
  3175. font-size: 22rpx;
  3176. font-weight: 400;
  3177. color: rgba(39, 75, 57, 0.6);
  3178. letter-spacing: 0.04em;
  3179. }
  3180. .traceFooterBrand {
  3181. font-size: 17rpx;
  3182. font-weight: 400;
  3183. letter-spacing: 0.1em;
  3184. color: rgba(88, 100, 92, 0.3);
  3185. margin-top: 8rpx;
  3186. }
  3187. /* 视频预览区域 */
  3188. .video-section {
  3189. /* margin: 0 30rpx 20rpx; */
  3190. position: relative;
  3191. z-index: 1;
  3192. }
  3193. .video-container {
  3194. position: relative;
  3195. width: 100%;
  3196. height: 420rpx;
  3197. background-color: #000000;
  3198. border-radius: 16rpx;
  3199. overflow: hidden;
  3200. box-shadow: 0 6rpx 20rpx rgba(0, 0, 0, 0.1);
  3201. transition: all 0.3s ease;
  3202. }
  3203. .video-container.fullscreen-mode {
  3204. position: fixed;
  3205. top: 0;
  3206. left: 0;
  3207. width: 100vw;
  3208. height: 100vh;
  3209. margin: 0;
  3210. z-index: 9999;
  3211. border-radius: 0;
  3212. }
  3213. .video-container.fullscreen-mode .video-controls {
  3214. padding: 30rpx;
  3215. }
  3216. .video-container.fullscreen-mode .top-controls,
  3217. .video-container.fullscreen-mode .bottom-controls {
  3218. opacity: 0;
  3219. transition: opacity 0.3s ease;
  3220. }
  3221. .video-container.fullscreen-mode:hover .top-controls,
  3222. .video-container.fullscreen-mode:hover .bottom-controls {
  3223. opacity: 1;
  3224. }
  3225. .video-player,
  3226. .video-placeholder {
  3227. width: 100%;
  3228. height: 100%;
  3229. object-fit: contain;
  3230. }
  3231. /* 微信小程序video组件样式 */
  3232. #myVideo {
  3233. width: 100%;
  3234. height: 100%;
  3235. background-color: #000000;
  3236. }
  3237. /* App端video组件样式 */
  3238. /* #ifdef APP-PLUS || APP-HARMONY */
  3239. #appVideo {
  3240. width: 100%;
  3241. height: 100%;
  3242. background-color: #000000;
  3243. }
  3244. /* #endif */
  3245. .h5-video-wrapper {
  3246. width: 100%;
  3247. height: 100%;
  3248. }
  3249. /* App端视频播放器样式优化 */
  3250. /* #ifdef APP-PLUS || APP-HARMONY */
  3251. #appVideoPlayer {
  3252. width: 100%;
  3253. height: 100%;
  3254. background-color: #000000;
  3255. }
  3256. /* #endif */
  3257. .video-controls {
  3258. position: absolute;
  3259. top: 0;
  3260. left: 0;
  3261. width: 100%;
  3262. height: 100%;
  3263. display: flex;
  3264. flex-direction: column;
  3265. justify-content: space-between;
  3266. padding: 20rpx;
  3267. box-sizing: border-box;
  3268. background: linear-gradient(to bottom, rgba(0, 0, 0, 0.3) 0%, rgba(0, 0, 0, 0) 30%, rgba(0, 0, 0, 0) 70%, rgba(0, 0, 0, 0.3) 100%);
  3269. }
  3270. .control-row {
  3271. display: flex;
  3272. justify-content: space-between;
  3273. align-items: center;
  3274. width: 100%;
  3275. }
  3276. .top-controls {
  3277. height: 80rpx;
  3278. }
  3279. .center-controls {
  3280. height: 120rpx;
  3281. justify-content: center;
  3282. align-items: center;
  3283. }
  3284. .bottom-controls {
  3285. height: 80rpx;
  3286. }
  3287. /* 信号指示器(轻量状态提示) */
  3288. .signal-indicator {
  3289. display: flex;
  3290. align-items: center;
  3291. color: rgba(200, 215, 205, 0.7);
  3292. font-size: 18rpx;
  3293. background-color: rgba(30, 55, 42, 0.5);
  3294. padding: 4rpx 10rpx;
  3295. border-radius: 16rpx;
  3296. opacity: 0.65;
  3297. }
  3298. .signal-subtle {
  3299. opacity: 0.55;
  3300. }
  3301. .signal-indicator image {
  3302. margin-right: 4rpx;
  3303. opacity: 0.7;
  3304. }
  3305. .signal-text {
  3306. font-weight: 400;
  3307. letter-spacing: 0.02em;
  3308. }
  3309. /* 全屏按钮(轻量透明图标按钮) */
  3310. .fullscreen-button {
  3311. position: absolute;
  3312. top: 12rpx;
  3313. right: 16rpx;
  3314. width: 44rpx;
  3315. height: 44rpx;
  3316. display: flex;
  3317. align-items: center;
  3318. justify-content: center;
  3319. color: rgba(235, 245, 240, 0.75);
  3320. background-color: transparent;
  3321. border: none;
  3322. border-radius: 0;
  3323. transition: all 0.2s;
  3324. z-index: 7;
  3325. }
  3326. .fullscreen-button:active {
  3327. color: rgba(235, 245, 240, 0.95);
  3328. transform: scale(0.92);
  3329. }
  3330. /* 实时在线状态标签(固定在右上角,全屏按钮左侧) */
  3331. .video-fixed-status {
  3332. position: absolute;
  3333. top: 24rpx;
  3334. right: 30rpx;
  3335. z-index: 6;
  3336. display: flex;
  3337. align-items: center;
  3338. }
  3339. .video-time {
  3340. color: #FFFFFF;
  3341. font-size: 26rpx;
  3342. background-color: rgba(0, 0, 0, 0.4);
  3343. padding: 6rpx 16rpx;
  3344. border-radius: 20rpx;
  3345. font-weight: 400;
  3346. }
  3347. /* 播放按钮(精致品牌风格,更柔和) */
  3348. .play-button {
  3349. width: 88rpx;
  3350. height: 88rpx;
  3351. border-radius: 50%;
  3352. background: rgba(255, 255, 255, 0.1);
  3353. backdrop-filter: blur(6px);
  3354. -webkit-backdrop-filter: blur(6px);
  3355. display: flex;
  3356. align-items: center;
  3357. justify-content: center;
  3358. border: 1rpx solid rgba(255, 255, 255, 0.2);
  3359. box-shadow: 0 4rpx 16rpx rgba(0, 0, 0, 0.15), inset 0 1rpx 0 rgba(255, 255, 255, 0.08);
  3360. transition: all 0.25s ease;
  3361. }
  3362. .play-button:active {
  3363. transform: scale(0.94);
  3364. background: rgba(255, 255, 255, 0.16);
  3365. }
  3366. /* 播放按钮内部图标(柔和米白) */
  3367. .play-btn-circle {
  3368. width: 54rpx;
  3369. height: 54rpx;
  3370. border-radius: 50%;
  3371. background: linear-gradient(135deg, rgba(250, 250, 248, 0.92) 0%, rgba(242, 245, 240, 0.88) 100%);
  3372. display: flex;
  3373. align-items: center;
  3374. justify-content: center;
  3375. box-shadow: 0 2rpx 8rpx rgba(0, 0, 0, 0.12);
  3376. }
  3377. /* CSS 三角形播放图标(柔和深绿灰) */
  3378. .play-btn-icon {
  3379. width: 0;
  3380. height: 0;
  3381. border-style: solid;
  3382. border-width: 10rpx 0 10rpx 17rpx;
  3383. border-color: transparent transparent transparent rgba(45, 70, 55, 0.82);
  3384. margin-left: 3rpx;
  3385. }
  3386. .center-button-container {
  3387. width: 100%;
  3388. height: 100%;
  3389. display: flex;
  3390. align-items: center;
  3391. justify-content: center;
  3392. }
  3393. .pause-icon {
  3394. width: 80rpx;
  3395. height: 80rpx;
  3396. border-radius: 50%;
  3397. background-color: rgba(0, 0, 0, 0.5);
  3398. display: flex;
  3399. align-items: center;
  3400. justify-content: center;
  3401. opacity: 0;
  3402. transition: opacity 0.3s;
  3403. }
  3404. .center-button-container:active .pause-icon {
  3405. opacity: 1;
  3406. background-color: rgba(76, 175, 80, 0.7);
  3407. }
  3408. </style>