shareIndex.html 85 KB

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