shareIndex.html 80 KB

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