detail.vue 92 KB

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