shareIndex.html 80 KB

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