shareIndex.html 81 KB

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