shareIndex.html 88 KB

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