shareIndex.html 65 KB

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