shareIndex.html 77 KB

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