shareIndex.html 77 KB

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