shareIndex.html 81 KB

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