shareIndex.html 65 KB

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