shareIndex.html 84 KB

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