shareIndex.html 80 KB

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