shareIndex.html 79 KB

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