shareIndex.html 87 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008200920102011201220132014201520162017201820192020202120222023202420252026202720282029203020312032203320342035203620372038203920402041204220432044204520462047204820492050205120522053205420552056205720582059206020612062206320642065206620672068206920702071207220732074207520762077207820792080208120822083208420852086208720882089209020912092209320942095209620972098209921002101210221032104210521062107210821092110211121122113211421152116211721182119212021212122212321242125212621272128212921302131213221332134213521362137213821392140214121422143214421452146214721482149215021512152215321542155215621572158215921602161216221632164216521662167216821692170217121722173217421752176217721782179218021812182218321842185218621872188218921902191219221932194219521962197219821992200220122022203220422052206220722082209221022112212221322142215221622172218221922202221222222232224222522262227222822292230223122322233223422352236223722382239224022412242224322442245224622472248224922502251225222532254225522562257225822592260226122622263226422652266226722682269227022712272227322742275227622772278227922802281228222832284228522862287228822892290229122922293229422952296229722982299230023012302230323042305230623072308230923102311231223132314231523162317231823192320232123222323232423252326232723282329233023312332233323342335233623372338233923402341234223432344234523462347234823492350235123522353235423552356235723582359236023612362236323642365236623672368236923702371237223732374237523762377237823792380238123822383238423852386238723882389239023912392239323942395239623972398239924002401240224032404240524062407240824092410241124122413241424152416241724182419242024212422242324242425242624272428242924302431243224332434243524362437243824392440244124422443244424452446244724482449245024512452245324542455245624572458245924602461246224632464246524662467246824692470247124722473247424752476247724782479248024812482248324842485248624872488248924902491249224932494249524962497249824992500250125022503250425052506250725082509251025112512251325142515251625172518251925202521252225232524252525262527252825292530253125322533253425352536253725382539254025412542254325442545254625472548254925502551255225532554255525562557255825592560256125622563256425652566256725682569257025712572257325742575257625772578257925802581258225832584258525862587258825892590259125922593259425952596259725982599260026012602260326042605260626072608260926102611261226132614261526162617261826192620262126222623262426252626262726282629263026312632263326342635263626372638263926402641264226432644264526462647264826492650265126522653265426552656265726582659266026612662266326642665266626672668266926702671267226732674267526762677267826792680268126822683268426852686268726882689269026912692269326942695269626972698269927002701270227032704270527062707270827092710271127122713271427152716271727182719272027212722272327242725272627272728272927302731273227332734273527362737273827392740274127422743274427452746274727482749275027512752275327542755275627572758275927602761276227632764276527662767276827692770277127722773277427752776277727782779278027812782278327842785278627872788278927902791279227932794279527962797279827992800280128022803280428052806280728082809281028112812281328142815281628172818281928202821282228232824282528262827282828292830283128322833283428352836283728382839284028412842284328442845284628472848284928502851285228532854285528562857285828592860286128622863286428652866286728682869287028712872287328742875287628772878287928802881288228832884288528862887288828892890289128922893289428952896289728982899290029012902290329042905290629072908290929102911291229132914291529162917291829192920292129222923292429252926292729282929293029312932293329342935293629372938293929402941294229432944294529462947294829492950295129522953295429552956295729582959296029612962296329642965296629672968296929702971297229732974297529762977297829792980298129822983298429852986298729882989299029912992299329942995299629972998299930003001300230033004300530063007300830093010301130123013301430153016301730183019302030213022302330243025302630273028302930303031303230333034303530363037303830393040304130423043304430453046304730483049
  1. <!DOCTYPE html>
  2. <html lang="zh-CN">
  3. <head>
  4. <meta charset="utf-8">
  5. <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no, viewport-fit=cover">
  6. <meta name="format-detection" content="telephone=no">
  7. <title>U店在哪</title>
  8. <style>
  9. :root {
  10. --orange: #F58220;
  11. --orange-light: #FFF4E8;
  12. --red: #FF4D4F;
  13. --text: #333333;
  14. --text-secondary: #999999;
  15. --border: #EEEEEE;
  16. --bg: #FFFFFF;
  17. --safe-bottom: env(safe-area-inset-bottom, 0px);
  18. }
  19. * {
  20. margin: 0;
  21. padding: 0;
  22. box-sizing: border-box;
  23. }
  24. #staffGroupsMount{
  25. height: 202px;
  26. overflow: hidden;
  27. }
  28. html {
  29. font-size: 16px;
  30. -webkit-tap-highlight-color: transparent;
  31. overflow-x: hidden;
  32. }
  33. body {
  34. font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", "Helvetica Neue", sans-serif;
  35. background: var(--bg);
  36. color: var(--text);
  37. padding-bottom: calc(88px + var(--safe-bottom));
  38. min-height: 100vh;
  39. overflow-x: hidden;
  40. }
  41. /* Header */
  42. .header {
  43. position: sticky;
  44. top: 0;
  45. z-index: 100;
  46. display: flex;
  47. align-items: center;
  48. justify-content: center;
  49. height: 44px;
  50. padding: 0 15px;
  51. background: var(--bg);
  52. border-bottom: 1px solid var(--border);
  53. }
  54. .header__back {
  55. position: absolute;
  56. left: 15px;
  57. width: 24px;
  58. height: 24px;
  59. display: flex;
  60. align-items: center;
  61. justify-content: center;
  62. color: var(--text);
  63. text-decoration: none;
  64. }
  65. .header__title {
  66. font-size: 17px;
  67. font-weight: 600;
  68. color: var(--text);
  69. }
  70. /* Hero carousel */
  71. .hero {
  72. position: relative;
  73. margin: 0 15px;
  74. margin-top: 10px;
  75. border-radius: 0 0 12px 12px;
  76. overflow: hidden;
  77. }
  78. .hero__track {
  79. display: flex;
  80. transition: transform 0.35s ease;
  81. }
  82. .hero__slide {
  83. flex: 0 0 100%;
  84. aspect-ratio: 16 / 10;
  85. background: #f0f0f0;
  86. }
  87. .hero__slide img {
  88. width: 100%;
  89. height: 100%;
  90. object-fit: cover;
  91. display: block;
  92. vertical-align: middle;
  93. }
  94. .hero__dots {
  95. position: absolute;
  96. bottom: 12px;
  97. left: 0;
  98. right: 0;
  99. display: flex;
  100. justify-content: center;
  101. align-items: center;
  102. gap: 6px;
  103. }
  104. .hero__dot {
  105. width: 6px;
  106. height: 6px;
  107. border-radius: 3px;
  108. background: rgba(255, 255, 255, 0.45);
  109. transition: width 0.25s ease, background 0.25s ease;
  110. }
  111. .hero__dot.is-active {
  112. width: 16px;
  113. background: #fff;
  114. }
  115. /* Store block */
  116. .section {
  117. padding: 16px 15px 0;
  118. }
  119. .store-name {
  120. font-size: 20px;
  121. font-weight: 700;
  122. line-height: 1.35;
  123. margin-bottom: 12px;
  124. }
  125. .row {
  126. display: flex;
  127. align-items: center;
  128. justify-content: space-between;
  129. gap: 10px;
  130. }
  131. .rating-row {
  132. margin-bottom: 12px;
  133. }
  134. .stars {
  135. display: inline-flex;
  136. align-items: center;
  137. gap: 2px;
  138. }
  139. .star {
  140. width: 14px;
  141. height: 14px;
  142. color: var(--orange);
  143. }
  144. .rating-num {
  145. font-size: 14px;
  146. font-weight: 600;
  147. color: var(--orange);
  148. }
  149. .store-evaluate-row {
  150. display: none;
  151. flex-direction: row;
  152. flex-wrap: wrap;
  153. align-items: center;
  154. gap: 6px 6px;
  155. margin: 0 0 12px;
  156. padding: 0;
  157. font-size: 13px;
  158. line-height: 1.4;
  159. color: var(--text-secondary);
  160. }
  161. .store-evaluate-row.is-visible {
  162. display: flex;
  163. }
  164. .store-evaluate__item {
  165. white-space: nowrap;
  166. }
  167. .link-muted {
  168. display: inline-flex;
  169. align-items: center;
  170. gap: 2px;
  171. font-size: 13px;
  172. color: var(--text-secondary);
  173. text-decoration: none;
  174. }
  175. .chevron {
  176. width: 14px;
  177. height: 14px;
  178. opacity: 0.6;
  179. }
  180. .hours-row {
  181. /* margin-bottom: 16px; */
  182. align-items: flex-start;
  183. border-bottom:1px solid #eee;
  184. padding-bottom: 20px;
  185. }
  186. .hours-left {
  187. flex: 1;
  188. min-width: 0;
  189. }
  190. .status {
  191. font-size: 14px;
  192. color: var(--red);
  193. margin-right: 8px;
  194. }
  195. .status.is-open {
  196. color: var(--orange);
  197. }
  198. .hours-text {
  199. font-size: 14px;
  200. color: var(--text-secondary);
  201. }
  202. .divider {
  203. height: 8px;
  204. background: #F7F7F7;
  205. margin: 0;
  206. }
  207. /* Location */
  208. .loc-wrap {
  209. display: flex;
  210. padding: 16px 15px;
  211. gap: 12px;
  212. }
  213. .loc-main {
  214. flex: 1;
  215. min-width: 0;
  216. padding-right: 12px;
  217. }
  218. .addr {
  219. font-size: 15px;
  220. font-weight: 600;
  221. line-height: 1.45;
  222. margin-bottom: 10px;
  223. }
  224. .meta-line {
  225. display: flex;
  226. align-items: flex-start;
  227. gap: 6px;
  228. font-size: 13px;
  229. color: var(--text-secondary);
  230. line-height: 1.45;
  231. margin-top: 6px;
  232. }
  233. .meta-line svg,
  234. .meta-line img {
  235. flex-shrink: 0;
  236. margin-top: 2px;
  237. opacity: 0.75;
  238. display: block;
  239. }
  240. .loc-actions {
  241. display: flex;
  242. flex-direction: row;
  243. align-items: center;
  244. justify-content: center;
  245. gap: 18px;
  246. flex-shrink: 0;
  247. }
  248. .act-btn {
  249. display: flex;
  250. flex-direction: column;
  251. align-items: center;
  252. gap: 4px;
  253. background: none;
  254. border: none;
  255. padding: 0;
  256. cursor: pointer;
  257. font-size: 12px;
  258. color: var(--text);
  259. }
  260. .act-btn__icon {
  261. width: 44px;
  262. height: 44px;
  263. border-radius: 10px;
  264. background: #F5F5F5;
  265. display: flex;
  266. align-items: center;
  267. justify-content: center;
  268. color: var(--orange);
  269. }
  270. .act-btn__icon img {
  271. width: 22px;
  272. height: 22px;
  273. object-fit: contain;
  274. display: block;
  275. }
  276. /* businessStatus===99 时仅展示关店提示并隐藏 .share-content;底部 FAB 仍在 #shareBelowContentEl */
  277. .closed-rec-wrap {
  278. display: none;
  279. }
  280. .closed-rec-divider {
  281. height: 8px;
  282. background: #F7F7F7;
  283. margin: 0;
  284. }
  285. .closed-rec-title {
  286. padding: 8px 15px 12px;
  287. font-size: 16px;
  288. font-weight: 700;
  289. }
  290. .closed-rec-grid {
  291. display: grid;
  292. grid-template-columns: repeat(2, 1fr);
  293. gap: 10px;
  294. padding: 0 15px 20px;
  295. }
  296. #shareClosedRecEmpty {
  297. grid-column: 1 / -1;
  298. }
  299. .closed-rec-empty {
  300. padding: 12px;
  301. color: var(--text-secondary);
  302. font-size: 14px;
  303. }
  304. .closed-rec-card {
  305. min-width: 0;
  306. background: #fff;
  307. border-radius: 10px;
  308. overflow: hidden;
  309. box-shadow: 0 2px 12px rgba(0, 0, 0, 0.06);
  310. }
  311. .closed-rec-card__img {
  312. aspect-ratio: 4 / 3;
  313. background: #eee;
  314. }
  315. .closed-rec-card__img img {
  316. width: 100%;
  317. height: 100%;
  318. object-fit: cover;
  319. display: block;
  320. border-radius: 0;
  321. }
  322. .closed-rec-card__body {
  323. padding: 10px;
  324. }
  325. .closed-rec-card__top {
  326. display: flex;
  327. justify-content: space-between;
  328. align-items: baseline;
  329. gap: 8px;
  330. margin-bottom: 6px;
  331. }
  332. .closed-rec-card__name {
  333. font-size: 15px;
  334. font-weight: 700;
  335. flex: 1;
  336. min-width: 0;
  337. overflow: hidden;
  338. text-overflow: ellipsis;
  339. white-space: nowrap;
  340. }
  341. .closed-rec-card__dist {
  342. font-size: 12px;
  343. color: var(--text-secondary);
  344. flex-shrink: 0;
  345. }
  346. .closed-rec-card__rating {
  347. display: flex;
  348. align-items: center;
  349. flex-wrap: wrap;
  350. gap: 4px 6px;
  351. }
  352. .closed-rec-card__rating .closed-rec-stars {
  353. display: inline-flex;
  354. align-items: center;
  355. gap: 2px;
  356. }
  357. .closed-rec-card__rating .closed-rec-star {
  358. display: block;
  359. flex-shrink: 0;
  360. }
  361. .closed-rec-card__rating .closed-rec-rating-num {
  362. font-size: 12px;
  363. font-weight: 600;
  364. color: var(--orange);
  365. }
  366. .closed-rec-meta {
  367. font-size: 12px;
  368. color: var(--text-secondary);
  369. }
  370. .closed-rec-card__footer {
  371. margin-top: 8px;
  372. font-size: 12px;
  373. color: var(--text-secondary);
  374. overflow: hidden;
  375. text-overflow: ellipsis;
  376. white-space: nowrap;
  377. }
  378. .share-none {
  379. display: none;
  380. text-align: center;
  381. padding: 28px 20px 16px;
  382. color: var(--text-muted);
  383. font-size: 15px;
  384. line-height: 1.5;
  385. }
  386. .share-none img {
  387. width: 240px;
  388. height: 240px;
  389. margin-bottom: 12px;
  390. display: inline-block;
  391. }
  392. .share-none p {
  393. margin: 0;
  394. padding:0 0 60px 0;
  395. color:#999;
  396. }
  397. /* FAB */
  398. .fab-wrap {
  399. position: fixed;
  400. left: 0;
  401. right: 0;
  402. bottom: 0;
  403. z-index: 200;
  404. padding: 12px 24px calc(12px + var(--safe-bottom));
  405. background: linear-gradient(to top, rgba(255, 255, 255, 0.98) 70%, transparent);
  406. pointer-events: none;
  407. }
  408. .fab-dock__slot {
  409. width: 100%;
  410. max-width: 198px;
  411. height: 48px;
  412. margin: 0 auto;
  413. pointer-events: auto;
  414. }
  415. #openApp img {
  416. display: block;
  417. width: 100%;
  418. height: 48px;
  419. object-fit: contain;
  420. pointer-events: none;
  421. }
  422. /* 微信内:wx.config 成功后只显示开放标签按钮(官方用法) */
  423. #launch-btn {
  424. display: none;
  425. width: 100%;
  426. height: 48px;
  427. min-height: 48px;
  428. border-radius: 24px;
  429. overflow: hidden;
  430. opacity: 1;
  431. }
  432. body.is-wechat.wx-jssdk-ready.wx-open-tag-scene #launch-btn {
  433. display: block;
  434. }
  435. body.is-wechat.wx-jssdk-ready.wx-open-tag-scene #openApp {
  436. display: none !important;
  437. }
  438. .fab {
  439. display: flex;
  440. align-items: center;
  441. justify-content: center;
  442. gap: 10px;
  443. width: 100%;
  444. max-width: 198px;
  445. margin: 0 auto;
  446. height: 48px;
  447. border: none;
  448. border-radius: 24px;
  449. background: var(--orange);
  450. color: #fff;
  451. font-size: 16px;
  452. font-weight: 600;
  453. box-shadow: 0 4px 16px rgba(245, 130, 32, 0.45);
  454. cursor: pointer;
  455. background:#F47D1F;
  456. }
  457. .fab__logo {
  458. width: 28px;
  459. height: 28px;
  460. flex-shrink: 0;
  461. }
  462. .home-indicator {
  463. height: 5px;
  464. background: #000;
  465. border-radius: 3px;
  466. width: 134px;
  467. margin: 8px auto 4px;
  468. opacity: 0.2;
  469. }
  470. #openAppToast {
  471. display: none;
  472. position: fixed;
  473. left: 16px;
  474. right: 16px;
  475. bottom: calc(72px + var(--safe-bottom));
  476. z-index: 10001;
  477. padding: 10px 14px;
  478. font-size: 13px;
  479. line-height: 1.45;
  480. color: #fff;
  481. text-align: center;
  482. background: rgba(0, 0, 0, 0.78);
  483. border-radius: 8px;
  484. pointer-events: none;
  485. word-break: break-all;
  486. }
  487. #openApp {
  488. touch-action: manipulation;
  489. }
  490. /* 营销活动(getStoreCouponList.marketingList) */
  491. .marketing-section {
  492. padding: 4px 15px 20px;
  493. }
  494. .marketing-section__title {
  495. font-size: 16px;
  496. font-weight: 700;
  497. color: var(--text);
  498. margin: 0 0 12px;
  499. }
  500. .marketing-section__list {
  501. display: flex;
  502. flex-direction: column;
  503. gap: 12px;
  504. }
  505. .marketing-card {
  506. border-radius: 12px;
  507. overflow: hidden;
  508. background: #f0f0f0;
  509. box-shadow: 0 2px 12px rgba(0, 0, 0, 0.06);
  510. }
  511. .marketing-card__media img,
  512. .marketing-card__media video {
  513. width: 100%;
  514. display: block;
  515. aspect-ratio: 16 / 9;
  516. object-fit: cover;
  517. vertical-align: middle;
  518. }
  519. .marketing-card__media video {
  520. background: #000;
  521. }
  522. .marketing-card--more {
  523. display: none;
  524. }
  525. .marketing-section.is-expanded .marketing-card--more {
  526. display: block;
  527. }
  528. .marketing-section__more {
  529. display: flex;
  530. align-items: center;
  531. justify-content: center;
  532. gap: 4px;
  533. width: 100%;
  534. margin-top: 14px;
  535. padding: 8px 0;
  536. border: none;
  537. background: none;
  538. font-size: 14px;
  539. color: var(--text-secondary);
  540. cursor: pointer;
  541. -webkit-tap-highlight-color: transparent;
  542. }
  543. .marketing-section__more-chevron {
  544. width: 16px;
  545. height: 16px;
  546. flex-shrink: 0;
  547. transition: transform 0.2s ease;
  548. }
  549. .marketing-section.is-expanded .marketing-section__more-chevron {
  550. transform: rotate(180deg);
  551. }
  552. .marketing-section__empty {
  553. display: flex;
  554. flex-direction: column;
  555. justify-content: center;
  556. align-items: center;
  557. padding: 10px 0 8px;
  558. }
  559. .marketing-section__empty img {
  560. width: 200px;
  561. height: 200px;
  562. display: block;
  563. object-fit: contain;
  564. }
  565. .marketing-section__empty-label {
  566. margin: 12px 0 0;
  567. font-size: 14px;
  568. color: var(--text-secondary);
  569. text-align: center;
  570. }
  571. /* 演出安排 performance/list/query */
  572. .performance-section {
  573. padding: 8px 0 20px;
  574. border-top: 1px solid var(--border);
  575. margin-top: 4px;
  576. }
  577. .performance-section__title {
  578. font-size: 16px;
  579. font-weight: 700;
  580. color: var(--text);
  581. margin: 0 15px 12px;
  582. }
  583. .performance-strip {
  584. display: flex;
  585. flex-direction: row;
  586. flex-wrap: nowrap;
  587. gap: 12px;
  588. overflow-x: auto;
  589. overflow-y: hidden;
  590. padding: 0 15px 4px;
  591. -webkit-overflow-scrolling: touch;
  592. scrollbar-width: none;
  593. }
  594. .performance-strip::-webkit-scrollbar {
  595. display: none;
  596. }
  597. .performance-card {
  598. flex: 0 0 auto;
  599. display: flex;
  600. flex-direction: row;
  601. align-items: stretch;
  602. gap: 10px;
  603. width: 272px;
  604. min-width: 272px;
  605. padding: 0;
  606. background: #fff;
  607. border-radius: 12px;
  608. overflow: hidden;
  609. }
  610. .performance-card__poster {
  611. flex: 0 0 76px;
  612. width: 76px;
  613. min-height: 102px;
  614. background: #eee;
  615. align-self: stretch;
  616. }
  617. .performance-card__poster img {
  618. width: 100%;
  619. height: 100%;
  620. min-height: 102px;
  621. object-fit: cover;
  622. display: block;
  623. vertical-align: middle;
  624. }
  625. .performance-card__body {
  626. flex: 1;
  627. min-width: 0;
  628. display: flex;
  629. flex-direction: column;
  630. justify-content: center;
  631. gap: 4px;
  632. padding: 10px 12px 10px 0;
  633. }
  634. .performance-card__name {
  635. font-size: 15px;
  636. font-weight: 700;
  637. color: var(--text);
  638. line-height: 1.3;
  639. overflow: hidden;
  640. text-overflow: ellipsis;
  641. display: -webkit-box;
  642. -webkit-line-clamp: 2;
  643. -webkit-box-orient: vertical;
  644. }
  645. .performance-card__meta {
  646. font-size: 12px;
  647. color: var(--text-secondary);
  648. line-height: 1.35;
  649. overflow: hidden;
  650. text-overflow: ellipsis;
  651. white-space: nowrap;
  652. }
  653. /* 人员阵容 queryStaffListByTitle */
  654. .staff-section {
  655. padding: 8px 0 24px;
  656. border-top: 1px solid var(--border);
  657. margin-top: 4px;
  658. }
  659. .staff-section__head {
  660. display: flex;
  661. align-items: center;
  662. justify-content: space-between;
  663. gap: 12px;
  664. padding: 0 15px;
  665. margin-bottom: 12px;
  666. }
  667. .staff-section__page-title {
  668. font-size: 16px;
  669. font-weight: 700;
  670. color: var(--text);
  671. margin: 0;
  672. flex: 1;
  673. min-width: 0;
  674. }
  675. .staff-section__all {
  676. flex-shrink: 0;
  677. display: inline-flex;
  678. align-items: center;
  679. gap: 2px;
  680. font-size: 13px;
  681. color: #151515;
  682. text-decoration: none;
  683. background: none;
  684. border: none;
  685. padding: 0;
  686. cursor: pointer;
  687. -webkit-tap-highlight-color: transparent;
  688. }
  689. .staff-section__all-chevron {
  690. width: 14px;
  691. height: 14px;
  692. opacity: 0.7;
  693. }
  694. .staff-group {
  695. margin-bottom: 20px;
  696. }
  697. .staff-group:last-child {
  698. margin-bottom: 0;
  699. }
  700. .staff-strip {
  701. display: flex;
  702. flex-direction: row;
  703. flex-wrap: nowrap;
  704. gap: 10px;
  705. overflow-x: auto;
  706. overflow-y: hidden;
  707. padding: 0 15px 4px;
  708. -webkit-overflow-scrolling: touch;
  709. scrollbar-width: none;
  710. }
  711. .staff-strip::-webkit-scrollbar {
  712. display: none;
  713. }
  714. .staff-card {
  715. flex: 0 0 112px;
  716. width: 112px;
  717. min-width: 112px;
  718. }
  719. .staff-card__img-wrap {
  720. position: relative;
  721. border-radius: 10px;
  722. overflow: hidden;
  723. background: #eee;
  724. aspect-ratio: 3 / 4;
  725. }
  726. .staff-card__img-wrap img {
  727. width: 100%;
  728. height: 100%;
  729. object-fit: cover;
  730. display: block;
  731. vertical-align: middle;
  732. }
  733. .staff-card__likes {
  734. position: absolute;
  735. left: 0;
  736. right: 0;
  737. bottom: 0;
  738. padding: 6px 8px;
  739. font-size: 11px;
  740. color: #fff;
  741. line-height: 1.2;
  742. background: linear-gradient(to top, rgba(0, 0, 0, 0.65), transparent);
  743. }
  744. .staff-card__name-row {
  745. display: flex;
  746. align-items: center;
  747. gap: 4px;
  748. margin-top: 8px;
  749. min-width: 0;
  750. }
  751. .staff-card__name {
  752. font-size: 14px;
  753. font-weight: 700;
  754. color: var(--text);
  755. overflow: hidden;
  756. text-overflow: ellipsis;
  757. white-space: nowrap;
  758. flex: 1;
  759. min-width: 0;
  760. }
  761. .staff-card__badge {
  762. flex-shrink: 0;
  763. font-size: 10px;
  764. font-weight: 600;
  765. color: #fff;
  766. background: #ff9d4d;
  767. padding: 2px 5px;
  768. border-radius: 3px;
  769. line-height: 1.2;
  770. white-space: nowrap;
  771. }
  772. .staff-card__meta {
  773. display: flex;
  774. align-items: center;
  775. flex-wrap: wrap;
  776. gap: 0 4px;
  777. margin-top: 4px;
  778. font-size: 12px;
  779. color: var(--text-secondary);
  780. line-height: 1.35;
  781. }
  782. .staff-card__position {
  783. overflow: hidden;
  784. text-overflow: ellipsis;
  785. white-space: nowrap;
  786. max-width: 100%;
  787. }
  788. .staff-card__reviews {
  789. display: inline-flex;
  790. align-items: center;
  791. gap: 4px;
  792. }
  793. .staff-card__sep {
  794. color: #ddd;
  795. font-weight: 300;
  796. }
  797. </style>
  798. </head>
  799. <body>
  800. <div class="share-none" id="shareClosedBanner" aria-hidden="true">
  801. <img src="images/storeNone.png" alt="">
  802. <p>抱歉商户已关闭,看看别的吧</p>
  803. </div>
  804. <div class="closed-rec-wrap" id="shareClosedRecommendWrap" aria-hidden="true">
  805. <div class="closed-rec-divider"></div>
  806. <h3 class="closed-rec-title">更多推荐</h3>
  807. <div class="closed-rec-grid" id="shareClosedRecList">
  808. <p id="shareClosedRecEmpty" class="closed-rec-empty" style="display:none;">暂无推荐</p>
  809. </div>
  810. </div>
  811. <div class="share-content" id="shareContentEl">
  812. <div class="hero" id="hero">
  813. <div class="hero__track" id="heroTrack">
  814. <div class="hero__slide"><img id="heroFallbackImg" src="images/hero.png" alt="店铺图"></div>
  815. </div>
  816. <div class="hero__dots" id="heroDots" aria-hidden="true"></div>
  817. </div>
  818. <!-- 数据由 getClientStoreDetail(id,userId,jingdu,weidu)填充,见 renderDetail -->
  819. <section class="section" id="mainSection">
  820. <p id="pageError" class="page-error" style="display:none;color:#ff4d4f;padding:12px 0;font-size:14px;"></p>
  821. <h2 class="store-name" id="storeName">加载中…</h2>
  822. <div class="row rating-row">
  823. <div class="row" style="flex:1; justify-content:flex-start;">
  824. <span class="stars" aria-label="5.0 分">
  825. <svg class="star" viewBox="0 0 24 24" fill="currentColor"><path d="M12 2l3.09 6.26L22 9.27l-5 4.87 1.18 6.88L12 17.77l-6.18 3.25L7 14.14 2 9.27l6.91-1.01L12 2z"/></svg>
  826. <svg class="star" viewBox="0 0 24 24" fill="currentColor"><path d="M12 2l3.09 6.26L22 9.27l-5 4.87 1.18 6.88L12 17.77l-6.18 3.25L7 14.14 2 9.27l6.91-1.01L12 2z"/></svg>
  827. <svg class="star" viewBox="0 0 24 24" fill="currentColor"><path d="M12 2l3.09 6.26L22 9.27l-5 4.87 1.18 6.88L12 17.77l-6.18 3.25L7 14.14 2 9.27l6.91-1.01L12 2z"/></svg>
  828. <svg class="star" viewBox="0 0 24 24" fill="currentColor"><path d="M12 2l3.09 6.26L22 9.27l-5 4.87 1.18 6.88L12 17.77l-6.18 3.25L7 14.14 2 9.27l6.91-1.01L12 2z"/></svg>
  829. <svg class="star" viewBox="0 0 24 24" fill="currentColor"><path d="M12 2l3.09 6.26L22 9.27l-5 4.87 1.18 6.88L12 17.77l-6.18 3.25L7 14.14 2 9.27l6.91-1.01L12 2z"/></svg>
  830. </span>
  831. <span class="rating-num" id="scoreAvg">—</span>
  832. <span id="commitCount" style="font-size: 14px;">0</span>
  833. </div>
  834. <!-- <a href="#" class="link-muted"><span id="commitCount">0</span>条评价
  835. <svg class="chevron" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><polyline points="9 18 15 12 9 6"/></svg>
  836. </a> -->
  837. </div>
  838. <div class="store-evaluate-row" id="storeEvaluateRow" aria-hidden="true">
  839. <span class="store-evaluate__item">酒水:<span id="storeEvaluateScoreOne">—</span></span>
  840. <span class="store-evaluate__item">氛围:<span id="storeEvaluateScoreTwo">—</span></span>
  841. <span class="store-evaluate__item">服务:<span id="storeEvaluateScoreThree">—</span></span>
  842. </div>
  843. <div class="row hours-row">
  844. <div class="hours-left">
  845. <span class="status" id="bizStatus">—</span>
  846. <span class="hours-text" id="hoursText">—</span>
  847. </div>
  848. <a href="#" class="link-muted">详情
  849. <svg class="chevron" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><polyline points="9 18 15 12 9 6"/></svg>
  850. </a>
  851. </div>
  852. </section>
  853. <div class="loc-wrap">
  854. <div class="loc-main">
  855. <p class="addr" id="storeAddr">—</p>
  856. <div class="meta-line" id="metaDistance" style="display:none;">
  857. <svg width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="#999" stroke-width="2"><path d="M21 10c0 7-9 13-9 13s-9-6-9-13a9 9 0 0 1 18 0z"/><circle cx="12" cy="10" r="3"/></svg>
  858. <span id="distanceText">—</span>
  859. </div>
  860. <div class="meta-line" id="metaSubway" style="display:none;">
  861. <img src="images/iconn.png" alt="" width="12" height="12" decoding="async">
  862. <span id="subwayText">—</span>
  863. </div>
  864. </div>
  865. <div class="loc-actions">
  866. <button type="button" class="act-btn" aria-label="导航">
  867. <span class="act-btn__icon">
  868. <img src="images/loc1.png" alt="" width="22" height="22" decoding="async">
  869. </span>
  870. 导航
  871. </button>
  872. <button type="button" class="act-btn" aria-label="电话">
  873. <span class="act-btn__icon">
  874. <img src="images/loc2.png" alt="" width="22" height="22" decoding="async">
  875. </span>
  876. 电话
  877. </button>
  878. </div>
  879. </div>
  880. <section class="marketing-section" id="shareMarketingSection" style="display:none;" aria-hidden="true">
  881. <h3 class="marketing-section__title">营销活动</h3>
  882. <div class="marketing-section__list" id="marketingListEl"></div>
  883. <button type="button" class="marketing-section__more" id="marketingMoreBtn" style="display:none;">
  884. <span id="marketingMoreText"></span>
  885. <svg class="marketing-section__more-chevron" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" aria-hidden="true"><polyline points="6 9 12 15 18 9"/></svg>
  886. </button>
  887. </section>
  888. <section class="performance-section" id="sharePerformanceSection" style="display:none;" aria-hidden="true">
  889. <h3 class="performance-section__title" id="performanceSectionTitle">演出安排(0)</h3>
  890. <div class="performance-strip" id="performanceStripEl"></div>
  891. </section>
  892. <section class="staff-section" id="shareStaffSection" style="display:none;" aria-hidden="true">
  893. <div class="staff-section__head">
  894. <h3 class="staff-section__page-title">人员阵容(<span id="staffSectionCountEl">0</span>)</h3>
  895. <button type="button" class="staff-section__all" id="staffSectionAllBtn" aria-label="查看全部">
  896. 查看全部
  897. <svg class="staff-section__all-chevron" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" aria-hidden="true"><polyline points="9 6 15 12 9 18"/></svg>
  898. </button>
  899. </div>
  900. <div id="staffGroupsMount"></div>
  901. </section>
  902. </div>
  903. <div id="openAppToast" role="status" aria-live="polite"></div>
  904. <div id="fabDock" class="fab-wrap">
  905. <div class="fab-dock__slot">
  906. <!-- 非微信 / 微信 JSSDK 未就绪:scheme 唤起 -->
  907. <button type="button" class="fab" id="openApp">
  908. <img src="images/uBtn.png" alt="APP内打开" decoding="async">
  909. </button>
  910. <!-- 微信内 wx.config 成功后:仅此按钮可唤起 App(须用户直接点击) -->
  911. <wx-open-launch-app id="launch-btn" appid="wxf5f1efe3a9f5012e" extinfo="">
  912. <script type="text/wxtag-template">
  913. <style>
  914. .wx-open-app-btn {
  915. display: block;
  916. width: 100%;
  917. height: 48px;
  918. margin: 0;
  919. padding: 0;
  920. border: none;
  921. border-radius: 24px;
  922. background: #F47D1F;
  923. box-shadow: 0 4px 16px rgba(245, 130, 32, 0.45);
  924. cursor: pointer;
  925. overflow: hidden;
  926. -webkit-tap-highlight-color: transparent;
  927. }
  928. .wx-open-app-btn img {
  929. display: block;
  930. width: 100%;
  931. height: 48px;
  932. object-fit: contain;
  933. opacity: 1;
  934. pointer-events: none;
  935. -webkit-user-drag: none;
  936. }
  937. </style>
  938. <button class="wx-open-app-btn" aria-label="APP内打开">
  939. <img src="https://test.ailien.shop/h5/HBuilderProjects/images/uBtn.png" alt="APP内打开" width="198" height="48" />
  940. </button>
  941. </script>
  942. </wx-open-launch-app>
  943. </div>
  944. <div class="home-indicator" aria-hidden="true"></div>
  945. </div>
  946. <script src="https://res.wx.qq.com/open/js/jweixin-1.6.0.js"></script>
  947. <script>
  948. (function () {
  949. 'use strict';
  950. /**
  951. * 与 group_user sharePopup 复制链接时携带的 query 一致,例如:
  952. * ?id=436&storeId=436&userId=628&businessSection=3&lat=...&lon=...&jingdu=...&weidu=...&storeName=...&coverUrl=...&desc=...
  953. *
  954. * 进入页先 GET .../store/info/getOne?id=(与 shareDynamic.html 一致);data.businessStatus===99 时先展示关店区(#shareClosedBanner、#shareClosedRecommendWrap)。
  955. * 关店时点「APP内打开」:深链为 shopro://pages/index/login?…(与 group_user pages/index/login),不再进八区详情。
  956. * 店铺头图/名称/评分/地址等(#mainSection、.loc-wrap):GET .../store/info/getClientStoreDetail?id=&userId=&jingdu=&weidu=
  957. * 经纬度:URL 可用 jingdu/weidu;若无则用 lon/lng、lat(与分享链一致)
  958. * 营销活动: GET .../store/info/getStoreCouponList?storeId= → data.marketingList
  959. * 演出安排: GET .../performance/list/query?storeId=&page=&size= → data.records, data.total(仅 URL businessSection=2 时展示与请求)
  960. * 人员阵容: GET .../storeStaffConfig/queryStaffListByTitle?storeId= → data[]
  961. *
  962. * 注意:用 file:// 打开本页时,浏览器可能因 CORS 拦截跨域请求。
  963. * 请用本地 HTTP 打开(如 VS Code Live Server、npx serve)或让后端为 H5 域名配置 Access-Control-Allow-Origin。
  964. */
  965. var API_BASE = 'https://test.ailien.shop/alienStore';
  966. /**
  967. * 微信 JSSDK(服务号「麦丽恩严U店」)— 仅用于 wx.config 签名,Secret 只放后端
  968. * 后端 POST {API_BASE}/wx/getWxConfig,body 传 url(当前页完整地址)须用:AppID wx412792c77f47babd + 服务号 AppSecret
  969. *
  970. * 签名 url 官方要求(invalid signature 排查):
  971. * 1. 前端用 location.href.split('#')[0] 动态取当前页完整 URL(含 ? 参数,不含 #)
  972. * 2. 作为 body.url 传给后端签名
  973. * 3. wx.config 的 appId/timestamp/nonceStr/signature 须与后端生成签名时完全一致(nonceStr 驼峰)
  974. * 4. appId 须与后端取 jsapi_ticket 的公众号一致
  975. * 5. 分享进入时微信会附加 from、isappinstalled 等参数,必须参与签名,不可用静态写死 URL
  976. */
  977. var WECHAT_MP_APP_ID = 'wx412792c77f47babd';
  978. /** 微信开放标签 wx-open-launch-app — 移动应用「U店在哪」AppID(不是服务号 ID) */
  979. var WECHAT_OPEN_APP_ID = 'wxf5f1efe3a9f5012e';
  980. var WECHAT_GET_WX_CONFIG_PATH = '/wx/getWxConfig';
  981. /** 仅 file:// 或无法读取 location.href 时的联调兜底,微信内真实环境不应走到此处 */
  982. var H5_PAGE_BASE_FALLBACK = 'https://test.ailien.shop/h5/HBuilderProjects/';
  983. var WX_GET_CONFIG_SIGN_URL = H5_PAGE_BASE_FALLBACK + 'shareIndex.html';
  984. var WECHAT_JS_SAFE_HOSTS = ['uat.ailien.shop', 'test.ailien.shop'];
  985. var weChatJssdkConfigured = false;
  986. var wxConfigSignRetriedBaseUrl = false;
  987. var wxInitLastError = '';
  988. var wxJssdkInitPromise = null;
  989. /**
  990. * 关店(businessStatus=99)更多推荐:POST …/ai/multimodal-services/api/v1/search/global/store-recommend
  991. * 与 shareCheckInUndefined.html 一致;请求体 userCity/userLat/userLng 优先取 URL:userCity、lat、lon(兼认 userLat/userLng、weidu/jingdu 等)。
  992. */
  993. var API_LIFE_AI_BASE = 'http://183.252.196.135:9100';
  994. var STORE_GLOBAL_RECOMMEND_PATH =
  995. '/ai/multimodal-services/api/v1/search/global/store-recommend';
  996. /** 关店推荐用户位置:优先 URL 的 lat、lon、userCity;缺省再用大连默认值 */
  997. function getClosedRecommendUserLocation() {
  998. var latRaw = (q('lat') || q('userLat') || q('latitude') || q('weidu') || '').trim();
  999. var lonRaw = (q('lon') || q('userLng') || q('longitude') || q('lng') || q('jingdu') || '').trim();
  1000. var cityRaw = (q('userCity') || q('city') || '').trim();
  1001. return {
  1002. userLat:
  1003. latRaw !== '' && !isNaN(Number(latRaw)) ? Number(latRaw) : 38.925747,
  1004. userLng:
  1005. lonRaw !== '' && !isNaN(Number(lonRaw)) ? Number(lonRaw) : 121.662531,
  1006. userCity: cityRaw !== '' ? cityRaw : '大连市'
  1007. };
  1008. }
  1009. /**
  1010. * 与 group_user 一致:
  1011. * - manifest:app-plus.distribute.android.schemes、ios.urltypes → shopro(即 shopro://)
  1012. * - Android 包名:manifest 未写 packagename 时与 App.vue 升级配置 androidPackageName 一致(云打包以 HBuilderX 为准)
  1013. */
  1014. var APP_ANDROID_PACKAGE = 'com.alien.Udianzaizhe';
  1015. var APP_IOS_URL_SCHEME = 'shopro://';
  1016. /** businessSection 未传或其它值时的默认落地页(与 1 相同) */
  1017. var APP_UNI_STORE_PATH = 'pages/ieisureEntertainment/eightTypeList/delicacyDetails';
  1018. function showDownloadTip() {
  1019. var msg = '请到应用商店下载';
  1020. if (typeof uni !== 'undefined' && typeof uni.showToast === 'function') {
  1021. uni.showToast({ title: msg, icon: 'none', duration: 2500 });
  1022. } else {
  1023. window.alert(msg);
  1024. }
  1025. }
  1026. /** getClientStoreDetail 回填后用于补全 storeType / storeTypeName 等唤起参数 */
  1027. var appLaunchDetailCache = null;
  1028. /**
  1029. * 与 App 详情 onLoad 一致,例如:
  1030. * pages/ieisureEntertainment/eightTypeList/delicacyDetails?storeId=378&storeType=3&storeTypeName=特色美食&businessSection=1
  1031. */
  1032. function buildAppLaunchQueryParams() {
  1033. var raw = (location.search && location.search.charAt(0) === '?') ? location.search.slice(1) : (location.search || '');
  1034. var params = new URLSearchParams(raw);
  1035. var sid = params.get('storeId') || params.get('id') || '';
  1036. if (sid && !params.get('storeId')) params.set('storeId', sid);
  1037. if (!params.has('weidu') && params.has('lat')) params.set('weidu', params.get('lat'));
  1038. if (!params.has('jingdu')) {
  1039. var lonVal = params.get('lon') || params.get('lng');
  1040. if (lonVal) params.set('jingdu', lonVal);
  1041. }
  1042. var d = appLaunchDetailCache;
  1043. if (d && typeof d === 'object') {
  1044. if (!params.has('storeType') && d.storeType != null && String(d.storeType).trim() !== '') {
  1045. params.set('storeType', String(d.storeType).trim());
  1046. }
  1047. if (!params.has('storeTypeName')) {
  1048. var tn = d.storeTypeName != null ? d.storeTypeName : d.typeName;
  1049. if (tn != null && String(tn).trim() !== '') params.set('storeTypeName', String(tn).trim());
  1050. }
  1051. if (!params.has('businessSection') && d.businessSection != null && String(d.businessSection).trim() !== '') {
  1052. params.set('businessSection', String(d.businessSection).trim());
  1053. }
  1054. }
  1055. if (!params.has('businessSection')) {
  1056. var pathHint = getAppUniPathForBusinessSection();
  1057. if (pathHint.indexOf('barDetails') >= 0) params.set('businessSection', '2');
  1058. else if (pathHint.indexOf('lifeDetails') >= 0) params.set('businessSection', '3');
  1059. else if (pathHint.indexOf('delicacyDetails') >= 0) params.set('businessSection', '1');
  1060. }
  1061. return params;
  1062. }
  1063. function buildAppOpenQueryString() {
  1064. var qs = buildAppLaunchQueryParams().toString();
  1065. return qs ? ('?' + qs) : '';
  1066. }
  1067. /** Uni 路由串(无 shopro://),供 wx-open-launch-app extinfo 与 App plus.runtime.arguments 解析 */
  1068. function buildAppUniPageLaunchUrl() {
  1069. var path = getAppUniPathForBusinessSection().replace(/^\//, '');
  1070. var qs = buildAppLaunchQueryParams().toString();
  1071. return qs ? path + '?' + qs : path;
  1072. }
  1073. /**
  1074. * 按 URL 参数 businessSection 打开对应 App 页:
  1075. * 1 → delicacyDetails,2 → barDetails,3 → lifeDetails
  1076. * 关店 businessStatus=99 时进 pages/index/login(见 isClosedMerchantForAppOpen)。
  1077. */
  1078. function getAppUniPathForBusinessSection() {
  1079. if (isClosedMerchantForAppOpen()) {
  1080. return 'pages/index/login';
  1081. }
  1082. var bs = String(q('businessSection') || '').trim();
  1083. if (bs === '1') {
  1084. return 'pages/ieisureEntertainment/eightTypeList/delicacyDetails';
  1085. }
  1086. if (bs === '2') {
  1087. return 'pages/ieisureEntertainment/eightTypeList/barDetails';
  1088. }
  1089. if (bs === '3') {
  1090. return 'pages/ieisureEntertainment/eightTypeList/lifeDetails';
  1091. }
  1092. return String(APP_UNI_STORE_PATH || 'pages/ieisureEntertainment/eightTypeList/delicacyDetails').replace(/^\//, '');
  1093. }
  1094. function buildAppDeepLink() {
  1095. var path = getAppUniPathForBusinessSection().replace(/^\//, '');
  1096. var s = buildAppOpenQueryString();
  1097. var root = APP_IOS_URL_SCHEME.replace(/\/$/, '');
  1098. if (!s) return root + '/' + path;
  1099. return root + '/' + path + s;
  1100. }
  1101. function isWeChatInAppBrowser() {
  1102. return /MicroMessenger/i.test(navigator.userAgent || '');
  1103. }
  1104. function getWxShareEntryFrom() {
  1105. var from = readQueryParam('from');
  1106. return from ? String(from).trim().toLowerCase() : '';
  1107. }
  1108. function isWxOpenLaunchAppSceneSupported() {
  1109. if (!isWeChatInAppBrowser()) return false;
  1110. if (readQueryParam('wxOpenTag') === '1' || readQueryParam('wxForceOpenTag') === '1') {
  1111. return true;
  1112. }
  1113. var from = getWxShareEntryFrom();
  1114. return (
  1115. from === 'singlemessage' ||
  1116. from === 'groupmessage' ||
  1117. from === 'timeline'
  1118. );
  1119. }
  1120. function applyWxOpenLaunchSceneBodyClass() {
  1121. if (!isWeChatInAppBrowser()) return;
  1122. var ok = isWxOpenLaunchAppSceneSupported();
  1123. document.body.classList.toggle('wx-open-tag-scene', ok);
  1124. document.body.classList.toggle('wx-copy-link-entry', !ok);
  1125. }
  1126. function isIOSWeChatBrowser() {
  1127. var ua = navigator.userAgent || '';
  1128. return /MicroMessenger/i.test(ua) && /iPhone|iPad|iPod/i.test(ua);
  1129. }
  1130. function logWxEntryDiagnostics() {
  1131. if (!isWeChatInAppBrowser()) return;
  1132. console.log('[wx-entry]', {
  1133. entryFrom: getWxShareEntryFrom() || '(无,多为复制链接进入)',
  1134. openLaunchTagScene: isWxOpenLaunchAppSceneSupported(),
  1135. signUrl: getWxConfigSignUrl()
  1136. });
  1137. }
  1138. function showWxCopyLinkEntryTip() {
  1139. showFabToast(
  1140. '当前为复制链接进入,微信不支持直接打开 App。请使用 App「分享到微信」发送卡片后,点卡片进入。'
  1141. );
  1142. }
  1143. function readQueryParam(name) {
  1144. try {
  1145. var v = new URLSearchParams(location.search || '').get(name);
  1146. return v == null ? '' : String(v);
  1147. } catch (eQ) {
  1148. return '';
  1149. }
  1150. }
  1151. function isWxDebugOn() {
  1152. return readQueryParam('wxDebug') === '1';
  1153. }
  1154. /** PC 联调:测试域 / localhost 自动开启;也可显式 ?wxForce=1 */
  1155. function isWxForceDebug() {
  1156. return readQueryParam('wxForce') === '1';
  1157. }
  1158. function isWxConfigOnClickDebug() {
  1159. return readQueryParam('wxConfigOnClick') === '1';
  1160. }
  1161. function isWxPcAutoDebugHost() {
  1162. var h = (location.hostname || '').toLowerCase();
  1163. if (h === 'localhost' || h === '127.0.0.1') return true;
  1164. for (var i = 0; i < WECHAT_JS_SAFE_HOSTS.length; i++) {
  1165. if (WECHAT_JS_SAFE_HOSTS[i] === h) return true;
  1166. }
  1167. return false;
  1168. }
  1169. function isWxPcBrowser() {
  1170. return !isWeChatInAppBrowser();
  1171. }
  1172. function shouldInitWeChatJssdkOnLoad() {
  1173. if (isWeChatInAppBrowser()) return true;
  1174. return isWxForceDebug() || isWxPcAutoDebugHost();
  1175. }
  1176. function shouldFetchWxConfig(fromUserClick) {
  1177. if (isWeChatInAppBrowser()) return true;
  1178. if (fromUserClick) return true;
  1179. return isWxForceDebug() || isWxPcAutoDebugHost();
  1180. }
  1181. /**
  1182. * 教程 Step6:htmlUrl = location.href.split('#')[0]
  1183. * 浏览器访问的 url 与传给后端签名的 url 必须一致(含微信附加的 from 等参数)。
  1184. */
  1185. function getWxHtmlUrl() {
  1186. var forced = String(q('wxSignUrl') || '').trim();
  1187. if (forced) return forced.split('#')[0];
  1188. return String(location.href || '').split('#')[0];
  1189. }
  1190. function getWxSignPageUrlForApi() {
  1191. var htmlUrl = getWxHtmlUrl();
  1192. if (htmlUrl && /^https?:\/\//i.test(htmlUrl)) return htmlUrl;
  1193. return WX_GET_CONFIG_SIGN_URL;
  1194. }
  1195. function getWxSignUrlFull() {
  1196. return getWxSignPageUrlForApi();
  1197. }
  1198. /** 仅 pathname;后端若按无参 url 签名可 ?wxSignBaseOnly=1 */
  1199. function getWxHtmlUrlBase() {
  1200. var htmlUrl = getWxSignPageUrlForApi();
  1201. try {
  1202. var u = new URL(htmlUrl);
  1203. return u.origin + u.pathname;
  1204. } catch (eU) {
  1205. return WX_GET_CONFIG_SIGN_URL;
  1206. }
  1207. }
  1208. function getWxConfigSignUrl() {
  1209. if (String(q('wxSignBaseOnly') || '') === '1') return getWxHtmlUrlBase();
  1210. return getWxSignPageUrlForApi();
  1211. }
  1212. function getWxGetConfigApiUrl() {
  1213. return API_BASE.replace(/\/$/, '') + WECHAT_GET_WX_CONFIG_PATH;
  1214. }
  1215. function buildWxGetConfigRequestBody(htmlUrl) {
  1216. return {
  1217. url: String(htmlUrl || '').split('#')[0].trim()
  1218. };
  1219. }
  1220. function resolveWxConfigAppIdFromSignData(d) {
  1221. if (!d || typeof d !== 'object') return '';
  1222. var mp =
  1223. d.mpAppId ||
  1224. d.mpAppid ||
  1225. d.officialAppId ||
  1226. d.gzhAppId ||
  1227. d.serviceAppId;
  1228. if (mp != null && String(mp).trim() !== '') return String(mp).trim();
  1229. var fromQuery = String(q('wxMpAppId') || WECHAT_MP_APP_ID || '').trim();
  1230. if (fromQuery) return fromQuery;
  1231. var raw = d.appId || d.appid || d.wxAppId;
  1232. return raw != null && String(raw).trim() !== '' ? String(raw).trim() : '';
  1233. }
  1234. function normalizeWxJssdkSignPayload(res, signUrlUsed) {
  1235. if (!res || typeof res !== 'object') return null;
  1236. var d = res.data != null && typeof res.data === 'object' ? res.data : res;
  1237. if (!d || typeof d !== 'object') return null;
  1238. var appId = resolveWxConfigAppIdFromSignData(d);
  1239. var timestamp = d.timestamp != null ? d.timestamp : d.timeStamp;
  1240. /* 官方字段名为 nonceStr(S 大写),与 wx.config 保持一致 */
  1241. var nonceStr =
  1242. d.nonceStr != null && String(d.nonceStr) !== ''
  1243. ? d.nonceStr
  1244. : d.noncestr != null && String(d.noncestr) !== ''
  1245. ? d.noncestr
  1246. : d.nonce;
  1247. var signature = d.signature || d.sign;
  1248. if (!appId || timestamp == null || nonceStr == null || nonceStr === '' || !signature) {
  1249. return null;
  1250. }
  1251. var signedUrl = String(signUrlUsed || '')
  1252. .split('#')[0]
  1253. .trim();
  1254. return {
  1255. appId: String(appId),
  1256. timestamp: Number(timestamp),
  1257. nonceStr: String(nonceStr),
  1258. signature: String(signature),
  1259. signUrl: signedUrl
  1260. };
  1261. }
  1262. function getWxErrMsg(err) {
  1263. if (!err) return '';
  1264. if (err.errMsg) return String(err.errMsg);
  1265. if (typeof err === 'string') return err;
  1266. try {
  1267. return JSON.stringify(err);
  1268. } catch (e) {
  1269. return String(err);
  1270. }
  1271. }
  1272. function formatWxConfigErrorTip(err, signPageUrl) {
  1273. var errMsg = getWxErrMsg(err);
  1274. var tip = '微信 JSSDK 配置失败';
  1275. if (/invalid signature/i.test(errMsg)) {
  1276. return (
  1277. tip +
  1278. ':签名无效。请核对:①后端用与前端相同的 url 签名;②url=' +
  1279. (signPageUrl || getWxHtmlUrl()) +
  1280. ';③nonceStr/timestamp 与接口返回一致;④appId=' +
  1281. WECHAT_MP_APP_ID
  1282. );
  1283. }
  1284. if (/require\s*subscribe/i.test(errMsg)) {
  1285. return tip + ':' + errMsg + '(服务号需用户已关注)';
  1286. }
  1287. return errMsg ? tip + ':' + errMsg : tip;
  1288. }
  1289. /**
  1290. * wx-open-launch-app extinfo:U店在哪 App 按 Uni 页面路径解析(与详情页路由一致)。
  1291. * 例:pages/ieisureEntertainment/eightTypeList/delicacyDetails?storeId=378&storeType=3&storeTypeName=特色美食&businessSection=1
  1292. */
  1293. function buildWeChatLaunchExtinfo() {
  1294. var uniPage = buildAppUniPageLaunchUrl();
  1295. if (uniPage.length <= 1024) return uniPage;
  1296. var params = buildAppLaunchQueryParams();
  1297. var mini = new URLSearchParams();
  1298. var storeId = params.get('storeId') || params.get('id') || '';
  1299. if (storeId) mini.set('storeId', storeId);
  1300. var st = params.get('storeType');
  1301. if (st) mini.set('storeType', st);
  1302. var stn = params.get('storeTypeName');
  1303. if (stn) mini.set('storeTypeName', stn);
  1304. var bs = params.get('businessSection');
  1305. if (bs) mini.set('businessSection', bs);
  1306. var path = getAppUniPathForBusinessSection().replace(/^\//, '');
  1307. var shortPage = path + '?' + mini.toString();
  1308. if (shortPage.length <= 1024) return shortPage;
  1309. var deep = buildAppDeepLink();
  1310. return deep.length <= 1024 ? deep : shortPage.slice(0, 1024);
  1311. }
  1312. function setWxInitError(msg) {
  1313. wxInitLastError = String(msg || '').trim();
  1314. if (wxInitLastError) console.warn('[wx]', wxInitLastError);
  1315. }
  1316. /**
  1317. * 教程标准流程:
  1318. * htmlUrl = location.href.split('#')[0]
  1319. * POST getWxConfig,body: { url: htmlUrl }
  1320. * success → wx.config({ appId, timestamp, nonceStr, signature, ... })
  1321. * 不修改地址栏,保证「浏览器 url」与「签名 url」一致。
  1322. */
  1323. function requestWeChatJssdkSignAndConfig(htmlUrlOptional) {
  1324. var htmlUrl = String(
  1325. htmlUrlOptional != null ? htmlUrlOptional : getWxConfigSignUrl()
  1326. )
  1327. .split('#')[0]
  1328. .trim();
  1329. if (!htmlUrl || !/^https?:\/\//i.test(htmlUrl)) {
  1330. htmlUrl = WX_GET_CONFIG_SIGN_URL;
  1331. }
  1332. if (isWxDebugOn()) {
  1333. try {
  1334. window.alert('htmlUrl(签名用,应与地址栏一致):\n' + htmlUrl);
  1335. } catch (eDbg) {}
  1336. }
  1337. var requestUrl = getWxGetConfigApiUrl();
  1338. var requestBody = buildWxGetConfigRequestBody(htmlUrl);
  1339. console.log('[wx] htmlUrl=', htmlUrl);
  1340. console.log('[wx] POST getWxConfig →', requestUrl, requestBody);
  1341. return fetch(requestUrl, {
  1342. method: 'POST',
  1343. mode: 'cors',
  1344. credentials: 'omit',
  1345. headers: {
  1346. Accept: 'application/json',
  1347. 'Content-Type': 'application/json;charset=UTF-8'
  1348. },
  1349. body: JSON.stringify(requestBody)
  1350. })
  1351. .then(function (r) {
  1352. if (r.ok) return r.json();
  1353. return r
  1354. .text()
  1355. .catch(function () {
  1356. return '';
  1357. })
  1358. .then(function (text) {
  1359. var hint = '';
  1360. try {
  1361. var j = JSON.parse(text);
  1362. hint = j.msg || j.message || '';
  1363. } catch (eP) {
  1364. if (text) hint = text.slice(0, 120);
  1365. }
  1366. throw new Error('getWxConfig HTTP ' + r.status + (hint ? ':' + hint : ''));
  1367. });
  1368. })
  1369. .then(function (res) {
  1370. if (res && res.code != null) {
  1371. var c = Number(res.code);
  1372. if (c !== 200 && c !== 0 && res.success !== true) {
  1373. throw new Error(res.msg || res.message || 'getWxConfig code ' + c);
  1374. }
  1375. }
  1376. var sign = normalizeWxJssdkSignPayload(res, htmlUrl);
  1377. if (!sign) {
  1378. console.warn('[wx] getWxConfig 响应字段不全', res, 'htmlUrl=', htmlUrl);
  1379. throw new Error(
  1380. 'getWxConfig 缺少 appId/timestamp/nonceStr/signature(见控制台)'
  1381. );
  1382. }
  1383. if (sign.appId !== WECHAT_MP_APP_ID) {
  1384. console.warn(
  1385. '[wx] 后端 appId=' + sign.appId + ',期望服务号 ' + WECHAT_MP_APP_ID
  1386. );
  1387. }
  1388. if (typeof wx === 'undefined') {
  1389. if (isWxPcBrowser()) {
  1390. console.log('[wx] PC getWxConfig 成功(无 jweixin)', sign);
  1391. return true;
  1392. }
  1393. setWxInitError('jweixin.js 未加载');
  1394. return false;
  1395. }
  1396. return applyWxConfigFromSign(sign, htmlUrl);
  1397. });
  1398. }
  1399. function applyWxConfigFromSign(sign, htmlUrl) {
  1400. var wxConfigParams = {
  1401. debug: isWxDebugOn(),
  1402. appId: String(sign.appId),
  1403. timestamp: sign.timestamp,
  1404. nonceStr: String(sign.nonceStr),
  1405. signature: String(sign.signature),
  1406. jsApiList: [],
  1407. openTagList: ['wx-open-launch-app']
  1408. };
  1409. return new Promise(function (resolve) {
  1410. if (isWxDebugOn()) {
  1411. try {
  1412. window.alert(
  1413. 'htmlUrl:\n' +
  1414. htmlUrl +
  1415. '\n\nwx.config:\n' +
  1416. JSON.stringify(wxConfigParams, null, 2)
  1417. );
  1418. } catch (alertErr) {}
  1419. }
  1420. wx.config(wxConfigParams);
  1421. wx.ready(function () {
  1422. weChatJssdkConfigured = true;
  1423. document.body.classList.add('wx-jssdk-ready');
  1424. applyWxOpenLaunchSceneBodyClass();
  1425. if (isWxOpenLaunchAppSceneSupported()) {
  1426. refreshWxLaunchTagAttrs();
  1427. }
  1428. console.log('[wx.config] ready, htmlUrl=', htmlUrl);
  1429. resolve(true);
  1430. });
  1431. wx.error(function (err) {
  1432. weChatJssdkConfigured = false;
  1433. document.body.classList.remove('wx-jssdk-ready');
  1434. wxJssdkInitPromise = null;
  1435. var errMsg = getWxErrMsg(err);
  1436. setWxInitError(formatWxConfigErrorTip(err, htmlUrl));
  1437. if (isWxDebugOn()) window.alert(wxInitLastError);
  1438. console.warn('[wx.config]', errMsg, 'htmlUrl=', htmlUrl);
  1439. var baseUrl = getWxHtmlUrlBase();
  1440. var fullUrl = getWxSignPageUrlForApi();
  1441. if (
  1442. !/invalid signature/i.test(errMsg) ||
  1443. wxConfigSignRetriedBaseUrl ||
  1444. baseUrl === fullUrl ||
  1445. htmlUrl === baseUrl
  1446. ) {
  1447. resolve(false);
  1448. return;
  1449. }
  1450. wxConfigSignRetriedBaseUrl = true;
  1451. requestWeChatJssdkSignAndConfig(baseUrl).then(resolve);
  1452. });
  1453. });
  1454. }
  1455. function refreshWxLaunchTagAttrs() {
  1456. var tag = document.getElementById('launch-btn');
  1457. if (!tag) return;
  1458. try {
  1459. tag.setAttribute('appid', WECHAT_OPEN_APP_ID);
  1460. tag.setAttribute('extinfo', buildWeChatLaunchExtinfo());
  1461. } catch (eA) {}
  1462. }
  1463. function bindWeChatLaunchTagEvents() {
  1464. var tag = document.getElementById('launch-btn');
  1465. if (!tag || tag._wxLaunchBound) return;
  1466. tag._wxLaunchBound = true;
  1467. refreshWxLaunchTagAttrs();
  1468. tag.addEventListener('launch', function () {
  1469. console.log('[wx-open-launch-app] launch ok');
  1470. // showFabToast('正在打开 U店在哪…');
  1471. });
  1472. tag.addEventListener('error', function (e) {
  1473. var detail = e && e.detail;
  1474. var errMsg =
  1475. detail && detail.errMsg
  1476. ? String(detail.errMsg)
  1477. : detail && detail.errmsg
  1478. ? String(detail.errmsg)
  1479. : '';
  1480. console.warn('[wx-open-launch-app]', detail);
  1481. showAppOpenFailTip(
  1482. '请确复制链接进入U店在哪'
  1483. );
  1484. });
  1485. }
  1486. function initWeChatOpenLaunchApp(fromUserClick) {
  1487. if (!shouldFetchWxConfig(!!fromUserClick)) {
  1488. console.log('[wx] 未调用 getWxConfig');
  1489. return Promise.resolve(false);
  1490. }
  1491. if (isWxPcBrowser()) {
  1492. console.warn(
  1493. '[wx] PC:请求 getWxConfig' + (fromUserClick ? '(按钮)' : '(进页)')
  1494. );
  1495. }
  1496. if (wxJssdkInitPromise && !fromUserClick) return wxJssdkInitPromise;
  1497. wxConfigSignRetriedBaseUrl = false;
  1498. wxInitLastError = '';
  1499. var htmlUrl = getWxConfigSignUrl();
  1500. bindWeChatLaunchTagEvents();
  1501. wxJssdkInitPromise = requestWeChatJssdkSignAndConfig(htmlUrl)
  1502. .then(function (ok) {
  1503. if (ok === true) return true;
  1504. if (!wxInitLastError) {
  1505. setWxInitError('wx.config 失败,可加 ?wxDebug=1 查看 htmlUrl');
  1506. }
  1507. return false;
  1508. })
  1509. .catch(function (e) {
  1510. var msg = e && e.message ? e.message : 'getWxConfig 请求失败';
  1511. setWxInitError(msg);
  1512. console.warn('[wx] requestWeChatJssdkSignAndConfig failed', msg, 'htmlUrl=', htmlUrl);
  1513. if (isWeChatInAppBrowser() && isWxDebugOn()) window.alert(msg);
  1514. return false;
  1515. })
  1516. .finally(function () {
  1517. if (!weChatJssdkConfigured) wxJssdkInitPromise = null;
  1518. });
  1519. return wxJssdkInitPromise;
  1520. }
  1521. /** 进页即尝试拉签名;jweixin 晚到时自动重试 */
  1522. function scheduleWeChatJssdkBootstrap() {
  1523. if (!shouldInitWeChatJssdkOnLoad()) return;
  1524. var attempts = 0;
  1525. function tick() {
  1526. attempts += 1;
  1527. if (weChatJssdkConfigured) return;
  1528. initWeChatOpenLaunchApp();
  1529. if (!weChatJssdkConfigured && attempts < 8 && typeof wx === 'undefined') {
  1530. setTimeout(tick, 400);
  1531. }
  1532. }
  1533. if (isIOSWeChatBrowser()) {
  1534. setTimeout(tick, 350);
  1535. } else {
  1536. tick();
  1537. }
  1538. }
  1539. function showFabToast(msg, ms) {
  1540. var tip = String(msg || '').trim();
  1541. if (!tip) return;
  1542. var el = document.getElementById('openAppToast');
  1543. if (el) {
  1544. el.textContent = tip;
  1545. el.style.display = 'block';
  1546. if (showFabToast._t) clearTimeout(showFabToast._t);
  1547. showFabToast._t = setTimeout(function () {
  1548. el.style.display = 'none';
  1549. }, ms || 2800);
  1550. }
  1551. console.log('[openApp]', tip);
  1552. }
  1553. function showAppOpenFailTip(msg) {
  1554. var tip = msg || '未能打开 App,请确认已安装最新版「U店在哪」。';
  1555. if (typeof uni !== 'undefined' && typeof uni.showToast === 'function') {
  1556. uni.showToast({ title: tip, icon: 'none', duration: 2800 });
  1557. } else if (isWeChatInAppBrowser()) {
  1558. window.alert(tip);
  1559. } else {
  1560. console.warn('[openApp]', tip);
  1561. }
  1562. }
  1563. /** 部分 WebView 对 location.href 拦截,用 a 标签点击略稳 */
  1564. function launchAppDeepLink(deepLink) {
  1565. try {
  1566. var a = document.createElement('a');
  1567. a.href = deepLink;
  1568. a.setAttribute('target', '_self');
  1569. document.body.appendChild(a);
  1570. a.click();
  1571. document.body.removeChild(a);
  1572. } catch (e1) {}
  1573. try {
  1574. window.location.href = deepLink;
  1575. } catch (e2) {}
  1576. }
  1577. /**
  1578. * 有 plus:检测 App 是否安装后 openURL;深链形如 shopro://{APP_UNI_STORE_PATH}?…
  1579. * 系统浏览器:唤起 scheme;微信内常拦截 scheme,需「在浏览器打开」。
  1580. */
  1581. function tryFetchWxConfigOnPcClick() {
  1582. if (!isWxPcBrowser()) return Promise.resolve(false);
  1583. showFabToast('正在请求 getWxConfig…');
  1584. wxJssdkInitPromise = null;
  1585. return initWeChatOpenLaunchApp(true).then(function (ok) {
  1586. if (ok) {
  1587. showFabToast(
  1588. weChatJssdkConfigured
  1589. ? 'getWxConfig 成功,wx.config 已就绪'
  1590. : 'getWxConfig 成功'
  1591. );
  1592. } else {
  1593. showFabToast(wxInitLastError || 'getWxConfig 失败');
  1594. }
  1595. return ok;
  1596. });
  1597. }
  1598. function tryOpenHBuilderApp() {
  1599. /* 微信内须直接点击 wx-open-launch-app,scheme 会被拦截 */
  1600. if (isWeChatInAppBrowser()) return;
  1601. tryFetchWxConfigOnPcClick().then(function () {
  1602. if (isWxConfigOnClickDebug() && !isWxForceDebug() && !isWxPcAutoDebugHost()) {
  1603. return;
  1604. }
  1605. tryOpenHBuilderAppViaScheme();
  1606. });
  1607. }
  1608. function tryOpenHBuilderAppViaScheme() {
  1609. // showFabToast('正在打开 U店在哪…');
  1610. var deepLink = buildAppDeepLink();
  1611. if (typeof plus !== 'undefined' && plus.runtime) {
  1612. var installed = null;
  1613. try {
  1614. if (typeof plus.runtime.isApplicationExist === 'function') {
  1615. installed = plus.runtime.isApplicationExist({
  1616. pname: APP_ANDROID_PACKAGE,
  1617. action: APP_IOS_URL_SCHEME
  1618. });
  1619. }
  1620. } catch (e) {
  1621. console.warn(e);
  1622. }
  1623. if (installed === false) {
  1624. showDownloadTip();
  1625. return;
  1626. }
  1627. try {
  1628. plus.runtime.openURL(deepLink);
  1629. } catch (e2) {
  1630. console.warn(e2);
  1631. showDownloadTip();
  1632. }
  1633. return;
  1634. }
  1635. var t0 = Date.now();
  1636. var done = false;
  1637. function finish() {
  1638. if (done) return;
  1639. done = true;
  1640. document.removeEventListener('visibilitychange', onVis);
  1641. window.removeEventListener('pagehide', onHide);
  1642. }
  1643. function onVis() {
  1644. if (document.visibilityState === 'hidden') finish();
  1645. }
  1646. function onHide() {
  1647. finish();
  1648. }
  1649. document.addEventListener('visibilitychange', onVis);
  1650. window.addEventListener('pagehide', onHide);
  1651. try {
  1652. launchAppDeepLink(deepLink);
  1653. } catch (e3) {
  1654. finish();
  1655. showDownloadTip();
  1656. return;
  1657. }
  1658. window.setTimeout(function () {
  1659. finish();
  1660. }, 2600);
  1661. }
  1662. function qs() {
  1663. return new URLSearchParams(location.search || '');
  1664. }
  1665. function q(name) {
  1666. var v = qs().get(name);
  1667. return v == null ? '' : String(v);
  1668. }
  1669. function showErr(msg) {
  1670. var el = document.getElementById('pageError');
  1671. el.textContent = msg;
  1672. el.style.display = 'block';
  1673. }
  1674. function getStoreId() {
  1675. return q('id') || q('storeId');
  1676. }
  1677. function shouldShowPerformanceSection() {
  1678. return String(q('businessSection') || '').trim() === '2';
  1679. }
  1680. function apiFetch(path) {
  1681. return fetch(API_BASE + path, {
  1682. method: 'GET',
  1683. mode: 'cors',
  1684. credentials: 'omit',
  1685. headers: { Accept: 'application/json' }
  1686. }).then(function (res) {
  1687. if (!res.ok) throw new Error('HTTP ' + res.status);
  1688. return res.json();
  1689. });
  1690. }
  1691. /** 进入页先拉店铺概要;与 shareDynamic.html fetchGetDeleteFlagByIdIfId 相同路径与 id 参数 */
  1692. function fetchStoreInfoGetOne(storeId) {
  1693. if (!storeId) return Promise.resolve(null);
  1694. var qs = new URLSearchParams();
  1695. qs.set('id', String(storeId).trim());
  1696. return apiFetch('/store/info/getOne?' + qs.toString()).catch(function (e) {
  1697. console.warn('[store/info/getOne]', e);
  1698. return null;
  1699. });
  1700. }
  1701. function isGetOneBusinessStatus99(res) {
  1702. if (!res || typeof res !== 'object') return false;
  1703. var d = res.data;
  1704. if (d && typeof d === 'object') {
  1705. var bs = d.businessStatus;
  1706. if (bs === 99 || bs === '99' || Number(bs) === 99) return true;
  1707. }
  1708. return false;
  1709. }
  1710. var MARKETING_PREVIEW_COUNT = 3;
  1711. var closedMerchantFlag = false;
  1712. /** 关店 businessStatus=99:getOne 已置 closedMerchantFlag,或 URL 带 businessStatus=99;唤起 App 时进登录页 */
  1713. function isClosedMerchantForAppOpen() {
  1714. if (closedMerchantFlag) return true;
  1715. var bs = String(q('businessStatus') || '').trim();
  1716. if (bs === '99' || Number(bs) === 99) return true;
  1717. return false;
  1718. }
  1719. var marketingListCache = [];
  1720. /** 避免详情先返回时用空 cache 误展示「暂无活动」图 */
  1721. var marketingCouponLoaded = false;
  1722. var staffGroupsCache = [];
  1723. var performanceListCache = { records: [], total: 0 };
  1724. function isMp4VideoUrl(url) {
  1725. if (!url || typeof url !== 'string') return false;
  1726. var path = url.split(/[?#]/)[0].toLowerCase();
  1727. return path.length >= 4 && path.slice(-4) === '.mp4';
  1728. }
  1729. function getMp4PlaybackUrl(url) {
  1730. var u = String(url || '').trim();
  1731. if (!u) return '';
  1732. var q = u.indexOf('?');
  1733. var h = u.indexOf('#');
  1734. var cut = u.length;
  1735. if (q >= 0) cut = Math.min(cut, q);
  1736. if (h >= 0) cut = Math.min(cut, h);
  1737. var base = u.slice(0, cut);
  1738. if (/\.mp4$/i.test(base)) return base;
  1739. return u;
  1740. }
  1741. function mp4UrlToJpgUrl(u) {
  1742. var q = u.indexOf('?');
  1743. var h = u.indexOf('#');
  1744. var cut = u.length;
  1745. if (q >= 0) cut = Math.min(cut, q);
  1746. if (h >= 0) cut = Math.min(cut, h);
  1747. var pathPart = u.slice(0, cut);
  1748. var rest = u.slice(cut);
  1749. if (!/\.mp4$/i.test(pathPart)) return '';
  1750. return pathPart.slice(0, -4) + '.jpg' + rest;
  1751. }
  1752. function createMarketingMedia(url) {
  1753. var wrap = document.createElement('div');
  1754. wrap.className = 'marketing-card__media';
  1755. var full = String(url == null ? '' : url).trim();
  1756. if (!full) return wrap;
  1757. if (isMp4VideoUrl(full)) {
  1758. var playUrl = getMp4PlaybackUrl(full);
  1759. var vid = document.createElement('video');
  1760. vid.src = playUrl;
  1761. vid.setAttribute('controls', '');
  1762. vid.setAttribute('playsinline', '');
  1763. vid.setAttribute('webkit-playsinline', '');
  1764. vid.muted = true;
  1765. vid.setAttribute('muted', '');
  1766. vid.setAttribute('autoplay', '');
  1767. vid.preload = 'auto';
  1768. var poster = '';
  1769. if (full.length > playUrl.length) poster = full;
  1770. else poster = mp4UrlToJpgUrl(playUrl);
  1771. if (poster) vid.setAttribute('poster', poster);
  1772. vid.addEventListener('canplay', function onCap() {
  1773. vid.removeEventListener('canplay', onCap);
  1774. var p = vid.play();
  1775. if (p && typeof p.catch === 'function') p.catch(function () {});
  1776. });
  1777. wrap.appendChild(vid);
  1778. } else {
  1779. var img = document.createElement('img');
  1780. img.src = full;
  1781. img.alt = '';
  1782. img.decoding = 'async';
  1783. wrap.appendChild(img);
  1784. }
  1785. return wrap;
  1786. }
  1787. function renderMarketingList(rawList) {
  1788. marketingListCache = Array.isArray(rawList) ? rawList.slice() : [];
  1789. var section = document.getElementById('shareMarketingSection');
  1790. var listEl = document.getElementById('marketingListEl');
  1791. var moreBtn = document.getElementById('marketingMoreBtn');
  1792. var moreText = document.getElementById('marketingMoreText');
  1793. if (!section || !listEl) return;
  1794. listEl.innerHTML = '';
  1795. section.classList.remove('is-expanded');
  1796. if (moreBtn) {
  1797. moreBtn.style.display = 'none';
  1798. moreBtn.setAttribute('aria-expanded', 'false');
  1799. }
  1800. if (closedMerchantFlag) {
  1801. section.style.display = 'none';
  1802. section.setAttribute('aria-hidden', 'true');
  1803. return;
  1804. }
  1805. var items = marketingListCache.filter(function (x) {
  1806. return x && x.imgUrl && String(x.imgUrl).trim();
  1807. }).filter(function (x) {
  1808. var t = x.activityType;
  1809. if (t == null || t === '') return true;
  1810. return String(t).toUpperCase() === 'MARKETING';
  1811. });
  1812. items.sort(function (a, b) {
  1813. var sa = Number(a.imgSort);
  1814. var sb = Number(b.imgSort);
  1815. if (isNaN(sa)) sa = 0;
  1816. if (isNaN(sb)) sb = 0;
  1817. return sa - sb;
  1818. });
  1819. if (!items.length) {
  1820. if (!marketingCouponLoaded) {
  1821. section.style.display = 'none';
  1822. section.setAttribute('aria-hidden', 'true');
  1823. return;
  1824. }
  1825. section.style.display = 'block';
  1826. section.setAttribute('aria-hidden', 'false');
  1827. var emptyWrap = document.createElement('div');
  1828. emptyWrap.className = 'marketing-section__empty';
  1829. emptyWrap.setAttribute('role', 'status');
  1830. var emptyImg = document.createElement('img');
  1831. emptyImg.src = 'images/empty.png';
  1832. emptyImg.alt = '';
  1833. emptyImg.decoding = 'async';
  1834. var emptyLabel = document.createElement('p');
  1835. emptyLabel.className = 'marketing-section__empty-label';
  1836. emptyLabel.textContent = '暂无活动';
  1837. emptyWrap.appendChild(emptyImg);
  1838. emptyWrap.appendChild(emptyLabel);
  1839. listEl.appendChild(emptyWrap);
  1840. return;
  1841. }
  1842. section.style.display = 'block';
  1843. section.setAttribute('aria-hidden', 'false');
  1844. items.forEach(function (item, idx) {
  1845. var card = document.createElement('article');
  1846. card.className = 'marketing-card';
  1847. if (idx >= MARKETING_PREVIEW_COUNT) card.classList.add('marketing-card--more');
  1848. card.appendChild(createMarketingMedia(item.imgUrl));
  1849. listEl.appendChild(card);
  1850. });
  1851. var extra = items.length - MARKETING_PREVIEW_COUNT;
  1852. if (extra > 0 && moreBtn && moreText) {
  1853. moreText.textContent = '查看剩余' + extra + '个活动';
  1854. moreBtn.style.display = 'flex';
  1855. }
  1856. }
  1857. function bindMarketingMore() {
  1858. var section = document.getElementById('shareMarketingSection');
  1859. var moreBtn = document.getElementById('marketingMoreBtn');
  1860. if (!section || !moreBtn || moreBtn.dataset.bound) return;
  1861. moreBtn.dataset.bound = '1';
  1862. moreBtn.addEventListener('click', function () {
  1863. section.classList.add('is-expanded');
  1864. moreBtn.style.display = 'none';
  1865. moreBtn.setAttribute('aria-expanded', 'true');
  1866. });
  1867. }
  1868. function createStaffCardElement(staff) {
  1869. var card = document.createElement('article');
  1870. card.className = 'staff-card';
  1871. var imgWrap = document.createElement('div');
  1872. imgWrap.className = 'staff-card__img-wrap';
  1873. var imgUrl = String(staff.staffImage || '').trim();
  1874. if (imgUrl) {
  1875. var img = document.createElement('img');
  1876. img.src = imgUrl;
  1877. img.alt = String(staff.name || '');
  1878. img.decoding = 'async';
  1879. img.loading = 'lazy';
  1880. imgWrap.appendChild(img);
  1881. }
  1882. var likes = document.createElement('div');
  1883. likes.className = 'staff-card__likes';
  1884. var lc = staff.likeCount != null ? Number(staff.likeCount) : 0;
  1885. if (isNaN(lc)) lc = 0;
  1886. likes.textContent = lc + '人喜欢';
  1887. imgWrap.appendChild(likes);
  1888. var nameRow = document.createElement('div');
  1889. nameRow.className = 'staff-card__name-row';
  1890. var nameEl = document.createElement('span');
  1891. nameEl.className = 'staff-card__name';
  1892. nameEl.textContent = String(staff.name != null ? staff.name : '').trim() || '—';
  1893. nameRow.appendChild(nameEl);
  1894. var perf = staff.hasPerformanceToday;
  1895. if (perf === true || perf === 1 || String(perf).toLowerCase() === 'true') {
  1896. var badge = document.createElement('span');
  1897. badge.className = 'staff-card__badge';
  1898. badge.textContent = '今日演出';
  1899. nameRow.appendChild(badge);
  1900. }
  1901. card.appendChild(imgWrap);
  1902. card.appendChild(nameRow);
  1903. var meta = document.createElement('div');
  1904. meta.className = 'staff-card__meta';
  1905. var pos = document.createElement('span');
  1906. pos.className = 'staff-card__position';
  1907. pos.textContent = String(staff.staffPosition || '').trim() || '\u00a0';
  1908. meta.appendChild(pos);
  1909. var pc = staff.positiveCommentsCount != null ? Number(staff.positiveCommentsCount) : 0;
  1910. if (!isNaN(pc) && pc > 0) {
  1911. var sep = document.createElement('span');
  1912. sep.className = 'staff-card__sep';
  1913. sep.textContent = '|';
  1914. var rev = document.createElement('span');
  1915. rev.className = 'staff-card__reviews';
  1916. rev.textContent = '好评' + pc + '次';
  1917. meta.appendChild(sep);
  1918. meta.appendChild(rev);
  1919. }
  1920. card.appendChild(meta);
  1921. return card;
  1922. }
  1923. function createPerformanceCardElement(row) {
  1924. var card = document.createElement('article');
  1925. card.className = 'performance-card';
  1926. var posterWrap = document.createElement('div');
  1927. posterWrap.className = 'performance-card__poster';
  1928. var posterUrl = String(row.performancePoster || '').trim();
  1929. if (posterUrl) {
  1930. var img = document.createElement('img');
  1931. img.src = posterUrl;
  1932. img.alt = String(row.performanceName || '');
  1933. img.decoding = 'async';
  1934. img.loading = 'lazy';
  1935. posterWrap.appendChild(img);
  1936. }
  1937. var body = document.createElement('div');
  1938. body.className = 'performance-card__body';
  1939. var nameEl = document.createElement('div');
  1940. nameEl.className = 'performance-card__name';
  1941. nameEl.textContent = String(row.performanceName != null ? row.performanceName : '').trim() || '—';
  1942. body.appendChild(nameEl);
  1943. var dr = String(row.dateRange || '').trim();
  1944. if (dr) {
  1945. var line1 = document.createElement('div');
  1946. line1.className = 'performance-card__meta';
  1947. line1.textContent = dr;
  1948. body.appendChild(line1);
  1949. }
  1950. var si = String(row.scheduleInfo || '').trim();
  1951. if (si) {
  1952. var line2 = document.createElement('div');
  1953. line2.className = 'performance-card__meta';
  1954. line2.textContent = si;
  1955. line2.title = si;
  1956. body.appendChild(line2);
  1957. }
  1958. card.appendChild(posterWrap);
  1959. card.appendChild(body);
  1960. return card;
  1961. }
  1962. function renderPerformanceList() {
  1963. var section = document.getElementById('sharePerformanceSection');
  1964. var titleEl = document.getElementById('performanceSectionTitle');
  1965. var strip = document.getElementById('performanceStripEl');
  1966. if (!section || !titleEl || !strip) return;
  1967. strip.innerHTML = '';
  1968. if (!shouldShowPerformanceSection()) {
  1969. section.style.display = 'none';
  1970. section.setAttribute('aria-hidden', 'true');
  1971. return;
  1972. }
  1973. if (closedMerchantFlag) {
  1974. section.style.display = 'none';
  1975. section.setAttribute('aria-hidden', 'true');
  1976. return;
  1977. }
  1978. var records = performanceListCache.records;
  1979. var total = performanceListCache.total;
  1980. if (isNaN(total)) total = records.length;
  1981. titleEl.textContent = '演出安排(' + total + ')';
  1982. if (!records.length) {
  1983. section.style.display = 'none';
  1984. section.setAttribute('aria-hidden', 'true');
  1985. return;
  1986. }
  1987. section.style.display = 'block';
  1988. section.setAttribute('aria-hidden', 'false');
  1989. records.forEach(function (row) {
  1990. if (!row) return;
  1991. strip.appendChild(createPerformanceCardElement(row));
  1992. });
  1993. }
  1994. function renderStaffGroups(raw) {
  1995. staffGroupsCache = Array.isArray(raw) ? raw.slice() : [];
  1996. var section = document.getElementById('shareStaffSection');
  1997. var mount = document.getElementById('staffGroupsMount');
  1998. if (!section || !mount) return;
  1999. var totalStaff = 0;
  2000. staffGroupsCache.forEach(function (g) {
  2001. if (g && Array.isArray(g.staffList)) totalStaff += g.staffList.length;
  2002. });
  2003. var countEl = document.getElementById('staffSectionCountEl');
  2004. if (countEl) countEl.textContent = String(totalStaff);
  2005. mount.innerHTML = '';
  2006. if (closedMerchantFlag) {
  2007. section.style.display = 'none';
  2008. section.setAttribute('aria-hidden', 'true');
  2009. return;
  2010. }
  2011. var groups = staffGroupsCache.filter(function (g) {
  2012. return g && Array.isArray(g.staffList) && g.staffList.length;
  2013. });
  2014. if (!groups.length) {
  2015. section.style.display = 'none';
  2016. section.setAttribute('aria-hidden', 'true');
  2017. return;
  2018. }
  2019. section.style.display = 'block';
  2020. section.setAttribute('aria-hidden', 'false');
  2021. groups.forEach(function (group) {
  2022. var wrap = document.createElement('div');
  2023. wrap.className = 'staff-group';
  2024. if (group.titleId != null) wrap.dataset.titleId = String(group.titleId);
  2025. var strip = document.createElement('div');
  2026. strip.className = 'staff-strip';
  2027. group.staffList.forEach(function (staff) {
  2028. if (!staff) return;
  2029. strip.appendChild(createStaffCardElement(staff));
  2030. });
  2031. wrap.appendChild(strip);
  2032. mount.appendChild(wrap);
  2033. });
  2034. }
  2035. function bindStaffSection() {
  2036. var btn = document.getElementById('staffSectionAllBtn');
  2037. if (!btn || btn.dataset.bound) return;
  2038. btn.dataset.bound = '1';
  2039. btn.addEventListener('click', function (e) {
  2040. e.preventDefault();
  2041. tryOpenHBuilderApp();
  2042. });
  2043. }
  2044. function buildHeroSlides(urls) {
  2045. var track = document.getElementById('heroTrack');
  2046. var dotsWrap = document.getElementById('heroDots');
  2047. track.innerHTML = '';
  2048. dotsWrap.innerHTML = '';
  2049. var list = (urls || []).filter(Boolean);
  2050. if (!list.length) {
  2051. var slide = document.createElement('div');
  2052. slide.className = 'hero__slide';
  2053. var img = document.createElement('img');
  2054. img.src = 'images/hero.png';
  2055. img.alt = '店铺';
  2056. slide.appendChild(img);
  2057. track.appendChild(slide);
  2058. var dot = document.createElement('span');
  2059. dot.className = 'hero__dot is-active';
  2060. dotsWrap.appendChild(dot);
  2061. return initHeroCarousel(1);
  2062. }
  2063. list.forEach(function (url, d) {
  2064. var slide = document.createElement('div');
  2065. slide.className = 'hero__slide';
  2066. var img = document.createElement('img');
  2067. img.src = url;
  2068. img.alt = '店铺图';
  2069. slide.appendChild(img);
  2070. track.appendChild(slide);
  2071. var dot = document.createElement('span');
  2072. dot.className = 'hero__dot' + (d === 0 ? ' is-active' : '');
  2073. dotsWrap.appendChild(dot);
  2074. });
  2075. initHeroCarousel(list.length);
  2076. }
  2077. var heroI = 0;
  2078. var heroTimer = null;
  2079. function initHeroCarousel(slides) {
  2080. var track = document.getElementById('heroTrack');
  2081. var dotsWrap = document.getElementById('heroDots');
  2082. var dots = dotsWrap.querySelectorAll('.hero__dot');
  2083. if (slides < 2) return;
  2084. function go(n) {
  2085. heroI = (n + slides) % slides;
  2086. track.style.transform = 'translateX(' + (-heroI * 100) + '%)';
  2087. dots.forEach(function (el, idx) {
  2088. el.classList.toggle('is-active', idx === heroI);
  2089. });
  2090. }
  2091. if (heroTimer) clearInterval(heroTimer);
  2092. heroTimer = setInterval(function () { go(heroI + 1); }, 4000);
  2093. var hero = document.getElementById('hero');
  2094. var startX = 0;
  2095. hero.addEventListener('touchstart', function (e) {
  2096. startX = e.changedTouches[0].clientX;
  2097. }, { passive: true });
  2098. hero.addEventListener('touchend', function (e) {
  2099. var dx = e.changedTouches[0].clientX - startX;
  2100. if (Math.abs(dx) > 40) go(dx < 0 ? heroI + 1 : heroI - 1);
  2101. }, { passive: true });
  2102. }
  2103. function timeToMinutes(t) {
  2104. var parts = String(t || '').trim().split(':');
  2105. var h = parseInt(parts[0], 10) || 0;
  2106. var m = parseInt(parts[1], 10) || 0;
  2107. return h * 60 + m;
  2108. }
  2109. function isTimeInRange(startTime, endTime) {
  2110. var s = String(startTime || '').trim();
  2111. var e = String(endTime || '').trim();
  2112. if (s === '00:00' && e === '00:00') return true;
  2113. if (s === '00:00' && e === '23:59') return true;
  2114. var cur = new Date().getHours() * 60 + new Date().getMinutes();
  2115. var sm = timeToMinutes(s);
  2116. var em = timeToMinutes(e);
  2117. if (em < sm) {
  2118. return cur >= sm || cur <= em;
  2119. }
  2120. return cur >= sm && cur <= em;
  2121. }
  2122. function parseHolidayDate(str) {
  2123. if (!str) return null;
  2124. var d = new Date(String(str).trim().replace(/-/g, '/'));
  2125. return isNaN(d.getTime()) ? null : d;
  2126. }
  2127. function isTodayInHolidayRange(holidayInfo) {
  2128. if (!holidayInfo) return false;
  2129. var hi = holidayInfo;
  2130. if (typeof hi === 'string') {
  2131. try {
  2132. hi = JSON.parse(hi);
  2133. } catch (err) {
  2134. return false;
  2135. }
  2136. }
  2137. var start = hi.startDate || hi.holidayStartDate || hi.beginDate || hi.start || hi.holidayStart;
  2138. var end = hi.endDate || hi.holidayEndDate || hi.finishDate || hi.end || hi.holidayEnd;
  2139. if (!start || !end) return false;
  2140. var startD = parseHolidayDate(start);
  2141. var endD = parseHolidayDate(end);
  2142. if (!startD || !endD) return false;
  2143. var today = new Date();
  2144. today.setHours(0, 0, 0, 0);
  2145. startD.setHours(0, 0, 0, 0);
  2146. endD.setHours(0, 0, 0, 0);
  2147. return today >= startD && today <= endD;
  2148. }
  2149. function findNormalBusinessInfo(list) {
  2150. var wdJs = new Date().getDay();
  2151. var i;
  2152. var x;
  2153. var w;
  2154. for (i = 0; i < list.length; i++) {
  2155. x = list[i];
  2156. if (!x || x.holidayInfo) continue;
  2157. w = x.weekDay != null ? x.weekDay : x.week;
  2158. if (w === undefined || w === null) continue;
  2159. if (Number(w) === wdJs) return x;
  2160. }
  2161. var wdMap = wdJs === 0 ? 7 : wdJs;
  2162. for (i = 0; i < list.length; i++) {
  2163. x = list[i];
  2164. if (!x || x.holidayInfo) continue;
  2165. w = x.weekDay != null ? x.weekDay : x.week;
  2166. if (w === undefined || w === null) continue;
  2167. if (Number(w) === wdMap) return x;
  2168. }
  2169. for (i = 0; i < list.length; i++) {
  2170. x = list[i];
  2171. if (x && !x.holidayInfo && (x.startTime || x.endTime)) return x;
  2172. }
  2173. return null;
  2174. }
  2175. /** 营业状态:暂停营业 | 商家暂未配置营业时间 | 休息中 | 营业中 xx:xx至xx:xx | 营业中 全天营业 */
  2176. function computeBusinessStatusDisplay(d) {
  2177. if (!d) return { text: '—', isOpen: false };
  2178. if (Number(d.businessStatus) === 99) {
  2179. return { text: '商户已关闭', isOpen: false };
  2180. }
  2181. if (Number(d.businessStatus) === 1) {
  2182. return { text: '暂停营业', isOpen: false };
  2183. }
  2184. var list = d.storeBusinessInfoVos || d.storeBusinessInfos || [];
  2185. if (!list.length) {
  2186. return { text: '商家暂未配置营业时间', isOpen: false };
  2187. }
  2188. var holidayList = Array.isArray(d.holidayBusinessInfoList) && d.holidayBusinessInfoList.length
  2189. ? d.holidayBusinessInfoList
  2190. : list.filter(function (item) { return item && item.holidayInfo; });
  2191. var todayHolidayItem = holidayList.find(function (item) {
  2192. return isTodayInHolidayRange(item.holidayInfo);
  2193. });
  2194. var normal = d.normalBusinessInfo || d.normalBusinessInfoVo || findNormalBusinessInfo(list);
  2195. var isOpen = false;
  2196. var currentItem = null;
  2197. if (todayHolidayItem) {
  2198. isOpen = isTimeInRange(todayHolidayItem.startTime, todayHolidayItem.endTime);
  2199. currentItem = todayHolidayItem;
  2200. } else if (normal) {
  2201. isOpen = isTimeInRange(normal.startTime, normal.endTime);
  2202. currentItem = normal;
  2203. }
  2204. if (!currentItem) return { text: '休息中', isOpen: false };
  2205. if (!isOpen) return { text: '休息中', isOpen: false };
  2206. var st = String(currentItem.startTime || '').trim();
  2207. var et = String(currentItem.endTime || '').trim();
  2208. if (st === '00:00' && et === '00:00') return { text: '营业中 全天营业', isOpen: true };
  2209. if (st === '00:00' && et === '23:59') return { text: '营业中 全天营业', isOpen: true };
  2210. var needNextDay = timeToMinutes(et) < timeToMinutes(st);
  2211. var suffix = (needNextDay ? '次日' : '') + et;
  2212. return { text: ('营业中 ' + st + ' 至 ' + suffix).trim(), isOpen: true };
  2213. }
  2214. /**
  2215. * 分项评分:可能在 storeEvaluate 对象内,或为 JSON 字符串;部分接口把字段放在详情根上。
  2216. */
  2217. function parseStoreEvaluateRaw(raw) {
  2218. if (raw == null || raw === '') return null;
  2219. if (typeof raw === 'string') {
  2220. var t = raw.trim();
  2221. if (!t) return null;
  2222. try {
  2223. raw = JSON.parse(t);
  2224. } catch (e) {
  2225. return null;
  2226. }
  2227. }
  2228. if (Array.isArray(raw) && raw.length && raw[0] && typeof raw[0] === 'object') {
  2229. raw = raw[0];
  2230. }
  2231. if (raw && typeof raw === 'object' && !Array.isArray(raw)) return raw;
  2232. return null;
  2233. }
  2234. function getStoreEvaluateScores(d) {
  2235. var ev = parseStoreEvaluateRaw(d.storeEvaluate)
  2236. || parseStoreEvaluateRaw(d.evaluate)
  2237. || parseStoreEvaluateRaw(d.evaluateInfo);
  2238. function lane(key, snake) {
  2239. var v;
  2240. if (ev && ev[key] != null && ev[key] !== '') v = ev[key];
  2241. else if (d[key] != null && d[key] !== '') v = d[key];
  2242. else if (snake && d[snake] != null && d[snake] !== '') v = d[snake];
  2243. else return null;
  2244. var n = Number(v);
  2245. return !isNaN(n) ? n : null;
  2246. }
  2247. return {
  2248. scoreOne: lane('scoreOne', 'score_one'),
  2249. scoreTwo: lane('scoreTwo', 'score_two'),
  2250. scoreThree: lane('scoreThree', 'score_three')
  2251. };
  2252. }
  2253. function fmtEvalScore(n) {
  2254. return n != null && !isNaN(n) ? Number(n).toFixed(1) : null;
  2255. }
  2256. var CLOSED_REC_STAR_PATH =
  2257. 'M12 17.27L18.18 21l-1.64-7.03L22 9.24l-7.19-.61L12 2 9.19 8.63 2 9.24l5.46 4.73L5.82 21z';
  2258. function closedRecEscHtml(s) {
  2259. return String(s == null ? '' : s)
  2260. .replace(/&/g, '&amp;')
  2261. .replace(/</g, '&lt;')
  2262. .replace(/>/g, '&gt;')
  2263. .replace(/"/g, '&quot;');
  2264. }
  2265. function closedRecStarsHtml(score) {
  2266. var s = Number(score);
  2267. if (isNaN(s)) s = 0;
  2268. s = Math.max(0, Math.min(5, s));
  2269. var rounded = Math.round(s);
  2270. var parts = [];
  2271. var i;
  2272. for (i = 1; i <= 5; i++) {
  2273. var fill = i <= rounded ? '#F58220' : '#E5E5E5';
  2274. parts.push(
  2275. '<svg class="closed-rec-star" width="11" height="11" viewBox="0 0 24 24" aria-hidden="true">' +
  2276. '<path fill="' + fill + '" d="' + CLOSED_REC_STAR_PATH + '"/></svg>'
  2277. );
  2278. }
  2279. return '<span class="closed-rec-stars">' + parts.join('') + '</span>';
  2280. }
  2281. function closedRecFormatDistance(item) {
  2282. if (item.distance != null && item.distance !== '') {
  2283. var km = Number(item.distance);
  2284. if (!isNaN(km) && km >= 0) {
  2285. return Math.round(km * 1000) + '米';
  2286. }
  2287. return String(item.distance).trim();
  2288. }
  2289. if (item.position != null && String(item.position).trim() !== '') {
  2290. return String(item.position).trim();
  2291. }
  2292. if (item.dist != null && item.dist !== '') {
  2293. var dn = Number(item.dist);
  2294. if (!isNaN(dn)) {
  2295. return dn >= 1 ? dn.toFixed(dn % 1 === 0 ? 0 : 1) + 'km' : Math.round(dn * 1000) + '米';
  2296. }
  2297. }
  2298. return '';
  2299. }
  2300. function closedRecPickScore(item) {
  2301. var x =
  2302. item.scoreAvg != null ? Number(item.scoreAvg)
  2303. : item.score != null ? Number(item.score)
  2304. : item.rating != null ? Number(item.rating)
  2305. : item.starScore != null ? Number(item.starScore)
  2306. : NaN;
  2307. return isNaN(x) ? null : x;
  2308. }
  2309. function closedRecPickReviewCount(item) {
  2310. var n =
  2311. item.commitCount != null ? Number(item.commitCount)
  2312. : item.commentCount != null ? Number(item.commentCount)
  2313. : item.reviewCount != null ? Number(item.reviewCount)
  2314. : item.evaluateCount != null ? Number(item.evaluateCount)
  2315. : NaN;
  2316. return isNaN(n) ? 0 : Math.max(0, Math.floor(n));
  2317. }
  2318. function normalizeClosedStoreRecommendList(res) {
  2319. if (!res || typeof res !== 'object') return [];
  2320. var raw = res.data != null ? res.data : res.result;
  2321. if (Array.isArray(raw)) return raw;
  2322. if (raw && typeof raw === 'object') {
  2323. if (Array.isArray(raw.list)) return raw.list;
  2324. if (Array.isArray(raw.records)) return raw.records;
  2325. if (Array.isArray(raw.rows)) return raw.rows;
  2326. if (Array.isArray(raw.content)) return raw.content;
  2327. if (Array.isArray(raw.stores)) return raw.stores;
  2328. if (Array.isArray(raw.storeList)) return raw.storeList;
  2329. if (Array.isArray(raw.storeVos)) return raw.storeVos;
  2330. if (Array.isArray(raw.items)) return raw.items;
  2331. }
  2332. if (Array.isArray(res.list)) return res.list;
  2333. if (Array.isArray(res.records)) return res.records;
  2334. return [];
  2335. }
  2336. function fetchShareClosedStoreRecommend(storeIdStr) {
  2337. var loc = getClosedRecommendUserLocation();
  2338. var page = parseInt(q('page') || '1', 10);
  2339. var pageSize = parseInt(q('pageSize') || '10', 10);
  2340. if (isNaN(page) || page < 1) page = 1;
  2341. if (isNaN(pageSize) || pageSize < 1) pageSize = 10;
  2342. var body = {
  2343. page: page,
  2344. pageSize: pageSize,
  2345. storeId: String(storeIdStr || ''),
  2346. userCity: loc.userCity,
  2347. userLat: loc.userLat,
  2348. userLng: loc.userLng
  2349. };
  2350. return fetch(API_LIFE_AI_BASE + STORE_GLOBAL_RECOMMEND_PATH, {
  2351. method: 'POST',
  2352. mode: 'cors',
  2353. credentials: 'omit',
  2354. headers: {
  2355. Accept: 'application/json',
  2356. 'Content-Type': 'application/json;charset=UTF-8'
  2357. },
  2358. body: JSON.stringify(body)
  2359. }).then(function (res) {
  2360. if (!res.ok) throw new Error('HTTP ' + res.status);
  2361. return res.json();
  2362. });
  2363. }
  2364. function renderShareClosedRecommended(list) {
  2365. var wrap = document.getElementById('shareClosedRecList');
  2366. var empty = document.getElementById('shareClosedRecEmpty');
  2367. if (!wrap || !empty) return;
  2368. wrap.querySelectorAll('.closed-rec-card').forEach(function (n) {
  2369. n.remove();
  2370. });
  2371. if (!list || !list.length) {
  2372. empty.style.display = 'block';
  2373. return;
  2374. }
  2375. empty.style.display = 'none';
  2376. list.forEach(function (item) {
  2377. if (!item || typeof item !== 'object') return;
  2378. var imgUrlField = item.imgUrl != null ? String(item.imgUrl).trim() : '';
  2379. var home = item.homeImage != null ? String(item.homeImage).trim() : '';
  2380. if (home && /\.mp4(\?|#|$)/i.test(home)) {
  2381. var vf = item.videoFirstFrame != null ? String(item.videoFirstFrame).trim() : '';
  2382. if (vf) home = vf;
  2383. }
  2384. var imgUrl =
  2385. imgUrlField ||
  2386. home ||
  2387. (item.coverUrl != null ? String(item.coverUrl).trim() : '') ||
  2388. (item.mainImage != null ? String(item.mainImage).trim() : '') ||
  2389. (item.goodsImage != null ? String(item.goodsImage).trim() : '') ||
  2390. (item.entranceImage != null ? String(item.entranceImage).trim() : '') ||
  2391. (Array.isArray(item.goodsImageList) && item.goodsImageList[0]) ||
  2392. (Array.isArray(item.imageList) && item.imageList[0]) ||
  2393. (Array.isArray(item.storeAlbumUrlList) && item.storeAlbumUrlList[0]) ||
  2394. '';
  2395. var name = item.title != null && String(item.title).trim() !== ''
  2396. ? String(item.title).replace(/\r?\n/g, ' ').replace(/\s+/g, ' ').trim()
  2397. : (item.storeName || item.goodsName || item.secondGoodsTitle || item.name || '推荐');
  2398. var dist = closedRecFormatDistance(item);
  2399. var scoreVal = closedRecPickScore(item);
  2400. var displayScore = scoreVal != null ? scoreVal.toFixed(1) : '—';
  2401. var starScore = scoreVal != null ? scoreVal : 0;
  2402. var rc = closedRecPickReviewCount(item);
  2403. var reviewLabel = rc > 0 ? rc + '条评价' : '';
  2404. var seller =
  2405. item.userName != null && String(item.userName).trim() !== ''
  2406. ? String(item.userName).trim()
  2407. : (item.nickName != null && String(item.nickName).trim() !== ''
  2408. ? String(item.nickName).trim()
  2409. : '');
  2410. var card = document.createElement('article');
  2411. card.className = 'closed-rec-card';
  2412. card.innerHTML =
  2413. '<div class="closed-rec-card__img"><img class="closed-rec-card__cover" src="" alt="" decoding="async"></div>' +
  2414. '<div class="closed-rec-card__body">' +
  2415. '<div class="closed-rec-card__top">' +
  2416. '<span class="closed-rec-card__name">' + closedRecEscHtml(name) + '</span>' +
  2417. (dist ? '<span class="closed-rec-card__dist">' + closedRecEscHtml(dist) + '</span>' : '') +
  2418. '</div>' +
  2419. '<div class="closed-rec-card__rating">' +
  2420. closedRecStarsHtml(starScore) +
  2421. '<span class="closed-rec-rating-num">' + closedRecEscHtml(displayScore) + '</span>' +
  2422. (reviewLabel ? '<span class="closed-rec-meta">' + closedRecEscHtml(reviewLabel) + '</span>' : '') +
  2423. '</div>' +
  2424. (seller ? '<div class="closed-rec-card__footer">' + closedRecEscHtml(seller) + '</div>' : '') +
  2425. '</div>';
  2426. var coverIm = card.querySelector('img.closed-rec-card__cover');
  2427. if (coverIm) {
  2428. coverIm.src = imgUrl;
  2429. coverIm.onerror = function () {
  2430. this.onerror = null;
  2431. this.src = '';
  2432. };
  2433. }
  2434. wrap.appendChild(card);
  2435. });
  2436. }
  2437. function loadShareClosedRecommendations() {
  2438. var sid = getStoreId();
  2439. if (!sid) {
  2440. renderShareClosedRecommended([]);
  2441. return;
  2442. }
  2443. fetchShareClosedStoreRecommend(sid)
  2444. .then(function (res) {
  2445. var list = normalizeClosedStoreRecommendList(res);
  2446. if (!list.length && res && res.msg) {
  2447. console.warn('[store-recommend]', res.msg);
  2448. }
  2449. renderShareClosedRecommended(list);
  2450. })
  2451. .catch(function (e) {
  2452. console.error(e);
  2453. renderShareClosedRecommended([]);
  2454. });
  2455. }
  2456. function applyShareIndexClosedMerchantUi(closed) {
  2457. var wasClosed = closedMerchantFlag;
  2458. closedMerchantFlag = closed;
  2459. if (wasClosed !== closed && weChatJssdkConfigured) {
  2460. refreshWxLaunchTagAttrs();
  2461. }
  2462. var banner = document.getElementById('shareClosedBanner');
  2463. var contentEl = document.getElementById('shareContentEl');
  2464. var belowEl = document.getElementById('shareBelowContentEl');
  2465. var recWrap = document.getElementById('shareClosedRecommendWrap');
  2466. if (banner) {
  2467. banner.style.display = closed ? 'block' : 'none';
  2468. banner.setAttribute('aria-hidden', closed ? 'false' : 'true');
  2469. }
  2470. if (contentEl) {
  2471. contentEl.style.display = closed ? 'none' : '';
  2472. contentEl.setAttribute('aria-hidden', closed ? 'true' : 'false');
  2473. }
  2474. if (belowEl) {
  2475. belowEl.style.display = '';
  2476. belowEl.setAttribute('aria-hidden', 'false');
  2477. }
  2478. if (recWrap) {
  2479. if (closed) {
  2480. recWrap.style.display = 'block';
  2481. recWrap.setAttribute('aria-hidden', 'false');
  2482. if (!wasClosed) {
  2483. loadShareClosedRecommendations();
  2484. }
  2485. } else {
  2486. recWrap.style.display = 'none';
  2487. recWrap.setAttribute('aria-hidden', 'true');
  2488. renderShareClosedRecommended([]);
  2489. }
  2490. }
  2491. }
  2492. function renderDetail(d) {
  2493. if (!d) return;
  2494. appLaunchDetailCache = d;
  2495. if (weChatJssdkConfigured) refreshWxLaunchTagAttrs();
  2496. document.getElementById('storeName').textContent = d.storeName || '—';
  2497. var score = d.scoreAvg != null ? Number(d.scoreAvg) : NaN;
  2498. document.getElementById('scoreAvg').textContent = !isNaN(score) ? score.toFixed(1) : '—';
  2499. document.getElementById('commitCount').textContent = d.commitCount != null ? String(d.commitCount)+'条' : '0';
  2500. var evRow = document.getElementById('storeEvaluateRow');
  2501. var evOne = document.getElementById('storeEvaluateScoreOne');
  2502. var evTwo = document.getElementById('storeEvaluateScoreTwo');
  2503. var evThree = document.getElementById('storeEvaluateScoreThree');
  2504. if (evRow && evOne && evTwo && evThree) {
  2505. evRow.classList.remove('is-visible');
  2506. evRow.setAttribute('aria-hidden', 'true');
  2507. var es = getStoreEvaluateScores(d);
  2508. var a = fmtEvalScore(es.scoreOne);
  2509. var b = fmtEvalScore(es.scoreTwo);
  2510. var c = fmtEvalScore(es.scoreThree);
  2511. if (a !== null || b !== null || c !== null) {
  2512. evOne.textContent = a !== null ? a : '—';
  2513. evTwo.textContent = b !== null ? b : '—';
  2514. evThree.textContent = c !== null ? c : '—';
  2515. evRow.classList.add('is-visible');
  2516. evRow.setAttribute('aria-hidden', 'false');
  2517. }
  2518. }
  2519. var bizDisp = computeBusinessStatusDisplay(d);
  2520. var bizEl = document.getElementById('bizStatus');
  2521. bizEl.textContent = bizDisp.text;
  2522. bizEl.className = 'status' + (bizDisp.isOpen ? ' is-open' : '');
  2523. document.getElementById('hoursText').textContent = '';
  2524. document.getElementById('storeAddr').textContent = d.queryAddress || d.storeAddress || '—';
  2525. if (d.distance != null) {
  2526. document.getElementById('metaDistance').style.display = 'flex';
  2527. document.getElementById('distanceText').textContent =
  2528. '距您' + (Number(d.distance) > 1 ? d.distance + '千米' : Math.round(Number(d.distance) * 1000) + '米');
  2529. }
  2530. if (d.subwayName && d.distance2 != null) {
  2531. document.getElementById('metaSubway').style.display = 'flex';
  2532. document.getElementById('subwayText').textContent =
  2533. '距' + d.subwayName + '步行' + (Number(d.distance2) >= 1000
  2534. ? (Number(d.distance2) / 1000).toFixed(1) + 'km'
  2535. : Math.round(Number(d.distance2)) + 'm');
  2536. }
  2537. var imgs = [];
  2538. if (Array.isArray(d.storeAlbumUrlList) && d.storeAlbumUrlList.length) imgs = d.storeAlbumUrlList.slice();
  2539. else if (d.entranceImage) imgs = [d.entranceImage];
  2540. buildHeroSlides(imgs);
  2541. var closedMerchant = Number(d.businessStatus) === 99;
  2542. applyShareIndexClosedMerchantUi(closedMerchant);
  2543. renderMarketingList(marketingListCache);
  2544. renderPerformanceList();
  2545. renderStaffGroups(staffGroupsCache);
  2546. }
  2547. function getLngForApi() {
  2548. var v = q('jingdu');
  2549. if (v) return v;
  2550. return q('lon') || q('lng') || q('longitude');
  2551. }
  2552. function getLatForApi() {
  2553. var v = q('weidu');
  2554. if (v) return v;
  2555. return q('lat') || q('latitude');
  2556. }
  2557. function mergeSearchAndHashParamsForRedirect() {
  2558. var params = new URLSearchParams();
  2559. function ingest(slice) {
  2560. if (!slice) return;
  2561. var p = new URLSearchParams(slice);
  2562. p.forEach(function (val, key) {
  2563. params.set(key, val);
  2564. });
  2565. }
  2566. if (location.search && location.search.length > 1) {
  2567. ingest(location.search.slice(1));
  2568. }
  2569. var hash = location.hash || '';
  2570. var qi = hash.indexOf('?');
  2571. if (qi >= 0) {
  2572. ingest(hash.slice(qi + 1));
  2573. }
  2574. return params;
  2575. }
  2576. /** getClientStoreDetail 无承载数据时进 shareCheckInUndefined(businessStatus=99 与落地页约定一致) */
  2577. function buildShareCheckInUndefinedRedirectHref() {
  2578. var p = mergeSearchAndHashParamsForRedirect();
  2579. p.set('businessStatus', '99');
  2580. var sid = getStoreId();
  2581. if (sid && !p.has('storeId')) {
  2582. p.set('storeId', sid);
  2583. }
  2584. var j = getLngForApi();
  2585. var w = getLatForApi();
  2586. if (j && !p.has('userLng')) {
  2587. p.set('userLng', j);
  2588. }
  2589. if (w && !p.has('userLat')) {
  2590. p.set('userLat', w);
  2591. }
  2592. var qs = p.toString();
  2593. return 'shareCheckInUndefined.html' + (qs ? ('?' + qs) : '?businessStatus=99');
  2594. }
  2595. function run() {
  2596. var sid = getStoreId();
  2597. var userId = q('userId');
  2598. var jingdu = getLngForApi();
  2599. var weidu = getLatForApi();
  2600. if (!sid) {
  2601. showErr('缺少店铺 id(请从 App 分享链接打开,URL 需带 id 或 storeId)');
  2602. document.getElementById('storeName').textContent = '参数错误';
  2603. return;
  2604. }
  2605. var detailPath = '/store/info/getClientStoreDetail?' +
  2606. 'id=' + encodeURIComponent(sid) +
  2607. '&userId=' + encodeURIComponent(userId) +
  2608. '&jingdu=' + encodeURIComponent(jingdu) +
  2609. '&weidu=' + encodeURIComponent(weidu);
  2610. fetchStoreInfoGetOne(sid).then(function (getOneRes) {
  2611. if (isGetOneBusinessStatus99(getOneRes)) {
  2612. applyShareIndexClosedMerchantUi(true);
  2613. }
  2614. apiFetch(detailPath)
  2615. .then(function (res) {
  2616. var tip = res && res.msg != null ? String(res.msg).trim() : '';
  2617. if (tip === '暂无承载数据') {
  2618. if (closedMerchantFlag) {
  2619. return;
  2620. }
  2621. window.location.replace(buildShareCheckInUndefinedRedirectHref());
  2622. return;
  2623. }
  2624. if (res.code !== 200 || !res.data) {
  2625. showErr(res.msg || '店铺详情加载失败');
  2626. return;
  2627. }
  2628. renderDetail(res.data);
  2629. })
  2630. .catch(function (e) {
  2631. console.error(e);
  2632. showErr('店铺详情请求失败(若为 file:// 打开,请检查 CORS 或改用 http 访问本页)');
  2633. });
  2634. var couponPath = '/store/info/getStoreCouponList?storeId=' + encodeURIComponent(sid);
  2635. marketingCouponLoaded = false;
  2636. apiFetch(couponPath)
  2637. .then(function (res) {
  2638. marketingCouponLoaded = true;
  2639. var list = (res && res.code === 200 && res.data && res.data.marketingList) || [];
  2640. if (!Array.isArray(list)) list = [];
  2641. renderMarketingList(list);
  2642. })
  2643. .catch(function (e) {
  2644. marketingCouponLoaded = true;
  2645. console.warn('[getStoreCouponList]', e);
  2646. renderMarketingList([]);
  2647. });
  2648. if (shouldShowPerformanceSection()) {
  2649. var perfPath = '/performance/list/query?storeId=' + encodeURIComponent(sid) + '&page=1&size=100';
  2650. apiFetch(perfPath)
  2651. .then(function (res) {
  2652. var d = (res && res.code === 200 && res.data) || null;
  2653. if (!d || typeof d !== 'object') {
  2654. performanceListCache.records = [];
  2655. performanceListCache.total = 0;
  2656. } else {
  2657. performanceListCache.records = Array.isArray(d.records) ? d.records.slice() : [];
  2658. var pt = d.total;
  2659. performanceListCache.total = pt != null && !isNaN(Number(pt))
  2660. ? Number(pt)
  2661. : performanceListCache.records.length;
  2662. }
  2663. renderPerformanceList();
  2664. })
  2665. .catch(function (e) {
  2666. console.warn('[performance/list/query]', e);
  2667. performanceListCache.records = [];
  2668. performanceListCache.total = 0;
  2669. renderPerformanceList();
  2670. });
  2671. } else {
  2672. performanceListCache.records = [];
  2673. performanceListCache.total = 0;
  2674. renderPerformanceList();
  2675. }
  2676. var staffPath = '/storeStaffConfig/queryStaffListByTitle?storeId=' + encodeURIComponent(sid);
  2677. apiFetch(staffPath)
  2678. .then(function (res) {
  2679. var arr = (res && res.code === 200 && res.data) || [];
  2680. if (!Array.isArray(arr)) arr = [];
  2681. renderStaffGroups(arr);
  2682. })
  2683. .catch(function (e) {
  2684. console.warn('[queryStaffListByTitle]', e);
  2685. renderStaffGroups([]);
  2686. });
  2687. });
  2688. }
  2689. function boot() {
  2690. var launchTag = document.getElementById('launch-btn');
  2691. if (launchTag) launchTag.setAttribute('appid', WECHAT_OPEN_APP_ID);
  2692. bindWeChatLaunchTagEvents();
  2693. if (isWeChatInAppBrowser()) {
  2694. document.body.classList.add('is-wechat');
  2695. applyWxOpenLaunchSceneBodyClass();
  2696. logWxEntryDiagnostics();
  2697. }
  2698. if (shouldInitWeChatJssdkOnLoad()) {
  2699. if (isWxPcBrowser() && (isWxForceDebug() || isWxPcAutoDebugHost())) {
  2700. document.body.classList.add('wx-pc-debug');
  2701. }
  2702. scheduleWeChatJssdkBootstrap();
  2703. }
  2704. document.addEventListener('WeixinOpenTagsError', function (e) {
  2705. console.warn('[WeixinOpenTagsError]', e && e.detail);
  2706. applyWxOpenLaunchSceneBodyClass();
  2707. });
  2708. if (isWeChatInAppBrowser()) {
  2709. var openBtnWx = document.getElementById('openApp');
  2710. if (openBtnWx) {
  2711. openBtnWx.addEventListener('click', function () {
  2712. if (!weChatJssdkConfigured) {
  2713. showFabToast(
  2714. wxInitLastError || '微信 SDK 初始化中,请稍候再点底部按钮'
  2715. );
  2716. return;
  2717. }
  2718. if (!isWxOpenLaunchAppSceneSupported()) {
  2719. showWxCopyLinkEntryTip();
  2720. }
  2721. });
  2722. }
  2723. } else {
  2724. var openBtn = document.getElementById('openApp');
  2725. if (openBtn) openBtn.addEventListener('click', tryOpenHBuilderApp);
  2726. }
  2727. run();
  2728. bindMarketingMore();
  2729. bindStaffSection();
  2730. }
  2731. if (document.readyState === 'complete') {
  2732. boot();
  2733. } else {
  2734. window.onload = boot;
  2735. }
  2736. })();
  2737. </script>
  2738. </body>
  2739. </html>