| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027202820292030203120322033203420352036203720382039204020412042204320442045204620472048204920502051205220532054205520562057205820592060206120622063206420652066206720682069207020712072207320742075207620772078207920802081208220832084208520862087208820892090209120922093209420952096209720982099210021012102210321042105210621072108210921102111211221132114211521162117211821192120212121222123212421252126212721282129213021312132213321342135213621372138213921402141214221432144214521462147214821492150215121522153215421552156215721582159216021612162216321642165216621672168216921702171217221732174217521762177217821792180218121822183218421852186218721882189219021912192219321942195219621972198219922002201220222032204220522062207220822092210221122122213221422152216221722182219222022212222222322242225222622272228222922302231223222332234223522362237223822392240224122422243224422452246224722482249225022512252225322542255225622572258225922602261226222632264226522662267226822692270227122722273227422752276227722782279228022812282228322842285228622872288228922902291229222932294229522962297229822992300230123022303230423052306230723082309231023112312231323142315231623172318231923202321232223232324232523262327232823292330233123322333233423352336233723382339234023412342234323442345234623472348234923502351235223532354235523562357235823592360236123622363236423652366236723682369237023712372237323742375237623772378237923802381238223832384238523862387238823892390239123922393239423952396239723982399240024012402240324042405240624072408240924102411241224132414241524162417241824192420242124222423242424252426242724282429243024312432243324342435243624372438243924402441244224432444244524462447244824492450245124522453245424552456245724582459246024612462246324642465246624672468246924702471247224732474247524762477247824792480248124822483248424852486248724882489249024912492249324942495249624972498249925002501250225032504250525062507250825092510251125122513251425152516251725182519252025212522252325242525252625272528252925302531253225332534253525362537253825392540254125422543254425452546254725482549255025512552255325542555255625572558255925602561256225632564256525662567256825692570257125722573257425752576257725782579258025812582258325842585258625872588258925902591259225932594259525962597259825992600260126022603260426052606260726082609261026112612261326142615261626172618261926202621262226232624262526262627262826292630263126322633263426352636263726382639264026412642264326442645264626472648264926502651265226532654265526562657265826592660266126622663266426652666266726682669267026712672267326742675267626772678267926802681268226832684268526862687268826892690269126922693269426952696269726982699270027012702270327042705270627072708270927102711271227132714271527162717271827192720272127222723272427252726272727282729273027312732273327342735273627372738273927402741274227432744274527462747274827492750275127522753275427552756275727582759276027612762276327642765276627672768276927702771277227732774277527762777277827792780278127822783278427852786278727882789279027912792279327942795279627972798279928002801280228032804280528062807280828092810281128122813281428152816281728182819282028212822282328242825282628272828282928302831283228332834283528362837283828392840284128422843284428452846284728482849285028512852285328542855285628572858285928602861286228632864286528662867286828692870287128722873287428752876287728782879288028812882288328842885288628872888288928902891289228932894289528962897289828992900290129022903290429052906290729082909291029112912291329142915291629172918291929202921292229232924292529262927292829292930293129322933293429352936293729382939294029412942294329442945294629472948294929502951295229532954295529562957295829592960296129622963296429652966296729682969297029712972297329742975297629772978297929802981298229832984298529862987298829892990299129922993299429952996299729982999300030013002300330043005300630073008300930103011301230133014301530163017301830193020302130223023302430253026302730283029303030313032303330343035303630373038303930403041304230433044304530463047304830493050305130523053305430553056305730583059306030613062306330643065306630673068306930703071307230733074 |
- <!DOCTYPE html>
- <html lang="zh-CN">
- <head>
- <meta charset="utf-8">
- <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no, viewport-fit=cover">
- <meta name="format-detection" content="telephone=no">
- <title>U店在哪</title>
- <style>
- :root {
- --orange: #F58220;
- --orange-light: #FFF4E8;
- --red: #FF4D4F;
- --text: #333333;
- --text-secondary: #999999;
- --border: #EEEEEE;
- --bg: #FFFFFF;
- --safe-bottom: env(safe-area-inset-bottom, 0px);
- }
- * {
- margin: 0;
- padding: 0;
- box-sizing: border-box;
- }
- #staffGroupsMount{
- height: 202px;
- overflow: hidden;
- }
- html {
- font-size: 16px;
- -webkit-tap-highlight-color: transparent;
- overflow-x: hidden;
- }
- body {
- font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", "Helvetica Neue", sans-serif;
- background: var(--bg);
- color: var(--text);
- padding-bottom: calc(88px + var(--safe-bottom));
- min-height: 100vh;
- overflow-x: hidden;
- }
- /* Header */
- .header {
- position: sticky;
- top: 0;
- z-index: 100;
- display: flex;
- align-items: center;
- justify-content: center;
- height: 44px;
- padding: 0 15px;
- background: var(--bg);
- border-bottom: 1px solid var(--border);
- }
- .header__back {
- position: absolute;
- left: 15px;
- width: 24px;
- height: 24px;
- display: flex;
- align-items: center;
- justify-content: center;
- color: var(--text);
- text-decoration: none;
- }
- .header__title {
- font-size: 17px;
- font-weight: 600;
- color: var(--text);
- }
- /* Hero carousel */
- .hero {
- position: relative;
- margin: 0 15px;
- margin-top: 10px;
- border-radius: 0 0 12px 12px;
- overflow: hidden;
- }
- .hero__track {
- display: flex;
- transition: transform 0.35s ease;
- }
- .hero__slide {
- flex: 0 0 100%;
- aspect-ratio: 16 / 10;
- background: #f0f0f0;
- }
- .hero__slide img {
- width: 100%;
- height: 100%;
- object-fit: cover;
- display: block;
- vertical-align: middle;
- }
- .hero__dots {
- position: absolute;
- bottom: 12px;
- left: 0;
- right: 0;
- display: flex;
- justify-content: center;
- align-items: center;
- gap: 6px;
- }
- .hero__dot {
- width: 6px;
- height: 6px;
- border-radius: 3px;
- background: rgba(255, 255, 255, 0.45);
- transition: width 0.25s ease, background 0.25s ease;
- }
- .hero__dot.is-active {
- width: 16px;
- background: #fff;
- }
- /* Store block */
- .section {
- padding: 16px 15px 0;
- }
- .store-name {
- font-size: 20px;
- font-weight: 700;
- line-height: 1.35;
- margin-bottom: 12px;
- }
- .row {
- display: flex;
- align-items: center;
- justify-content: space-between;
- gap: 10px;
- }
- .rating-row {
- margin-bottom: 12px;
- }
- .stars {
- display: inline-flex;
- align-items: center;
- gap: 2px;
- }
- .star {
- width: 14px;
- height: 14px;
- color: var(--orange);
- }
- .rating-num {
- font-size: 14px;
- font-weight: 600;
- color: var(--orange);
- }
- .store-evaluate-row {
- display: none;
- flex-direction: row;
- flex-wrap: wrap;
- align-items: center;
- gap: 6px 6px;
- margin: 0 0 12px;
- padding: 0;
- font-size: 13px;
- line-height: 1.4;
- color: var(--text-secondary);
- }
- .store-evaluate-row.is-visible {
- display: flex;
- }
- .store-evaluate__item {
- white-space: nowrap;
- }
- .link-muted {
- display: inline-flex;
- align-items: center;
- gap: 2px;
- font-size: 13px;
- color: var(--text-secondary);
- text-decoration: none;
- }
- .chevron {
- width: 14px;
- height: 14px;
- opacity: 0.6;
- }
- .hours-row {
- /* margin-bottom: 16px; */
- align-items: flex-start;
- border-bottom:1px solid #eee;
- padding-bottom: 20px;
- }
- .hours-left {
- flex: 1;
- min-width: 0;
- }
- .status {
- font-size: 14px;
- color: var(--red);
- margin-right: 8px;
- }
- .status.is-open {
- color: var(--orange);
- }
- .hours-text {
- font-size: 14px;
- color: var(--text-secondary);
- }
- .divider {
- height: 8px;
- background: #F7F7F7;
- margin: 0;
- }
- /* Location */
- .loc-wrap {
- display: flex;
- padding: 16px 15px;
- gap: 12px;
- }
- .loc-main {
- flex: 1;
- min-width: 0;
- padding-right: 12px;
- }
- .addr {
- font-size: 15px;
- font-weight: 600;
- line-height: 1.45;
- margin-bottom: 10px;
- }
- .meta-line {
- display: flex;
- align-items: flex-start;
- gap: 6px;
- font-size: 13px;
- color: var(--text-secondary);
- line-height: 1.45;
- margin-top: 6px;
- }
- .meta-line svg,
- .meta-line img {
- flex-shrink: 0;
- margin-top: 2px;
- opacity: 0.75;
- display: block;
- }
- .loc-actions {
- display: flex;
- flex-direction: row;
- align-items: center;
- justify-content: center;
- gap: 18px;
- flex-shrink: 0;
- }
- .act-btn {
- display: flex;
- flex-direction: column;
- align-items: center;
- gap: 4px;
- background: none;
- border: none;
- padding: 0;
- cursor: pointer;
- font-size: 12px;
- color: var(--text);
- }
- .act-btn__icon {
- width: 44px;
- height: 44px;
- border-radius: 10px;
- background: #F5F5F5;
- display: flex;
- align-items: center;
- justify-content: center;
- color: var(--orange);
- }
- .act-btn__icon img {
- width: 22px;
- height: 22px;
- object-fit: contain;
- display: block;
- }
- /* businessStatus===99 时仅展示关店提示并隐藏 .share-content;底部 FAB 仍在 #shareBelowContentEl */
- .closed-rec-wrap {
- display: none;
- }
- .closed-rec-divider {
- height: 8px;
- background: #F7F7F7;
- margin: 0;
- }
- .closed-rec-title {
- padding: 8px 15px 12px;
- font-size: 16px;
- font-weight: 700;
- }
- .closed-rec-grid {
- display: grid;
- grid-template-columns: repeat(2, 1fr);
- gap: 10px;
- padding: 0 15px 20px;
- }
- #shareClosedRecEmpty {
- grid-column: 1 / -1;
- }
- .closed-rec-empty {
- padding: 12px;
- color: var(--text-secondary);
- font-size: 14px;
- }
- .closed-rec-card {
- min-width: 0;
- background: #fff;
- border-radius: 10px;
- overflow: hidden;
- box-shadow: 0 2px 12px rgba(0, 0, 0, 0.06);
- }
- .closed-rec-card__img {
- aspect-ratio: 4 / 3;
- background: #eee;
- }
- .closed-rec-card__img img {
- width: 100%;
- height: 100%;
- object-fit: cover;
- display: block;
- border-radius: 0;
- }
- .closed-rec-card__body {
- padding: 10px;
- }
- .closed-rec-card__top {
- display: flex;
- justify-content: space-between;
- align-items: baseline;
- gap: 8px;
- margin-bottom: 6px;
- }
- .closed-rec-card__name {
- font-size: 15px;
- font-weight: 700;
- flex: 1;
- min-width: 0;
- overflow: hidden;
- text-overflow: ellipsis;
- white-space: nowrap;
- }
- .closed-rec-card__dist {
- font-size: 12px;
- color: var(--text-secondary);
- flex-shrink: 0;
- }
- .closed-rec-card__rating {
- display: flex;
- align-items: center;
- flex-wrap: wrap;
- gap: 4px 6px;
- }
- .closed-rec-card__rating .closed-rec-stars {
- display: inline-flex;
- align-items: center;
- gap: 2px;
- }
- .closed-rec-card__rating .closed-rec-star {
- display: block;
- flex-shrink: 0;
- }
- .closed-rec-card__rating .closed-rec-rating-num {
- font-size: 12px;
- font-weight: 600;
- color: var(--orange);
- }
- .closed-rec-meta {
- font-size: 12px;
- color: var(--text-secondary);
- }
- .closed-rec-card__footer {
- margin-top: 8px;
- font-size: 12px;
- color: var(--text-secondary);
- overflow: hidden;
- text-overflow: ellipsis;
- white-space: nowrap;
- }
- .share-none {
- display: none;
- text-align: center;
- padding: 28px 20px 16px;
- color: var(--text-muted);
- font-size: 15px;
- line-height: 1.5;
- }
- .share-none img {
- width: 240px;
- height: 240px;
- margin-bottom: 12px;
- display: inline-block;
- }
- .share-none p {
- margin: 0;
- padding:0 0 60px 0;
- color:#999;
- }
- /* FAB */
- .fab-wrap {
- position: fixed;
- left: 0;
- right: 0;
- bottom: 0;
- z-index: 200;
- padding: 12px 24px calc(12px + var(--safe-bottom));
- background: linear-gradient(to top, rgba(255, 255, 255, 0.98) 70%, transparent);
- pointer-events: none;
- }
- .fab-dock__slot {
- width: 100%;
- max-width: 198px;
- height: 48px;
- margin: 0 auto;
- pointer-events: auto;
- }
- #openApp.fab {
- padding: 0 10px;
- -webkit-font-smoothing: antialiased;
- text-rendering: optimizeLegibility;
- }
- .fab__brand-clip {
- display: block;
- flex-shrink: 0;
- line-height: 0;
- }
- .fab__brand-img {
- display: block;
- height: 36px;
- width: auto;
- max-width: none;
- pointer-events: none;
- -webkit-user-drag: none;
- }
- .fab__label {
- font-size: 15px;
- line-height: 1;
- letter-spacing: 0.04em;
- white-space: nowrap;
- }
- /* 微信内:wx.config 成功后只显示开放标签按钮(官方用法) */
- #launch-btn {
- display: none;
- width: 100%;
- height: 48px;
- min-height: 48px;
- border-radius: 24px;
- overflow: hidden;
- opacity: 1;
- }
- body.is-wechat.wx-jssdk-ready #launch-btn {
- display: block;
- }
- body.is-wechat.wx-jssdk-ready #openApp {
- display: none !important;
- }
- .fab {
- display: flex;
- align-items: center;
- justify-content: center;
- gap: 4px;
- width: 100%;
- max-width: 198px;
- margin: 0 auto;
- height: 48px;
- border: none;
- border-radius: 24px;
- background: var(--orange);
- color: #fff;
- font-size: 16px;
- font-weight: 600;
- box-shadow: 0 4px 16px rgba(245, 130, 32, 0.45);
- cursor: pointer;
- background:#F47D1F;
- }
- .fab__logo {
- width: 28px;
- height: 28px;
- flex-shrink: 0;
- }
- .home-indicator {
- height: 5px;
- background: #000;
- border-radius: 3px;
- width: 134px;
- margin: 8px auto 4px;
- opacity: 0.2;
- }
- #openAppToast {
- display: none;
- position: fixed;
- left: 16px;
- right: 16px;
- bottom: calc(72px + var(--safe-bottom));
- z-index: 10001;
- padding: 10px 14px;
- font-size: 13px;
- line-height: 1.45;
- color: #fff;
- text-align: center;
- background: rgba(0, 0, 0, 0.78);
- border-radius: 8px;
- pointer-events: none;
- word-break: break-all;
- }
- #openApp {
- touch-action: manipulation;
- }
- /* 营销活动(getStoreCouponList.marketingList) */
- .marketing-section {
- padding: 4px 15px 20px;
- }
- .marketing-section__title {
- font-size: 16px;
- font-weight: 700;
- color: var(--text);
- margin: 0 0 12px;
- }
- .marketing-section__list {
- display: flex;
- flex-direction: column;
- gap: 12px;
- }
- .marketing-card {
- border-radius: 12px;
- overflow: hidden;
- background: #f0f0f0;
- box-shadow: 0 2px 12px rgba(0, 0, 0, 0.06);
- }
- .marketing-card__media img,
- .marketing-card__media video {
- width: 100%;
- display: block;
- aspect-ratio: 16 / 9;
- object-fit: cover;
- vertical-align: middle;
- }
- .marketing-card__media video {
- background: #000;
- }
- .marketing-card--more {
- display: none;
- }
- .marketing-section.is-expanded .marketing-card--more {
- display: block;
- }
- .marketing-section__more {
- display: flex;
- align-items: center;
- justify-content: center;
- gap: 4px;
- width: 100%;
- margin-top: 14px;
- padding: 8px 0;
- border: none;
- background: none;
- font-size: 14px;
- color: var(--text-secondary);
- cursor: pointer;
- -webkit-tap-highlight-color: transparent;
- }
- .marketing-section__more-chevron {
- width: 16px;
- height: 16px;
- flex-shrink: 0;
- transition: transform 0.2s ease;
- }
- .marketing-section.is-expanded .marketing-section__more-chevron {
- transform: rotate(180deg);
- }
- .marketing-section__empty {
- display: flex;
- flex-direction: column;
- justify-content: center;
- align-items: center;
- padding: 10px 0 8px;
- }
- .marketing-section__empty img {
- width: 200px;
- height: 200px;
- display: block;
- object-fit: contain;
- }
- .marketing-section__empty-label {
- margin: 12px 0 0;
- font-size: 14px;
- color: var(--text-secondary);
- text-align: center;
- }
- /* 演出安排 performance/list/query */
- .performance-section {
- padding: 8px 0 20px;
- border-top: 1px solid var(--border);
- margin-top: 4px;
- }
- .performance-section__title {
- font-size: 16px;
- font-weight: 700;
- color: var(--text);
- margin: 0 15px 12px;
- }
- .performance-strip {
- display: flex;
- flex-direction: row;
- flex-wrap: nowrap;
- gap: 12px;
- overflow-x: auto;
- overflow-y: hidden;
- padding: 0 15px 4px;
- -webkit-overflow-scrolling: touch;
- scrollbar-width: none;
- }
- .performance-strip::-webkit-scrollbar {
- display: none;
- }
- .performance-card {
- flex: 0 0 auto;
- display: flex;
- flex-direction: row;
- align-items: stretch;
- gap: 10px;
- width: 272px;
- min-width: 272px;
- padding: 0;
- background: #fff;
- border-radius: 12px;
- overflow: hidden;
- }
- .performance-card__poster {
- flex: 0 0 76px;
- width: 76px;
- min-height: 102px;
- background: #eee;
- align-self: stretch;
- }
- .performance-card__poster img {
- width: 100%;
- height: 100%;
- min-height: 102px;
- object-fit: cover;
- display: block;
- vertical-align: middle;
- }
- .performance-card__body {
- flex: 1;
- min-width: 0;
- display: flex;
- flex-direction: column;
- justify-content: center;
- gap: 4px;
- padding: 10px 12px 10px 0;
- }
- .performance-card__name {
- font-size: 15px;
- font-weight: 700;
- color: var(--text);
- line-height: 1.3;
- overflow: hidden;
- text-overflow: ellipsis;
- display: -webkit-box;
- -webkit-line-clamp: 2;
- -webkit-box-orient: vertical;
- }
- .performance-card__meta {
- font-size: 12px;
- color: var(--text-secondary);
- line-height: 1.35;
- overflow: hidden;
- text-overflow: ellipsis;
- white-space: nowrap;
- }
- /* 人员阵容 queryStaffListByTitle */
- .staff-section {
- padding: 8px 0 24px;
- border-top: 1px solid var(--border);
- margin-top: 4px;
- }
- .staff-section__head {
- display: flex;
- align-items: center;
- justify-content: space-between;
- gap: 12px;
- padding: 0 15px;
- margin-bottom: 12px;
- }
- .staff-section__page-title {
- font-size: 16px;
- font-weight: 700;
- color: var(--text);
- margin: 0;
- flex: 1;
- min-width: 0;
- }
- .staff-section__all {
- flex-shrink: 0;
- display: inline-flex;
- align-items: center;
- gap: 2px;
- font-size: 13px;
- color: #151515;
- text-decoration: none;
- background: none;
- border: none;
- padding: 0;
- cursor: pointer;
- -webkit-tap-highlight-color: transparent;
- }
- .staff-section__all-chevron {
- width: 14px;
- height: 14px;
- opacity: 0.7;
- }
- .staff-group {
- margin-bottom: 20px;
- }
- .staff-group:last-child {
- margin-bottom: 0;
- }
- .staff-strip {
- display: flex;
- flex-direction: row;
- flex-wrap: nowrap;
- gap: 10px;
- overflow-x: auto;
- overflow-y: hidden;
- padding: 0 15px 4px;
- -webkit-overflow-scrolling: touch;
- scrollbar-width: none;
- }
- .staff-strip::-webkit-scrollbar {
- display: none;
- }
- .staff-card {
- flex: 0 0 112px;
- width: 112px;
- min-width: 112px;
- }
- .staff-card__img-wrap {
- position: relative;
- border-radius: 10px;
- overflow: hidden;
- background: #eee;
- aspect-ratio: 3 / 4;
- }
- .staff-card__img-wrap img {
- width: 100%;
- height: 100%;
- object-fit: cover;
- display: block;
- vertical-align: middle;
- }
- .staff-card__likes {
- position: absolute;
- left: 0;
- right: 0;
- bottom: 0;
- padding: 6px 8px;
- font-size: 11px;
- color: #fff;
- line-height: 1.2;
- background: linear-gradient(to top, rgba(0, 0, 0, 0.65), transparent);
- }
- .staff-card__name-row {
- display: flex;
- align-items: center;
- gap: 4px;
- margin-top: 8px;
- min-width: 0;
- }
- .staff-card__name {
- font-size: 14px;
- font-weight: 700;
- color: var(--text);
- overflow: hidden;
- text-overflow: ellipsis;
- white-space: nowrap;
- flex: 1;
- min-width: 0;
- }
- .staff-card__badge {
- flex-shrink: 0;
- font-size: 10px;
- font-weight: 600;
- color: #fff;
- background: #ff9d4d;
- padding: 2px 5px;
- border-radius: 3px;
- line-height: 1.2;
- white-space: nowrap;
- }
- .staff-card__meta {
- display: flex;
- align-items: center;
- flex-wrap: wrap;
- gap: 0 4px;
- margin-top: 4px;
- font-size: 12px;
- color: var(--text-secondary);
- line-height: 1.35;
- }
- .staff-card__position {
- overflow: hidden;
- text-overflow: ellipsis;
- white-space: nowrap;
- max-width: 100%;
- }
- .staff-card__reviews {
- display: inline-flex;
- align-items: center;
- gap: 4px;
- }
- .staff-card__sep {
- color: #ddd;
- font-weight: 300;
- }
- </style>
- </head>
- <body>
- <div class="share-none" id="shareClosedBanner" aria-hidden="true">
- <img src="images/storeNone.png" alt="">
- <p>抱歉商户已关闭,看看别的吧</p>
- </div>
- <div class="closed-rec-wrap" id="shareClosedRecommendWrap" aria-hidden="true">
- <div class="closed-rec-divider"></div>
- <h3 class="closed-rec-title">更多推荐</h3>
- <div class="closed-rec-grid" id="shareClosedRecList">
- <p id="shareClosedRecEmpty" class="closed-rec-empty" style="display:none;">暂无推荐</p>
- </div>
- </div>
- <div class="share-content" id="shareContentEl">
- <div class="hero" id="hero">
- <div class="hero__track" id="heroTrack">
- <div class="hero__slide"><img id="heroFallbackImg" src="images/hero.png" alt="店铺图"></div>
- </div>
- <div class="hero__dots" id="heroDots" aria-hidden="true"></div>
- </div>
- <!-- 数据由 getClientStoreDetail(id,userId,jingdu,weidu)填充,见 renderDetail -->
- <section class="section" id="mainSection">
- <p id="pageError" class="page-error" style="display:none;color:#ff4d4f;padding:12px 0;font-size:14px;"></p>
- <h2 class="store-name" id="storeName">加载中…</h2>
- <div class="row rating-row">
- <div class="row" style="flex:1; justify-content:flex-start;">
- <span class="stars" aria-label="5.0 分">
- <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>
- <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>
- <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>
- <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>
- <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>
- </span>
- <span class="rating-num" id="scoreAvg">—</span>
- <span id="commitCount" style="font-size: 14px;">0</span>
- </div>
- <!-- <a href="#" class="link-muted"><span id="commitCount">0</span>条评价
- <svg class="chevron" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><polyline points="9 18 15 12 9 6"/></svg>
- </a> -->
- </div>
- <div class="store-evaluate-row" id="storeEvaluateRow" aria-hidden="true">
- <span class="store-evaluate__item">酒水:<span id="storeEvaluateScoreOne">—</span></span>
- <span class="store-evaluate__item">氛围:<span id="storeEvaluateScoreTwo">—</span></span>
- <span class="store-evaluate__item">服务:<span id="storeEvaluateScoreThree">—</span></span>
- </div>
- <div class="row hours-row">
- <div class="hours-left">
- <span class="status" id="bizStatus">—</span>
- <span class="hours-text" id="hoursText">—</span>
- </div>
- <a href="#" class="link-muted">详情
- <svg class="chevron" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><polyline points="9 18 15 12 9 6"/></svg>
- </a>
- </div>
- </section>
- <div class="loc-wrap">
- <div class="loc-main">
- <p class="addr" id="storeAddr">—</p>
- <div class="meta-line" id="metaDistance" style="display:none;">
- <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>
- <span id="distanceText">—</span>
- </div>
- <div class="meta-line" id="metaSubway" style="display:none;">
- <img src="images/iconn.png" alt="" width="12" height="12" decoding="async">
- <span id="subwayText">—</span>
- </div>
- </div>
- <div class="loc-actions">
- <button type="button" class="act-btn" aria-label="导航">
- <span class="act-btn__icon">
- <img src="images/loc1.png" alt="" width="22" height="22" decoding="async">
- </span>
- 导航
- </button>
- <button type="button" class="act-btn" aria-label="电话">
- <span class="act-btn__icon">
- <img src="images/loc2.png" alt="" width="22" height="22" decoding="async">
- </span>
- 电话
- </button>
- </div>
- </div>
- <section class="marketing-section" id="shareMarketingSection" style="display:none;" aria-hidden="true">
- <h3 class="marketing-section__title">营销活动</h3>
- <div class="marketing-section__list" id="marketingListEl"></div>
- <button type="button" class="marketing-section__more" id="marketingMoreBtn" style="display:none;">
- <span id="marketingMoreText"></span>
- <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>
- </button>
- </section>
- <section class="performance-section" id="sharePerformanceSection" style="display:none;" aria-hidden="true">
- <h3 class="performance-section__title" id="performanceSectionTitle">演出安排(0)</h3>
- <div class="performance-strip" id="performanceStripEl"></div>
- </section>
- <section class="staff-section" id="shareStaffSection" style="display:none;" aria-hidden="true">
- <div class="staff-section__head">
- <h3 class="staff-section__page-title">人员阵容(<span id="staffSectionCountEl">0</span>)</h3>
- <button type="button" class="staff-section__all" id="staffSectionAllBtn" aria-label="查看全部">
- 查看全部
- <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>
- </button>
- </div>
- <div id="staffGroupsMount"></div>
- </section>
- </div>
- <div id="openAppToast" role="status" aria-live="polite"></div>
- <div id="fabDock" class="fab-wrap">
- <div class="fab-dock__slot">
- <!-- 非微信 / 微信 JSSDK 未就绪:scheme 唤起 -->
- <button type="button" class="fab" id="openApp" aria-label="APP内打开">
- <span class="fab__brand-clip" aria-hidden="true">
- <img class="fab__brand-img" src="images/uBtn.svg" alt="" decoding="async">
- </span>
- <span class="fab__label">APP内打开</span>
- </button>
- <!-- 微信内 wx.config 成功后:仅此按钮可唤起 App(须用户直接点击) -->
- <wx-open-launch-app id="launch-btn" appid="wxf5f1efe3a9f5012e" extinfo="">
- <script type="text/wxtag-template">
- <style>
- .wx-open-app-btn {
- display: flex;
- align-items: center;
- justify-content: center;
- gap: 8px;
- width: 100%;
- height: 48px;
- margin: 0;
- padding: 0 10px;
- border: none;
- border-radius: 24px;
- background: #F47D1F;
- box-shadow: 0 4px 16px rgba(245, 130, 32, 0.45);
- color: #fff;
- font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Helvetica Neue", sans-serif;
- -webkit-font-smoothing: antialiased;
- cursor: pointer;
- overflow: hidden;
- -webkit-tap-highlight-color: transparent;
- box-sizing: border-box;
- }
- .wx-open-app-btn .fab__brand-clip {
- display: block;
- flex-shrink: 0;
- line-height: 0;
- }
- .wx-open-app-btn .fab__brand-img {
- display: block;
- height: 36px;
- width: auto;
- max-width: none;
- pointer-events: none;
- -webkit-user-drag: none;
- }
- .wx-open-app-btn .fab__label {
- font-size: 15px;
- line-height: 1;
- letter-spacing: 0.04em;
- white-space: nowrap;
- }
- </style>
- <button class="wx-open-app-btn" aria-label="APP内打开">
- <span class="fab__brand-clip" aria-hidden="true">
- <img class="fab__brand-img" src="https://test.ailien.shop/h5/HBuilderProjects/images/uBtn.svg" alt="" decoding="async">
- </span>
- <span class="fab__label">APP内打开</span>
- </button>
- </script>
- </wx-open-launch-app>
- </div>
- <div class="home-indicator" aria-hidden="true"></div>
- </div>
- <script src="https://res.wx.qq.com/open/js/jweixin-1.6.0.js"></script>
- <script>
- (function () {
- 'use strict';
- /**
- * 与 group_user sharePopup 复制链接时携带的 query 一致,例如:
- * ?id=436&storeId=436&userId=628&businessSection=3&lat=...&lon=...&jingdu=...&weidu=...&storeName=...&coverUrl=...&desc=...
- *
- * 进入页先 GET .../store/info/getOne?id=(与 shareDynamic.html 一致);data.businessStatus===99 时先展示关店区(#shareClosedBanner、#shareClosedRecommendWrap)。
- * 关店时点「APP内打开」:深链为 shopro://pages/index/login?…(与 group_user pages/index/login),不再进八区详情。
- * 店铺头图/名称/评分/地址等(#mainSection、.loc-wrap):GET .../store/info/getClientStoreDetail?id=&userId=&jingdu=&weidu=
- * 经纬度:URL 可用 jingdu/weidu;若无则用 lon/lng、lat(与分享链一致)
- * 营销活动: GET .../store/info/getStoreCouponList?storeId= → data.marketingList
- * 演出安排: GET .../performance/list/query?storeId=&page=&size= → data.records, data.total(仅 URL businessSection=2 时展示与请求)
- * 人员阵容: GET .../storeStaffConfig/queryStaffListByTitle?storeId= → data[]
- *
- * 注意:用 file:// 打开本页时,浏览器可能因 CORS 拦截跨域请求。
- * 请用本地 HTTP 打开(如 VS Code Live Server、npx serve)或让后端为 H5 域名配置 Access-Control-Allow-Origin。
- */
- var API_BASE = 'https://test.ailien.shop/alienStore';
- /**
- * 微信 JSSDK(服务号「麦丽恩严U店」)— 仅用于 wx.config 签名,Secret 只放后端
- * 后端 POST {API_BASE}/wx/getWxConfig,body 传 url(当前页完整地址)须用:AppID wx412792c77f47babd + 服务号 AppSecret
- *
- * 签名 url 官方要求(invalid signature 排查):
- * 1. 前端用 location.href.split('#')[0] 动态取当前页完整 URL(含 ? 参数,不含 #)
- * 2. 作为 body.url 传给后端签名
- * 3. wx.config 的 appId/timestamp/nonceStr/signature 须与后端生成签名时完全一致(nonceStr 驼峰)
- * 4. appId 须与后端取 jsapi_ticket 的公众号一致
- * 5. 分享进入时微信会附加 from、isappinstalled 等参数,必须参与签名,不可用静态写死 URL
- */
- var WECHAT_MP_APP_ID = 'wx412792c77f47babd';
- /** 微信开放标签 wx-open-launch-app — 移动应用「U店在哪」AppID(不是服务号 ID) */
- var WECHAT_OPEN_APP_ID = 'wxf5f1efe3a9f5012e';
- var WECHAT_GET_WX_CONFIG_PATH = '/wx/getWxConfig';
- /** 仅 file:// 或无法读取 location.href 时的联调兜底,微信内真实环境不应走到此处 */
- var H5_PAGE_BASE_FALLBACK = 'https://test.ailien.shop/h5/HBuilderProjects/';
- var WX_GET_CONFIG_SIGN_URL = H5_PAGE_BASE_FALLBACK + 'shareIndex.html';
- var WECHAT_JS_SAFE_HOSTS = ['uat.ailien.shop', 'test.ailien.shop'];
- var weChatJssdkConfigured = false;
- var wxConfigSignRetriedBaseUrl = false;
- var wxInitLastError = '';
- var wxJssdkInitPromise = null;
- /**
- * 关店(businessStatus=99)更多推荐:POST …/ai/multimodal-services/api/v1/search/global/store-recommend
- * 与 shareCheckInUndefined.html 一致;请求体 userCity/userLat/userLng 优先取 URL:userCity、lat、lon(兼认 userLat/userLng、weidu/jingdu 等)。
- */
- var API_LIFE_AI_BASE = 'http://183.252.196.135:9100';
- var STORE_GLOBAL_RECOMMEND_PATH =
- '/ai/multimodal-services/api/v1/search/global/store-recommend';
- /** 关店推荐用户位置:优先 URL 的 lat、lon、userCity;缺省再用大连默认值 */
- function getClosedRecommendUserLocation() {
- var latRaw = (q('lat') || q('userLat') || q('latitude') || q('weidu') || '').trim();
- var lonRaw = (q('lon') || q('userLng') || q('longitude') || q('lng') || q('jingdu') || '').trim();
- var cityRaw = (q('userCity') || q('city') || '').trim();
- return {
- userLat:
- latRaw !== '' && !isNaN(Number(latRaw)) ? Number(latRaw) : 38.925747,
- userLng:
- lonRaw !== '' && !isNaN(Number(lonRaw)) ? Number(lonRaw) : 121.662531,
- userCity: cityRaw !== '' ? cityRaw : '大连市'
- };
- }
- /**
- * 与 group_user 一致:
- * - manifest:app-plus.distribute.android.schemes、ios.urltypes → shopro(即 shopro://)
- * - Android 包名:manifest 未写 packagename 时与 App.vue 升级配置 androidPackageName 一致(云打包以 HBuilderX 为准)
- */
- var APP_ANDROID_PACKAGE = 'com.alien.Udianzaizhe';
- var APP_IOS_URL_SCHEME = 'shopro://';
- /** businessSection 未传或其它值时的默认落地页(与 1 相同) */
- var APP_UNI_STORE_PATH = 'pages/ieisureEntertainment/eightTypeList/delicacyDetails';
- function showDownloadTip() {
- var msg = '请到应用商店下载';
- if (typeof uni !== 'undefined' && typeof uni.showToast === 'function') {
- uni.showToast({ title: msg, icon: 'none', duration: 2500 });
- } else {
- window.alert(msg);
- }
- }
- /** getClientStoreDetail 回填后用于补全 storeType / storeTypeName 等唤起参数 */
- var appLaunchDetailCache = null;
- /**
- * 与 App 详情 onLoad 一致,例如:
- * pages/ieisureEntertainment/eightTypeList/delicacyDetails?storeId=378&storeType=3&storeTypeName=特色美食&businessSection=1
- */
- function buildAppLaunchQueryParams() {
- var raw = (location.search && location.search.charAt(0) === '?') ? location.search.slice(1) : (location.search || '');
- var params = new URLSearchParams(raw);
- var sid = params.get('storeId') || params.get('id') || '';
- if (sid && !params.get('storeId')) params.set('storeId', sid);
- if (!params.has('weidu') && params.has('lat')) params.set('weidu', params.get('lat'));
- if (!params.has('jingdu')) {
- var lonVal = params.get('lon') || params.get('lng');
- if (lonVal) params.set('jingdu', lonVal);
- }
- var d = appLaunchDetailCache;
- if (d && typeof d === 'object') {
- if (!params.has('storeType') && d.storeType != null && String(d.storeType).trim() !== '') {
- params.set('storeType', String(d.storeType).trim());
- }
- if (!params.has('storeTypeName')) {
- var tn = d.storeTypeName != null ? d.storeTypeName : d.typeName;
- if (tn != null && String(tn).trim() !== '') params.set('storeTypeName', String(tn).trim());
- }
- if (!params.has('businessSection') && d.businessSection != null && String(d.businessSection).trim() !== '') {
- params.set('businessSection', String(d.businessSection).trim());
- }
- }
- if (!params.has('businessSection')) {
- var pathHint = getAppUniPathForBusinessSection();
- if (pathHint.indexOf('barDetails') >= 0) params.set('businessSection', '2');
- else if (pathHint.indexOf('lifeDetails') >= 0) params.set('businessSection', '3');
- else if (pathHint.indexOf('delicacyDetails') >= 0) params.set('businessSection', '1');
- }
- return params;
- }
- function buildAppOpenQueryString() {
- var qs = buildAppLaunchQueryParams().toString();
- return qs ? ('?' + qs) : '';
- }
- /** Uni 路由串(无 shopro://),供 wx-open-launch-app extinfo 与 App plus.runtime.arguments 解析 */
- function buildAppUniPageLaunchUrl() {
- var path = getAppUniPathForBusinessSection().replace(/^\//, '');
- var qs = buildAppLaunchQueryParams().toString();
- return qs ? path + '?' + qs : path;
- }
- /**
- * 按 URL 参数 businessSection 打开对应 App 页:
- * 1 → delicacyDetails,2 → barDetails,3 → lifeDetails
- * 关店 businessStatus=99 时进 pages/index/login(见 isClosedMerchantForAppOpen)。
- */
- function getAppUniPathForBusinessSection() {
- if (isClosedMerchantForAppOpen()) {
- return 'pages/index/login';
- }
- var bs = String(q('businessSection') || '').trim();
- if (bs === '1') {
- return 'pages/ieisureEntertainment/eightTypeList/delicacyDetails';
- }
- if (bs === '2') {
- return 'pages/ieisureEntertainment/eightTypeList/barDetails';
- }
- if (bs === '3') {
- return 'pages/ieisureEntertainment/eightTypeList/lifeDetails';
- }
- return String(APP_UNI_STORE_PATH || 'pages/ieisureEntertainment/eightTypeList/delicacyDetails').replace(/^\//, '');
- }
- function buildAppDeepLink() {
- var path = getAppUniPathForBusinessSection().replace(/^\//, '');
- var s = buildAppOpenQueryString();
- var root = APP_IOS_URL_SCHEME.replace(/\/$/, '');
- if (!s) return root + '/' + path;
- return root + '/' + path + s;
- }
- function isWeChatInAppBrowser() {
- return /MicroMessenger/i.test(navigator.userAgent || '');
- }
- function getWxShareEntryFrom() {
- var from = readQueryParam('from');
- if (from) return String(from).trim().toLowerCase();
- try {
- var h = location.hash || '';
- var qi = h.indexOf('?');
- if (qi >= 0) {
- var hf = new URLSearchParams(h.slice(qi + 1)).get('from');
- if (hf) return String(hf).trim().toLowerCase();
- }
- } catch (eH) {}
- return '';
- }
- function isIOSWeChatBrowser() {
- var ua = navigator.userAgent || '';
- return /MicroMessenger/i.test(ua) && /iPhone|iPad|iPod/i.test(ua);
- }
- function logWxEntryDiagnostics() {
- if (!isWeChatInAppBrowser()) return;
- console.log('[wx-entry]', {
- entryFrom: getWxShareEntryFrom() || '(无)',
- wxJssdkReady: weChatJssdkConfigured,
- signUrl: getWxConfigSignUrl()
- });
- }
- function readQueryParam(name) {
- try {
- var v = new URLSearchParams(location.search || '').get(name);
- return v == null ? '' : String(v);
- } catch (eQ) {
- return '';
- }
- }
- function isWxDebugOn() {
- return readQueryParam('wxDebug') === '1';
- }
- /** PC 联调:测试域 / localhost 自动开启;也可显式 ?wxForce=1 */
- function isWxForceDebug() {
- return readQueryParam('wxForce') === '1';
- }
- function isWxConfigOnClickDebug() {
- return readQueryParam('wxConfigOnClick') === '1';
- }
- function isWxPcAutoDebugHost() {
- var h = (location.hostname || '').toLowerCase();
- if (h === 'localhost' || h === '127.0.0.1') return true;
- for (var i = 0; i < WECHAT_JS_SAFE_HOSTS.length; i++) {
- if (WECHAT_JS_SAFE_HOSTS[i] === h) return true;
- }
- return false;
- }
- function isWxPcBrowser() {
- return !isWeChatInAppBrowser();
- }
- function shouldInitWeChatJssdkOnLoad() {
- if (isWeChatInAppBrowser()) return true;
- return isWxForceDebug() || isWxPcAutoDebugHost();
- }
- function shouldFetchWxConfig(fromUserClick) {
- if (isWeChatInAppBrowser()) return true;
- if (fromUserClick) return true;
- return isWxForceDebug() || isWxPcAutoDebugHost();
- }
- /**
- * 教程 Step6:htmlUrl = location.href.split('#')[0]
- * 浏览器访问的 url 与传给后端签名的 url 必须一致(含微信附加的 from 等参数)。
- */
- function getWxHtmlUrl() {
- var forced = String(q('wxSignUrl') || '').trim();
- if (forced) return forced.split('#')[0];
- return String(location.href || '').split('#')[0];
- }
- function getWxSignPageUrlForApi() {
- var htmlUrl = getWxHtmlUrl();
- if (htmlUrl && /^https?:\/\//i.test(htmlUrl)) return htmlUrl;
- return WX_GET_CONFIG_SIGN_URL;
- }
- function getWxSignUrlFull() {
- return getWxSignPageUrlForApi();
- }
- /** 仅 pathname;后端若按无参 url 签名可 ?wxSignBaseOnly=1 */
- function getWxHtmlUrlBase() {
- var htmlUrl = getWxSignPageUrlForApi();
- try {
- var u = new URL(htmlUrl);
- return u.origin + u.pathname;
- } catch (eU) {
- return WX_GET_CONFIG_SIGN_URL;
- }
- }
- function getWxConfigSignUrl() {
- if (String(q('wxSignBaseOnly') || '') === '1') return getWxHtmlUrlBase();
- return getWxSignPageUrlForApi();
- }
- function getWxGetConfigApiUrl() {
- return API_BASE.replace(/\/$/, '') + WECHAT_GET_WX_CONFIG_PATH;
- }
- function buildWxGetConfigRequestBody(htmlUrl) {
- return {
- url: String(htmlUrl || '').split('#')[0].trim()
- };
- }
- function resolveWxConfigAppIdFromSignData(d) {
- if (!d || typeof d !== 'object') return '';
- var mp =
- d.mpAppId ||
- d.mpAppid ||
- d.officialAppId ||
- d.gzhAppId ||
- d.serviceAppId;
- if (mp != null && String(mp).trim() !== '') return String(mp).trim();
- var fromQuery = String(q('wxMpAppId') || WECHAT_MP_APP_ID || '').trim();
- if (fromQuery) return fromQuery;
- var raw = d.appId || d.appid || d.wxAppId;
- return raw != null && String(raw).trim() !== '' ? String(raw).trim() : '';
- }
- function normalizeWxJssdkSignPayload(res, signUrlUsed) {
- if (!res || typeof res !== 'object') return null;
- var d = res.data != null && typeof res.data === 'object' ? res.data : res;
- if (!d || typeof d !== 'object') return null;
- var appId = resolveWxConfigAppIdFromSignData(d);
- var timestamp = d.timestamp != null ? d.timestamp : d.timeStamp;
- /* 官方字段名为 nonceStr(S 大写),与 wx.config 保持一致 */
- var nonceStr =
- d.nonceStr != null && String(d.nonceStr) !== ''
- ? d.nonceStr
- : d.noncestr != null && String(d.noncestr) !== ''
- ? d.noncestr
- : d.nonce;
- var signature = d.signature || d.sign;
- if (!appId || timestamp == null || nonceStr == null || nonceStr === '' || !signature) {
- return null;
- }
- var signedUrl = String(signUrlUsed || '')
- .split('#')[0]
- .trim();
- return {
- appId: String(appId),
- timestamp: Number(timestamp),
- nonceStr: String(nonceStr),
- signature: String(signature),
- signUrl: signedUrl
- };
- }
- function getWxErrMsg(err) {
- if (!err) return '';
- if (err.errMsg) return String(err.errMsg);
- if (typeof err === 'string') return err;
- try {
- return JSON.stringify(err);
- } catch (e) {
- return String(err);
- }
- }
- function formatWxConfigErrorTip(err, signPageUrl) {
- var errMsg = getWxErrMsg(err);
- var tip = '微信 JSSDK 配置失败';
- if (/invalid signature/i.test(errMsg)) {
- return (
- tip +
- ':签名无效。请核对:①后端用与前端相同的 url 签名;②url=' +
- (signPageUrl || getWxHtmlUrl()) +
- ';③nonceStr/timestamp 与接口返回一致;④appId=' +
- WECHAT_MP_APP_ID
- );
- }
- if (/require\s*subscribe/i.test(errMsg)) {
- return tip + ':' + errMsg + '(服务号需用户已关注)';
- }
- return errMsg ? tip + ':' + errMsg : tip;
- }
- /**
- * wx-open-launch-app extinfo:U店在哪 App 按 Uni 页面路径解析(与详情页路由一致)。
- * 例:pages/ieisureEntertainment/eightTypeList/delicacyDetails?storeId=378&storeType=3&storeTypeName=特色美食&businessSection=1
- */
- function buildWeChatLaunchExtinfo() {
- var uniPage = buildAppUniPageLaunchUrl();
- if (uniPage.length <= 1024) return uniPage;
- var params = buildAppLaunchQueryParams();
- var mini = new URLSearchParams();
- var storeId = params.get('storeId') || params.get('id') || '';
- if (storeId) mini.set('storeId', storeId);
- var st = params.get('storeType');
- if (st) mini.set('storeType', st);
- var stn = params.get('storeTypeName');
- if (stn) mini.set('storeTypeName', stn);
- var bs = params.get('businessSection');
- if (bs) mini.set('businessSection', bs);
- var path = getAppUniPathForBusinessSection().replace(/^\//, '');
- var shortPage = path + '?' + mini.toString();
- if (shortPage.length <= 1024) return shortPage;
- var deep = buildAppDeepLink();
- return deep.length <= 1024 ? deep : shortPage.slice(0, 1024);
- }
- function setWxInitError(msg) {
- wxInitLastError = String(msg || '').trim();
- if (wxInitLastError) console.warn('[wx]', wxInitLastError);
- }
- /**
- * 教程标准流程:
- * htmlUrl = location.href.split('#')[0]
- * POST getWxConfig,body: { url: htmlUrl }
- * success → wx.config({ appId, timestamp, nonceStr, signature, ... })
- * 不修改地址栏,保证「浏览器 url」与「签名 url」一致。
- */
- function requestWeChatJssdkSignAndConfig(htmlUrlOptional) {
- var htmlUrl = String(
- htmlUrlOptional != null ? htmlUrlOptional : getWxConfigSignUrl()
- )
- .split('#')[0]
- .trim();
- if (!htmlUrl || !/^https?:\/\//i.test(htmlUrl)) {
- htmlUrl = WX_GET_CONFIG_SIGN_URL;
- }
- if (isWxDebugOn()) {
- try {
- window.alert('htmlUrl(签名用,应与地址栏一致):\n' + htmlUrl);
- } catch (eDbg) {}
- }
- var requestUrl = getWxGetConfigApiUrl();
- var requestBody = buildWxGetConfigRequestBody(htmlUrl);
- console.log('[wx] htmlUrl=', htmlUrl);
- console.log('[wx] POST getWxConfig →', requestUrl, requestBody);
- return fetch(requestUrl, {
- method: 'POST',
- mode: 'cors',
- credentials: 'omit',
- headers: {
- Accept: 'application/json',
- 'Content-Type': 'application/json;charset=UTF-8'
- },
- body: JSON.stringify(requestBody)
- })
- .then(function (r) {
- if (r.ok) return r.json();
- return r
- .text()
- .catch(function () {
- return '';
- })
- .then(function (text) {
- var hint = '';
- try {
- var j = JSON.parse(text);
- hint = j.msg || j.message || '';
- } catch (eP) {
- if (text) hint = text.slice(0, 120);
- }
- throw new Error('getWxConfig HTTP ' + r.status + (hint ? ':' + hint : ''));
- });
- })
- .then(function (res) {
- if (res && res.code != null) {
- var c = Number(res.code);
- if (c !== 200 && c !== 0 && res.success !== true) {
- throw new Error(res.msg || res.message || 'getWxConfig code ' + c);
- }
- }
- var sign = normalizeWxJssdkSignPayload(res, htmlUrl);
- if (!sign) {
- console.warn('[wx] getWxConfig 响应字段不全', res, 'htmlUrl=', htmlUrl);
- throw new Error(
- 'getWxConfig 缺少 appId/timestamp/nonceStr/signature(见控制台)'
- );
- }
- if (sign.appId !== WECHAT_MP_APP_ID) {
- console.warn(
- '[wx] 后端 appId=' + sign.appId + ',期望服务号 ' + WECHAT_MP_APP_ID
- );
- }
- if (typeof wx === 'undefined') {
- if (isWxPcBrowser()) {
- console.log('[wx] PC getWxConfig 成功(无 jweixin)', sign);
- return true;
- }
- setWxInitError('jweixin.js 未加载');
- return false;
- }
- return applyWxConfigFromSign(sign, htmlUrl);
- });
- }
- function applyWxConfigFromSign(sign, htmlUrl) {
- var wxConfigParams = {
- debug: isWxDebugOn(),
- appId: String(sign.appId),
- timestamp: sign.timestamp,
- nonceStr: String(sign.nonceStr),
- signature: String(sign.signature),
- jsApiList: [],
- openTagList: ['wx-open-launch-app']
- };
- return new Promise(function (resolve) {
- if (isWxDebugOn()) {
- try {
- window.alert(
- 'htmlUrl:\n' +
- htmlUrl +
- '\n\nwx.config:\n' +
- JSON.stringify(wxConfigParams, null, 2)
- );
- } catch (alertErr) {}
- }
- wx.config(wxConfigParams);
- wx.ready(function () {
- weChatJssdkConfigured = true;
- document.body.classList.add('wx-jssdk-ready');
- refreshWxLaunchTagAttrs();
- console.log('[wx.config] ready, htmlUrl=', htmlUrl);
- resolve(true);
- });
- wx.error(function (err) {
- weChatJssdkConfigured = false;
- document.body.classList.remove('wx-jssdk-ready');
- wxJssdkInitPromise = null;
- var errMsg = getWxErrMsg(err);
- setWxInitError(formatWxConfigErrorTip(err, htmlUrl));
- if (isWxDebugOn()) window.alert(wxInitLastError);
- console.warn('[wx.config]', errMsg, 'htmlUrl=', htmlUrl);
- var baseUrl = getWxHtmlUrlBase();
- var fullUrl = getWxSignPageUrlForApi();
- if (
- !/invalid signature/i.test(errMsg) ||
- wxConfigSignRetriedBaseUrl ||
- baseUrl === fullUrl ||
- htmlUrl === baseUrl
- ) {
- resolve(false);
- return;
- }
- wxConfigSignRetriedBaseUrl = true;
- requestWeChatJssdkSignAndConfig(baseUrl).then(resolve);
- });
- });
- }
- function refreshWxLaunchTagAttrs() {
- var tag = document.getElementById('launch-btn');
- if (!tag) return;
- try {
- tag.setAttribute('appid', WECHAT_OPEN_APP_ID);
- tag.setAttribute('extinfo', buildWeChatLaunchExtinfo());
- } catch (eA) {}
- }
- function bindWeChatLaunchTagEvents() {
- var tag = document.getElementById('launch-btn');
- if (!tag || tag._wxLaunchBound) return;
- tag._wxLaunchBound = true;
- refreshWxLaunchTagAttrs();
- tag.addEventListener('launch', function () {
- console.log('[wx-open-launch-app] launch ok');
- // showFabToast('正在打开 U店在哪…');
- });
- tag.addEventListener('error', function (e) {
- var detail = e && e.detail;
- var errMsg =
- detail && detail.errMsg
- ? String(detail.errMsg)
- : detail && detail.errmsg
- ? String(detail.errmsg)
- : '';
- console.warn('[wx-open-launch-app]', detail);
- if (/launch:fail/i.test(errMsg) && !getWxShareEntryFrom()) {
- showAppOpenFailTip(
- '当前环境无法直接打开 App,请使用 App「分享到微信」后点分享卡片进入'
- );
- } else {
- showAppOpenFailTip(
- errMsg
- ? '未能打开 App:' + errMsg
- : '未能打开 App,请确认已安装最新版「U店在哪」'
- );
- }
- });
- }
- function initWeChatOpenLaunchApp(fromUserClick) {
- if (!shouldFetchWxConfig(!!fromUserClick)) {
- console.log('[wx] 未调用 getWxConfig');
- return Promise.resolve(false);
- }
- if (isWxPcBrowser()) {
- console.warn(
- '[wx] PC:请求 getWxConfig' + (fromUserClick ? '(按钮)' : '(进页)')
- );
- }
- if (wxJssdkInitPromise && !fromUserClick) return wxJssdkInitPromise;
- wxConfigSignRetriedBaseUrl = false;
- wxInitLastError = '';
- var htmlUrl = getWxConfigSignUrl();
- bindWeChatLaunchTagEvents();
- wxJssdkInitPromise = requestWeChatJssdkSignAndConfig(htmlUrl)
- .then(function (ok) {
- if (ok === true) return true;
- if (!wxInitLastError) {
- setWxInitError('wx.config 失败,可加 ?wxDebug=1 查看 htmlUrl');
- }
- return false;
- })
- .catch(function (e) {
- var msg = e && e.message ? e.message : 'getWxConfig 请求失败';
- setWxInitError(msg);
- console.warn('[wx] requestWeChatJssdkSignAndConfig failed', msg, 'htmlUrl=', htmlUrl);
- if (isWeChatInAppBrowser() && isWxDebugOn()) window.alert(msg);
- return false;
- })
- .finally(function () {
- if (!weChatJssdkConfigured) wxJssdkInitPromise = null;
- });
- return wxJssdkInitPromise;
- }
- /** 进页即尝试拉签名;jweixin 晚到时自动重试 */
- function scheduleWeChatJssdkBootstrap() {
- if (!shouldInitWeChatJssdkOnLoad()) return;
- var attempts = 0;
- function tick() {
- attempts += 1;
- if (weChatJssdkConfigured) return;
- initWeChatOpenLaunchApp();
- if (!weChatJssdkConfigured && attempts < 8 && typeof wx === 'undefined') {
- setTimeout(tick, 400);
- }
- }
- if (isIOSWeChatBrowser()) {
- setTimeout(tick, 350);
- } else {
- tick();
- }
- }
- function showFabToast(msg, ms) {
- var tip = String(msg || '').trim();
- if (!tip) return;
- var el = document.getElementById('openAppToast');
- if (el) {
- el.textContent = tip;
- el.style.display = 'block';
- if (showFabToast._t) clearTimeout(showFabToast._t);
- showFabToast._t = setTimeout(function () {
- el.style.display = 'none';
- }, ms || 2800);
- }
- console.log('[openApp]', tip);
- }
- function showAppOpenFailTip(msg) {
- var tip = msg || '未能打开 App,请确认已安装最新版「U店在哪」。';
- if (typeof uni !== 'undefined' && typeof uni.showToast === 'function') {
- uni.showToast({ title: tip, icon: 'none', duration: 2800 });
- } else if (isWeChatInAppBrowser()) {
- window.alert(tip);
- } else {
- console.warn('[openApp]', tip);
- }
- }
- /** 部分 WebView 对 location.href 拦截,用 a 标签点击略稳 */
- function launchAppDeepLink(deepLink) {
-
- try {
- var a = document.createElement('a');
- a.href = deepLink;
- a.setAttribute('target', '_self');
- document.body.appendChild(a);
- a.click();
- document.body.removeChild(a);
- } catch (e1) {}
- try {
- window.location.href = deepLink;
- } catch (e2) {}
- }
- /**
- * 有 plus:检测 App 是否安装后 openURL;深链形如 shopro://{APP_UNI_STORE_PATH}?…
- * 系统浏览器:唤起 scheme;微信内常拦截 scheme,需「在浏览器打开」。
- */
- function tryFetchWxConfigOnPcClick() {
- if (!isWxPcBrowser()) return Promise.resolve(false);
- showFabToast('正在请求 getWxConfig…');
- wxJssdkInitPromise = null;
- return initWeChatOpenLaunchApp(true).then(function (ok) {
- if (ok) {
- showFabToast(
- weChatJssdkConfigured
- ? 'getWxConfig 成功,wx.config 已就绪'
- : 'getWxConfig 成功'
- );
- } else {
- showFabToast(wxInitLastError || 'getWxConfig 失败');
- }
- return ok;
- });
- }
- function tryOpenHBuilderApp() {
- /* 微信内须直接点击 wx-open-launch-app,scheme 会被拦截 */
- if (isWeChatInAppBrowser()) return;
- tryFetchWxConfigOnPcClick().then(function () {
- if (isWxConfigOnClickDebug() && !isWxForceDebug() && !isWxPcAutoDebugHost()) {
- return;
- }
- tryOpenHBuilderAppViaScheme();
- });
- }
- function tryOpenHBuilderAppViaScheme() {
- // showFabToast('正在打开 U店在哪…');
- var deepLink = buildAppDeepLink();
- if (typeof plus !== 'undefined' && plus.runtime) {
- var installed = null;
- try {
- if (typeof plus.runtime.isApplicationExist === 'function') {
- installed = plus.runtime.isApplicationExist({
- pname: APP_ANDROID_PACKAGE,
- action: APP_IOS_URL_SCHEME
- });
- }
- } catch (e) {
- console.warn(e);
- }
- if (installed === false) {
- showDownloadTip();
- return;
- }
- try {
- plus.runtime.openURL(deepLink);
- } catch (e2) {
- console.warn(e2);
- showDownloadTip();
- }
- return;
- }
- var t0 = Date.now();
- var done = false;
- function finish() {
- if (done) return;
- done = true;
- document.removeEventListener('visibilitychange', onVis);
- window.removeEventListener('pagehide', onHide);
- }
- function onVis() {
- if (document.visibilityState === 'hidden') finish();
- }
- function onHide() {
- finish();
- }
- document.addEventListener('visibilitychange', onVis);
- window.addEventListener('pagehide', onHide);
- try {
- launchAppDeepLink(deepLink);
- } catch (e3) {
- finish();
- showDownloadTip();
- return;
- }
- window.setTimeout(function () {
- finish();
- }, 2600);
- }
- function qs() {
- return new URLSearchParams(location.search || '');
- }
- function q(name) {
- var v = qs().get(name);
- return v == null ? '' : String(v);
- }
- function showErr(msg) {
- var el = document.getElementById('pageError');
- el.textContent = msg;
- el.style.display = 'block';
- }
- function getStoreId() {
- return q('id') || q('storeId');
- }
- function shouldShowPerformanceSection() {
- return String(q('businessSection') || '').trim() === '2';
- }
- function apiFetch(path) {
- return fetch(API_BASE + path, {
- method: 'GET',
- mode: 'cors',
- credentials: 'omit',
- headers: { Accept: 'application/json' }
- }).then(function (res) {
- if (!res.ok) throw new Error('HTTP ' + res.status);
- return res.json();
- });
- }
- /** 进入页先拉店铺概要;与 shareDynamic.html fetchGetDeleteFlagByIdIfId 相同路径与 id 参数 */
- function fetchStoreInfoGetOne(storeId) {
- if (!storeId) return Promise.resolve(null);
- var qs = new URLSearchParams();
- qs.set('id', String(storeId).trim());
- return apiFetch('/store/info/getOne?' + qs.toString()).catch(function (e) {
- console.warn('[store/info/getOne]', e);
- return null;
- });
- }
- function isGetOneBusinessStatus99(res) {
- if (!res || typeof res !== 'object') return false;
- var d = res.data;
- if (d && typeof d === 'object') {
- var bs = d.businessStatus;
- if (bs === 99 || bs === '99' || Number(bs) === 99) return true;
- }
- return false;
- }
- var MARKETING_PREVIEW_COUNT = 3;
- var closedMerchantFlag = false;
- /** 关店 businessStatus=99:getOne 已置 closedMerchantFlag,或 URL 带 businessStatus=99;唤起 App 时进登录页 */
- function isClosedMerchantForAppOpen() {
- if (closedMerchantFlag) return true;
- var bs = String(q('businessStatus') || '').trim();
- if (bs === '99' || Number(bs) === 99) return true;
- return false;
- }
- var marketingListCache = [];
- /** 避免详情先返回时用空 cache 误展示「暂无活动」图 */
- var marketingCouponLoaded = false;
- var staffGroupsCache = [];
- var performanceListCache = { records: [], total: 0 };
- function isMp4VideoUrl(url) {
- if (!url || typeof url !== 'string') return false;
- var path = url.split(/[?#]/)[0].toLowerCase();
- return path.length >= 4 && path.slice(-4) === '.mp4';
- }
- function getMp4PlaybackUrl(url) {
- var u = String(url || '').trim();
- if (!u) return '';
- var q = u.indexOf('?');
- var h = u.indexOf('#');
- var cut = u.length;
- if (q >= 0) cut = Math.min(cut, q);
- if (h >= 0) cut = Math.min(cut, h);
- var base = u.slice(0, cut);
- if (/\.mp4$/i.test(base)) return base;
- return u;
- }
- function mp4UrlToJpgUrl(u) {
- var q = u.indexOf('?');
- var h = u.indexOf('#');
- var cut = u.length;
- if (q >= 0) cut = Math.min(cut, q);
- if (h >= 0) cut = Math.min(cut, h);
- var pathPart = u.slice(0, cut);
- var rest = u.slice(cut);
- if (!/\.mp4$/i.test(pathPart)) return '';
- return pathPart.slice(0, -4) + '.jpg' + rest;
- }
- function createMarketingMedia(url) {
- var wrap = document.createElement('div');
- wrap.className = 'marketing-card__media';
- var full = String(url == null ? '' : url).trim();
- if (!full) return wrap;
- if (isMp4VideoUrl(full)) {
- var playUrl = getMp4PlaybackUrl(full);
- var vid = document.createElement('video');
- vid.src = playUrl;
- vid.setAttribute('controls', '');
- vid.setAttribute('playsinline', '');
- vid.setAttribute('webkit-playsinline', '');
- vid.muted = true;
- vid.setAttribute('muted', '');
- vid.setAttribute('autoplay', '');
- vid.preload = 'auto';
- var poster = '';
- if (full.length > playUrl.length) poster = full;
- else poster = mp4UrlToJpgUrl(playUrl);
- if (poster) vid.setAttribute('poster', poster);
- vid.addEventListener('canplay', function onCap() {
- vid.removeEventListener('canplay', onCap);
- var p = vid.play();
- if (p && typeof p.catch === 'function') p.catch(function () {});
- });
- wrap.appendChild(vid);
- } else {
- var img = document.createElement('img');
- img.src = full;
- img.alt = '';
- img.decoding = 'async';
- wrap.appendChild(img);
- }
- return wrap;
- }
- function renderMarketingList(rawList) {
- marketingListCache = Array.isArray(rawList) ? rawList.slice() : [];
- var section = document.getElementById('shareMarketingSection');
- var listEl = document.getElementById('marketingListEl');
- var moreBtn = document.getElementById('marketingMoreBtn');
- var moreText = document.getElementById('marketingMoreText');
- if (!section || !listEl) return;
- listEl.innerHTML = '';
- section.classList.remove('is-expanded');
- if (moreBtn) {
- moreBtn.style.display = 'none';
- moreBtn.setAttribute('aria-expanded', 'false');
- }
- if (closedMerchantFlag) {
- section.style.display = 'none';
- section.setAttribute('aria-hidden', 'true');
- return;
- }
- var items = marketingListCache.filter(function (x) {
- return x && x.imgUrl && String(x.imgUrl).trim();
- }).filter(function (x) {
- var t = x.activityType;
- if (t == null || t === '') return true;
- return String(t).toUpperCase() === 'MARKETING';
- });
- items.sort(function (a, b) {
- var sa = Number(a.imgSort);
- var sb = Number(b.imgSort);
- if (isNaN(sa)) sa = 0;
- if (isNaN(sb)) sb = 0;
- return sa - sb;
- });
- if (!items.length) {
- if (!marketingCouponLoaded) {
- section.style.display = 'none';
- section.setAttribute('aria-hidden', 'true');
- return;
- }
- section.style.display = 'block';
- section.setAttribute('aria-hidden', 'false');
- var emptyWrap = document.createElement('div');
- emptyWrap.className = 'marketing-section__empty';
- emptyWrap.setAttribute('role', 'status');
- var emptyImg = document.createElement('img');
- emptyImg.src = 'images/empty.png';
- emptyImg.alt = '';
- emptyImg.decoding = 'async';
- var emptyLabel = document.createElement('p');
- emptyLabel.className = 'marketing-section__empty-label';
- emptyLabel.textContent = '暂无活动';
- emptyWrap.appendChild(emptyImg);
- emptyWrap.appendChild(emptyLabel);
- listEl.appendChild(emptyWrap);
- return;
- }
- section.style.display = 'block';
- section.setAttribute('aria-hidden', 'false');
- items.forEach(function (item, idx) {
- var card = document.createElement('article');
- card.className = 'marketing-card';
- if (idx >= MARKETING_PREVIEW_COUNT) card.classList.add('marketing-card--more');
- card.appendChild(createMarketingMedia(item.imgUrl));
- listEl.appendChild(card);
- });
- var extra = items.length - MARKETING_PREVIEW_COUNT;
- if (extra > 0 && moreBtn && moreText) {
- moreText.textContent = '查看剩余' + extra + '个活动';
- moreBtn.style.display = 'flex';
- }
- }
- function bindMarketingMore() {
- var section = document.getElementById('shareMarketingSection');
- var moreBtn = document.getElementById('marketingMoreBtn');
- if (!section || !moreBtn || moreBtn.dataset.bound) return;
- moreBtn.dataset.bound = '1';
- moreBtn.addEventListener('click', function () {
- section.classList.add('is-expanded');
- moreBtn.style.display = 'none';
- moreBtn.setAttribute('aria-expanded', 'true');
- });
- }
- function createStaffCardElement(staff) {
- var card = document.createElement('article');
- card.className = 'staff-card';
- var imgWrap = document.createElement('div');
- imgWrap.className = 'staff-card__img-wrap';
- var imgUrl = String(staff.staffImage || '').trim();
- if (imgUrl) {
- var img = document.createElement('img');
- img.src = imgUrl;
- img.alt = String(staff.name || '');
- img.decoding = 'async';
- img.loading = 'lazy';
- imgWrap.appendChild(img);
- }
- var likes = document.createElement('div');
- likes.className = 'staff-card__likes';
- var lc = staff.likeCount != null ? Number(staff.likeCount) : 0;
- if (isNaN(lc)) lc = 0;
- likes.textContent = lc + '人喜欢';
- imgWrap.appendChild(likes);
- var nameRow = document.createElement('div');
- nameRow.className = 'staff-card__name-row';
- var nameEl = document.createElement('span');
- nameEl.className = 'staff-card__name';
- nameEl.textContent = String(staff.name != null ? staff.name : '').trim() || '—';
- nameRow.appendChild(nameEl);
- var perf = staff.hasPerformanceToday;
- if (perf === true || perf === 1 || String(perf).toLowerCase() === 'true') {
- var badge = document.createElement('span');
- badge.className = 'staff-card__badge';
- badge.textContent = '今日演出';
- nameRow.appendChild(badge);
- }
- card.appendChild(imgWrap);
- card.appendChild(nameRow);
- var meta = document.createElement('div');
- meta.className = 'staff-card__meta';
- var pos = document.createElement('span');
- pos.className = 'staff-card__position';
- pos.textContent = String(staff.staffPosition || '').trim() || '\u00a0';
- meta.appendChild(pos);
- var pc = staff.positiveCommentsCount != null ? Number(staff.positiveCommentsCount) : 0;
- if (!isNaN(pc) && pc > 0) {
- var sep = document.createElement('span');
- sep.className = 'staff-card__sep';
- sep.textContent = '|';
- var rev = document.createElement('span');
- rev.className = 'staff-card__reviews';
- rev.textContent = '好评' + pc + '次';
- meta.appendChild(sep);
- meta.appendChild(rev);
- }
- card.appendChild(meta);
- return card;
- }
- function createPerformanceCardElement(row) {
- var card = document.createElement('article');
- card.className = 'performance-card';
- var posterWrap = document.createElement('div');
- posterWrap.className = 'performance-card__poster';
- var posterUrl = String(row.performancePoster || '').trim();
- if (posterUrl) {
- var img = document.createElement('img');
- img.src = posterUrl;
- img.alt = String(row.performanceName || '');
- img.decoding = 'async';
- img.loading = 'lazy';
- posterWrap.appendChild(img);
- }
- var body = document.createElement('div');
- body.className = 'performance-card__body';
- var nameEl = document.createElement('div');
- nameEl.className = 'performance-card__name';
- nameEl.textContent = String(row.performanceName != null ? row.performanceName : '').trim() || '—';
- body.appendChild(nameEl);
- var dr = String(row.dateRange || '').trim();
- if (dr) {
- var line1 = document.createElement('div');
- line1.className = 'performance-card__meta';
- line1.textContent = dr;
- body.appendChild(line1);
- }
- var si = String(row.scheduleInfo || '').trim();
- if (si) {
- var line2 = document.createElement('div');
- line2.className = 'performance-card__meta';
- line2.textContent = si;
- line2.title = si;
- body.appendChild(line2);
- }
- card.appendChild(posterWrap);
- card.appendChild(body);
- return card;
- }
- function renderPerformanceList() {
- var section = document.getElementById('sharePerformanceSection');
- var titleEl = document.getElementById('performanceSectionTitle');
- var strip = document.getElementById('performanceStripEl');
- if (!section || !titleEl || !strip) return;
- strip.innerHTML = '';
- if (!shouldShowPerformanceSection()) {
- section.style.display = 'none';
- section.setAttribute('aria-hidden', 'true');
- return;
- }
- if (closedMerchantFlag) {
- section.style.display = 'none';
- section.setAttribute('aria-hidden', 'true');
- return;
- }
- var records = performanceListCache.records;
- var total = performanceListCache.total;
- if (isNaN(total)) total = records.length;
- titleEl.textContent = '演出安排(' + total + ')';
- if (!records.length) {
- section.style.display = 'none';
- section.setAttribute('aria-hidden', 'true');
- return;
- }
- section.style.display = 'block';
- section.setAttribute('aria-hidden', 'false');
- records.forEach(function (row) {
- if (!row) return;
- strip.appendChild(createPerformanceCardElement(row));
- });
- }
- function renderStaffGroups(raw) {
- staffGroupsCache = Array.isArray(raw) ? raw.slice() : [];
- var section = document.getElementById('shareStaffSection');
- var mount = document.getElementById('staffGroupsMount');
- if (!section || !mount) return;
- var totalStaff = 0;
- staffGroupsCache.forEach(function (g) {
- if (g && Array.isArray(g.staffList)) totalStaff += g.staffList.length;
- });
- var countEl = document.getElementById('staffSectionCountEl');
- if (countEl) countEl.textContent = String(totalStaff);
- mount.innerHTML = '';
- if (closedMerchantFlag) {
- section.style.display = 'none';
- section.setAttribute('aria-hidden', 'true');
- return;
- }
- var groups = staffGroupsCache.filter(function (g) {
- return g && Array.isArray(g.staffList) && g.staffList.length;
- });
- if (!groups.length) {
- section.style.display = 'none';
- section.setAttribute('aria-hidden', 'true');
- return;
- }
- section.style.display = 'block';
- section.setAttribute('aria-hidden', 'false');
- groups.forEach(function (group) {
- var wrap = document.createElement('div');
- wrap.className = 'staff-group';
- if (group.titleId != null) wrap.dataset.titleId = String(group.titleId);
- var strip = document.createElement('div');
- strip.className = 'staff-strip';
- group.staffList.forEach(function (staff) {
- if (!staff) return;
- strip.appendChild(createStaffCardElement(staff));
- });
- wrap.appendChild(strip);
- mount.appendChild(wrap);
- });
- }
- function bindStaffSection() {
- var btn = document.getElementById('staffSectionAllBtn');
- if (!btn || btn.dataset.bound) return;
- btn.dataset.bound = '1';
- btn.addEventListener('click', function (e) {
- e.preventDefault();
- tryOpenHBuilderApp();
- });
- }
- function buildHeroSlides(urls) {
- var track = document.getElementById('heroTrack');
- var dotsWrap = document.getElementById('heroDots');
- track.innerHTML = '';
- dotsWrap.innerHTML = '';
- var list = (urls || []).filter(Boolean);
- if (!list.length) {
- var slide = document.createElement('div');
- slide.className = 'hero__slide';
- var img = document.createElement('img');
- img.src = 'images/hero.png';
- img.alt = '店铺';
- slide.appendChild(img);
- track.appendChild(slide);
- var dot = document.createElement('span');
- dot.className = 'hero__dot is-active';
- dotsWrap.appendChild(dot);
- return initHeroCarousel(1);
- }
- list.forEach(function (url, d) {
- var slide = document.createElement('div');
- slide.className = 'hero__slide';
- var img = document.createElement('img');
- img.src = url;
- img.alt = '店铺图';
- slide.appendChild(img);
- track.appendChild(slide);
- var dot = document.createElement('span');
- dot.className = 'hero__dot' + (d === 0 ? ' is-active' : '');
- dotsWrap.appendChild(dot);
- });
- initHeroCarousel(list.length);
- }
- var heroI = 0;
- var heroTimer = null;
- function initHeroCarousel(slides) {
- var track = document.getElementById('heroTrack');
- var dotsWrap = document.getElementById('heroDots');
- var dots = dotsWrap.querySelectorAll('.hero__dot');
- if (slides < 2) return;
- function go(n) {
- heroI = (n + slides) % slides;
- track.style.transform = 'translateX(' + (-heroI * 100) + '%)';
- dots.forEach(function (el, idx) {
- el.classList.toggle('is-active', idx === heroI);
- });
- }
- if (heroTimer) clearInterval(heroTimer);
- heroTimer = setInterval(function () { go(heroI + 1); }, 4000);
- var hero = document.getElementById('hero');
- var startX = 0;
- hero.addEventListener('touchstart', function (e) {
- startX = e.changedTouches[0].clientX;
- }, { passive: true });
- hero.addEventListener('touchend', function (e) {
- var dx = e.changedTouches[0].clientX - startX;
- if (Math.abs(dx) > 40) go(dx < 0 ? heroI + 1 : heroI - 1);
- }, { passive: true });
- }
- function timeToMinutes(t) {
- var parts = String(t || '').trim().split(':');
- var h = parseInt(parts[0], 10) || 0;
- var m = parseInt(parts[1], 10) || 0;
- return h * 60 + m;
- }
- function isTimeInRange(startTime, endTime) {
- var s = String(startTime || '').trim();
- var e = String(endTime || '').trim();
- if (s === '00:00' && e === '00:00') return true;
- if (s === '00:00' && e === '23:59') return true;
- var cur = new Date().getHours() * 60 + new Date().getMinutes();
- var sm = timeToMinutes(s);
- var em = timeToMinutes(e);
- if (em < sm) {
- return cur >= sm || cur <= em;
- }
- return cur >= sm && cur <= em;
- }
- function parseHolidayDate(str) {
- if (!str) return null;
- var d = new Date(String(str).trim().replace(/-/g, '/'));
- return isNaN(d.getTime()) ? null : d;
- }
- function isTodayInHolidayRange(holidayInfo) {
- if (!holidayInfo) return false;
- var hi = holidayInfo;
- if (typeof hi === 'string') {
- try {
- hi = JSON.parse(hi);
- } catch (err) {
- return false;
- }
- }
- var start = hi.startDate || hi.holidayStartDate || hi.beginDate || hi.start || hi.holidayStart;
- var end = hi.endDate || hi.holidayEndDate || hi.finishDate || hi.end || hi.holidayEnd;
- if (!start || !end) return false;
- var startD = parseHolidayDate(start);
- var endD = parseHolidayDate(end);
- if (!startD || !endD) return false;
- var today = new Date();
- today.setHours(0, 0, 0, 0);
- startD.setHours(0, 0, 0, 0);
- endD.setHours(0, 0, 0, 0);
- return today >= startD && today <= endD;
- }
- function findNormalBusinessInfo(list) {
- var wdJs = new Date().getDay();
- var i;
- var x;
- var w;
- for (i = 0; i < list.length; i++) {
- x = list[i];
- if (!x || x.holidayInfo) continue;
- w = x.weekDay != null ? x.weekDay : x.week;
- if (w === undefined || w === null) continue;
- if (Number(w) === wdJs) return x;
- }
- var wdMap = wdJs === 0 ? 7 : wdJs;
- for (i = 0; i < list.length; i++) {
- x = list[i];
- if (!x || x.holidayInfo) continue;
- w = x.weekDay != null ? x.weekDay : x.week;
- if (w === undefined || w === null) continue;
- if (Number(w) === wdMap) return x;
- }
- for (i = 0; i < list.length; i++) {
- x = list[i];
- if (x && !x.holidayInfo && (x.startTime || x.endTime)) return x;
- }
- return null;
- }
- /** 营业状态:暂停营业 | 商家暂未配置营业时间 | 休息中 | 营业中 xx:xx至xx:xx | 营业中 全天营业 */
- function computeBusinessStatusDisplay(d) {
- if (!d) return { text: '—', isOpen: false };
- if (Number(d.businessStatus) === 99) {
- return { text: '商户已关闭', isOpen: false };
- }
- if (Number(d.businessStatus) === 1) {
- return { text: '暂停营业', isOpen: false };
- }
- var list = d.storeBusinessInfoVos || d.storeBusinessInfos || [];
- if (!list.length) {
- return { text: '商家暂未配置营业时间', isOpen: false };
- }
- var holidayList = Array.isArray(d.holidayBusinessInfoList) && d.holidayBusinessInfoList.length
- ? d.holidayBusinessInfoList
- : list.filter(function (item) { return item && item.holidayInfo; });
- var todayHolidayItem = holidayList.find(function (item) {
- return isTodayInHolidayRange(item.holidayInfo);
- });
- var normal = d.normalBusinessInfo || d.normalBusinessInfoVo || findNormalBusinessInfo(list);
- var isOpen = false;
- var currentItem = null;
- if (todayHolidayItem) {
- isOpen = isTimeInRange(todayHolidayItem.startTime, todayHolidayItem.endTime);
- currentItem = todayHolidayItem;
- } else if (normal) {
- isOpen = isTimeInRange(normal.startTime, normal.endTime);
- currentItem = normal;
- }
- if (!currentItem) return { text: '休息中', isOpen: false };
- if (!isOpen) return { text: '休息中', isOpen: false };
- var st = String(currentItem.startTime || '').trim();
- var et = String(currentItem.endTime || '').trim();
- if (st === '00:00' && et === '00:00') return { text: '营业中 全天营业', isOpen: true };
- if (st === '00:00' && et === '23:59') return { text: '营业中 全天营业', isOpen: true };
- var needNextDay = timeToMinutes(et) < timeToMinutes(st);
- var suffix = (needNextDay ? '次日' : '') + et;
- return { text: ('营业中 ' + st + ' 至 ' + suffix).trim(), isOpen: true };
- }
- /**
- * 分项评分:可能在 storeEvaluate 对象内,或为 JSON 字符串;部分接口把字段放在详情根上。
- */
- function parseStoreEvaluateRaw(raw) {
- if (raw == null || raw === '') return null;
- if (typeof raw === 'string') {
- var t = raw.trim();
- if (!t) return null;
- try {
- raw = JSON.parse(t);
- } catch (e) {
- return null;
- }
- }
- if (Array.isArray(raw) && raw.length && raw[0] && typeof raw[0] === 'object') {
- raw = raw[0];
- }
- if (raw && typeof raw === 'object' && !Array.isArray(raw)) return raw;
- return null;
- }
- function getStoreEvaluateScores(d) {
- var ev = parseStoreEvaluateRaw(d.storeEvaluate)
- || parseStoreEvaluateRaw(d.evaluate)
- || parseStoreEvaluateRaw(d.evaluateInfo);
- function lane(key, snake) {
- var v;
- if (ev && ev[key] != null && ev[key] !== '') v = ev[key];
- else if (d[key] != null && d[key] !== '') v = d[key];
- else if (snake && d[snake] != null && d[snake] !== '') v = d[snake];
- else return null;
- var n = Number(v);
- return !isNaN(n) ? n : null;
- }
- return {
- scoreOne: lane('scoreOne', 'score_one'),
- scoreTwo: lane('scoreTwo', 'score_two'),
- scoreThree: lane('scoreThree', 'score_three')
- };
- }
- function fmtEvalScore(n) {
- return n != null && !isNaN(n) ? Number(n).toFixed(1) : null;
- }
- var CLOSED_REC_STAR_PATH =
- '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';
- function closedRecEscHtml(s) {
- return String(s == null ? '' : s)
- .replace(/&/g, '&')
- .replace(/</g, '<')
- .replace(/>/g, '>')
- .replace(/"/g, '"');
- }
- function closedRecStarsHtml(score) {
- var s = Number(score);
- if (isNaN(s)) s = 0;
- s = Math.max(0, Math.min(5, s));
- var rounded = Math.round(s);
- var parts = [];
- var i;
- for (i = 1; i <= 5; i++) {
- var fill = i <= rounded ? '#F58220' : '#E5E5E5';
- parts.push(
- '<svg class="closed-rec-star" width="11" height="11" viewBox="0 0 24 24" aria-hidden="true">' +
- '<path fill="' + fill + '" d="' + CLOSED_REC_STAR_PATH + '"/></svg>'
- );
- }
- return '<span class="closed-rec-stars">' + parts.join('') + '</span>';
- }
- function closedRecFormatDistance(item) {
- if (item.distance != null && item.distance !== '') {
- var km = Number(item.distance);
- if (!isNaN(km) && km >= 0) {
- return Math.round(km * 1000) + '米';
- }
- return String(item.distance).trim();
- }
- if (item.position != null && String(item.position).trim() !== '') {
- return String(item.position).trim();
- }
- if (item.dist != null && item.dist !== '') {
- var dn = Number(item.dist);
- if (!isNaN(dn)) {
- return dn >= 1 ? dn.toFixed(dn % 1 === 0 ? 0 : 1) + 'km' : Math.round(dn * 1000) + '米';
- }
- }
- return '';
- }
- function closedRecPickScore(item) {
- var x =
- item.scoreAvg != null ? Number(item.scoreAvg)
- : item.score != null ? Number(item.score)
- : item.rating != null ? Number(item.rating)
- : item.starScore != null ? Number(item.starScore)
- : NaN;
- return isNaN(x) ? null : x;
- }
- function closedRecPickReviewCount(item) {
- var n =
- item.commitCount != null ? Number(item.commitCount)
- : item.commentCount != null ? Number(item.commentCount)
- : item.reviewCount != null ? Number(item.reviewCount)
- : item.evaluateCount != null ? Number(item.evaluateCount)
- : NaN;
- return isNaN(n) ? 0 : Math.max(0, Math.floor(n));
- }
- function normalizeClosedStoreRecommendList(res) {
- if (!res || typeof res !== 'object') return [];
- var raw = res.data != null ? res.data : res.result;
- if (Array.isArray(raw)) return raw;
- if (raw && typeof raw === 'object') {
- if (Array.isArray(raw.list)) return raw.list;
- if (Array.isArray(raw.records)) return raw.records;
- if (Array.isArray(raw.rows)) return raw.rows;
- if (Array.isArray(raw.content)) return raw.content;
- if (Array.isArray(raw.stores)) return raw.stores;
- if (Array.isArray(raw.storeList)) return raw.storeList;
- if (Array.isArray(raw.storeVos)) return raw.storeVos;
- if (Array.isArray(raw.items)) return raw.items;
- }
- if (Array.isArray(res.list)) return res.list;
- if (Array.isArray(res.records)) return res.records;
- return [];
- }
- function fetchShareClosedStoreRecommend(storeIdStr) {
- var loc = getClosedRecommendUserLocation();
- var page = parseInt(q('page') || '1', 10);
- var pageSize = parseInt(q('pageSize') || '10', 10);
- if (isNaN(page) || page < 1) page = 1;
- if (isNaN(pageSize) || pageSize < 1) pageSize = 10;
- var body = {
- page: page,
- pageSize: pageSize,
- storeId: String(storeIdStr || ''),
- userCity: loc.userCity,
- userLat: loc.userLat,
- userLng: loc.userLng
- };
- return fetch(API_LIFE_AI_BASE + STORE_GLOBAL_RECOMMEND_PATH, {
- method: 'POST',
- mode: 'cors',
- credentials: 'omit',
- headers: {
- Accept: 'application/json',
- 'Content-Type': 'application/json;charset=UTF-8'
- },
- body: JSON.stringify(body)
- }).then(function (res) {
- if (!res.ok) throw new Error('HTTP ' + res.status);
- return res.json();
- });
- }
- function renderShareClosedRecommended(list) {
- var wrap = document.getElementById('shareClosedRecList');
- var empty = document.getElementById('shareClosedRecEmpty');
- if (!wrap || !empty) return;
- wrap.querySelectorAll('.closed-rec-card').forEach(function (n) {
- n.remove();
- });
- if (!list || !list.length) {
- empty.style.display = 'block';
- return;
- }
- empty.style.display = 'none';
- list.forEach(function (item) {
- if (!item || typeof item !== 'object') return;
- var imgUrlField = item.imgUrl != null ? String(item.imgUrl).trim() : '';
- var home = item.homeImage != null ? String(item.homeImage).trim() : '';
- if (home && /\.mp4(\?|#|$)/i.test(home)) {
- var vf = item.videoFirstFrame != null ? String(item.videoFirstFrame).trim() : '';
- if (vf) home = vf;
- }
- var imgUrl =
- imgUrlField ||
- home ||
- (item.coverUrl != null ? String(item.coverUrl).trim() : '') ||
- (item.mainImage != null ? String(item.mainImage).trim() : '') ||
- (item.goodsImage != null ? String(item.goodsImage).trim() : '') ||
- (item.entranceImage != null ? String(item.entranceImage).trim() : '') ||
- (Array.isArray(item.goodsImageList) && item.goodsImageList[0]) ||
- (Array.isArray(item.imageList) && item.imageList[0]) ||
- (Array.isArray(item.storeAlbumUrlList) && item.storeAlbumUrlList[0]) ||
- '';
- var name = item.title != null && String(item.title).trim() !== ''
- ? String(item.title).replace(/\r?\n/g, ' ').replace(/\s+/g, ' ').trim()
- : (item.storeName || item.goodsName || item.secondGoodsTitle || item.name || '推荐');
- var dist = closedRecFormatDistance(item);
- var scoreVal = closedRecPickScore(item);
- var displayScore = scoreVal != null ? scoreVal.toFixed(1) : '—';
- var starScore = scoreVal != null ? scoreVal : 0;
- var rc = closedRecPickReviewCount(item);
- var reviewLabel = rc > 0 ? rc + '条评价' : '';
- var seller =
- item.userName != null && String(item.userName).trim() !== ''
- ? String(item.userName).trim()
- : (item.nickName != null && String(item.nickName).trim() !== ''
- ? String(item.nickName).trim()
- : '');
- var card = document.createElement('article');
- card.className = 'closed-rec-card';
- card.innerHTML =
- '<div class="closed-rec-card__img"><img class="closed-rec-card__cover" src="" alt="" decoding="async"></div>' +
- '<div class="closed-rec-card__body">' +
- '<div class="closed-rec-card__top">' +
- '<span class="closed-rec-card__name">' + closedRecEscHtml(name) + '</span>' +
- (dist ? '<span class="closed-rec-card__dist">' + closedRecEscHtml(dist) + '</span>' : '') +
- '</div>' +
- '<div class="closed-rec-card__rating">' +
- closedRecStarsHtml(starScore) +
- '<span class="closed-rec-rating-num">' + closedRecEscHtml(displayScore) + '</span>' +
- (reviewLabel ? '<span class="closed-rec-meta">' + closedRecEscHtml(reviewLabel) + '</span>' : '') +
- '</div>' +
- (seller ? '<div class="closed-rec-card__footer">' + closedRecEscHtml(seller) + '</div>' : '') +
- '</div>';
- var coverIm = card.querySelector('img.closed-rec-card__cover');
- if (coverIm) {
- coverIm.src = imgUrl;
- coverIm.onerror = function () {
- this.onerror = null;
- this.src = '';
- };
- }
- wrap.appendChild(card);
- });
- }
- function loadShareClosedRecommendations() {
- var sid = getStoreId();
- if (!sid) {
- renderShareClosedRecommended([]);
- return;
- }
- fetchShareClosedStoreRecommend(sid)
- .then(function (res) {
- var list = normalizeClosedStoreRecommendList(res);
- if (!list.length && res && res.msg) {
- console.warn('[store-recommend]', res.msg);
- }
- renderShareClosedRecommended(list);
- })
- .catch(function (e) {
- console.error(e);
- renderShareClosedRecommended([]);
- });
- }
- function applyShareIndexClosedMerchantUi(closed) {
- var wasClosed = closedMerchantFlag;
- closedMerchantFlag = closed;
- if (wasClosed !== closed && weChatJssdkConfigured) {
- refreshWxLaunchTagAttrs();
- }
- var banner = document.getElementById('shareClosedBanner');
- var contentEl = document.getElementById('shareContentEl');
- var belowEl = document.getElementById('shareBelowContentEl');
- var recWrap = document.getElementById('shareClosedRecommendWrap');
- if (banner) {
- banner.style.display = closed ? 'block' : 'none';
- banner.setAttribute('aria-hidden', closed ? 'false' : 'true');
- }
- if (contentEl) {
- contentEl.style.display = closed ? 'none' : '';
- contentEl.setAttribute('aria-hidden', closed ? 'true' : 'false');
- }
- if (belowEl) {
- belowEl.style.display = '';
- belowEl.setAttribute('aria-hidden', 'false');
- }
- if (recWrap) {
- if (closed) {
- recWrap.style.display = 'block';
- recWrap.setAttribute('aria-hidden', 'false');
- if (!wasClosed) {
- loadShareClosedRecommendations();
- }
- } else {
- recWrap.style.display = 'none';
- recWrap.setAttribute('aria-hidden', 'true');
- renderShareClosedRecommended([]);
- }
- }
- }
- function renderDetail(d) {
- if (!d) return;
- appLaunchDetailCache = d;
- if (weChatJssdkConfigured) refreshWxLaunchTagAttrs();
- document.getElementById('storeName').textContent = d.storeName || '—';
- var score = d.scoreAvg != null ? Number(d.scoreAvg) : NaN;
- document.getElementById('scoreAvg').textContent = !isNaN(score) ? score.toFixed(1) : '—';
- document.getElementById('commitCount').textContent = d.commitCount != null ? String(d.commitCount)+'条' : '0';
- var evRow = document.getElementById('storeEvaluateRow');
- var evOne = document.getElementById('storeEvaluateScoreOne');
- var evTwo = document.getElementById('storeEvaluateScoreTwo');
- var evThree = document.getElementById('storeEvaluateScoreThree');
- if (evRow && evOne && evTwo && evThree) {
- evRow.classList.remove('is-visible');
- evRow.setAttribute('aria-hidden', 'true');
- var es = getStoreEvaluateScores(d);
- var a = fmtEvalScore(es.scoreOne);
- var b = fmtEvalScore(es.scoreTwo);
- var c = fmtEvalScore(es.scoreThree);
- if (a !== null || b !== null || c !== null) {
- evOne.textContent = a !== null ? a : '—';
- evTwo.textContent = b !== null ? b : '—';
- evThree.textContent = c !== null ? c : '—';
- evRow.classList.add('is-visible');
- evRow.setAttribute('aria-hidden', 'false');
- }
- }
- var bizDisp = computeBusinessStatusDisplay(d);
- var bizEl = document.getElementById('bizStatus');
- bizEl.textContent = bizDisp.text;
- bizEl.className = 'status' + (bizDisp.isOpen ? ' is-open' : '');
- document.getElementById('hoursText').textContent = '';
- document.getElementById('storeAddr').textContent = d.queryAddress || d.storeAddress || '—';
- if (d.distance != null) {
- document.getElementById('metaDistance').style.display = 'flex';
- document.getElementById('distanceText').textContent =
- '距您' + (Number(d.distance) > 1 ? d.distance + '千米' : Math.round(Number(d.distance) * 1000) + '米');
- }
- if (d.subwayName && d.distance2 != null) {
- document.getElementById('metaSubway').style.display = 'flex';
- document.getElementById('subwayText').textContent =
- '距' + d.subwayName + '步行' + (Number(d.distance2) >= 1000
- ? (Number(d.distance2) / 1000).toFixed(1) + 'km'
- : Math.round(Number(d.distance2)) + 'm');
- }
- var imgs = [];
- if (Array.isArray(d.storeAlbumUrlList) && d.storeAlbumUrlList.length) imgs = d.storeAlbumUrlList.slice();
- else if (d.entranceImage) imgs = [d.entranceImage];
- buildHeroSlides(imgs);
- var closedMerchant = Number(d.businessStatus) === 99;
- applyShareIndexClosedMerchantUi(closedMerchant);
- renderMarketingList(marketingListCache);
- renderPerformanceList();
- renderStaffGroups(staffGroupsCache);
- }
- function getLngForApi() {
- var v = q('jingdu');
- if (v) return v;
- return q('lon') || q('lng') || q('longitude');
- }
- function getLatForApi() {
- var v = q('weidu');
- if (v) return v;
- return q('lat') || q('latitude');
- }
- function mergeSearchAndHashParamsForRedirect() {
- var params = new URLSearchParams();
- function ingest(slice) {
- if (!slice) return;
- var p = new URLSearchParams(slice);
- p.forEach(function (val, key) {
- params.set(key, val);
- });
- }
- if (location.search && location.search.length > 1) {
- ingest(location.search.slice(1));
- }
- var hash = location.hash || '';
- var qi = hash.indexOf('?');
- if (qi >= 0) {
- ingest(hash.slice(qi + 1));
- }
- return params;
- }
- /** getClientStoreDetail 无承载数据时进 shareCheckInUndefined(businessStatus=99 与落地页约定一致) */
- function buildShareCheckInUndefinedRedirectHref() {
- var p = mergeSearchAndHashParamsForRedirect();
- p.set('businessStatus', '99');
- var sid = getStoreId();
- if (sid && !p.has('storeId')) {
- p.set('storeId', sid);
- }
- var j = getLngForApi();
- var w = getLatForApi();
- if (j && !p.has('userLng')) {
- p.set('userLng', j);
- }
- if (w && !p.has('userLat')) {
- p.set('userLat', w);
- }
- var qs = p.toString();
- return 'shareCheckInUndefined.html' + (qs ? ('?' + qs) : '?businessStatus=99');
- }
- function run() {
- var sid = getStoreId();
- var userId = q('userId');
- var jingdu = getLngForApi();
- var weidu = getLatForApi();
- if (!sid) {
- showErr('缺少店铺 id(请从 App 分享链接打开,URL 需带 id 或 storeId)');
- document.getElementById('storeName').textContent = '参数错误';
- return;
- }
- var detailPath = '/store/info/getClientStoreDetail?' +
- 'id=' + encodeURIComponent(sid) +
- '&userId=' + encodeURIComponent(userId) +
- '&jingdu=' + encodeURIComponent(jingdu) +
- '&weidu=' + encodeURIComponent(weidu);
- fetchStoreInfoGetOne(sid).then(function (getOneRes) {
- if (isGetOneBusinessStatus99(getOneRes)) {
- applyShareIndexClosedMerchantUi(true);
- }
- apiFetch(detailPath)
- .then(function (res) {
- var tip = res && res.msg != null ? String(res.msg).trim() : '';
- if (tip === '暂无承载数据') {
- if (closedMerchantFlag) {
- return;
- }
- window.location.replace(buildShareCheckInUndefinedRedirectHref());
- return;
- }
- if (res.code !== 200 || !res.data) {
- showErr(res.msg || '店铺详情加载失败');
- return;
- }
- renderDetail(res.data);
- })
- .catch(function (e) {
- console.error(e);
- showErr('店铺详情请求失败(若为 file:// 打开,请检查 CORS 或改用 http 访问本页)');
- });
- var couponPath = '/store/info/getStoreCouponList?storeId=' + encodeURIComponent(sid);
- marketingCouponLoaded = false;
- apiFetch(couponPath)
- .then(function (res) {
- marketingCouponLoaded = true;
- var list = (res && res.code === 200 && res.data && res.data.marketingList) || [];
- if (!Array.isArray(list)) list = [];
- renderMarketingList(list);
- })
- .catch(function (e) {
- marketingCouponLoaded = true;
- console.warn('[getStoreCouponList]', e);
- renderMarketingList([]);
- });
- if (shouldShowPerformanceSection()) {
- var perfPath = '/performance/list/query?storeId=' + encodeURIComponent(sid) + '&page=1&size=100';
- apiFetch(perfPath)
- .then(function (res) {
- var d = (res && res.code === 200 && res.data) || null;
- if (!d || typeof d !== 'object') {
- performanceListCache.records = [];
- performanceListCache.total = 0;
- } else {
- performanceListCache.records = Array.isArray(d.records) ? d.records.slice() : [];
- var pt = d.total;
- performanceListCache.total = pt != null && !isNaN(Number(pt))
- ? Number(pt)
- : performanceListCache.records.length;
- }
- renderPerformanceList();
- })
- .catch(function (e) {
- console.warn('[performance/list/query]', e);
- performanceListCache.records = [];
- performanceListCache.total = 0;
- renderPerformanceList();
- });
- } else {
- performanceListCache.records = [];
- performanceListCache.total = 0;
- renderPerformanceList();
- }
- var staffPath = '/storeStaffConfig/queryStaffListByTitle?storeId=' + encodeURIComponent(sid);
- apiFetch(staffPath)
- .then(function (res) {
- var arr = (res && res.code === 200 && res.data) || [];
- if (!Array.isArray(arr)) arr = [];
- renderStaffGroups(arr);
- })
- .catch(function (e) {
- console.warn('[queryStaffListByTitle]', e);
- renderStaffGroups([]);
- });
- });
- }
- function boot() {
- var launchTag = document.getElementById('launch-btn');
- if (launchTag) launchTag.setAttribute('appid', WECHAT_OPEN_APP_ID);
- bindWeChatLaunchTagEvents();
- if (isWeChatInAppBrowser()) {
- document.body.classList.add('is-wechat');
- logWxEntryDiagnostics();
- }
- if (shouldInitWeChatJssdkOnLoad()) {
- if (isWxPcBrowser() && (isWxForceDebug() || isWxPcAutoDebugHost())) {
- document.body.classList.add('wx-pc-debug');
- }
- scheduleWeChatJssdkBootstrap();
- }
- document.addEventListener('WeixinOpenTagsError', function (e) {
- console.warn('[WeixinOpenTagsError]', e && e.detail);
- });
- if (isWeChatInAppBrowser()) {
- var openBtnWx = document.getElementById('openApp');
- if (openBtnWx) {
- openBtnWx.addEventListener('click', function () {
- if (!weChatJssdkConfigured) {
- showFabToast(
- wxInitLastError || '微信 SDK 初始化中,请稍候再点底部按钮'
- );
- }
- });
- }
- } else {
- var openBtn = document.getElementById('openApp');
- if (openBtn) openBtn.addEventListener('click', tryOpenHBuilderApp);
- }
- run();
- bindMarketingMore();
- bindStaffSection();
- }
- if (document.readyState === 'complete') {
- boot();
- } else {
- window.onload = boot;
- }
- })();
- </script>
- </body>
- </html>
|