shareIndex.html 73 KB

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