shareIndex.html 81 KB

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