shareIndex.html 65 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008200920102011201220132014201520162017201820192020202120222023202420252026202720282029203020312032203320342035203620372038203920402041204220432044204520462047204820492050205120522053205420552056205720582059206020612062206320642065206620672068206920702071207220732074207520762077207820792080208120822083208420852086208720882089209020912092209320942095209620972098209921002101210221032104210521062107210821092110211121122113211421152116211721182119212021212122212321242125212621272128212921302131213221332134213521362137213821392140214121422143214421452146214721482149215021512152215321542155215621572158215921602161216221632164216521662167216821692170217121722173217421752176217721782179218021812182218321842185218621872188218921902191219221932194219521962197219821992200220122022203220422052206220722082209221022112212221322142215221622172218221922202221222222232224222522262227222822292230223122322233223422352236223722382239224022412242224322442245224622472248224922502251225222532254225522562257225822592260226122622263226422652266226722682269227022712272227322742275227622772278227922802281228222832284228522862287228822892290229122922293229422952296229722982299230023012302230323042305230623072308230923102311231223132314231523162317231823192320232123222323232423252326232723282329
  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 一致;请求体 page、pageSize、storeId、userCity、userLat、userLng 可由 URL 覆盖。
  882. */
  883. var API_LIFE_AI_BASE = 'http://124.93.18.180:9100';
  884. var STORE_GLOBAL_RECOMMEND_PATH =
  885. '/ai/multimodal-services/api/v1/search/global/store-recommend';
  886. var DEFAULT_REC_USER_LAT = 38.925747;
  887. var DEFAULT_REC_USER_LNG = 121.662531;
  888. var DEFAULT_REC_USER_CITY = '大连市';
  889. /**
  890. * 与 group_user 一致:
  891. * - manifest:app-plus.distribute.android.schemes、ios.urltypes → shopro(即 shopro://)
  892. * - Android 包名:manifest 未写 packagename 时与 App.vue 升级配置 androidPackageName 一致(云打包以 HBuilderX 为准)
  893. */
  894. var APP_ANDROID_PACKAGE = 'com.alien.Udianzaizhe';
  895. var APP_IOS_URL_SCHEME = 'shopro://';
  896. /** businessSection 未传或其它值时的默认落地页(与 1 相同) */
  897. var APP_UNI_STORE_PATH = 'pages/ieisureEntertainment/eightTypeList/delicacyDetails';
  898. function showDownloadTip() {
  899. var msg = '请到应用商店下载';
  900. if (typeof uni !== 'undefined' && typeof uni.showToast === 'function') {
  901. uni.showToast({ title: msg, icon: 'none', duration: 2500 });
  902. } else {
  903. window.alert(msg);
  904. }
  905. }
  906. /** 详情页 onLoad 使用 storeId;分享链常为 id,补全 storeId 避免 App 内参数为空 */
  907. function buildAppOpenQueryString() {
  908. var raw = (location.search && location.search.charAt(0) === '?') ? location.search.slice(1) : (location.search || '');
  909. var params = new URLSearchParams(raw);
  910. var sid = params.get('storeId') || params.get('id') || '';
  911. if (sid && !params.get('storeId')) params.set('storeId', sid);
  912. var qs = params.toString();
  913. return qs ? ('?' + qs) : '';
  914. }
  915. /**
  916. * 按 URL 参数 businessSection 打开对应 App 页:
  917. * 1 → delicacyDetails,2 → barDetails,3 → lifeDetails
  918. * 关店 businessStatus=99 时进 pages/index/login(见 isClosedMerchantForAppOpen)。
  919. */
  920. function getAppUniPathForBusinessSection() {
  921. if (isClosedMerchantForAppOpen()) {
  922. return 'pages/index/login';
  923. }
  924. var bs = String(q('businessSection') || '').trim();
  925. if (bs === '1') {
  926. return 'pages/ieisureEntertainment/eightTypeList/delicacyDetails';
  927. }
  928. if (bs === '2') {
  929. return 'pages/ieisureEntertainment/eightTypeList/barDetails';
  930. }
  931. if (bs === '3') {
  932. return 'pages/ieisureEntertainment/eightTypeList/lifeDetails';
  933. }
  934. return String(APP_UNI_STORE_PATH || 'pages/ieisureEntertainment/eightTypeList/delicacyDetails').replace(/^\//, '');
  935. }
  936. function buildAppDeepLink() {
  937. var path = getAppUniPathForBusinessSection().replace(/^\//, '');
  938. var s = buildAppOpenQueryString();
  939. var root = APP_IOS_URL_SCHEME.replace(/\/$/, '');
  940. if (!s) return root + '/' + path;
  941. return root + '/' + path + s;
  942. }
  943. function isWeChatInAppBrowser() {
  944. return /MicroMessenger/i.test(navigator.userAgent || '');
  945. }
  946. /** 部分 WebView 对 location.href 拦截,用 a 标签点击略稳 */
  947. function launchAppDeepLink(deepLink) {
  948. try {
  949. var a = document.createElement('a');
  950. a.href = deepLink;
  951. a.setAttribute('target', '_self');
  952. document.body.appendChild(a);
  953. a.click();
  954. document.body.removeChild(a);
  955. } catch (e1) {}
  956. try {
  957. window.location.href = deepLink;
  958. } catch (e2) {}
  959. }
  960. /**
  961. * 有 plus:检测 App 是否安装后 openURL;深链形如 shopro://{APP_UNI_STORE_PATH}?…
  962. * 系统浏览器:唤起 scheme;微信内常拦截 scheme,需「在浏览器打开」。
  963. */
  964. function tryOpenHBuilderApp() {
  965. var deepLink = buildAppDeepLink();
  966. if (typeof plus !== 'undefined' && plus.runtime) {
  967. var installed = null;
  968. try {
  969. if (typeof plus.runtime.isApplicationExist === 'function') {
  970. installed = plus.runtime.isApplicationExist({
  971. pname: APP_ANDROID_PACKAGE,
  972. action: APP_IOS_URL_SCHEME
  973. });
  974. }
  975. } catch (e) {
  976. console.warn(e);
  977. }
  978. if (installed === false) {
  979. showDownloadTip();
  980. return;
  981. }
  982. try {
  983. plus.runtime.openURL(deepLink);
  984. } catch (e2) {
  985. console.warn(e2);
  986. showDownloadTip();
  987. }
  988. return;
  989. }
  990. var t0 = Date.now();
  991. var done = false;
  992. function finish() {
  993. if (done) return;
  994. done = true;
  995. document.removeEventListener('visibilitychange', onVis);
  996. window.removeEventListener('pagehide', onHide);
  997. }
  998. function onVis() {
  999. if (document.visibilityState === 'hidden') finish();
  1000. }
  1001. function onHide() {
  1002. finish();
  1003. }
  1004. document.addEventListener('visibilitychange', onVis);
  1005. window.addEventListener('pagehide', onHide);
  1006. if (isWeChatInAppBrowser()) {
  1007. window.alert('若点击后无法打开 App:请先点右上角「···」,选择「在浏览器中打开」,再点「APP内打开」。');
  1008. }
  1009. try {
  1010. launchAppDeepLink(deepLink);
  1011. } catch (e3) {
  1012. finish();
  1013. showDownloadTip();
  1014. return;
  1015. }
  1016. window.setTimeout(function () {
  1017. if (done) return;
  1018. if (document.visibilityState === 'visible' && Date.now() - t0 < 3500) {
  1019. showDownloadTip();
  1020. }
  1021. finish();
  1022. }, 2600);
  1023. }
  1024. function qs() {
  1025. return new URLSearchParams(location.search || '');
  1026. }
  1027. function q(name) {
  1028. var v = qs().get(name);
  1029. return v == null ? '' : String(v);
  1030. }
  1031. function showErr(msg) {
  1032. var el = document.getElementById('pageError');
  1033. el.textContent = msg;
  1034. el.style.display = 'block';
  1035. }
  1036. function getStoreId() {
  1037. return q('id') || q('storeId');
  1038. }
  1039. function shouldShowPerformanceSection() {
  1040. return String(q('businessSection') || '').trim() === '2';
  1041. }
  1042. function apiFetch(path) {
  1043. return fetch(API_BASE + path, {
  1044. method: 'GET',
  1045. mode: 'cors',
  1046. credentials: 'omit',
  1047. headers: { Accept: 'application/json' }
  1048. }).then(function (res) {
  1049. if (!res.ok) throw new Error('HTTP ' + res.status);
  1050. return res.json();
  1051. });
  1052. }
  1053. /** 进入页先拉店铺概要;与 shareDynamic.html fetchGetDeleteFlagByIdIfId 相同路径与 id 参数 */
  1054. function fetchStoreInfoGetOne(storeId) {
  1055. if (!storeId) return Promise.resolve(null);
  1056. var qs = new URLSearchParams();
  1057. qs.set('id', String(storeId).trim());
  1058. return apiFetch('/store/info/getOne?' + qs.toString()).catch(function (e) {
  1059. console.warn('[store/info/getOne]', e);
  1060. return null;
  1061. });
  1062. }
  1063. function isGetOneBusinessStatus99(res) {
  1064. if (!res || typeof res !== 'object') return false;
  1065. var d = res.data;
  1066. if (d && typeof d === 'object') {
  1067. var bs = d.businessStatus;
  1068. if (bs === 99 || bs === '99' || Number(bs) === 99) return true;
  1069. }
  1070. return false;
  1071. }
  1072. var MARKETING_PREVIEW_COUNT = 3;
  1073. var closedMerchantFlag = false;
  1074. /** 关店 businessStatus=99:getOne 已置 closedMerchantFlag,或 URL 带 businessStatus=99;唤起 App 时进登录页 */
  1075. function isClosedMerchantForAppOpen() {
  1076. if (closedMerchantFlag) return true;
  1077. var bs = String(q('businessStatus') || '').trim();
  1078. if (bs === '99' || Number(bs) === 99) return true;
  1079. return false;
  1080. }
  1081. var marketingListCache = [];
  1082. /** 避免详情先返回时用空 cache 误展示「暂无活动」图 */
  1083. var marketingCouponLoaded = false;
  1084. var staffGroupsCache = [];
  1085. var performanceListCache = { records: [], total: 0 };
  1086. function isMp4VideoUrl(url) {
  1087. if (!url || typeof url !== 'string') return false;
  1088. var path = url.split(/[?#]/)[0].toLowerCase();
  1089. return path.length >= 4 && path.slice(-4) === '.mp4';
  1090. }
  1091. function getMp4PlaybackUrl(url) {
  1092. var u = String(url || '').trim();
  1093. if (!u) return '';
  1094. var q = u.indexOf('?');
  1095. var h = u.indexOf('#');
  1096. var cut = u.length;
  1097. if (q >= 0) cut = Math.min(cut, q);
  1098. if (h >= 0) cut = Math.min(cut, h);
  1099. var base = u.slice(0, cut);
  1100. if (/\.mp4$/i.test(base)) return base;
  1101. return u;
  1102. }
  1103. function mp4UrlToJpgUrl(u) {
  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 pathPart = u.slice(0, cut);
  1110. var rest = u.slice(cut);
  1111. if (!/\.mp4$/i.test(pathPart)) return '';
  1112. return pathPart.slice(0, -4) + '.jpg' + rest;
  1113. }
  1114. function createMarketingMedia(url) {
  1115. var wrap = document.createElement('div');
  1116. wrap.className = 'marketing-card__media';
  1117. var full = String(url == null ? '' : url).trim();
  1118. if (!full) return wrap;
  1119. if (isMp4VideoUrl(full)) {
  1120. var playUrl = getMp4PlaybackUrl(full);
  1121. var vid = document.createElement('video');
  1122. vid.src = playUrl;
  1123. vid.setAttribute('controls', '');
  1124. vid.setAttribute('playsinline', '');
  1125. vid.setAttribute('webkit-playsinline', '');
  1126. vid.muted = true;
  1127. vid.setAttribute('muted', '');
  1128. vid.setAttribute('autoplay', '');
  1129. vid.preload = 'auto';
  1130. var poster = '';
  1131. if (full.length > playUrl.length) poster = full;
  1132. else poster = mp4UrlToJpgUrl(playUrl);
  1133. if (poster) vid.setAttribute('poster', poster);
  1134. vid.addEventListener('canplay', function onCap() {
  1135. vid.removeEventListener('canplay', onCap);
  1136. var p = vid.play();
  1137. if (p && typeof p.catch === 'function') p.catch(function () {});
  1138. });
  1139. wrap.appendChild(vid);
  1140. } else {
  1141. var img = document.createElement('img');
  1142. img.src = full;
  1143. img.alt = '';
  1144. img.decoding = 'async';
  1145. wrap.appendChild(img);
  1146. }
  1147. return wrap;
  1148. }
  1149. function renderMarketingList(rawList) {
  1150. marketingListCache = Array.isArray(rawList) ? rawList.slice() : [];
  1151. var section = document.getElementById('shareMarketingSection');
  1152. var listEl = document.getElementById('marketingListEl');
  1153. var moreBtn = document.getElementById('marketingMoreBtn');
  1154. var moreText = document.getElementById('marketingMoreText');
  1155. if (!section || !listEl) return;
  1156. listEl.innerHTML = '';
  1157. section.classList.remove('is-expanded');
  1158. if (moreBtn) {
  1159. moreBtn.style.display = 'none';
  1160. moreBtn.setAttribute('aria-expanded', 'false');
  1161. }
  1162. if (closedMerchantFlag) {
  1163. section.style.display = 'none';
  1164. section.setAttribute('aria-hidden', 'true');
  1165. return;
  1166. }
  1167. var items = marketingListCache.filter(function (x) {
  1168. return x && x.imgUrl && String(x.imgUrl).trim();
  1169. }).filter(function (x) {
  1170. var t = x.activityType;
  1171. if (t == null || t === '') return true;
  1172. return String(t).toUpperCase() === 'MARKETING';
  1173. });
  1174. items.sort(function (a, b) {
  1175. var sa = Number(a.imgSort);
  1176. var sb = Number(b.imgSort);
  1177. if (isNaN(sa)) sa = 0;
  1178. if (isNaN(sb)) sb = 0;
  1179. return sa - sb;
  1180. });
  1181. if (!items.length) {
  1182. if (!marketingCouponLoaded) {
  1183. section.style.display = 'none';
  1184. section.setAttribute('aria-hidden', 'true');
  1185. return;
  1186. }
  1187. section.style.display = 'block';
  1188. section.setAttribute('aria-hidden', 'false');
  1189. var emptyWrap = document.createElement('div');
  1190. emptyWrap.className = 'marketing-section__empty';
  1191. emptyWrap.setAttribute('role', 'status');
  1192. var emptyImg = document.createElement('img');
  1193. emptyImg.src = 'images/empty.png';
  1194. emptyImg.alt = '';
  1195. emptyImg.decoding = 'async';
  1196. var emptyLabel = document.createElement('p');
  1197. emptyLabel.className = 'marketing-section__empty-label';
  1198. emptyLabel.textContent = '暂无活动';
  1199. emptyWrap.appendChild(emptyImg);
  1200. emptyWrap.appendChild(emptyLabel);
  1201. listEl.appendChild(emptyWrap);
  1202. return;
  1203. }
  1204. section.style.display = 'block';
  1205. section.setAttribute('aria-hidden', 'false');
  1206. items.forEach(function (item, idx) {
  1207. var card = document.createElement('article');
  1208. card.className = 'marketing-card';
  1209. if (idx >= MARKETING_PREVIEW_COUNT) card.classList.add('marketing-card--more');
  1210. card.appendChild(createMarketingMedia(item.imgUrl));
  1211. listEl.appendChild(card);
  1212. });
  1213. var extra = items.length - MARKETING_PREVIEW_COUNT;
  1214. if (extra > 0 && moreBtn && moreText) {
  1215. moreText.textContent = '查看剩余' + extra + '个活动';
  1216. moreBtn.style.display = 'flex';
  1217. }
  1218. }
  1219. function bindMarketingMore() {
  1220. var section = document.getElementById('shareMarketingSection');
  1221. var moreBtn = document.getElementById('marketingMoreBtn');
  1222. if (!section || !moreBtn || moreBtn.dataset.bound) return;
  1223. moreBtn.dataset.bound = '1';
  1224. moreBtn.addEventListener('click', function () {
  1225. section.classList.add('is-expanded');
  1226. moreBtn.style.display = 'none';
  1227. moreBtn.setAttribute('aria-expanded', 'true');
  1228. });
  1229. }
  1230. function createStaffCardElement(staff) {
  1231. var card = document.createElement('article');
  1232. card.className = 'staff-card';
  1233. var imgWrap = document.createElement('div');
  1234. imgWrap.className = 'staff-card__img-wrap';
  1235. var imgUrl = String(staff.staffImage || '').trim();
  1236. if (imgUrl) {
  1237. var img = document.createElement('img');
  1238. img.src = imgUrl;
  1239. img.alt = String(staff.name || '');
  1240. img.decoding = 'async';
  1241. img.loading = 'lazy';
  1242. imgWrap.appendChild(img);
  1243. }
  1244. var likes = document.createElement('div');
  1245. likes.className = 'staff-card__likes';
  1246. var lc = staff.likeCount != null ? Number(staff.likeCount) : 0;
  1247. if (isNaN(lc)) lc = 0;
  1248. likes.textContent = lc + '人喜欢';
  1249. imgWrap.appendChild(likes);
  1250. var nameRow = document.createElement('div');
  1251. nameRow.className = 'staff-card__name-row';
  1252. var nameEl = document.createElement('span');
  1253. nameEl.className = 'staff-card__name';
  1254. nameEl.textContent = String(staff.name != null ? staff.name : '').trim() || '—';
  1255. nameRow.appendChild(nameEl);
  1256. var perf = staff.hasPerformanceToday;
  1257. if (perf === true || perf === 1 || String(perf).toLowerCase() === 'true') {
  1258. var badge = document.createElement('span');
  1259. badge.className = 'staff-card__badge';
  1260. badge.textContent = '今日演出';
  1261. nameRow.appendChild(badge);
  1262. }
  1263. card.appendChild(imgWrap);
  1264. card.appendChild(nameRow);
  1265. var meta = document.createElement('div');
  1266. meta.className = 'staff-card__meta';
  1267. var pos = document.createElement('span');
  1268. pos.className = 'staff-card__position';
  1269. pos.textContent = String(staff.staffPosition || '').trim() || '\u00a0';
  1270. meta.appendChild(pos);
  1271. var pc = staff.positiveCommentsCount != null ? Number(staff.positiveCommentsCount) : 0;
  1272. if (!isNaN(pc) && pc > 0) {
  1273. var sep = document.createElement('span');
  1274. sep.className = 'staff-card__sep';
  1275. sep.textContent = '|';
  1276. var rev = document.createElement('span');
  1277. rev.className = 'staff-card__reviews';
  1278. rev.textContent = '好评' + pc + '次';
  1279. meta.appendChild(sep);
  1280. meta.appendChild(rev);
  1281. }
  1282. card.appendChild(meta);
  1283. return card;
  1284. }
  1285. function createPerformanceCardElement(row) {
  1286. var card = document.createElement('article');
  1287. card.className = 'performance-card';
  1288. var posterWrap = document.createElement('div');
  1289. posterWrap.className = 'performance-card__poster';
  1290. var posterUrl = String(row.performancePoster || '').trim();
  1291. if (posterUrl) {
  1292. var img = document.createElement('img');
  1293. img.src = posterUrl;
  1294. img.alt = String(row.performanceName || '');
  1295. img.decoding = 'async';
  1296. img.loading = 'lazy';
  1297. posterWrap.appendChild(img);
  1298. }
  1299. var body = document.createElement('div');
  1300. body.className = 'performance-card__body';
  1301. var nameEl = document.createElement('div');
  1302. nameEl.className = 'performance-card__name';
  1303. nameEl.textContent = String(row.performanceName != null ? row.performanceName : '').trim() || '—';
  1304. body.appendChild(nameEl);
  1305. var dr = String(row.dateRange || '').trim();
  1306. if (dr) {
  1307. var line1 = document.createElement('div');
  1308. line1.className = 'performance-card__meta';
  1309. line1.textContent = dr;
  1310. body.appendChild(line1);
  1311. }
  1312. var si = String(row.scheduleInfo || '').trim();
  1313. if (si) {
  1314. var line2 = document.createElement('div');
  1315. line2.className = 'performance-card__meta';
  1316. line2.textContent = si;
  1317. line2.title = si;
  1318. body.appendChild(line2);
  1319. }
  1320. card.appendChild(posterWrap);
  1321. card.appendChild(body);
  1322. return card;
  1323. }
  1324. function renderPerformanceList() {
  1325. var section = document.getElementById('sharePerformanceSection');
  1326. var titleEl = document.getElementById('performanceSectionTitle');
  1327. var strip = document.getElementById('performanceStripEl');
  1328. if (!section || !titleEl || !strip) return;
  1329. strip.innerHTML = '';
  1330. if (!shouldShowPerformanceSection()) {
  1331. section.style.display = 'none';
  1332. section.setAttribute('aria-hidden', 'true');
  1333. return;
  1334. }
  1335. if (closedMerchantFlag) {
  1336. section.style.display = 'none';
  1337. section.setAttribute('aria-hidden', 'true');
  1338. return;
  1339. }
  1340. var records = performanceListCache.records;
  1341. var total = performanceListCache.total;
  1342. if (isNaN(total)) total = records.length;
  1343. titleEl.textContent = '演出安排(' + total + ')';
  1344. if (!records.length) {
  1345. section.style.display = 'none';
  1346. section.setAttribute('aria-hidden', 'true');
  1347. return;
  1348. }
  1349. section.style.display = 'block';
  1350. section.setAttribute('aria-hidden', 'false');
  1351. records.forEach(function (row) {
  1352. if (!row) return;
  1353. strip.appendChild(createPerformanceCardElement(row));
  1354. });
  1355. }
  1356. function renderStaffGroups(raw) {
  1357. staffGroupsCache = Array.isArray(raw) ? raw.slice() : [];
  1358. var section = document.getElementById('shareStaffSection');
  1359. var mount = document.getElementById('staffGroupsMount');
  1360. if (!section || !mount) return;
  1361. var totalStaff = 0;
  1362. staffGroupsCache.forEach(function (g) {
  1363. if (g && Array.isArray(g.staffList)) totalStaff += g.staffList.length;
  1364. });
  1365. var countEl = document.getElementById('staffSectionCountEl');
  1366. if (countEl) countEl.textContent = String(totalStaff);
  1367. mount.innerHTML = '';
  1368. if (closedMerchantFlag) {
  1369. section.style.display = 'none';
  1370. section.setAttribute('aria-hidden', 'true');
  1371. return;
  1372. }
  1373. var groups = staffGroupsCache.filter(function (g) {
  1374. return g && Array.isArray(g.staffList) && g.staffList.length;
  1375. });
  1376. if (!groups.length) {
  1377. section.style.display = 'none';
  1378. section.setAttribute('aria-hidden', 'true');
  1379. return;
  1380. }
  1381. section.style.display = 'block';
  1382. section.setAttribute('aria-hidden', 'false');
  1383. groups.forEach(function (group) {
  1384. var wrap = document.createElement('div');
  1385. wrap.className = 'staff-group';
  1386. if (group.titleId != null) wrap.dataset.titleId = String(group.titleId);
  1387. var strip = document.createElement('div');
  1388. strip.className = 'staff-strip';
  1389. group.staffList.forEach(function (staff) {
  1390. if (!staff) return;
  1391. strip.appendChild(createStaffCardElement(staff));
  1392. });
  1393. wrap.appendChild(strip);
  1394. mount.appendChild(wrap);
  1395. });
  1396. }
  1397. function bindStaffSection() {
  1398. var btn = document.getElementById('staffSectionAllBtn');
  1399. if (!btn || btn.dataset.bound) return;
  1400. btn.dataset.bound = '1';
  1401. btn.addEventListener('click', function (e) {
  1402. e.preventDefault();
  1403. tryOpenHBuilderApp();
  1404. });
  1405. }
  1406. function buildHeroSlides(urls) {
  1407. var track = document.getElementById('heroTrack');
  1408. var dotsWrap = document.getElementById('heroDots');
  1409. track.innerHTML = '';
  1410. dotsWrap.innerHTML = '';
  1411. var list = (urls || []).filter(Boolean);
  1412. if (!list.length) {
  1413. var slide = document.createElement('div');
  1414. slide.className = 'hero__slide';
  1415. var img = document.createElement('img');
  1416. img.src = 'images/hero.png';
  1417. img.alt = '店铺';
  1418. slide.appendChild(img);
  1419. track.appendChild(slide);
  1420. var dot = document.createElement('span');
  1421. dot.className = 'hero__dot is-active';
  1422. dotsWrap.appendChild(dot);
  1423. return initHeroCarousel(1);
  1424. }
  1425. list.forEach(function (url, d) {
  1426. var slide = document.createElement('div');
  1427. slide.className = 'hero__slide';
  1428. var img = document.createElement('img');
  1429. img.src = url;
  1430. img.alt = '店铺图';
  1431. slide.appendChild(img);
  1432. track.appendChild(slide);
  1433. var dot = document.createElement('span');
  1434. dot.className = 'hero__dot' + (d === 0 ? ' is-active' : '');
  1435. dotsWrap.appendChild(dot);
  1436. });
  1437. initHeroCarousel(list.length);
  1438. }
  1439. var heroI = 0;
  1440. var heroTimer = null;
  1441. function initHeroCarousel(slides) {
  1442. var track = document.getElementById('heroTrack');
  1443. var dotsWrap = document.getElementById('heroDots');
  1444. var dots = dotsWrap.querySelectorAll('.hero__dot');
  1445. if (slides < 2) return;
  1446. function go(n) {
  1447. heroI = (n + slides) % slides;
  1448. track.style.transform = 'translateX(' + (-heroI * 100) + '%)';
  1449. dots.forEach(function (el, idx) {
  1450. el.classList.toggle('is-active', idx === heroI);
  1451. });
  1452. }
  1453. if (heroTimer) clearInterval(heroTimer);
  1454. heroTimer = setInterval(function () { go(heroI + 1); }, 4000);
  1455. var hero = document.getElementById('hero');
  1456. var startX = 0;
  1457. hero.addEventListener('touchstart', function (e) {
  1458. startX = e.changedTouches[0].clientX;
  1459. }, { passive: true });
  1460. hero.addEventListener('touchend', function (e) {
  1461. var dx = e.changedTouches[0].clientX - startX;
  1462. if (Math.abs(dx) > 40) go(dx < 0 ? heroI + 1 : heroI - 1);
  1463. }, { passive: true });
  1464. }
  1465. function timeToMinutes(t) {
  1466. var parts = String(t || '').trim().split(':');
  1467. var h = parseInt(parts[0], 10) || 0;
  1468. var m = parseInt(parts[1], 10) || 0;
  1469. return h * 60 + m;
  1470. }
  1471. function isTimeInRange(startTime, endTime) {
  1472. var s = String(startTime || '').trim();
  1473. var e = String(endTime || '').trim();
  1474. if (s === '00:00' && e === '00:00') return true;
  1475. if (s === '00:00' && e === '23:59') return true;
  1476. var cur = new Date().getHours() * 60 + new Date().getMinutes();
  1477. var sm = timeToMinutes(s);
  1478. var em = timeToMinutes(e);
  1479. if (em < sm) {
  1480. return cur >= sm || cur <= em;
  1481. }
  1482. return cur >= sm && cur <= em;
  1483. }
  1484. function parseHolidayDate(str) {
  1485. if (!str) return null;
  1486. var d = new Date(String(str).trim().replace(/-/g, '/'));
  1487. return isNaN(d.getTime()) ? null : d;
  1488. }
  1489. function isTodayInHolidayRange(holidayInfo) {
  1490. if (!holidayInfo) return false;
  1491. var hi = holidayInfo;
  1492. if (typeof hi === 'string') {
  1493. try {
  1494. hi = JSON.parse(hi);
  1495. } catch (err) {
  1496. return false;
  1497. }
  1498. }
  1499. var start = hi.startDate || hi.holidayStartDate || hi.beginDate || hi.start || hi.holidayStart;
  1500. var end = hi.endDate || hi.holidayEndDate || hi.finishDate || hi.end || hi.holidayEnd;
  1501. if (!start || !end) return false;
  1502. var startD = parseHolidayDate(start);
  1503. var endD = parseHolidayDate(end);
  1504. if (!startD || !endD) return false;
  1505. var today = new Date();
  1506. today.setHours(0, 0, 0, 0);
  1507. startD.setHours(0, 0, 0, 0);
  1508. endD.setHours(0, 0, 0, 0);
  1509. return today >= startD && today <= endD;
  1510. }
  1511. function findNormalBusinessInfo(list) {
  1512. var wdJs = new Date().getDay();
  1513. var i;
  1514. var x;
  1515. var w;
  1516. for (i = 0; i < list.length; i++) {
  1517. x = list[i];
  1518. if (!x || x.holidayInfo) continue;
  1519. w = x.weekDay != null ? x.weekDay : x.week;
  1520. if (w === undefined || w === null) continue;
  1521. if (Number(w) === wdJs) return x;
  1522. }
  1523. var wdMap = wdJs === 0 ? 7 : wdJs;
  1524. for (i = 0; i < list.length; i++) {
  1525. x = list[i];
  1526. if (!x || x.holidayInfo) continue;
  1527. w = x.weekDay != null ? x.weekDay : x.week;
  1528. if (w === undefined || w === null) continue;
  1529. if (Number(w) === wdMap) return x;
  1530. }
  1531. for (i = 0; i < list.length; i++) {
  1532. x = list[i];
  1533. if (x && !x.holidayInfo && (x.startTime || x.endTime)) return x;
  1534. }
  1535. return null;
  1536. }
  1537. /** 营业状态:暂停营业 | 商家暂未配置营业时间 | 休息中 | 营业中 xx:xx至xx:xx | 营业中 全天营业 */
  1538. function computeBusinessStatusDisplay(d) {
  1539. if (!d) return { text: '—', isOpen: false };
  1540. if (Number(d.businessStatus) === 99) {
  1541. return { text: '商户已关闭', isOpen: false };
  1542. }
  1543. if (Number(d.businessStatus) === 1) {
  1544. return { text: '暂停营业', isOpen: false };
  1545. }
  1546. var list = d.storeBusinessInfoVos || d.storeBusinessInfos || [];
  1547. if (!list.length) {
  1548. return { text: '商家暂未配置营业时间', isOpen: false };
  1549. }
  1550. var holidayList = Array.isArray(d.holidayBusinessInfoList) && d.holidayBusinessInfoList.length
  1551. ? d.holidayBusinessInfoList
  1552. : list.filter(function (item) { return item && item.holidayInfo; });
  1553. var todayHolidayItem = holidayList.find(function (item) {
  1554. return isTodayInHolidayRange(item.holidayInfo);
  1555. });
  1556. var normal = d.normalBusinessInfo || d.normalBusinessInfoVo || findNormalBusinessInfo(list);
  1557. var isOpen = false;
  1558. var currentItem = null;
  1559. if (todayHolidayItem) {
  1560. isOpen = isTimeInRange(todayHolidayItem.startTime, todayHolidayItem.endTime);
  1561. currentItem = todayHolidayItem;
  1562. } else if (normal) {
  1563. isOpen = isTimeInRange(normal.startTime, normal.endTime);
  1564. currentItem = normal;
  1565. }
  1566. if (!currentItem) return { text: '休息中', isOpen: false };
  1567. if (!isOpen) return { text: '休息中', isOpen: false };
  1568. var st = String(currentItem.startTime || '').trim();
  1569. var et = String(currentItem.endTime || '').trim();
  1570. if (st === '00:00' && et === '00:00') return { text: '营业中 全天营业', isOpen: true };
  1571. if (st === '00:00' && et === '23:59') return { text: '营业中 全天营业', isOpen: true };
  1572. var needNextDay = timeToMinutes(et) < timeToMinutes(st);
  1573. var suffix = (needNextDay ? '次日' : '') + et;
  1574. return { text: ('营业中 ' + st + ' 至 ' + suffix).trim(), isOpen: true };
  1575. }
  1576. /**
  1577. * 分项评分:可能在 storeEvaluate 对象内,或为 JSON 字符串;部分接口把字段放在详情根上。
  1578. */
  1579. function parseStoreEvaluateRaw(raw) {
  1580. if (raw == null || raw === '') return null;
  1581. if (typeof raw === 'string') {
  1582. var t = raw.trim();
  1583. if (!t) return null;
  1584. try {
  1585. raw = JSON.parse(t);
  1586. } catch (e) {
  1587. return null;
  1588. }
  1589. }
  1590. if (Array.isArray(raw) && raw.length && raw[0] && typeof raw[0] === 'object') {
  1591. raw = raw[0];
  1592. }
  1593. if (raw && typeof raw === 'object' && !Array.isArray(raw)) return raw;
  1594. return null;
  1595. }
  1596. function getStoreEvaluateScores(d) {
  1597. var ev = parseStoreEvaluateRaw(d.storeEvaluate)
  1598. || parseStoreEvaluateRaw(d.evaluate)
  1599. || parseStoreEvaluateRaw(d.evaluateInfo);
  1600. function lane(key, snake) {
  1601. var v;
  1602. if (ev && ev[key] != null && ev[key] !== '') v = ev[key];
  1603. else if (d[key] != null && d[key] !== '') v = d[key];
  1604. else if (snake && d[snake] != null && d[snake] !== '') v = d[snake];
  1605. else return null;
  1606. var n = Number(v);
  1607. return !isNaN(n) ? n : null;
  1608. }
  1609. return {
  1610. scoreOne: lane('scoreOne', 'score_one'),
  1611. scoreTwo: lane('scoreTwo', 'score_two'),
  1612. scoreThree: lane('scoreThree', 'score_three')
  1613. };
  1614. }
  1615. function fmtEvalScore(n) {
  1616. return n != null && !isNaN(n) ? Number(n).toFixed(1) : null;
  1617. }
  1618. var CLOSED_REC_STAR_PATH =
  1619. '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';
  1620. function closedRecEscHtml(s) {
  1621. return String(s == null ? '' : s)
  1622. .replace(/&/g, '&amp;')
  1623. .replace(/</g, '&lt;')
  1624. .replace(/>/g, '&gt;')
  1625. .replace(/"/g, '&quot;');
  1626. }
  1627. function closedRecStarsHtml(score) {
  1628. var s = Number(score);
  1629. if (isNaN(s)) s = 0;
  1630. s = Math.max(0, Math.min(5, s));
  1631. var rounded = Math.round(s);
  1632. var parts = [];
  1633. var i;
  1634. for (i = 1; i <= 5; i++) {
  1635. var fill = i <= rounded ? '#F58220' : '#E5E5E5';
  1636. parts.push(
  1637. '<svg class="closed-rec-star" width="11" height="11" viewBox="0 0 24 24" aria-hidden="true">' +
  1638. '<path fill="' + fill + '" d="' + CLOSED_REC_STAR_PATH + '"/></svg>'
  1639. );
  1640. }
  1641. return '<span class="closed-rec-stars">' + parts.join('') + '</span>';
  1642. }
  1643. function closedRecFormatDistance(item) {
  1644. if (item.distance != null && item.distance !== '') {
  1645. var km = Number(item.distance);
  1646. if (!isNaN(km) && km >= 0) {
  1647. return Math.round(km * 1000) + '米';
  1648. }
  1649. return String(item.distance).trim();
  1650. }
  1651. if (item.position != null && String(item.position).trim() !== '') {
  1652. return String(item.position).trim();
  1653. }
  1654. if (item.dist != null && item.dist !== '') {
  1655. var dn = Number(item.dist);
  1656. if (!isNaN(dn)) {
  1657. return dn >= 1 ? dn.toFixed(dn % 1 === 0 ? 0 : 1) + 'km' : Math.round(dn * 1000) + '米';
  1658. }
  1659. }
  1660. return '';
  1661. }
  1662. function closedRecPickScore(item) {
  1663. var x =
  1664. item.scoreAvg != null ? Number(item.scoreAvg)
  1665. : item.score != null ? Number(item.score)
  1666. : item.rating != null ? Number(item.rating)
  1667. : item.starScore != null ? Number(item.starScore)
  1668. : NaN;
  1669. return isNaN(x) ? null : x;
  1670. }
  1671. function closedRecPickReviewCount(item) {
  1672. var n =
  1673. item.commitCount != null ? Number(item.commitCount)
  1674. : item.commentCount != null ? Number(item.commentCount)
  1675. : item.reviewCount != null ? Number(item.reviewCount)
  1676. : item.evaluateCount != null ? Number(item.evaluateCount)
  1677. : NaN;
  1678. return isNaN(n) ? 0 : Math.max(0, Math.floor(n));
  1679. }
  1680. function normalizeClosedStoreRecommendList(res) {
  1681. if (!res || typeof res !== 'object') return [];
  1682. var raw = res.data != null ? res.data : res.result;
  1683. if (Array.isArray(raw)) return raw;
  1684. if (raw && typeof raw === 'object') {
  1685. if (Array.isArray(raw.list)) return raw.list;
  1686. if (Array.isArray(raw.records)) return raw.records;
  1687. if (Array.isArray(raw.rows)) return raw.rows;
  1688. if (Array.isArray(raw.content)) return raw.content;
  1689. if (Array.isArray(raw.stores)) return raw.stores;
  1690. if (Array.isArray(raw.storeList)) return raw.storeList;
  1691. if (Array.isArray(raw.storeVos)) return raw.storeVos;
  1692. if (Array.isArray(raw.items)) return raw.items;
  1693. }
  1694. if (Array.isArray(res.list)) return res.list;
  1695. if (Array.isArray(res.records)) return res.records;
  1696. return [];
  1697. }
  1698. function fetchShareClosedStoreRecommend(storeIdStr) {
  1699. var latRaw = (q('userLat') || q('latitude') || q('lat') || q('weidu')).trim();
  1700. var lngRaw = (q('userLng') || q('longitude') || q('lon') || q('jingdu')).trim();
  1701. var userLat =
  1702. latRaw !== '' && !isNaN(Number(latRaw)) ? Number(latRaw) : DEFAULT_REC_USER_LAT;
  1703. var userLng =
  1704. lngRaw !== '' && !isNaN(Number(lngRaw)) ? Number(lngRaw) : DEFAULT_REC_USER_LNG;
  1705. var page = parseInt(q('page') || '1', 10);
  1706. var pageSize = parseInt(q('pageSize') || '10', 10);
  1707. if (isNaN(page) || page < 1) page = 1;
  1708. if (isNaN(pageSize) || pageSize < 1) pageSize = 10;
  1709. var userCityRaw = (q('userCity') || q('city') || '').trim();
  1710. var userCity = userCityRaw !== '' ? userCityRaw : DEFAULT_REC_USER_CITY;
  1711. var body = {
  1712. page: page,
  1713. pageSize: pageSize,
  1714. storeId: String(storeIdStr || ''),
  1715. userCity: userCity,
  1716. userLat: userLat,
  1717. userLng: userLng
  1718. };
  1719. return fetch(API_LIFE_AI_BASE + STORE_GLOBAL_RECOMMEND_PATH, {
  1720. method: 'POST',
  1721. mode: 'cors',
  1722. credentials: 'omit',
  1723. headers: {
  1724. Accept: 'application/json',
  1725. 'Content-Type': 'application/json;charset=UTF-8'
  1726. },
  1727. body: JSON.stringify(body)
  1728. }).then(function (res) {
  1729. if (!res.ok) throw new Error('HTTP ' + res.status);
  1730. return res.json();
  1731. });
  1732. }
  1733. function renderShareClosedRecommended(list) {
  1734. var wrap = document.getElementById('shareClosedRecList');
  1735. var empty = document.getElementById('shareClosedRecEmpty');
  1736. if (!wrap || !empty) return;
  1737. wrap.querySelectorAll('.closed-rec-card').forEach(function (n) {
  1738. n.remove();
  1739. });
  1740. if (!list || !list.length) {
  1741. empty.style.display = 'block';
  1742. return;
  1743. }
  1744. empty.style.display = 'none';
  1745. list.forEach(function (item) {
  1746. if (!item || typeof item !== 'object') return;
  1747. var imgUrlField = item.imgUrl != null ? String(item.imgUrl).trim() : '';
  1748. var home = item.homeImage != null ? String(item.homeImage).trim() : '';
  1749. if (home && /\.mp4(\?|#|$)/i.test(home)) {
  1750. var vf = item.videoFirstFrame != null ? String(item.videoFirstFrame).trim() : '';
  1751. if (vf) home = vf;
  1752. }
  1753. var imgUrl =
  1754. imgUrlField ||
  1755. home ||
  1756. (item.coverUrl != null ? String(item.coverUrl).trim() : '') ||
  1757. (item.mainImage != null ? String(item.mainImage).trim() : '') ||
  1758. (item.goodsImage != null ? String(item.goodsImage).trim() : '') ||
  1759. (item.entranceImage != null ? String(item.entranceImage).trim() : '') ||
  1760. (Array.isArray(item.goodsImageList) && item.goodsImageList[0]) ||
  1761. (Array.isArray(item.imageList) && item.imageList[0]) ||
  1762. (Array.isArray(item.storeAlbumUrlList) && item.storeAlbumUrlList[0]) ||
  1763. '';
  1764. var name = item.title != null && String(item.title).trim() !== ''
  1765. ? String(item.title).replace(/\r?\n/g, ' ').replace(/\s+/g, ' ').trim()
  1766. : (item.storeName || item.goodsName || item.secondGoodsTitle || item.name || '推荐');
  1767. var dist = closedRecFormatDistance(item);
  1768. var scoreVal = closedRecPickScore(item);
  1769. var displayScore = scoreVal != null ? scoreVal.toFixed(1) : '—';
  1770. var starScore = scoreVal != null ? scoreVal : 0;
  1771. var rc = closedRecPickReviewCount(item);
  1772. var reviewLabel = rc > 0 ? rc + '条评价' : '';
  1773. var seller =
  1774. item.userName != null && String(item.userName).trim() !== ''
  1775. ? String(item.userName).trim()
  1776. : (item.nickName != null && String(item.nickName).trim() !== ''
  1777. ? String(item.nickName).trim()
  1778. : '');
  1779. var card = document.createElement('article');
  1780. card.className = 'closed-rec-card';
  1781. card.innerHTML =
  1782. '<div class="closed-rec-card__img"><img class="closed-rec-card__cover" src="" alt="" decoding="async"></div>' +
  1783. '<div class="closed-rec-card__body">' +
  1784. '<div class="closed-rec-card__top">' +
  1785. '<span class="closed-rec-card__name">' + closedRecEscHtml(name) + '</span>' +
  1786. (dist ? '<span class="closed-rec-card__dist">' + closedRecEscHtml(dist) + '</span>' : '') +
  1787. '</div>' +
  1788. '<div class="closed-rec-card__rating">' +
  1789. closedRecStarsHtml(starScore) +
  1790. '<span class="closed-rec-rating-num">' + closedRecEscHtml(displayScore) + '</span>' +
  1791. (reviewLabel ? '<span class="closed-rec-meta">' + closedRecEscHtml(reviewLabel) + '</span>' : '') +
  1792. '</div>' +
  1793. (seller ? '<div class="closed-rec-card__footer">' + closedRecEscHtml(seller) + '</div>' : '') +
  1794. '</div>';
  1795. var coverIm = card.querySelector('img.closed-rec-card__cover');
  1796. if (coverIm) {
  1797. coverIm.src = imgUrl;
  1798. coverIm.onerror = function () {
  1799. this.onerror = null;
  1800. this.src = '';
  1801. };
  1802. }
  1803. wrap.appendChild(card);
  1804. });
  1805. }
  1806. function loadShareClosedRecommendations() {
  1807. var sid = getStoreId();
  1808. if (!sid) {
  1809. renderShareClosedRecommended([]);
  1810. return;
  1811. }
  1812. fetchShareClosedStoreRecommend(sid)
  1813. .then(function (res) {
  1814. var list = normalizeClosedStoreRecommendList(res);
  1815. if (!list.length && res && res.msg) {
  1816. console.warn('[store-recommend]', res.msg);
  1817. }
  1818. renderShareClosedRecommended(list);
  1819. })
  1820. .catch(function (e) {
  1821. console.error(e);
  1822. renderShareClosedRecommended([]);
  1823. });
  1824. }
  1825. function applyShareIndexClosedMerchantUi(closed) {
  1826. var wasClosed = closedMerchantFlag;
  1827. closedMerchantFlag = closed;
  1828. var banner = document.getElementById('shareClosedBanner');
  1829. var contentEl = document.getElementById('shareContentEl');
  1830. var belowEl = document.getElementById('shareBelowContentEl');
  1831. var recWrap = document.getElementById('shareClosedRecommendWrap');
  1832. if (banner) {
  1833. banner.style.display = closed ? 'block' : 'none';
  1834. banner.setAttribute('aria-hidden', closed ? 'false' : 'true');
  1835. }
  1836. if (contentEl) {
  1837. contentEl.style.display = closed ? 'none' : '';
  1838. contentEl.setAttribute('aria-hidden', closed ? 'true' : 'false');
  1839. }
  1840. if (belowEl) {
  1841. belowEl.style.display = '';
  1842. belowEl.setAttribute('aria-hidden', 'false');
  1843. }
  1844. if (recWrap) {
  1845. if (closed) {
  1846. recWrap.style.display = 'block';
  1847. recWrap.setAttribute('aria-hidden', 'false');
  1848. if (!wasClosed) {
  1849. loadShareClosedRecommendations();
  1850. }
  1851. } else {
  1852. recWrap.style.display = 'none';
  1853. recWrap.setAttribute('aria-hidden', 'true');
  1854. renderShareClosedRecommended([]);
  1855. }
  1856. }
  1857. }
  1858. function renderDetail(d) {
  1859. if (!d) return;
  1860. document.getElementById('storeName').textContent = d.storeName || '—';
  1861. var score = d.scoreAvg != null ? Number(d.scoreAvg) : NaN;
  1862. document.getElementById('scoreAvg').textContent = !isNaN(score) ? score.toFixed(1) : '—';
  1863. document.getElementById('commitCount').textContent = d.commitCount != null ? String(d.commitCount)+'条' : '0';
  1864. var evRow = document.getElementById('storeEvaluateRow');
  1865. var evOne = document.getElementById('storeEvaluateScoreOne');
  1866. var evTwo = document.getElementById('storeEvaluateScoreTwo');
  1867. var evThree = document.getElementById('storeEvaluateScoreThree');
  1868. if (evRow && evOne && evTwo && evThree) {
  1869. evRow.classList.remove('is-visible');
  1870. evRow.setAttribute('aria-hidden', 'true');
  1871. var es = getStoreEvaluateScores(d);
  1872. var a = fmtEvalScore(es.scoreOne);
  1873. var b = fmtEvalScore(es.scoreTwo);
  1874. var c = fmtEvalScore(es.scoreThree);
  1875. if (a !== null || b !== null || c !== null) {
  1876. evOne.textContent = a !== null ? a : '—';
  1877. evTwo.textContent = b !== null ? b : '—';
  1878. evThree.textContent = c !== null ? c : '—';
  1879. evRow.classList.add('is-visible');
  1880. evRow.setAttribute('aria-hidden', 'false');
  1881. }
  1882. }
  1883. var bizDisp = computeBusinessStatusDisplay(d);
  1884. var bizEl = document.getElementById('bizStatus');
  1885. bizEl.textContent = bizDisp.text;
  1886. bizEl.className = 'status' + (bizDisp.isOpen ? ' is-open' : '');
  1887. document.getElementById('hoursText').textContent = '';
  1888. document.getElementById('storeAddr').textContent = d.queryAddress || d.storeAddress || '—';
  1889. if (d.distance != null) {
  1890. document.getElementById('metaDistance').style.display = 'flex';
  1891. document.getElementById('distanceText').textContent =
  1892. '距您' + (Number(d.distance) > 1 ? d.distance + '千米' : Math.round(Number(d.distance) * 1000) + '米');
  1893. }
  1894. if (d.subwayName && d.distance2 != null) {
  1895. document.getElementById('metaSubway').style.display = 'flex';
  1896. document.getElementById('subwayText').textContent =
  1897. '距' + d.subwayName + '步行' + (Number(d.distance2) >= 1000
  1898. ? (Number(d.distance2) / 1000).toFixed(1) + 'km'
  1899. : Math.round(Number(d.distance2)) + 'm');
  1900. }
  1901. var imgs = [];
  1902. if (Array.isArray(d.storeAlbumUrlList) && d.storeAlbumUrlList.length) imgs = d.storeAlbumUrlList.slice();
  1903. else if (d.entranceImage) imgs = [d.entranceImage];
  1904. buildHeroSlides(imgs);
  1905. var closedMerchant = Number(d.businessStatus) === 99;
  1906. applyShareIndexClosedMerchantUi(closedMerchant);
  1907. renderMarketingList(marketingListCache);
  1908. renderPerformanceList();
  1909. renderStaffGroups(staffGroupsCache);
  1910. }
  1911. function getLngForApi() {
  1912. var v = q('jingdu');
  1913. if (v) return v;
  1914. return q('lon') || q('lng') || q('longitude');
  1915. }
  1916. function getLatForApi() {
  1917. var v = q('weidu');
  1918. if (v) return v;
  1919. return q('lat') || q('latitude');
  1920. }
  1921. function mergeSearchAndHashParamsForRedirect() {
  1922. var params = new URLSearchParams();
  1923. function ingest(slice) {
  1924. if (!slice) return;
  1925. var p = new URLSearchParams(slice);
  1926. p.forEach(function (val, key) {
  1927. params.set(key, val);
  1928. });
  1929. }
  1930. if (location.search && location.search.length > 1) {
  1931. ingest(location.search.slice(1));
  1932. }
  1933. var hash = location.hash || '';
  1934. var qi = hash.indexOf('?');
  1935. if (qi >= 0) {
  1936. ingest(hash.slice(qi + 1));
  1937. }
  1938. return params;
  1939. }
  1940. /** getClientStoreDetail 无承载数据时进 shareCheckInUndefined(businessStatus=99 与落地页约定一致) */
  1941. function buildShareCheckInUndefinedRedirectHref() {
  1942. var p = mergeSearchAndHashParamsForRedirect();
  1943. p.set('businessStatus', '99');
  1944. var sid = getStoreId();
  1945. if (sid && !p.has('storeId')) {
  1946. p.set('storeId', sid);
  1947. }
  1948. var j = getLngForApi();
  1949. var w = getLatForApi();
  1950. if (j && !p.has('userLng')) {
  1951. p.set('userLng', j);
  1952. }
  1953. if (w && !p.has('userLat')) {
  1954. p.set('userLat', w);
  1955. }
  1956. var qs = p.toString();
  1957. return 'shareCheckInUndefined.html' + (qs ? ('?' + qs) : '?businessStatus=99');
  1958. }
  1959. function run() {
  1960. var sid = getStoreId();
  1961. var userId = q('userId');
  1962. var jingdu = getLngForApi();
  1963. var weidu = getLatForApi();
  1964. if (!sid) {
  1965. showErr('缺少店铺 id(请从 App 分享链接打开,URL 需带 id 或 storeId)');
  1966. document.getElementById('storeName').textContent = '参数错误';
  1967. return;
  1968. }
  1969. var detailPath = '/store/info/getClientStoreDetail?' +
  1970. 'id=' + encodeURIComponent(sid) +
  1971. '&userId=' + encodeURIComponent(userId) +
  1972. '&jingdu=' + encodeURIComponent(jingdu) +
  1973. '&weidu=' + encodeURIComponent(weidu);
  1974. fetchStoreInfoGetOne(sid).then(function (getOneRes) {
  1975. if (isGetOneBusinessStatus99(getOneRes)) {
  1976. applyShareIndexClosedMerchantUi(true);
  1977. }
  1978. apiFetch(detailPath)
  1979. .then(function (res) {
  1980. var tip = res && res.msg != null ? String(res.msg).trim() : '';
  1981. if (tip === '暂无承载数据') {
  1982. if (closedMerchantFlag) {
  1983. return;
  1984. }
  1985. window.location.replace(buildShareCheckInUndefinedRedirectHref());
  1986. return;
  1987. }
  1988. if (res.code !== 200 || !res.data) {
  1989. showErr(res.msg || '店铺详情加载失败');
  1990. return;
  1991. }
  1992. renderDetail(res.data);
  1993. })
  1994. .catch(function (e) {
  1995. console.error(e);
  1996. showErr('店铺详情请求失败(若为 file:// 打开,请检查 CORS 或改用 http 访问本页)');
  1997. });
  1998. var couponPath = '/store/info/getStoreCouponList?storeId=' + encodeURIComponent(sid);
  1999. marketingCouponLoaded = false;
  2000. apiFetch(couponPath)
  2001. .then(function (res) {
  2002. marketingCouponLoaded = true;
  2003. var list = (res && res.code === 200 && res.data && res.data.marketingList) || [];
  2004. if (!Array.isArray(list)) list = [];
  2005. renderMarketingList(list);
  2006. })
  2007. .catch(function (e) {
  2008. marketingCouponLoaded = true;
  2009. console.warn('[getStoreCouponList]', e);
  2010. renderMarketingList([]);
  2011. });
  2012. if (shouldShowPerformanceSection()) {
  2013. var perfPath = '/performance/list/query?storeId=' + encodeURIComponent(sid) + '&page=1&size=100';
  2014. apiFetch(perfPath)
  2015. .then(function (res) {
  2016. var d = (res && res.code === 200 && res.data) || null;
  2017. if (!d || typeof d !== 'object') {
  2018. performanceListCache.records = [];
  2019. performanceListCache.total = 0;
  2020. } else {
  2021. performanceListCache.records = Array.isArray(d.records) ? d.records.slice() : [];
  2022. var pt = d.total;
  2023. performanceListCache.total = pt != null && !isNaN(Number(pt))
  2024. ? Number(pt)
  2025. : performanceListCache.records.length;
  2026. }
  2027. renderPerformanceList();
  2028. })
  2029. .catch(function (e) {
  2030. console.warn('[performance/list/query]', e);
  2031. performanceListCache.records = [];
  2032. performanceListCache.total = 0;
  2033. renderPerformanceList();
  2034. });
  2035. } else {
  2036. performanceListCache.records = [];
  2037. performanceListCache.total = 0;
  2038. renderPerformanceList();
  2039. }
  2040. var staffPath = '/storeStaffConfig/queryStaffListByTitle?storeId=' + encodeURIComponent(sid);
  2041. apiFetch(staffPath)
  2042. .then(function (res) {
  2043. var arr = (res && res.code === 200 && res.data) || [];
  2044. if (!Array.isArray(arr)) arr = [];
  2045. renderStaffGroups(arr);
  2046. })
  2047. .catch(function (e) {
  2048. console.warn('[queryStaffListByTitle]', e);
  2049. renderStaffGroups([]);
  2050. });
  2051. });
  2052. }
  2053. function boot() {
  2054. run();
  2055. bindMarketingMore();
  2056. bindStaffSection();
  2057. var openBtn = document.getElementById('openApp');
  2058. if (openBtn) {
  2059. openBtn.addEventListener('click', function () {
  2060. tryOpenHBuilderApp();
  2061. });
  2062. }
  2063. }
  2064. if (document.readyState === 'complete') {
  2065. boot();
  2066. } else {
  2067. window.onload = boot;
  2068. }
  2069. })();
  2070. </script>
  2071. </body>
  2072. </html>