shareIndex.html 65 KB

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