shareIndex.html 86 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097209820992100210121022103210421052106210721082109211021112112211321142115211621172118211921202121212221232124212521262127212821292130213121322133213421352136213721382139214021412142214321442145214621472148214921502151215221532154215521562157215821592160216121622163216421652166216721682169217021712172217321742175217621772178217921802181218221832184218521862187218821892190219121922193219421952196219721982199220022012202220322042205220622072208220922102211221222132214221522162217221822192220222122222223222422252226222722282229223022312232223322342235223622372238223922402241224222432244224522462247224822492250225122522253225422552256225722582259226022612262226322642265226622672268226922702271227222732274227522762277227822792280228122822283228422852286228722882289229022912292229322942295229622972298229923002301230223032304230523062307230823092310231123122313231423152316231723182319232023212322232323242325232623272328232923302331233223332334233523362337233823392340234123422343234423452346234723482349235023512352235323542355235623572358235923602361236223632364236523662367236823692370237123722373237423752376237723782379238023812382238323842385238623872388238923902391239223932394239523962397239823992400240124022403240424052406240724082409241024112412241324142415241624172418241924202421242224232424242524262427242824292430243124322433243424352436243724382439244024412442244324442445244624472448244924502451245224532454245524562457245824592460246124622463246424652466246724682469247024712472247324742475247624772478247924802481248224832484248524862487248824892490249124922493249424952496249724982499250025012502250325042505250625072508250925102511251225132514251525162517251825192520252125222523252425252526252725282529253025312532253325342535253625372538253925402541254225432544254525462547254825492550255125522553255425552556255725582559256025612562256325642565256625672568256925702571257225732574257525762577257825792580258125822583258425852586258725882589259025912592259325942595259625972598259926002601260226032604260526062607260826092610261126122613261426152616261726182619262026212622262326242625262626272628262926302631263226332634263526362637263826392640264126422643264426452646264726482649265026512652265326542655265626572658265926602661266226632664266526662667266826692670267126722673267426752676267726782679268026812682268326842685268626872688268926902691269226932694269526962697269826992700270127022703270427052706270727082709271027112712271327142715271627172718271927202721272227232724272527262727272827292730273127322733273427352736273727382739274027412742274327442745274627472748274927502751275227532754275527562757275827592760276127622763276427652766276727682769277027712772277327742775277627772778277927802781278227832784278527862787278827892790279127922793279427952796279727982799280028012802280328042805280628072808280928102811281228132814281528162817281828192820282128222823282428252826282728282829283028312832283328342835283628372838283928402841284228432844284528462847284828492850285128522853285428552856285728582859286028612862286328642865286628672868286928702871287228732874287528762877287828792880288128822883288428852886288728882889289028912892289328942895289628972898289929002901290229032904290529062907290829092910291129122913291429152916291729182919292029212922292329242925292629272928292929302931293229332934293529362937293829392940294129422943294429452946294729482949295029512952295329542955295629572958295929602961296229632964296529662967296829692970297129722973297429752976297729782979298029812982298329842985
  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. * 后端 POST {API_BASE}/wx/getWxConfig,body 传 url(当前页完整地址)须用:AppID wx412792c77f47babd + 服务号 AppSecret
  969. *
  970. * 签名 url 官方要求(invalid signature 排查):
  971. * 1. 前端用 location.href.split('#')[0] 动态取当前页完整 URL(含 ? 参数,不含 #)
  972. * 2. 作为 body.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 getWxGetConfigApiUrl() {
  1174. return API_BASE.replace(/\/$/, '') + WECHAT_GET_WX_CONFIG_PATH;
  1175. }
  1176. function buildWxGetConfigRequestBody(htmlUrl) {
  1177. return {
  1178. url: 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. * POST getWxConfig,body: { url: 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 = getWxGetConfigApiUrl();
  1299. var requestBody = buildWxGetConfigRequestBody(htmlUrl);
  1300. console.log('[wx] htmlUrl=', htmlUrl);
  1301. console.log('[wx] POST getWxConfig →', requestUrl, requestBody);
  1302. return fetch(requestUrl, {
  1303. method: 'POST',
  1304. mode: 'cors',
  1305. credentials: 'omit',
  1306. headers: {
  1307. Accept: 'application/json',
  1308. 'Content-Type': 'application/json;charset=UTF-8'
  1309. },
  1310. body: JSON.stringify(requestBody)
  1311. })
  1312. .then(function (r) {
  1313. if (r.ok) return r.json();
  1314. return r
  1315. .text()
  1316. .catch(function () {
  1317. return '';
  1318. })
  1319. .then(function (text) {
  1320. var hint = '';
  1321. try {
  1322. var j = JSON.parse(text);
  1323. hint = j.msg || j.message || '';
  1324. } catch (eP) {
  1325. if (text) hint = text.slice(0, 120);
  1326. }
  1327. throw new Error('getWxConfig HTTP ' + r.status + (hint ? ':' + hint : ''));
  1328. });
  1329. })
  1330. .then(function (res) {
  1331. if (res && res.code != null) {
  1332. var c = Number(res.code);
  1333. if (c !== 200 && c !== 0 && res.success !== true) {
  1334. throw new Error(res.msg || res.message || 'getWxConfig code ' + c);
  1335. }
  1336. }
  1337. var sign = normalizeWxJssdkSignPayload(res, htmlUrl);
  1338. if (!sign) {
  1339. console.warn('[wx] getWxConfig 响应字段不全', res, 'htmlUrl=', htmlUrl);
  1340. throw new Error(
  1341. 'getWxConfig 缺少 appId/timestamp/nonceStr/signature(见控制台)'
  1342. );
  1343. }
  1344. if (sign.appId !== WECHAT_MP_APP_ID) {
  1345. console.warn(
  1346. '[wx] 后端 appId=' + sign.appId + ',期望服务号 ' + WECHAT_MP_APP_ID
  1347. );
  1348. }
  1349. if (typeof wx === 'undefined') {
  1350. if (isWxPcBrowser()) {
  1351. console.log('[wx] PC getWxConfig 成功(无 jweixin)', sign);
  1352. return true;
  1353. }
  1354. setWxInitError('jweixin.js 未加载');
  1355. return false;
  1356. }
  1357. return applyWxConfigFromSign(sign, htmlUrl);
  1358. });
  1359. }
  1360. function applyWxConfigFromSign(sign, htmlUrl) {
  1361. var wxConfigParams = {
  1362. debug: isWxDebugOn(),
  1363. appId: String(sign.appId),
  1364. timestamp: sign.timestamp,
  1365. nonceStr: String(sign.nonceStr),
  1366. signature: String(sign.signature),
  1367. jsApiList: [],
  1368. openTagList: ['wx-open-launch-app']
  1369. };
  1370. return new Promise(function (resolve) {
  1371. if (isWxDebugOn()) {
  1372. try {
  1373. window.alert(
  1374. 'htmlUrl:\n' +
  1375. htmlUrl +
  1376. '\n\nwx.config:\n' +
  1377. JSON.stringify(wxConfigParams, null, 2)
  1378. );
  1379. } catch (alertErr) {}
  1380. }
  1381. wx.config(wxConfigParams);
  1382. wx.ready(function () {
  1383. weChatJssdkConfigured = true;
  1384. document.body.classList.add('wx-jssdk-ready');
  1385. refreshWxLaunchTagAttrs();
  1386. console.log('[wx.config] ready, htmlUrl=', htmlUrl);
  1387. resolve(true);
  1388. });
  1389. wx.error(function (err) {
  1390. weChatJssdkConfigured = false;
  1391. document.body.classList.remove('wx-jssdk-ready');
  1392. wxJssdkInitPromise = null;
  1393. var errMsg = getWxErrMsg(err);
  1394. setWxInitError(formatWxConfigErrorTip(err, htmlUrl));
  1395. if (isWxDebugOn()) window.alert(wxInitLastError);
  1396. console.warn('[wx.config]', errMsg, 'htmlUrl=', htmlUrl);
  1397. var baseUrl = getWxHtmlUrlBase();
  1398. var fullUrl = getWxSignPageUrlForApi();
  1399. if (
  1400. !/invalid signature/i.test(errMsg) ||
  1401. wxConfigSignRetriedBaseUrl ||
  1402. baseUrl === fullUrl ||
  1403. htmlUrl === baseUrl
  1404. ) {
  1405. resolve(false);
  1406. return;
  1407. }
  1408. wxConfigSignRetriedBaseUrl = true;
  1409. requestWeChatJssdkSignAndConfig(baseUrl).then(resolve);
  1410. });
  1411. });
  1412. }
  1413. function refreshWxLaunchTagAttrs() {
  1414. var tag = document.getElementById('launch-btn');
  1415. if (!tag) return;
  1416. try {
  1417. tag.setAttribute('appid', WECHAT_OPEN_APP_ID);
  1418. tag.setAttribute('extinfo', buildWeChatLaunchExtinfo());
  1419. } catch (eA) {}
  1420. }
  1421. function bindWeChatLaunchTagEvents() {
  1422. var tag = document.getElementById('launch-btn');
  1423. if (!tag || tag._wxLaunchBound) return;
  1424. tag._wxLaunchBound = true;
  1425. refreshWxLaunchTagAttrs();
  1426. tag.addEventListener('launch', function () {
  1427. console.log('[wx-open-launch-app] launch ok');
  1428. showFabToast('正在打开 U店在哪…');
  1429. });
  1430. tag.addEventListener('error', function (e) {
  1431. var detail = e && e.detail;
  1432. var errMsg =
  1433. detail && detail.errMsg
  1434. ? String(detail.errMsg)
  1435. : detail && detail.errmsg
  1436. ? String(detail.errmsg)
  1437. : '';
  1438. console.warn('[wx-open-launch-app]', detail);
  1439. showAppOpenFailTip(
  1440. errMsg
  1441. ? '未能唤起 App:' + errMsg
  1442. : '未能唤起 App,请确认已安装 U店在哪,且开放平台已绑定服务号与移动应用。'
  1443. );
  1444. });
  1445. }
  1446. function initWeChatOpenLaunchApp(fromUserClick) {
  1447. if (!shouldFetchWxConfig(!!fromUserClick)) {
  1448. console.log('[wx] 未调用 getWxConfig');
  1449. return Promise.resolve(false);
  1450. }
  1451. if (isWxPcBrowser()) {
  1452. console.warn(
  1453. '[wx] PC:请求 getWxConfig' + (fromUserClick ? '(按钮)' : '(进页)')
  1454. );
  1455. }
  1456. if (wxJssdkInitPromise && !fromUserClick) return wxJssdkInitPromise;
  1457. wxConfigSignRetriedBaseUrl = false;
  1458. wxInitLastError = '';
  1459. var htmlUrl = getWxConfigSignUrl();
  1460. bindWeChatLaunchTagEvents();
  1461. wxJssdkInitPromise = requestWeChatJssdkSignAndConfig(htmlUrl)
  1462. .then(function (ok) {
  1463. if (ok === true) return true;
  1464. if (!wxInitLastError) {
  1465. setWxInitError('wx.config 失败,可加 ?wxDebug=1 查看 htmlUrl');
  1466. }
  1467. return false;
  1468. })
  1469. .catch(function (e) {
  1470. var msg = e && e.message ? e.message : 'getWxConfig 请求失败';
  1471. setWxInitError(msg);
  1472. console.warn('[wx] requestWeChatJssdkSignAndConfig failed', msg, 'htmlUrl=', htmlUrl);
  1473. if (isWeChatInAppBrowser() && isWxDebugOn()) window.alert(msg);
  1474. return false;
  1475. })
  1476. .finally(function () {
  1477. if (!weChatJssdkConfigured) wxJssdkInitPromise = null;
  1478. });
  1479. return wxJssdkInitPromise;
  1480. }
  1481. /** 进页即尝试拉签名;jweixin 晚到时自动重试 */
  1482. function scheduleWeChatJssdkBootstrap() {
  1483. if (!shouldInitWeChatJssdkOnLoad()) return;
  1484. var attempts = 0;
  1485. function tick() {
  1486. attempts += 1;
  1487. if (weChatJssdkConfigured) return;
  1488. initWeChatOpenLaunchApp();
  1489. if (!weChatJssdkConfigured && attempts < 8 && typeof wx === 'undefined') {
  1490. setTimeout(tick, 400);
  1491. }
  1492. }
  1493. tick();
  1494. }
  1495. function showFabToast(msg, ms) {
  1496. var tip = String(msg || '').trim();
  1497. if (!tip) return;
  1498. var el = document.getElementById('openAppToast');
  1499. if (el) {
  1500. el.textContent = tip;
  1501. el.style.display = 'block';
  1502. if (showFabToast._t) clearTimeout(showFabToast._t);
  1503. showFabToast._t = setTimeout(function () {
  1504. el.style.display = 'none';
  1505. }, ms || 2800);
  1506. }
  1507. console.log('[openApp]', tip);
  1508. }
  1509. function showAppOpenFailTip(msg) {
  1510. var tip = msg || '未能打开 App,请确认已安装最新版「U店在哪」。';
  1511. if (typeof uni !== 'undefined' && typeof uni.showToast === 'function') {
  1512. uni.showToast({ title: tip, icon: 'none', duration: 2800 });
  1513. } else if (isWeChatInAppBrowser()) {
  1514. window.alert(tip);
  1515. } else {
  1516. console.warn('[openApp]', tip);
  1517. }
  1518. }
  1519. /** 部分 WebView 对 location.href 拦截,用 a 标签点击略稳 */
  1520. function launchAppDeepLink(deepLink) {
  1521. try {
  1522. var a = document.createElement('a');
  1523. a.href = deepLink;
  1524. a.setAttribute('target', '_self');
  1525. document.body.appendChild(a);
  1526. a.click();
  1527. document.body.removeChild(a);
  1528. } catch (e1) {}
  1529. try {
  1530. window.location.href = deepLink;
  1531. } catch (e2) {}
  1532. }
  1533. /**
  1534. * 有 plus:检测 App 是否安装后 openURL;深链形如 shopro://{APP_UNI_STORE_PATH}?…
  1535. * 系统浏览器:唤起 scheme;微信内常拦截 scheme,需「在浏览器打开」。
  1536. */
  1537. function tryFetchWxConfigOnPcClick() {
  1538. if (!isWxPcBrowser()) return Promise.resolve(false);
  1539. showFabToast('正在请求 getWxConfig…');
  1540. wxJssdkInitPromise = null;
  1541. return initWeChatOpenLaunchApp(true).then(function (ok) {
  1542. if (ok) {
  1543. showFabToast(
  1544. weChatJssdkConfigured
  1545. ? 'getWxConfig 成功,wx.config 已就绪'
  1546. : 'getWxConfig 成功'
  1547. );
  1548. } else {
  1549. showFabToast(wxInitLastError || 'getWxConfig 失败');
  1550. }
  1551. return ok;
  1552. });
  1553. }
  1554. function tryOpenHBuilderApp() {
  1555. /* 微信内须直接点击 wx-open-launch-app,scheme 会被拦截 */
  1556. if (isWeChatInAppBrowser()) return;
  1557. tryFetchWxConfigOnPcClick().then(function () {
  1558. if (isWxConfigOnClickDebug() && !isWxForceDebug() && !isWxPcAutoDebugHost()) {
  1559. return;
  1560. }
  1561. tryOpenHBuilderAppViaScheme();
  1562. });
  1563. }
  1564. function tryOpenHBuilderAppViaScheme() {
  1565. showFabToast('正在打开 U店在哪…');
  1566. var deepLink = buildAppDeepLink();
  1567. if (typeof plus !== 'undefined' && plus.runtime) {
  1568. var installed = null;
  1569. try {
  1570. if (typeof plus.runtime.isApplicationExist === 'function') {
  1571. installed = plus.runtime.isApplicationExist({
  1572. pname: APP_ANDROID_PACKAGE,
  1573. action: APP_IOS_URL_SCHEME
  1574. });
  1575. }
  1576. } catch (e) {
  1577. console.warn(e);
  1578. }
  1579. if (installed === false) {
  1580. showDownloadTip();
  1581. return;
  1582. }
  1583. try {
  1584. plus.runtime.openURL(deepLink);
  1585. } catch (e2) {
  1586. console.warn(e2);
  1587. showDownloadTip();
  1588. }
  1589. return;
  1590. }
  1591. var t0 = Date.now();
  1592. var done = false;
  1593. function finish() {
  1594. if (done) return;
  1595. done = true;
  1596. document.removeEventListener('visibilitychange', onVis);
  1597. window.removeEventListener('pagehide', onHide);
  1598. }
  1599. function onVis() {
  1600. if (document.visibilityState === 'hidden') finish();
  1601. }
  1602. function onHide() {
  1603. finish();
  1604. }
  1605. document.addEventListener('visibilitychange', onVis);
  1606. window.addEventListener('pagehide', onHide);
  1607. try {
  1608. launchAppDeepLink(deepLink);
  1609. } catch (e3) {
  1610. finish();
  1611. showDownloadTip();
  1612. return;
  1613. }
  1614. window.setTimeout(function () {
  1615. finish();
  1616. }, 2600);
  1617. }
  1618. function qs() {
  1619. return new URLSearchParams(location.search || '');
  1620. }
  1621. function q(name) {
  1622. var v = qs().get(name);
  1623. return v == null ? '' : String(v);
  1624. }
  1625. function showErr(msg) {
  1626. var el = document.getElementById('pageError');
  1627. el.textContent = msg;
  1628. el.style.display = 'block';
  1629. }
  1630. function getStoreId() {
  1631. return q('id') || q('storeId');
  1632. }
  1633. function shouldShowPerformanceSection() {
  1634. return String(q('businessSection') || '').trim() === '2';
  1635. }
  1636. function apiFetch(path) {
  1637. return fetch(API_BASE + path, {
  1638. method: 'GET',
  1639. mode: 'cors',
  1640. credentials: 'omit',
  1641. headers: { Accept: 'application/json' }
  1642. }).then(function (res) {
  1643. if (!res.ok) throw new Error('HTTP ' + res.status);
  1644. return res.json();
  1645. });
  1646. }
  1647. /** 进入页先拉店铺概要;与 shareDynamic.html fetchGetDeleteFlagByIdIfId 相同路径与 id 参数 */
  1648. function fetchStoreInfoGetOne(storeId) {
  1649. if (!storeId) return Promise.resolve(null);
  1650. var qs = new URLSearchParams();
  1651. qs.set('id', String(storeId).trim());
  1652. return apiFetch('/store/info/getOne?' + qs.toString()).catch(function (e) {
  1653. console.warn('[store/info/getOne]', e);
  1654. return null;
  1655. });
  1656. }
  1657. function isGetOneBusinessStatus99(res) {
  1658. if (!res || typeof res !== 'object') return false;
  1659. var d = res.data;
  1660. if (d && typeof d === 'object') {
  1661. var bs = d.businessStatus;
  1662. if (bs === 99 || bs === '99' || Number(bs) === 99) return true;
  1663. }
  1664. return false;
  1665. }
  1666. var MARKETING_PREVIEW_COUNT = 3;
  1667. var closedMerchantFlag = false;
  1668. /** 关店 businessStatus=99:getOne 已置 closedMerchantFlag,或 URL 带 businessStatus=99;唤起 App 时进登录页 */
  1669. function isClosedMerchantForAppOpen() {
  1670. if (closedMerchantFlag) return true;
  1671. var bs = String(q('businessStatus') || '').trim();
  1672. if (bs === '99' || Number(bs) === 99) return true;
  1673. return false;
  1674. }
  1675. var marketingListCache = [];
  1676. /** 避免详情先返回时用空 cache 误展示「暂无活动」图 */
  1677. var marketingCouponLoaded = false;
  1678. var staffGroupsCache = [];
  1679. var performanceListCache = { records: [], total: 0 };
  1680. function isMp4VideoUrl(url) {
  1681. if (!url || typeof url !== 'string') return false;
  1682. var path = url.split(/[?#]/)[0].toLowerCase();
  1683. return path.length >= 4 && path.slice(-4) === '.mp4';
  1684. }
  1685. function getMp4PlaybackUrl(url) {
  1686. var u = String(url || '').trim();
  1687. if (!u) return '';
  1688. var q = u.indexOf('?');
  1689. var h = u.indexOf('#');
  1690. var cut = u.length;
  1691. if (q >= 0) cut = Math.min(cut, q);
  1692. if (h >= 0) cut = Math.min(cut, h);
  1693. var base = u.slice(0, cut);
  1694. if (/\.mp4$/i.test(base)) return base;
  1695. return u;
  1696. }
  1697. function mp4UrlToJpgUrl(u) {
  1698. var q = u.indexOf('?');
  1699. var h = u.indexOf('#');
  1700. var cut = u.length;
  1701. if (q >= 0) cut = Math.min(cut, q);
  1702. if (h >= 0) cut = Math.min(cut, h);
  1703. var pathPart = u.slice(0, cut);
  1704. var rest = u.slice(cut);
  1705. if (!/\.mp4$/i.test(pathPart)) return '';
  1706. return pathPart.slice(0, -4) + '.jpg' + rest;
  1707. }
  1708. function createMarketingMedia(url) {
  1709. var wrap = document.createElement('div');
  1710. wrap.className = 'marketing-card__media';
  1711. var full = String(url == null ? '' : url).trim();
  1712. if (!full) return wrap;
  1713. if (isMp4VideoUrl(full)) {
  1714. var playUrl = getMp4PlaybackUrl(full);
  1715. var vid = document.createElement('video');
  1716. vid.src = playUrl;
  1717. vid.setAttribute('controls', '');
  1718. vid.setAttribute('playsinline', '');
  1719. vid.setAttribute('webkit-playsinline', '');
  1720. vid.muted = true;
  1721. vid.setAttribute('muted', '');
  1722. vid.setAttribute('autoplay', '');
  1723. vid.preload = 'auto';
  1724. var poster = '';
  1725. if (full.length > playUrl.length) poster = full;
  1726. else poster = mp4UrlToJpgUrl(playUrl);
  1727. if (poster) vid.setAttribute('poster', poster);
  1728. vid.addEventListener('canplay', function onCap() {
  1729. vid.removeEventListener('canplay', onCap);
  1730. var p = vid.play();
  1731. if (p && typeof p.catch === 'function') p.catch(function () {});
  1732. });
  1733. wrap.appendChild(vid);
  1734. } else {
  1735. var img = document.createElement('img');
  1736. img.src = full;
  1737. img.alt = '';
  1738. img.decoding = 'async';
  1739. wrap.appendChild(img);
  1740. }
  1741. return wrap;
  1742. }
  1743. function renderMarketingList(rawList) {
  1744. marketingListCache = Array.isArray(rawList) ? rawList.slice() : [];
  1745. var section = document.getElementById('shareMarketingSection');
  1746. var listEl = document.getElementById('marketingListEl');
  1747. var moreBtn = document.getElementById('marketingMoreBtn');
  1748. var moreText = document.getElementById('marketingMoreText');
  1749. if (!section || !listEl) return;
  1750. listEl.innerHTML = '';
  1751. section.classList.remove('is-expanded');
  1752. if (moreBtn) {
  1753. moreBtn.style.display = 'none';
  1754. moreBtn.setAttribute('aria-expanded', 'false');
  1755. }
  1756. if (closedMerchantFlag) {
  1757. section.style.display = 'none';
  1758. section.setAttribute('aria-hidden', 'true');
  1759. return;
  1760. }
  1761. var items = marketingListCache.filter(function (x) {
  1762. return x && x.imgUrl && String(x.imgUrl).trim();
  1763. }).filter(function (x) {
  1764. var t = x.activityType;
  1765. if (t == null || t === '') return true;
  1766. return String(t).toUpperCase() === 'MARKETING';
  1767. });
  1768. items.sort(function (a, b) {
  1769. var sa = Number(a.imgSort);
  1770. var sb = Number(b.imgSort);
  1771. if (isNaN(sa)) sa = 0;
  1772. if (isNaN(sb)) sb = 0;
  1773. return sa - sb;
  1774. });
  1775. if (!items.length) {
  1776. if (!marketingCouponLoaded) {
  1777. section.style.display = 'none';
  1778. section.setAttribute('aria-hidden', 'true');
  1779. return;
  1780. }
  1781. section.style.display = 'block';
  1782. section.setAttribute('aria-hidden', 'false');
  1783. var emptyWrap = document.createElement('div');
  1784. emptyWrap.className = 'marketing-section__empty';
  1785. emptyWrap.setAttribute('role', 'status');
  1786. var emptyImg = document.createElement('img');
  1787. emptyImg.src = 'images/empty.png';
  1788. emptyImg.alt = '';
  1789. emptyImg.decoding = 'async';
  1790. var emptyLabel = document.createElement('p');
  1791. emptyLabel.className = 'marketing-section__empty-label';
  1792. emptyLabel.textContent = '暂无活动';
  1793. emptyWrap.appendChild(emptyImg);
  1794. emptyWrap.appendChild(emptyLabel);
  1795. listEl.appendChild(emptyWrap);
  1796. return;
  1797. }
  1798. section.style.display = 'block';
  1799. section.setAttribute('aria-hidden', 'false');
  1800. items.forEach(function (item, idx) {
  1801. var card = document.createElement('article');
  1802. card.className = 'marketing-card';
  1803. if (idx >= MARKETING_PREVIEW_COUNT) card.classList.add('marketing-card--more');
  1804. card.appendChild(createMarketingMedia(item.imgUrl));
  1805. listEl.appendChild(card);
  1806. });
  1807. var extra = items.length - MARKETING_PREVIEW_COUNT;
  1808. if (extra > 0 && moreBtn && moreText) {
  1809. moreText.textContent = '查看剩余' + extra + '个活动';
  1810. moreBtn.style.display = 'flex';
  1811. }
  1812. }
  1813. function bindMarketingMore() {
  1814. var section = document.getElementById('shareMarketingSection');
  1815. var moreBtn = document.getElementById('marketingMoreBtn');
  1816. if (!section || !moreBtn || moreBtn.dataset.bound) return;
  1817. moreBtn.dataset.bound = '1';
  1818. moreBtn.addEventListener('click', function () {
  1819. section.classList.add('is-expanded');
  1820. moreBtn.style.display = 'none';
  1821. moreBtn.setAttribute('aria-expanded', 'true');
  1822. });
  1823. }
  1824. function createStaffCardElement(staff) {
  1825. var card = document.createElement('article');
  1826. card.className = 'staff-card';
  1827. var imgWrap = document.createElement('div');
  1828. imgWrap.className = 'staff-card__img-wrap';
  1829. var imgUrl = String(staff.staffImage || '').trim();
  1830. if (imgUrl) {
  1831. var img = document.createElement('img');
  1832. img.src = imgUrl;
  1833. img.alt = String(staff.name || '');
  1834. img.decoding = 'async';
  1835. img.loading = 'lazy';
  1836. imgWrap.appendChild(img);
  1837. }
  1838. var likes = document.createElement('div');
  1839. likes.className = 'staff-card__likes';
  1840. var lc = staff.likeCount != null ? Number(staff.likeCount) : 0;
  1841. if (isNaN(lc)) lc = 0;
  1842. likes.textContent = lc + '人喜欢';
  1843. imgWrap.appendChild(likes);
  1844. var nameRow = document.createElement('div');
  1845. nameRow.className = 'staff-card__name-row';
  1846. var nameEl = document.createElement('span');
  1847. nameEl.className = 'staff-card__name';
  1848. nameEl.textContent = String(staff.name != null ? staff.name : '').trim() || '—';
  1849. nameRow.appendChild(nameEl);
  1850. var perf = staff.hasPerformanceToday;
  1851. if (perf === true || perf === 1 || String(perf).toLowerCase() === 'true') {
  1852. var badge = document.createElement('span');
  1853. badge.className = 'staff-card__badge';
  1854. badge.textContent = '今日演出';
  1855. nameRow.appendChild(badge);
  1856. }
  1857. card.appendChild(imgWrap);
  1858. card.appendChild(nameRow);
  1859. var meta = document.createElement('div');
  1860. meta.className = 'staff-card__meta';
  1861. var pos = document.createElement('span');
  1862. pos.className = 'staff-card__position';
  1863. pos.textContent = String(staff.staffPosition || '').trim() || '\u00a0';
  1864. meta.appendChild(pos);
  1865. var pc = staff.positiveCommentsCount != null ? Number(staff.positiveCommentsCount) : 0;
  1866. if (!isNaN(pc) && pc > 0) {
  1867. var sep = document.createElement('span');
  1868. sep.className = 'staff-card__sep';
  1869. sep.textContent = '|';
  1870. var rev = document.createElement('span');
  1871. rev.className = 'staff-card__reviews';
  1872. rev.textContent = '好评' + pc + '次';
  1873. meta.appendChild(sep);
  1874. meta.appendChild(rev);
  1875. }
  1876. card.appendChild(meta);
  1877. return card;
  1878. }
  1879. function createPerformanceCardElement(row) {
  1880. var card = document.createElement('article');
  1881. card.className = 'performance-card';
  1882. var posterWrap = document.createElement('div');
  1883. posterWrap.className = 'performance-card__poster';
  1884. var posterUrl = String(row.performancePoster || '').trim();
  1885. if (posterUrl) {
  1886. var img = document.createElement('img');
  1887. img.src = posterUrl;
  1888. img.alt = String(row.performanceName || '');
  1889. img.decoding = 'async';
  1890. img.loading = 'lazy';
  1891. posterWrap.appendChild(img);
  1892. }
  1893. var body = document.createElement('div');
  1894. body.className = 'performance-card__body';
  1895. var nameEl = document.createElement('div');
  1896. nameEl.className = 'performance-card__name';
  1897. nameEl.textContent = String(row.performanceName != null ? row.performanceName : '').trim() || '—';
  1898. body.appendChild(nameEl);
  1899. var dr = String(row.dateRange || '').trim();
  1900. if (dr) {
  1901. var line1 = document.createElement('div');
  1902. line1.className = 'performance-card__meta';
  1903. line1.textContent = dr;
  1904. body.appendChild(line1);
  1905. }
  1906. var si = String(row.scheduleInfo || '').trim();
  1907. if (si) {
  1908. var line2 = document.createElement('div');
  1909. line2.className = 'performance-card__meta';
  1910. line2.textContent = si;
  1911. line2.title = si;
  1912. body.appendChild(line2);
  1913. }
  1914. card.appendChild(posterWrap);
  1915. card.appendChild(body);
  1916. return card;
  1917. }
  1918. function renderPerformanceList() {
  1919. var section = document.getElementById('sharePerformanceSection');
  1920. var titleEl = document.getElementById('performanceSectionTitle');
  1921. var strip = document.getElementById('performanceStripEl');
  1922. if (!section || !titleEl || !strip) return;
  1923. strip.innerHTML = '';
  1924. if (!shouldShowPerformanceSection()) {
  1925. section.style.display = 'none';
  1926. section.setAttribute('aria-hidden', 'true');
  1927. return;
  1928. }
  1929. if (closedMerchantFlag) {
  1930. section.style.display = 'none';
  1931. section.setAttribute('aria-hidden', 'true');
  1932. return;
  1933. }
  1934. var records = performanceListCache.records;
  1935. var total = performanceListCache.total;
  1936. if (isNaN(total)) total = records.length;
  1937. titleEl.textContent = '演出安排(' + total + ')';
  1938. if (!records.length) {
  1939. section.style.display = 'none';
  1940. section.setAttribute('aria-hidden', 'true');
  1941. return;
  1942. }
  1943. section.style.display = 'block';
  1944. section.setAttribute('aria-hidden', 'false');
  1945. records.forEach(function (row) {
  1946. if (!row) return;
  1947. strip.appendChild(createPerformanceCardElement(row));
  1948. });
  1949. }
  1950. function renderStaffGroups(raw) {
  1951. staffGroupsCache = Array.isArray(raw) ? raw.slice() : [];
  1952. var section = document.getElementById('shareStaffSection');
  1953. var mount = document.getElementById('staffGroupsMount');
  1954. if (!section || !mount) return;
  1955. var totalStaff = 0;
  1956. staffGroupsCache.forEach(function (g) {
  1957. if (g && Array.isArray(g.staffList)) totalStaff += g.staffList.length;
  1958. });
  1959. var countEl = document.getElementById('staffSectionCountEl');
  1960. if (countEl) countEl.textContent = String(totalStaff);
  1961. mount.innerHTML = '';
  1962. if (closedMerchantFlag) {
  1963. section.style.display = 'none';
  1964. section.setAttribute('aria-hidden', 'true');
  1965. return;
  1966. }
  1967. var groups = staffGroupsCache.filter(function (g) {
  1968. return g && Array.isArray(g.staffList) && g.staffList.length;
  1969. });
  1970. if (!groups.length) {
  1971. section.style.display = 'none';
  1972. section.setAttribute('aria-hidden', 'true');
  1973. return;
  1974. }
  1975. section.style.display = 'block';
  1976. section.setAttribute('aria-hidden', 'false');
  1977. groups.forEach(function (group) {
  1978. var wrap = document.createElement('div');
  1979. wrap.className = 'staff-group';
  1980. if (group.titleId != null) wrap.dataset.titleId = String(group.titleId);
  1981. var strip = document.createElement('div');
  1982. strip.className = 'staff-strip';
  1983. group.staffList.forEach(function (staff) {
  1984. if (!staff) return;
  1985. strip.appendChild(createStaffCardElement(staff));
  1986. });
  1987. wrap.appendChild(strip);
  1988. mount.appendChild(wrap);
  1989. });
  1990. }
  1991. function bindStaffSection() {
  1992. var btn = document.getElementById('staffSectionAllBtn');
  1993. if (!btn || btn.dataset.bound) return;
  1994. btn.dataset.bound = '1';
  1995. btn.addEventListener('click', function (e) {
  1996. e.preventDefault();
  1997. tryOpenHBuilderApp();
  1998. });
  1999. }
  2000. function buildHeroSlides(urls) {
  2001. var track = document.getElementById('heroTrack');
  2002. var dotsWrap = document.getElementById('heroDots');
  2003. track.innerHTML = '';
  2004. dotsWrap.innerHTML = '';
  2005. var list = (urls || []).filter(Boolean);
  2006. if (!list.length) {
  2007. var slide = document.createElement('div');
  2008. slide.className = 'hero__slide';
  2009. var img = document.createElement('img');
  2010. img.src = 'images/hero.png';
  2011. img.alt = '店铺';
  2012. slide.appendChild(img);
  2013. track.appendChild(slide);
  2014. var dot = document.createElement('span');
  2015. dot.className = 'hero__dot is-active';
  2016. dotsWrap.appendChild(dot);
  2017. return initHeroCarousel(1);
  2018. }
  2019. list.forEach(function (url, d) {
  2020. var slide = document.createElement('div');
  2021. slide.className = 'hero__slide';
  2022. var img = document.createElement('img');
  2023. img.src = url;
  2024. img.alt = '店铺图';
  2025. slide.appendChild(img);
  2026. track.appendChild(slide);
  2027. var dot = document.createElement('span');
  2028. dot.className = 'hero__dot' + (d === 0 ? ' is-active' : '');
  2029. dotsWrap.appendChild(dot);
  2030. });
  2031. initHeroCarousel(list.length);
  2032. }
  2033. var heroI = 0;
  2034. var heroTimer = null;
  2035. function initHeroCarousel(slides) {
  2036. var track = document.getElementById('heroTrack');
  2037. var dotsWrap = document.getElementById('heroDots');
  2038. var dots = dotsWrap.querySelectorAll('.hero__dot');
  2039. if (slides < 2) return;
  2040. function go(n) {
  2041. heroI = (n + slides) % slides;
  2042. track.style.transform = 'translateX(' + (-heroI * 100) + '%)';
  2043. dots.forEach(function (el, idx) {
  2044. el.classList.toggle('is-active', idx === heroI);
  2045. });
  2046. }
  2047. if (heroTimer) clearInterval(heroTimer);
  2048. heroTimer = setInterval(function () { go(heroI + 1); }, 4000);
  2049. var hero = document.getElementById('hero');
  2050. var startX = 0;
  2051. hero.addEventListener('touchstart', function (e) {
  2052. startX = e.changedTouches[0].clientX;
  2053. }, { passive: true });
  2054. hero.addEventListener('touchend', function (e) {
  2055. var dx = e.changedTouches[0].clientX - startX;
  2056. if (Math.abs(dx) > 40) go(dx < 0 ? heroI + 1 : heroI - 1);
  2057. }, { passive: true });
  2058. }
  2059. function timeToMinutes(t) {
  2060. var parts = String(t || '').trim().split(':');
  2061. var h = parseInt(parts[0], 10) || 0;
  2062. var m = parseInt(parts[1], 10) || 0;
  2063. return h * 60 + m;
  2064. }
  2065. function isTimeInRange(startTime, endTime) {
  2066. var s = String(startTime || '').trim();
  2067. var e = String(endTime || '').trim();
  2068. if (s === '00:00' && e === '00:00') return true;
  2069. if (s === '00:00' && e === '23:59') return true;
  2070. var cur = new Date().getHours() * 60 + new Date().getMinutes();
  2071. var sm = timeToMinutes(s);
  2072. var em = timeToMinutes(e);
  2073. if (em < sm) {
  2074. return cur >= sm || cur <= em;
  2075. }
  2076. return cur >= sm && cur <= em;
  2077. }
  2078. function parseHolidayDate(str) {
  2079. if (!str) return null;
  2080. var d = new Date(String(str).trim().replace(/-/g, '/'));
  2081. return isNaN(d.getTime()) ? null : d;
  2082. }
  2083. function isTodayInHolidayRange(holidayInfo) {
  2084. if (!holidayInfo) return false;
  2085. var hi = holidayInfo;
  2086. if (typeof hi === 'string') {
  2087. try {
  2088. hi = JSON.parse(hi);
  2089. } catch (err) {
  2090. return false;
  2091. }
  2092. }
  2093. var start = hi.startDate || hi.holidayStartDate || hi.beginDate || hi.start || hi.holidayStart;
  2094. var end = hi.endDate || hi.holidayEndDate || hi.finishDate || hi.end || hi.holidayEnd;
  2095. if (!start || !end) return false;
  2096. var startD = parseHolidayDate(start);
  2097. var endD = parseHolidayDate(end);
  2098. if (!startD || !endD) return false;
  2099. var today = new Date();
  2100. today.setHours(0, 0, 0, 0);
  2101. startD.setHours(0, 0, 0, 0);
  2102. endD.setHours(0, 0, 0, 0);
  2103. return today >= startD && today <= endD;
  2104. }
  2105. function findNormalBusinessInfo(list) {
  2106. var wdJs = new Date().getDay();
  2107. var i;
  2108. var x;
  2109. var w;
  2110. for (i = 0; i < list.length; i++) {
  2111. x = list[i];
  2112. if (!x || x.holidayInfo) continue;
  2113. w = x.weekDay != null ? x.weekDay : x.week;
  2114. if (w === undefined || w === null) continue;
  2115. if (Number(w) === wdJs) return x;
  2116. }
  2117. var wdMap = wdJs === 0 ? 7 : wdJs;
  2118. for (i = 0; i < list.length; i++) {
  2119. x = list[i];
  2120. if (!x || x.holidayInfo) continue;
  2121. w = x.weekDay != null ? x.weekDay : x.week;
  2122. if (w === undefined || w === null) continue;
  2123. if (Number(w) === wdMap) return x;
  2124. }
  2125. for (i = 0; i < list.length; i++) {
  2126. x = list[i];
  2127. if (x && !x.holidayInfo && (x.startTime || x.endTime)) return x;
  2128. }
  2129. return null;
  2130. }
  2131. /** 营业状态:暂停营业 | 商家暂未配置营业时间 | 休息中 | 营业中 xx:xx至xx:xx | 营业中 全天营业 */
  2132. function computeBusinessStatusDisplay(d) {
  2133. if (!d) return { text: '—', isOpen: false };
  2134. if (Number(d.businessStatus) === 99) {
  2135. return { text: '商户已关闭', isOpen: false };
  2136. }
  2137. if (Number(d.businessStatus) === 1) {
  2138. return { text: '暂停营业', isOpen: false };
  2139. }
  2140. var list = d.storeBusinessInfoVos || d.storeBusinessInfos || [];
  2141. if (!list.length) {
  2142. return { text: '商家暂未配置营业时间', isOpen: false };
  2143. }
  2144. var holidayList = Array.isArray(d.holidayBusinessInfoList) && d.holidayBusinessInfoList.length
  2145. ? d.holidayBusinessInfoList
  2146. : list.filter(function (item) { return item && item.holidayInfo; });
  2147. var todayHolidayItem = holidayList.find(function (item) {
  2148. return isTodayInHolidayRange(item.holidayInfo);
  2149. });
  2150. var normal = d.normalBusinessInfo || d.normalBusinessInfoVo || findNormalBusinessInfo(list);
  2151. var isOpen = false;
  2152. var currentItem = null;
  2153. if (todayHolidayItem) {
  2154. isOpen = isTimeInRange(todayHolidayItem.startTime, todayHolidayItem.endTime);
  2155. currentItem = todayHolidayItem;
  2156. } else if (normal) {
  2157. isOpen = isTimeInRange(normal.startTime, normal.endTime);
  2158. currentItem = normal;
  2159. }
  2160. if (!currentItem) return { text: '休息中', isOpen: false };
  2161. if (!isOpen) return { text: '休息中', isOpen: false };
  2162. var st = String(currentItem.startTime || '').trim();
  2163. var et = String(currentItem.endTime || '').trim();
  2164. if (st === '00:00' && et === '00:00') return { text: '营业中 全天营业', isOpen: true };
  2165. if (st === '00:00' && et === '23:59') return { text: '营业中 全天营业', isOpen: true };
  2166. var needNextDay = timeToMinutes(et) < timeToMinutes(st);
  2167. var suffix = (needNextDay ? '次日' : '') + et;
  2168. return { text: ('营业中 ' + st + ' 至 ' + suffix).trim(), isOpen: true };
  2169. }
  2170. /**
  2171. * 分项评分:可能在 storeEvaluate 对象内,或为 JSON 字符串;部分接口把字段放在详情根上。
  2172. */
  2173. function parseStoreEvaluateRaw(raw) {
  2174. if (raw == null || raw === '') return null;
  2175. if (typeof raw === 'string') {
  2176. var t = raw.trim();
  2177. if (!t) return null;
  2178. try {
  2179. raw = JSON.parse(t);
  2180. } catch (e) {
  2181. return null;
  2182. }
  2183. }
  2184. if (Array.isArray(raw) && raw.length && raw[0] && typeof raw[0] === 'object') {
  2185. raw = raw[0];
  2186. }
  2187. if (raw && typeof raw === 'object' && !Array.isArray(raw)) return raw;
  2188. return null;
  2189. }
  2190. function getStoreEvaluateScores(d) {
  2191. var ev = parseStoreEvaluateRaw(d.storeEvaluate)
  2192. || parseStoreEvaluateRaw(d.evaluate)
  2193. || parseStoreEvaluateRaw(d.evaluateInfo);
  2194. function lane(key, snake) {
  2195. var v;
  2196. if (ev && ev[key] != null && ev[key] !== '') v = ev[key];
  2197. else if (d[key] != null && d[key] !== '') v = d[key];
  2198. else if (snake && d[snake] != null && d[snake] !== '') v = d[snake];
  2199. else return null;
  2200. var n = Number(v);
  2201. return !isNaN(n) ? n : null;
  2202. }
  2203. return {
  2204. scoreOne: lane('scoreOne', 'score_one'),
  2205. scoreTwo: lane('scoreTwo', 'score_two'),
  2206. scoreThree: lane('scoreThree', 'score_three')
  2207. };
  2208. }
  2209. function fmtEvalScore(n) {
  2210. return n != null && !isNaN(n) ? Number(n).toFixed(1) : null;
  2211. }
  2212. var CLOSED_REC_STAR_PATH =
  2213. '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';
  2214. function closedRecEscHtml(s) {
  2215. return String(s == null ? '' : s)
  2216. .replace(/&/g, '&amp;')
  2217. .replace(/</g, '&lt;')
  2218. .replace(/>/g, '&gt;')
  2219. .replace(/"/g, '&quot;');
  2220. }
  2221. function closedRecStarsHtml(score) {
  2222. var s = Number(score);
  2223. if (isNaN(s)) s = 0;
  2224. s = Math.max(0, Math.min(5, s));
  2225. var rounded = Math.round(s);
  2226. var parts = [];
  2227. var i;
  2228. for (i = 1; i <= 5; i++) {
  2229. var fill = i <= rounded ? '#F58220' : '#E5E5E5';
  2230. parts.push(
  2231. '<svg class="closed-rec-star" width="11" height="11" viewBox="0 0 24 24" aria-hidden="true">' +
  2232. '<path fill="' + fill + '" d="' + CLOSED_REC_STAR_PATH + '"/></svg>'
  2233. );
  2234. }
  2235. return '<span class="closed-rec-stars">' + parts.join('') + '</span>';
  2236. }
  2237. function closedRecFormatDistance(item) {
  2238. if (item.distance != null && item.distance !== '') {
  2239. var km = Number(item.distance);
  2240. if (!isNaN(km) && km >= 0) {
  2241. return Math.round(km * 1000) + '米';
  2242. }
  2243. return String(item.distance).trim();
  2244. }
  2245. if (item.position != null && String(item.position).trim() !== '') {
  2246. return String(item.position).trim();
  2247. }
  2248. if (item.dist != null && item.dist !== '') {
  2249. var dn = Number(item.dist);
  2250. if (!isNaN(dn)) {
  2251. return dn >= 1 ? dn.toFixed(dn % 1 === 0 ? 0 : 1) + 'km' : Math.round(dn * 1000) + '米';
  2252. }
  2253. }
  2254. return '';
  2255. }
  2256. function closedRecPickScore(item) {
  2257. var x =
  2258. item.scoreAvg != null ? Number(item.scoreAvg)
  2259. : item.score != null ? Number(item.score)
  2260. : item.rating != null ? Number(item.rating)
  2261. : item.starScore != null ? Number(item.starScore)
  2262. : NaN;
  2263. return isNaN(x) ? null : x;
  2264. }
  2265. function closedRecPickReviewCount(item) {
  2266. var n =
  2267. item.commitCount != null ? Number(item.commitCount)
  2268. : item.commentCount != null ? Number(item.commentCount)
  2269. : item.reviewCount != null ? Number(item.reviewCount)
  2270. : item.evaluateCount != null ? Number(item.evaluateCount)
  2271. : NaN;
  2272. return isNaN(n) ? 0 : Math.max(0, Math.floor(n));
  2273. }
  2274. function normalizeClosedStoreRecommendList(res) {
  2275. if (!res || typeof res !== 'object') return [];
  2276. var raw = res.data != null ? res.data : res.result;
  2277. if (Array.isArray(raw)) return raw;
  2278. if (raw && typeof raw === 'object') {
  2279. if (Array.isArray(raw.list)) return raw.list;
  2280. if (Array.isArray(raw.records)) return raw.records;
  2281. if (Array.isArray(raw.rows)) return raw.rows;
  2282. if (Array.isArray(raw.content)) return raw.content;
  2283. if (Array.isArray(raw.stores)) return raw.stores;
  2284. if (Array.isArray(raw.storeList)) return raw.storeList;
  2285. if (Array.isArray(raw.storeVos)) return raw.storeVos;
  2286. if (Array.isArray(raw.items)) return raw.items;
  2287. }
  2288. if (Array.isArray(res.list)) return res.list;
  2289. if (Array.isArray(res.records)) return res.records;
  2290. return [];
  2291. }
  2292. function fetchShareClosedStoreRecommend(storeIdStr) {
  2293. var loc = getClosedRecommendUserLocation();
  2294. var page = parseInt(q('page') || '1', 10);
  2295. var pageSize = parseInt(q('pageSize') || '10', 10);
  2296. if (isNaN(page) || page < 1) page = 1;
  2297. if (isNaN(pageSize) || pageSize < 1) pageSize = 10;
  2298. var body = {
  2299. page: page,
  2300. pageSize: pageSize,
  2301. storeId: String(storeIdStr || ''),
  2302. userCity: loc.userCity,
  2303. userLat: loc.userLat,
  2304. userLng: loc.userLng
  2305. };
  2306. return fetch(API_LIFE_AI_BASE + STORE_GLOBAL_RECOMMEND_PATH, {
  2307. method: 'POST',
  2308. mode: 'cors',
  2309. credentials: 'omit',
  2310. headers: {
  2311. Accept: 'application/json',
  2312. 'Content-Type': 'application/json;charset=UTF-8'
  2313. },
  2314. body: JSON.stringify(body)
  2315. }).then(function (res) {
  2316. if (!res.ok) throw new Error('HTTP ' + res.status);
  2317. return res.json();
  2318. });
  2319. }
  2320. function renderShareClosedRecommended(list) {
  2321. var wrap = document.getElementById('shareClosedRecList');
  2322. var empty = document.getElementById('shareClosedRecEmpty');
  2323. if (!wrap || !empty) return;
  2324. wrap.querySelectorAll('.closed-rec-card').forEach(function (n) {
  2325. n.remove();
  2326. });
  2327. if (!list || !list.length) {
  2328. empty.style.display = 'block';
  2329. return;
  2330. }
  2331. empty.style.display = 'none';
  2332. list.forEach(function (item) {
  2333. if (!item || typeof item !== 'object') return;
  2334. var imgUrlField = item.imgUrl != null ? String(item.imgUrl).trim() : '';
  2335. var home = item.homeImage != null ? String(item.homeImage).trim() : '';
  2336. if (home && /\.mp4(\?|#|$)/i.test(home)) {
  2337. var vf = item.videoFirstFrame != null ? String(item.videoFirstFrame).trim() : '';
  2338. if (vf) home = vf;
  2339. }
  2340. var imgUrl =
  2341. imgUrlField ||
  2342. home ||
  2343. (item.coverUrl != null ? String(item.coverUrl).trim() : '') ||
  2344. (item.mainImage != null ? String(item.mainImage).trim() : '') ||
  2345. (item.goodsImage != null ? String(item.goodsImage).trim() : '') ||
  2346. (item.entranceImage != null ? String(item.entranceImage).trim() : '') ||
  2347. (Array.isArray(item.goodsImageList) && item.goodsImageList[0]) ||
  2348. (Array.isArray(item.imageList) && item.imageList[0]) ||
  2349. (Array.isArray(item.storeAlbumUrlList) && item.storeAlbumUrlList[0]) ||
  2350. '';
  2351. var name = item.title != null && String(item.title).trim() !== ''
  2352. ? String(item.title).replace(/\r?\n/g, ' ').replace(/\s+/g, ' ').trim()
  2353. : (item.storeName || item.goodsName || item.secondGoodsTitle || item.name || '推荐');
  2354. var dist = closedRecFormatDistance(item);
  2355. var scoreVal = closedRecPickScore(item);
  2356. var displayScore = scoreVal != null ? scoreVal.toFixed(1) : '—';
  2357. var starScore = scoreVal != null ? scoreVal : 0;
  2358. var rc = closedRecPickReviewCount(item);
  2359. var reviewLabel = rc > 0 ? rc + '条评价' : '';
  2360. var seller =
  2361. item.userName != null && String(item.userName).trim() !== ''
  2362. ? String(item.userName).trim()
  2363. : (item.nickName != null && String(item.nickName).trim() !== ''
  2364. ? String(item.nickName).trim()
  2365. : '');
  2366. var card = document.createElement('article');
  2367. card.className = 'closed-rec-card';
  2368. card.innerHTML =
  2369. '<div class="closed-rec-card__img"><img class="closed-rec-card__cover" src="" alt="" decoding="async"></div>' +
  2370. '<div class="closed-rec-card__body">' +
  2371. '<div class="closed-rec-card__top">' +
  2372. '<span class="closed-rec-card__name">' + closedRecEscHtml(name) + '</span>' +
  2373. (dist ? '<span class="closed-rec-card__dist">' + closedRecEscHtml(dist) + '</span>' : '') +
  2374. '</div>' +
  2375. '<div class="closed-rec-card__rating">' +
  2376. closedRecStarsHtml(starScore) +
  2377. '<span class="closed-rec-rating-num">' + closedRecEscHtml(displayScore) + '</span>' +
  2378. (reviewLabel ? '<span class="closed-rec-meta">' + closedRecEscHtml(reviewLabel) + '</span>' : '') +
  2379. '</div>' +
  2380. (seller ? '<div class="closed-rec-card__footer">' + closedRecEscHtml(seller) + '</div>' : '') +
  2381. '</div>';
  2382. var coverIm = card.querySelector('img.closed-rec-card__cover');
  2383. if (coverIm) {
  2384. coverIm.src = imgUrl;
  2385. coverIm.onerror = function () {
  2386. this.onerror = null;
  2387. this.src = '';
  2388. };
  2389. }
  2390. wrap.appendChild(card);
  2391. });
  2392. }
  2393. function loadShareClosedRecommendations() {
  2394. var sid = getStoreId();
  2395. if (!sid) {
  2396. renderShareClosedRecommended([]);
  2397. return;
  2398. }
  2399. fetchShareClosedStoreRecommend(sid)
  2400. .then(function (res) {
  2401. var list = normalizeClosedStoreRecommendList(res);
  2402. if (!list.length && res && res.msg) {
  2403. console.warn('[store-recommend]', res.msg);
  2404. }
  2405. renderShareClosedRecommended(list);
  2406. })
  2407. .catch(function (e) {
  2408. console.error(e);
  2409. renderShareClosedRecommended([]);
  2410. });
  2411. }
  2412. function applyShareIndexClosedMerchantUi(closed) {
  2413. var wasClosed = closedMerchantFlag;
  2414. closedMerchantFlag = closed;
  2415. if (wasClosed !== closed && weChatJssdkConfigured) {
  2416. refreshWxLaunchTagAttrs();
  2417. }
  2418. var banner = document.getElementById('shareClosedBanner');
  2419. var contentEl = document.getElementById('shareContentEl');
  2420. var belowEl = document.getElementById('shareBelowContentEl');
  2421. var recWrap = document.getElementById('shareClosedRecommendWrap');
  2422. if (banner) {
  2423. banner.style.display = closed ? 'block' : 'none';
  2424. banner.setAttribute('aria-hidden', closed ? 'false' : 'true');
  2425. }
  2426. if (contentEl) {
  2427. contentEl.style.display = closed ? 'none' : '';
  2428. contentEl.setAttribute('aria-hidden', closed ? 'true' : 'false');
  2429. }
  2430. if (belowEl) {
  2431. belowEl.style.display = '';
  2432. belowEl.setAttribute('aria-hidden', 'false');
  2433. }
  2434. if (recWrap) {
  2435. if (closed) {
  2436. recWrap.style.display = 'block';
  2437. recWrap.setAttribute('aria-hidden', 'false');
  2438. if (!wasClosed) {
  2439. loadShareClosedRecommendations();
  2440. }
  2441. } else {
  2442. recWrap.style.display = 'none';
  2443. recWrap.setAttribute('aria-hidden', 'true');
  2444. renderShareClosedRecommended([]);
  2445. }
  2446. }
  2447. }
  2448. function renderDetail(d) {
  2449. if (!d) return;
  2450. appLaunchDetailCache = d;
  2451. if (weChatJssdkConfigured) refreshWxLaunchTagAttrs();
  2452. document.getElementById('storeName').textContent = d.storeName || '—';
  2453. var score = d.scoreAvg != null ? Number(d.scoreAvg) : NaN;
  2454. document.getElementById('scoreAvg').textContent = !isNaN(score) ? score.toFixed(1) : '—';
  2455. document.getElementById('commitCount').textContent = d.commitCount != null ? String(d.commitCount)+'条' : '0';
  2456. var evRow = document.getElementById('storeEvaluateRow');
  2457. var evOne = document.getElementById('storeEvaluateScoreOne');
  2458. var evTwo = document.getElementById('storeEvaluateScoreTwo');
  2459. var evThree = document.getElementById('storeEvaluateScoreThree');
  2460. if (evRow && evOne && evTwo && evThree) {
  2461. evRow.classList.remove('is-visible');
  2462. evRow.setAttribute('aria-hidden', 'true');
  2463. var es = getStoreEvaluateScores(d);
  2464. var a = fmtEvalScore(es.scoreOne);
  2465. var b = fmtEvalScore(es.scoreTwo);
  2466. var c = fmtEvalScore(es.scoreThree);
  2467. if (a !== null || b !== null || c !== null) {
  2468. evOne.textContent = a !== null ? a : '—';
  2469. evTwo.textContent = b !== null ? b : '—';
  2470. evThree.textContent = c !== null ? c : '—';
  2471. evRow.classList.add('is-visible');
  2472. evRow.setAttribute('aria-hidden', 'false');
  2473. }
  2474. }
  2475. var bizDisp = computeBusinessStatusDisplay(d);
  2476. var bizEl = document.getElementById('bizStatus');
  2477. bizEl.textContent = bizDisp.text;
  2478. bizEl.className = 'status' + (bizDisp.isOpen ? ' is-open' : '');
  2479. document.getElementById('hoursText').textContent = '';
  2480. document.getElementById('storeAddr').textContent = d.queryAddress || d.storeAddress || '—';
  2481. if (d.distance != null) {
  2482. document.getElementById('metaDistance').style.display = 'flex';
  2483. document.getElementById('distanceText').textContent =
  2484. '距您' + (Number(d.distance) > 1 ? d.distance + '千米' : Math.round(Number(d.distance) * 1000) + '米');
  2485. }
  2486. if (d.subwayName && d.distance2 != null) {
  2487. document.getElementById('metaSubway').style.display = 'flex';
  2488. document.getElementById('subwayText').textContent =
  2489. '距' + d.subwayName + '步行' + (Number(d.distance2) >= 1000
  2490. ? (Number(d.distance2) / 1000).toFixed(1) + 'km'
  2491. : Math.round(Number(d.distance2)) + 'm');
  2492. }
  2493. var imgs = [];
  2494. if (Array.isArray(d.storeAlbumUrlList) && d.storeAlbumUrlList.length) imgs = d.storeAlbumUrlList.slice();
  2495. else if (d.entranceImage) imgs = [d.entranceImage];
  2496. buildHeroSlides(imgs);
  2497. var closedMerchant = Number(d.businessStatus) === 99;
  2498. applyShareIndexClosedMerchantUi(closedMerchant);
  2499. renderMarketingList(marketingListCache);
  2500. renderPerformanceList();
  2501. renderStaffGroups(staffGroupsCache);
  2502. }
  2503. function getLngForApi() {
  2504. var v = q('jingdu');
  2505. if (v) return v;
  2506. return q('lon') || q('lng') || q('longitude');
  2507. }
  2508. function getLatForApi() {
  2509. var v = q('weidu');
  2510. if (v) return v;
  2511. return q('lat') || q('latitude');
  2512. }
  2513. function mergeSearchAndHashParamsForRedirect() {
  2514. var params = new URLSearchParams();
  2515. function ingest(slice) {
  2516. if (!slice) return;
  2517. var p = new URLSearchParams(slice);
  2518. p.forEach(function (val, key) {
  2519. params.set(key, val);
  2520. });
  2521. }
  2522. if (location.search && location.search.length > 1) {
  2523. ingest(location.search.slice(1));
  2524. }
  2525. var hash = location.hash || '';
  2526. var qi = hash.indexOf('?');
  2527. if (qi >= 0) {
  2528. ingest(hash.slice(qi + 1));
  2529. }
  2530. return params;
  2531. }
  2532. /** getClientStoreDetail 无承载数据时进 shareCheckInUndefined(businessStatus=99 与落地页约定一致) */
  2533. function buildShareCheckInUndefinedRedirectHref() {
  2534. var p = mergeSearchAndHashParamsForRedirect();
  2535. p.set('businessStatus', '99');
  2536. var sid = getStoreId();
  2537. if (sid && !p.has('storeId')) {
  2538. p.set('storeId', sid);
  2539. }
  2540. var j = getLngForApi();
  2541. var w = getLatForApi();
  2542. if (j && !p.has('userLng')) {
  2543. p.set('userLng', j);
  2544. }
  2545. if (w && !p.has('userLat')) {
  2546. p.set('userLat', w);
  2547. }
  2548. var qs = p.toString();
  2549. return 'shareCheckInUndefined.html' + (qs ? ('?' + qs) : '?businessStatus=99');
  2550. }
  2551. function run() {
  2552. var sid = getStoreId();
  2553. var userId = q('userId');
  2554. var jingdu = getLngForApi();
  2555. var weidu = getLatForApi();
  2556. if (!sid) {
  2557. showErr('缺少店铺 id(请从 App 分享链接打开,URL 需带 id 或 storeId)');
  2558. document.getElementById('storeName').textContent = '参数错误';
  2559. return;
  2560. }
  2561. var detailPath = '/store/info/getClientStoreDetail?' +
  2562. 'id=' + encodeURIComponent(sid) +
  2563. '&userId=' + encodeURIComponent(userId) +
  2564. '&jingdu=' + encodeURIComponent(jingdu) +
  2565. '&weidu=' + encodeURIComponent(weidu);
  2566. fetchStoreInfoGetOne(sid).then(function (getOneRes) {
  2567. if (isGetOneBusinessStatus99(getOneRes)) {
  2568. applyShareIndexClosedMerchantUi(true);
  2569. }
  2570. apiFetch(detailPath)
  2571. .then(function (res) {
  2572. var tip = res && res.msg != null ? String(res.msg).trim() : '';
  2573. if (tip === '暂无承载数据') {
  2574. if (closedMerchantFlag) {
  2575. return;
  2576. }
  2577. window.location.replace(buildShareCheckInUndefinedRedirectHref());
  2578. return;
  2579. }
  2580. if (res.code !== 200 || !res.data) {
  2581. showErr(res.msg || '店铺详情加载失败');
  2582. return;
  2583. }
  2584. renderDetail(res.data);
  2585. })
  2586. .catch(function (e) {
  2587. console.error(e);
  2588. showErr('店铺详情请求失败(若为 file:// 打开,请检查 CORS 或改用 http 访问本页)');
  2589. });
  2590. var couponPath = '/store/info/getStoreCouponList?storeId=' + encodeURIComponent(sid);
  2591. marketingCouponLoaded = false;
  2592. apiFetch(couponPath)
  2593. .then(function (res) {
  2594. marketingCouponLoaded = true;
  2595. var list = (res && res.code === 200 && res.data && res.data.marketingList) || [];
  2596. if (!Array.isArray(list)) list = [];
  2597. renderMarketingList(list);
  2598. })
  2599. .catch(function (e) {
  2600. marketingCouponLoaded = true;
  2601. console.warn('[getStoreCouponList]', e);
  2602. renderMarketingList([]);
  2603. });
  2604. if (shouldShowPerformanceSection()) {
  2605. var perfPath = '/performance/list/query?storeId=' + encodeURIComponent(sid) + '&page=1&size=100';
  2606. apiFetch(perfPath)
  2607. .then(function (res) {
  2608. var d = (res && res.code === 200 && res.data) || null;
  2609. if (!d || typeof d !== 'object') {
  2610. performanceListCache.records = [];
  2611. performanceListCache.total = 0;
  2612. } else {
  2613. performanceListCache.records = Array.isArray(d.records) ? d.records.slice() : [];
  2614. var pt = d.total;
  2615. performanceListCache.total = pt != null && !isNaN(Number(pt))
  2616. ? Number(pt)
  2617. : performanceListCache.records.length;
  2618. }
  2619. renderPerformanceList();
  2620. })
  2621. .catch(function (e) {
  2622. console.warn('[performance/list/query]', e);
  2623. performanceListCache.records = [];
  2624. performanceListCache.total = 0;
  2625. renderPerformanceList();
  2626. });
  2627. } else {
  2628. performanceListCache.records = [];
  2629. performanceListCache.total = 0;
  2630. renderPerformanceList();
  2631. }
  2632. var staffPath = '/storeStaffConfig/queryStaffListByTitle?storeId=' + encodeURIComponent(sid);
  2633. apiFetch(staffPath)
  2634. .then(function (res) {
  2635. var arr = (res && res.code === 200 && res.data) || [];
  2636. if (!Array.isArray(arr)) arr = [];
  2637. renderStaffGroups(arr);
  2638. })
  2639. .catch(function (e) {
  2640. console.warn('[queryStaffListByTitle]', e);
  2641. renderStaffGroups([]);
  2642. });
  2643. });
  2644. }
  2645. function boot() {
  2646. var launchTag = document.getElementById('launch-btn');
  2647. if (launchTag) launchTag.setAttribute('appid', WECHAT_OPEN_APP_ID);
  2648. bindWeChatLaunchTagEvents();
  2649. if (shouldInitWeChatJssdkOnLoad()) {
  2650. if (isWeChatInAppBrowser()) document.body.classList.add('is-wechat');
  2651. if (isWxPcBrowser() && (isWxForceDebug() || isWxPcAutoDebugHost())) {
  2652. document.body.classList.add('wx-pc-debug');
  2653. }
  2654. scheduleWeChatJssdkBootstrap();
  2655. }
  2656. if (isWeChatInAppBrowser()) {
  2657. var openBtnWx = document.getElementById('openApp');
  2658. if (openBtnWx) {
  2659. openBtnWx.addEventListener('click', function () {
  2660. if (!weChatJssdkConfigured) {
  2661. showFabToast(
  2662. wxInitLastError || '微信 SDK 初始化中,请稍候再点底部按钮'
  2663. );
  2664. }
  2665. });
  2666. }
  2667. } else {
  2668. var openBtn = document.getElementById('openApp');
  2669. if (openBtn) openBtn.addEventListener('click', tryOpenHBuilderApp);
  2670. }
  2671. run();
  2672. bindMarketingMore();
  2673. bindStaffSection();
  2674. }
  2675. if (document.readyState === 'complete') {
  2676. boot();
  2677. } else {
  2678. window.onload = boot;
  2679. }
  2680. })();
  2681. </script>
  2682. </body>
  2683. </html>