shareIndex.html 79 KB

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