shareIndex.html 76 KB

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