shareIndex.html 75 KB

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