shareIndex.html 81 KB

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