shareIndex.html 88 KB

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