shareIndex.html 77 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008200920102011201220132014201520162017201820192020202120222023202420252026202720282029203020312032203320342035203620372038203920402041204220432044204520462047204820492050205120522053205420552056205720582059206020612062206320642065206620672068206920702071207220732074207520762077207820792080208120822083208420852086208720882089209020912092209320942095209620972098209921002101210221032104210521062107210821092110211121122113211421152116211721182119212021212122212321242125212621272128212921302131213221332134213521362137213821392140214121422143214421452146214721482149215021512152215321542155215621572158215921602161216221632164216521662167216821692170217121722173217421752176217721782179218021812182218321842185218621872188218921902191219221932194219521962197219821992200220122022203220422052206220722082209221022112212221322142215221622172218221922202221222222232224222522262227222822292230223122322233223422352236223722382239224022412242224322442245224622472248224922502251225222532254225522562257225822592260226122622263226422652266226722682269227022712272227322742275227622772278227922802281228222832284228522862287228822892290229122922293229422952296229722982299230023012302230323042305230623072308230923102311231223132314231523162317231823192320232123222323232423252326232723282329233023312332233323342335233623372338233923402341234223432344234523462347234823492350235123522353235423552356235723582359236023612362236323642365236623672368236923702371237223732374237523762377237823792380238123822383238423852386238723882389239023912392239323942395239623972398239924002401240224032404240524062407240824092410241124122413241424152416241724182419242024212422242324242425242624272428242924302431243224332434243524362437243824392440244124422443244424452446244724482449245024512452245324542455245624572458245924602461246224632464246524662467246824692470247124722473247424752476247724782479248024812482248324842485248624872488248924902491249224932494249524962497249824992500250125022503250425052506250725082509251025112512251325142515251625172518251925202521252225232524252525262527252825292530253125322533253425352536253725382539254025412542254325442545254625472548254925502551255225532554255525562557255825592560256125622563256425652566256725682569257025712572257325742575257625772578257925802581258225832584258525862587258825892590259125922593259425952596259725982599260026012602260326042605260626072608260926102611261226132614261526162617261826192620262126222623262426252626262726282629263026312632263326342635263626372638263926402641264226432644264526462647264826492650265126522653265426552656265726582659266026612662266326642665266626672668266926702671267226732674267526762677267826792680268126822683268426852686268726882689269026912692269326942695269626972698269927002701270227032704270527062707270827092710271127122713271427152716271727182719272027212722272327242725272627272728272927302731273227332734273527362737
  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. #fabDock,
  409. .fab-dock__slot,
  410. #fabDock .fab,
  411. .fab-wx-hit {
  412. pointer-events: auto;
  413. }
  414. .fab-dock__slot {
  415. position: relative;
  416. width: 100%;
  417. max-width: 320px;
  418. height: 48px;
  419. margin: 0 auto;
  420. }
  421. .fab-wx-hit {
  422. display: none;
  423. position: absolute;
  424. left: 0;
  425. right: 0;
  426. top: 0;
  427. height: 48px;
  428. z-index: 3;
  429. }
  430. #fabDock.wx-open-enabled .fab-wx-hit {
  431. display: block;
  432. }
  433. #launch-btn {
  434. display: block;
  435. width: 100%;
  436. height: 48px;
  437. min-height: 48px;
  438. }
  439. #openApp img {
  440. pointer-events: none;
  441. }
  442. .fab {
  443. display: flex;
  444. align-items: center;
  445. justify-content: center;
  446. gap: 10px;
  447. width: 100%;
  448. max-width: 320px;
  449. margin: 0 auto;
  450. height: 48px;
  451. border: none;
  452. border-radius: 24px;
  453. background: var(--orange);
  454. color: #fff;
  455. font-size: 16px;
  456. font-weight: 600;
  457. box-shadow: 0 4px 16px rgba(245, 130, 32, 0.45);
  458. cursor: pointer;
  459. background:#F47D1F;
  460. }
  461. .fab__logo {
  462. width: 28px;
  463. height: 28px;
  464. flex-shrink: 0;
  465. }
  466. .home-indicator {
  467. height: 5px;
  468. background: #000;
  469. border-radius: 3px;
  470. width: 134px;
  471. margin: 8px auto 4px;
  472. opacity: 0.2;
  473. }
  474. /* 营销活动(getStoreCouponList.marketingList) */
  475. .marketing-section {
  476. padding: 4px 15px 20px;
  477. }
  478. .marketing-section__title {
  479. font-size: 16px;
  480. font-weight: 700;
  481. color: var(--text);
  482. margin: 0 0 12px;
  483. }
  484. .marketing-section__list {
  485. display: flex;
  486. flex-direction: column;
  487. gap: 12px;
  488. }
  489. .marketing-card {
  490. border-radius: 12px;
  491. overflow: hidden;
  492. background: #f0f0f0;
  493. box-shadow: 0 2px 12px rgba(0, 0, 0, 0.06);
  494. }
  495. .marketing-card__media img,
  496. .marketing-card__media video {
  497. width: 100%;
  498. display: block;
  499. aspect-ratio: 16 / 9;
  500. object-fit: cover;
  501. vertical-align: middle;
  502. }
  503. .marketing-card__media video {
  504. background: #000;
  505. }
  506. .marketing-card--more {
  507. display: none;
  508. }
  509. .marketing-section.is-expanded .marketing-card--more {
  510. display: block;
  511. }
  512. .marketing-section__more {
  513. display: flex;
  514. align-items: center;
  515. justify-content: center;
  516. gap: 4px;
  517. width: 100%;
  518. margin-top: 14px;
  519. padding: 8px 0;
  520. border: none;
  521. background: none;
  522. font-size: 14px;
  523. color: var(--text-secondary);
  524. cursor: pointer;
  525. -webkit-tap-highlight-color: transparent;
  526. }
  527. .marketing-section__more-chevron {
  528. width: 16px;
  529. height: 16px;
  530. flex-shrink: 0;
  531. transition: transform 0.2s ease;
  532. }
  533. .marketing-section.is-expanded .marketing-section__more-chevron {
  534. transform: rotate(180deg);
  535. }
  536. .marketing-section__empty {
  537. display: flex;
  538. flex-direction: column;
  539. justify-content: center;
  540. align-items: center;
  541. padding: 10px 0 8px;
  542. }
  543. .marketing-section__empty img {
  544. width: 200px;
  545. height: 200px;
  546. display: block;
  547. object-fit: contain;
  548. }
  549. .marketing-section__empty-label {
  550. margin: 12px 0 0;
  551. font-size: 14px;
  552. color: var(--text-secondary);
  553. text-align: center;
  554. }
  555. /* 演出安排 performance/list/query */
  556. .performance-section {
  557. padding: 8px 0 20px;
  558. border-top: 1px solid var(--border);
  559. margin-top: 4px;
  560. }
  561. .performance-section__title {
  562. font-size: 16px;
  563. font-weight: 700;
  564. color: var(--text);
  565. margin: 0 15px 12px;
  566. }
  567. .performance-strip {
  568. display: flex;
  569. flex-direction: row;
  570. flex-wrap: nowrap;
  571. gap: 12px;
  572. overflow-x: auto;
  573. overflow-y: hidden;
  574. padding: 0 15px 4px;
  575. -webkit-overflow-scrolling: touch;
  576. scrollbar-width: none;
  577. }
  578. .performance-strip::-webkit-scrollbar {
  579. display: none;
  580. }
  581. .performance-card {
  582. flex: 0 0 auto;
  583. display: flex;
  584. flex-direction: row;
  585. align-items: stretch;
  586. gap: 10px;
  587. width: 272px;
  588. min-width: 272px;
  589. padding: 0;
  590. background: #fff;
  591. border-radius: 12px;
  592. overflow: hidden;
  593. }
  594. .performance-card__poster {
  595. flex: 0 0 76px;
  596. width: 76px;
  597. min-height: 102px;
  598. background: #eee;
  599. align-self: stretch;
  600. }
  601. .performance-card__poster img {
  602. width: 100%;
  603. height: 100%;
  604. min-height: 102px;
  605. object-fit: cover;
  606. display: block;
  607. vertical-align: middle;
  608. }
  609. .performance-card__body {
  610. flex: 1;
  611. min-width: 0;
  612. display: flex;
  613. flex-direction: column;
  614. justify-content: center;
  615. gap: 4px;
  616. padding: 10px 12px 10px 0;
  617. }
  618. .performance-card__name {
  619. font-size: 15px;
  620. font-weight: 700;
  621. color: var(--text);
  622. line-height: 1.3;
  623. overflow: hidden;
  624. text-overflow: ellipsis;
  625. display: -webkit-box;
  626. -webkit-line-clamp: 2;
  627. -webkit-box-orient: vertical;
  628. }
  629. .performance-card__meta {
  630. font-size: 12px;
  631. color: var(--text-secondary);
  632. line-height: 1.35;
  633. overflow: hidden;
  634. text-overflow: ellipsis;
  635. white-space: nowrap;
  636. }
  637. /* 人员阵容 queryStaffListByTitle */
  638. .staff-section {
  639. padding: 8px 0 24px;
  640. border-top: 1px solid var(--border);
  641. margin-top: 4px;
  642. }
  643. .staff-section__head {
  644. display: flex;
  645. align-items: center;
  646. justify-content: space-between;
  647. gap: 12px;
  648. padding: 0 15px;
  649. margin-bottom: 12px;
  650. }
  651. .staff-section__page-title {
  652. font-size: 16px;
  653. font-weight: 700;
  654. color: var(--text);
  655. margin: 0;
  656. flex: 1;
  657. min-width: 0;
  658. }
  659. .staff-section__all {
  660. flex-shrink: 0;
  661. display: inline-flex;
  662. align-items: center;
  663. gap: 2px;
  664. font-size: 13px;
  665. color: #151515;
  666. text-decoration: none;
  667. background: none;
  668. border: none;
  669. padding: 0;
  670. cursor: pointer;
  671. -webkit-tap-highlight-color: transparent;
  672. }
  673. .staff-section__all-chevron {
  674. width: 14px;
  675. height: 14px;
  676. opacity: 0.7;
  677. }
  678. .staff-group {
  679. margin-bottom: 20px;
  680. }
  681. .staff-group:last-child {
  682. margin-bottom: 0;
  683. }
  684. .staff-strip {
  685. display: flex;
  686. flex-direction: row;
  687. flex-wrap: nowrap;
  688. gap: 10px;
  689. overflow-x: auto;
  690. overflow-y: hidden;
  691. padding: 0 15px 4px;
  692. -webkit-overflow-scrolling: touch;
  693. scrollbar-width: none;
  694. }
  695. .staff-strip::-webkit-scrollbar {
  696. display: none;
  697. }
  698. .staff-card {
  699. flex: 0 0 112px;
  700. width: 112px;
  701. min-width: 112px;
  702. }
  703. .staff-card__img-wrap {
  704. position: relative;
  705. border-radius: 10px;
  706. overflow: hidden;
  707. background: #eee;
  708. aspect-ratio: 3 / 4;
  709. }
  710. .staff-card__img-wrap img {
  711. width: 100%;
  712. height: 100%;
  713. object-fit: cover;
  714. display: block;
  715. vertical-align: middle;
  716. }
  717. .staff-card__likes {
  718. position: absolute;
  719. left: 0;
  720. right: 0;
  721. bottom: 0;
  722. padding: 6px 8px;
  723. font-size: 11px;
  724. color: #fff;
  725. line-height: 1.2;
  726. background: linear-gradient(to top, rgba(0, 0, 0, 0.65), transparent);
  727. }
  728. .staff-card__name-row {
  729. display: flex;
  730. align-items: center;
  731. gap: 4px;
  732. margin-top: 8px;
  733. min-width: 0;
  734. }
  735. .staff-card__name {
  736. font-size: 14px;
  737. font-weight: 700;
  738. color: var(--text);
  739. overflow: hidden;
  740. text-overflow: ellipsis;
  741. white-space: nowrap;
  742. flex: 1;
  743. min-width: 0;
  744. }
  745. .staff-card__badge {
  746. flex-shrink: 0;
  747. font-size: 10px;
  748. font-weight: 600;
  749. color: #fff;
  750. background: #ff9d4d;
  751. padding: 2px 5px;
  752. border-radius: 3px;
  753. line-height: 1.2;
  754. white-space: nowrap;
  755. }
  756. .staff-card__meta {
  757. display: flex;
  758. align-items: center;
  759. flex-wrap: wrap;
  760. gap: 0 4px;
  761. margin-top: 4px;
  762. font-size: 12px;
  763. color: var(--text-secondary);
  764. line-height: 1.35;
  765. }
  766. .staff-card__position {
  767. overflow: hidden;
  768. text-overflow: ellipsis;
  769. white-space: nowrap;
  770. max-width: 100%;
  771. }
  772. .staff-card__reviews {
  773. display: inline-flex;
  774. align-items: center;
  775. gap: 4px;
  776. }
  777. .staff-card__sep {
  778. color: #ddd;
  779. font-weight: 300;
  780. }
  781. </style>
  782. </head>
  783. <body>
  784. <div class="share-none" id="shareClosedBanner" aria-hidden="true">
  785. <img src="images/storeNone.png" alt="">
  786. <p>抱歉,商户已关闭,看看别的吧</p>
  787. </div>
  788. <div class="closed-rec-wrap" id="shareClosedRecommendWrap" aria-hidden="true">
  789. <div class="closed-rec-divider"></div>
  790. <h3 class="closed-rec-title">更多推荐</h3>
  791. <div class="closed-rec-grid" id="shareClosedRecList">
  792. <p id="shareClosedRecEmpty" class="closed-rec-empty" style="display:none;">暂无推荐</p>
  793. </div>
  794. </div>
  795. <div class="share-content" id="shareContentEl">
  796. <div class="hero" id="hero">
  797. <div class="hero__track" id="heroTrack">
  798. <div class="hero__slide"><img id="heroFallbackImg" src="images/hero.png" alt="店铺图"></div>
  799. </div>
  800. <div class="hero__dots" id="heroDots" aria-hidden="true"></div>
  801. </div>
  802. <!-- 数据由 getClientStoreDetail(id,userId,jingdu,weidu)填充,见 renderDetail -->
  803. <section class="section" id="mainSection">
  804. <p id="pageError" class="page-error" style="display:none;color:#ff4d4f;padding:12px 0;font-size:14px;"></p>
  805. <h2 class="store-name" id="storeName">加载中…</h2>
  806. <div class="row rating-row">
  807. <div class="row" style="flex:1; justify-content:flex-start;">
  808. <span class="stars" aria-label="5.0 分">
  809. <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>
  810. <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>
  811. <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>
  812. <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>
  813. <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>
  814. </span>
  815. <span class="rating-num" id="scoreAvg">—</span>
  816. <span id="commitCount" style="font-size: 14px;">0</span>
  817. </div>
  818. <!-- <a href="#" class="link-muted"><span id="commitCount">0</span>条评价
  819. <svg class="chevron" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><polyline points="9 18 15 12 9 6"/></svg>
  820. </a> -->
  821. </div>
  822. <div class="store-evaluate-row" id="storeEvaluateRow" aria-hidden="true">
  823. <span class="store-evaluate__item">酒水:<span id="storeEvaluateScoreOne">—</span></span>
  824. <span class="store-evaluate__item">氛围:<span id="storeEvaluateScoreTwo">—</span></span>
  825. <span class="store-evaluate__item">服务:<span id="storeEvaluateScoreThree">—</span></span>
  826. </div>
  827. <div class="row hours-row">
  828. <div class="hours-left">
  829. <span class="status" id="bizStatus">—</span>
  830. <span class="hours-text" id="hoursText">—</span>
  831. </div>
  832. <a href="#" class="link-muted">详情
  833. <svg class="chevron" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><polyline points="9 18 15 12 9 6"/></svg>
  834. </a>
  835. </div>
  836. </section>
  837. <div class="loc-wrap">
  838. <div class="loc-main">
  839. <p class="addr" id="storeAddr">—</p>
  840. <div class="meta-line" id="metaDistance" style="display:none;">
  841. <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>
  842. <span id="distanceText">—</span>
  843. </div>
  844. <div class="meta-line" id="metaSubway" style="display:none;">
  845. <img src="images/iconn.png" alt="" width="12" height="12" decoding="async">
  846. <span id="subwayText">—</span>
  847. </div>
  848. </div>
  849. <div class="loc-actions">
  850. <button type="button" class="act-btn" aria-label="导航">
  851. <span class="act-btn__icon">
  852. <img src="images/loc1.png" alt="" width="22" height="22" decoding="async">
  853. </span>
  854. 导航
  855. </button>
  856. <button type="button" class="act-btn" aria-label="电话">
  857. <span class="act-btn__icon">
  858. <img src="images/loc2.png" alt="" width="22" height="22" decoding="async">
  859. </span>
  860. 电话
  861. </button>
  862. </div>
  863. </div>
  864. <section class="marketing-section" id="shareMarketingSection" style="display:none;" aria-hidden="true">
  865. <h3 class="marketing-section__title">营销活动</h3>
  866. <div class="marketing-section__list" id="marketingListEl"></div>
  867. <button type="button" class="marketing-section__more" id="marketingMoreBtn" style="display:none;">
  868. <span id="marketingMoreText"></span>
  869. <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>
  870. </button>
  871. </section>
  872. <section class="performance-section" id="sharePerformanceSection" style="display:none;" aria-hidden="true">
  873. <h3 class="performance-section__title" id="performanceSectionTitle">演出安排(0)</h3>
  874. <div class="performance-strip" id="performanceStripEl"></div>
  875. </section>
  876. <section class="staff-section" id="shareStaffSection" style="display:none;" aria-hidden="true">
  877. <div class="staff-section__head">
  878. <h3 class="staff-section__page-title">人员阵容(<span id="staffSectionCountEl">0</span>)</h3>
  879. <button type="button" class="staff-section__all" id="staffSectionAllBtn" aria-label="查看全部">
  880. 查看全部
  881. <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>
  882. </button>
  883. </div>
  884. <div id="staffGroupsMount"></div>
  885. </section>
  886. </div>
  887. <div id="fabDock" class="fab-wrap">
  888. <div class="fab-dock__slot">
  889. <button type="button" class="fab" id="openApp">
  890. <img src="images/uBtn.png" alt="APP内打开" decoding="async">
  891. </button>
  892. <div id="fabWxHit" class="fab-wx-hit" aria-hidden="true">
  893. <wx-open-launch-app id="launch-btn" appid="wxf5f1efe3a9f5012e">
  894. <script type="text/wxtag-template">
  895. <style>
  896. .wx-open-app-btn {
  897. display: block;
  898. width: 100%;
  899. height: 48px;
  900. margin: 0;
  901. padding: 0;
  902. border: none;
  903. background: transparent;
  904. }
  905. .wx-open-app-btn img {
  906. display: block;
  907. width: 100%;
  908. height: 48px;
  909. object-fit: contain;
  910. }
  911. </style>
  912. <button class="wx-open-app-btn" aria-label="APP内打开">
  913. <img src="https://test.ailien.shop/h5/HBuilderProjects/images/uBtn.png" alt="APP内打开" />
  914. </button>
  915. </script>
  916. </wx-open-launch-app>
  917. </div>
  918. </div>
  919. <div class="home-indicator" aria-hidden="true"></div>
  920. </div>
  921. <script src="https://res.wx.qq.com/open/js/jweixin-1.6.0.js"></script>
  922. <script>
  923. (function () {
  924. 'use strict';
  925. /**
  926. * 与 group_user sharePopup 复制链接时携带的 query 一致,例如:
  927. * ?id=436&storeId=436&userId=628&businessSection=3&lat=...&lon=...&jingdu=...&weidu=...&storeName=...&coverUrl=...&desc=...
  928. *
  929. * 进入页先 GET .../store/info/getOne?id=(与 shareDynamic.html 一致);data.businessStatus===99 时先展示关店区(#shareClosedBanner、#shareClosedRecommendWrap)。
  930. * 关店时点「APP内打开」:深链为 shopro://pages/index/login?…(与 group_user pages/index/login),不再进八区详情。
  931. * 店铺头图/名称/评分/地址等(#mainSection、.loc-wrap):GET .../store/info/getClientStoreDetail?id=&userId=&jingdu=&weidu=
  932. * 经纬度:URL 可用 jingdu/weidu;若无则用 lon/lng、lat(与分享链一致)
  933. * 营销活动: GET .../store/info/getStoreCouponList?storeId= → data.marketingList
  934. * 演出安排: GET .../performance/list/query?storeId=&page=&size= → data.records, data.total(仅 URL businessSection=2 时展示与请求)
  935. * 人员阵容: GET .../storeStaffConfig/queryStaffListByTitle?storeId= → data[]
  936. *
  937. * 注意:用 file:// 打开本页时,浏览器可能因 CORS 拦截跨域请求。
  938. * 请用本地 HTTP 打开(如 VS Code Live Server、npx serve)或让后端为 H5 域名配置 Access-Control-Allow-Origin。
  939. */
  940. var API_BASE = 'https://test.ailien.shop/alienStore';
  941. /**
  942. * 微信 JSSDK(服务号「麦丽恩严U店」)— 仅用于 wx.config 签名,Secret 只放后端
  943. * 后端 GET {API_BASE}/wx/getWxConfig 须用:AppID wx412792c77f47babd + 服务号 AppSecret
  944. */
  945. var WECHAT_MP_APP_ID = 'wx412792c77f47babd';
  946. /** 微信开放标签 wx-open-launch-app — 移动应用「U店在哪」AppID(不是服务号 ID) */
  947. var WECHAT_OPEN_APP_ID = 'wxf5f1efe3a9f5012e';
  948. var WECHAT_GET_WX_CONFIG_PATH = '/wx/getWxConfig';
  949. var H5_PAGE_BASE_FALLBACK = 'https://test.ailien.shop/h5/HBuilderProjects/';
  950. var WX_GET_CONFIG_SIGN_URL = H5_PAGE_BASE_FALLBACK + 'shareIndex.html';
  951. var WECHAT_JS_SAFE_HOSTS = ['uat.ailien.shop', 'test.ailien.shop'];
  952. var weChatJssdkConfigured = false;
  953. var wxConfigSignRetriedBaseUrl = false;
  954. var wxSignUrlFullBeforeStrip = '';
  955. /**
  956. * 关店(businessStatus=99)更多推荐:POST …/ai/multimodal-services/api/v1/search/global/store-recommend
  957. * 与 shareCheckInUndefined.html 一致;请求体 userCity/userLat/userLng 优先取 URL:userCity、lat、lon(兼认 userLat/userLng、weidu/jingdu 等)。
  958. */
  959. var API_LIFE_AI_BASE = 'http://183.252.196.135:9100';
  960. var STORE_GLOBAL_RECOMMEND_PATH =
  961. '/ai/multimodal-services/api/v1/search/global/store-recommend';
  962. /** 关店推荐用户位置:优先 URL 的 lat、lon、userCity;缺省再用大连默认值 */
  963. function getClosedRecommendUserLocation() {
  964. var latRaw = (q('lat') || q('userLat') || q('latitude') || q('weidu') || '').trim();
  965. var lonRaw = (q('lon') || q('userLng') || q('longitude') || q('lng') || q('jingdu') || '').trim();
  966. var cityRaw = (q('userCity') || q('city') || '').trim();
  967. return {
  968. userLat:
  969. latRaw !== '' && !isNaN(Number(latRaw)) ? Number(latRaw) : 38.925747,
  970. userLng:
  971. lonRaw !== '' && !isNaN(Number(lonRaw)) ? Number(lonRaw) : 121.662531,
  972. userCity: cityRaw !== '' ? cityRaw : '大连市'
  973. };
  974. }
  975. /**
  976. * 与 group_user 一致:
  977. * - manifest:app-plus.distribute.android.schemes、ios.urltypes → shopro(即 shopro://)
  978. * - Android 包名:manifest 未写 packagename 时与 App.vue 升级配置 androidPackageName 一致(云打包以 HBuilderX 为准)
  979. */
  980. var APP_ANDROID_PACKAGE = 'com.alien.Udianzaizhe';
  981. var APP_IOS_URL_SCHEME = 'shopro://';
  982. /** businessSection 未传或其它值时的默认落地页(与 1 相同) */
  983. var APP_UNI_STORE_PATH = 'pages/ieisureEntertainment/eightTypeList/delicacyDetails';
  984. function showDownloadTip() {
  985. var msg = '请到应用商店下载';
  986. if (typeof uni !== 'undefined' && typeof uni.showToast === 'function') {
  987. uni.showToast({ title: msg, icon: 'none', duration: 2500 });
  988. } else {
  989. window.alert(msg);
  990. }
  991. }
  992. /** 详情页 onLoad 使用 storeId;分享链常为 id,补全 storeId 避免 App 内参数为空 */
  993. function buildAppOpenQueryString() {
  994. var raw = (location.search && location.search.charAt(0) === '?') ? location.search.slice(1) : (location.search || '');
  995. var params = new URLSearchParams(raw);
  996. var sid = params.get('storeId') || params.get('id') || '';
  997. if (sid && !params.get('storeId')) params.set('storeId', sid);
  998. var qs = params.toString();
  999. return qs ? ('?' + qs) : '';
  1000. }
  1001. /**
  1002. * 按 URL 参数 businessSection 打开对应 App 页:
  1003. * 1 → delicacyDetails,2 → barDetails,3 → lifeDetails
  1004. * 关店 businessStatus=99 时进 pages/index/login(见 isClosedMerchantForAppOpen)。
  1005. */
  1006. function getAppUniPathForBusinessSection() {
  1007. if (isClosedMerchantForAppOpen()) {
  1008. return 'pages/index/login';
  1009. }
  1010. var bs = String(q('businessSection') || '').trim();
  1011. if (bs === '1') {
  1012. return 'pages/ieisureEntertainment/eightTypeList/delicacyDetails';
  1013. }
  1014. if (bs === '2') {
  1015. return 'pages/ieisureEntertainment/eightTypeList/barDetails';
  1016. }
  1017. if (bs === '3') {
  1018. return 'pages/ieisureEntertainment/eightTypeList/lifeDetails';
  1019. }
  1020. return String(APP_UNI_STORE_PATH || 'pages/ieisureEntertainment/eightTypeList/delicacyDetails').replace(/^\//, '');
  1021. }
  1022. function buildAppDeepLink() {
  1023. var path = getAppUniPathForBusinessSection().replace(/^\//, '');
  1024. var s = buildAppOpenQueryString();
  1025. var root = APP_IOS_URL_SCHEME.replace(/\/$/, '');
  1026. if (!s) return root + '/' + path;
  1027. return root + '/' + path + s;
  1028. }
  1029. function isWeChatInAppBrowser() {
  1030. return /MicroMessenger/i.test(navigator.userAgent || '');
  1031. }
  1032. function isWxDebugOn() {
  1033. return String(q('wxDebug') || '') === '1';
  1034. }
  1035. function getWxSignUrlFull() {
  1036. var forced = String(q('wxSignUrl') || '').trim();
  1037. if (forced) return forced.split('#')[0];
  1038. if (location.origin && /^https?:/i.test(location.origin)) {
  1039. return (
  1040. location.origin +
  1041. (location.pathname || '/h5/HBuilderProjects/shareIndex.html') +
  1042. (location.search || '')
  1043. );
  1044. }
  1045. var href = String(location.href || '').split('#')[0];
  1046. if (href && href.indexOf('file:') !== 0) return href;
  1047. return WX_GET_CONFIG_SIGN_URL;
  1048. }
  1049. function getWxSignUrlBase() {
  1050. if (location.origin && /^https?:/i.test(location.origin)) {
  1051. return location.origin + (location.pathname || '/h5/HBuilderProjects/shareIndex.html');
  1052. }
  1053. return WX_GET_CONFIG_SIGN_URL;
  1054. }
  1055. function getWxConfigSignUrl() {
  1056. if (String(q('wxSignBaseOnly') || '') === '1') return getWxSignUrlBase();
  1057. return getWxSignUrlFull();
  1058. }
  1059. function syncBrowserUrlForWxSign(signUrl) {
  1060. var target = String(signUrl || '').split('#')[0];
  1061. if (!target) return;
  1062. var current = String(location.href || '').split('#')[0];
  1063. if (current !== target) {
  1064. history.replaceState(history.state, document.title, target + (location.hash || ''));
  1065. }
  1066. }
  1067. function buildWxGetConfigRequestUrl(signPageUrl) {
  1068. return (
  1069. API_BASE.replace(/\/$/, '') +
  1070. WECHAT_GET_WX_CONFIG_PATH +
  1071. '?url=' +
  1072. encodeURIComponent(signPageUrl || getWxConfigSignUrl())
  1073. );
  1074. }
  1075. function resolveWxConfigAppIdFromSignData(d) {
  1076. if (!d || typeof d !== 'object') return '';
  1077. var mp =
  1078. d.mpAppId ||
  1079. d.mpAppid ||
  1080. d.officialAppId ||
  1081. d.gzhAppId ||
  1082. d.serviceAppId;
  1083. if (mp != null && String(mp).trim() !== '') return String(mp).trim();
  1084. var fromQuery = String(q('wxMpAppId') || WECHAT_MP_APP_ID || '').trim();
  1085. if (fromQuery) return fromQuery;
  1086. var raw = d.appId || d.appid || d.wxAppId;
  1087. return raw != null && String(raw).trim() !== '' ? String(raw).trim() : '';
  1088. }
  1089. function normalizeWxJssdkSignPayload(res, signUrlUsed) {
  1090. if (!res || typeof res !== 'object') return null;
  1091. var d = res.data != null && typeof res.data === 'object' ? res.data : res;
  1092. if (!d || typeof d !== 'object') return null;
  1093. var appId = resolveWxConfigAppIdFromSignData(d);
  1094. var timestamp = d.timestamp != null ? d.timestamp : d.timeStamp;
  1095. var nonceStr = d.nonceStr || d.noncestr || d.nonce;
  1096. var signature = d.signature || d.sign;
  1097. if (!appId || timestamp == null || !nonceStr || !signature) return null;
  1098. var signedUrl =
  1099. d.signUrl != null && String(d.signUrl).trim() !== ''
  1100. ? String(d.signUrl).trim().split('#')[0]
  1101. : signUrlUsed != null && String(signUrlUsed).trim() !== ''
  1102. ? String(signUrlUsed).trim().split('#')[0]
  1103. : '';
  1104. return {
  1105. appId: String(appId),
  1106. timestamp: Number(timestamp),
  1107. nonceStr: String(nonceStr),
  1108. signature: String(signature),
  1109. signUrl: signedUrl
  1110. };
  1111. }
  1112. function getWxErrMsg(err) {
  1113. if (!err) return '';
  1114. if (err.errMsg) return String(err.errMsg);
  1115. if (typeof err === 'string') return err;
  1116. try {
  1117. return JSON.stringify(err);
  1118. } catch (e) {
  1119. return String(err);
  1120. }
  1121. }
  1122. function formatWxConfigErrorTip(err, signPageUrl) {
  1123. var errMsg = getWxErrMsg(err);
  1124. var tip = '微信 JSSDK 配置失败';
  1125. if (/invalid signature/i.test(errMsg)) {
  1126. return (
  1127. tip +
  1128. ':签名无效。地址栏:' +
  1129. String(location.href || '').split('#')[0] +
  1130. ';签名 url:' +
  1131. (signPageUrl || getWxSignUrlFull())
  1132. );
  1133. }
  1134. if (/require\s*subscribe/i.test(errMsg)) {
  1135. return tip + ':' + errMsg + '(服务号需用户已关注)';
  1136. }
  1137. return errMsg ? tip + ':' + errMsg : tip;
  1138. }
  1139. function buildWeChatLaunchExtinfo() {
  1140. var pageUrl = getWxSignUrlFull();
  1141. if (pageUrl && pageUrl.length <= 1024) return pageUrl;
  1142. var path = getAppUniPathForBusinessSection().replace(/^\//, '');
  1143. var qs = buildAppOpenQueryString().replace(/^\?/, '');
  1144. try {
  1145. var pack = JSON.stringify({ path: path, query: qs, h5: pageUrl });
  1146. if (pack.length <= 1024) return pack;
  1147. } catch (eJ) {}
  1148. var deep = buildAppDeepLink();
  1149. return deep.length <= 1024 ? deep : (pageUrl || deep).slice(0, 1024);
  1150. }
  1151. function fetchWeChatJssdkSign(signPageUrl) {
  1152. signPageUrl = signPageUrl || getWxConfigSignUrl();
  1153. var url = buildWxGetConfigRequestUrl(signPageUrl);
  1154. return fetch(url, {
  1155. method: 'GET',
  1156. mode: 'cors',
  1157. credentials: 'omit',
  1158. headers: { Accept: 'application/json' }
  1159. })
  1160. .then(function (r) {
  1161. if (!r.ok) throw new Error('HTTP ' + r.status);
  1162. return r.json();
  1163. })
  1164. .then(function (res) {
  1165. if (res && res.code != null) {
  1166. var c = Number(res.code);
  1167. if (c !== 200 && c !== 0 && res.success !== true) {
  1168. throw new Error(res.msg || 'sign rejected');
  1169. }
  1170. }
  1171. var pack = normalizeWxJssdkSignPayload(res, signPageUrl);
  1172. if (!pack) throw new Error('empty sign');
  1173. return pack;
  1174. });
  1175. }
  1176. function applyWxConfig(sign, signPageUrl) {
  1177. var urlForWx =
  1178. sign.signUrl && String(sign.signUrl).trim() !== ''
  1179. ? String(sign.signUrl).trim()
  1180. : signPageUrl;
  1181. syncBrowserUrlForWxSign(urlForWx);
  1182. return new Promise(function (resolve) {
  1183. wx.config({
  1184. debug: isWxDebugOn(),
  1185. appId: sign.appId,
  1186. timestamp: sign.timestamp,
  1187. nonceStr: sign.nonceStr,
  1188. signature: sign.signature,
  1189. jsApiList: [],
  1190. openTagList: ['wx-open-launch-app']
  1191. });
  1192. wx.ready(function () {
  1193. weChatJssdkConfigured = true;
  1194. if (wxSignUrlFullBeforeStrip) {
  1195. history.replaceState(
  1196. history.state,
  1197. document.title,
  1198. wxSignUrlFullBeforeStrip + (location.hash || '')
  1199. );
  1200. wxSignUrlFullBeforeStrip = '';
  1201. }
  1202. scheduleWxOpenTagRefresh();
  1203. resolve(true);
  1204. });
  1205. wx.error(function (err) {
  1206. weChatJssdkConfigured = false;
  1207. updateFabOpenLayer();
  1208. var errMsg = getWxErrMsg(err);
  1209. if (isWxDebugOn()) window.alert(formatWxConfigErrorTip(err, urlForWx));
  1210. console.warn('[wx.config]', errMsg, urlForWx);
  1211. var baseUrl = getWxSignUrlBase();
  1212. var fullUrl = getWxSignUrlFull();
  1213. if (
  1214. !/invalid signature/i.test(errMsg) ||
  1215. wxConfigSignRetriedBaseUrl ||
  1216. baseUrl === fullUrl ||
  1217. urlForWx === baseUrl
  1218. ) {
  1219. resolve(false);
  1220. return;
  1221. }
  1222. wxConfigSignRetriedBaseUrl = true;
  1223. wxSignUrlFullBeforeStrip = fullUrl;
  1224. fetchWeChatJssdkSign(baseUrl)
  1225. .then(function (sign2) {
  1226. if (!sign2) {
  1227. resolve(false);
  1228. return;
  1229. }
  1230. applyWxConfig(sign2, baseUrl).then(resolve);
  1231. })
  1232. .catch(function () {
  1233. resolve(false);
  1234. });
  1235. });
  1236. });
  1237. }
  1238. function refreshWxLaunchTagAttrs() {
  1239. var tag = document.getElementById('launch-btn');
  1240. if (!tag) return;
  1241. try {
  1242. tag.setAttribute('appid', WECHAT_OPEN_APP_ID);
  1243. tag.setAttribute('extinfo', buildWeChatLaunchExtinfo());
  1244. } catch (eA) {}
  1245. }
  1246. function updateFabOpenLayer() {
  1247. var dock = document.getElementById('fabDock');
  1248. var hit = document.getElementById('fabWxHit');
  1249. var useWx = isWeChatInAppBrowser() && weChatJssdkConfigured;
  1250. if (dock) {
  1251. if (useWx) dock.classList.add('wx-open-enabled');
  1252. else dock.classList.remove('wx-open-enabled');
  1253. }
  1254. if (hit) hit.setAttribute('aria-hidden', useWx ? 'false' : 'true');
  1255. if (useWx) refreshWxLaunchTagAttrs();
  1256. }
  1257. function scheduleWxOpenTagRefresh() {
  1258. refreshWxLaunchTagAttrs();
  1259. updateFabOpenLayer();
  1260. [200, 600, 1500].forEach(function (ms) {
  1261. setTimeout(function () {
  1262. if (!weChatJssdkConfigured) return;
  1263. refreshWxLaunchTagAttrs();
  1264. updateFabOpenLayer();
  1265. }, ms);
  1266. });
  1267. }
  1268. function bindWeChatLaunchTagEvents() {
  1269. var tag = document.getElementById('launch-btn');
  1270. if (!tag) return;
  1271. refreshWxLaunchTagAttrs();
  1272. tag.addEventListener('launch', function () {
  1273. console.log('[wx-open-launch-app] launch ok');
  1274. });
  1275. tag.addEventListener('error', function (e) {
  1276. var detail = e && e.detail;
  1277. var errMsg =
  1278. detail && detail.errMsg
  1279. ? String(detail.errMsg)
  1280. : detail && detail.errmsg
  1281. ? String(detail.errmsg)
  1282. : '';
  1283. console.warn('[wx-open-launch-app]', detail);
  1284. showAppOpenFailTip(
  1285. errMsg
  1286. ? '未能唤起 App:' + errMsg
  1287. : '未能唤起 App,请确认已安装 U店在哪,且开放平台已绑定服务号与移动应用。'
  1288. );
  1289. });
  1290. }
  1291. function initWeChatOpenLaunchApp() {
  1292. if (!isWeChatInAppBrowser()) return Promise.resolve(false);
  1293. wxConfigSignRetriedBaseUrl = false;
  1294. var signPageUrl = getWxConfigSignUrl();
  1295. if (typeof wx === 'undefined') {
  1296. console.warn('[wx] jweixin not loaded');
  1297. return Promise.resolve(false);
  1298. }
  1299. bindWeChatLaunchTagEvents();
  1300. return fetchWeChatJssdkSign(signPageUrl)
  1301. .then(function (sign) {
  1302. if (!sign) {
  1303. console.warn('[wx] getWxConfig empty');
  1304. return false;
  1305. }
  1306. if (sign.appId !== WECHAT_MP_APP_ID) {
  1307. console.warn(
  1308. '[wx] config appId=' +
  1309. sign.appId +
  1310. ' 与 WECHAT_MP_APP_ID=' +
  1311. WECHAT_MP_APP_ID +
  1312. ' 不一致,请后端用服务号 ID 签名'
  1313. );
  1314. }
  1315. return applyWxConfig(sign, signPageUrl);
  1316. })
  1317. .catch(function (e) {
  1318. console.warn('[wx] init failed', e);
  1319. return false;
  1320. });
  1321. }
  1322. function showAppOpenFailTip(msg) {
  1323. var tip = msg || '未能打开 App,请确认已安装最新版「U店在哪」。';
  1324. if (typeof uni !== 'undefined' && typeof uni.showToast === 'function') {
  1325. uni.showToast({ title: tip, icon: 'none', duration: 2800 });
  1326. } else if (isWeChatInAppBrowser()) {
  1327. window.alert(tip);
  1328. } else {
  1329. console.warn('[openApp]', tip);
  1330. }
  1331. }
  1332. /** 部分 WebView 对 location.href 拦截,用 a 标签点击略稳 */
  1333. function launchAppDeepLink(deepLink) {
  1334. try {
  1335. var a = document.createElement('a');
  1336. a.href = deepLink;
  1337. a.setAttribute('target', '_self');
  1338. document.body.appendChild(a);
  1339. a.click();
  1340. document.body.removeChild(a);
  1341. } catch (e1) {}
  1342. try {
  1343. window.location.href = deepLink;
  1344. } catch (e2) {}
  1345. }
  1346. /**
  1347. * 有 plus:检测 App 是否安装后 openURL;深链形如 shopro://{APP_UNI_STORE_PATH}?…
  1348. * 系统浏览器:唤起 scheme;微信内常拦截 scheme,需「在浏览器打开」。
  1349. */
  1350. function tryOpenHBuilderApp() {
  1351. var inWx = isWeChatInAppBrowser();
  1352. if (inWx && weChatJssdkConfigured) {
  1353. return;
  1354. }
  1355. if (inWx && !weChatJssdkConfigured) {
  1356. showAppOpenFailTip(
  1357. '微信内请先完成 JSSDK 配置(服务号 wx412792c77f47babd 签名)。可加 ?wxDebug=1 查看报错。'
  1358. );
  1359. return;
  1360. }
  1361. var deepLink = buildAppDeepLink();
  1362. if (typeof plus !== 'undefined' && plus.runtime) {
  1363. var installed = null;
  1364. try {
  1365. if (typeof plus.runtime.isApplicationExist === 'function') {
  1366. installed = plus.runtime.isApplicationExist({
  1367. pname: APP_ANDROID_PACKAGE,
  1368. action: APP_IOS_URL_SCHEME
  1369. });
  1370. }
  1371. } catch (e) {
  1372. console.warn(e);
  1373. }
  1374. if (installed === false) {
  1375. showDownloadTip();
  1376. return;
  1377. }
  1378. try {
  1379. plus.runtime.openURL(deepLink);
  1380. } catch (e2) {
  1381. console.warn(e2);
  1382. showDownloadTip();
  1383. }
  1384. return;
  1385. }
  1386. var t0 = Date.now();
  1387. var done = false;
  1388. function finish() {
  1389. if (done) return;
  1390. done = true;
  1391. document.removeEventListener('visibilitychange', onVis);
  1392. window.removeEventListener('pagehide', onHide);
  1393. }
  1394. function onVis() {
  1395. if (document.visibilityState === 'hidden') finish();
  1396. }
  1397. function onHide() {
  1398. finish();
  1399. }
  1400. document.addEventListener('visibilitychange', onVis);
  1401. window.addEventListener('pagehide', onHide);
  1402. try {
  1403. launchAppDeepLink(deepLink);
  1404. } catch (e3) {
  1405. finish();
  1406. showDownloadTip();
  1407. return;
  1408. }
  1409. window.setTimeout(function () {
  1410. finish();
  1411. }, 2600);
  1412. }
  1413. function qs() {
  1414. return new URLSearchParams(location.search || '');
  1415. }
  1416. function q(name) {
  1417. var v = qs().get(name);
  1418. return v == null ? '' : String(v);
  1419. }
  1420. function showErr(msg) {
  1421. var el = document.getElementById('pageError');
  1422. el.textContent = msg;
  1423. el.style.display = 'block';
  1424. }
  1425. function getStoreId() {
  1426. return q('id') || q('storeId');
  1427. }
  1428. function shouldShowPerformanceSection() {
  1429. return String(q('businessSection') || '').trim() === '2';
  1430. }
  1431. function apiFetch(path) {
  1432. return fetch(API_BASE + path, {
  1433. method: 'GET',
  1434. mode: 'cors',
  1435. credentials: 'omit',
  1436. headers: { Accept: 'application/json' }
  1437. }).then(function (res) {
  1438. if (!res.ok) throw new Error('HTTP ' + res.status);
  1439. return res.json();
  1440. });
  1441. }
  1442. /** 进入页先拉店铺概要;与 shareDynamic.html fetchGetDeleteFlagByIdIfId 相同路径与 id 参数 */
  1443. function fetchStoreInfoGetOne(storeId) {
  1444. if (!storeId) return Promise.resolve(null);
  1445. var qs = new URLSearchParams();
  1446. qs.set('id', String(storeId).trim());
  1447. return apiFetch('/store/info/getOne?' + qs.toString()).catch(function (e) {
  1448. console.warn('[store/info/getOne]', e);
  1449. return null;
  1450. });
  1451. }
  1452. function isGetOneBusinessStatus99(res) {
  1453. if (!res || typeof res !== 'object') return false;
  1454. var d = res.data;
  1455. if (d && typeof d === 'object') {
  1456. var bs = d.businessStatus;
  1457. if (bs === 99 || bs === '99' || Number(bs) === 99) return true;
  1458. }
  1459. return false;
  1460. }
  1461. var MARKETING_PREVIEW_COUNT = 3;
  1462. var closedMerchantFlag = false;
  1463. /** 关店 businessStatus=99:getOne 已置 closedMerchantFlag,或 URL 带 businessStatus=99;唤起 App 时进登录页 */
  1464. function isClosedMerchantForAppOpen() {
  1465. if (closedMerchantFlag) return true;
  1466. var bs = String(q('businessStatus') || '').trim();
  1467. if (bs === '99' || Number(bs) === 99) return true;
  1468. return false;
  1469. }
  1470. var marketingListCache = [];
  1471. /** 避免详情先返回时用空 cache 误展示「暂无活动」图 */
  1472. var marketingCouponLoaded = false;
  1473. var staffGroupsCache = [];
  1474. var performanceListCache = { records: [], total: 0 };
  1475. function isMp4VideoUrl(url) {
  1476. if (!url || typeof url !== 'string') return false;
  1477. var path = url.split(/[?#]/)[0].toLowerCase();
  1478. return path.length >= 4 && path.slice(-4) === '.mp4';
  1479. }
  1480. function getMp4PlaybackUrl(url) {
  1481. var u = String(url || '').trim();
  1482. if (!u) return '';
  1483. var q = u.indexOf('?');
  1484. var h = u.indexOf('#');
  1485. var cut = u.length;
  1486. if (q >= 0) cut = Math.min(cut, q);
  1487. if (h >= 0) cut = Math.min(cut, h);
  1488. var base = u.slice(0, cut);
  1489. if (/\.mp4$/i.test(base)) return base;
  1490. return u;
  1491. }
  1492. function mp4UrlToJpgUrl(u) {
  1493. var q = u.indexOf('?');
  1494. var h = u.indexOf('#');
  1495. var cut = u.length;
  1496. if (q >= 0) cut = Math.min(cut, q);
  1497. if (h >= 0) cut = Math.min(cut, h);
  1498. var pathPart = u.slice(0, cut);
  1499. var rest = u.slice(cut);
  1500. if (!/\.mp4$/i.test(pathPart)) return '';
  1501. return pathPart.slice(0, -4) + '.jpg' + rest;
  1502. }
  1503. function createMarketingMedia(url) {
  1504. var wrap = document.createElement('div');
  1505. wrap.className = 'marketing-card__media';
  1506. var full = String(url == null ? '' : url).trim();
  1507. if (!full) return wrap;
  1508. if (isMp4VideoUrl(full)) {
  1509. var playUrl = getMp4PlaybackUrl(full);
  1510. var vid = document.createElement('video');
  1511. vid.src = playUrl;
  1512. vid.setAttribute('controls', '');
  1513. vid.setAttribute('playsinline', '');
  1514. vid.setAttribute('webkit-playsinline', '');
  1515. vid.muted = true;
  1516. vid.setAttribute('muted', '');
  1517. vid.setAttribute('autoplay', '');
  1518. vid.preload = 'auto';
  1519. var poster = '';
  1520. if (full.length > playUrl.length) poster = full;
  1521. else poster = mp4UrlToJpgUrl(playUrl);
  1522. if (poster) vid.setAttribute('poster', poster);
  1523. vid.addEventListener('canplay', function onCap() {
  1524. vid.removeEventListener('canplay', onCap);
  1525. var p = vid.play();
  1526. if (p && typeof p.catch === 'function') p.catch(function () {});
  1527. });
  1528. wrap.appendChild(vid);
  1529. } else {
  1530. var img = document.createElement('img');
  1531. img.src = full;
  1532. img.alt = '';
  1533. img.decoding = 'async';
  1534. wrap.appendChild(img);
  1535. }
  1536. return wrap;
  1537. }
  1538. function renderMarketingList(rawList) {
  1539. marketingListCache = Array.isArray(rawList) ? rawList.slice() : [];
  1540. var section = document.getElementById('shareMarketingSection');
  1541. var listEl = document.getElementById('marketingListEl');
  1542. var moreBtn = document.getElementById('marketingMoreBtn');
  1543. var moreText = document.getElementById('marketingMoreText');
  1544. if (!section || !listEl) return;
  1545. listEl.innerHTML = '';
  1546. section.classList.remove('is-expanded');
  1547. if (moreBtn) {
  1548. moreBtn.style.display = 'none';
  1549. moreBtn.setAttribute('aria-expanded', 'false');
  1550. }
  1551. if (closedMerchantFlag) {
  1552. section.style.display = 'none';
  1553. section.setAttribute('aria-hidden', 'true');
  1554. return;
  1555. }
  1556. var items = marketingListCache.filter(function (x) {
  1557. return x && x.imgUrl && String(x.imgUrl).trim();
  1558. }).filter(function (x) {
  1559. var t = x.activityType;
  1560. if (t == null || t === '') return true;
  1561. return String(t).toUpperCase() === 'MARKETING';
  1562. });
  1563. items.sort(function (a, b) {
  1564. var sa = Number(a.imgSort);
  1565. var sb = Number(b.imgSort);
  1566. if (isNaN(sa)) sa = 0;
  1567. if (isNaN(sb)) sb = 0;
  1568. return sa - sb;
  1569. });
  1570. if (!items.length) {
  1571. if (!marketingCouponLoaded) {
  1572. section.style.display = 'none';
  1573. section.setAttribute('aria-hidden', 'true');
  1574. return;
  1575. }
  1576. section.style.display = 'block';
  1577. section.setAttribute('aria-hidden', 'false');
  1578. var emptyWrap = document.createElement('div');
  1579. emptyWrap.className = 'marketing-section__empty';
  1580. emptyWrap.setAttribute('role', 'status');
  1581. var emptyImg = document.createElement('img');
  1582. emptyImg.src = 'images/empty.png';
  1583. emptyImg.alt = '';
  1584. emptyImg.decoding = 'async';
  1585. var emptyLabel = document.createElement('p');
  1586. emptyLabel.className = 'marketing-section__empty-label';
  1587. emptyLabel.textContent = '暂无活动';
  1588. emptyWrap.appendChild(emptyImg);
  1589. emptyWrap.appendChild(emptyLabel);
  1590. listEl.appendChild(emptyWrap);
  1591. return;
  1592. }
  1593. section.style.display = 'block';
  1594. section.setAttribute('aria-hidden', 'false');
  1595. items.forEach(function (item, idx) {
  1596. var card = document.createElement('article');
  1597. card.className = 'marketing-card';
  1598. if (idx >= MARKETING_PREVIEW_COUNT) card.classList.add('marketing-card--more');
  1599. card.appendChild(createMarketingMedia(item.imgUrl));
  1600. listEl.appendChild(card);
  1601. });
  1602. var extra = items.length - MARKETING_PREVIEW_COUNT;
  1603. if (extra > 0 && moreBtn && moreText) {
  1604. moreText.textContent = '查看剩余' + extra + '个活动';
  1605. moreBtn.style.display = 'flex';
  1606. }
  1607. }
  1608. function bindMarketingMore() {
  1609. var section = document.getElementById('shareMarketingSection');
  1610. var moreBtn = document.getElementById('marketingMoreBtn');
  1611. if (!section || !moreBtn || moreBtn.dataset.bound) return;
  1612. moreBtn.dataset.bound = '1';
  1613. moreBtn.addEventListener('click', function () {
  1614. section.classList.add('is-expanded');
  1615. moreBtn.style.display = 'none';
  1616. moreBtn.setAttribute('aria-expanded', 'true');
  1617. });
  1618. }
  1619. function createStaffCardElement(staff) {
  1620. var card = document.createElement('article');
  1621. card.className = 'staff-card';
  1622. var imgWrap = document.createElement('div');
  1623. imgWrap.className = 'staff-card__img-wrap';
  1624. var imgUrl = String(staff.staffImage || '').trim();
  1625. if (imgUrl) {
  1626. var img = document.createElement('img');
  1627. img.src = imgUrl;
  1628. img.alt = String(staff.name || '');
  1629. img.decoding = 'async';
  1630. img.loading = 'lazy';
  1631. imgWrap.appendChild(img);
  1632. }
  1633. var likes = document.createElement('div');
  1634. likes.className = 'staff-card__likes';
  1635. var lc = staff.likeCount != null ? Number(staff.likeCount) : 0;
  1636. if (isNaN(lc)) lc = 0;
  1637. likes.textContent = lc + '人喜欢';
  1638. imgWrap.appendChild(likes);
  1639. var nameRow = document.createElement('div');
  1640. nameRow.className = 'staff-card__name-row';
  1641. var nameEl = document.createElement('span');
  1642. nameEl.className = 'staff-card__name';
  1643. nameEl.textContent = String(staff.name != null ? staff.name : '').trim() || '—';
  1644. nameRow.appendChild(nameEl);
  1645. var perf = staff.hasPerformanceToday;
  1646. if (perf === true || perf === 1 || String(perf).toLowerCase() === 'true') {
  1647. var badge = document.createElement('span');
  1648. badge.className = 'staff-card__badge';
  1649. badge.textContent = '今日演出';
  1650. nameRow.appendChild(badge);
  1651. }
  1652. card.appendChild(imgWrap);
  1653. card.appendChild(nameRow);
  1654. var meta = document.createElement('div');
  1655. meta.className = 'staff-card__meta';
  1656. var pos = document.createElement('span');
  1657. pos.className = 'staff-card__position';
  1658. pos.textContent = String(staff.staffPosition || '').trim() || '\u00a0';
  1659. meta.appendChild(pos);
  1660. var pc = staff.positiveCommentsCount != null ? Number(staff.positiveCommentsCount) : 0;
  1661. if (!isNaN(pc) && pc > 0) {
  1662. var sep = document.createElement('span');
  1663. sep.className = 'staff-card__sep';
  1664. sep.textContent = '|';
  1665. var rev = document.createElement('span');
  1666. rev.className = 'staff-card__reviews';
  1667. rev.textContent = '好评' + pc + '次';
  1668. meta.appendChild(sep);
  1669. meta.appendChild(rev);
  1670. }
  1671. card.appendChild(meta);
  1672. return card;
  1673. }
  1674. function createPerformanceCardElement(row) {
  1675. var card = document.createElement('article');
  1676. card.className = 'performance-card';
  1677. var posterWrap = document.createElement('div');
  1678. posterWrap.className = 'performance-card__poster';
  1679. var posterUrl = String(row.performancePoster || '').trim();
  1680. if (posterUrl) {
  1681. var img = document.createElement('img');
  1682. img.src = posterUrl;
  1683. img.alt = String(row.performanceName || '');
  1684. img.decoding = 'async';
  1685. img.loading = 'lazy';
  1686. posterWrap.appendChild(img);
  1687. }
  1688. var body = document.createElement('div');
  1689. body.className = 'performance-card__body';
  1690. var nameEl = document.createElement('div');
  1691. nameEl.className = 'performance-card__name';
  1692. nameEl.textContent = String(row.performanceName != null ? row.performanceName : '').trim() || '—';
  1693. body.appendChild(nameEl);
  1694. var dr = String(row.dateRange || '').trim();
  1695. if (dr) {
  1696. var line1 = document.createElement('div');
  1697. line1.className = 'performance-card__meta';
  1698. line1.textContent = dr;
  1699. body.appendChild(line1);
  1700. }
  1701. var si = String(row.scheduleInfo || '').trim();
  1702. if (si) {
  1703. var line2 = document.createElement('div');
  1704. line2.className = 'performance-card__meta';
  1705. line2.textContent = si;
  1706. line2.title = si;
  1707. body.appendChild(line2);
  1708. }
  1709. card.appendChild(posterWrap);
  1710. card.appendChild(body);
  1711. return card;
  1712. }
  1713. function renderPerformanceList() {
  1714. var section = document.getElementById('sharePerformanceSection');
  1715. var titleEl = document.getElementById('performanceSectionTitle');
  1716. var strip = document.getElementById('performanceStripEl');
  1717. if (!section || !titleEl || !strip) return;
  1718. strip.innerHTML = '';
  1719. if (!shouldShowPerformanceSection()) {
  1720. section.style.display = 'none';
  1721. section.setAttribute('aria-hidden', 'true');
  1722. return;
  1723. }
  1724. if (closedMerchantFlag) {
  1725. section.style.display = 'none';
  1726. section.setAttribute('aria-hidden', 'true');
  1727. return;
  1728. }
  1729. var records = performanceListCache.records;
  1730. var total = performanceListCache.total;
  1731. if (isNaN(total)) total = records.length;
  1732. titleEl.textContent = '演出安排(' + total + ')';
  1733. if (!records.length) {
  1734. section.style.display = 'none';
  1735. section.setAttribute('aria-hidden', 'true');
  1736. return;
  1737. }
  1738. section.style.display = 'block';
  1739. section.setAttribute('aria-hidden', 'false');
  1740. records.forEach(function (row) {
  1741. if (!row) return;
  1742. strip.appendChild(createPerformanceCardElement(row));
  1743. });
  1744. }
  1745. function renderStaffGroups(raw) {
  1746. staffGroupsCache = Array.isArray(raw) ? raw.slice() : [];
  1747. var section = document.getElementById('shareStaffSection');
  1748. var mount = document.getElementById('staffGroupsMount');
  1749. if (!section || !mount) return;
  1750. var totalStaff = 0;
  1751. staffGroupsCache.forEach(function (g) {
  1752. if (g && Array.isArray(g.staffList)) totalStaff += g.staffList.length;
  1753. });
  1754. var countEl = document.getElementById('staffSectionCountEl');
  1755. if (countEl) countEl.textContent = String(totalStaff);
  1756. mount.innerHTML = '';
  1757. if (closedMerchantFlag) {
  1758. section.style.display = 'none';
  1759. section.setAttribute('aria-hidden', 'true');
  1760. return;
  1761. }
  1762. var groups = staffGroupsCache.filter(function (g) {
  1763. return g && Array.isArray(g.staffList) && g.staffList.length;
  1764. });
  1765. if (!groups.length) {
  1766. section.style.display = 'none';
  1767. section.setAttribute('aria-hidden', 'true');
  1768. return;
  1769. }
  1770. section.style.display = 'block';
  1771. section.setAttribute('aria-hidden', 'false');
  1772. groups.forEach(function (group) {
  1773. var wrap = document.createElement('div');
  1774. wrap.className = 'staff-group';
  1775. if (group.titleId != null) wrap.dataset.titleId = String(group.titleId);
  1776. var strip = document.createElement('div');
  1777. strip.className = 'staff-strip';
  1778. group.staffList.forEach(function (staff) {
  1779. if (!staff) return;
  1780. strip.appendChild(createStaffCardElement(staff));
  1781. });
  1782. wrap.appendChild(strip);
  1783. mount.appendChild(wrap);
  1784. });
  1785. }
  1786. function bindStaffSection() {
  1787. var btn = document.getElementById('staffSectionAllBtn');
  1788. if (!btn || btn.dataset.bound) return;
  1789. btn.dataset.bound = '1';
  1790. btn.addEventListener('click', function (e) {
  1791. e.preventDefault();
  1792. tryOpenHBuilderApp();
  1793. });
  1794. }
  1795. function buildHeroSlides(urls) {
  1796. var track = document.getElementById('heroTrack');
  1797. var dotsWrap = document.getElementById('heroDots');
  1798. track.innerHTML = '';
  1799. dotsWrap.innerHTML = '';
  1800. var list = (urls || []).filter(Boolean);
  1801. if (!list.length) {
  1802. var slide = document.createElement('div');
  1803. slide.className = 'hero__slide';
  1804. var img = document.createElement('img');
  1805. img.src = 'images/hero.png';
  1806. img.alt = '店铺';
  1807. slide.appendChild(img);
  1808. track.appendChild(slide);
  1809. var dot = document.createElement('span');
  1810. dot.className = 'hero__dot is-active';
  1811. dotsWrap.appendChild(dot);
  1812. return initHeroCarousel(1);
  1813. }
  1814. list.forEach(function (url, d) {
  1815. var slide = document.createElement('div');
  1816. slide.className = 'hero__slide';
  1817. var img = document.createElement('img');
  1818. img.src = url;
  1819. img.alt = '店铺图';
  1820. slide.appendChild(img);
  1821. track.appendChild(slide);
  1822. var dot = document.createElement('span');
  1823. dot.className = 'hero__dot' + (d === 0 ? ' is-active' : '');
  1824. dotsWrap.appendChild(dot);
  1825. });
  1826. initHeroCarousel(list.length);
  1827. }
  1828. var heroI = 0;
  1829. var heroTimer = null;
  1830. function initHeroCarousel(slides) {
  1831. var track = document.getElementById('heroTrack');
  1832. var dotsWrap = document.getElementById('heroDots');
  1833. var dots = dotsWrap.querySelectorAll('.hero__dot');
  1834. if (slides < 2) return;
  1835. function go(n) {
  1836. heroI = (n + slides) % slides;
  1837. track.style.transform = 'translateX(' + (-heroI * 100) + '%)';
  1838. dots.forEach(function (el, idx) {
  1839. el.classList.toggle('is-active', idx === heroI);
  1840. });
  1841. }
  1842. if (heroTimer) clearInterval(heroTimer);
  1843. heroTimer = setInterval(function () { go(heroI + 1); }, 4000);
  1844. var hero = document.getElementById('hero');
  1845. var startX = 0;
  1846. hero.addEventListener('touchstart', function (e) {
  1847. startX = e.changedTouches[0].clientX;
  1848. }, { passive: true });
  1849. hero.addEventListener('touchend', function (e) {
  1850. var dx = e.changedTouches[0].clientX - startX;
  1851. if (Math.abs(dx) > 40) go(dx < 0 ? heroI + 1 : heroI - 1);
  1852. }, { passive: true });
  1853. }
  1854. function timeToMinutes(t) {
  1855. var parts = String(t || '').trim().split(':');
  1856. var h = parseInt(parts[0], 10) || 0;
  1857. var m = parseInt(parts[1], 10) || 0;
  1858. return h * 60 + m;
  1859. }
  1860. function isTimeInRange(startTime, endTime) {
  1861. var s = String(startTime || '').trim();
  1862. var e = String(endTime || '').trim();
  1863. if (s === '00:00' && e === '00:00') return true;
  1864. if (s === '00:00' && e === '23:59') return true;
  1865. var cur = new Date().getHours() * 60 + new Date().getMinutes();
  1866. var sm = timeToMinutes(s);
  1867. var em = timeToMinutes(e);
  1868. if (em < sm) {
  1869. return cur >= sm || cur <= em;
  1870. }
  1871. return cur >= sm && cur <= em;
  1872. }
  1873. function parseHolidayDate(str) {
  1874. if (!str) return null;
  1875. var d = new Date(String(str).trim().replace(/-/g, '/'));
  1876. return isNaN(d.getTime()) ? null : d;
  1877. }
  1878. function isTodayInHolidayRange(holidayInfo) {
  1879. if (!holidayInfo) return false;
  1880. var hi = holidayInfo;
  1881. if (typeof hi === 'string') {
  1882. try {
  1883. hi = JSON.parse(hi);
  1884. } catch (err) {
  1885. return false;
  1886. }
  1887. }
  1888. var start = hi.startDate || hi.holidayStartDate || hi.beginDate || hi.start || hi.holidayStart;
  1889. var end = hi.endDate || hi.holidayEndDate || hi.finishDate || hi.end || hi.holidayEnd;
  1890. if (!start || !end) return false;
  1891. var startD = parseHolidayDate(start);
  1892. var endD = parseHolidayDate(end);
  1893. if (!startD || !endD) return false;
  1894. var today = new Date();
  1895. today.setHours(0, 0, 0, 0);
  1896. startD.setHours(0, 0, 0, 0);
  1897. endD.setHours(0, 0, 0, 0);
  1898. return today >= startD && today <= endD;
  1899. }
  1900. function findNormalBusinessInfo(list) {
  1901. var wdJs = new Date().getDay();
  1902. var i;
  1903. var x;
  1904. var w;
  1905. for (i = 0; i < list.length; i++) {
  1906. x = list[i];
  1907. if (!x || x.holidayInfo) continue;
  1908. w = x.weekDay != null ? x.weekDay : x.week;
  1909. if (w === undefined || w === null) continue;
  1910. if (Number(w) === wdJs) return x;
  1911. }
  1912. var wdMap = wdJs === 0 ? 7 : wdJs;
  1913. for (i = 0; i < list.length; i++) {
  1914. x = list[i];
  1915. if (!x || x.holidayInfo) continue;
  1916. w = x.weekDay != null ? x.weekDay : x.week;
  1917. if (w === undefined || w === null) continue;
  1918. if (Number(w) === wdMap) return x;
  1919. }
  1920. for (i = 0; i < list.length; i++) {
  1921. x = list[i];
  1922. if (x && !x.holidayInfo && (x.startTime || x.endTime)) return x;
  1923. }
  1924. return null;
  1925. }
  1926. /** 营业状态:暂停营业 | 商家暂未配置营业时间 | 休息中 | 营业中 xx:xx至xx:xx | 营业中 全天营业 */
  1927. function computeBusinessStatusDisplay(d) {
  1928. if (!d) return { text: '—', isOpen: false };
  1929. if (Number(d.businessStatus) === 99) {
  1930. return { text: '商户已关闭', isOpen: false };
  1931. }
  1932. if (Number(d.businessStatus) === 1) {
  1933. return { text: '暂停营业', isOpen: false };
  1934. }
  1935. var list = d.storeBusinessInfoVos || d.storeBusinessInfos || [];
  1936. if (!list.length) {
  1937. return { text: '商家暂未配置营业时间', isOpen: false };
  1938. }
  1939. var holidayList = Array.isArray(d.holidayBusinessInfoList) && d.holidayBusinessInfoList.length
  1940. ? d.holidayBusinessInfoList
  1941. : list.filter(function (item) { return item && item.holidayInfo; });
  1942. var todayHolidayItem = holidayList.find(function (item) {
  1943. return isTodayInHolidayRange(item.holidayInfo);
  1944. });
  1945. var normal = d.normalBusinessInfo || d.normalBusinessInfoVo || findNormalBusinessInfo(list);
  1946. var isOpen = false;
  1947. var currentItem = null;
  1948. if (todayHolidayItem) {
  1949. isOpen = isTimeInRange(todayHolidayItem.startTime, todayHolidayItem.endTime);
  1950. currentItem = todayHolidayItem;
  1951. } else if (normal) {
  1952. isOpen = isTimeInRange(normal.startTime, normal.endTime);
  1953. currentItem = normal;
  1954. }
  1955. if (!currentItem) return { text: '休息中', isOpen: false };
  1956. if (!isOpen) return { text: '休息中', isOpen: false };
  1957. var st = String(currentItem.startTime || '').trim();
  1958. var et = String(currentItem.endTime || '').trim();
  1959. if (st === '00:00' && et === '00:00') return { text: '营业中 全天营业', isOpen: true };
  1960. if (st === '00:00' && et === '23:59') return { text: '营业中 全天营业', isOpen: true };
  1961. var needNextDay = timeToMinutes(et) < timeToMinutes(st);
  1962. var suffix = (needNextDay ? '次日' : '') + et;
  1963. return { text: ('营业中 ' + st + ' 至 ' + suffix).trim(), isOpen: true };
  1964. }
  1965. /**
  1966. * 分项评分:可能在 storeEvaluate 对象内,或为 JSON 字符串;部分接口把字段放在详情根上。
  1967. */
  1968. function parseStoreEvaluateRaw(raw) {
  1969. if (raw == null || raw === '') return null;
  1970. if (typeof raw === 'string') {
  1971. var t = raw.trim();
  1972. if (!t) return null;
  1973. try {
  1974. raw = JSON.parse(t);
  1975. } catch (e) {
  1976. return null;
  1977. }
  1978. }
  1979. if (Array.isArray(raw) && raw.length && raw[0] && typeof raw[0] === 'object') {
  1980. raw = raw[0];
  1981. }
  1982. if (raw && typeof raw === 'object' && !Array.isArray(raw)) return raw;
  1983. return null;
  1984. }
  1985. function getStoreEvaluateScores(d) {
  1986. var ev = parseStoreEvaluateRaw(d.storeEvaluate)
  1987. || parseStoreEvaluateRaw(d.evaluate)
  1988. || parseStoreEvaluateRaw(d.evaluateInfo);
  1989. function lane(key, snake) {
  1990. var v;
  1991. if (ev && ev[key] != null && ev[key] !== '') v = ev[key];
  1992. else if (d[key] != null && d[key] !== '') v = d[key];
  1993. else if (snake && d[snake] != null && d[snake] !== '') v = d[snake];
  1994. else return null;
  1995. var n = Number(v);
  1996. return !isNaN(n) ? n : null;
  1997. }
  1998. return {
  1999. scoreOne: lane('scoreOne', 'score_one'),
  2000. scoreTwo: lane('scoreTwo', 'score_two'),
  2001. scoreThree: lane('scoreThree', 'score_three')
  2002. };
  2003. }
  2004. function fmtEvalScore(n) {
  2005. return n != null && !isNaN(n) ? Number(n).toFixed(1) : null;
  2006. }
  2007. var CLOSED_REC_STAR_PATH =
  2008. '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';
  2009. function closedRecEscHtml(s) {
  2010. return String(s == null ? '' : s)
  2011. .replace(/&/g, '&amp;')
  2012. .replace(/</g, '&lt;')
  2013. .replace(/>/g, '&gt;')
  2014. .replace(/"/g, '&quot;');
  2015. }
  2016. function closedRecStarsHtml(score) {
  2017. var s = Number(score);
  2018. if (isNaN(s)) s = 0;
  2019. s = Math.max(0, Math.min(5, s));
  2020. var rounded = Math.round(s);
  2021. var parts = [];
  2022. var i;
  2023. for (i = 1; i <= 5; i++) {
  2024. var fill = i <= rounded ? '#F58220' : '#E5E5E5';
  2025. parts.push(
  2026. '<svg class="closed-rec-star" width="11" height="11" viewBox="0 0 24 24" aria-hidden="true">' +
  2027. '<path fill="' + fill + '" d="' + CLOSED_REC_STAR_PATH + '"/></svg>'
  2028. );
  2029. }
  2030. return '<span class="closed-rec-stars">' + parts.join('') + '</span>';
  2031. }
  2032. function closedRecFormatDistance(item) {
  2033. if (item.distance != null && item.distance !== '') {
  2034. var km = Number(item.distance);
  2035. if (!isNaN(km) && km >= 0) {
  2036. return Math.round(km * 1000) + '米';
  2037. }
  2038. return String(item.distance).trim();
  2039. }
  2040. if (item.position != null && String(item.position).trim() !== '') {
  2041. return String(item.position).trim();
  2042. }
  2043. if (item.dist != null && item.dist !== '') {
  2044. var dn = Number(item.dist);
  2045. if (!isNaN(dn)) {
  2046. return dn >= 1 ? dn.toFixed(dn % 1 === 0 ? 0 : 1) + 'km' : Math.round(dn * 1000) + '米';
  2047. }
  2048. }
  2049. return '';
  2050. }
  2051. function closedRecPickScore(item) {
  2052. var x =
  2053. item.scoreAvg != null ? Number(item.scoreAvg)
  2054. : item.score != null ? Number(item.score)
  2055. : item.rating != null ? Number(item.rating)
  2056. : item.starScore != null ? Number(item.starScore)
  2057. : NaN;
  2058. return isNaN(x) ? null : x;
  2059. }
  2060. function closedRecPickReviewCount(item) {
  2061. var n =
  2062. item.commitCount != null ? Number(item.commitCount)
  2063. : item.commentCount != null ? Number(item.commentCount)
  2064. : item.reviewCount != null ? Number(item.reviewCount)
  2065. : item.evaluateCount != null ? Number(item.evaluateCount)
  2066. : NaN;
  2067. return isNaN(n) ? 0 : Math.max(0, Math.floor(n));
  2068. }
  2069. function normalizeClosedStoreRecommendList(res) {
  2070. if (!res || typeof res !== 'object') return [];
  2071. var raw = res.data != null ? res.data : res.result;
  2072. if (Array.isArray(raw)) return raw;
  2073. if (raw && typeof raw === 'object') {
  2074. if (Array.isArray(raw.list)) return raw.list;
  2075. if (Array.isArray(raw.records)) return raw.records;
  2076. if (Array.isArray(raw.rows)) return raw.rows;
  2077. if (Array.isArray(raw.content)) return raw.content;
  2078. if (Array.isArray(raw.stores)) return raw.stores;
  2079. if (Array.isArray(raw.storeList)) return raw.storeList;
  2080. if (Array.isArray(raw.storeVos)) return raw.storeVos;
  2081. if (Array.isArray(raw.items)) return raw.items;
  2082. }
  2083. if (Array.isArray(res.list)) return res.list;
  2084. if (Array.isArray(res.records)) return res.records;
  2085. return [];
  2086. }
  2087. function fetchShareClosedStoreRecommend(storeIdStr) {
  2088. var loc = getClosedRecommendUserLocation();
  2089. var page = parseInt(q('page') || '1', 10);
  2090. var pageSize = parseInt(q('pageSize') || '10', 10);
  2091. if (isNaN(page) || page < 1) page = 1;
  2092. if (isNaN(pageSize) || pageSize < 1) pageSize = 10;
  2093. var body = {
  2094. page: page,
  2095. pageSize: pageSize,
  2096. storeId: String(storeIdStr || ''),
  2097. userCity: loc.userCity,
  2098. userLat: loc.userLat,
  2099. userLng: loc.userLng
  2100. };
  2101. return fetch(API_LIFE_AI_BASE + STORE_GLOBAL_RECOMMEND_PATH, {
  2102. method: 'POST',
  2103. mode: 'cors',
  2104. credentials: 'omit',
  2105. headers: {
  2106. Accept: 'application/json',
  2107. 'Content-Type': 'application/json;charset=UTF-8'
  2108. },
  2109. body: JSON.stringify(body)
  2110. }).then(function (res) {
  2111. if (!res.ok) throw new Error('HTTP ' + res.status);
  2112. return res.json();
  2113. });
  2114. }
  2115. function renderShareClosedRecommended(list) {
  2116. var wrap = document.getElementById('shareClosedRecList');
  2117. var empty = document.getElementById('shareClosedRecEmpty');
  2118. if (!wrap || !empty) return;
  2119. wrap.querySelectorAll('.closed-rec-card').forEach(function (n) {
  2120. n.remove();
  2121. });
  2122. if (!list || !list.length) {
  2123. empty.style.display = 'block';
  2124. return;
  2125. }
  2126. empty.style.display = 'none';
  2127. list.forEach(function (item) {
  2128. if (!item || typeof item !== 'object') return;
  2129. var imgUrlField = item.imgUrl != null ? String(item.imgUrl).trim() : '';
  2130. var home = item.homeImage != null ? String(item.homeImage).trim() : '';
  2131. if (home && /\.mp4(\?|#|$)/i.test(home)) {
  2132. var vf = item.videoFirstFrame != null ? String(item.videoFirstFrame).trim() : '';
  2133. if (vf) home = vf;
  2134. }
  2135. var imgUrl =
  2136. imgUrlField ||
  2137. home ||
  2138. (item.coverUrl != null ? String(item.coverUrl).trim() : '') ||
  2139. (item.mainImage != null ? String(item.mainImage).trim() : '') ||
  2140. (item.goodsImage != null ? String(item.goodsImage).trim() : '') ||
  2141. (item.entranceImage != null ? String(item.entranceImage).trim() : '') ||
  2142. (Array.isArray(item.goodsImageList) && item.goodsImageList[0]) ||
  2143. (Array.isArray(item.imageList) && item.imageList[0]) ||
  2144. (Array.isArray(item.storeAlbumUrlList) && item.storeAlbumUrlList[0]) ||
  2145. '';
  2146. var name = item.title != null && String(item.title).trim() !== ''
  2147. ? String(item.title).replace(/\r?\n/g, ' ').replace(/\s+/g, ' ').trim()
  2148. : (item.storeName || item.goodsName || item.secondGoodsTitle || item.name || '推荐');
  2149. var dist = closedRecFormatDistance(item);
  2150. var scoreVal = closedRecPickScore(item);
  2151. var displayScore = scoreVal != null ? scoreVal.toFixed(1) : '—';
  2152. var starScore = scoreVal != null ? scoreVal : 0;
  2153. var rc = closedRecPickReviewCount(item);
  2154. var reviewLabel = rc > 0 ? rc + '条评价' : '';
  2155. var seller =
  2156. item.userName != null && String(item.userName).trim() !== ''
  2157. ? String(item.userName).trim()
  2158. : (item.nickName != null && String(item.nickName).trim() !== ''
  2159. ? String(item.nickName).trim()
  2160. : '');
  2161. var card = document.createElement('article');
  2162. card.className = 'closed-rec-card';
  2163. card.innerHTML =
  2164. '<div class="closed-rec-card__img"><img class="closed-rec-card__cover" src="" alt="" decoding="async"></div>' +
  2165. '<div class="closed-rec-card__body">' +
  2166. '<div class="closed-rec-card__top">' +
  2167. '<span class="closed-rec-card__name">' + closedRecEscHtml(name) + '</span>' +
  2168. (dist ? '<span class="closed-rec-card__dist">' + closedRecEscHtml(dist) + '</span>' : '') +
  2169. '</div>' +
  2170. '<div class="closed-rec-card__rating">' +
  2171. closedRecStarsHtml(starScore) +
  2172. '<span class="closed-rec-rating-num">' + closedRecEscHtml(displayScore) + '</span>' +
  2173. (reviewLabel ? '<span class="closed-rec-meta">' + closedRecEscHtml(reviewLabel) + '</span>' : '') +
  2174. '</div>' +
  2175. (seller ? '<div class="closed-rec-card__footer">' + closedRecEscHtml(seller) + '</div>' : '') +
  2176. '</div>';
  2177. var coverIm = card.querySelector('img.closed-rec-card__cover');
  2178. if (coverIm) {
  2179. coverIm.src = imgUrl;
  2180. coverIm.onerror = function () {
  2181. this.onerror = null;
  2182. this.src = '';
  2183. };
  2184. }
  2185. wrap.appendChild(card);
  2186. });
  2187. }
  2188. function loadShareClosedRecommendations() {
  2189. var sid = getStoreId();
  2190. if (!sid) {
  2191. renderShareClosedRecommended([]);
  2192. return;
  2193. }
  2194. fetchShareClosedStoreRecommend(sid)
  2195. .then(function (res) {
  2196. var list = normalizeClosedStoreRecommendList(res);
  2197. if (!list.length && res && res.msg) {
  2198. console.warn('[store-recommend]', res.msg);
  2199. }
  2200. renderShareClosedRecommended(list);
  2201. })
  2202. .catch(function (e) {
  2203. console.error(e);
  2204. renderShareClosedRecommended([]);
  2205. });
  2206. }
  2207. function applyShareIndexClosedMerchantUi(closed) {
  2208. var wasClosed = closedMerchantFlag;
  2209. closedMerchantFlag = closed;
  2210. var banner = document.getElementById('shareClosedBanner');
  2211. var contentEl = document.getElementById('shareContentEl');
  2212. var belowEl = document.getElementById('shareBelowContentEl');
  2213. var recWrap = document.getElementById('shareClosedRecommendWrap');
  2214. if (banner) {
  2215. banner.style.display = closed ? 'block' : 'none';
  2216. banner.setAttribute('aria-hidden', closed ? 'false' : 'true');
  2217. }
  2218. if (contentEl) {
  2219. contentEl.style.display = closed ? 'none' : '';
  2220. contentEl.setAttribute('aria-hidden', closed ? 'true' : 'false');
  2221. }
  2222. if (belowEl) {
  2223. belowEl.style.display = '';
  2224. belowEl.setAttribute('aria-hidden', 'false');
  2225. }
  2226. if (recWrap) {
  2227. if (closed) {
  2228. recWrap.style.display = 'block';
  2229. recWrap.setAttribute('aria-hidden', 'false');
  2230. if (!wasClosed) {
  2231. loadShareClosedRecommendations();
  2232. }
  2233. } else {
  2234. recWrap.style.display = 'none';
  2235. recWrap.setAttribute('aria-hidden', 'true');
  2236. renderShareClosedRecommended([]);
  2237. }
  2238. }
  2239. }
  2240. function renderDetail(d) {
  2241. if (!d) return;
  2242. document.getElementById('storeName').textContent = d.storeName || '—';
  2243. var score = d.scoreAvg != null ? Number(d.scoreAvg) : NaN;
  2244. document.getElementById('scoreAvg').textContent = !isNaN(score) ? score.toFixed(1) : '—';
  2245. document.getElementById('commitCount').textContent = d.commitCount != null ? String(d.commitCount)+'条' : '0';
  2246. var evRow = document.getElementById('storeEvaluateRow');
  2247. var evOne = document.getElementById('storeEvaluateScoreOne');
  2248. var evTwo = document.getElementById('storeEvaluateScoreTwo');
  2249. var evThree = document.getElementById('storeEvaluateScoreThree');
  2250. if (evRow && evOne && evTwo && evThree) {
  2251. evRow.classList.remove('is-visible');
  2252. evRow.setAttribute('aria-hidden', 'true');
  2253. var es = getStoreEvaluateScores(d);
  2254. var a = fmtEvalScore(es.scoreOne);
  2255. var b = fmtEvalScore(es.scoreTwo);
  2256. var c = fmtEvalScore(es.scoreThree);
  2257. if (a !== null || b !== null || c !== null) {
  2258. evOne.textContent = a !== null ? a : '—';
  2259. evTwo.textContent = b !== null ? b : '—';
  2260. evThree.textContent = c !== null ? c : '—';
  2261. evRow.classList.add('is-visible');
  2262. evRow.setAttribute('aria-hidden', 'false');
  2263. }
  2264. }
  2265. var bizDisp = computeBusinessStatusDisplay(d);
  2266. var bizEl = document.getElementById('bizStatus');
  2267. bizEl.textContent = bizDisp.text;
  2268. bizEl.className = 'status' + (bizDisp.isOpen ? ' is-open' : '');
  2269. document.getElementById('hoursText').textContent = '';
  2270. document.getElementById('storeAddr').textContent = d.queryAddress || d.storeAddress || '—';
  2271. if (d.distance != null) {
  2272. document.getElementById('metaDistance').style.display = 'flex';
  2273. document.getElementById('distanceText').textContent =
  2274. '距您' + (Number(d.distance) > 1 ? d.distance + '千米' : Math.round(Number(d.distance) * 1000) + '米');
  2275. }
  2276. if (d.subwayName && d.distance2 != null) {
  2277. document.getElementById('metaSubway').style.display = 'flex';
  2278. document.getElementById('subwayText').textContent =
  2279. '距' + d.subwayName + '步行' + (Number(d.distance2) >= 1000
  2280. ? (Number(d.distance2) / 1000).toFixed(1) + 'km'
  2281. : Math.round(Number(d.distance2)) + 'm');
  2282. }
  2283. var imgs = [];
  2284. if (Array.isArray(d.storeAlbumUrlList) && d.storeAlbumUrlList.length) imgs = d.storeAlbumUrlList.slice();
  2285. else if (d.entranceImage) imgs = [d.entranceImage];
  2286. buildHeroSlides(imgs);
  2287. var closedMerchant = Number(d.businessStatus) === 99;
  2288. applyShareIndexClosedMerchantUi(closedMerchant);
  2289. renderMarketingList(marketingListCache);
  2290. renderPerformanceList();
  2291. renderStaffGroups(staffGroupsCache);
  2292. }
  2293. function getLngForApi() {
  2294. var v = q('jingdu');
  2295. if (v) return v;
  2296. return q('lon') || q('lng') || q('longitude');
  2297. }
  2298. function getLatForApi() {
  2299. var v = q('weidu');
  2300. if (v) return v;
  2301. return q('lat') || q('latitude');
  2302. }
  2303. function mergeSearchAndHashParamsForRedirect() {
  2304. var params = new URLSearchParams();
  2305. function ingest(slice) {
  2306. if (!slice) return;
  2307. var p = new URLSearchParams(slice);
  2308. p.forEach(function (val, key) {
  2309. params.set(key, val);
  2310. });
  2311. }
  2312. if (location.search && location.search.length > 1) {
  2313. ingest(location.search.slice(1));
  2314. }
  2315. var hash = location.hash || '';
  2316. var qi = hash.indexOf('?');
  2317. if (qi >= 0) {
  2318. ingest(hash.slice(qi + 1));
  2319. }
  2320. return params;
  2321. }
  2322. /** getClientStoreDetail 无承载数据时进 shareCheckInUndefined(businessStatus=99 与落地页约定一致) */
  2323. function buildShareCheckInUndefinedRedirectHref() {
  2324. var p = mergeSearchAndHashParamsForRedirect();
  2325. p.set('businessStatus', '99');
  2326. var sid = getStoreId();
  2327. if (sid && !p.has('storeId')) {
  2328. p.set('storeId', sid);
  2329. }
  2330. var j = getLngForApi();
  2331. var w = getLatForApi();
  2332. if (j && !p.has('userLng')) {
  2333. p.set('userLng', j);
  2334. }
  2335. if (w && !p.has('userLat')) {
  2336. p.set('userLat', w);
  2337. }
  2338. var qs = p.toString();
  2339. return 'shareCheckInUndefined.html' + (qs ? ('?' + qs) : '?businessStatus=99');
  2340. }
  2341. function run() {
  2342. var sid = getStoreId();
  2343. var userId = q('userId');
  2344. var jingdu = getLngForApi();
  2345. var weidu = getLatForApi();
  2346. if (!sid) {
  2347. showErr('缺少店铺 id(请从 App 分享链接打开,URL 需带 id 或 storeId)');
  2348. document.getElementById('storeName').textContent = '参数错误';
  2349. return;
  2350. }
  2351. var detailPath = '/store/info/getClientStoreDetail?' +
  2352. 'id=' + encodeURIComponent(sid) +
  2353. '&userId=' + encodeURIComponent(userId) +
  2354. '&jingdu=' + encodeURIComponent(jingdu) +
  2355. '&weidu=' + encodeURIComponent(weidu);
  2356. fetchStoreInfoGetOne(sid).then(function (getOneRes) {
  2357. if (isGetOneBusinessStatus99(getOneRes)) {
  2358. applyShareIndexClosedMerchantUi(true);
  2359. }
  2360. apiFetch(detailPath)
  2361. .then(function (res) {
  2362. var tip = res && res.msg != null ? String(res.msg).trim() : '';
  2363. if (tip === '暂无承载数据') {
  2364. if (closedMerchantFlag) {
  2365. return;
  2366. }
  2367. window.location.replace(buildShareCheckInUndefinedRedirectHref());
  2368. return;
  2369. }
  2370. if (res.code !== 200 || !res.data) {
  2371. showErr(res.msg || '店铺详情加载失败');
  2372. return;
  2373. }
  2374. renderDetail(res.data);
  2375. })
  2376. .catch(function (e) {
  2377. console.error(e);
  2378. showErr('店铺详情请求失败(若为 file:// 打开,请检查 CORS 或改用 http 访问本页)');
  2379. });
  2380. var couponPath = '/store/info/getStoreCouponList?storeId=' + encodeURIComponent(sid);
  2381. marketingCouponLoaded = false;
  2382. apiFetch(couponPath)
  2383. .then(function (res) {
  2384. marketingCouponLoaded = true;
  2385. var list = (res && res.code === 200 && res.data && res.data.marketingList) || [];
  2386. if (!Array.isArray(list)) list = [];
  2387. renderMarketingList(list);
  2388. })
  2389. .catch(function (e) {
  2390. marketingCouponLoaded = true;
  2391. console.warn('[getStoreCouponList]', e);
  2392. renderMarketingList([]);
  2393. });
  2394. if (shouldShowPerformanceSection()) {
  2395. var perfPath = '/performance/list/query?storeId=' + encodeURIComponent(sid) + '&page=1&size=100';
  2396. apiFetch(perfPath)
  2397. .then(function (res) {
  2398. var d = (res && res.code === 200 && res.data) || null;
  2399. if (!d || typeof d !== 'object') {
  2400. performanceListCache.records = [];
  2401. performanceListCache.total = 0;
  2402. } else {
  2403. performanceListCache.records = Array.isArray(d.records) ? d.records.slice() : [];
  2404. var pt = d.total;
  2405. performanceListCache.total = pt != null && !isNaN(Number(pt))
  2406. ? Number(pt)
  2407. : performanceListCache.records.length;
  2408. }
  2409. renderPerformanceList();
  2410. })
  2411. .catch(function (e) {
  2412. console.warn('[performance/list/query]', e);
  2413. performanceListCache.records = [];
  2414. performanceListCache.total = 0;
  2415. renderPerformanceList();
  2416. });
  2417. } else {
  2418. performanceListCache.records = [];
  2419. performanceListCache.total = 0;
  2420. renderPerformanceList();
  2421. }
  2422. var staffPath = '/storeStaffConfig/queryStaffListByTitle?storeId=' + encodeURIComponent(sid);
  2423. apiFetch(staffPath)
  2424. .then(function (res) {
  2425. var arr = (res && res.code === 200 && res.data) || [];
  2426. if (!Array.isArray(arr)) arr = [];
  2427. renderStaffGroups(arr);
  2428. })
  2429. .catch(function (e) {
  2430. console.warn('[queryStaffListByTitle]', e);
  2431. renderStaffGroups([]);
  2432. });
  2433. });
  2434. }
  2435. function boot() {
  2436. run();
  2437. bindMarketingMore();
  2438. bindStaffSection();
  2439. var launchTag = document.getElementById('launch-btn');
  2440. if (launchTag) launchTag.setAttribute('appid', WECHAT_OPEN_APP_ID);
  2441. var openBtn = document.getElementById('openApp');
  2442. if (openBtn) {
  2443. openBtn.addEventListener('click', function () {
  2444. tryOpenHBuilderApp();
  2445. });
  2446. }
  2447. initWeChatOpenLaunchApp();
  2448. }
  2449. if (document.readyState === 'complete') {
  2450. boot();
  2451. } else {
  2452. window.onload = boot;
  2453. }
  2454. })();
  2455. </script>
  2456. </body>
  2457. </html>