shareIndex.html 65 KB

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