shareIndex.html 80 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097209820992100210121022103210421052106210721082109211021112112211321142115211621172118211921202121212221232124212521262127212821292130213121322133213421352136213721382139214021412142214321442145214621472148214921502151215221532154215521562157215821592160216121622163216421652166216721682169217021712172217321742175217621772178217921802181218221832184218521862187218821892190219121922193219421952196219721982199220022012202220322042205220622072208220922102211221222132214221522162217221822192220222122222223222422252226222722282229223022312232223322342235223622372238223922402241224222432244224522462247224822492250225122522253225422552256225722582259226022612262226322642265226622672268226922702271227222732274227522762277227822792280228122822283228422852286228722882289229022912292229322942295229622972298229923002301230223032304230523062307230823092310231123122313231423152316231723182319232023212322232323242325232623272328232923302331233223332334233523362337233823392340234123422343234423452346234723482349235023512352235323542355235623572358235923602361236223632364236523662367236823692370237123722373237423752376237723782379238023812382238323842385238623872388238923902391239223932394239523962397239823992400240124022403240424052406240724082409241024112412241324142415241624172418241924202421242224232424242524262427242824292430243124322433243424352436243724382439244024412442244324442445244624472448244924502451245224532454245524562457245824592460246124622463246424652466246724682469247024712472247324742475247624772478247924802481248224832484248524862487248824892490249124922493249424952496249724982499250025012502250325042505250625072508250925102511251225132514251525162517251825192520252125222523252425252526252725282529253025312532253325342535253625372538253925402541254225432544254525462547254825492550255125522553255425552556255725582559256025612562256325642565256625672568256925702571257225732574257525762577257825792580258125822583258425852586258725882589259025912592259325942595259625972598259926002601260226032604260526062607260826092610261126122613261426152616261726182619262026212622262326242625262626272628262926302631263226332634263526362637263826392640264126422643264426452646264726482649265026512652265326542655265626572658265926602661266226632664266526662667266826692670267126722673267426752676267726782679268026812682268326842685268626872688268926902691269226932694269526962697269826992700270127022703270427052706270727082709271027112712271327142715271627172718271927202721272227232724272527262727272827292730273127322733273427352736273727382739274027412742274327442745274627472748274927502751275227532754275527562757275827592760276127622763276427652766276727682769277027712772277327742775
  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={页面地址,不含 query/hash}
  931. * 例:.../wx/getWxConfig?url=https://test.ailien.shop/h5/HBuilderProjects/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. /** getWxConfig 的 url 参数:仅页面地址,不带 ? 后分享参数 */
  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. /** /wx/getWxConfig 签名用 url:不含 query/hash,与后端约定一致 */
  1038. function getWxConfigSignUrl() {
  1039. if (location.origin && /^https?:/i.test(location.origin) && location.pathname) {
  1040. return location.origin + location.pathname;
  1041. }
  1042. return WX_GET_CONFIG_SIGN_URL;
  1043. }
  1044. /** 唤起 App 的 extinfo 等:保留完整分享链(含 query) */
  1045. function getPageUrlForWxSign() {
  1046. var u = String(location.href || '').split('#')[0];
  1047. if (!u || u.indexOf('file:') === 0) {
  1048. return H5_PAGE_BASE_FALLBACK + 'shareIndex.html' + (location.search || '');
  1049. }
  1050. return u;
  1051. }
  1052. function buildWxGetConfigRequestUrl(signPageUrl) {
  1053. var base = API_BASE.replace(/\/$/, '');
  1054. return (
  1055. base +
  1056. WECHAT_GET_WX_CONFIG_PATH +
  1057. '?url=' +
  1058. encodeURIComponent(signPageUrl || getWxConfigSignUrl())
  1059. );
  1060. }
  1061. /**
  1062. * 微信开放标签 extinfo:优先传当前 H5 分享链(与 App 解析分享 URL 一致);
  1063. * 超长时再传 path+query JSON,最后才用 shopro://。
  1064. */
  1065. function buildWeChatLaunchExtinfo() {
  1066. var pageUrl = getPageUrlForWxSign();
  1067. if (pageUrl && pageUrl.length <= 1024) return pageUrl;
  1068. var path = getAppUniPathForBusinessSection().replace(/^\//, '');
  1069. var qs = buildAppOpenQueryString().replace(/^\?/, '');
  1070. try {
  1071. var pack = JSON.stringify({
  1072. path: path,
  1073. query: qs,
  1074. h5: pageUrl
  1075. });
  1076. if (pack.length <= 1024) return pack;
  1077. } catch (eJson) {}
  1078. var deep = buildAppDeepLink();
  1079. if (deep && deep.length <= 1024) return deep;
  1080. return pageUrl ? pageUrl.slice(0, 1024) : deep.slice(0, 1024);
  1081. }
  1082. function absH5AssetUrl(rel) {
  1083. rel = String(rel || '').replace(/^\//, '');
  1084. var origin = location.origin;
  1085. if (origin && origin !== 'null' && /^https?:/i.test(origin)) {
  1086. var dir = location.pathname.replace(/[^/]*$/, '');
  1087. return origin + dir + rel;
  1088. }
  1089. return H5_PAGE_BASE_FALLBACK + rel;
  1090. }
  1091. function isWeChatMobileAppId(appId) {
  1092. var id = String(appId || '').trim();
  1093. if (!id) return false;
  1094. for (var i = 0; i < WECHAT_KNOWN_MOBILE_APP_IDS.length; i++) {
  1095. if (id === WECHAT_KNOWN_MOBILE_APP_IDS[i]) return true;
  1096. }
  1097. return false;
  1098. }
  1099. function resolveWxConfigAppIdFromSignData(d) {
  1100. if (!d || typeof d !== 'object') return '';
  1101. var mp =
  1102. d.mpAppId ||
  1103. d.mpAppid ||
  1104. d.officialAppId ||
  1105. d.officialAccountAppId ||
  1106. d.gzhAppId ||
  1107. d.serviceAppId;
  1108. if (mp != null && String(mp).trim() !== '') return String(mp).trim();
  1109. var fromQuery = String(q('wxMpAppId') || WECHAT_MP_APP_ID || '').trim();
  1110. if (fromQuery) return fromQuery;
  1111. var raw = d.appId || d.appid || d.wxAppId;
  1112. if (raw == null || String(raw).trim() === '') return '';
  1113. raw = String(raw).trim();
  1114. if (isWeChatMobileAppId(raw)) return '';
  1115. return raw;
  1116. }
  1117. function normalizeWxJssdkSignPayload(res) {
  1118. if (!res || typeof res !== 'object') return null;
  1119. var d = res.data != null && typeof res.data === 'object' ? res.data : res;
  1120. if (!d || typeof d !== 'object') return null;
  1121. var appId = resolveWxConfigAppIdFromSignData(d);
  1122. var timestamp = d.timestamp != null ? d.timestamp : d.timeStamp;
  1123. var nonceStr = d.nonceStr || d.noncestr || d.nonce;
  1124. var signature = d.signature || d.sign;
  1125. if (!appId || timestamp == null || !nonceStr || !signature) return null;
  1126. return {
  1127. appId: String(appId),
  1128. timestamp: Number(timestamp),
  1129. nonceStr: String(nonceStr),
  1130. signature: String(signature)
  1131. };
  1132. }
  1133. function formatWxConfigErrorTip(err, signPageUrl, rawAppId) {
  1134. var errMsg = '';
  1135. if (err && err.errMsg) errMsg = String(err.errMsg);
  1136. else if (typeof err === 'string') errMsg = err;
  1137. var tip = '微信 JSSDK 配置失败';
  1138. if (rawAppId && isWeChatMobileAppId(rawAppId)) {
  1139. return (
  1140. tip +
  1141. ':接口返回的 appId(' +
  1142. rawAppId +
  1143. ')是移动应用 ID。wx.config 必须使用公众号 AppID,请后端用公众号 AppSecret 签名并返回公众号 appId(或 data.mpAppId)。'
  1144. );
  1145. }
  1146. if (/invalid signature/i.test(errMsg)) {
  1147. return (
  1148. tip +
  1149. ':签名无效(invalid signature)。请确认后端签名使用的 url 与前端完全一致:' +
  1150. (signPageUrl || getWxConfigSignUrl())
  1151. );
  1152. }
  1153. if (/invalid appid/i.test(errMsg)) {
  1154. return tip + ':appId 无效,请使用已认证服务号的公众号 AppID。';
  1155. }
  1156. if (/invalid url/i.test(errMsg)) {
  1157. return tip + ':域名未在公众号 JS 接口安全域名中,或未在开放平台绑定域名与移动应用。';
  1158. }
  1159. if (errMsg) return tip + ':' + errMsg;
  1160. return tip + ',开放标签不可用。';
  1161. }
  1162. function fetchWeChatJssdkSign() {
  1163. var signPageUrl = getWxConfigSignUrl();
  1164. var urls = [];
  1165. var custom = getWeChatJssdkSignRequestUrl();
  1166. if (custom) {
  1167. var sep0 = custom.indexOf('?') >= 0 ? '&' : '?';
  1168. urls.push(custom + sep0 + 'url=' + encodeURIComponent(signPageUrl));
  1169. } else {
  1170. urls.push(buildWxGetConfigRequestUrl(signPageUrl));
  1171. }
  1172. function tryUrl(idx) {
  1173. if (idx >= urls.length) return Promise.resolve(null);
  1174. return fetch(urls[idx], {
  1175. method: 'GET',
  1176. mode: 'cors',
  1177. credentials: 'omit',
  1178. headers: { Accept: 'application/json' }
  1179. })
  1180. .then(function (r) {
  1181. if (!r.ok) throw new Error('HTTP ' + r.status);
  1182. return r.json();
  1183. })
  1184. .then(function (res) {
  1185. if (res && res.code != null) {
  1186. var c = Number(res.code);
  1187. if (c !== 200 && c !== 0 && res.success !== true) {
  1188. throw new Error(res.msg || 'sign rejected');
  1189. }
  1190. }
  1191. var pack = normalizeWxJssdkSignPayload(res);
  1192. if (!pack) {
  1193. var rd =
  1194. res.data != null && typeof res.data === 'object' ? res.data : res;
  1195. var rawId = rd && (rd.appId || rd.appid) ? String(rd.appId || rd.appid) : '';
  1196. if (rawId && isWeChatMobileAppId(rawId)) {
  1197. return Promise.reject({ mobileAppId: rawId });
  1198. }
  1199. throw new Error('empty sign payload');
  1200. }
  1201. return pack;
  1202. })
  1203. .catch(function (err) {
  1204. if (err && err.mobileAppId) return Promise.reject(err);
  1205. return tryUrl(idx + 1);
  1206. });
  1207. }
  1208. return tryUrl(0);
  1209. }
  1210. function setFabLaunchMode(mode) {
  1211. var wxWrap = document.getElementById('fabWrapWx');
  1212. var fbWrap = document.getElementById('fabWrapFallback');
  1213. if (mode === 'wx') {
  1214. if (wxWrap) {
  1215. wxWrap.classList.add('is-active');
  1216. wxWrap.setAttribute('aria-hidden', 'false');
  1217. }
  1218. if (fbWrap) {
  1219. fbWrap.style.display = 'none';
  1220. fbWrap.setAttribute('aria-hidden', 'true');
  1221. }
  1222. } else {
  1223. if (wxWrap) {
  1224. wxWrap.classList.remove('is-active');
  1225. wxWrap.setAttribute('aria-hidden', 'true');
  1226. }
  1227. if (fbWrap) {
  1228. fbWrap.style.display = '';
  1229. fbWrap.setAttribute('aria-hidden', 'false');
  1230. }
  1231. }
  1232. }
  1233. function bindWeChatLaunchTagEvents() {
  1234. var tag = document.getElementById('launch-btn');
  1235. if (!tag) return;
  1236. try {
  1237. tag.setAttribute('extinfo', buildWeChatLaunchExtinfo());
  1238. } catch (eExt) {}
  1239. tag.addEventListener('launch', function () {
  1240. console.log('[wx-open-launch-app] launch ok');
  1241. });
  1242. tag.addEventListener('error', function (e) {
  1243. var detail = e && e.detail;
  1244. console.warn('[wx-open-launch-app]', detail);
  1245. var errMsg =
  1246. detail && detail.errMsg
  1247. ? String(detail.errMsg)
  1248. : detail && detail.errmsg
  1249. ? String(detail.errmsg)
  1250. : '';
  1251. if (/launch:fail/i.test(errMsg)) {
  1252. showAppOpenFailTip(
  1253. '微信未能唤起 App(' +
  1254. errMsg +
  1255. ')。请确认已安装 App,且移动应用已与公众号关联。'
  1256. );
  1257. } else {
  1258. showAppOpenFailTip();
  1259. }
  1260. });
  1261. }
  1262. /**
  1263. * 进入页即 GET /wx/getWxConfig(任意浏览器都会请求,便于联调);
  1264. * 仅微信内且签名成功后再 wx.config + 展示开放标签按钮。
  1265. */
  1266. function initWeChatOpenLaunchApp() {
  1267. var inWx = isWeChatInAppBrowser();
  1268. var signPageUrl = getWxConfigSignUrl();
  1269. var reqUrl = buildWxGetConfigRequestUrl(signPageUrl);
  1270. if (!inWx) {
  1271. setFabLaunchMode('scheme');
  1272. } else {
  1273. var domainHint = checkWxJsSafeDomainHint();
  1274. if (domainHint) {
  1275. console.warn('[wx]', domainHint);
  1276. showAppOpenFailTip(domainHint);
  1277. }
  1278. var fbWrap0 = document.getElementById('fabWrapFallback');
  1279. if (fbWrap0) {
  1280. fbWrap0.style.display = 'none';
  1281. fbWrap0.setAttribute('aria-hidden', 'true');
  1282. }
  1283. }
  1284. console.log('[wx] GET', reqUrl);
  1285. return fetchWeChatJssdkSign()
  1286. .then(function (sign) {
  1287. if (!inWx) {
  1288. if (!sign) {
  1289. console.warn('[wx] getWxConfig empty (non-wechat preview)');
  1290. }
  1291. return false;
  1292. }
  1293. if (typeof wx === 'undefined') {
  1294. console.warn('[wx] jweixin not loaded');
  1295. setFabLaunchMode('scheme');
  1296. return false;
  1297. }
  1298. bindWeChatLaunchTagEvents();
  1299. if (!sign) {
  1300. console.warn('[wx] GET ' + WECHAT_GET_WX_CONFIG_PATH + ' — invalid sign for wx.config');
  1301. showAppOpenFailTip(
  1302. formatWxConfigErrorTip(null, signPageUrl, 'wxf5f1efe3a9f5012e')
  1303. );
  1304. setFabLaunchMode('scheme');
  1305. return false;
  1306. }
  1307. console.log('[wx.config] appId=', sign.appId, 'signUrl=', signPageUrl);
  1308. return new Promise(function (resolve) {
  1309. wx.config({
  1310. debug: String(q('wxDebug') || '') === '1',
  1311. appId: sign.appId,
  1312. timestamp: sign.timestamp,
  1313. nonceStr: sign.nonceStr,
  1314. signature: sign.signature,
  1315. jsApiList: ['checkJsApi'],
  1316. openTagList: ['wx-open-launch-app']
  1317. });
  1318. wx.ready(function () {
  1319. weChatJssdkConfigured = true;
  1320. var tag = document.getElementById('launch-btn');
  1321. if (tag) {
  1322. try {
  1323. tag.setAttribute('extinfo', buildWeChatLaunchExtinfo());
  1324. } catch (eReady) {}
  1325. }
  1326. setFabLaunchMode('wx');
  1327. resolve(true);
  1328. });
  1329. wx.error(function (err) {
  1330. console.warn('[wx.config]', err);
  1331. weChatJssdkConfigured = false;
  1332. showAppOpenFailTip(formatWxConfigErrorTip(err, signPageUrl, ''));
  1333. setFabLaunchMode('scheme');
  1334. resolve(false);
  1335. });
  1336. });
  1337. })
  1338. .catch(function (e) {
  1339. console.warn('[wx] init failed', e);
  1340. if (inWx) {
  1341. if (e && e.mobileAppId) {
  1342. showAppOpenFailTip(
  1343. formatWxConfigErrorTip(null, signPageUrl, e.mobileAppId)
  1344. );
  1345. }
  1346. setFabLaunchMode('scheme');
  1347. }
  1348. return false;
  1349. });
  1350. }
  1351. function isCustomAppSchemeUrl(url) {
  1352. var s = String(url || '').trim();
  1353. if (!s) return false;
  1354. if (/^https?:/i.test(s)) return false;
  1355. return /^[a-z][a-z0-9+.-]*:/i.test(s);
  1356. }
  1357. function launchAppDeepLink(deepLink) {
  1358. deepLink = String(deepLink || '').trim();
  1359. if (!deepLink) return;
  1360. if (isCustomAppSchemeUrl(deepLink)) {
  1361. var anchor = document.getElementById('appDeepLinkAnchor');
  1362. if (!anchor) {
  1363. anchor = document.createElement('a');
  1364. anchor.id = 'appDeepLinkAnchor';
  1365. anchor.setAttribute('aria-hidden', 'true');
  1366. anchor.style.cssText =
  1367. 'position:fixed;left:-9999px;top:0;width:1px;height:1px;opacity:0;pointer-events:none;';
  1368. document.body.appendChild(anchor);
  1369. }
  1370. anchor.setAttribute('href', deepLink);
  1371. anchor.click();
  1372. return;
  1373. }
  1374. try {
  1375. window.location.href = deepLink;
  1376. } catch (eHref) {}
  1377. }
  1378. /**
  1379. * 有 plus:检测 App 是否安装后 openURL;深链形如 shopro://{APP_UNI_STORE_PATH}?…
  1380. * 系统浏览器:scheme 唤起;微信内优先 wx-open-launch-app,失败再 scheme(不再弹「在浏览器中打开」)。
  1381. */
  1382. function tryOpenHBuilderApp() {
  1383. /** 微信内且开放标签已配置:仅开放标签可唤起,scheme 会被拦截,勿误报「去应用商店」 */
  1384. if (isWeChatInAppBrowser() && weChatJssdkConfigured) {
  1385. showAppOpenFailTip('请使用页面底部「APP内打开」按钮(微信开放标签)。');
  1386. return;
  1387. }
  1388. var deepLink = buildAppDeepLink();
  1389. var inWx = isWeChatInAppBrowser();
  1390. if (typeof plus !== 'undefined' && plus.runtime) {
  1391. var installed = null;
  1392. try {
  1393. if (typeof plus.runtime.isApplicationExist === 'function') {
  1394. installed = plus.runtime.isApplicationExist({
  1395. pname: APP_ANDROID_PACKAGE,
  1396. action: APP_IOS_URL_SCHEME
  1397. });
  1398. }
  1399. } catch (e) {
  1400. console.warn(e);
  1401. }
  1402. try {
  1403. plus.runtime.openURL(deepLink);
  1404. } catch (e2) {
  1405. console.warn(e2);
  1406. if (installed === false) {
  1407. showDownloadTip();
  1408. } else if (!inWx) {
  1409. showAppOpenFailTip();
  1410. }
  1411. }
  1412. return;
  1413. }
  1414. var done = false;
  1415. function finish() {
  1416. if (done) return;
  1417. done = true;
  1418. document.removeEventListener('visibilitychange', onVis);
  1419. window.removeEventListener('pagehide', onHide);
  1420. }
  1421. function onVis() {
  1422. if (document.visibilityState === 'hidden') finish();
  1423. }
  1424. function onHide() {
  1425. finish();
  1426. }
  1427. document.addEventListener('visibilitychange', onVis);
  1428. window.addEventListener('pagehide', onHide);
  1429. try {
  1430. launchAppDeepLink(deepLink);
  1431. } catch (e3) {
  1432. finish();
  1433. if (!inWx) showAppOpenFailTip();
  1434. return;
  1435. }
  1436. /**
  1437. * 微信内 scheme 常被拦截且页面仍 visible,原 2.6s 后 showDownloadTip 会误报「请到应用商店下载」。
  1438. * 与 shareDynamic 一致:超时仅收尾,不弹下载提示。
  1439. */
  1440. window.setTimeout(function () {
  1441. finish();
  1442. }, 3200);
  1443. }
  1444. function qs() {
  1445. return new URLSearchParams(location.search || '');
  1446. }
  1447. function q(name) {
  1448. var v = qs().get(name);
  1449. return v == null ? '' : String(v);
  1450. }
  1451. function showErr(msg) {
  1452. var el = document.getElementById('pageError');
  1453. el.textContent = msg;
  1454. el.style.display = 'block';
  1455. }
  1456. function getStoreId() {
  1457. return q('id') || q('storeId');
  1458. }
  1459. function shouldShowPerformanceSection() {
  1460. return String(q('businessSection') || '').trim() === '2';
  1461. }
  1462. function apiFetch(path) {
  1463. return fetch(API_BASE + path, {
  1464. method: 'GET',
  1465. mode: 'cors',
  1466. credentials: 'omit',
  1467. headers: { Accept: 'application/json' }
  1468. }).then(function (res) {
  1469. if (!res.ok) throw new Error('HTTP ' + res.status);
  1470. return res.json();
  1471. });
  1472. }
  1473. /** 进入页先拉店铺概要;与 shareDynamic.html fetchGetDeleteFlagByIdIfId 相同路径与 id 参数 */
  1474. function fetchStoreInfoGetOne(storeId) {
  1475. if (!storeId) return Promise.resolve(null);
  1476. var qs = new URLSearchParams();
  1477. qs.set('id', String(storeId).trim());
  1478. return apiFetch('/store/info/getOne?' + qs.toString()).catch(function (e) {
  1479. console.warn('[store/info/getOne]', e);
  1480. return null;
  1481. });
  1482. }
  1483. function isGetOneBusinessStatus99(res) {
  1484. if (!res || typeof res !== 'object') return false;
  1485. var d = res.data;
  1486. if (d && typeof d === 'object') {
  1487. var bs = d.businessStatus;
  1488. if (bs === 99 || bs === '99' || Number(bs) === 99) return true;
  1489. }
  1490. return false;
  1491. }
  1492. var MARKETING_PREVIEW_COUNT = 3;
  1493. var closedMerchantFlag = false;
  1494. /** 关店 businessStatus=99:getOne 已置 closedMerchantFlag,或 URL 带 businessStatus=99;唤起 App 时进登录页 */
  1495. function isClosedMerchantForAppOpen() {
  1496. if (closedMerchantFlag) return true;
  1497. var bs = String(q('businessStatus') || '').trim();
  1498. if (bs === '99' || Number(bs) === 99) return true;
  1499. return false;
  1500. }
  1501. var marketingListCache = [];
  1502. /** 避免详情先返回时用空 cache 误展示「暂无活动」图 */
  1503. var marketingCouponLoaded = false;
  1504. var staffGroupsCache = [];
  1505. var performanceListCache = { records: [], total: 0 };
  1506. function isMp4VideoUrl(url) {
  1507. if (!url || typeof url !== 'string') return false;
  1508. var path = url.split(/[?#]/)[0].toLowerCase();
  1509. return path.length >= 4 && path.slice(-4) === '.mp4';
  1510. }
  1511. function getMp4PlaybackUrl(url) {
  1512. var u = String(url || '').trim();
  1513. if (!u) return '';
  1514. var q = u.indexOf('?');
  1515. var h = u.indexOf('#');
  1516. var cut = u.length;
  1517. if (q >= 0) cut = Math.min(cut, q);
  1518. if (h >= 0) cut = Math.min(cut, h);
  1519. var base = u.slice(0, cut);
  1520. if (/\.mp4$/i.test(base)) return base;
  1521. return u;
  1522. }
  1523. function mp4UrlToJpgUrl(u) {
  1524. var q = u.indexOf('?');
  1525. var h = u.indexOf('#');
  1526. var cut = u.length;
  1527. if (q >= 0) cut = Math.min(cut, q);
  1528. if (h >= 0) cut = Math.min(cut, h);
  1529. var pathPart = u.slice(0, cut);
  1530. var rest = u.slice(cut);
  1531. if (!/\.mp4$/i.test(pathPart)) return '';
  1532. return pathPart.slice(0, -4) + '.jpg' + rest;
  1533. }
  1534. function createMarketingMedia(url) {
  1535. var wrap = document.createElement('div');
  1536. wrap.className = 'marketing-card__media';
  1537. var full = String(url == null ? '' : url).trim();
  1538. if (!full) return wrap;
  1539. if (isMp4VideoUrl(full)) {
  1540. var playUrl = getMp4PlaybackUrl(full);
  1541. var vid = document.createElement('video');
  1542. vid.src = playUrl;
  1543. vid.setAttribute('controls', '');
  1544. vid.setAttribute('playsinline', '');
  1545. vid.setAttribute('webkit-playsinline', '');
  1546. vid.muted = true;
  1547. vid.setAttribute('muted', '');
  1548. vid.setAttribute('autoplay', '');
  1549. vid.preload = 'auto';
  1550. var poster = '';
  1551. if (full.length > playUrl.length) poster = full;
  1552. else poster = mp4UrlToJpgUrl(playUrl);
  1553. if (poster) vid.setAttribute('poster', poster);
  1554. vid.addEventListener('canplay', function onCap() {
  1555. vid.removeEventListener('canplay', onCap);
  1556. var p = vid.play();
  1557. if (p && typeof p.catch === 'function') p.catch(function () {});
  1558. });
  1559. wrap.appendChild(vid);
  1560. } else {
  1561. var img = document.createElement('img');
  1562. img.src = full;
  1563. img.alt = '';
  1564. img.decoding = 'async';
  1565. wrap.appendChild(img);
  1566. }
  1567. return wrap;
  1568. }
  1569. function renderMarketingList(rawList) {
  1570. marketingListCache = Array.isArray(rawList) ? rawList.slice() : [];
  1571. var section = document.getElementById('shareMarketingSection');
  1572. var listEl = document.getElementById('marketingListEl');
  1573. var moreBtn = document.getElementById('marketingMoreBtn');
  1574. var moreText = document.getElementById('marketingMoreText');
  1575. if (!section || !listEl) return;
  1576. listEl.innerHTML = '';
  1577. section.classList.remove('is-expanded');
  1578. if (moreBtn) {
  1579. moreBtn.style.display = 'none';
  1580. moreBtn.setAttribute('aria-expanded', 'false');
  1581. }
  1582. if (closedMerchantFlag) {
  1583. section.style.display = 'none';
  1584. section.setAttribute('aria-hidden', 'true');
  1585. return;
  1586. }
  1587. var items = marketingListCache.filter(function (x) {
  1588. return x && x.imgUrl && String(x.imgUrl).trim();
  1589. }).filter(function (x) {
  1590. var t = x.activityType;
  1591. if (t == null || t === '') return true;
  1592. return String(t).toUpperCase() === 'MARKETING';
  1593. });
  1594. items.sort(function (a, b) {
  1595. var sa = Number(a.imgSort);
  1596. var sb = Number(b.imgSort);
  1597. if (isNaN(sa)) sa = 0;
  1598. if (isNaN(sb)) sb = 0;
  1599. return sa - sb;
  1600. });
  1601. if (!items.length) {
  1602. if (!marketingCouponLoaded) {
  1603. section.style.display = 'none';
  1604. section.setAttribute('aria-hidden', 'true');
  1605. return;
  1606. }
  1607. section.style.display = 'block';
  1608. section.setAttribute('aria-hidden', 'false');
  1609. var emptyWrap = document.createElement('div');
  1610. emptyWrap.className = 'marketing-section__empty';
  1611. emptyWrap.setAttribute('role', 'status');
  1612. var emptyImg = document.createElement('img');
  1613. emptyImg.src = 'images/empty.png';
  1614. emptyImg.alt = '';
  1615. emptyImg.decoding = 'async';
  1616. var emptyLabel = document.createElement('p');
  1617. emptyLabel.className = 'marketing-section__empty-label';
  1618. emptyLabel.textContent = '暂无活动';
  1619. emptyWrap.appendChild(emptyImg);
  1620. emptyWrap.appendChild(emptyLabel);
  1621. listEl.appendChild(emptyWrap);
  1622. return;
  1623. }
  1624. section.style.display = 'block';
  1625. section.setAttribute('aria-hidden', 'false');
  1626. items.forEach(function (item, idx) {
  1627. var card = document.createElement('article');
  1628. card.className = 'marketing-card';
  1629. if (idx >= MARKETING_PREVIEW_COUNT) card.classList.add('marketing-card--more');
  1630. card.appendChild(createMarketingMedia(item.imgUrl));
  1631. listEl.appendChild(card);
  1632. });
  1633. var extra = items.length - MARKETING_PREVIEW_COUNT;
  1634. if (extra > 0 && moreBtn && moreText) {
  1635. moreText.textContent = '查看剩余' + extra + '个活动';
  1636. moreBtn.style.display = 'flex';
  1637. }
  1638. }
  1639. function bindMarketingMore() {
  1640. var section = document.getElementById('shareMarketingSection');
  1641. var moreBtn = document.getElementById('marketingMoreBtn');
  1642. if (!section || !moreBtn || moreBtn.dataset.bound) return;
  1643. moreBtn.dataset.bound = '1';
  1644. moreBtn.addEventListener('click', function () {
  1645. section.classList.add('is-expanded');
  1646. moreBtn.style.display = 'none';
  1647. moreBtn.setAttribute('aria-expanded', 'true');
  1648. });
  1649. }
  1650. function createStaffCardElement(staff) {
  1651. var card = document.createElement('article');
  1652. card.className = 'staff-card';
  1653. var imgWrap = document.createElement('div');
  1654. imgWrap.className = 'staff-card__img-wrap';
  1655. var imgUrl = String(staff.staffImage || '').trim();
  1656. if (imgUrl) {
  1657. var img = document.createElement('img');
  1658. img.src = imgUrl;
  1659. img.alt = String(staff.name || '');
  1660. img.decoding = 'async';
  1661. img.loading = 'lazy';
  1662. imgWrap.appendChild(img);
  1663. }
  1664. var likes = document.createElement('div');
  1665. likes.className = 'staff-card__likes';
  1666. var lc = staff.likeCount != null ? Number(staff.likeCount) : 0;
  1667. if (isNaN(lc)) lc = 0;
  1668. likes.textContent = lc + '人喜欢';
  1669. imgWrap.appendChild(likes);
  1670. var nameRow = document.createElement('div');
  1671. nameRow.className = 'staff-card__name-row';
  1672. var nameEl = document.createElement('span');
  1673. nameEl.className = 'staff-card__name';
  1674. nameEl.textContent = String(staff.name != null ? staff.name : '').trim() || '—';
  1675. nameRow.appendChild(nameEl);
  1676. var perf = staff.hasPerformanceToday;
  1677. if (perf === true || perf === 1 || String(perf).toLowerCase() === 'true') {
  1678. var badge = document.createElement('span');
  1679. badge.className = 'staff-card__badge';
  1680. badge.textContent = '今日演出';
  1681. nameRow.appendChild(badge);
  1682. }
  1683. card.appendChild(imgWrap);
  1684. card.appendChild(nameRow);
  1685. var meta = document.createElement('div');
  1686. meta.className = 'staff-card__meta';
  1687. var pos = document.createElement('span');
  1688. pos.className = 'staff-card__position';
  1689. pos.textContent = String(staff.staffPosition || '').trim() || '\u00a0';
  1690. meta.appendChild(pos);
  1691. var pc = staff.positiveCommentsCount != null ? Number(staff.positiveCommentsCount) : 0;
  1692. if (!isNaN(pc) && pc > 0) {
  1693. var sep = document.createElement('span');
  1694. sep.className = 'staff-card__sep';
  1695. sep.textContent = '|';
  1696. var rev = document.createElement('span');
  1697. rev.className = 'staff-card__reviews';
  1698. rev.textContent = '好评' + pc + '次';
  1699. meta.appendChild(sep);
  1700. meta.appendChild(rev);
  1701. }
  1702. card.appendChild(meta);
  1703. return card;
  1704. }
  1705. function createPerformanceCardElement(row) {
  1706. var card = document.createElement('article');
  1707. card.className = 'performance-card';
  1708. var posterWrap = document.createElement('div');
  1709. posterWrap.className = 'performance-card__poster';
  1710. var posterUrl = String(row.performancePoster || '').trim();
  1711. if (posterUrl) {
  1712. var img = document.createElement('img');
  1713. img.src = posterUrl;
  1714. img.alt = String(row.performanceName || '');
  1715. img.decoding = 'async';
  1716. img.loading = 'lazy';
  1717. posterWrap.appendChild(img);
  1718. }
  1719. var body = document.createElement('div');
  1720. body.className = 'performance-card__body';
  1721. var nameEl = document.createElement('div');
  1722. nameEl.className = 'performance-card__name';
  1723. nameEl.textContent = String(row.performanceName != null ? row.performanceName : '').trim() || '—';
  1724. body.appendChild(nameEl);
  1725. var dr = String(row.dateRange || '').trim();
  1726. if (dr) {
  1727. var line1 = document.createElement('div');
  1728. line1.className = 'performance-card__meta';
  1729. line1.textContent = dr;
  1730. body.appendChild(line1);
  1731. }
  1732. var si = String(row.scheduleInfo || '').trim();
  1733. if (si) {
  1734. var line2 = document.createElement('div');
  1735. line2.className = 'performance-card__meta';
  1736. line2.textContent = si;
  1737. line2.title = si;
  1738. body.appendChild(line2);
  1739. }
  1740. card.appendChild(posterWrap);
  1741. card.appendChild(body);
  1742. return card;
  1743. }
  1744. function renderPerformanceList() {
  1745. var section = document.getElementById('sharePerformanceSection');
  1746. var titleEl = document.getElementById('performanceSectionTitle');
  1747. var strip = document.getElementById('performanceStripEl');
  1748. if (!section || !titleEl || !strip) return;
  1749. strip.innerHTML = '';
  1750. if (!shouldShowPerformanceSection()) {
  1751. section.style.display = 'none';
  1752. section.setAttribute('aria-hidden', 'true');
  1753. return;
  1754. }
  1755. if (closedMerchantFlag) {
  1756. section.style.display = 'none';
  1757. section.setAttribute('aria-hidden', 'true');
  1758. return;
  1759. }
  1760. var records = performanceListCache.records;
  1761. var total = performanceListCache.total;
  1762. if (isNaN(total)) total = records.length;
  1763. titleEl.textContent = '演出安排(' + total + ')';
  1764. if (!records.length) {
  1765. section.style.display = 'none';
  1766. section.setAttribute('aria-hidden', 'true');
  1767. return;
  1768. }
  1769. section.style.display = 'block';
  1770. section.setAttribute('aria-hidden', 'false');
  1771. records.forEach(function (row) {
  1772. if (!row) return;
  1773. strip.appendChild(createPerformanceCardElement(row));
  1774. });
  1775. }
  1776. function renderStaffGroups(raw) {
  1777. staffGroupsCache = Array.isArray(raw) ? raw.slice() : [];
  1778. var section = document.getElementById('shareStaffSection');
  1779. var mount = document.getElementById('staffGroupsMount');
  1780. if (!section || !mount) return;
  1781. var totalStaff = 0;
  1782. staffGroupsCache.forEach(function (g) {
  1783. if (g && Array.isArray(g.staffList)) totalStaff += g.staffList.length;
  1784. });
  1785. var countEl = document.getElementById('staffSectionCountEl');
  1786. if (countEl) countEl.textContent = String(totalStaff);
  1787. mount.innerHTML = '';
  1788. if (closedMerchantFlag) {
  1789. section.style.display = 'none';
  1790. section.setAttribute('aria-hidden', 'true');
  1791. return;
  1792. }
  1793. var groups = staffGroupsCache.filter(function (g) {
  1794. return g && Array.isArray(g.staffList) && g.staffList.length;
  1795. });
  1796. if (!groups.length) {
  1797. section.style.display = 'none';
  1798. section.setAttribute('aria-hidden', 'true');
  1799. return;
  1800. }
  1801. section.style.display = 'block';
  1802. section.setAttribute('aria-hidden', 'false');
  1803. groups.forEach(function (group) {
  1804. var wrap = document.createElement('div');
  1805. wrap.className = 'staff-group';
  1806. if (group.titleId != null) wrap.dataset.titleId = String(group.titleId);
  1807. var strip = document.createElement('div');
  1808. strip.className = 'staff-strip';
  1809. group.staffList.forEach(function (staff) {
  1810. if (!staff) return;
  1811. strip.appendChild(createStaffCardElement(staff));
  1812. });
  1813. wrap.appendChild(strip);
  1814. mount.appendChild(wrap);
  1815. });
  1816. }
  1817. function bindStaffSection() {
  1818. var btn = document.getElementById('staffSectionAllBtn');
  1819. if (!btn || btn.dataset.bound) return;
  1820. btn.dataset.bound = '1';
  1821. btn.addEventListener('click', function (e) {
  1822. e.preventDefault();
  1823. tryOpenHBuilderApp();
  1824. });
  1825. }
  1826. function buildHeroSlides(urls) {
  1827. var track = document.getElementById('heroTrack');
  1828. var dotsWrap = document.getElementById('heroDots');
  1829. track.innerHTML = '';
  1830. dotsWrap.innerHTML = '';
  1831. var list = (urls || []).filter(Boolean);
  1832. if (!list.length) {
  1833. var slide = document.createElement('div');
  1834. slide.className = 'hero__slide';
  1835. var img = document.createElement('img');
  1836. img.src = 'images/hero.png';
  1837. img.alt = '店铺';
  1838. slide.appendChild(img);
  1839. track.appendChild(slide);
  1840. var dot = document.createElement('span');
  1841. dot.className = 'hero__dot is-active';
  1842. dotsWrap.appendChild(dot);
  1843. return initHeroCarousel(1);
  1844. }
  1845. list.forEach(function (url, d) {
  1846. var slide = document.createElement('div');
  1847. slide.className = 'hero__slide';
  1848. var img = document.createElement('img');
  1849. img.src = url;
  1850. img.alt = '店铺图';
  1851. slide.appendChild(img);
  1852. track.appendChild(slide);
  1853. var dot = document.createElement('span');
  1854. dot.className = 'hero__dot' + (d === 0 ? ' is-active' : '');
  1855. dotsWrap.appendChild(dot);
  1856. });
  1857. initHeroCarousel(list.length);
  1858. }
  1859. var heroI = 0;
  1860. var heroTimer = null;
  1861. function initHeroCarousel(slides) {
  1862. var track = document.getElementById('heroTrack');
  1863. var dotsWrap = document.getElementById('heroDots');
  1864. var dots = dotsWrap.querySelectorAll('.hero__dot');
  1865. if (slides < 2) return;
  1866. function go(n) {
  1867. heroI = (n + slides) % slides;
  1868. track.style.transform = 'translateX(' + (-heroI * 100) + '%)';
  1869. dots.forEach(function (el, idx) {
  1870. el.classList.toggle('is-active', idx === heroI);
  1871. });
  1872. }
  1873. if (heroTimer) clearInterval(heroTimer);
  1874. heroTimer = setInterval(function () { go(heroI + 1); }, 4000);
  1875. var hero = document.getElementById('hero');
  1876. var startX = 0;
  1877. hero.addEventListener('touchstart', function (e) {
  1878. startX = e.changedTouches[0].clientX;
  1879. }, { passive: true });
  1880. hero.addEventListener('touchend', function (e) {
  1881. var dx = e.changedTouches[0].clientX - startX;
  1882. if (Math.abs(dx) > 40) go(dx < 0 ? heroI + 1 : heroI - 1);
  1883. }, { passive: true });
  1884. }
  1885. function timeToMinutes(t) {
  1886. var parts = String(t || '').trim().split(':');
  1887. var h = parseInt(parts[0], 10) || 0;
  1888. var m = parseInt(parts[1], 10) || 0;
  1889. return h * 60 + m;
  1890. }
  1891. function isTimeInRange(startTime, endTime) {
  1892. var s = String(startTime || '').trim();
  1893. var e = String(endTime || '').trim();
  1894. if (s === '00:00' && e === '00:00') return true;
  1895. if (s === '00:00' && e === '23:59') return true;
  1896. var cur = new Date().getHours() * 60 + new Date().getMinutes();
  1897. var sm = timeToMinutes(s);
  1898. var em = timeToMinutes(e);
  1899. if (em < sm) {
  1900. return cur >= sm || cur <= em;
  1901. }
  1902. return cur >= sm && cur <= em;
  1903. }
  1904. function parseHolidayDate(str) {
  1905. if (!str) return null;
  1906. var d = new Date(String(str).trim().replace(/-/g, '/'));
  1907. return isNaN(d.getTime()) ? null : d;
  1908. }
  1909. function isTodayInHolidayRange(holidayInfo) {
  1910. if (!holidayInfo) return false;
  1911. var hi = holidayInfo;
  1912. if (typeof hi === 'string') {
  1913. try {
  1914. hi = JSON.parse(hi);
  1915. } catch (err) {
  1916. return false;
  1917. }
  1918. }
  1919. var start = hi.startDate || hi.holidayStartDate || hi.beginDate || hi.start || hi.holidayStart;
  1920. var end = hi.endDate || hi.holidayEndDate || hi.finishDate || hi.end || hi.holidayEnd;
  1921. if (!start || !end) return false;
  1922. var startD = parseHolidayDate(start);
  1923. var endD = parseHolidayDate(end);
  1924. if (!startD || !endD) return false;
  1925. var today = new Date();
  1926. today.setHours(0, 0, 0, 0);
  1927. startD.setHours(0, 0, 0, 0);
  1928. endD.setHours(0, 0, 0, 0);
  1929. return today >= startD && today <= endD;
  1930. }
  1931. function findNormalBusinessInfo(list) {
  1932. var wdJs = new Date().getDay();
  1933. var i;
  1934. var x;
  1935. var w;
  1936. for (i = 0; i < list.length; i++) {
  1937. x = list[i];
  1938. if (!x || x.holidayInfo) continue;
  1939. w = x.weekDay != null ? x.weekDay : x.week;
  1940. if (w === undefined || w === null) continue;
  1941. if (Number(w) === wdJs) return x;
  1942. }
  1943. var wdMap = wdJs === 0 ? 7 : wdJs;
  1944. for (i = 0; i < list.length; i++) {
  1945. x = list[i];
  1946. if (!x || x.holidayInfo) continue;
  1947. w = x.weekDay != null ? x.weekDay : x.week;
  1948. if (w === undefined || w === null) continue;
  1949. if (Number(w) === wdMap) return x;
  1950. }
  1951. for (i = 0; i < list.length; i++) {
  1952. x = list[i];
  1953. if (x && !x.holidayInfo && (x.startTime || x.endTime)) return x;
  1954. }
  1955. return null;
  1956. }
  1957. /** 营业状态:暂停营业 | 商家暂未配置营业时间 | 休息中 | 营业中 xx:xx至xx:xx | 营业中 全天营业 */
  1958. function computeBusinessStatusDisplay(d) {
  1959. if (!d) return { text: '—', isOpen: false };
  1960. if (Number(d.businessStatus) === 99) {
  1961. return { text: '商户已关闭', isOpen: false };
  1962. }
  1963. if (Number(d.businessStatus) === 1) {
  1964. return { text: '暂停营业', isOpen: false };
  1965. }
  1966. var list = d.storeBusinessInfoVos || d.storeBusinessInfos || [];
  1967. if (!list.length) {
  1968. return { text: '商家暂未配置营业时间', isOpen: false };
  1969. }
  1970. var holidayList = Array.isArray(d.holidayBusinessInfoList) && d.holidayBusinessInfoList.length
  1971. ? d.holidayBusinessInfoList
  1972. : list.filter(function (item) { return item && item.holidayInfo; });
  1973. var todayHolidayItem = holidayList.find(function (item) {
  1974. return isTodayInHolidayRange(item.holidayInfo);
  1975. });
  1976. var normal = d.normalBusinessInfo || d.normalBusinessInfoVo || findNormalBusinessInfo(list);
  1977. var isOpen = false;
  1978. var currentItem = null;
  1979. if (todayHolidayItem) {
  1980. isOpen = isTimeInRange(todayHolidayItem.startTime, todayHolidayItem.endTime);
  1981. currentItem = todayHolidayItem;
  1982. } else if (normal) {
  1983. isOpen = isTimeInRange(normal.startTime, normal.endTime);
  1984. currentItem = normal;
  1985. }
  1986. if (!currentItem) return { text: '休息中', isOpen: false };
  1987. if (!isOpen) return { text: '休息中', isOpen: false };
  1988. var st = String(currentItem.startTime || '').trim();
  1989. var et = String(currentItem.endTime || '').trim();
  1990. if (st === '00:00' && et === '00:00') return { text: '营业中 全天营业', isOpen: true };
  1991. if (st === '00:00' && et === '23:59') return { text: '营业中 全天营业', isOpen: true };
  1992. var needNextDay = timeToMinutes(et) < timeToMinutes(st);
  1993. var suffix = (needNextDay ? '次日' : '') + et;
  1994. return { text: ('营业中 ' + st + ' 至 ' + suffix).trim(), isOpen: true };
  1995. }
  1996. /**
  1997. * 分项评分:可能在 storeEvaluate 对象内,或为 JSON 字符串;部分接口把字段放在详情根上。
  1998. */
  1999. function parseStoreEvaluateRaw(raw) {
  2000. if (raw == null || raw === '') return null;
  2001. if (typeof raw === 'string') {
  2002. var t = raw.trim();
  2003. if (!t) return null;
  2004. try {
  2005. raw = JSON.parse(t);
  2006. } catch (e) {
  2007. return null;
  2008. }
  2009. }
  2010. if (Array.isArray(raw) && raw.length && raw[0] && typeof raw[0] === 'object') {
  2011. raw = raw[0];
  2012. }
  2013. if (raw && typeof raw === 'object' && !Array.isArray(raw)) return raw;
  2014. return null;
  2015. }
  2016. function getStoreEvaluateScores(d) {
  2017. var ev = parseStoreEvaluateRaw(d.storeEvaluate)
  2018. || parseStoreEvaluateRaw(d.evaluate)
  2019. || parseStoreEvaluateRaw(d.evaluateInfo);
  2020. function lane(key, snake) {
  2021. var v;
  2022. if (ev && ev[key] != null && ev[key] !== '') v = ev[key];
  2023. else if (d[key] != null && d[key] !== '') v = d[key];
  2024. else if (snake && d[snake] != null && d[snake] !== '') v = d[snake];
  2025. else return null;
  2026. var n = Number(v);
  2027. return !isNaN(n) ? n : null;
  2028. }
  2029. return {
  2030. scoreOne: lane('scoreOne', 'score_one'),
  2031. scoreTwo: lane('scoreTwo', 'score_two'),
  2032. scoreThree: lane('scoreThree', 'score_three')
  2033. };
  2034. }
  2035. function fmtEvalScore(n) {
  2036. return n != null && !isNaN(n) ? Number(n).toFixed(1) : null;
  2037. }
  2038. var CLOSED_REC_STAR_PATH =
  2039. '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';
  2040. function closedRecEscHtml(s) {
  2041. return String(s == null ? '' : s)
  2042. .replace(/&/g, '&amp;')
  2043. .replace(/</g, '&lt;')
  2044. .replace(/>/g, '&gt;')
  2045. .replace(/"/g, '&quot;');
  2046. }
  2047. function closedRecStarsHtml(score) {
  2048. var s = Number(score);
  2049. if (isNaN(s)) s = 0;
  2050. s = Math.max(0, Math.min(5, s));
  2051. var rounded = Math.round(s);
  2052. var parts = [];
  2053. var i;
  2054. for (i = 1; i <= 5; i++) {
  2055. var fill = i <= rounded ? '#F58220' : '#E5E5E5';
  2056. parts.push(
  2057. '<svg class="closed-rec-star" width="11" height="11" viewBox="0 0 24 24" aria-hidden="true">' +
  2058. '<path fill="' + fill + '" d="' + CLOSED_REC_STAR_PATH + '"/></svg>'
  2059. );
  2060. }
  2061. return '<span class="closed-rec-stars">' + parts.join('') + '</span>';
  2062. }
  2063. function closedRecFormatDistance(item) {
  2064. if (item.distance != null && item.distance !== '') {
  2065. var km = Number(item.distance);
  2066. if (!isNaN(km) && km >= 0) {
  2067. return Math.round(km * 1000) + '米';
  2068. }
  2069. return String(item.distance).trim();
  2070. }
  2071. if (item.position != null && String(item.position).trim() !== '') {
  2072. return String(item.position).trim();
  2073. }
  2074. if (item.dist != null && item.dist !== '') {
  2075. var dn = Number(item.dist);
  2076. if (!isNaN(dn)) {
  2077. return dn >= 1 ? dn.toFixed(dn % 1 === 0 ? 0 : 1) + 'km' : Math.round(dn * 1000) + '米';
  2078. }
  2079. }
  2080. return '';
  2081. }
  2082. function closedRecPickScore(item) {
  2083. var x =
  2084. item.scoreAvg != null ? Number(item.scoreAvg)
  2085. : item.score != null ? Number(item.score)
  2086. : item.rating != null ? Number(item.rating)
  2087. : item.starScore != null ? Number(item.starScore)
  2088. : NaN;
  2089. return isNaN(x) ? null : x;
  2090. }
  2091. function closedRecPickReviewCount(item) {
  2092. var n =
  2093. item.commitCount != null ? Number(item.commitCount)
  2094. : item.commentCount != null ? Number(item.commentCount)
  2095. : item.reviewCount != null ? Number(item.reviewCount)
  2096. : item.evaluateCount != null ? Number(item.evaluateCount)
  2097. : NaN;
  2098. return isNaN(n) ? 0 : Math.max(0, Math.floor(n));
  2099. }
  2100. function normalizeClosedStoreRecommendList(res) {
  2101. if (!res || typeof res !== 'object') return [];
  2102. var raw = res.data != null ? res.data : res.result;
  2103. if (Array.isArray(raw)) return raw;
  2104. if (raw && typeof raw === 'object') {
  2105. if (Array.isArray(raw.list)) return raw.list;
  2106. if (Array.isArray(raw.records)) return raw.records;
  2107. if (Array.isArray(raw.rows)) return raw.rows;
  2108. if (Array.isArray(raw.content)) return raw.content;
  2109. if (Array.isArray(raw.stores)) return raw.stores;
  2110. if (Array.isArray(raw.storeList)) return raw.storeList;
  2111. if (Array.isArray(raw.storeVos)) return raw.storeVos;
  2112. if (Array.isArray(raw.items)) return raw.items;
  2113. }
  2114. if (Array.isArray(res.list)) return res.list;
  2115. if (Array.isArray(res.records)) return res.records;
  2116. return [];
  2117. }
  2118. function fetchShareClosedStoreRecommend(storeIdStr) {
  2119. var latRaw = (q('userLat') || q('latitude') || q('lat') || q('weidu')).trim();
  2120. var lngRaw = (q('userLng') || q('longitude') || q('lon') || q('jingdu')).trim();
  2121. var userLat =
  2122. latRaw !== '' && !isNaN(Number(latRaw)) ? Number(latRaw) : DEFAULT_REC_USER_LAT;
  2123. var userLng =
  2124. lngRaw !== '' && !isNaN(Number(lngRaw)) ? Number(lngRaw) : DEFAULT_REC_USER_LNG;
  2125. var page = parseInt(q('page') || '1', 10);
  2126. var pageSize = parseInt(q('pageSize') || '10', 10);
  2127. if (isNaN(page) || page < 1) page = 1;
  2128. if (isNaN(pageSize) || pageSize < 1) pageSize = 10;
  2129. var userCityRaw = (q('userCity') || q('city') || '').trim();
  2130. var userCity = userCityRaw !== '' ? userCityRaw : DEFAULT_REC_USER_CITY;
  2131. var body = {
  2132. page: page,
  2133. pageSize: pageSize,
  2134. storeId: String(storeIdStr || ''),
  2135. userCity: userCity,
  2136. userLat: userLat,
  2137. userLng: userLng
  2138. };
  2139. return fetch(API_LIFE_AI_BASE + STORE_GLOBAL_RECOMMEND_PATH, {
  2140. method: 'POST',
  2141. mode: 'cors',
  2142. credentials: 'omit',
  2143. headers: {
  2144. Accept: 'application/json',
  2145. 'Content-Type': 'application/json;charset=UTF-8'
  2146. },
  2147. body: JSON.stringify(body)
  2148. }).then(function (res) {
  2149. if (!res.ok) throw new Error('HTTP ' + res.status);
  2150. return res.json();
  2151. });
  2152. }
  2153. function renderShareClosedRecommended(list) {
  2154. var wrap = document.getElementById('shareClosedRecList');
  2155. var empty = document.getElementById('shareClosedRecEmpty');
  2156. if (!wrap || !empty) return;
  2157. wrap.querySelectorAll('.closed-rec-card').forEach(function (n) {
  2158. n.remove();
  2159. });
  2160. if (!list || !list.length) {
  2161. empty.style.display = 'block';
  2162. return;
  2163. }
  2164. empty.style.display = 'none';
  2165. list.forEach(function (item) {
  2166. if (!item || typeof item !== 'object') return;
  2167. var imgUrlField = item.imgUrl != null ? String(item.imgUrl).trim() : '';
  2168. var home = item.homeImage != null ? String(item.homeImage).trim() : '';
  2169. if (home && /\.mp4(\?|#|$)/i.test(home)) {
  2170. var vf = item.videoFirstFrame != null ? String(item.videoFirstFrame).trim() : '';
  2171. if (vf) home = vf;
  2172. }
  2173. var imgUrl =
  2174. imgUrlField ||
  2175. home ||
  2176. (item.coverUrl != null ? String(item.coverUrl).trim() : '') ||
  2177. (item.mainImage != null ? String(item.mainImage).trim() : '') ||
  2178. (item.goodsImage != null ? String(item.goodsImage).trim() : '') ||
  2179. (item.entranceImage != null ? String(item.entranceImage).trim() : '') ||
  2180. (Array.isArray(item.goodsImageList) && item.goodsImageList[0]) ||
  2181. (Array.isArray(item.imageList) && item.imageList[0]) ||
  2182. (Array.isArray(item.storeAlbumUrlList) && item.storeAlbumUrlList[0]) ||
  2183. '';
  2184. var name = item.title != null && String(item.title).trim() !== ''
  2185. ? String(item.title).replace(/\r?\n/g, ' ').replace(/\s+/g, ' ').trim()
  2186. : (item.storeName || item.goodsName || item.secondGoodsTitle || item.name || '推荐');
  2187. var dist = closedRecFormatDistance(item);
  2188. var scoreVal = closedRecPickScore(item);
  2189. var displayScore = scoreVal != null ? scoreVal.toFixed(1) : '—';
  2190. var starScore = scoreVal != null ? scoreVal : 0;
  2191. var rc = closedRecPickReviewCount(item);
  2192. var reviewLabel = rc > 0 ? rc + '条评价' : '';
  2193. var seller =
  2194. item.userName != null && String(item.userName).trim() !== ''
  2195. ? String(item.userName).trim()
  2196. : (item.nickName != null && String(item.nickName).trim() !== ''
  2197. ? String(item.nickName).trim()
  2198. : '');
  2199. var card = document.createElement('article');
  2200. card.className = 'closed-rec-card';
  2201. card.innerHTML =
  2202. '<div class="closed-rec-card__img"><img class="closed-rec-card__cover" src="" alt="" decoding="async"></div>' +
  2203. '<div class="closed-rec-card__body">' +
  2204. '<div class="closed-rec-card__top">' +
  2205. '<span class="closed-rec-card__name">' + closedRecEscHtml(name) + '</span>' +
  2206. (dist ? '<span class="closed-rec-card__dist">' + closedRecEscHtml(dist) + '</span>' : '') +
  2207. '</div>' +
  2208. '<div class="closed-rec-card__rating">' +
  2209. closedRecStarsHtml(starScore) +
  2210. '<span class="closed-rec-rating-num">' + closedRecEscHtml(displayScore) + '</span>' +
  2211. (reviewLabel ? '<span class="closed-rec-meta">' + closedRecEscHtml(reviewLabel) + '</span>' : '') +
  2212. '</div>' +
  2213. (seller ? '<div class="closed-rec-card__footer">' + closedRecEscHtml(seller) + '</div>' : '') +
  2214. '</div>';
  2215. var coverIm = card.querySelector('img.closed-rec-card__cover');
  2216. if (coverIm) {
  2217. coverIm.src = imgUrl;
  2218. coverIm.onerror = function () {
  2219. this.onerror = null;
  2220. this.src = '';
  2221. };
  2222. }
  2223. wrap.appendChild(card);
  2224. });
  2225. }
  2226. function loadShareClosedRecommendations() {
  2227. var sid = getStoreId();
  2228. if (!sid) {
  2229. renderShareClosedRecommended([]);
  2230. return;
  2231. }
  2232. fetchShareClosedStoreRecommend(sid)
  2233. .then(function (res) {
  2234. var list = normalizeClosedStoreRecommendList(res);
  2235. if (!list.length && res && res.msg) {
  2236. console.warn('[store-recommend]', res.msg);
  2237. }
  2238. renderShareClosedRecommended(list);
  2239. })
  2240. .catch(function (e) {
  2241. console.error(e);
  2242. renderShareClosedRecommended([]);
  2243. });
  2244. }
  2245. function applyShareIndexClosedMerchantUi(closed) {
  2246. var wasClosed = closedMerchantFlag;
  2247. closedMerchantFlag = closed;
  2248. var banner = document.getElementById('shareClosedBanner');
  2249. var contentEl = document.getElementById('shareContentEl');
  2250. var belowEl = document.getElementById('shareBelowContentEl');
  2251. var recWrap = document.getElementById('shareClosedRecommendWrap');
  2252. if (banner) {
  2253. banner.style.display = closed ? 'block' : 'none';
  2254. banner.setAttribute('aria-hidden', closed ? 'false' : 'true');
  2255. }
  2256. if (contentEl) {
  2257. contentEl.style.display = closed ? 'none' : '';
  2258. contentEl.setAttribute('aria-hidden', closed ? 'true' : 'false');
  2259. }
  2260. if (belowEl) {
  2261. belowEl.style.display = '';
  2262. belowEl.setAttribute('aria-hidden', 'false');
  2263. }
  2264. if (recWrap) {
  2265. if (closed) {
  2266. recWrap.style.display = 'block';
  2267. recWrap.setAttribute('aria-hidden', 'false');
  2268. if (!wasClosed) {
  2269. loadShareClosedRecommendations();
  2270. }
  2271. } else {
  2272. recWrap.style.display = 'none';
  2273. recWrap.setAttribute('aria-hidden', 'true');
  2274. renderShareClosedRecommended([]);
  2275. }
  2276. }
  2277. }
  2278. function renderDetail(d) {
  2279. if (!d) return;
  2280. document.getElementById('storeName').textContent = d.storeName || '—';
  2281. var score = d.scoreAvg != null ? Number(d.scoreAvg) : NaN;
  2282. document.getElementById('scoreAvg').textContent = !isNaN(score) ? score.toFixed(1) : '—';
  2283. document.getElementById('commitCount').textContent = d.commitCount != null ? String(d.commitCount)+'条' : '0';
  2284. var evRow = document.getElementById('storeEvaluateRow');
  2285. var evOne = document.getElementById('storeEvaluateScoreOne');
  2286. var evTwo = document.getElementById('storeEvaluateScoreTwo');
  2287. var evThree = document.getElementById('storeEvaluateScoreThree');
  2288. if (evRow && evOne && evTwo && evThree) {
  2289. evRow.classList.remove('is-visible');
  2290. evRow.setAttribute('aria-hidden', 'true');
  2291. var es = getStoreEvaluateScores(d);
  2292. var a = fmtEvalScore(es.scoreOne);
  2293. var b = fmtEvalScore(es.scoreTwo);
  2294. var c = fmtEvalScore(es.scoreThree);
  2295. if (a !== null || b !== null || c !== null) {
  2296. evOne.textContent = a !== null ? a : '—';
  2297. evTwo.textContent = b !== null ? b : '—';
  2298. evThree.textContent = c !== null ? c : '—';
  2299. evRow.classList.add('is-visible');
  2300. evRow.setAttribute('aria-hidden', 'false');
  2301. }
  2302. }
  2303. var bizDisp = computeBusinessStatusDisplay(d);
  2304. var bizEl = document.getElementById('bizStatus');
  2305. bizEl.textContent = bizDisp.text;
  2306. bizEl.className = 'status' + (bizDisp.isOpen ? ' is-open' : '');
  2307. document.getElementById('hoursText').textContent = '';
  2308. document.getElementById('storeAddr').textContent = d.queryAddress || d.storeAddress || '—';
  2309. if (d.distance != null) {
  2310. document.getElementById('metaDistance').style.display = 'flex';
  2311. document.getElementById('distanceText').textContent =
  2312. '距您' + (Number(d.distance) > 1 ? d.distance + '千米' : Math.round(Number(d.distance) * 1000) + '米');
  2313. }
  2314. if (d.subwayName && d.distance2 != null) {
  2315. document.getElementById('metaSubway').style.display = 'flex';
  2316. document.getElementById('subwayText').textContent =
  2317. '距' + d.subwayName + '步行' + (Number(d.distance2) >= 1000
  2318. ? (Number(d.distance2) / 1000).toFixed(1) + 'km'
  2319. : Math.round(Number(d.distance2)) + 'm');
  2320. }
  2321. var imgs = [];
  2322. if (Array.isArray(d.storeAlbumUrlList) && d.storeAlbumUrlList.length) imgs = d.storeAlbumUrlList.slice();
  2323. else if (d.entranceImage) imgs = [d.entranceImage];
  2324. buildHeroSlides(imgs);
  2325. var closedMerchant = Number(d.businessStatus) === 99;
  2326. applyShareIndexClosedMerchantUi(closedMerchant);
  2327. renderMarketingList(marketingListCache);
  2328. renderPerformanceList();
  2329. renderStaffGroups(staffGroupsCache);
  2330. }
  2331. function getLngForApi() {
  2332. var v = q('jingdu');
  2333. if (v) return v;
  2334. return q('lon') || q('lng') || q('longitude');
  2335. }
  2336. function getLatForApi() {
  2337. var v = q('weidu');
  2338. if (v) return v;
  2339. return q('lat') || q('latitude');
  2340. }
  2341. function mergeSearchAndHashParamsForRedirect() {
  2342. var params = new URLSearchParams();
  2343. function ingest(slice) {
  2344. if (!slice) return;
  2345. var p = new URLSearchParams(slice);
  2346. p.forEach(function (val, key) {
  2347. params.set(key, val);
  2348. });
  2349. }
  2350. if (location.search && location.search.length > 1) {
  2351. ingest(location.search.slice(1));
  2352. }
  2353. var hash = location.hash || '';
  2354. var qi = hash.indexOf('?');
  2355. if (qi >= 0) {
  2356. ingest(hash.slice(qi + 1));
  2357. }
  2358. return params;
  2359. }
  2360. /** getClientStoreDetail 无承载数据时进 shareCheckInUndefined(businessStatus=99 与落地页约定一致) */
  2361. function buildShareCheckInUndefinedRedirectHref() {
  2362. var p = mergeSearchAndHashParamsForRedirect();
  2363. p.set('businessStatus', '99');
  2364. var sid = getStoreId();
  2365. if (sid && !p.has('storeId')) {
  2366. p.set('storeId', sid);
  2367. }
  2368. var j = getLngForApi();
  2369. var w = getLatForApi();
  2370. if (j && !p.has('userLng')) {
  2371. p.set('userLng', j);
  2372. }
  2373. if (w && !p.has('userLat')) {
  2374. p.set('userLat', w);
  2375. }
  2376. var qs = p.toString();
  2377. return 'shareCheckInUndefined.html' + (qs ? ('?' + qs) : '?businessStatus=99');
  2378. }
  2379. function run() {
  2380. var sid = getStoreId();
  2381. var userId = q('userId');
  2382. var jingdu = getLngForApi();
  2383. var weidu = getLatForApi();
  2384. if (!sid) {
  2385. showErr('缺少店铺 id(请从 App 分享链接打开,URL 需带 id 或 storeId)');
  2386. document.getElementById('storeName').textContent = '参数错误';
  2387. return;
  2388. }
  2389. var detailPath = '/store/info/getClientStoreDetail?' +
  2390. 'id=' + encodeURIComponent(sid) +
  2391. '&userId=' + encodeURIComponent(userId) +
  2392. '&jingdu=' + encodeURIComponent(jingdu) +
  2393. '&weidu=' + encodeURIComponent(weidu);
  2394. fetchStoreInfoGetOne(sid).then(function (getOneRes) {
  2395. if (isGetOneBusinessStatus99(getOneRes)) {
  2396. applyShareIndexClosedMerchantUi(true);
  2397. }
  2398. apiFetch(detailPath)
  2399. .then(function (res) {
  2400. var tip = res && res.msg != null ? String(res.msg).trim() : '';
  2401. if (tip === '暂无承载数据') {
  2402. if (closedMerchantFlag) {
  2403. return;
  2404. }
  2405. window.location.replace(buildShareCheckInUndefinedRedirectHref());
  2406. return;
  2407. }
  2408. if (res.code !== 200 || !res.data) {
  2409. showErr(res.msg || '店铺详情加载失败');
  2410. return;
  2411. }
  2412. renderDetail(res.data);
  2413. })
  2414. .catch(function (e) {
  2415. console.error(e);
  2416. showErr('店铺详情请求失败(若为 file:// 打开,请检查 CORS 或改用 http 访问本页)');
  2417. });
  2418. var couponPath = '/store/info/getStoreCouponList?storeId=' + encodeURIComponent(sid);
  2419. marketingCouponLoaded = false;
  2420. apiFetch(couponPath)
  2421. .then(function (res) {
  2422. marketingCouponLoaded = true;
  2423. var list = (res && res.code === 200 && res.data && res.data.marketingList) || [];
  2424. if (!Array.isArray(list)) list = [];
  2425. renderMarketingList(list);
  2426. })
  2427. .catch(function (e) {
  2428. marketingCouponLoaded = true;
  2429. console.warn('[getStoreCouponList]', e);
  2430. renderMarketingList([]);
  2431. });
  2432. if (shouldShowPerformanceSection()) {
  2433. var perfPath = '/performance/list/query?storeId=' + encodeURIComponent(sid) + '&page=1&size=100';
  2434. apiFetch(perfPath)
  2435. .then(function (res) {
  2436. var d = (res && res.code === 200 && res.data) || null;
  2437. if (!d || typeof d !== 'object') {
  2438. performanceListCache.records = [];
  2439. performanceListCache.total = 0;
  2440. } else {
  2441. performanceListCache.records = Array.isArray(d.records) ? d.records.slice() : [];
  2442. var pt = d.total;
  2443. performanceListCache.total = pt != null && !isNaN(Number(pt))
  2444. ? Number(pt)
  2445. : performanceListCache.records.length;
  2446. }
  2447. renderPerformanceList();
  2448. })
  2449. .catch(function (e) {
  2450. console.warn('[performance/list/query]', e);
  2451. performanceListCache.records = [];
  2452. performanceListCache.total = 0;
  2453. renderPerformanceList();
  2454. });
  2455. } else {
  2456. performanceListCache.records = [];
  2457. performanceListCache.total = 0;
  2458. renderPerformanceList();
  2459. }
  2460. var staffPath = '/storeStaffConfig/queryStaffListByTitle?storeId=' + encodeURIComponent(sid);
  2461. apiFetch(staffPath)
  2462. .then(function (res) {
  2463. var arr = (res && res.code === 200 && res.data) || [];
  2464. if (!Array.isArray(arr)) arr = [];
  2465. renderStaffGroups(arr);
  2466. })
  2467. .catch(function (e) {
  2468. console.warn('[queryStaffListByTitle]', e);
  2469. renderStaffGroups([]);
  2470. });
  2471. });
  2472. }
  2473. function boot() {
  2474. run();
  2475. bindMarketingMore();
  2476. bindStaffSection();
  2477. var openBtn = document.getElementById('openApp');
  2478. if (openBtn) {
  2479. openBtn.addEventListener('click', function () {
  2480. tryOpenHBuilderApp();
  2481. });
  2482. }
  2483. }
  2484. /** 进入页立即请求 getWxConfig,不等到 window.onload */
  2485. initWeChatOpenLaunchApp();
  2486. if (document.readyState === 'complete') {
  2487. boot();
  2488. } else {
  2489. window.onload = boot;
  2490. }
  2491. })();
  2492. </script>
  2493. </body>
  2494. </html>