index.vue 163 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008200920102011201220132014201520162017201820192020202120222023202420252026202720282029203020312032203320342035203620372038203920402041204220432044204520462047204820492050205120522053205420552056205720582059206020612062206320642065206620672068206920702071207220732074207520762077207820792080208120822083208420852086208720882089209020912092209320942095209620972098209921002101210221032104210521062107210821092110211121122113211421152116211721182119212021212122212321242125212621272128212921302131213221332134213521362137213821392140214121422143214421452146214721482149215021512152215321542155215621572158215921602161216221632164216521662167216821692170217121722173217421752176217721782179218021812182218321842185218621872188218921902191219221932194219521962197219821992200220122022203220422052206220722082209221022112212221322142215221622172218221922202221222222232224222522262227222822292230223122322233223422352236223722382239224022412242224322442245224622472248224922502251225222532254225522562257225822592260226122622263226422652266226722682269227022712272227322742275227622772278227922802281228222832284228522862287228822892290229122922293229422952296229722982299230023012302230323042305230623072308230923102311231223132314231523162317231823192320232123222323232423252326232723282329233023312332233323342335233623372338233923402341234223432344234523462347234823492350235123522353235423552356235723582359236023612362236323642365236623672368236923702371237223732374237523762377237823792380238123822383238423852386238723882389239023912392239323942395239623972398239924002401240224032404240524062407240824092410241124122413241424152416241724182419242024212422242324242425242624272428242924302431243224332434243524362437243824392440244124422443244424452446244724482449245024512452245324542455245624572458245924602461246224632464246524662467246824692470247124722473247424752476247724782479248024812482248324842485248624872488248924902491249224932494249524962497249824992500250125022503250425052506250725082509251025112512251325142515251625172518251925202521252225232524252525262527252825292530253125322533253425352536253725382539254025412542254325442545254625472548254925502551255225532554255525562557255825592560256125622563256425652566256725682569257025712572257325742575257625772578257925802581258225832584258525862587258825892590259125922593259425952596259725982599260026012602260326042605260626072608260926102611261226132614261526162617261826192620262126222623262426252626262726282629263026312632263326342635263626372638263926402641264226432644264526462647264826492650265126522653265426552656265726582659266026612662266326642665266626672668266926702671267226732674267526762677267826792680268126822683268426852686268726882689269026912692269326942695269626972698269927002701270227032704270527062707270827092710271127122713271427152716271727182719272027212722272327242725272627272728272927302731273227332734273527362737273827392740274127422743274427452746274727482749275027512752275327542755275627572758275927602761276227632764276527662767276827692770277127722773277427752776277727782779278027812782278327842785278627872788278927902791279227932794279527962797279827992800280128022803280428052806280728082809281028112812281328142815281628172818281928202821282228232824282528262827282828292830283128322833283428352836283728382839284028412842284328442845284628472848284928502851285228532854285528562857285828592860286128622863286428652866286728682869287028712872287328742875287628772878287928802881288228832884288528862887288828892890289128922893289428952896289728982899290029012902290329042905290629072908290929102911291229132914291529162917291829192920292129222923292429252926292729282929293029312932293329342935293629372938293929402941294229432944294529462947294829492950295129522953295429552956295729582959296029612962296329642965296629672968296929702971297229732974297529762977297829792980298129822983298429852986298729882989299029912992299329942995299629972998299930003001300230033004300530063007300830093010301130123013301430153016301730183019302030213022302330243025302630273028302930303031303230333034303530363037303830393040304130423043304430453046304730483049305030513052305330543055305630573058305930603061306230633064306530663067306830693070307130723073307430753076307730783079308030813082308330843085308630873088308930903091309230933094309530963097309830993100310131023103310431053106310731083109311031113112311331143115311631173118311931203121312231233124312531263127312831293130313131323133313431353136313731383139314031413142314331443145314631473148314931503151315231533154315531563157315831593160316131623163316431653166316731683169317031713172317331743175317631773178317931803181318231833184318531863187318831893190319131923193319431953196319731983199320032013202320332043205320632073208320932103211321232133214321532163217321832193220322132223223322432253226322732283229323032313232323332343235323632373238323932403241324232433244324532463247324832493250325132523253325432553256325732583259326032613262326332643265326632673268326932703271327232733274327532763277327832793280328132823283328432853286328732883289329032913292329332943295329632973298329933003301330233033304330533063307330833093310331133123313331433153316331733183319332033213322332333243325332633273328332933303331333233333334333533363337333833393340334133423343334433453346334733483349335033513352335333543355335633573358335933603361336233633364336533663367336833693370337133723373337433753376337733783379338033813382338333843385338633873388338933903391339233933394339533963397339833993400340134023403340434053406340734083409341034113412341334143415341634173418341934203421342234233424342534263427342834293430343134323433343434353436343734383439344034413442344334443445344634473448344934503451345234533454345534563457345834593460346134623463346434653466346734683469347034713472347334743475347634773478347934803481348234833484348534863487348834893490349134923493349434953496349734983499350035013502350335043505350635073508350935103511351235133514351535163517351835193520352135223523352435253526352735283529353035313532353335343535353635373538353935403541354235433544354535463547354835493550355135523553355435553556355735583559356035613562356335643565356635673568356935703571357235733574357535763577357835793580358135823583358435853586358735883589359035913592359335943595359635973598359936003601360236033604360536063607360836093610361136123613361436153616361736183619362036213622362336243625362636273628362936303631363236333634363536363637363836393640364136423643364436453646364736483649365036513652365336543655365636573658365936603661366236633664366536663667366836693670367136723673367436753676367736783679368036813682368336843685368636873688368936903691369236933694369536963697369836993700370137023703370437053706370737083709371037113712371337143715371637173718371937203721372237233724372537263727372837293730373137323733373437353736373737383739374037413742374337443745374637473748374937503751375237533754375537563757375837593760376137623763376437653766376737683769377037713772377337743775377637773778377937803781378237833784378537863787378837893790379137923793379437953796379737983799380038013802380338043805380638073808380938103811381238133814381538163817381838193820382138223823382438253826382738283829383038313832383338343835383638373838383938403841384238433844384538463847384838493850385138523853385438553856385738583859386038613862386338643865386638673868386938703871387238733874387538763877387838793880388138823883388438853886388738883889389038913892389338943895389638973898389939003901390239033904390539063907390839093910391139123913391439153916391739183919392039213922392339243925392639273928392939303931393239333934393539363937393839393940394139423943394439453946394739483949395039513952395339543955395639573958395939603961396239633964396539663967396839693970397139723973397439753976397739783979398039813982398339843985398639873988398939903991399239933994399539963997399839994000400140024003400440054006400740084009401040114012401340144015401640174018401940204021402240234024402540264027402840294030403140324033403440354036403740384039404040414042404340444045404640474048404940504051405240534054405540564057405840594060406140624063406440654066406740684069407040714072407340744075407640774078407940804081408240834084408540864087408840894090409140924093409440954096409740984099410041014102410341044105410641074108410941104111411241134114411541164117411841194120412141224123412441254126412741284129413041314132413341344135413641374138413941404141414241434144414541464147414841494150415141524153415441554156415741584159416041614162416341644165416641674168416941704171417241734174417541764177417841794180418141824183418441854186418741884189419041914192419341944195419641974198419942004201420242034204420542064207420842094210421142124213421442154216421742184219422042214222422342244225422642274228422942304231423242334234423542364237423842394240424142424243424442454246424742484249425042514252425342544255425642574258425942604261426242634264426542664267426842694270427142724273427442754276427742784279428042814282428342844285428642874288428942904291429242934294429542964297429842994300430143024303430443054306430743084309431043114312431343144315431643174318431943204321432243234324432543264327432843294330433143324333433443354336433743384339434043414342434343444345434643474348434943504351435243534354435543564357435843594360436143624363436443654366436743684369437043714372437343744375437643774378437943804381438243834384438543864387438843894390439143924393439443954396439743984399440044014402440344044405440644074408440944104411441244134414441544164417441844194420442144224423442444254426442744284429443044314432443344344435443644374438443944404441444244434444444544464447444844494450445144524453445444554456445744584459446044614462446344644465446644674468446944704471447244734474447544764477447844794480448144824483448444854486448744884489449044914492449344944495449644974498449945004501450245034504450545064507450845094510451145124513451445154516451745184519452045214522452345244525452645274528452945304531453245334534453545364537453845394540454145424543454445454546454745484549455045514552455345544555455645574558455945604561456245634564456545664567456845694570457145724573457445754576457745784579458045814582458345844585458645874588458945904591459245934594459545964597459845994600460146024603460446054606460746084609461046114612461346144615461646174618461946204621462246234624462546264627462846294630463146324633463446354636463746384639464046414642464346444645464646474648464946504651465246534654465546564657465846594660466146624663466446654666466746684669467046714672467346744675467646774678467946804681468246834684468546864687468846894690469146924693469446954696469746984699470047014702470347044705470647074708470947104711471247134714471547164717471847194720472147224723472447254726472747284729473047314732473347344735473647374738473947404741474247434744474547464747474847494750475147524753475447554756475747584759476047614762476347644765476647674768476947704771477247734774477547764777477847794780478147824783478447854786478747884789479047914792479347944795479647974798479948004801480248034804480548064807480848094810481148124813481448154816481748184819482048214822482348244825482648274828482948304831483248334834483548364837483848394840484148424843484448454846484748484849485048514852485348544855485648574858485948604861486248634864486548664867486848694870487148724873487448754876487748784879488048814882488348844885488648874888488948904891489248934894489548964897489848994900490149024903490449054906490749084909491049114912491349144915491649174918491949204921492249234924492549264927492849294930493149324933493449354936493749384939494049414942494349444945494649474948494949504951495249534954495549564957495849594960496149624963496449654966496749684969497049714972497349744975497649774978497949804981498249834984498549864987498849894990499149924993499449954996499749984999500050015002500350045005500650075008500950105011501250135014501550165017501850195020502150225023502450255026502750285029503050315032503350345035503650375038503950405041504250435044504550465047504850495050505150525053505450555056505750585059506050615062506350645065506650675068506950705071507250735074507550765077507850795080508150825083508450855086508750885089509050915092509350945095509650975098509951005101510251035104510551065107510851095110511151125113511451155116511751185119512051215122512351245125512651275128512951305131513251335134513551365137513851395140514151425143514451455146514751485149515051515152515351545155515651575158515951605161516251635164516551665167516851695170517151725173517451755176517751785179518051815182518351845185518651875188518951905191519251935194519551965197519851995200520152025203520452055206520752085209521052115212521352145215521652175218521952205221522252235224522552265227522852295230523152325233523452355236523752385239524052415242524352445245524652475248524952505251525252535254525552565257525852595260526152625263526452655266526752685269527052715272527352745275527652775278527952805281528252835284528552865287528852895290529152925293529452955296529752985299530053015302530353045305530653075308530953105311531253135314531553165317531853195320532153225323532453255326532753285329533053315332533353345335533653375338533953405341534253435344534553465347534853495350535153525353535453555356535753585359536053615362536353645365536653675368536953705371537253735374537553765377537853795380538153825383538453855386538753885389539053915392539353945395539653975398539954005401540254035404540554065407540854095410541154125413541454155416541754185419542054215422542354245425542654275428542954305431543254335434543554365437543854395440544154425443544454455446544754485449545054515452545354545455545654575458545954605461546254635464
  1. <template>
  2. <div class="parameter-settings">
  3. <!-- 顶部二级菜单 -->
  4. <div class="sub-tabs">
  5. <div
  6. v-for="tab in subTabs"
  7. :key="tab.value"
  8. :class="['sub-tab-item', { active: activeSubTab === tab.value }]"
  9. @click="activeSubTab = tab.value"
  10. >
  11. {{ tab.label }}
  12. </div>
  13. </div>
  14. <!-- 内容区域 -->
  15. <div class="content-body">
  16. <!-- 搜索栏编辑区 -->
  17. <div v-if="activeSubTab === 'search'" class="search-editor">
  18. <!-- 实时预览区 (参照图1) -->
  19. <div class="preview-section">
  20. <div class="preview-title">实时预览</div>
  21. <div class="live-preview-box">
  22. <div class="search-bar-mockup">
  23. <!-- 左侧标题 -->
  24. <div class="mockup-left">
  25. <div class="main-title" :style="{ color: form.themeColor }">{{ form.mainTitle }}</div>
  26. <div class="sub-title">{{ form.subTitle }}</div>
  27. </div>
  28. <!-- 中间搜索框 -->
  29. <div class="mockup-center" :style="{ '--theme-color': form.themeColor }">
  30. <div class="search-input-wrapper" :style="{ borderColor: form.themeColor }">
  31. <div class="placeholder-scroll">
  32. <transition-group name="list-scroll" tag="div" class="scroll-container">
  33. <div v-for="(text, index) in searchPlaceholderList" :key="text" v-show="index === currentPlaceholderIndex" class="scroll-item">
  34. {{ text }}
  35. </div>
  36. </transition-group>
  37. </div>
  38. <div class="search-btn" :style="{ backgroundColor: form.themeColor }">搜 索</div>
  39. </div>
  40. <div class="hot-words">
  41. <span v-for="item in form.hotWordsList" :key="item.name" class="hot-word">{{ item.name }}</span>
  42. </div>
  43. </div>
  44. <!-- 右侧功能按钮 (可配置) -->
  45. <div class="mockup-right">
  46. <div class="cart-btn" :style="{ borderColor: form.themeColor, color: form.themeColor }">
  47. <img v-if="form.rightBtnIcon" :src="form.rightBtnIcon" style="width: 16px; height: 16px; margin-right: 4px; object-fit: contain" />
  48. <span v-if="form.rightBtnText">{{ form.rightBtnText }}</span>
  49. <span v-else-if="!form.rightBtnIcon">购物车</span>
  50. </div>
  51. </div>
  52. </div>
  53. </div>
  54. </div>
  55. <!-- 配置项表单 -->
  56. <div class="settings-section">
  57. <el-form :model="form" label-width="120px" label-position="left">
  58. <el-form-item label="主标题:">
  59. <el-input v-model="form.mainTitle" placeholder="如:优易企业购" class="settings-input" />
  60. </el-form-item>
  61. <el-form-item label="副标题:">
  62. <el-input v-model="form.subTitle" placeholder="如:省钱 · 省心 · 省时间" class="settings-input" />
  63. </el-form-item>
  64. <el-form-item label="搜索框文字:">
  65. <el-input v-model="form.placeholderText" placeholder="支持输入多个,请用英文逗号(,)隔开实现上下滚动效果" class="settings-input" />
  66. </el-form-item>
  67. <el-form-item label="搜索热词:">
  68. <div class="hot-words-config">
  69. <div v-for="(item, index) in form.hotWordsList" :key="index" class="hot-word-row">
  70. <el-input v-model="item.name" placeholder="热词名称" class="hot-word-input-name" />
  71. <el-input v-model="item.link" placeholder="跳转地址" class="hot-word-input-link" />
  72. <el-button type="danger" icon="Delete" circle plain size="small" @click="removeHotWord(index)" />
  73. </div>
  74. <el-button type="primary" icon="Plus" link @click="addHotWord" class="add-hotword-btn">添加热词</el-button>
  75. </div>
  76. </el-form-item>
  77. <el-form-item label="按钮图标:">
  78. <div class="upload-placeholder-square" @click="triggerUpload('rightBtnIcon')">
  79. <img v-if="form.rightBtnIcon" :src="form.rightBtnIcon" class="form-preview-img-square" style="width: 24px; height: 24px" />
  80. <el-icon v-else class="upload-icon"><Plus /></el-icon>
  81. </div>
  82. <div class="field-tip">建议尺寸: 32*32, 格式: PNG/SVG</div>
  83. </el-form-item>
  84. <el-form-item label="按钮文字:">
  85. <el-input v-model="form.rightBtnText" placeholder="如:购物车" maxlength="6" show-word-limit class="settings-input" />
  86. </el-form-item>
  87. <el-form-item label="跳转地址:">
  88. <el-input v-model="form.rightBtnLink" placeholder="请输入跳转地址" class="settings-input" />
  89. </el-form-item>
  90. <el-form-item label="主题色:">
  91. <div class="color-picker-wrap">
  92. <el-color-picker v-model="form.themeColor" />
  93. <span class="color-val">{{ form.themeColor }}</span>
  94. </div>
  95. </el-form-item>
  96. </el-form>
  97. </div>
  98. </div>
  99. <!-- 广告图编辑区 -->
  100. <div v-else-if="activeSubTab === 'carousel'" class="carousel-editor">
  101. <!-- 模块一:左侧广告设置 -->
  102. <div class="editor-section">
  103. <div class="section-header">
  104. <span class="section-title">模块一:左侧广告设置</span>
  105. <span class="section-desc">尺寸要求:790 * 460,支持上传本地图片并设置跳转链接</span>
  106. </div>
  107. <div class="left-ad-container">
  108. <div
  109. class="left-ad-preview-wrapper"
  110. :class="{ expanded: leftAdHover }"
  111. @mouseenter="leftAdHover = true"
  112. @mouseleave="leftAdHover = false"
  113. >
  114. <img v-if="form.leftAdImage" :src="form.leftAdImage" class="left-ad-img" alt="左侧广告" />
  115. <div v-else class="left-ad-empty" @click="triggerUpload('leftAd')">
  116. <el-icon :size="40"><Plus /></el-icon>
  117. <p>点击上传广告图</p>
  118. </div>
  119. <div class="ad-actions" v-show="leftAdHover && form.leftAdImage">
  120. <el-button type="primary" icon="Edit" circle @click="triggerUpload('leftAd')" title="更换图片" />
  121. <el-button type="danger" icon="Delete" circle @click="handleDeleteLeftAd" title="删除图片" />
  122. </div>
  123. </div>
  124. <div class="left-ad-settings" v-if="form.leftAdImage">
  125. <el-form label-width="90px" label-position="left">
  126. <el-form-item label="跳转地址:">
  127. <el-input v-model="form.leftAdLink" placeholder="请输入以 http:// 或 https:// 开头的地址" class="settings-input-ad" />
  128. </el-form-item>
  129. </el-form>
  130. <div class="left-ad-tip">
  131. <el-icon><InfoFilled /></el-icon>
  132. <span>鼠标悬停查看全图预览效果,点击在新窗口打开</span>
  133. </div>
  134. </div>
  135. </div>
  136. </div>
  137. <!-- 模块二:轮播图管理 -->
  138. <div class="editor-section">
  139. <div class="section-header">
  140. <span class="section-title">模块二:轮播图设置</span>
  141. <span class="section-desc">尺寸要求:552 * 190,支持拖拽排序与实时状态切换</span>
  142. </div>
  143. <!-- 实时预览区 -->
  144. <div class="carousel-preview-box">
  145. <div class="preview-mockup">
  146. <el-carousel height="190px" trigger="click" indicator-position="inside" arrow="never">
  147. <el-carousel-item v-for="item in activeCarouselList" :key="item.id">
  148. <div class="carousel-slide">
  149. <img :src="item.image" alt="轮播图" />
  150. </div>
  151. </el-carousel-item>
  152. <div v-if="activeCarouselList.length === 0" class="carousel-empty">
  153. <el-icon :size="40"><Picture /></el-icon>
  154. <p>暂无启用的轮播图预览</p>
  155. </div>
  156. </el-carousel>
  157. </div>
  158. </div>
  159. <!-- 列表管理区 -->
  160. <div class="carousel-list-box">
  161. <div class="list-toolbar">
  162. <el-button type="primary" icon="Plus" @click="handleAddCarousel" class="btn-add-carousel">新增轮播图</el-button>
  163. <span class="drag-tip">提示:列表支持状态切换及拖拽排序管理</span>
  164. </div>
  165. <el-table :data="carouselList" style="width: 100%" row-key="id" border header-cell-class-name="table-header-custom">
  166. <el-table-column label="排序" width="70" align="center">
  167. <template #default="scope">
  168. <div class="rank-box">
  169. <el-icon v-if="scope.$index > 0" class="rank-icon" @click="moveRow(scope.$index, -1)"><CaretTop /></el-icon>
  170. <el-icon v-if="scope.$index < carouselList.length - 1" class="rank-icon" @click="moveRow(scope.$index, 1)"
  171. ><CaretBottom
  172. /></el-icon>
  173. </div>
  174. </template>
  175. </el-table-column>
  176. <el-table-column label="序号" type="index" width="60" align="center" />
  177. <el-table-column label="图片" width="180">
  178. <template #default="scope">
  179. <el-image :src="scope.row.image" :preview-src-list="[scope.row.image]" fit="cover" class="table-img" preview-teleported />
  180. </template>
  181. </el-table-column>
  182. <el-table-column prop="link" label="跳转地址" show-overflow-tooltip />
  183. <el-table-column label="打开方式" width="120" align="center">
  184. <template #default="scope">
  185. <el-tag :type="scope.row.target === '_blank' ? 'success' : 'info'" size="small">
  186. {{ scope.row.target === '_blank' ? '新窗口' : '当前窗口' }}
  187. </el-tag>
  188. </template>
  189. </el-table-column>
  190. <el-table-column label="状态" width="100" align="center">
  191. <template #default="scope">
  192. <el-switch v-model="scope.row.status" :active-value="1" :inactive-value="0" active-color="#13ce66" />
  193. </template>
  194. </el-table-column>
  195. <el-table-column label="操作" width="150" align="center">
  196. <template #default="scope">
  197. <el-button link type="primary" @click="handleEditCarousel(scope.row)">修改</el-button>
  198. <el-button link type="danger" @click="handleRemoveCarousel(scope.$index)">删除</el-button>
  199. </template>
  200. </el-table-column>
  201. </el-table>
  202. </div>
  203. </div>
  204. </div>
  205. <!-- 快捷入口编辑区 -->
  206. <div v-else-if="activeSubTab === 'quick-entry'" class="quick-entry-editor">
  207. <div class="preview-section">
  208. <div class="preview-title">快捷入口实时预览 (尺寸: 230 * 167)</div>
  209. <div class="quick-entry-preview-outer">
  210. <!-- 仿真预览模块 (230*167) -->
  211. <div class="qe-mockup-card">
  212. <div class="qe-card-header">
  213. <span class="qe-card-title">{{ quickEntrySettings.moduleName }}</span>
  214. <el-icon class="qe-header-arrow"><ArrowRight /></el-icon>
  215. </div>
  216. <div class="qe-grid-container">
  217. <div class="qe-grid-wrapper" :style="{ transform: `translateX(-${qePageIndex * 198}px)` }">
  218. <!-- 网格页 -->
  219. <div v-for="pageIdx in qePageCount" :key="pageIdx" class="qe-grid-page">
  220. <div v-for="(item, idx) in getPageItems(pageIdx - 1)" :key="idx" class="qe-item">
  221. <div class="qe-icon-wrap">
  222. <img v-if="item.icon" :src="item.icon" class="qe-icon-img" />
  223. <el-icon v-else class="qe-icon-placeholder"><Menu /></el-icon>
  224. <div v-if="item.tag" class="qe-tag-bubble">{{ item.tag }}</div>
  225. </div>
  226. <span class="qe-name">{{ item.name }}</span>
  227. </div>
  228. </div>
  229. </div>
  230. <!-- 左右翻页按钮 (仅在多于8项时显示) -->
  231. <div v-if="quickEntryList.length > 8" class="qe-nav-btns">
  232. <div v-if="qePageIndex > 0" class="qe-nav-btn prev" @click="qePageIndex--">
  233. <el-icon><ArrowLeft /></el-icon>
  234. </div>
  235. <div v-if="qePageIndex < qePageCount - 1" class="qe-nav-btn next" @click="qePageIndex++">
  236. <el-icon><ArrowRight /></el-icon>
  237. </div>
  238. </div>
  239. </div>
  240. </div>
  241. </div>
  242. </div>
  243. <!-- 列表设置 -->
  244. <div class="editor-section">
  245. <div class="section-header">
  246. <span class="section-title">模块基础配置</span>
  247. </div>
  248. <div class="config-form-inline">
  249. <el-form :inline="true" :model="quickEntrySettings" label-width="100px">
  250. <el-form-item label="模块名称:">
  251. <el-input v-model="quickEntrySettings.moduleName" placeholder="如:企业工作台" />
  252. </el-form-item>
  253. <el-form-item label="跳转地址:">
  254. <el-input v-model="quickEntrySettings.jumpLink" placeholder="标题点击跳转地址" style="width: 300px" />
  255. </el-form-item>
  256. </el-form>
  257. </div>
  258. <div class="section-header m-t-20">
  259. <span class="section-title">入口项管理列表</span>
  260. </div>
  261. <div class="list-toolbar">
  262. <div class="drag-tip">提示:一页显示8个,超过8个将自动启用预览区右滑功能</div>
  263. <el-button type="primary" icon="Plus" @click="handleAddQuickEntry">新增入口</el-button>
  264. </div>
  265. <el-table :data="quickEntryList" border style="width: 100%" header-cell-class-name="table-header-custom">
  266. <el-table-column label="排序" width="80" align="center">
  267. <template #default="{ $index }">
  268. <div class="rank-box">
  269. <el-icon v-if="$index > 0" class="rank-icon" @click="moveQE($index, -1)"><CaretTop /></el-icon>
  270. <el-icon v-if="$index < quickEntryList.length - 1" class="rank-icon" @click="moveQE($index, 1)"><CaretBottom /></el-icon>
  271. </div>
  272. </template>
  273. </el-table-column>
  274. <el-table-column label="图标" width="100" align="center">
  275. <template #default="{ row }">
  276. <div class="table-icon-cell">
  277. <img v-if="row.icon" :src="row.icon" style="width: 24px; height: 24px" />
  278. <el-icon v-else style="font-size: 20px; color: #ccc"><Menu /></el-icon>
  279. </div>
  280. </template>
  281. </el-table-column>
  282. <el-table-column prop="name" label="名称" width="150" />
  283. <el-table-column label="标签" width="120" align="center">
  284. <template #default="{ row }">
  285. <el-tag v-if="row.tag" type="danger" size="small" effect="plain">{{ row.tag }}</el-tag>
  286. <span v-else>-</span>
  287. </template>
  288. </el-table-column>
  289. <el-table-column prop="link" label="跳转地址" show-overflow-tooltip />
  290. <el-table-column label="状态" width="100" align="center">
  291. <template #default="{ row }">
  292. <el-switch v-model="row.status" :active-value="1" :inactive-value="0" />
  293. </template>
  294. </el-table-column>
  295. <el-table-column label="操作" width="150" fixed="right" align="center">
  296. <template #default="{ row, $index }">
  297. <el-button type="primary" link @click="handleEditQuickEntry(row, $index)">编辑</el-button>
  298. <el-button type="danger" link @click="handleDeleteQuickEntry($index)">删除</el-button>
  299. </template>
  300. </el-table-column>
  301. </el-table>
  302. </div>
  303. </div>
  304. <!-- 分类设置编辑区 -->
  305. <div v-else-if="activeSubTab === 'category'" class="category-editor">
  306. <!-- 模块一:实时预览 (高度还原图1、2) -->
  307. <div class="editor-section">
  308. <div class="section-header">
  309. <span class="section-title">分类实时预览</span>
  310. <span class="section-desc">尺寸要求:280 * 398,悬停可查看右滑面板效果 (图1、图2)</span>
  311. </div>
  312. <div class="category-preview-container">
  313. <!-- 图1: 分类菜单 -->
  314. <div class="category-menu-mockup">
  315. <div v-for="item in categoryList.filter((c) => c.status === 1).slice(0, 10)" :key="item.id" class="menu-item">
  316. <div class="menu-icon">
  317. <img v-if="item.icon" :src="item.icon" alt="" />
  318. <el-icon v-else><Menu /></el-icon>
  319. </div>
  320. <div class="menu-name">{{ item.name }}</div>
  321. <!-- 图2: 悬停右滑面板 - CSS 控制显示 -->
  322. <div class="category-panel-mockup">
  323. <div class="panel-header-line"></div>
  324. <div class="panel-content">
  325. <!-- 顶部标签栏 -->
  326. <div class="panel-tabs">
  327. <span v-for="tag in item.tags" :key="tag.name" class="panel-tab-item">{{ tag.name }}</span>
  328. </div>
  329. <!-- 品牌位 (图3) - 绝对定位至右上角 -->
  330. <div class="brand-box">
  331. <div class="brand-main-title">
  332. {{ item.panelData.mainTitle }}<span class="brand-strong">{{ item.panelData.subTitle }}</span>
  333. </div>
  334. <div class="brand-notes">
  335. <template v-for="(note, nIdx) in item.panelData.notes" :key="nIdx">
  336. <span class="note-item">{{ note.name }}</span>
  337. <span v-if="nIdx < item.panelData.notes.length - 1" class="note-sep">|</span>
  338. </template>
  339. </div>
  340. </div>
  341. <div class="panel-body">
  342. <!-- 左侧分类列表 -->
  343. <div class="panel-main">
  344. <div v-for="group in item.panelData.groups" :key="group.title" class="category-group">
  345. <div class="group-title">{{ group.title }}</div>
  346. <div class="group-items">
  347. <span v-for="sub in group.items" :key="sub" class="group-item">{{ sub }}</span>
  348. </div>
  349. </div>
  350. </div>
  351. </div>
  352. </div>
  353. </div>
  354. </div>
  355. </div>
  356. </div>
  357. </div>
  358. <!-- 模块二:列表设置 -->
  359. <div class="editor-section">
  360. <div class="section-header">
  361. <span class="section-title">分类列表设置</span>
  362. <span class="section-desc">管理首页分类菜单的显示内容、图标、标签及关联分类</span>
  363. </div>
  364. <div class="list-toolbar">
  365. <div class="theme-color-setting-pro">
  366. <span class="label">主题色:</span>
  367. <el-color-picker v-model="categoryThemeColor" />
  368. <span class="value">{{ categoryThemeColor }}</span>
  369. </div>
  370. <el-button type="primary" icon="Plus" @click="handleAddCategory">新增分类</el-button>
  371. </div>
  372. <el-table :data="categoryList" border style="width: 100%" header-cell-class-name="table-header-custom">
  373. <el-table-column label="排序" width="70" align="center">
  374. <template #default="scope">
  375. <div class="rank-box">
  376. <el-icon v-if="scope.$index > 0" class="rank-icon" @click="moveCategory(scope.$index, -1)"><CaretTop /></el-icon>
  377. <el-icon v-if="scope.$index < categoryList.length - 1" class="rank-icon" @click="moveCategory(scope.$index, 1)"
  378. ><CaretBottom
  379. /></el-icon>
  380. </div>
  381. </template>
  382. </el-table-column>
  383. <el-table-column label="菜单名称" prop="name" min-width="200" show-overflow-tooltip />
  384. <el-table-column label="图标" width="80" align="center">
  385. <template #default="scope">
  386. <el-image v-if="scope.row.icon" :src="scope.row.icon" fit="contain" class="table-icon-preview" />
  387. <span v-else class="text-gray">-</span>
  388. </template>
  389. </el-table-column>
  390. <el-table-column label="同步分类" prop="syncCategory" width="120" />
  391. <el-table-column label="标签" min-width="180">
  392. <template #default="scope">
  393. <div class="tag-wrap">
  394. <el-tag v-for="tag in scope.row.tags" :key="tag.name" size="small" class="m-r-5">{{ tag.name }}</el-tag>
  395. </div>
  396. </template>
  397. </el-table-column>
  398. <el-table-column label="状态" width="100" align="center">
  399. <template #default="scope">
  400. <el-switch v-model="scope.row.status" :active-value="1" :inactive-value="0" active-color="#13ce66" />
  401. </template>
  402. </el-table-column>
  403. <el-table-column label="操作" width="150" align="center" fixed="right">
  404. <template #default="scope">
  405. <el-button link type="primary" @click="handleEditCategory(scope.row)">编辑</el-button>
  406. <el-button link type="danger" @click="handleRemoveCategory(scope.$index)">删除</el-button>
  407. </template>
  408. </el-table-column>
  409. </el-table>
  410. </div>
  411. </div>
  412. <!-- 头部分类编辑区 -->
  413. <div v-else-if="activeSubTab === 'headerCategory'" class="header-category-editor">
  414. <!-- 实时预览区 (1350*60) -->
  415. <div class="preview-section">
  416. <div class="preview-title">头部分类实时预览</div>
  417. <div class="header-preview-outer">
  418. <div class="header-preview-box">
  419. <!-- 左侧箭头 -->
  420. <div v-show="showLeftArrow" class="nav-arrow left-arrow" @click="scrollHeaderNav('left')">
  421. <el-icon><ArrowLeft /></el-icon>
  422. </div>
  423. <div class="header-nav-scroll" ref="headerNavScrollRef" @scroll="updateNavArrows">
  424. <div class="header-nav-list">
  425. <div v-for="item in headerCategoryList.filter((i) => i.status === 1)" :key="item.id" class="header-nav-item">
  426. <div class="item-icon">
  427. <img v-if="item.icon" :src="item.icon" alt="" />
  428. <el-icon v-else :style="{ color: headerThemeColor }"><Menu /></el-icon>
  429. </div>
  430. <span class="item-text" :style="{ '--hover-color': headerThemeColor }">{{ item.title }}</span>
  431. </div>
  432. </div>
  433. </div>
  434. <!-- 右侧箭头 -->
  435. <div v-show="showRightArrow" class="nav-arrow right-arrow" @click="scrollHeaderNav('right')">
  436. <el-icon><ArrowRight /></el-icon>
  437. </div>
  438. </div>
  439. </div>
  440. <div class="preview-desc">尺寸要求:1350 * 60,导航项横向排列,支持图标与主题色联动</div>
  441. </div>
  442. <!-- 列表设置 -->
  443. <div class="editor-section">
  444. <div class="section-header">
  445. <span class="section-title">分类列表设置管理</span>
  446. </div>
  447. <div class="list-toolbar">
  448. <div class="theme-color-setting-pro">
  449. <span class="label">主题色设置:</span>
  450. <el-color-picker v-model="headerThemeColor" />
  451. <span class="value">{{ headerThemeColor }}</span>
  452. </div>
  453. <el-button type="primary" icon="Plus" @click="handleAddHeaderCategory">新增分类</el-button>
  454. </div>
  455. <el-table :data="headerCategoryList" border style="width: 100%" header-cell-class-name="table-header-custom">
  456. <el-table-column label="排序" width="80" align="center">
  457. <template #default="{ $index }">
  458. <div class="rank-box">
  459. <el-icon v-if="$index > 0" class="rank-icon" @click="moveHeader($index, -1)"><CaretTop /></el-icon>
  460. <el-icon v-if="$index < headerCategoryList.length - 1" class="rank-icon" @click="moveHeader($index, 1)"><CaretBottom /></el-icon>
  461. </div>
  462. </template>
  463. </el-table-column>
  464. <el-table-column prop="title" label="分类标题名称" min-width="150" />
  465. <el-table-column label="图标" width="100" align="center">
  466. <template #default="{ row }">
  467. <img v-if="row.icon" :src="row.icon" class="table-icon-preview" style="width: 22px; height: 22px" />
  468. <span v-else>-</span>
  469. </template>
  470. </el-table-column>
  471. <el-table-column prop="link" label="跳转地址" show-overflow-tooltip />
  472. <el-table-column label="打开方式" width="120" align="center">
  473. <template #default="{ row }">
  474. <el-tag :type="row.openMode === 'new' ? 'success' : 'info'" size="small">
  475. {{ row.openMode === 'new' ? '新窗口' : '当前页' }}
  476. </el-tag>
  477. </template>
  478. </el-table-column>
  479. <el-table-column label="状态" width="100" align="center">
  480. <template #default="{ row }">
  481. <el-switch v-model="row.status" :active-value="1" :inactive-value="0" active-color="#13ce66" />
  482. </template>
  483. </el-table-column>
  484. <el-table-column label="操作" width="150" fixed="right" align="center">
  485. <template #default="{ row, $index }">
  486. <el-button type="primary" link @click="handleEditHeaderCategory(row, $index)">编辑</el-button>
  487. <el-button type="danger" link @click="handleDeleteHeaderCategory($index)">删除</el-button>
  488. </template>
  489. </el-table-column>
  490. </el-table>
  491. </div>
  492. </div>
  493. <!-- 广告模块编辑区 -->
  494. <div v-else-if="activeSubTab === 'ad-module'" class="ad-module-editor">
  495. <div class="preview-section">
  496. <div class="preview-title">广告模块实时预览</div>
  497. <div class="ad-preview-grid">
  498. <!-- 广告一: 企业购x百亿补贴 (484*190) -->
  499. <div class="ad-item ad-subsidy" :style="{ width: '484px', height: '190px' }">
  500. <div class="ad-header">
  501. <div class="ad-title-main" :style="getAdTitleStyle(0, 'main')">{{ getAdTitleText(0, 'main') }}</div>
  502. <div class="ad-title-sub" :style="getAdTitleStyle(0, 'sub')">{{ getAdTitleText(0, 'sub') }}</div>
  503. </div>
  504. <div class="ad-products-subsidy">
  505. <div v-for="item in adModules[0].items" :key="item.id" class="product-item">
  506. <div class="product-img"><img :src="item.imageUrl" alt="" /></div>
  507. <div class="product-price">¥{{ item.price }}</div>
  508. </div>
  509. </div>
  510. <div class="ad-hover-mask">
  511. <el-button type="primary" size="small" @click="handleEditAd(0)">设置</el-button>
  512. </div>
  513. </div>
  514. <!-- 广告二: 企采榜单 (253*196) -->
  515. <div class="ad-item ad-ranking" :style="{ width: '253px', height: '196px' }">
  516. <div class="ad-header">
  517. <div class="ad-title-main" :style="getAdTitleStyle(1, 'main')">{{ getAdTitleText(1, 'main') }}</div>
  518. <div class="ad-title-sub" :style="getAdTitleStyle(1, 'sub')">{{ getAdTitleText(1, 'sub') }}</div>
  519. </div>
  520. <div class="ad-products-ranking">
  521. <div v-for="item in adModules[1].items" :key="item.id" class="ranking-item">
  522. <div class="ranking-badge">{{ item.tagText || '排行榜' }} ></div>
  523. <div class="product-img"><img :src="item.imageUrl" alt="" /></div>
  524. <div class="ranking-footer">已售{{ item.salesCount }}件</div>
  525. </div>
  526. </div>
  527. <div class="ad-hover-mask">
  528. <el-button type="primary" size="small" @click="handleEditAd(1)">设置</el-button>
  529. </div>
  530. </div>
  531. <!-- 广告三: 品牌好店 (253*196) -->
  532. <div class="ad-item ad-brand" :style="{ width: '253px', height: '196px' }">
  533. <div class="ad-header">
  534. <div class="ad-title-main" :style="getAdTitleStyle(2, 'main')">{{ getAdTitleText(2, 'main') }}</div>
  535. <div class="ad-title-sub" :style="getAdTitleStyle(2, 'sub')">{{ getAdTitleText(2, 'sub') }}</div>
  536. </div>
  537. <div class="ad-brands-content">
  538. <div v-for="item in adModules[2].items" :key="item.id" class="brand-item">
  539. <div class="brand-logo"><img :src="item.imageUrl" alt="" /></div>
  540. <div class="brand-name">{{ item.tagLink || item.productName }}</div>
  541. <div class="brand-tag-btn">{{ item.tagText || '品质保障' }}</div>
  542. </div>
  543. </div>
  544. <div class="ad-hover-mask">
  545. <el-button type="primary" size="small" @click="handleEditAd(2)">设置</el-button>
  546. </div>
  547. </div>
  548. <!-- 广告四: 企业精选 (253*196) -->
  549. <div class="ad-item ad-selection" :style="{ width: '253px', height: '196px' }">
  550. <div class="ad-header">
  551. <div class="ad-title-main" :style="getAdTitleStyle(3, 'main')">{{ getAdTitleText(3, 'main') }}</div>
  552. <div class="ad-title-sub" :style="getAdTitleStyle(3, 'sub')">{{ getAdTitleText(3, 'sub') }}</div>
  553. </div>
  554. <div class="ad-products-selection">
  555. <div v-for="item in adModules[3].items" :key="item.id" class="selection-item">
  556. <div class="product-img"><img :src="item.imageUrl" alt="" /></div>
  557. <div class="product-price-row">
  558. <span class="p-unit">¥</span>
  559. <span class="p-val">{{ item.price }}</span>
  560. </div>
  561. </div>
  562. </div>
  563. <div class="ad-hover-mask">
  564. <el-button type="primary" size="small" @click="handleEditAd(3)">设置</el-button>
  565. </div>
  566. </div>
  567. <!-- 广告五: 企业购x京东新品 (253*196) -->
  568. <div class="ad-item ad-new" :style="{ width: '253px', height: '196px' }">
  569. <div class="ad-header">
  570. <div class="ad-title-main" :style="getAdTitleStyle(4, 'main')">{{ getAdTitleText(4, 'main') }}</div>
  571. <div class="ad-title-sub" :style="getAdTitleStyle(4, 'sub')">{{ getAdTitleText(4, 'sub') }}</div>
  572. </div>
  573. <div class="ad-products-selection">
  574. <div v-for="item in adModules[4].items" :key="item.id" class="selection-item">
  575. <div class="product-img"><img :src="item.imageUrl" alt="" /></div>
  576. <div class="product-price-row center">
  577. <span class="p-unit">¥</span>
  578. <span class="p-val">{{ item.price }}</span>
  579. </div>
  580. </div>
  581. </div>
  582. <div class="ad-hover-mask">
  583. <el-button type="primary" size="small" @click="handleEditAd(4)">设置</el-button>
  584. </div>
  585. </div>
  586. </div>
  587. <div class="preview-desc">提示:支持 5 个独立广告模块配置,悬停模块显示“设置”按钮进行内容管理</div>
  588. </div>
  589. </div>
  590. <!-- 场景方案编辑区 -->
  591. <!-- 场景方案编辑区 -->
  592. <div v-else-if="activeSubTab === 'scenario'" class="scenario-editor-container">
  593. <!-- 实时预览区 -->
  594. <div class="preview-section-standard">
  595. <div class="section-title-standard">场景方案实时预览</div>
  596. <div class="scenario-preview-outer">
  597. <div class="scenario-preview-box-clean" :style="{ '--s-theme-color': scenarioSettings.themeColor }">
  598. <!-- 左侧标题区 -->
  599. <div class="scenario-header-left">
  600. <div class="s-title-group">
  601. <span class="s-main-title">{{ scenarioSettings.mainTitle }}</span>
  602. <span class="s-sub-title-inline">{{ scenarioSettings.subTitle }}</span>
  603. </div>
  604. <div class="s-btn-wrap">
  605. <div class="s-btn-premium">
  606. {{ scenarioSettings.btnText }}
  607. <el-icon class="m-l-5"><CaretRight /></el-icon>
  608. </div>
  609. </div>
  610. </div>
  611. <!-- 右侧方案卡片 -->
  612. <div class="scenario-cards-wrap">
  613. <div
  614. v-for="(item, idx) in scenarioList"
  615. :key="item.id"
  616. class="scenario-card-premium"
  617. :class="{ 'hidden-card-fourth': idx === 3 }"
  618. :style="{ backgroundColor: hexToRgba(item.bgColor, item.opacity) }"
  619. >
  620. <div class="card-top-header">
  621. <div class="card-titles-group">
  622. <span class="card-main-title" :style="{ color: item.titleColor }">{{ item.title }}</span>
  623. <span class="card-sub-title" :style="{ color: item.subTitleColor }">{{ item.subTitle }}</span>
  624. </div>
  625. <div class="card-arrow-icon" :style="{ backgroundColor: item.titleColor }">
  626. <el-icon><ArrowRight /></el-icon>
  627. </div>
  628. </div>
  629. <div class="card-image-content">
  630. <img :src="item.image || defaultPlaceholder" alt="" />
  631. </div>
  632. </div>
  633. </div>
  634. </div>
  635. </div>
  636. <div class="preview-tip">尺寸要求:1600 * 158,支持响应式隐藏及主题色联动</div>
  637. </div>
  638. <!-- 全局配置 -->
  639. <div class="config-section-standard">
  640. <div class="section-title-standard">场景解决方案全局设置</div>
  641. <div class="settings-form-standard">
  642. <el-form :model="scenarioSettings" label-width="120px" label-position="left">
  643. <el-form-item label="场景主标题:">
  644. <el-input v-model="scenarioSettings.mainTitle" placeholder="请输入主标题" style="width: 400px" />
  645. </el-form-item>
  646. <el-form-item label="场景副标题:">
  647. <el-input v-model="scenarioSettings.subTitle" placeholder="请输入副标题" style="width: 400px" />
  648. </el-form-item>
  649. <el-form-item label="按钮文字:">
  650. <el-input v-model="scenarioSettings.btnText" placeholder="请输入按钮文字" style="width: 400px" />
  651. </el-form-item>
  652. <el-form-item label="跳转链接:">
  653. <el-input v-model="scenarioSettings.jumpLink" placeholder="请输入跳转地址" style="width: 400px" />
  654. </el-form-item>
  655. <el-form-item label="主题背景色:">
  656. <div class="theme-color-setting-pro">
  657. <el-color-picker v-model="scenarioSettings.themeColor" />
  658. <span class="value">{{ scenarioSettings.themeColor }}</span>
  659. </div>
  660. </el-form-item>
  661. </el-form>
  662. </div>
  663. </div>
  664. <!-- 列表管理 -->
  665. <div class="config-section-standard">
  666. <div class="section-title-standard">方案卡片设置管理</div>
  667. <el-table :data="scenarioList" border style="width: 100%" header-cell-class-name="table-header-custom" class="standard-table">
  668. <el-table-column label="排序" width="80" align="center">
  669. <template #default="{ $index }">
  670. <div class="rank-action-btns">
  671. <el-icon v-if="$index > 0" class="rank-btn-mini" @click="moveScenario($index, -1)"><ArrowUp /></el-icon>
  672. <el-icon v-if="$index < scenarioList.length - 1" class="rank-btn-mini" @click="moveScenario($index, 1)"><ArrowDown /></el-icon>
  673. </div>
  674. </template>
  675. </el-table-column>
  676. <el-table-column label="分类方案名称" min-width="250">
  677. <template #default="{ row }">
  678. <div class="flex-column">
  679. <span :style="{ color: row.titleColor, fontSize: '14px', fontWeight: 'bold' }">{{ row.title }}</span>
  680. <span class="text-gray" style="font-size: 12px; margin-top: 4px">{{ row.subTitle }}</span>
  681. </div>
  682. </template>
  683. </el-table-column>
  684. <el-table-column label="图标/封面图" width="200" align="center">
  685. <template #default="{ row }">
  686. <el-image :src="row.image" fit="cover" style="width: 160px; height: 48px; border-radius: 4px" />
  687. </template>
  688. </el-table-column>
  689. <el-table-column prop="link" label="跳转链接" min-width="300" show-overflow-tooltip />
  690. <el-table-column label="操作" width="120" align="center" fixed="right">
  691. <template #default="{ row, $index }">
  692. <el-button type="primary" link @click="handleEditScenario(row, $index)">编辑内容</el-button>
  693. </template>
  694. </el-table-column>
  695. </el-table>
  696. </div>
  697. </div>
  698. <!-- 推荐设置编辑区 -->
  699. <div v-else-if="activeSubTab === 'recommend'" class="recommend-editor-container">
  700. <!-- 实时预览区 -->
  701. <div class="preview-section-standard">
  702. <div class="section-title-standard">为你推荐实时预览</div>
  703. <div class="recommend-preview-outer">
  704. <div class="recommend-preview-container">
  705. <!-- 左侧箭头 -->
  706. <div v-if="recShowLeft" class="recommend-nav-btn prev" @click="scrollRecommend('left')">
  707. <el-icon><CaretLeft /></el-icon>
  708. </div>
  709. <div
  710. ref="recommendScrollRef"
  711. class="recommend-preview-box"
  712. :style="{ '--r-theme-color': recommendThemeColor }"
  713. @scroll="updateRecArrows"
  714. >
  715. <div
  716. v-for="item in activeRecommendList"
  717. :key="item.id"
  718. :class="['recommend-item', { active: recommendActiveId === item.id }]"
  719. @click="recommendActiveId = item.id"
  720. >
  721. <div class="recommend-icon">
  722. <img :src="item.icon || defaultPlaceholder" alt="" />
  723. </div>
  724. <div class="recommend-text">
  725. <div class="r-main-title" :style="{ color: recommendActiveId === item.id ? recommendThemeColor : '#333' }">{{ item.name }}</div>
  726. <div
  727. class="r-sub-title"
  728. :style="{
  729. color: recommendActiveId === item.id ? recommendThemeColor : '#999',
  730. opacity: recommendActiveId === item.id ? 0.8 : 1
  731. }"
  732. >
  733. {{ item.subTitle }}
  734. </div>
  735. </div>
  736. </div>
  737. </div>
  738. <!-- 右侧箭头 -->
  739. <div v-if="recShowRight" class="recommend-nav-btn next" @click="scrollRecommend('right')">
  740. <el-icon><CaretRight /></el-icon>
  741. </div>
  742. </div>
  743. </div>
  744. <div class="preview-desc">尺寸要求:1600 * 88,分类图标 32 * 32,支持响应式平滑滚动及选中态色值联动</div>
  745. </div>
  746. <!-- 配置表单区域 -->
  747. <div class="config-section-standard">
  748. <div class="section-title-standard">为你推荐配置设置</div>
  749. <el-form label-width="120px" inline class="m-b-20">
  750. <el-form-item label="主题选中色调:">
  751. <div class="theme-color-setting-pro">
  752. <el-color-picker v-model="recommendThemeColor" />
  753. <span class="value">{{ recommendThemeColor }}</span>
  754. </div>
  755. </el-form-item>
  756. <el-form-item label="商品列表主题色:">
  757. <div class="theme-color-setting-pro">
  758. <el-color-picker v-model="recommendProductThemeColor" />
  759. <span class="value">{{ recommendProductThemeColor }}</span>
  760. </div>
  761. </el-form-item>
  762. <el-form-item>
  763. <el-button type="primary" icon="Plus" @click="handleAddRecommend">新增推荐分类</el-button>
  764. </el-form-item>
  765. </el-form>
  766. <el-table :data="recommendList" border style="width: 100%" header-cell-class-name="table-header-custom" class="standard-table">
  767. <el-table-column label="位置" width="80" align="center">
  768. <template #default="{ $index }">
  769. <div class="rank-action-btns">
  770. <el-icon v-if="$index > 0" class="rank-btn-mini" @click="moveRecommend($index, -1)"><ArrowUp /></el-icon>
  771. <el-icon v-if="$index < recommendList.length - 1" class="rank-btn-mini" @click="moveRecommend($index, 1)"><ArrowDown /></el-icon>
  772. </div>
  773. </template>
  774. </el-table-column>
  775. <el-table-column label="分类名称" min-width="120">
  776. <template #default="{ row }">
  777. <span style="font-weight: bold; color: #333">{{ row.name }}</span>
  778. </template>
  779. </el-table-column>
  780. <el-table-column prop="subTitle" label="副标题" min-width="150" />
  781. <el-table-column label="图标" width="100" align="center">
  782. <template #default="{ row }">
  783. <div class="table-icon-preview">
  784. <img :src="row.icon || defaultPlaceholder" class="row-icon" />
  785. </div>
  786. </template>
  787. </el-table-column>
  788. <el-table-column label="数据类型" width="120" align="center">
  789. <template #default="{ row }">
  790. <el-tag :type="row.type === 'category' ? 'success' : 'warning'">
  791. {{ row.type === 'category' ? '分类映射' : '商品自选' }}
  792. </el-tag>
  793. </template>
  794. </el-table-column>
  795. <el-table-column label="关联类目/商品数" min-width="180">
  796. <template #default="{ row }">
  797. <div v-if="row.type === 'category'" class="text-gray">{{ row.categoryLabel || '未设置' }}</div>
  798. <div v-else class="text-gray">已选 {{ row.selectedProducts?.length || 0 }} 个商品</div>
  799. </template>
  800. </el-table-column>
  801. <el-table-column label="启用状态" width="100" align="center">
  802. <template #default="{ row }">
  803. <el-switch v-model="row.status" :active-value="1" :inactive-value="0" active-color="#13ce66" />
  804. </template>
  805. </el-table-column>
  806. <el-table-column label="操作" width="220" align="center" fixed="right">
  807. <template #default="{ row, $index }">
  808. <el-button type="primary" link @click="handleEditRecommend(row, $index)">编辑</el-button>
  809. <el-button v-if="row.type === 'select'" type="primary" link @click="openRecommendProductSelect($index)">选商品</el-button>
  810. <el-button type="danger" link @click="handleDeleteRecommend($index)">删除</el-button>
  811. </template>
  812. </el-table-column>
  813. </el-table>
  814. </div>
  815. </div>
  816. </div>
  817. <!-- 广告模块设置弹窗 -->
  818. <el-dialog
  819. v-model="adDialogVisible"
  820. :title="`设置广告模块 - ${adModules[currentAdIdx]?.title}`"
  821. width="1050px"
  822. custom-class="ad-setup-dialog"
  823. destroy-on-close
  824. >
  825. <el-form :model="adForm" label-width="100px" class="dialog-form-inner">
  826. <el-form-item label="模块标题:">
  827. <div class="theme-color-setting-pro">
  828. <el-input v-model="adForm.title" placeholder="请输入主标题" style="width: 300px" />
  829. <el-color-picker v-model="adForm.titleColor" />
  830. <span class="value">{{ adForm.titleColor }}</span>
  831. </div>
  832. </el-form-item>
  833. <el-form-item label="副标题:">
  834. <div class="theme-color-setting-pro">
  835. <el-input v-model="adForm.subTitle" placeholder="请输入副标题" style="width: 300px" />
  836. <el-color-picker v-model="adForm.titleColor" />
  837. <span class="value">{{ adForm.titleColor }}</span>
  838. </div>
  839. </el-form-item>
  840. <div class="config-subtitle">商品/品牌列表 (固定 {{ adForm.items.length }} 项)</div>
  841. <el-table :data="adForm.items" border style="width: 100%" class="m-t-10">
  842. <el-table-column label="位置" width="60" align="center">
  843. <template #default="scope">{{ scope.$index + 1 }}</template>
  844. </el-table-column>
  845. <el-table-column label="图片" width="100" align="center">
  846. <template #default="{ row }">
  847. <img :src="row.imageUrl" style="width: 50px; height: 50px; object-fit: contain" />
  848. </template>
  849. </el-table-column>
  850. <!-- 通用商品信息列 (百亿补贴、企采精选、京东新品) -->
  851. <el-table-column v-if="currentAdIdx === 0 || currentAdIdx === 3 || currentAdIdx === 4" label="商品信息" min-width="180">
  852. <template #default="{ row }">
  853. <div class="table-info-cell">
  854. <div class="info-name">{{ row.productName || '未选择' }}</div>
  855. <div class="info-price">价格:¥{{ row.price }}</div>
  856. <div class="info-id">ID: {{ row.id || '-' }}</div>
  857. </div>
  858. </template>
  859. </el-table-column>
  860. <!-- 企采榜单 专属列 -->
  861. <template v-if="currentAdIdx === 1">
  862. <el-table-column label="商品信息" min-width="150">
  863. <template #default="{ row }">
  864. <div class="info-name">{{ row.productName || '未选择' }}</div>
  865. <div class="info-id">ID: {{ row.id || '-' }}</div>
  866. </template>
  867. </el-table-column>
  868. <el-table-column label="排行标签" width="220">
  869. <template #default="{ row }">
  870. <el-input v-model="row.tagText" placeholder="标签文字" size="small" class="m-b-5" />
  871. <el-input v-model="row.tagLink" placeholder="跳转链接" size="small" />
  872. </template>
  873. </el-table-column>
  874. <el-table-column label="销量数据" width="130">
  875. <template #default="{ row }">
  876. <el-input v-model="row.salesCount" placeholder="销量" size="small">
  877. <template #prepend>已售</template>
  878. </el-input>
  879. </template>
  880. </el-table-column>
  881. </template>
  882. <!-- 品牌好店 专属列 -->
  883. <template v-if="currentAdIdx === 2">
  884. <el-table-column label="品牌名称" min-width="180">
  885. <template #default="{ row }">
  886. <div class="brand-name-display">{{ row.productName || '未选择' }}</div>
  887. <div class="info-id m-t-5">ID: {{ row.id || '-' }}</div>
  888. </template>
  889. </el-table-column>
  890. <el-table-column label="品牌标签" width="300">
  891. <template #default="{ row }">
  892. <div class="flex-column gap-10">
  893. <el-input v-model="row.tagText" placeholder="标签文字 (如: 品质保障)" />
  894. <el-input v-model="row.tagLink" placeholder="描述文字 (控制预览品牌名称)" />
  895. </div>
  896. </template>
  897. </el-table-column>
  898. </template>
  899. <el-table-column label="操作" width="110" align="center" fixed="right">
  900. <template #default="scope">
  901. <el-button type="primary" link @click="openProductSelect(scope.$index)">
  902. <el-icon class="m-r-5"><Edit /></el-icon>
  903. {{ scope.row?.id ? '修改' : '选择' }}
  904. </el-button>
  905. </template>
  906. </el-table-column>
  907. </el-table>
  908. </el-form>
  909. <template #footer>
  910. <el-button @click="adDialogVisible = false">取消</el-button>
  911. <el-button type="primary" @click="submitAdForm">保存设置</el-button>
  912. </template>
  913. </el-dialog>
  914. <!-- 选择商品/品牌抽屉 (加宽版) -->
  915. <el-drawer v-model="selectDialogVisible" :title="currentAdIdx === 2 ? '选择品牌' : '选择商品'" size="850px" append-to-body>
  916. <div class="select-dialog-content">
  917. <el-input
  918. v-model="productQueryParams.itemName"
  919. :placeholder="currentAdIdx === 2 ? '输入品牌名称搜索' : '输入商品名称或ID搜索'"
  920. prefix-icon="Search"
  921. clearable
  922. style="margin-bottom: 20px"
  923. @input="getProductList"
  924. />
  925. <div class="select-list">
  926. <div
  927. v-for="item in pagedSelectList"
  928. :key="item.id"
  929. class="select-item-row"
  930. :class="{ active: selectedTempId === item.id }"
  931. @click="selectedTempId = item.id"
  932. >
  933. <img :src="item.image" class="select-item-img" />
  934. <div class="select-item-info">
  935. <div class="select-item-name">{{ item.name }}</div>
  936. <div v-if="currentAdIdx !== 2" class="select-item-price">¥{{ item.price }}</div>
  937. <div class="select-item-id">ID: {{ item.id }}</div>
  938. </div>
  939. <el-radio v-model="selectedTempId" :label="item.id"><span></span></el-radio>
  940. </div>
  941. </div>
  942. <!-- 分页组件 -->
  943. <div class="select-pagination">
  944. <el-pagination
  945. v-model:current-page="selectCurrentPage"
  946. v-model:page-size="selectPageSize"
  947. :total="productTotal"
  948. :page-sizes="[8, 12, 20, 50]"
  949. layout="total, sizes, prev, pager, next, jumper"
  950. background
  951. @current-change="onProductPageChange"
  952. @size-change="onProductPageSizeChange"
  953. />
  954. </div>
  955. </div>
  956. <template #footer>
  957. <div style="flex: auto; text-align: right; padding: 20px">
  958. <el-button @click="selectDialogVisible = false">取消</el-button>
  959. <el-button type="primary" @click="confirmSelect">确定选择</el-button>
  960. </div>
  961. </template>
  962. </el-drawer>
  963. <!-- 轮播图编辑弹窗 -->
  964. <el-dialog v-model="dialogVisible" :title="dialogType === 'add' ? '新增轮播图' : '修改轮播图'" width="800px" destroy-on-close>
  965. <el-form :model="carouselForm" label-width="100px" class="dialog-form-inner">
  966. <el-form-item label="轮播图片:">
  967. <div class="upload-placeholder" @click="triggerUpload('carousel')">
  968. <img v-if="carouselForm.image" :src="carouselForm.image" class="form-preview-img" />
  969. <el-icon v-else class="upload-icon"><Plus /></el-icon>
  970. </div>
  971. <div class="upload-tip">推荐尺寸:552 * 190,支持上传本地图片</div>
  972. </el-form-item>
  973. <el-form-item label="跳转地址:">
  974. <el-input v-model="carouselForm.link" placeholder="请输入以 http:// 或 https:// 开头的地址" />
  975. </el-form-item>
  976. <el-form-item label="打开方式:">
  977. <el-radio-group v-model="carouselForm.target">
  978. <el-radio label="_self">当前窗口</el-radio>
  979. <el-radio label="_blank">新窗口</el-radio>
  980. </el-radio-group>
  981. </el-form-item>
  982. <el-form-item label="启用状态:">
  983. <el-switch v-model="carouselForm.status" :active-value="1" :inactive-value="0" active-color="#13ce66" />
  984. </el-form-item>
  985. </el-form>
  986. <template #footer>
  987. <el-button @click="dialogVisible = false">取消</el-button>
  988. <el-button type="primary" @click="submitCarouselForm">确定</el-button>
  989. </template>
  990. </el-dialog>
  991. <!-- 分类设置编辑弹窗 -->
  992. <el-dialog v-model="categoryDialogVisible" :title="categoryDialogType === 'add' ? '新增分类' : '修改分类'" width="900px" destroy-on-close>
  993. <el-form :model="categoryForm" label-width="100px" class="dialog-form-inner">
  994. <el-tabs type="border-card">
  995. <el-tab-pane label="基础设置">
  996. <el-form-item label="菜单名称:">
  997. <el-input v-model="categoryForm.name" placeholder="如:办公电脑 / 办公打印 / 电脑组件" />
  998. </el-form-item>
  999. <el-form-item label="图标:">
  1000. <div class="upload-placeholder-square" @click="triggerUpload('categoryIcon')">
  1001. <img v-if="categoryForm.icon" :src="categoryForm.icon" class="form-preview-img-square" />
  1002. <el-icon v-else class="upload-icon"><Plus /></el-icon>
  1003. </div>
  1004. <div class="upload-tip">推荐尺寸:16 * 16,支持上传透明背景 PNG</div>
  1005. </el-form-item>
  1006. <el-form-item label="同步分类:">
  1007. <el-select
  1008. v-model="categoryForm.syncCategory"
  1009. placeholder="请选择或输入关联的一级分类"
  1010. style="width: 100%"
  1011. filterable
  1012. allow-create
  1013. default-first-option
  1014. >
  1015. <el-option v-for="opt in syncCategoryOptions" :key="opt" :label="opt" :value="opt" />
  1016. </el-select>
  1017. </el-form-item>
  1018. <el-form-item label="标签设置:">
  1019. <div class="notes-config-list">
  1020. <div v-for="(tag, index) in categoryForm.tags" :key="index" class="note-config-row">
  1021. <el-input v-model="tag.name" placeholder="标签名称" style="width: 120px" />
  1022. <el-input v-model="tag.link" placeholder="跳转地址" style="flex: 1" />
  1023. <el-button type="danger" icon="Delete" circle plain size="small" @click="removeCategoryTag(index)" />
  1024. </div>
  1025. <el-button type="primary" icon="Plus" link @click="addCategoryTag">添加标签</el-button>
  1026. </div>
  1027. <div class="field-tip">用于在右滑面板顶部显示的业务标签,支持配置独立跳转地址</div>
  1028. </el-form-item>
  1029. <el-form-item label="启用状态:">
  1030. <el-switch v-model="categoryForm.status" :active-value="1" :inactive-value="0" active-color="#13ce66" />
  1031. </el-form-item>
  1032. </el-tab-pane>
  1033. <el-tab-pane label="右滑面板配置">
  1034. <div class="panel-config-section">
  1035. <div class="config-subtitle">品牌位设置 (图3)</div>
  1036. <el-row :gutter="20">
  1037. <el-col :span="12">
  1038. <el-form-item label="主标题:">
  1039. <el-input v-model="categoryForm.panelData.mainTitle" placeholder="如:京东" />
  1040. </el-form-item>
  1041. </el-col>
  1042. <el-col :span="12">
  1043. <el-form-item label="副标题:">
  1044. <el-input v-model="categoryForm.panelData.subTitle" placeholder="如:3C数码" />
  1045. </el-form-item>
  1046. </el-col>
  1047. </el-row>
  1048. <el-form-item label="便签列表:">
  1049. <div class="notes-config-list">
  1050. <div v-for="(note, index) in categoryForm.panelData.notes" :key="index" class="note-config-row">
  1051. <el-input v-model="note.name" placeholder="便签名称" style="width: 120px" />
  1052. <el-input v-model="note.link" placeholder="跳转地址" style="flex: 1" />
  1053. <el-button type="danger" icon="Delete" circle plain size="small" @click="removePanelNote(index)" />
  1054. </div>
  1055. <el-button type="primary" icon="Plus" link @click="addPanelNote">添加便签</el-button>
  1056. </div>
  1057. </el-form-item>
  1058. </div>
  1059. <div class="panel-config-section m-t-20">
  1060. <div class="config-subtitle">分类分组设置</div>
  1061. <div class="field-tip">目前支持在代码中静态配置,弹窗界面待进一步完善。</div>
  1062. </div>
  1063. </el-tab-pane>
  1064. </el-tabs>
  1065. </el-form>
  1066. <template #footer>
  1067. <el-button @click="categoryDialogVisible = false">取消</el-button>
  1068. <el-button type="primary" @click="submitCategoryForm">确定保存</el-button>
  1069. </template>
  1070. </el-dialog>
  1071. <!-- 头部分类编辑弹窗 -->
  1072. <el-dialog v-model="headerDialogVisible" :title="headerEditIndex > -1 ? '编辑头部分类' : '新增头部分类'" width="600px" destroy-on-close>
  1073. <el-form :model="headerForm" label-width="100px" class="dialog-form-inner">
  1074. <el-form-item label="分类名称:">
  1075. <el-input v-model="headerForm.title" placeholder="如:公共采购" />
  1076. </el-form-item>
  1077. <el-form-item label="分类图标:">
  1078. <div class="upload-placeholder-square" @click="triggerUpload('headerIcon')">
  1079. <img v-if="headerForm.icon" :src="headerForm.icon" class="form-preview-img-square" style="width: 20px; height: 20px" />
  1080. <el-icon v-else class="upload-icon"><Plus /></el-icon>
  1081. </div>
  1082. <div class="upload-tip">建议尺寸:20*20,透明背景 PNG</div>
  1083. </el-form-item>
  1084. <el-form-item label="跳转地址:">
  1085. <el-input v-model="headerForm.link" placeholder="请输入跳转链接" />
  1086. </el-form-item>
  1087. <el-form-item label="打开方式:">
  1088. <el-radio-group v-model="headerForm.openMode">
  1089. <el-radio label="current">当前页</el-radio>
  1090. <el-radio label="new">新窗口</el-radio>
  1091. </el-radio-group>
  1092. </el-form-item>
  1093. <el-form-item label="启用状态:">
  1094. <el-switch v-model="headerForm.status" :active-value="1" :inactive-value="0" active-color="#13ce66" />
  1095. </el-form-item>
  1096. </el-form>
  1097. <template #footer>
  1098. <el-button @click="headerDialogVisible = false">取消</el-button>
  1099. <el-button type="primary" @click="submitHeaderForm">确定保存</el-button>
  1100. </template>
  1101. </el-dialog>
  1102. <!-- 场景方案编辑弹窗 -->
  1103. <!-- 已选商品管理抽屉 (占据 45% 屏幕) -->
  1104. <el-drawer
  1105. v-model="selectedProductDialogVisible"
  1106. :title="`已选商品管理 - ${recommendList[currentRecommendIndex]?.name}`"
  1107. size="45%"
  1108. direction="rtl"
  1109. custom-class="selected-products-drawer"
  1110. destroy-on-close
  1111. >
  1112. <div class="drawer-content-wrapper">
  1113. <div class="selected-products-header">
  1114. <div class="left-actions">
  1115. <el-button type="primary" icon="Plus" @click="openProductDrawer">添加商品</el-button>
  1116. <el-button
  1117. type="danger"
  1118. plain
  1119. icon="Delete"
  1120. :disabled="!recommendList[currentRecommendIndex]?.selectedProducts?.length"
  1121. @click="batchRemoveSelectedProducts"
  1122. >批量移除</el-button
  1123. >
  1124. </div>
  1125. <div class="right-info">
  1126. 共 <span class="count">{{ recommendList[currentRecommendIndex]?.selectedProducts?.length || 0 }}</span> 个商品
  1127. </div>
  1128. </div>
  1129. <el-table
  1130. ref="selectedProductsTableRef"
  1131. :data="pagedSelectedProducts"
  1132. border
  1133. height="calc(100vh - 280px)"
  1134. style="width: 100%"
  1135. header-cell-class-name="table-header-custom"
  1136. class="standard-table"
  1137. >
  1138. <el-table-column type="selection" width="55" align="center" />
  1139. <el-table-column label="商品图片" width="100" align="center">
  1140. <template #default="{ row }">
  1141. <el-image :src="row.image" style="width: 50px; height: 50px; border-radius: 4px; border: 1px solid #f0f0f0" fit="contain" />
  1142. </template>
  1143. </el-table-column>
  1144. <el-table-column prop="name" label="商品名称" min-width="250" show-overflow-tooltip />
  1145. <el-table-column prop="id" label="商品ID" width="120" align="center" />
  1146. <el-table-column label="单价" width="120" align="center">
  1147. <template #default="{ row }">
  1148. <span class="price-text">¥{{ row.price }}</span>
  1149. </template>
  1150. </el-table-column>
  1151. <el-table-column label="操作" width="100" align="center" fixed="right">
  1152. <template #default="{ $index }">
  1153. <el-button type="danger" link @click="removeSelectedProduct($index)">移除</el-button>
  1154. </template>
  1155. </el-table-column>
  1156. <template #empty>
  1157. <div class="empty-placeholder">
  1158. <el-empty description="暂未添加任何商品" :image-size="160">
  1159. <el-button type="primary" size="large" @click="openProductDrawer">去添加商品</el-button>
  1160. </el-empty>
  1161. </div>
  1162. </template>
  1163. </el-table>
  1164. <div class="drawer-pagination">
  1165. <el-pagination
  1166. v-model:current-page="selectedCurrentPage"
  1167. v-model:page-size="selectedPageSize"
  1168. :total="recommendList[currentRecommendIndex]?.selectedProducts?.length || 0"
  1169. :page-sizes="[10, 20, 50, 100]"
  1170. layout="total, sizes, prev, pager, next, jumper"
  1171. background
  1172. />
  1173. </div>
  1174. </div>
  1175. <template #footer>
  1176. <div class="drawer-footer-actions">
  1177. <el-button @click="selectedProductDialogVisible = false">取消</el-button>
  1178. <el-button type="primary" @click="submitSelectedProducts">确定保存</el-button>
  1179. </div>
  1180. </template>
  1181. </el-drawer>
  1182. <!-- 商品多选选择抽屉 (占据 1/3 屏幕) -->
  1183. <el-drawer
  1184. v-model="productSelectionDrawerVisible"
  1185. title="从商品库选择商品"
  1186. size="45%"
  1187. direction="rtl"
  1188. destroy-on-close
  1189. custom-class="product-selection-drawer"
  1190. >
  1191. <div class="drawer-content-wrapper">
  1192. <div class="drawer-search-bar">
  1193. <el-input v-model="productQueryParams.itemName" placeholder="输入商品名称或ID搜索" prefix-icon="Search" clearable @input="getProductList" />
  1194. </div>
  1195. <div class="drawer-stat-bar">
  1196. <el-icon class="info-icon"><InfoFilled /></el-icon>
  1197. <span
  1198. >已勾选 <span class="highlight">{{ drawerSelection.length }}</span> 个商品</span
  1199. >
  1200. </div>
  1201. <el-table
  1202. ref="drawerTableRef"
  1203. :data="pagedSelectList"
  1204. border
  1205. height="calc(100vh - 280px)"
  1206. style="width: 100%"
  1207. row-key="id"
  1208. @selection-change="handleDrawerSelectionChange"
  1209. >
  1210. <el-table-column type="selection" width="50" align="center" :reserve-selection="true" />
  1211. <el-table-column label="商品信息" min-width="200">
  1212. <template #default="{ row }">
  1213. <div class="drawer-product-info">
  1214. <el-image :src="row.image" class="mini-img" fit="contain" />
  1215. <div class="detail">
  1216. <div class="name">{{ row.name }}</div>
  1217. <div class="id">ID: {{ row.id }}</div>
  1218. <div class="price">¥{{ row.price }}</div>
  1219. </div>
  1220. </div>
  1221. </template>
  1222. </el-table-column>
  1223. </el-table>
  1224. <div class="drawer-pagination">
  1225. <el-pagination
  1226. v-model:current-page="selectCurrentPage"
  1227. v-model:page-size="selectPageSize"
  1228. :total="productTotal"
  1229. :page-sizes="[10, 20, 50, 100]"
  1230. layout="total, sizes, prev, pager, next, jumper"
  1231. background
  1232. @current-change="onProductPageChange"
  1233. @size-change="onProductPageSizeChange"
  1234. />
  1235. </div>
  1236. </div>
  1237. <template #footer>
  1238. <div class="drawer-footer-actions">
  1239. <el-button @click="productSelectionDrawerVisible = false">取消</el-button>
  1240. <el-button type="primary" :disabled="!drawerSelection.length" @click="confirmDrawerSelection"
  1241. >确认添加 ({{ drawerSelection.length }})</el-button
  1242. >
  1243. </div>
  1244. </template>
  1245. </el-drawer>
  1246. <el-dialog v-model="scenarioDialogVisible" title="编辑场景方案卡片" width="600px" destroy-on-close>
  1247. <el-form :model="scenarioForm" label-width="100px" class="dialog-form-inner">
  1248. <el-form-item label="主标题:">
  1249. <div class="flex-center gap-10">
  1250. <el-input v-model="scenarioForm.title" style="width: 200px" />
  1251. <div class="theme-color-setting-pro">
  1252. <el-color-picker v-model="scenarioForm.titleColor" />
  1253. <span class="value">{{ scenarioForm.titleColor }}</span>
  1254. </div>
  1255. </div>
  1256. </el-form-item>
  1257. <el-form-item label="副标题:">
  1258. <div class="flex-center gap-10">
  1259. <el-input v-model="scenarioForm.subTitle" style="width: 200px" />
  1260. <div class="theme-color-setting-pro">
  1261. <el-color-picker v-model="scenarioForm.subTitleColor" />
  1262. <span class="value">{{ scenarioForm.subTitleColor }}</span>
  1263. </div>
  1264. </div>
  1265. </el-form-item>
  1266. <el-form-item label="卡片背景:">
  1267. <div class="flex-center gap-10">
  1268. <div class="theme-color-setting-pro">
  1269. <el-color-picker v-model="scenarioForm.bgColor" />
  1270. <span class="value">{{ scenarioForm.bgColor }}</span>
  1271. </div>
  1272. <span class="text-gray m-l-10">不透明度:</span>
  1273. <el-slider v-model="scenarioForm.opacity" :min="0" :max="1" :step="0.05" style="width: 120px" />
  1274. <span class="value m-l-5">{{ Math.round(scenarioForm.opacity * 100) }}%</span>
  1275. </div>
  1276. </el-form-item>
  1277. <el-form-item label="封面图片:">
  1278. <div class="upload-placeholder-square" style="width: 272px; height: 80px" @click="triggerUpload('scenarioImg')">
  1279. <img v-if="scenarioForm.image" :src="scenarioForm.image" style="width: 100%; height: 100%; object-fit: cover" />
  1280. <el-icon v-else class="upload-icon"><Plus /></el-icon>
  1281. </div>
  1282. <div class="upload-tip">建议尺寸:272 * 80</div>
  1283. </el-form-item>
  1284. <el-form-item label="跳转链接:">
  1285. <el-input v-model="scenarioForm.link" placeholder="请输入跳转地址" />
  1286. </el-form-item>
  1287. </el-form>
  1288. <template #footer>
  1289. <el-button @click="scenarioDialogVisible = false">取消</el-button>
  1290. <el-button type="primary" @click="submitScenarioForm">保存修改</el-button>
  1291. </template>
  1292. </el-dialog>
  1293. <!-- 推荐设置编辑弹窗 -->
  1294. <el-dialog v-model="recommendDialogVisible" :title="recommendEditIndex > -1 ? '修改推荐分类' : '新增推荐分类'" width="600px" destroy-on-close>
  1295. <el-form :model="recommendForm" label-width="110px" class="dialog-form-inner">
  1296. <el-form-item label="主标题:">
  1297. <el-input v-model="recommendForm.name" placeholder="请输入分类名称" maxlength="6" show-word-limit />
  1298. </el-form-item>
  1299. <el-form-item label="副标题:">
  1300. <el-input v-model="recommendForm.subTitle" placeholder="请输入副标题" maxlength="12" show-word-limit />
  1301. </el-form-item>
  1302. <el-form-item label="分类图标:">
  1303. <div class="upload-placeholder-square" style="width: 64px; height: 64px" @click="triggerUpload('recommendIcon')">
  1304. <img v-if="recommendForm.icon" :src="recommendForm.icon" style="width: 100%; height: 100%; object-fit: contain" />
  1305. <el-icon v-else class="upload-icon"><Plus /></el-icon>
  1306. </div>
  1307. <div class="upload-tip">建议尺寸:32 * 32,透明背景 PNG</div>
  1308. </el-form-item>
  1309. <el-form-item label="数据类型:">
  1310. <el-radio-group v-model="recommendForm.type">
  1311. <el-radio label="select">商品自选</el-radio>
  1312. <el-radio label="category">分类映射</el-radio>
  1313. </el-radio-group>
  1314. </el-form-item>
  1315. <el-form-item v-if="recommendForm.type === 'category'" label="映射分类:">
  1316. <el-cascader
  1317. v-model="recommendForm.categoryValue"
  1318. :options="mockCategoryOptions"
  1319. :props="{ checkStrictly: true, expandTrigger: 'hover' }"
  1320. placeholder="请选择一级/二级/三级分类"
  1321. style="width: 100%"
  1322. filterable
  1323. clearable
  1324. @change="handleRecommendCategoryChange"
  1325. />
  1326. <div class="field-tip">选择后,该页签将自动抓取对应分类下的最新商品</div>
  1327. </el-form-item>
  1328. <el-form-item label="启用状态:">
  1329. <el-switch v-model="recommendForm.status" :active-value="1" :inactive-value="0" active-color="#13ce66" />
  1330. </el-form-item>
  1331. </el-form>
  1332. <template #footer>
  1333. <el-button @click="recommendDialogVisible = false">取消</el-button>
  1334. <el-button type="primary" @click="submitRecommendForm">保存设置</el-button>
  1335. </template>
  1336. </el-dialog>
  1337. <!-- 快捷入口编辑弹窗 -->
  1338. <el-dialog
  1339. v-model="quickEntryDialogVisible"
  1340. :title="quickEntryDialogType === 'add' ? '新增快捷入口' : '编辑快捷入口'"
  1341. width="600px"
  1342. append-to-body
  1343. destroy-on-close
  1344. >
  1345. <el-form :model="quickEntryForm" label-width="100px" class="dialog-form-inner">
  1346. <el-form-item label="入口名称:">
  1347. <el-input v-model="quickEntryForm.name" placeholder="请输入入口名称(建议4-5个字)" maxlength="6" show-word-limit />
  1348. </el-form-item>
  1349. <el-form-item label="图标:">
  1350. <div class="upload-placeholder-square" @click="triggerUpload('quickEntryIcon')">
  1351. <img v-if="quickEntryForm.icon" :src="quickEntryForm.icon" class="form-preview-img-square" style="width: 24px; height: 24px" />
  1352. <el-icon v-else class="upload-icon"><Plus /></el-icon>
  1353. </div>
  1354. <div class="upload-tip">建议尺寸: 48*48, 格式: PNG/SVG</div>
  1355. </el-form-item>
  1356. <el-form-item label="标签文字:">
  1357. <el-input v-model="quickEntryForm.tag" placeholder="如:返100" maxlength="4" style="width: 200px" />
  1358. <div class="field-tip">显示在图标右上角的红色气泡,留空则不显示</div>
  1359. </el-form-item>
  1360. <el-form-item label="跳转地址:">
  1361. <el-input v-model="quickEntryForm.link" placeholder="请输入跳转地址" />
  1362. </el-form-item>
  1363. <el-form-item label="启用状态:">
  1364. <el-switch v-model="quickEntryForm.status" :active-value="1" :inactive-value="0" />
  1365. </el-form-item>
  1366. </el-form>
  1367. <template #footer>
  1368. <el-button @click="quickEntryDialogVisible = false">取消</el-button>
  1369. <el-button type="primary" @click="submitQuickEntryForm">确定</el-button>
  1370. </template>
  1371. </el-dialog>
  1372. <!-- 底部固定操作栏 -->
  1373. <div class="footer-actions">
  1374. <el-button type="primary" class="btn-confirm" @click="handleMainSave">保存当前页配置</el-button>
  1375. </div>
  1376. <!-- 隐藏的文件选择框 -->
  1377. <input type="file" ref="fileInput" style="display: none" accept="image/*" @change="onFileChange" />
  1378. </div>
  1379. </template>
  1380. <script lang="ts" setup>
  1381. import { ref, reactive, computed, watch, onMounted, onUnmounted, nextTick } from 'vue';
  1382. import { ElMessage, ElMessageBox } from 'element-plus';
  1383. import {
  1384. listSearchConfig,
  1385. getSearchConfig,
  1386. delSearchConfig,
  1387. addSearchConfig,
  1388. updateSearchConfig,
  1389. getCurrentSearchConfig
  1390. } from '@/api/enterprisePurchase/searchConfig';
  1391. import { SearchConfigVO, SearchConfigQuery, SearchConfigForm } from '@/api/enterprisePurchase/searchConfig/types';
  1392. import { listAdLeft, getAdLeft, delAdLeft, addAdLeft, updateAdLeft, getCurrentAdLeft } from '@/api/enterprisePurchase/adLeft';
  1393. import { AdLeftVO, AdLeftQuery, AdLeftForm } from '@/api/enterprisePurchase/adLeft/types';
  1394. import { listCarousel, getCarousel, delCarousel, addCarousel, updateCarousel } from '@/api/enterprisePurchase/carousel';
  1395. import { CarouselVO, CarouselQuery, CarouselForm } from '@/api/enterprisePurchase/carousel/types';
  1396. import { listCategoryMain, getCategoryMain, delCategoryMain, addCategoryMain, updateCategoryMain } from '@/api/enterprisePurchase/categoryMain';
  1397. import { CategoryMainVO, CategoryMainQuery, CategoryMainForm } from '@/api/enterprisePurchase/categoryMain/types';
  1398. import { listScenarioCards, getScenarioCards, delScenarioCards, addScenarioCards, updateScenarioCards } from '@/api/enterprisePurchase/scenarioCards';
  1399. import { ScenarioCardsVO, ScenarioCardsQuery, ScenarioCardsForm } from '@/api/enterprisePurchase/scenarioCards/types';
  1400. import { listScenarioGlobalSettings, addScenarioGlobalSettings, updateScenarioGlobalSettings } from '@/api/enterprisePurchase/scenarioGlobalSettings';
  1401. import { ScenarioGlobalSettingsForm } from '@/api/enterprisePurchase/scenarioGlobalSettings/types';
  1402. import { listQuickEntryModule, addQuickEntryModule, updateQuickEntryModule } from '@/api/enterprisePurchase/quickEntryModule';
  1403. import { QuickEntryModuleVO, QuickEntryModuleQuery, QuickEntryModuleForm } from '@/api/enterprisePurchase/quickEntryModule/types';
  1404. import {
  1405. listQuickEntryItems,
  1406. getQuickEntryItems,
  1407. delQuickEntryItems,
  1408. addQuickEntryItems,
  1409. updateQuickEntryItems
  1410. } from '@/api/enterprisePurchase/quickEntryItems';
  1411. import { QuickEntryItemsVO, QuickEntryItemsQuery, QuickEntryItemsForm } from '@/api/enterprisePurchase/quickEntryItems/types';
  1412. import { listBase } from '@/api/pmsProduct/base';
  1413. import { listBrand } from '@/api/product/brand';
  1414. import {
  1415. listAdModuleConfig,
  1416. getAdModuleConfig,
  1417. delAdModuleConfig,
  1418. addAdModuleConfig,
  1419. updateAdModuleConfig
  1420. } from '@/api/enterprisePurchase/adModuleConfig';
  1421. import { AdModuleConfigVO, AdModuleConfigQuery, AdModuleConfigForm } from '@/api/enterprisePurchase/adModuleConfig/types';
  1422. import {
  1423. listHeaderCategory,
  1424. getHeaderCategory,
  1425. delHeaderCategory,
  1426. addHeaderCategory,
  1427. updateHeaderCategory
  1428. } from '@/api/enterprisePurchase/headerCategory';
  1429. import { HeaderCategoryVO, HeaderCategoryQuery, HeaderCategoryForm } from '@/api/enterprisePurchase/headerCategory/types';
  1430. import {
  1431. ShoppingCart,
  1432. Plus,
  1433. Edit,
  1434. Delete,
  1435. Picture,
  1436. CaretTop,
  1437. CaretBottom,
  1438. Menu,
  1439. ArrowLeft,
  1440. ArrowRight,
  1441. Search,
  1442. InfoFilled,
  1443. ArrowUp,
  1444. ArrowDown
  1445. } from '@element-plus/icons-vue';
  1446. const defaultPlaceholder =
  1447. 'data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMTAwIiBoZWlnaHQ9IjEwMCIgdmlld0JveD0iMCAwIDEwMCAxMDAiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyI+PHJlY3Qgd2lkdGg9IjEwMCIgaGVpZ2h0PSIxMDAiIGZpbGw9IiNmMmYyZjIiLz48dGV4dCB4PSI1MCUiIHk9IjUwJSIgZG9taW5hbnQtYmFzZWxpbmU9Im1pZGRsZSIgdGV4dC1hbmNob3I9Im1pZGRsZSIgZm9udC1zaXplPSIxMiIgZmlsbD0iI2JmYmZiZiI+5pys5peg5Zu+54mHPC90ZXh0Pjwvc3ZnPg==';
  1448. // 基础导航状态
  1449. const activeSubTab = ref('search');
  1450. const subTabs = [
  1451. { label: '搜索栏', value: 'search' },
  1452. { label: '广告图', value: 'carousel' },
  1453. { label: '分类设置', value: 'category' },
  1454. { label: '头部分类', value: 'headerCategory' },
  1455. { label: '广告模块', value: 'ad-module' },
  1456. { label: '快捷入口', value: 'quick-entry' },
  1457. { label: '场景方案', value: 'scenario' },
  1458. { label: '推荐设置', value: 'recommend' }
  1459. ];
  1460. // 首页核心配置表单 (搜索栏与基本设置)
  1461. const form = reactive({
  1462. id: null,
  1463. mainTitle: '',
  1464. subTitle: '',
  1465. placeholderText: '',
  1466. hotWordsList: [{ name: '', link: '' }],
  1467. themeColor: '',
  1468. rightBtnIcon: '',
  1469. rightBtnText: '',
  1470. rightBtnLink: '',
  1471. leftAdImage: '',
  1472. leftAdLink: ''
  1473. });
  1474. // 左侧广告配置ID(单例)
  1475. const leftAdId = ref<string | number>('');
  1476. // 保存配置
  1477. const handleMainSave = async () => {
  1478. try {
  1479. let res;
  1480. if (activeSubTab.value == 'search') {
  1481. // 构建提交数据,过滤空的热词
  1482. const submitData = {
  1483. ...form,
  1484. hotWordList: form.hotWordsList.filter((item) => item.name && item.name.trim() !== '')
  1485. };
  1486. // 无ID则新增
  1487. res = await addSearchConfig(submitData);
  1488. if (res.code === 200) {
  1489. ElMessage.success('配置保存成功');
  1490. // 如果是新增,保存返回的ID
  1491. if (!form.id && res.data) {
  1492. form.id = res.data.id;
  1493. }
  1494. // 重新获取最新配置
  1495. await getCurrentSearch();
  1496. } else {
  1497. ElMessage.error(res.msg || '保存失败');
  1498. }
  1499. } else if (activeSubTab.value == 'carousel') {
  1500. saveLeftAdConfig();
  1501. } else if (activeSubTab.value == 'scenario') {
  1502. saveScenarioGlobalSettings();
  1503. } else if (activeSubTab.value == 'quick-entry') {
  1504. saveQuickEntryModule();
  1505. }
  1506. } catch (error) {
  1507. console.error('保存配置失败:', error);
  1508. ElMessage.error('保存配置失败');
  1509. }
  1510. };
  1511. // 获取当前配置
  1512. const getCurrentAdLeftBtn = async () => {
  1513. try {
  1514. const res = await getCurrentAdLeft();
  1515. if (res.code === 200 && res.data) {
  1516. // 回显数据到表单
  1517. form.id = res.data.id || null;
  1518. form.leftAdImage = res.data.imageUrl || '';
  1519. form.leftAdLink = res.data.link || '';
  1520. }
  1521. } catch (error) {
  1522. console.error('获取配置失败:', error);
  1523. ElMessage.error('获取配置失败');
  1524. }
  1525. };
  1526. // 获取当前配置
  1527. const getCurrentSearch = async () => {
  1528. try {
  1529. const res = await getCurrentSearchConfig();
  1530. if (res.code === 200 && res.data) {
  1531. // 回显数据到表单
  1532. form.id = res.data.id || null;
  1533. form.mainTitle = res.data.mainTitle || '';
  1534. form.subTitle = res.data.subTitle || '';
  1535. form.placeholderText = res.data.placeholderText || '';
  1536. form.themeColor = res.data.themeColor || '';
  1537. form.rightBtnIcon = res.data.rightBtnIcon || '';
  1538. form.rightBtnText = res.data.rightBtnText || '';
  1539. form.rightBtnLink = res.data.rightBtnLink || '';
  1540. form.leftAdImage = res.data.leftAdImage || '';
  1541. form.leftAdLink = res.data.leftAdLink || '';
  1542. // 处理热词列表
  1543. if (res.data.hotWordList && Array.isArray(res.data.hotWordList)) {
  1544. form.hotWordsList =
  1545. res.data.hotWordList.length > 0
  1546. ? res.data.hotWordList.map((item) => ({
  1547. name: item.name || '',
  1548. link: item.link || ''
  1549. }))
  1550. : [{ name: '', link: '' }];
  1551. } else {
  1552. form.hotWordsList = [{ name: '', link: '' }];
  1553. }
  1554. }
  1555. } catch (error) {
  1556. console.error('获取配置失败:', error);
  1557. ElMessage.error('获取配置失败');
  1558. }
  1559. };
  1560. const handleMainReset = () => {
  1561. ElMessageBox.confirm('确定要重置当前页面的所有修改吗?', '提示', {
  1562. confirmButtonText: '确定重置',
  1563. cancelButtonText: '取消',
  1564. type: 'warning'
  1565. }).then(() => {
  1566. ElMessage.info('已还原至初始状态');
  1567. });
  1568. };
  1569. // 搜索栏逻辑
  1570. const currentPlaceholderIndex = ref(0);
  1571. let timer = null;
  1572. const searchPlaceholderList = computed(() => {
  1573. return form.placeholderText
  1574. .split(',')
  1575. .map((t) => t.trim())
  1576. .filter((t) => t !== '');
  1577. });
  1578. const addHotWord = () => {
  1579. form.hotWordsList.push({ name: '', link: '' });
  1580. };
  1581. const removeHotWord = (index) => {
  1582. form.hotWordsList.splice(index, 1);
  1583. };
  1584. const startPlaceholderScroll = () => {
  1585. if (timer) clearInterval(timer);
  1586. if (searchPlaceholderList.value.length <= 1) return;
  1587. timer = setInterval(() => {
  1588. currentPlaceholderIndex.value = (currentPlaceholderIndex.value + 1) % searchPlaceholderList.value.length;
  1589. }, 3000);
  1590. };
  1591. // 广告图模块逻辑
  1592. const leftAdHover = ref(false);
  1593. const carouselList = ref<CarouselVO[]>([]);
  1594. // 获取轮播图列表
  1595. const getCarouselList = async () => {
  1596. try {
  1597. const res = await listCarousel();
  1598. if (res.code === 200 && res.rows) {
  1599. carouselList.value = res.rows.map((item: CarouselVO) => ({
  1600. ...item,
  1601. image: item.imageUrl || ''
  1602. }));
  1603. }
  1604. } catch (error) {
  1605. console.error('获取轮播图列表失败:', error);
  1606. ElMessage.error('获取轮播图列表失败');
  1607. }
  1608. };
  1609. const activeCarouselList = computed(() => {
  1610. return carouselList.value.filter((item) => item.status === 1);
  1611. });
  1612. // 轮播图弹窗逻辑
  1613. const dialogVisible = ref(false);
  1614. const dialogType = ref('add'); // add | edit
  1615. const currentEditIndex = ref(-1);
  1616. const carouselForm = reactive({
  1617. image: '',
  1618. link: '',
  1619. target: '_self',
  1620. status: 1
  1621. });
  1622. const handleAddCarousel = () => {
  1623. dialogType.value = 'add';
  1624. carouselForm.image = '';
  1625. carouselForm.link = '';
  1626. carouselForm.target = '_self';
  1627. carouselForm.status = 1;
  1628. dialogVisible.value = true;
  1629. };
  1630. const handleEditCarousel = (row) => {
  1631. dialogType.value = 'edit';
  1632. currentEditIndex.value = carouselList.value.findIndex((item) => item.id === row.id);
  1633. carouselForm.image = row.image;
  1634. carouselForm.link = row.link;
  1635. carouselForm.target = row.target;
  1636. carouselForm.status = row.status;
  1637. dialogVisible.value = true;
  1638. };
  1639. const submitCarouselForm = async () => {
  1640. if (!carouselForm.image) {
  1641. return ElMessage.warning('请先上传轮播图片');
  1642. }
  1643. const data: CarouselForm = {
  1644. imageUrl: carouselForm.image,
  1645. link: carouselForm.link,
  1646. target: carouselForm.target,
  1647. status: carouselForm.status,
  1648. sortOrder: carouselList.value.length
  1649. };
  1650. try {
  1651. if (dialogType.value === 'add') {
  1652. const res = await addCarousel(data);
  1653. if (res.code === 200) {
  1654. ElMessage.success('新增成功');
  1655. dialogVisible.value = false;
  1656. getCarouselList();
  1657. } else {
  1658. ElMessage.error(res.msg || '新增失败');
  1659. }
  1660. } else {
  1661. const id = carouselList.value[currentEditIndex.value]?.id;
  1662. const res = await updateCarousel({ ...data, id });
  1663. if (res.code === 200) {
  1664. ElMessage.success('修改成功');
  1665. dialogVisible.value = false;
  1666. getCarouselList();
  1667. } else {
  1668. ElMessage.error(res.msg || '修改失败');
  1669. }
  1670. }
  1671. } catch (error) {
  1672. console.error('操作失败:', error);
  1673. ElMessage.error('操作失败');
  1674. }
  1675. };
  1676. const handleRemoveCarousel = async (index: number) => {
  1677. const item = carouselList.value[index];
  1678. try {
  1679. await ElMessageBox.confirm('确定要删除该轮播图吗?', '提示', { type: 'warning' });
  1680. const res = await delCarousel(item.id);
  1681. if (res.code === 200) {
  1682. ElMessage.success('删除成功');
  1683. getCarouselList();
  1684. } else {
  1685. ElMessage.error(res.msg || '删除失败');
  1686. }
  1687. } catch (error) {
  1688. if (error !== 'cancel') {
  1689. console.error('删除失败:', error);
  1690. ElMessage.error('删除失败');
  1691. }
  1692. }
  1693. };
  1694. const moveRow = async (index: number, direction: number) => {
  1695. const newIndex = index + direction;
  1696. if (newIndex < 0 || newIndex >= carouselList.value.length) return;
  1697. const item = carouselList.value.splice(index, 1)[0];
  1698. carouselList.value.splice(newIndex, 0, item);
  1699. // 同步排序到后端
  1700. try {
  1701. const start = Math.min(index, newIndex);
  1702. const end = Math.max(index, newIndex);
  1703. for (let i = start; i <= end; i++) {
  1704. const row = carouselList.value[i];
  1705. await updateCarousel({
  1706. id: row.id,
  1707. imageUrl: row.image || row.imageUrl,
  1708. link: row.link,
  1709. target: row.target,
  1710. status: row.status,
  1711. sortOrder: i
  1712. });
  1713. }
  1714. } catch (error) {
  1715. console.error('排序更新失败:', error);
  1716. ElMessage.error('排序更新失败');
  1717. }
  1718. };
  1719. // 颜色转换工具:Hex 转 RGBA
  1720. const hexToRgba = (hex, opacity) => {
  1721. if (!hex) return `rgba(255, 255, 255, ${opacity})`;
  1722. let r = parseInt(hex.slice(1, 3), 16);
  1723. let g = parseInt(hex.slice(3, 5), 16);
  1724. let b = parseInt(hex.slice(5, 7), 16);
  1725. return `rgba(${r}, ${g}, ${b}, ${opacity})`;
  1726. };
  1727. const handleSelectSearch = () => {
  1728. // 模拟搜索过滤,computed 会自动处理
  1729. };
  1730. // 文件上传相关
  1731. const fileInput = ref(null);
  1732. const uploadTarget = ref(''); // 'leftAd' | 'carousel' | 'categoryIcon' | 'headerIcon'
  1733. const triggerUpload = (target) => {
  1734. uploadTarget.value = target;
  1735. fileInput.value.click();
  1736. };
  1737. const onFileChange = (e) => {
  1738. const file = e.target.files[0];
  1739. if (!file) return;
  1740. const reader = new FileReader();
  1741. reader.onload = (event) => {
  1742. const base64 = event.target.result;
  1743. if (uploadTarget.value === 'leftAd') {
  1744. form.leftAdImage = base64;
  1745. } else if (uploadTarget.value === 'carousel') {
  1746. carouselForm.image = base64;
  1747. } else if (uploadTarget.value === 'rightBtnIcon') {
  1748. form.rightBtnIcon = base64;
  1749. } else if (uploadTarget.value === 'categoryIcon') {
  1750. categoryForm.icon = base64;
  1751. } else if (uploadTarget.value === 'headerIcon') {
  1752. headerForm.icon = base64;
  1753. } else if (uploadTarget.value === 'scenarioImg') {
  1754. scenarioForm.image = base64;
  1755. } else if (uploadTarget.value === 'quickEntryIcon') {
  1756. quickEntryForm.icon = base64;
  1757. } else if (uploadTarget.value === 'recommendIcon') {
  1758. recommendForm.icon = base64;
  1759. }
  1760. ElMessage.success('图片上传成功');
  1761. e.target.value = '';
  1762. };
  1763. reader.readAsDataURL(file);
  1764. };
  1765. // ==================== 左侧广告单例配置 ====================
  1766. // 获取左侧广告配置
  1767. const fetchLeftAdConfig = async () => {
  1768. try {
  1769. const res = await listAdLeft({ pageNum: 1, pageSize: 1 });
  1770. if (res.code === 200 && res.rows && res.rows.length > 0) {
  1771. const adData = res.rows[0];
  1772. leftAdId.value = adData.id;
  1773. form.leftAdImage = adData.imageUrl || '';
  1774. form.leftAdLink = adData.link || '';
  1775. }
  1776. } catch (error) {
  1777. console.error('获取左侧广告配置失败:', error);
  1778. }
  1779. };
  1780. // 保存左侧广告配置
  1781. const saveLeftAdConfig = async () => {
  1782. try {
  1783. if (!form.leftAdImage) {
  1784. ElMessage.warning('请先上传广告图片');
  1785. return;
  1786. }
  1787. const submitData: AdLeftForm = {
  1788. id: leftAdId.value || undefined,
  1789. imageUrl: form.leftAdImage,
  1790. link: form.leftAdLink,
  1791. status: 1 // 默认启用
  1792. };
  1793. let res;
  1794. if (leftAdId.value) {
  1795. // 有ID则更新
  1796. res = await updateAdLeft(submitData);
  1797. } else {
  1798. // 无ID则新增
  1799. res = await addAdLeft(submitData);
  1800. }
  1801. if (res.code === 200) {
  1802. ElMessage.success('左侧广告保存成功');
  1803. // 如果是新增,保存返回的ID
  1804. if (!leftAdId.value && res.data) {
  1805. leftAdId.value = res.data.id;
  1806. }
  1807. // 重新获取最新配置
  1808. await fetchLeftAdConfig();
  1809. } else {
  1810. ElMessage.error(res.msg || '保存失败');
  1811. }
  1812. } catch (error) {
  1813. console.error('保存左侧广告失败:', error);
  1814. ElMessage.error('保存左侧广告失败');
  1815. }
  1816. };
  1817. // 删除左侧广告
  1818. const handleDeleteLeftAd = () => {
  1819. ElMessageBox.confirm('确定要删除左侧广告吗?', '提示', {
  1820. confirmButtonText: '确定删除',
  1821. cancelButtonText: '取消',
  1822. type: 'warning'
  1823. })
  1824. .then(async () => {
  1825. try {
  1826. if (leftAdId.value) {
  1827. const res = await delAdLeft(leftAdId.value);
  1828. if (res.code === 200) {
  1829. ElMessage.success('删除成功');
  1830. // 清空表单数据
  1831. leftAdId.value = '';
  1832. form.leftAdImage = '';
  1833. form.leftAdLink = '';
  1834. } else {
  1835. ElMessage.error(res.msg || '删除失败');
  1836. }
  1837. } else {
  1838. // 如果没有ID,直接清空表单
  1839. form.leftAdImage = '';
  1840. form.leftAdLink = '';
  1841. ElMessage.success('已清除');
  1842. }
  1843. } catch (error) {
  1844. console.error('删除左侧广告失败:', error);
  1845. ElMessage.error('删除失败');
  1846. }
  1847. })
  1848. .catch(() => {
  1849. // 用户取消操作
  1850. });
  1851. };
  1852. // 分类设置模块逻辑
  1853. const categoryThemeColor = ref('#e60012');
  1854. const syncCategoryOptions = ['办公电脑', '办公设备', '办公家电', '文具耗材', '日用百货', '工业品', '食品饮料', '车载用品', '运动户外'];
  1855. const categoryList = ref<CategoryMainVO[]>([]);
  1856. // 获取分类列表
  1857. const getCategoryList = async () => {
  1858. try {
  1859. const res = await listCategoryMain();
  1860. if (res.code === 200 && res.rows) {
  1861. categoryList.value = res.rows.map((item: CategoryMainVO) => {
  1862. let extra = { tags: [] as any[], notes: [] as any[], groups: [] as any[] };
  1863. try {
  1864. if ((item as any).remark) {
  1865. extra = JSON.parse((item as any).remark);
  1866. }
  1867. } catch (e) {
  1868. /* remark JSON 解析失败使用默认值 */
  1869. }
  1870. return {
  1871. ...item,
  1872. tags: extra.tags || [],
  1873. panelData: {
  1874. mainTitle: (item as any).panelMainTitle || '',
  1875. subTitle: (item as any).panelSubTitle || '',
  1876. notes: extra.notes || [],
  1877. groups: extra.groups || []
  1878. }
  1879. };
  1880. });
  1881. }
  1882. } catch (error) {
  1883. console.error('获取分类列表失败:', error);
  1884. ElMessage.error('获取分类列表失败');
  1885. }
  1886. };
  1887. const addCategoryTag = () => {
  1888. categoryForm.tags.push({ name: '', link: '' });
  1889. };
  1890. const removeCategoryTag = (index) => {
  1891. categoryForm.tags.splice(index, 1);
  1892. };
  1893. const categoryDialogVisible = ref(false);
  1894. const categoryDialogType = ref('add');
  1895. const categoryForm = reactive({
  1896. id: null,
  1897. name: '',
  1898. icon: '',
  1899. syncCategory: '',
  1900. tags: [],
  1901. status: 1,
  1902. panelData: {
  1903. mainTitle: '',
  1904. subTitle: '',
  1905. notes: [],
  1906. groups: []
  1907. }
  1908. });
  1909. const handleAddCategory = () => {
  1910. categoryDialogType.value = 'add';
  1911. Object.assign(categoryForm, {
  1912. id: null,
  1913. name: '',
  1914. icon: '',
  1915. syncCategory: '',
  1916. tags: [],
  1917. status: 1,
  1918. panelData: { mainTitle: '', subTitle: '', notes: [], groups: [] }
  1919. });
  1920. categoryDialogVisible.value = true;
  1921. };
  1922. const handleEditCategory = (row) => {
  1923. categoryDialogType.value = 'edit';
  1924. Object.assign(categoryForm, JSON.parse(JSON.stringify(row)));
  1925. categoryDialogVisible.value = true;
  1926. };
  1927. const submitCategoryForm = async () => {
  1928. if (!categoryForm.name) return ElMessage.warning('请输入菜单名称');
  1929. const data: CategoryMainForm = {
  1930. name: categoryForm.name,
  1931. icon: categoryForm.icon,
  1932. syncCategory: categoryForm.syncCategory,
  1933. status: categoryForm.status,
  1934. panelMainTitle: categoryForm.panelData.mainTitle,
  1935. panelSubTitle: categoryForm.panelData.subTitle,
  1936. remark: JSON.stringify({
  1937. tags: categoryForm.tags,
  1938. notes: categoryForm.panelData.notes,
  1939. groups: categoryForm.panelData.groups
  1940. })
  1941. };
  1942. try {
  1943. if (categoryDialogType.value === 'add') {
  1944. const res = await addCategoryMain(data);
  1945. if (res.code === 200) {
  1946. ElMessage.success('新增成功');
  1947. categoryDialogVisible.value = false;
  1948. getCategoryList();
  1949. } else {
  1950. ElMessage.error(res.msg || '新增失败');
  1951. }
  1952. } else {
  1953. const id = categoryForm.id;
  1954. const res = await updateCategoryMain({ ...data, id });
  1955. if (res.code === 200) {
  1956. ElMessage.success('修改成功');
  1957. categoryDialogVisible.value = false;
  1958. getCategoryList();
  1959. } else {
  1960. ElMessage.error(res.msg || '修改失败');
  1961. }
  1962. }
  1963. } catch (error) {
  1964. console.error('操作失败:', error);
  1965. ElMessage.error('操作失败');
  1966. }
  1967. };
  1968. // 场景方案模块逻辑
  1969. const scenarioSettings = reactive({
  1970. id: null as string | number | null,
  1971. mainTitle: '场景解决方案',
  1972. subTitle: '一站全买齐',
  1973. btnText: '进入全场景',
  1974. jumpLink: '',
  1975. themeColor: '#66e0a3'
  1976. });
  1977. // 获取场景全局设置
  1978. const getScenarioGlobalSettingsList = async () => {
  1979. try {
  1980. const res = await listScenarioGlobalSettings();
  1981. if (res.code === 200 && res.rows && res.rows.length > 0) {
  1982. const data = res.rows[0];
  1983. scenarioSettings.id = data.id;
  1984. scenarioSettings.mainTitle = data.mainTitle || '';
  1985. scenarioSettings.subTitle = data.subTitle || '';
  1986. scenarioSettings.btnText = data.btnText || '';
  1987. scenarioSettings.jumpLink = data.jumpLink || '';
  1988. scenarioSettings.themeColor = data.themeColor || '#66e0a3';
  1989. }
  1990. } catch (error) {
  1991. console.error('获取场景全局设置失败:', error);
  1992. ElMessage.error('获取场景全局设置失败');
  1993. }
  1994. };
  1995. // 保存场景全局设置
  1996. const saveScenarioGlobalSettings = async () => {
  1997. const data: ScenarioGlobalSettingsForm = {
  1998. mainTitle: scenarioSettings.mainTitle,
  1999. subTitle: scenarioSettings.subTitle,
  2000. btnText: scenarioSettings.btnText,
  2001. jumpLink: scenarioSettings.jumpLink,
  2002. themeColor: scenarioSettings.themeColor
  2003. };
  2004. try {
  2005. let res;
  2006. if (scenarioSettings.id) {
  2007. res = await updateScenarioGlobalSettings({ ...data, id: scenarioSettings.id });
  2008. } else {
  2009. res = await addScenarioGlobalSettings(data);
  2010. if (res.code === 200 && res.data) {
  2011. scenarioSettings.id = res.data.id;
  2012. }
  2013. }
  2014. if (res.code === 200) {
  2015. ElMessage.success('场景全局设置保存成功');
  2016. } else {
  2017. ElMessage.error(res.msg || '保存失败');
  2018. }
  2019. } catch (error) {
  2020. console.error('保存场景全局设置失败:', error);
  2021. ElMessage.error('保存失败');
  2022. }
  2023. };
  2024. const scenarioList = ref<ScenarioCardsVO[]>([]);
  2025. // 获取场景卡片列表
  2026. const getScenarioList = async () => {
  2027. try {
  2028. const res = await listScenarioCards();
  2029. if (res.code === 200 && res.rows) {
  2030. scenarioList.value = res.rows.map((item: ScenarioCardsVO) => {
  2031. let extra = { subTitleColor: '#333333', bgColor: '#ffffff', opacity: 1 };
  2032. try {
  2033. if ((item as any).remark) {
  2034. extra = { ...extra, ...JSON.parse((item as any).remark) };
  2035. }
  2036. } catch (e) {
  2037. /* remark JSON 解析失败使用默认值 */
  2038. }
  2039. return {
  2040. ...item,
  2041. image: (item as any).imageUrl || '',
  2042. link: (item as any).jumpLink || '',
  2043. subTitleColor: extra.subTitleColor,
  2044. bgColor: extra.bgColor,
  2045. opacity: extra.opacity
  2046. };
  2047. });
  2048. }
  2049. } catch (error) {
  2050. console.error('获取场景卡片列表失败:', error);
  2051. ElMessage.error('获取场景卡片列表失败');
  2052. }
  2053. };
  2054. const scenarioDialogVisible = ref(false);
  2055. const scenarioEditIndex = ref(-1);
  2056. const scenarioForm = reactive({
  2057. title: '',
  2058. titleColor: '#008b4e',
  2059. subTitle: '',
  2060. subTitleColor: '#333333',
  2061. image: '',
  2062. link: '',
  2063. bgColor: '#ffffff',
  2064. opacity: 1
  2065. });
  2066. const handleEditScenario = (row, index) => {
  2067. scenarioEditIndex.value = index;
  2068. Object.assign(scenarioForm, JSON.parse(JSON.stringify(row)));
  2069. scenarioDialogVisible.value = true;
  2070. };
  2071. const submitScenarioForm = async () => {
  2072. const item = scenarioList.value[scenarioEditIndex.value];
  2073. if (!item) return;
  2074. const data: ScenarioCardsForm = {
  2075. id: item.id,
  2076. title: scenarioForm.title,
  2077. titleColor: scenarioForm.titleColor,
  2078. subTitle: scenarioForm.subTitle,
  2079. imageUrl: scenarioForm.image,
  2080. jumpLink: scenarioForm.link,
  2081. sortOrder: (item as any).sortOrder ?? scenarioEditIndex.value,
  2082. remark: JSON.stringify({
  2083. subTitleColor: scenarioForm.subTitleColor,
  2084. bgColor: scenarioForm.bgColor,
  2085. opacity: scenarioForm.opacity
  2086. })
  2087. };
  2088. try {
  2089. const res = await updateScenarioCards(data);
  2090. if (res.code === 200) {
  2091. ElMessage.success('方案修改成功');
  2092. scenarioDialogVisible.value = false;
  2093. getScenarioList();
  2094. } else {
  2095. ElMessage.error(res.msg || '修改失败');
  2096. }
  2097. } catch (error) {
  2098. console.error('修改失败:', error);
  2099. ElMessage.error('修改失败');
  2100. }
  2101. };
  2102. const moveScenario = async (index: number, direction: number) => {
  2103. const newIndex = index + direction;
  2104. if (newIndex < 0 || newIndex >= scenarioList.value.length) return;
  2105. const item = scenarioList.value.splice(index, 1)[0];
  2106. scenarioList.value.splice(newIndex, 0, item);
  2107. // 同步排序到后端
  2108. try {
  2109. const start = Math.min(index, newIndex);
  2110. const end = Math.max(index, newIndex);
  2111. for (let i = start; i <= end; i++) {
  2112. const row = scenarioList.value[i] as any;
  2113. await updateScenarioCards({
  2114. id: row.id,
  2115. title: row.title,
  2116. titleColor: row.titleColor,
  2117. subTitle: row.subTitle,
  2118. imageUrl: row.image || row.imageUrl,
  2119. jumpLink: row.link || row.jumpLink,
  2120. sortOrder: i,
  2121. remark: JSON.stringify({
  2122. subTitleColor: row.subTitleColor || '#333333',
  2123. bgColor: row.bgColor || '#ffffff',
  2124. opacity: row.opacity ?? 1
  2125. })
  2126. });
  2127. }
  2128. } catch (error) {
  2129. console.error('排序更新失败:', error);
  2130. ElMessage.error('排序更新失败');
  2131. }
  2132. };
  2133. const handleRemoveCategory = async (index: number) => {
  2134. const item = categoryList.value[index];
  2135. try {
  2136. await ElMessageBox.confirm('确定要删除该分类吗?', '提示');
  2137. const res = await delCategoryMain(item.id);
  2138. if (res.code === 200) {
  2139. ElMessage.success('删除成功');
  2140. getCategoryList();
  2141. } else {
  2142. ElMessage.error(res.msg || '删除失败');
  2143. }
  2144. } catch (error) {
  2145. if (error !== 'cancel') {
  2146. console.error('删除失败:', error);
  2147. ElMessage.error('删除失败');
  2148. }
  2149. }
  2150. };
  2151. const addPanelNote = () => {
  2152. categoryForm.panelData.notes.push({ name: '', link: '' });
  2153. };
  2154. const removePanelNote = (index) => {
  2155. categoryForm.panelData.notes.splice(index, 1);
  2156. };
  2157. const moveCategory = (index, direction) => {
  2158. const newIndex = index + direction;
  2159. if (newIndex < 0 || newIndex >= categoryList.value.length) return;
  2160. const item = categoryList.value.splice(index, 1)[0];
  2161. categoryList.value.splice(newIndex, 0, item);
  2162. };
  2163. onMounted(() => {
  2164. startPlaceholderScroll();
  2165. });
  2166. // 头部分类模块逻辑
  2167. const headerThemeColor = ref('#e60012');
  2168. const headerCategoryList = ref<HeaderCategoryVO[]>([]);
  2169. // 获取头部分类列表
  2170. const getHeaderCategoryList = async () => {
  2171. try {
  2172. const res = await listHeaderCategory();
  2173. if (res.code === 200 && res.rows) {
  2174. headerCategoryList.value = res.rows;
  2175. }
  2176. } catch (error) {
  2177. console.error('获取头部分类列表失败:', error);
  2178. ElMessage.error('获取头部分类列表失败');
  2179. }
  2180. };
  2181. const headerDialogVisible = ref(false);
  2182. const headerEditIndex = ref(-1);
  2183. const headerForm = reactive({ title: '', icon: '', link: '', openMode: 'current', status: 1 });
  2184. const handleAddHeaderCategory = () => {
  2185. headerEditIndex.value = -1;
  2186. Object.assign(headerForm, { title: '', icon: '', link: '', openMode: 'current', status: 1 });
  2187. headerDialogVisible.value = true;
  2188. };
  2189. const handleEditHeaderCategory = (row, index) => {
  2190. headerEditIndex.value = index;
  2191. Object.assign(headerForm, JSON.parse(JSON.stringify(row)));
  2192. headerDialogVisible.value = true;
  2193. };
  2194. const submitHeaderForm = async () => {
  2195. const data: HeaderCategoryForm = {
  2196. title: headerForm.title,
  2197. icon: headerForm.icon,
  2198. link: headerForm.link,
  2199. openMode: headerForm.openMode,
  2200. status: headerForm.status
  2201. };
  2202. try {
  2203. if (headerEditIndex.value > -1) {
  2204. const id = headerCategoryList.value[headerEditIndex.value]?.id;
  2205. const res = await updateHeaderCategory({ ...data, id });
  2206. if (res.code === 200) {
  2207. ElMessage.success('修改成功');
  2208. headerDialogVisible.value = false;
  2209. getHeaderCategoryList();
  2210. } else {
  2211. ElMessage.error(res.msg || '修改失败');
  2212. }
  2213. } else {
  2214. const res = await addHeaderCategory(data);
  2215. if (res.code === 200) {
  2216. ElMessage.success('新增成功');
  2217. headerDialogVisible.value = false;
  2218. getHeaderCategoryList();
  2219. } else {
  2220. ElMessage.error(res.msg || '新增失败');
  2221. }
  2222. }
  2223. } catch (error) {
  2224. console.error('操作失败:', error);
  2225. ElMessage.error('操作失败');
  2226. }
  2227. };
  2228. const handleDeleteHeaderCategory = async (index: number) => {
  2229. const item = headerCategoryList.value[index];
  2230. try {
  2231. await ElMessageBox.confirm('确定删除该分类吗?', '提示');
  2232. const res = await delHeaderCategory(item.id);
  2233. if (res.code === 200) {
  2234. ElMessage.success('删除成功');
  2235. getHeaderCategoryList();
  2236. } else {
  2237. ElMessage.error(res.msg || '删除失败');
  2238. }
  2239. } catch (error) {
  2240. if (error !== 'cancel') {
  2241. console.error('删除失败:', error);
  2242. ElMessage.error('删除失败');
  2243. }
  2244. }
  2245. };
  2246. const moveHeader = (index, delta) => {
  2247. const target = index + delta;
  2248. if (target < 0 || target >= headerCategoryList.value.length) return;
  2249. const temp = headerCategoryList.value[index];
  2250. headerCategoryList.value[index] = headerCategoryList.value[target];
  2251. headerCategoryList.value[target] = temp;
  2252. };
  2253. // 导航滚动逻辑
  2254. const headerNavScrollRef = ref(null);
  2255. const showLeftArrow = ref(false);
  2256. const showRightArrow = ref(false);
  2257. const updateNavArrows = () => {
  2258. if (!headerNavScrollRef.value) return;
  2259. const { scrollLeft, scrollWidth, clientWidth } = headerNavScrollRef.value;
  2260. showLeftArrow.value = scrollLeft > 5;
  2261. showRightArrow.value = scrollLeft + clientWidth < scrollWidth - 5;
  2262. };
  2263. const scrollHeaderNav = (direction) => {
  2264. const container = headerNavScrollRef.value;
  2265. if (!container) return;
  2266. const scrollAmount = 350;
  2267. if (direction === 'left') {
  2268. container.scrollLeft -= scrollAmount;
  2269. } else {
  2270. container.scrollLeft += scrollAmount;
  2271. }
  2272. };
  2273. // 广告模块逻辑
  2274. const adModules = ref([
  2275. {
  2276. id: 1,
  2277. title: '企业购x百亿补贴',
  2278. titleColor: '#333333',
  2279. subTitle: '先采后付 享底价',
  2280. subTitleColor: '#999999',
  2281. type: 'subsidy',
  2282. items: [
  2283. { id: 101, productName: '企业商用台式机', imageUrl: '/static/images/purchase/pc_desktop.jpg', price: '69.9' },
  2284. { id: 102, productName: '商务笔记本', imageUrl: '/static/images/purchase/laptop_hp.jpg', price: '84.8' },
  2285. { id: 103, productName: '智能打印机', imageUrl: '/static/images/purchase/printer_office.jpg', price: '139.9' },
  2286. { id: 104, productName: '高效办公组网', imageUrl: '/static/images/purchase/network_router.jpg', price: '1749' }
  2287. ]
  2288. },
  2289. {
  2290. id: 2,
  2291. title: '企采榜单',
  2292. titleColor: '#333333',
  2293. subTitle: '同行都在买',
  2294. subTitleColor: '#f58220',
  2295. type: 'ranking',
  2296. items: [
  2297. {
  2298. id: 201,
  2299. productName: '办公电脑榜',
  2300. imageUrl: '/static/images/purchase/laptop_lenovo.jpg',
  2301. price: '0',
  2302. tagText: '办公电脑榜',
  2303. tagLink: '',
  2304. salesCount: '1543'
  2305. },
  2306. {
  2307. id: 202,
  2308. productName: '文具榜',
  2309. imageUrl: '/static/images/purchase/stationery_ranking.jpg',
  2310. price: '0',
  2311. tagText: '文具榜',
  2312. tagLink: '',
  2313. salesCount: '1200'
  2314. }
  2315. ]
  2316. },
  2317. {
  2318. id: 3,
  2319. title: '品牌好店',
  2320. titleColor: '#333333',
  2321. subTitle: '返2000元E卡',
  2322. subTitleColor: '#f58220',
  2323. type: 'brand',
  2324. items: [
  2325. { id: 301, productName: '鲁花', imageUrl: '/static/images/purchase/oil_luhua.jpg', tagText: '品质保障', tagLink: '鲁花京东自营旗舰店' },
  2326. { id: 302, productName: '金龙鱼', imageUrl: '/static/images/purchase/oil_jinlongyu.jpg', tagText: '热销品牌', tagLink: '金龙鱼京东自营旗舰店' }
  2327. ]
  2328. },
  2329. {
  2330. id: 4,
  2331. title: '企业精选',
  2332. titleColor: '#333333',
  2333. subTitle: '品牌专供 库存充足',
  2334. subTitleColor: '#999999',
  2335. type: 'selection',
  2336. items: [
  2337. { id: 401, productName: '高性能工作站', imageUrl: '/static/images/purchase/pc_desktop.jpg', price: '10740' },
  2338. { id: 402, productName: '办公咖啡机', imageUrl: '/static/images/purchase/coffee_machine.jpg', price: '877' }
  2339. ]
  2340. },
  2341. {
  2342. id: 5,
  2343. title: '企业购x京东新品',
  2344. titleColor: '#333333',
  2345. subTitle: '美的新鲜',
  2346. subTitleColor: '#f58220',
  2347. type: 'new',
  2348. items: [
  2349. { id: 501, productName: '商用冷柜', imageUrl: '/static/images/purchase/freezer.jpg', price: '7188' },
  2350. { id: 502, productName: '得力笔记本', imageUrl: '/static/images/purchase/notebook_deli.jpg', price: '34.9' }
  2351. ]
  2352. }
  2353. ]);
  2354. const adDialogVisible = ref(false);
  2355. const currentAdIdx = ref(-1);
  2356. const currentItemIdx = ref(-1);
  2357. const adForm = reactive({ title: '', titleColor: '#333333', subTitle: '', subTitleColor: '#f58220', items: [] });
  2358. // 实时预览辅助函数
  2359. const getAdTitleStyle = (index, type) => {
  2360. const isEditing = adDialogVisible.value && currentAdIdx.value === index;
  2361. const key = type === 'main' ? 'titleColor' : 'subTitleColor';
  2362. const defaultColor = type === 'main' ? '#333' : '#999';
  2363. const color = isEditing ? adForm[key] : adModules.value[index][key] || defaultColor;
  2364. return { color };
  2365. };
  2366. const getAdTitleText = (index, type) => {
  2367. const isEditing = adDialogVisible.value && currentAdIdx.value === index;
  2368. const key = type === 'main' ? 'title' : 'subTitle';
  2369. return isEditing ? adForm[key] : adModules.value[index][key];
  2370. };
  2371. const handleEditAd = (index) => {
  2372. currentAdIdx.value = index;
  2373. const ad = adModules.value[index];
  2374. Object.assign(adForm, JSON.parse(JSON.stringify(ad)));
  2375. adDialogVisible.value = true;
  2376. };
  2377. const submitAdForm = async () => {
  2378. const moduleData = adModules.value[currentAdIdx.value];
  2379. if (!moduleData) return;
  2380. const data: AdModuleConfigForm = {
  2381. moduleCode: moduleData.type || '',
  2382. moduleName: moduleData.title || '',
  2383. mainTitle: adForm.title,
  2384. mainTitleColor: adForm.titleColor,
  2385. subTitle: adForm.subTitle,
  2386. subTitleColor: adForm.subTitleColor,
  2387. jumpLink: '',
  2388. status: 1,
  2389. sortOrder: currentAdIdx.value,
  2390. adModuleItemList: adForm.items.map((item: any) => ({
  2391. productId: item.productId || item.id,
  2392. productName: item.productName || '',
  2393. imageUrl: item.imageUrl || '',
  2394. price: item.price || 0,
  2395. tagText: item.tagText || '',
  2396. tagLink: item.tagLink || '',
  2397. salesCount: item.salesCount || 0
  2398. }))
  2399. };
  2400. try {
  2401. let res;
  2402. // 从 API 加载的真实数据才有有效 id,mock id(1-5)用 POST 新增
  2403. const isFromApi = moduleData.moduleCode && moduleData.id && String(moduleData.id).length > 10;
  2404. if (isFromApi) {
  2405. res = await updateAdModuleConfig({ ...data, id: moduleData.id });
  2406. } else {
  2407. res = await addAdModuleConfig(data);
  2408. }
  2409. if (res.code === 200) {
  2410. // 新增时回写后端返回的 id
  2411. const savedData = JSON.parse(JSON.stringify(adForm));
  2412. if (!isFromApi && res.data?.id) {
  2413. savedData.id = res.data.id;
  2414. }
  2415. adModules.value[currentAdIdx.value] = savedData;
  2416. adDialogVisible.value = false;
  2417. ElMessage.success('配置保存成功');
  2418. } else {
  2419. ElMessage.error(res.msg || '保存失败');
  2420. }
  2421. } catch (error) {
  2422. console.error('保存广告模块配置失败:', error);
  2423. ElMessage.error('保存失败');
  2424. }
  2425. };
  2426. // 获取广告模块配置列表
  2427. const getAdModuleList = async () => {
  2428. try {
  2429. const res = await listAdModuleConfig();
  2430. if (res.code === 200 && res.rows && res.rows.length > 0) {
  2431. adModules.value = res.rows.map((item: AdModuleConfigVO) => ({
  2432. ...item,
  2433. title: item.mainTitle || '',
  2434. titleColor: item.mainTitleColor || '#333333',
  2435. subTitle: item.subTitle || '',
  2436. subTitleColor: item.subTitleColor || '#999999',
  2437. type: item.moduleCode || '',
  2438. items: (item.adModuleItemList || []).map((sub: any) => ({
  2439. id: sub.id,
  2440. productId: sub.productId || '',
  2441. productName: sub.productName || '',
  2442. imageUrl: sub.imageUrl || '',
  2443. price: sub.price || 0,
  2444. tagText: sub.tagText || '',
  2445. tagLink: sub.tagLink || '',
  2446. salesCount: sub.salesCount || 0
  2447. }))
  2448. }));
  2449. }
  2450. } catch (error) {
  2451. console.error('获取广告模块配置失败:', error);
  2452. ElMessage.error('获取广告模块配置失败');
  2453. }
  2454. };
  2455. // 推荐设置模块逻辑
  2456. const recommendThemeColor = ref('#e60012');
  2457. const recommendProductThemeColor = ref('#e60012');
  2458. const recommendActiveId = ref(1);
  2459. const recommendList = ref([
  2460. {
  2461. id: 1,
  2462. name: '为你推荐',
  2463. subTitle: '每日低价 妙券',
  2464. icon: 'data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHZpZXdCb3g9IjAgMCAzMiAzMiI+PHBhdGggZmlsbD0iI2U2MDAxMiIgZD0iTTE2IDJsNC4zNSA4LjgxbDkuNzIgMS40MWwtNy4wMyA2Ljg1bDEuNjYgOS42OEwxNiAyNS4yN2wtOC43IDQuNTdsMS42Ni05LjY4bC03LjAzLTYuODVsOS43Mi0xLjQxTDE2IDJ6Ii8+PC9zdmc+',
  2465. type: 'select',
  2466. status: 1,
  2467. selectedProducts: [
  2468. { id: 1001, name: 'Lenovo 联想 昭阳K4e 轻薄办公本 14英寸 i7/16G/512G', image: '/static/images/purchase/laptop_lenovo.jpg', price: '4599' },
  2469. { id: 1002, name: 'HP 惠普 战66 六代 商务笔记本电脑 锐龙版 15.6英寸', image: '/static/images/purchase/laptop_hp.jpg', price: '3899' }
  2470. ]
  2471. },
  2472. {
  2473. id: 2,
  2474. name: '新客专享',
  2475. subTitle: '精选爆品 低价',
  2476. icon: 'data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHZpZXdCb3g9IjAgMCAzMiAzMiI+PHBhdGggZmlsbD0iI2U2MDAxMiIgZD0iTTI2IDE0djEwaC00VjhIMTB2MTZINnYtMTBMNCAxMmw4LThoOHoiLz48cGF0aCBmaWxsPSIjZTYwMDEyIiBkPSJNMjIgMjRIMTB2LTRoMTJ6Ii8+PC9zdmc+',
  2477. type: 'select',
  2478. status: 1,
  2479. selectedProducts: []
  2480. },
  2481. {
  2482. id: 3,
  2483. name: '办公设备',
  2484. subTitle: '电脑设备 批量',
  2485. icon: 'data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHZpZXdCb3g9IjAgMCAzMiAzMiI+PHBhdGggZmlsbD0iI2U2MDAxMiIgZD0iTTI4IDI0SDR2LTJoMjR6bS0yLTJIMnYtNGgyNHptMC00SDJ2LTRoMjR6bTAtNEgydi00aDI0eiIvPjxwYXRoIGZpbGw9IiNlNjAwMTIiIGQ9Ik04IDI4aDE2di0ySDh6Ii8+PC9zdmc+',
  2486. type: 'category',
  2487. categoryLabel: '办公设备 > 办公电脑 > 笔记本',
  2488. status: 1,
  2489. selectedProducts: []
  2490. },
  2491. {
  2492. id: 4,
  2493. name: '办公耗材',
  2494. subTitle: '低价直供 囤货',
  2495. icon: 'data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHZpZXdCb3g9IjAgMCAzMiAzMiI+PHBhdGggZmlsbD0iI2U2MDAxMiIgZD0iTTI0IDRINFYyOGgyMHYtNHoiLz48cGF0aCBmaWxsPSIjZTYwMDEyIiBkPSJNMjggMTJsLTQgNHY4aDR6Ii8+PC9zdmc+',
  2496. type: 'category',
  2497. categoryLabel: '文具耗材 > 打印耗材 > 复印纸',
  2498. status: 1,
  2499. selectedProducts: []
  2500. },
  2501. {
  2502. id: 5,
  2503. name: '工业生产',
  2504. subTitle: '车间工具 规格',
  2505. icon: 'data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHZpZXdCb3g9IjAgMCAzMiAzMiI+PHBhdGggZmlsbD0iI2U2MDAxMiIgZD0iTTE2IDhsLTIuNDUgNC4yNUg4LjY0djQuOTFMNi4xOCAxOWwyLjQ1IDQuMjV2NC45MWg0LjkxbDIuNDUgNC4yNWwyLjQ1LTQuMjVoNC45MXYtNC45MWwyLjQ1LTQuMjVsLTIuNDUtNC4yNXYtNC45MWgtNC45MUwxNiA4eiIvPjwvc3ZnPg==',
  2506. type: 'category',
  2507. categoryLabel: '工业品 > 五金工具 > 电动工具',
  2508. status: 1,
  2509. selectedProducts: []
  2510. },
  2511. {
  2512. id: 6,
  2513. name: '员工福利',
  2514. subTitle: '节日礼盒 一键',
  2515. icon: 'data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHZpZXdCb3g9IjAgMCAzMiAzMiI+PHBhdGggZmlsbD0iI2U2MDAxMiIgZD0iTTE2IDI4czEyLTYuNDIgMTItMTZjMC01LjM2LTQuNjQtOS05LTlhOC43OCA4Ljc4IDAgMC0wIDMtM2MtNC4zNiAwLTkgMy42NC05IDlzMTIgMTYgMTIgMTZ6Ii8+PC9zdmc+',
  2516. type: 'select',
  2517. status: 1,
  2518. selectedProducts: []
  2519. },
  2520. {
  2521. id: 7,
  2522. name: '办公环境',
  2523. subTitle: '电器家具 焕新',
  2524. icon: 'data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHZpZXdCb3g9IjAgMCAzMiAzMiI+PHBhdGggZmlsbD0iI2U2MDAxMiIgZD0iTTE2IDhsOCAxNkg4bDgtMTZ6Ii8+PHBhdGggZmlsbD0iI2U2MDAxMiIgZD0iTTI2IDI4SDR2LTRoMjJ6Ii8+PC9zdmc+',
  2525. type: 'select',
  2526. status: 1,
  2527. selectedProducts: []
  2528. },
  2529. {
  2530. id: 8,
  2531. name: '营销礼品',
  2532. subTitle: '客户礼包 特惠',
  2533. icon: 'data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHZpZXdCb3g9IjAgMCAzMiAzMiI+PHBhdGggZmlsbD0iI2U2MDAxMiIgZD0iTTI2IDEwaC02VjhIMTJ2Mkg2djE2aDIwVjEweiIvPjxwYXRoIGZpbGw9IiNlNjAwMTIiIGQ9Ik0xOCAxMHYtMmgLTR2MnoiLz48L3N2Zz4=',
  2534. type: 'select',
  2535. status: 1,
  2536. selectedProducts: []
  2537. },
  2538. {
  2539. id: 9,
  2540. name: '个人防护',
  2541. subTitle: '劳保用品 齐全',
  2542. icon: 'data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHZpZXdCb3g9IjAgMCAzMiAzMiI+PHBhdGggZmlsbD0iI2U2MDAxMiIgZD0iTTE2IDJsLTEyIDR2MTBzMCAxMiAxMiAxNmMxMi00IDEyLTE2IDEyLTE2VjZMMTYgMnoiLz48L3N2Zz4=',
  2543. type: 'category',
  2544. categoryLabel: '个人防护 > 头部防护 > 安全帽',
  2545. status: 1,
  2546. selectedProducts: []
  2547. },
  2548. { id: 10, name: '清洁用品', subTitle: '扫把 拖把 纸巾', icon: '', type: 'select', status: 1, selectedProducts: [] },
  2549. { id: 11, name: '运动器材', subTitle: '跑步机 哑铃', icon: '', type: 'select', status: 1, selectedProducts: [] },
  2550. { id: 12, name: '生鲜水果', subTitle: '苹果 橙子 香蕉', icon: '', type: 'select', status: 1, selectedProducts: [] },
  2551. { id: 13, name: '零食小吃', subTitle: '坚果 薯片 饼干', icon: '', type: 'select', status: 1, selectedProducts: [] },
  2552. { id: 14, name: '美妆护肤', subTitle: '洗面奶 补水', icon: '', type: 'select', status: 1, selectedProducts: [] }
  2553. ]);
  2554. const activeRecommendList = computed(() => {
  2555. return recommendList.value.filter((item) => item.status === 1);
  2556. });
  2557. const recommendDialogVisible = ref(false);
  2558. const recommendEditIndex = ref(-1);
  2559. const recommendForm = reactive({
  2560. name: '',
  2561. subTitle: '',
  2562. icon: '',
  2563. type: 'select',
  2564. categoryValue: [],
  2565. categoryLabel: '',
  2566. selectedProducts: [],
  2567. status: 1
  2568. });
  2569. const mockCategoryOptions = [
  2570. {
  2571. value: 'bg',
  2572. label: '办公设备',
  2573. children: [
  2574. {
  2575. value: 'dn',
  2576. label: '办公电脑',
  2577. children: [
  2578. { value: 'bjb', label: '笔记本' },
  2579. { value: 'tsj', label: '台式机' }
  2580. ]
  2581. }
  2582. ]
  2583. },
  2584. {
  2585. value: 'wj',
  2586. label: '文具耗材',
  2587. children: [
  2588. {
  2589. value: 'dy',
  2590. label: '打印耗材',
  2591. children: [
  2592. { value: 'fyz', label: '复印纸' },
  2593. { value: 'xhg', label: '硒鼓' }
  2594. ]
  2595. }
  2596. ]
  2597. }
  2598. ];
  2599. const handleAddRecommend = () => {
  2600. recommendEditIndex.value = -1;
  2601. Object.assign(recommendForm, {
  2602. name: '',
  2603. subTitle: '',
  2604. icon: '',
  2605. type: 'select',
  2606. categoryValue: [],
  2607. categoryLabel: '',
  2608. selectedProducts: [],
  2609. status: 1
  2610. });
  2611. recommendDialogVisible.value = true;
  2612. };
  2613. const handleEditRecommend = (row, index) => {
  2614. recommendEditIndex.value = index;
  2615. Object.assign(recommendForm, JSON.parse(JSON.stringify(row)));
  2616. recommendDialogVisible.value = true;
  2617. };
  2618. const getLabelsByValues = (values, options) => {
  2619. const labels = [];
  2620. let currentOptions = options;
  2621. for (const val of values) {
  2622. const target = currentOptions.find((opt) => opt.value === val);
  2623. if (target) {
  2624. labels.push(target.label);
  2625. currentOptions = target.children || [];
  2626. }
  2627. }
  2628. return labels.join(' > ');
  2629. };
  2630. const handleRecommendCategoryChange = (val) => {
  2631. if (val && val.length > 0) {
  2632. recommendForm.categoryLabel = getLabelsByValues(val, mockCategoryOptions);
  2633. } else {
  2634. recommendForm.categoryLabel = '';
  2635. }
  2636. };
  2637. const submitRecommendForm = () => {
  2638. if (recommendEditIndex.value > -1) {
  2639. recommendList.value[recommendEditIndex.value] = { ...recommendForm };
  2640. } else {
  2641. recommendList.value.push({ id: Date.now(), ...recommendForm });
  2642. }
  2643. recommendDialogVisible.value = false;
  2644. ElMessage.success('保存成功');
  2645. };
  2646. // 推荐商品选择增强逻辑
  2647. const selectedProductDialogVisible = ref(false);
  2648. const productSelectionDrawerVisible = ref(false);
  2649. const currentRecommendIndex = ref(-1);
  2650. const drawerSelection = ref([]);
  2651. const selectedProductsTableRef = ref(null);
  2652. const drawerTableRef = ref(null);
  2653. const selectedCurrentPage = ref(1);
  2654. const selectedPageSize = ref(10);
  2655. const pagedSelectedProducts = computed(() => {
  2656. const list = recommendList.value[currentRecommendIndex.value]?.selectedProducts || [];
  2657. const start = (selectedCurrentPage.value - 1) * selectedPageSize.value;
  2658. const end = start + selectedPageSize.value;
  2659. return list.slice(start, end);
  2660. });
  2661. const handleSelectedProductsSelectionChange = (val) => {
  2662. currentItemIdx.value = val; // 临时借用 currentItemIdx 存储选中的行
  2663. };
  2664. const openRecommendProductSelect = (index) => {
  2665. currentRecommendIndex.value = index;
  2666. selectedCurrentPage.value = 1;
  2667. selectedProductDialogVisible.value = true;
  2668. };
  2669. const submitSelectedProducts = () => {
  2670. selectedProductDialogVisible.value = false;
  2671. ElMessage.success('已选商品配置已保存');
  2672. };
  2673. const openProductDrawer = async () => {
  2674. const currentList = recommendList.value[currentRecommendIndex.value]?.selectedProducts || [];
  2675. drawerSelection.value = JSON.parse(JSON.stringify(currentList));
  2676. productQueryParams.itemName = '';
  2677. productQueryParams.pageNum = 1;
  2678. productQueryParams.pageSize = selectPageSize.value;
  2679. selectCurrentPage.value = 1;
  2680. productSelectionDrawerVisible.value = true;
  2681. await getProductList();
  2682. // 回显勾选逻辑
  2683. nextTick(() => {
  2684. if (drawerTableRef.value) {
  2685. drawerTableRef.value.clearSelection();
  2686. productList.value.forEach((item) => {
  2687. if (currentList.some((exist) => exist.id === item.id)) {
  2688. drawerTableRef.value.toggleRowSelection(item, true);
  2689. }
  2690. });
  2691. }
  2692. });
  2693. };
  2694. const handleDrawerSelectionChange = (val) => {
  2695. drawerSelection.value = val;
  2696. };
  2697. const confirmDrawerSelection = () => {
  2698. // 直接全量覆盖,支持在抽屉里取消勾选来删除
  2699. recommendList.value[currentRecommendIndex.value].selectedProducts = JSON.parse(JSON.stringify(drawerSelection.value));
  2700. ElMessage.success('商品列表同步成功');
  2701. productSelectionDrawerVisible.value = false;
  2702. };
  2703. const removeSelectedProduct = (index) => {
  2704. recommendList.value[currentRecommendIndex.value].selectedProducts.splice(index, 1);
  2705. ElMessage.success('移除成功');
  2706. };
  2707. const batchRemoveSelectedProducts = () => {
  2708. const selectedRows = selectedProductsTableRef.value?.getSelectionRows() || [];
  2709. if (selectedRows.length === 0) return ElMessage.warning('请先勾选要移除的商品');
  2710. ElMessageBox.confirm(`确定移除选中的 ${selectedRows.length} 个商品吗?`, '提示').then(() => {
  2711. const currentList = recommendList.value[currentRecommendIndex.value].selectedProducts;
  2712. const selectedIds = selectedRows.map((r) => r.id);
  2713. recommendList.value[currentRecommendIndex.value].selectedProducts = currentList.filter((item) => !selectedIds.includes(item.id));
  2714. ElMessage.success('批量移除成功');
  2715. });
  2716. };
  2717. // 推荐预览滚动逻辑
  2718. const recommendScrollRef = ref(null);
  2719. const recShowLeft = ref(false);
  2720. const recShowRight = ref(false);
  2721. const updateRecArrows = () => {
  2722. if (!recommendScrollRef.value) return;
  2723. const { scrollLeft, scrollWidth, clientWidth } = recommendScrollRef.value;
  2724. recShowLeft.value = scrollLeft > 5;
  2725. recShowRight.value = scrollLeft + clientWidth < scrollWidth - 5;
  2726. };
  2727. const scrollRecommend = (direction) => {
  2728. const container = recommendScrollRef.value;
  2729. if (!container) return;
  2730. const scrollAmount = 400;
  2731. if (direction === 'left') {
  2732. container.scrollLeft -= scrollAmount;
  2733. } else {
  2734. container.scrollLeft += scrollAmount;
  2735. }
  2736. };
  2737. // 商品选择逻辑
  2738. const selectDialogVisible = ref(false);
  2739. const selectedTempId = ref(null);
  2740. const selectCurrentPage = ref(1);
  2741. const selectPageSize = ref(8);
  2742. // 商品列表(API数据)
  2743. const productList = ref<any[]>([]);
  2744. const productTotal = ref(0);
  2745. const productQueryParams = reactive({
  2746. pageNum: 1,
  2747. pageSize: 8,
  2748. itemName: '',
  2749. productStatus: 1
  2750. });
  2751. const brandQueryParams = reactive({
  2752. pageNum: 1,
  2753. pageSize: 8,
  2754. brandName: ''
  2755. });
  2756. /** 获取商品/品牌列表(根据广告模块类型自动切换) */
  2757. const getProductList = async () => {
  2758. try {
  2759. if (selectDialogVisible.value && currentAdIdx.value === 2) {
  2760. // 品牌好店:查询品牌
  2761. brandQueryParams.brandName = productQueryParams.itemName;
  2762. brandQueryParams.pageNum = productQueryParams.pageNum;
  2763. brandQueryParams.pageSize = productQueryParams.pageSize;
  2764. const res = await listBrand(brandQueryParams);
  2765. productList.value = (res.rows || []).map((item: any) => ({
  2766. id: item.id,
  2767. name: item.brandName || '',
  2768. image: item.brandLogo || '',
  2769. price: ''
  2770. }));
  2771. productTotal.value = res.total || 0;
  2772. } else {
  2773. // 其他广告模块:查询商品
  2774. const res = await listBase(productQueryParams);
  2775. productList.value = (res.rows || []).map((item: any) => ({
  2776. id: item.id,
  2777. name: item.itemName || '',
  2778. image: item.productImage || item.productImageUrl || '',
  2779. price: item.memberPrice ?? item.minSellingPrice ?? item.marketPrice ?? ''
  2780. }));
  2781. productTotal.value = res.total || 0;
  2782. }
  2783. } catch (error) {
  2784. console.error('获取列表失败:', error);
  2785. ElMessage.error('获取列表失败');
  2786. }
  2787. };
  2788. const filteredSelectList = computed(() => productList.value);
  2789. const pagedSelectList = computed(() => productList.value);
  2790. const onProductPageChange = (page: number) => {
  2791. productQueryParams.pageNum = page;
  2792. selectCurrentPage.value = page;
  2793. getProductList();
  2794. };
  2795. const onProductPageSizeChange = (size: number) => {
  2796. productQueryParams.pageSize = size;
  2797. productQueryParams.pageNum = 1;
  2798. selectCurrentPage.value = 1;
  2799. selectPageSize.value = size;
  2800. getProductList();
  2801. };
  2802. const openProductSelect = (index: number) => {
  2803. currentItemIdx.value = index;
  2804. selectedTempId.value = adForm.items[index].id;
  2805. productQueryParams.itemName = '';
  2806. productQueryParams.pageNum = 1;
  2807. productQueryParams.pageSize = selectPageSize.value;
  2808. selectCurrentPage.value = 1;
  2809. selectDialogVisible.value = true;
  2810. getProductList();
  2811. };
  2812. const confirmSelect = () => {
  2813. const item = productList.value.find((i) => i.id === selectedTempId.value);
  2814. if (item) {
  2815. const target = adForm.items[currentItemIdx.value];
  2816. target.id = item.id;
  2817. target.productId = item.id;
  2818. target.productName = item.name;
  2819. target.imageUrl = item.image;
  2820. target.price = item.price;
  2821. selectDialogVisible.value = false;
  2822. ElMessage.success('选择成功');
  2823. }
  2824. };
  2825. // 快捷入口模块逻辑
  2826. const qePageIndex = ref(0);
  2827. const quickEntrySettings = reactive({
  2828. id: null as string | number | null,
  2829. moduleName: '企业工作台',
  2830. jumpLink: ''
  2831. });
  2832. // 获取快捷入口模块配置
  2833. const getQuickEntryModuleList = async () => {
  2834. try {
  2835. const res = await listQuickEntryModule();
  2836. if (res.code === 200 && res.rows && res.rows.length > 0) {
  2837. const data = res.rows[0];
  2838. quickEntrySettings.id = data.id;
  2839. quickEntrySettings.moduleName = data.moduleName || '';
  2840. quickEntrySettings.jumpLink = data.jumpLink || '';
  2841. }
  2842. } catch (error) {
  2843. console.error('获取快捷入口模块配置失败:', error);
  2844. ElMessage.error('获取快捷入口模块配置失败');
  2845. }
  2846. };
  2847. // 保存快捷入口模块配置
  2848. const saveQuickEntryModule = async () => {
  2849. const data: QuickEntryModuleForm = {
  2850. moduleName: quickEntrySettings.moduleName,
  2851. jumpLink: quickEntrySettings.jumpLink
  2852. };
  2853. try {
  2854. let res;
  2855. if (quickEntrySettings.id) {
  2856. res = await updateQuickEntryModule({ ...data, id: quickEntrySettings.id });
  2857. } else {
  2858. res = await addQuickEntryModule(data);
  2859. if (res.code === 200 && res.data) {
  2860. quickEntrySettings.id = res.data.id;
  2861. }
  2862. }
  2863. if (res.code === 200) {
  2864. ElMessage.success('快捷入口模块配置保存成功');
  2865. } else {
  2866. ElMessage.error(res.msg || '保存失败');
  2867. }
  2868. } catch (error) {
  2869. console.error('保存快捷入口模块配置失败:', error);
  2870. ElMessage.error('保存失败');
  2871. }
  2872. };
  2873. const quickEntryList = ref<QuickEntryItemsVO[]>([]);
  2874. // 获取快捷入口项列表
  2875. const getQuickEntryItemsList = async () => {
  2876. try {
  2877. const res = await listQuickEntryItems();
  2878. if (res.code === 200 && res.rows) {
  2879. quickEntryList.value = res.rows.map((item: QuickEntryItemsVO) => ({
  2880. ...item,
  2881. icon: (item as any).iconUrl || '',
  2882. tag: (item as any).tagText || '',
  2883. link: (item as any).jumpLink || ''
  2884. }));
  2885. }
  2886. } catch (error) {
  2887. console.error('获取快捷入口项列表失败:', error);
  2888. ElMessage.error('获取快捷入口项列表失败');
  2889. }
  2890. };
  2891. const qePageCount = computed(() => Math.ceil(quickEntryList.value.filter((i) => i.status === 1).length / 8));
  2892. const getPageItems = (pageIdx) => {
  2893. const activeItems = quickEntryList.value.filter((i) => i.status === 1);
  2894. return activeItems.slice(pageIdx * 8, (pageIdx + 1) * 8);
  2895. };
  2896. const quickEntryDialogVisible = ref(false);
  2897. const quickEntryDialogType = ref('add');
  2898. const qeEditIndex = ref(-1);
  2899. const quickEntryForm = reactive({ name: '', icon: '', tag: '', link: '', status: 1 });
  2900. const handleAddQuickEntry = () => {
  2901. quickEntryDialogType.value = 'add';
  2902. Object.assign(quickEntryForm, { name: '', icon: '', tag: '', link: '', status: 1 });
  2903. quickEntryDialogVisible.value = true;
  2904. };
  2905. const handleEditQuickEntry = (row, index) => {
  2906. quickEntryDialogType.value = 'edit';
  2907. qeEditIndex.value = index;
  2908. Object.assign(quickEntryForm, JSON.parse(JSON.stringify(row)));
  2909. quickEntryDialogVisible.value = true;
  2910. };
  2911. const submitQuickEntryForm = async () => {
  2912. if (!quickEntryForm.name) return ElMessage.warning('请输入入口名称');
  2913. const data: QuickEntryItemsForm = {
  2914. name: quickEntryForm.name,
  2915. iconUrl: quickEntryForm.icon,
  2916. tagText: quickEntryForm.tag,
  2917. jumpLink: quickEntryForm.link,
  2918. status: quickEntryForm.status,
  2919. sortOrder: quickEntryList.value.length
  2920. };
  2921. try {
  2922. if (quickEntryDialogType.value === 'add') {
  2923. const res = await addQuickEntryItems(data);
  2924. if (res.code === 200) {
  2925. ElMessage.success('新增成功');
  2926. quickEntryDialogVisible.value = false;
  2927. getQuickEntryItemsList();
  2928. } else {
  2929. ElMessage.error(res.msg || '新增失败');
  2930. }
  2931. } else {
  2932. const id = quickEntryList.value[qeEditIndex.value]?.id;
  2933. const res = await updateQuickEntryItems({ ...data, id });
  2934. if (res.code === 200) {
  2935. ElMessage.success('修改成功');
  2936. quickEntryDialogVisible.value = false;
  2937. getQuickEntryItemsList();
  2938. } else {
  2939. ElMessage.error(res.msg || '修改失败');
  2940. }
  2941. }
  2942. } catch (error) {
  2943. console.error('操作失败:', error);
  2944. ElMessage.error('操作失败');
  2945. }
  2946. };
  2947. const handleDeleteQuickEntry = async (index: number) => {
  2948. const item = quickEntryList.value[index];
  2949. try {
  2950. await ElMessageBox.confirm('确定要删除该入口吗?', '提示', { type: 'warning' });
  2951. const res = await delQuickEntryItems(item.id);
  2952. if (res.code === 200) {
  2953. ElMessage.success('删除成功');
  2954. getQuickEntryItemsList();
  2955. } else {
  2956. ElMessage.error(res.msg || '删除失败');
  2957. }
  2958. } catch (error) {
  2959. if (error !== 'cancel') {
  2960. console.error('删除失败:', error);
  2961. ElMessage.error('删除失败');
  2962. }
  2963. }
  2964. };
  2965. const moveQE = async (index: number, direction: number) => {
  2966. const newIndex = index + direction;
  2967. if (newIndex < 0 || newIndex >= quickEntryList.value.length) return;
  2968. const item = quickEntryList.value.splice(index, 1)[0];
  2969. quickEntryList.value.splice(newIndex, 0, item);
  2970. // 同步排序到后端
  2971. try {
  2972. const start = Math.min(index, newIndex);
  2973. const end = Math.max(index, newIndex);
  2974. for (let i = start; i <= end; i++) {
  2975. const row = quickEntryList.value[i] as any;
  2976. await updateQuickEntryItems({
  2977. id: row.id,
  2978. name: row.name,
  2979. iconUrl: row.icon || row.iconUrl,
  2980. tagText: row.tag || row.tagText,
  2981. jumpLink: row.link || row.jumpLink,
  2982. status: row.status,
  2983. sortOrder: i
  2984. });
  2985. }
  2986. } catch (error) {
  2987. console.error('排序更新失败:', error);
  2988. ElMessage.error('排序更新失败');
  2989. }
  2990. };
  2991. watch(
  2992. headerCategoryList,
  2993. () => {
  2994. nextTick(() => updateNavArrows());
  2995. },
  2996. { deep: true }
  2997. );
  2998. onMounted(() => {
  2999. startPlaceholderScroll();
  3000. // 获取当前配置
  3001. getCurrentSearch();
  3002. getCurrentAdLeftBtn();
  3003. getCarouselList();
  3004. getHeaderCategoryList();
  3005. getCategoryList();
  3006. getScenarioGlobalSettingsList();
  3007. getScenarioList();
  3008. getQuickEntryModuleList();
  3009. getQuickEntryItemsList();
  3010. getAdModuleList();
  3011. // 获取左侧广告配置
  3012. nextTick(() => {
  3013. updateNavArrows();
  3014. updateRecArrows();
  3015. });
  3016. // 延迟再次检测,确保图片加载后布局稳定
  3017. setTimeout(() => {
  3018. updateRecArrows();
  3019. }, 500);
  3020. window.addEventListener('resize', updateNavArrows);
  3021. window.addEventListener('resize', updateRecArrows);
  3022. });
  3023. onUnmounted(() => {
  3024. if (timer) clearInterval(timer);
  3025. window.removeEventListener('resize', updateNavArrows);
  3026. window.removeEventListener('resize', updateRecArrows);
  3027. });
  3028. watch(
  3029. activeRecommendList,
  3030. () => {
  3031. nextTick(() => {
  3032. updateRecArrows();
  3033. });
  3034. },
  3035. { deep: true }
  3036. );
  3037. // 监听子页签切换,确保切换回推荐设置时更新箭头状态
  3038. watch(activeSubTab, (newVal) => {
  3039. if (newVal === 'recommend') {
  3040. nextTick(() => {
  3041. setTimeout(() => {
  3042. updateRecArrows();
  3043. }, 300);
  3044. });
  3045. }
  3046. });
  3047. </script>
  3048. <style scoped>
  3049. /* 基础辅助类 */
  3050. .flex-column {
  3051. display: flex;
  3052. flex-direction: column;
  3053. }
  3054. .flex-center {
  3055. display: flex;
  3056. align-items: center;
  3057. }
  3058. .gap-5 {
  3059. gap: 5px;
  3060. }
  3061. .gap-10 {
  3062. gap: 10px;
  3063. }
  3064. .m-b-30 {
  3065. margin-bottom: 30px;
  3066. }
  3067. .scenario-editor-container {
  3068. padding: 32px 40px;
  3069. display: flex;
  3070. flex-direction: column;
  3071. background-color: #fff; /* 纯白背景 */
  3072. min-height: 100%;
  3073. }
  3074. .preview-section-standard {
  3075. background: #fcfdfe;
  3076. border: 1px solid #eef2f6;
  3077. border-radius: 8px;
  3078. padding: 32px;
  3079. margin-bottom: 32px;
  3080. }
  3081. .section-title-standard {
  3082. font-size: 16px;
  3083. font-weight: bold;
  3084. color: #333;
  3085. margin-bottom: 24px;
  3086. display: flex;
  3087. align-items: center;
  3088. }
  3089. .section-title-standard::before {
  3090. content: '';
  3091. width: 4px;
  3092. height: 16px;
  3093. background-color: #e60012;
  3094. margin-right: 12px;
  3095. border-radius: 2px;
  3096. }
  3097. .config-section-standard {
  3098. padding: 32px 0;
  3099. border-bottom: 1px solid #f0f0f0;
  3100. }
  3101. .settings-form-standard {
  3102. padding-left: 16px;
  3103. }
  3104. .preview-tip {
  3105. font-size: 12px;
  3106. color: #999;
  3107. margin-top: 16px;
  3108. }
  3109. .rank-action-btns {
  3110. display: flex;
  3111. flex-direction: column;
  3112. align-items: center;
  3113. gap: 4px;
  3114. }
  3115. .rank-btn-mini {
  3116. cursor: pointer;
  3117. font-size: 14px;
  3118. color: #909399;
  3119. transition: color 0.2s;
  3120. }
  3121. .rank-btn-mini:hover {
  3122. color: #e60012;
  3123. }
  3124. .standard-table :deep(.el-table__header) th {
  3125. background-color: #f8fafc;
  3126. color: #606266;
  3127. font-weight: bold;
  3128. }
  3129. .parameter-settings {
  3130. flex: 1;
  3131. min-height: 0; /* 关键:防止 flex 子项被内容撑开 */
  3132. display: flex;
  3133. flex-direction: column;
  3134. background-color: #fff;
  3135. overflow: hidden;
  3136. }
  3137. .sub-tabs {
  3138. display: flex;
  3139. padding: 0 20px;
  3140. border-bottom: 1px solid #f0f0f0;
  3141. flex-shrink: 0;
  3142. height: 48px; /* 固定高度,防止切换时抖动 */
  3143. align-items: center;
  3144. }
  3145. .sub-tab-item {
  3146. padding: 12px 20px;
  3147. cursor: pointer;
  3148. font-size: 14px;
  3149. color: #666;
  3150. font-weight: 500;
  3151. position: relative;
  3152. }
  3153. .sub-tab-item.active {
  3154. color: var(--primary-color);
  3155. }
  3156. .sub-tab-item.active::after {
  3157. content: '';
  3158. position: absolute;
  3159. bottom: 0;
  3160. left: 20px;
  3161. right: 20px;
  3162. height: 2px;
  3163. background-color: var(--primary-color);
  3164. }
  3165. .content-body {
  3166. flex: 1;
  3167. overflow-y: auto;
  3168. }
  3169. /* 搜索编辑区布局 */
  3170. .search-editor {
  3171. display: flex;
  3172. flex-direction: column;
  3173. padding: 20px 40px;
  3174. gap: 30px;
  3175. }
  3176. /* 预览区域 */
  3177. .preview-section {
  3178. background-color: #fff;
  3179. border: 1px dashed #dcdfe6;
  3180. border-radius: 8px;
  3181. padding: 20px;
  3182. }
  3183. .preview-title {
  3184. font-size: 13px;
  3185. color: #909399;
  3186. margin-bottom: 15px;
  3187. font-weight: bold;
  3188. }
  3189. .live-preview-box {
  3190. background-color: #fff;
  3191. padding: 40px 20px;
  3192. border-radius: 4px;
  3193. box-shadow: 0 2px 12px rgba(0, 0, 0, 0.04);
  3194. }
  3195. /* 仿真 Mockup */
  3196. .search-bar-mockup {
  3197. display: flex;
  3198. align-items: center;
  3199. max-width: 1400px; /* 进一步加宽容器 */
  3200. margin: 0 auto;
  3201. gap: 30px;
  3202. }
  3203. .mockup-left {
  3204. flex-shrink: 0;
  3205. text-align: center;
  3206. }
  3207. .main-title {
  3208. font-size: 32px;
  3209. font-weight: 800;
  3210. line-height: 1.2;
  3211. }
  3212. .sub-title {
  3213. font-size: 12px;
  3214. color: #999;
  3215. margin-top: 4px;
  3216. letter-spacing: 1px;
  3217. }
  3218. .mockup-center {
  3219. flex: 2; /* 增加中心区域的弹性占比,使搜索框更宽 */
  3220. }
  3221. .search-input-wrapper {
  3222. height: 44px;
  3223. border: 2px solid transparent; /* 由动态绑定控制颜色 */
  3224. border-radius: 8px;
  3225. display: flex;
  3226. align-items: center;
  3227. overflow: hidden;
  3228. position: relative;
  3229. }
  3230. .placeholder-scroll {
  3231. flex: 1;
  3232. padding: 0 15px;
  3233. height: 100%;
  3234. overflow: hidden;
  3235. }
  3236. .scroll-container {
  3237. height: 100%;
  3238. position: relative;
  3239. }
  3240. .scroll-item {
  3241. height: 100%;
  3242. display: flex;
  3243. align-items: center;
  3244. color: #999;
  3245. font-size: 15px;
  3246. }
  3247. .search-btn {
  3248. width: 90px;
  3249. height: 34px;
  3250. color: #fff;
  3251. display: flex;
  3252. align-items: center;
  3253. justify-content: center;
  3254. font-weight: bold;
  3255. font-size: 15px;
  3256. cursor: pointer;
  3257. border-radius: 6px;
  3258. letter-spacing: 2px;
  3259. margin-right: 4px;
  3260. transition: opacity 0.2s;
  3261. }
  3262. .search-btn:hover {
  3263. opacity: 0.9;
  3264. }
  3265. .hot-words {
  3266. margin-top: 8px;
  3267. display: flex;
  3268. gap: 15px;
  3269. padding-left: 5px;
  3270. }
  3271. .hot-word {
  3272. font-size: 12px;
  3273. color: #999;
  3274. cursor: pointer;
  3275. transition: color 0.2s;
  3276. }
  3277. .hot-word:hover {
  3278. color: var(--theme-color);
  3279. }
  3280. .mockup-right {
  3281. flex-shrink: 0;
  3282. }
  3283. .cart-btn {
  3284. display: flex;
  3285. align-items: center;
  3286. gap: 8px;
  3287. padding: 8px 16px;
  3288. border: 1px solid transparent; /* 由动态绑定控制颜色 */
  3289. border-radius: 8px;
  3290. font-size: 14px;
  3291. cursor: pointer;
  3292. background-color: #fff;
  3293. transition: all 0.2s;
  3294. }
  3295. .cart-btn:hover {
  3296. filter: brightness(0.95);
  3297. }
  3298. /* 广告图编辑区 */
  3299. .carousel-editor {
  3300. padding: 20px 40px;
  3301. display: flex;
  3302. flex-direction: column;
  3303. gap: 40px;
  3304. }
  3305. .editor-section {
  3306. display: flex;
  3307. flex-direction: column;
  3308. gap: 20px;
  3309. }
  3310. .section-header {
  3311. display: flex;
  3312. flex-direction: column;
  3313. gap: 4px;
  3314. }
  3315. .section-title {
  3316. font-size: 16px;
  3317. font-weight: bold;
  3318. color: #333;
  3319. }
  3320. .section-desc {
  3321. font-size: 13px;
  3322. color: #999;
  3323. }
  3324. /* 左侧广告设置 */
  3325. .left-ad-container {
  3326. display: flex;
  3327. flex-direction: column;
  3328. gap: 10px;
  3329. }
  3330. .left-ad-preview-wrapper {
  3331. width: 80px;
  3332. height: 460px;
  3333. border-radius: 8px;
  3334. overflow: hidden;
  3335. position: relative;
  3336. cursor: pointer;
  3337. transition: width 0.4s cubic-bezier(0.4, 0, 0.2, 1);
  3338. box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
  3339. border: 1px solid #eee;
  3340. }
  3341. .left-ad-preview-wrapper.expanded {
  3342. width: 790px;
  3343. }
  3344. .left-ad-img {
  3345. width: 790px; /* 固定宽度,外层容器裁剪 */
  3346. height: 460px;
  3347. object-fit: cover;
  3348. display: block;
  3349. }
  3350. .left-ad-empty {
  3351. width: 100%;
  3352. height: 100%;
  3353. background-color: #f5f7fa;
  3354. display: flex;
  3355. flex-direction: column;
  3356. align-items: center;
  3357. justify-content: center;
  3358. color: #909399;
  3359. border: 1px dashed #dcdfe6;
  3360. }
  3361. .ad-actions {
  3362. position: absolute;
  3363. top: 20px;
  3364. right: 20px;
  3365. display: flex;
  3366. gap: 10px;
  3367. background: rgba(255, 255, 255, 0.9);
  3368. padding: 8px;
  3369. border-radius: 30px;
  3370. box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
  3371. }
  3372. .left-ad-settings {
  3373. flex: 1;
  3374. display: flex;
  3375. flex-direction: column;
  3376. gap: 15px;
  3377. padding: 10px 0; /* 移除背景和边框 */
  3378. }
  3379. .settings-input-ad {
  3380. max-width: 500px;
  3381. }
  3382. .left-ad-tip {
  3383. display: flex;
  3384. align-items: center;
  3385. gap: 6px;
  3386. font-size: 13px;
  3387. color: #a8abb2;
  3388. }
  3389. /* 轮播图预览 */
  3390. .carousel-preview-box {
  3391. padding: 10px 0;
  3392. }
  3393. .preview-mockup {
  3394. width: 552px;
  3395. height: 190px;
  3396. border-radius: 8px;
  3397. overflow: hidden;
  3398. box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
  3399. background-color: #f5f7fa;
  3400. }
  3401. /* 强力锁定轮播图指示器至左下角 */
  3402. :deep(.el-carousel__indicators--horizontal) {
  3403. left: 20px !important;
  3404. right: auto !important;
  3405. bottom: 15px !important;
  3406. transform: none !important;
  3407. width: fit-content !important;
  3408. margin: 0 !important;
  3409. padding: 0 !important;
  3410. display: flex !important;
  3411. justify-content: flex-start !important;
  3412. }
  3413. :deep(.el-carousel__indicator--horizontal) {
  3414. display: inline-block !important;
  3415. padding: 0 3px !important;
  3416. }
  3417. :deep(.el-carousel__indicators--inside) {
  3418. left: 20px !important;
  3419. transform: none !important;
  3420. }
  3421. :deep(.el-carousel__indicator) {
  3422. padding: 0 3px;
  3423. }
  3424. :deep(.el-carousel__button) {
  3425. width: 6px;
  3426. height: 6px;
  3427. border-radius: 50%;
  3428. background-color: rgba(255, 255, 255, 0.4) !important;
  3429. opacity: 1 !important;
  3430. transition: all 0.3s;
  3431. }
  3432. :deep(.el-carousel__indicator.is-active .el-carousel__button) {
  3433. width: 20px; /* 激活状态变为长胶囊 */
  3434. border-radius: 10px;
  3435. background-color: #ffffff !important;
  3436. }
  3437. .carousel-slide {
  3438. width: 100%;
  3439. height: 100%;
  3440. }
  3441. .carousel-slide img {
  3442. width: 100%;
  3443. height: 100%;
  3444. object-fit: cover;
  3445. }
  3446. .carousel-empty {
  3447. height: 100%;
  3448. display: flex;
  3449. flex-direction: column;
  3450. align-items: center;
  3451. justify-content: center;
  3452. color: #ccc;
  3453. background-color: #f9f9f9;
  3454. }
  3455. /* 轮播列表 */
  3456. .carousel-list-box {
  3457. display: flex;
  3458. flex-direction: column;
  3459. gap: 15px;
  3460. margin-top: 10px;
  3461. }
  3462. .list-toolbar {
  3463. display: flex;
  3464. justify-content: space-between;
  3465. align-items: center;
  3466. padding: 0 5px;
  3467. }
  3468. .btn-add-carousel {
  3469. padding: 0 25px;
  3470. font-weight: bold;
  3471. }
  3472. /* 自定义表头样式 */
  3473. :deep(.table-header-custom) {
  3474. background-color: #f8f9fb !important;
  3475. color: #333 !important;
  3476. font-weight: bold !important;
  3477. height: 50px;
  3478. }
  3479. .drag-tip {
  3480. font-size: 12px;
  3481. color: #a8abb2;
  3482. }
  3483. .table-img {
  3484. width: 140px;
  3485. height: 48px;
  3486. border-radius: 4px;
  3487. border: 1px solid #f0f0f0;
  3488. display: block;
  3489. }
  3490. .rank-box {
  3491. display: flex;
  3492. flex-direction: column;
  3493. align-items: center;
  3494. gap: 2px;
  3495. }
  3496. .rank-icon {
  3497. cursor: pointer;
  3498. color: #909399;
  3499. font-size: 16px;
  3500. transition: color 0.2s;
  3501. }
  3502. .rank-icon:hover {
  3503. color: #409eff;
  3504. }
  3505. /* 弹窗上传样式 */
  3506. .upload-placeholder {
  3507. width: 240px;
  3508. height: 82px;
  3509. border: 1px dashed #dcdfe6;
  3510. border-radius: 6px;
  3511. cursor: pointer;
  3512. overflow: hidden;
  3513. display: flex;
  3514. align-items: center;
  3515. justify-content: center;
  3516. background-color: #f5f7fa;
  3517. transition: border-color 0.2s;
  3518. }
  3519. .upload-placeholder:hover {
  3520. border-color: #409eff;
  3521. }
  3522. .form-preview-img {
  3523. width: 100%;
  3524. height: 100%;
  3525. object-fit: cover;
  3526. }
  3527. .upload-icon {
  3528. font-size: 28px;
  3529. color: #8c939d;
  3530. }
  3531. .upload-tip {
  3532. font-size: 12px;
  3533. color: #999;
  3534. margin-top: 5px;
  3535. line-height: 1.4;
  3536. }
  3537. .dialog-form-inner {
  3538. padding: 30px 40px; /* 大幅增加内边距,使其更高、更大气 */
  3539. }
  3540. .dialog-form-inner :deep(.el-form-item) {
  3541. margin-bottom: 25px; /* 增加表单项间距 */
  3542. }
  3543. .list-scroll-enter-active,
  3544. .list-scroll-leave-active {
  3545. transition: all 0.5s ease;
  3546. position: absolute;
  3547. width: 100%;
  3548. }
  3549. .list-scroll-enter-from {
  3550. transform: translateY(100%);
  3551. opacity: 0;
  3552. }
  3553. .list-scroll-leave-to {
  3554. transform: translateY(-100%);
  3555. opacity: 0;
  3556. }
  3557. /* 设置表单 */
  3558. .settings-section {
  3559. padding: 0 10px;
  3560. }
  3561. .settings-input {
  3562. max-width: 600px;
  3563. }
  3564. .color-picker-wrap {
  3565. display: flex;
  3566. align-items: center;
  3567. }
  3568. .tip-text {
  3569. font-size: 12px;
  3570. color: #999;
  3571. margin-top: 4px;
  3572. }
  3573. .color-val {
  3574. margin-left: 10px;
  3575. color: #666;
  3576. font-family: monospace;
  3577. }
  3578. /* 热词配置样式 */
  3579. .hot-words-config {
  3580. display: flex;
  3581. flex-direction: column;
  3582. gap: 10px;
  3583. width: 800px; /* 加宽配置区域 */
  3584. }
  3585. .hot-word-row {
  3586. display: flex;
  3587. align-items: center;
  3588. gap: 10px;
  3589. }
  3590. .hot-word-input-name {
  3591. width: 200px; /* 稍微加宽名称框 */
  3592. }
  3593. .hot-word-input-link {
  3594. flex: 1; /* 此时地址框会占据剩余更多空间 */
  3595. }
  3596. .add-hotword-btn {
  3597. width: fit-content;
  3598. padding: 0;
  3599. margin-top: 5px;
  3600. }
  3601. .footer-actions {
  3602. padding: 20px 40px;
  3603. border-top: 1px solid #f0f0f0;
  3604. display: flex;
  3605. gap: 15px;
  3606. flex-shrink: 0;
  3607. }
  3608. .btn-confirm {
  3609. padding: 0 30px;
  3610. }
  3611. .btn-reset {
  3612. padding: 0 30px;
  3613. }
  3614. /* 分类设置编辑区 */
  3615. .category-editor {
  3616. padding: 20px 40px;
  3617. display: flex;
  3618. flex-direction: column;
  3619. gap: 40px;
  3620. }
  3621. .category-preview-container {
  3622. padding: 20px 0;
  3623. display: flex;
  3624. justify-content: flex-start;
  3625. }
  3626. /* 图1: 仿真菜单 */
  3627. .category-menu-mockup {
  3628. width: 280px;
  3629. height: 398px;
  3630. background: #f8f9fa;
  3631. border-radius: 4px;
  3632. padding: 10px 0;
  3633. box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
  3634. position: relative;
  3635. z-index: 10;
  3636. overflow: visible; /* 必须可见,否则遮罩层无法伸出 */
  3637. }
  3638. /* 仿真菜单项 */
  3639. .menu-item {
  3640. height: 44px;
  3641. display: flex;
  3642. align-items: center;
  3643. padding: 0 15px;
  3644. cursor: pointer;
  3645. position: relative;
  3646. transition: all 0.1s;
  3647. background: transparent;
  3648. box-sizing: border-box;
  3649. }
  3650. .menu-item:hover {
  3651. background-color: #fff !important;
  3652. color: v-bind(categoryThemeColor);
  3653. border: 1px solid v-bind(categoryThemeColor);
  3654. border-right: none;
  3655. border-radius: 12px 0 0 12px;
  3656. z-index: 1000;
  3657. margin-left: 10px;
  3658. padding-left: 15px;
  3659. width: calc(100% - 10px);
  3660. }
  3661. .menu-icon {
  3662. width: 16px;
  3663. height: 16px;
  3664. margin-right: 15px; /* 增加间距 */
  3665. color: #999;
  3666. display: flex;
  3667. align-items: center;
  3668. justify-content: center;
  3669. flex-shrink: 0;
  3670. }
  3671. .menu-icon img {
  3672. width: 100%;
  3673. height: 100%;
  3674. object-fit: contain;
  3675. }
  3676. .menu-name {
  3677. font-size: 14px;
  3678. color: #333;
  3679. flex: 1;
  3680. white-space: nowrap;
  3681. overflow: hidden;
  3682. text-overflow: ellipsis;
  3683. }
  3684. /* 遮盖层:仅抹除中间垂直线,保留上下边框连贯 */
  3685. .menu-item:hover::after {
  3686. content: '';
  3687. position: absolute;
  3688. top: 0; /* 保持在边框内侧 */
  3689. bottom: 0; /* 保持在边框内侧 */
  3690. right: -1px; /* 贴合右边缘 */
  3691. width: 2px; /* 覆盖面板左边框 */
  3692. background: #fff;
  3693. z-index: 1001;
  3694. }
  3695. .menu-item:hover .menu-icon {
  3696. color: v-bind(categoryThemeColor);
  3697. }
  3698. .menu-name {
  3699. font-size: 14px;
  3700. color: #333;
  3701. }
  3702. .menu-item:hover .menu-name {
  3703. color: v-bind(categoryThemeColor);
  3704. font-weight: bold;
  3705. }
  3706. /* 图2: 右滑面板 */
  3707. .category-panel-mockup {
  3708. position: absolute;
  3709. left: 100%; /* 紧贴菜单项右侧 */
  3710. margin-left: 0;
  3711. top: -1px; /* 顶部边框对齐 */
  3712. width: 980px;
  3713. min-height: 480px;
  3714. background: #fff;
  3715. box-shadow: 15px 15px 40px rgba(0, 0, 0, 0.1);
  3716. border-radius: 0 12px 12px 12px;
  3717. z-index: 500;
  3718. border: 1px solid v-bind(categoryThemeColor);
  3719. display: none;
  3720. flex-direction: column;
  3721. box-sizing: border-box;
  3722. cursor: default;
  3723. }
  3724. /* 悬停时显示面板 */
  3725. .menu-item:hover .category-panel-mockup {
  3726. display: flex;
  3727. }
  3728. .panel-content {
  3729. flex: 1;
  3730. padding: 25px 30px;
  3731. position: relative; /* 为品牌位定位提供基准 */
  3732. overflow: hidden;
  3733. }
  3734. .panel-tabs {
  3735. display: flex;
  3736. gap: 15px;
  3737. margin-bottom: 25px;
  3738. padding-right: 200px; /* 为右上角品牌位留出空间 */
  3739. }
  3740. .panel-tab-item {
  3741. padding: 6px 14px;
  3742. background-color: #f5f5f5;
  3743. color: #666;
  3744. font-size: 12px;
  3745. border-radius: 4px;
  3746. cursor: pointer;
  3747. transition: all 0.2s;
  3748. }
  3749. .panel-tab-item:hover {
  3750. background-color: #f5f5f5; /* 保持浅灰或根据主题调整 */
  3751. color: v-bind(categoryThemeColor);
  3752. filter: brightness(0.95);
  3753. }
  3754. .panel-body {
  3755. display: flex;
  3756. flex-direction: column; /* 改为垂直布局,内容横向撑开 */
  3757. flex: 1;
  3758. }
  3759. .panel-main {
  3760. flex: 1;
  3761. overflow-y: auto;
  3762. max-height: 400px;
  3763. }
  3764. .category-group {
  3765. margin-bottom: 15px;
  3766. display: flex;
  3767. }
  3768. .group-title {
  3769. width: 80px;
  3770. font-size: 12px;
  3771. font-weight: bold;
  3772. color: #333;
  3773. flex-shrink: 0;
  3774. line-height: 1.6;
  3775. }
  3776. .group-items {
  3777. flex: 1;
  3778. display: flex;
  3779. flex-wrap: wrap;
  3780. gap: 6px 15px;
  3781. }
  3782. .group-item {
  3783. font-size: 12px;
  3784. color: #666;
  3785. cursor: pointer;
  3786. transition: color 0.2s;
  3787. }
  3788. .group-item:hover {
  3789. color: v-bind(categoryThemeColor);
  3790. }
  3791. /* 品牌位移至右上角 (图3) */
  3792. .panel-side {
  3793. display: none; /* 移除侧边栏布局 */
  3794. }
  3795. .brand-box {
  3796. position: absolute;
  3797. top: 25px;
  3798. right: 30px;
  3799. display: flex;
  3800. flex-direction: column;
  3801. align-items: flex-end; /* 右对齐更美观 */
  3802. z-index: 105;
  3803. }
  3804. .brand-main-title {
  3805. font-size: 20px;
  3806. font-weight: 900;
  3807. color: v-bind(categoryThemeColor);
  3808. margin-bottom: 4px;
  3809. display: flex;
  3810. align-items: baseline;
  3811. }
  3812. .brand-strong {
  3813. color: #333;
  3814. margin-left: 2px;
  3815. font-size: 20px;
  3816. }
  3817. .brand-notes {
  3818. display: flex;
  3819. gap: 5px;
  3820. color: v-bind(categoryThemeColor);
  3821. font-size: 12px;
  3822. justify-content: flex-end;
  3823. }
  3824. .note-item {
  3825. cursor: pointer;
  3826. }
  3827. .note-sep {
  3828. color: #eee;
  3829. margin: 0 2px;
  3830. }
  3831. /* 工具栏主题色设置 - 专业版 */
  3832. .theme-color-setting-pro {
  3833. display: flex;
  3834. align-items: center;
  3835. gap: 8px;
  3836. margin-right: 20px;
  3837. }
  3838. .theme-color-setting-pro .label {
  3839. font-size: 14px;
  3840. color: #333;
  3841. }
  3842. .theme-color-setting-pro .value {
  3843. font-size: 13px;
  3844. color: #666;
  3845. margin-left: 5px;
  3846. font-family: monospace;
  3847. }
  3848. /* 覆盖 el-color-picker 样式 */
  3849. :deep(.theme-color-setting-pro .el-color-picker__trigger) {
  3850. width: 28px;
  3851. height: 28px;
  3852. padding: 2px;
  3853. border-radius: 4px;
  3854. }
  3855. /* 列表样式 */
  3856. .table-icon-preview {
  3857. width: 24px;
  3858. height: 24px;
  3859. }
  3860. .tag-wrap {
  3861. display: flex;
  3862. flex-wrap: wrap;
  3863. gap: 5px;
  3864. }
  3865. .m-r-5 {
  3866. margin-right: 5px;
  3867. }
  3868. .m-t-20 {
  3869. margin-top: 20px;
  3870. }
  3871. /* 弹窗样式 */
  3872. .panel-config-section {
  3873. background: #fafafa;
  3874. padding: 15px;
  3875. border-radius: 4px;
  3876. border: 1px dashed #eee;
  3877. }
  3878. /* 移除冗余的 .config-subtitle 定义,统一使用下方全局定义的样式 */
  3879. .notes-config-list {
  3880. display: flex;
  3881. flex-direction: column;
  3882. gap: 10px;
  3883. }
  3884. .note-config-row {
  3885. display: flex;
  3886. gap: 10px;
  3887. align-items: center;
  3888. }
  3889. .field-tip {
  3890. font-size: 12px;
  3891. color: #999;
  3892. margin-top: 5px;
  3893. }
  3894. /* 正方形图标上传 */
  3895. .upload-placeholder-square {
  3896. width: 80px;
  3897. height: 80px;
  3898. border: 1px dashed #d9d9d9;
  3899. border-radius: 4px;
  3900. cursor: pointer;
  3901. display: flex;
  3902. align-items: center;
  3903. justify-content: center;
  3904. background-color: #fafafa;
  3905. transition: border-color 0.2s;
  3906. }
  3907. .upload-placeholder-square:hover {
  3908. border-color: v-bind(categoryThemeColor);
  3909. }
  3910. .upload-placeholder-square .upload-icon {
  3911. font-size: 20px;
  3912. color: #999;
  3913. }
  3914. .form-preview-img-square {
  3915. width: 16px;
  3916. height: 16px;
  3917. object-fit: contain;
  3918. }
  3919. /* 头部分类样式 */
  3920. .header-category-editor {
  3921. padding: 20px 40px;
  3922. display: flex;
  3923. flex-direction: column;
  3924. gap: 40px;
  3925. }
  3926. .header-preview-outer {
  3927. width: 100%;
  3928. background: #f8f9fa;
  3929. padding: 40px 20px;
  3930. border-radius: 8px;
  3931. display: block; /* 改为 block 以便支持内部滚动 */
  3932. overflow-x: auto; /* 允许内部滚动,防止溢出 */
  3933. box-sizing: border-box;
  3934. }
  3935. .header-preview-box {
  3936. width: 1350px; /* 强制保持 1350px 宽度以高度还原设计 */
  3937. height: 60px;
  3938. background: #fff;
  3939. box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
  3940. border-radius: 4px;
  3941. display: flex;
  3942. align-items: center;
  3943. padding: 0 40px; /* 为箭头预留空间 */
  3944. margin: 0 auto; /* 在容器足够大时居中 */
  3945. flex-shrink: 0; /* 禁止缩小 */
  3946. position: relative;
  3947. overflow: hidden; /* 关键:确保内部超出部分被剪裁,由滚动容器处理 */
  3948. }
  3949. .header-nav-scroll {
  3950. flex: 1;
  3951. overflow-x: auto;
  3952. scrollbar-width: none;
  3953. display: flex;
  3954. align-items: center;
  3955. scroll-behavior: smooth;
  3956. }
  3957. .header-nav-scroll::-webkit-scrollbar {
  3958. display: none;
  3959. }
  3960. .header-nav-list {
  3961. display: flex;
  3962. align-items: center;
  3963. gap: 30px;
  3964. flex-shrink: 0;
  3965. }
  3966. .nav-arrow {
  3967. position: absolute;
  3968. top: 50%;
  3969. transform: translateY(-50%);
  3970. width: 24px;
  3971. height: 24px;
  3972. background: #eee;
  3973. border-radius: 50%;
  3974. display: flex;
  3975. align-items: center;
  3976. justify-content: center;
  3977. cursor: pointer;
  3978. z-index: 10;
  3979. color: #666;
  3980. transition: all 0.2s;
  3981. box-shadow: 0 2px 6px rgba(0, 0, 0, 0.1);
  3982. }
  3983. .nav-arrow:hover {
  3984. background: #e0e0e0;
  3985. color: #333;
  3986. }
  3987. .left-arrow {
  3988. left: 8px;
  3989. }
  3990. .right-arrow {
  3991. right: 8px;
  3992. }
  3993. .header-nav-item {
  3994. display: flex;
  3995. align-items: center;
  3996. gap: 8px;
  3997. cursor: pointer;
  3998. white-space: nowrap;
  3999. flex-shrink: 0;
  4000. }
  4001. .header-nav-item .item-icon {
  4002. width: 22px;
  4003. height: 22px;
  4004. display: flex;
  4005. align-items: center;
  4006. justify-content: center;
  4007. }
  4008. .header-nav-item .item-icon img {
  4009. width: 100%;
  4010. height: 100%;
  4011. object-fit: contain;
  4012. }
  4013. .header-nav-item .item-text {
  4014. font-size: 16px;
  4015. font-weight: bold;
  4016. color: #333;
  4017. transition: color 0.2s;
  4018. }
  4019. .header-nav-item:hover .item-text {
  4020. color: var(--hover-color);
  4021. }
  4022. /* 广告模块样式 */
  4023. .ad-preview-grid {
  4024. display: flex;
  4025. flex-wrap: nowrap;
  4026. gap: 20px;
  4027. max-width: 1600px;
  4028. margin: 0;
  4029. }
  4030. .ad-item {
  4031. background: #f8f9fa;
  4032. border-radius: 12px;
  4033. padding: 15px;
  4034. position: relative;
  4035. overflow: hidden;
  4036. box-sizing: border-box;
  4037. }
  4038. .ad-item:hover .ad-hover-mask {
  4039. display: flex;
  4040. }
  4041. .ad-hover-mask {
  4042. position: absolute;
  4043. top: 0;
  4044. left: 0;
  4045. right: 0;
  4046. bottom: 0;
  4047. background: rgba(0, 0, 0, 0.4);
  4048. display: none;
  4049. align-items: center;
  4050. justify-content: center;
  4051. z-index: 100;
  4052. }
  4053. .ad-header {
  4054. display: flex;
  4055. justify-content: space-between;
  4056. align-items: baseline;
  4057. margin-bottom: 12px;
  4058. }
  4059. .ad-title-main {
  4060. font-size: 18px;
  4061. font-weight: 800;
  4062. color: #333;
  4063. }
  4064. .ad-title-sub {
  4065. font-size: 13px;
  4066. }
  4067. .ad-title-sub.orange {
  4068. color: #f58220;
  4069. }
  4070. .ad-title-sub.gray {
  4071. color: #999;
  4072. }
  4073. /* Ad 1: 百亿补贴 */
  4074. .ad-products-subsidy {
  4075. display: flex;
  4076. gap: 15px;
  4077. }
  4078. .ad-subsidy .product-item {
  4079. flex: 1;
  4080. text-align: center;
  4081. }
  4082. .ad-subsidy .product-img {
  4083. width: 94px;
  4084. height: 94px;
  4085. background: #fff;
  4086. border-radius: 8px;
  4087. margin-bottom: 8px;
  4088. overflow: hidden;
  4089. }
  4090. .ad-subsidy .product-img img {
  4091. width: 100%;
  4092. height: 100%;
  4093. object-fit: contain;
  4094. }
  4095. .ad-subsidy .product-price {
  4096. color: #e60012;
  4097. font-weight: bold;
  4098. font-size: 15px;
  4099. }
  4100. .ad-ranking {
  4101. padding: 12px !important;
  4102. }
  4103. .ad-ranking .ad-header {
  4104. margin-bottom: 8px;
  4105. }
  4106. /* Ad 2: 榜单 */
  4107. .ad-products-ranking {
  4108. display: flex;
  4109. gap: 8px;
  4110. flex: 1;
  4111. }
  4112. .ranking-item {
  4113. flex: 1;
  4114. background: #fff;
  4115. border-radius: 8px;
  4116. padding: 6px 5px 0;
  4117. position: relative;
  4118. text-align: center;
  4119. display: flex;
  4120. flex-direction: column;
  4121. align-items: center;
  4122. overflow: hidden;
  4123. height: 135px; /* 高度调小一点 */
  4124. }
  4125. .ranking-badge {
  4126. display: inline-block;
  4127. background: #fff3e5;
  4128. color: #f58220;
  4129. font-size: 11px;
  4130. padding: 2px 10px;
  4131. border-radius: 20px;
  4132. white-space: nowrap;
  4133. margin-bottom: 4px;
  4134. transform: scale(0.9); /* 略微缩小标签以腾出空间 */
  4135. }
  4136. .ranking-item .product-img {
  4137. width: 80px; /* 略微缩小图片从 84 降至 80 */
  4138. height: 80px;
  4139. margin-bottom: 4px;
  4140. display: flex;
  4141. align-items: center;
  4142. justify-content: center;
  4143. }
  4144. .ranking-item .product-img img {
  4145. width: 100%;
  4146. height: 100%;
  4147. object-fit: contain;
  4148. }
  4149. .ranking-footer {
  4150. background: #fff1f1;
  4151. color: #e60012;
  4152. font-size: 12px;
  4153. padding: 5px 0;
  4154. font-weight: bold;
  4155. width: 100%;
  4156. margin-top: auto;
  4157. line-height: 1.2;
  4158. }
  4159. /* Ad 3: 品牌 */
  4160. .ad-brands-content {
  4161. display: flex;
  4162. gap: 10px;
  4163. }
  4164. .brand-item {
  4165. flex: 1;
  4166. text-align: center;
  4167. }
  4168. .brand-logo {
  4169. width: 50px;
  4170. height: 50px;
  4171. margin: 0 auto 8px;
  4172. background: #fff;
  4173. border-radius: 4px;
  4174. padding: 5px;
  4175. }
  4176. .brand-logo img {
  4177. width: 100%;
  4178. height: 100%;
  4179. object-fit: contain;
  4180. }
  4181. .brand-name {
  4182. font-size: 11px;
  4183. color: #0071bc;
  4184. margin-bottom: 5px;
  4185. height: 20px;
  4186. line-height: 20px;
  4187. white-space: nowrap;
  4188. overflow: hidden;
  4189. text-overflow: ellipsis;
  4190. width: 100%;
  4191. }
  4192. .brand-tag-btn {
  4193. display: inline-block;
  4194. padding: 2px 10px;
  4195. border: 1px solid #e60012;
  4196. color: #e60012;
  4197. border-radius: 10px;
  4198. font-size: 11px;
  4199. }
  4200. /* Ad 4 & 5: 精选/新品 */
  4201. .ad-products-selection {
  4202. display: flex;
  4203. gap: 10px;
  4204. }
  4205. .selection-item {
  4206. flex: 1;
  4207. text-align: center;
  4208. }
  4209. .selection-item .product-img {
  4210. width: 84px;
  4211. height: 84px;
  4212. background: #fff;
  4213. border-radius: 8px;
  4214. margin-bottom: 5px;
  4215. }
  4216. .selection-item .product-img img {
  4217. width: 100%;
  4218. height: 100%;
  4219. object-fit: contain;
  4220. }
  4221. .product-price-row {
  4222. display: flex;
  4223. align-items: baseline;
  4224. justify-content: flex-start;
  4225. gap: 2px;
  4226. }
  4227. .product-price-row.center {
  4228. justify-content: center;
  4229. }
  4230. .p-unit {
  4231. font-size: 12px;
  4232. color: #e60012;
  4233. font-weight: bold;
  4234. }
  4235. .p-val {
  4236. font-size: 16px;
  4237. color: #e60012;
  4238. font-weight: 800;
  4239. }
  4240. .p-tag {
  4241. background: #3fa9f5;
  4242. color: #fff;
  4243. font-size: 10px;
  4244. padding: 0 4px;
  4245. border-radius: 2px;
  4246. margin-left: 2px;
  4247. }
  4248. /* 选择弹窗样式 */
  4249. .select-item-row {
  4250. display: flex;
  4251. align-items: center;
  4252. padding: 12px;
  4253. border: 1px solid #eee;
  4254. border-radius: 8px;
  4255. margin-bottom: 10px;
  4256. cursor: pointer;
  4257. transition: all 0.2s;
  4258. }
  4259. .select-item-row:hover {
  4260. border-color: #409eff;
  4261. background: #f0f7ff;
  4262. }
  4263. .select-item-row.active {
  4264. border-color: #409eff;
  4265. background: #f0f7ff;
  4266. }
  4267. .select-item-img {
  4268. width: 80px;
  4269. height: 80px;
  4270. object-fit: contain;
  4271. margin-right: 20px;
  4272. background: #f9f9f9;
  4273. border-radius: 4px;
  4274. }
  4275. .select-item-info {
  4276. flex: 1;
  4277. }
  4278. .select-item-name {
  4279. font-size: 14px;
  4280. color: #333;
  4281. margin-bottom: 4px;
  4282. }
  4283. .select-item-price {
  4284. color: #e60012;
  4285. font-weight: bold;
  4286. }
  4287. .select-pagination {
  4288. margin-top: 30px;
  4289. display: flex;
  4290. justify-content: center;
  4291. padding-bottom: 20px;
  4292. }
  4293. .select-item-id {
  4294. font-size: 11px;
  4295. color: #999;
  4296. margin-top: 2px;
  4297. }
  4298. /* 场景方案预览样式 */
  4299. .scenario-preview-outer {
  4300. width: 100%;
  4301. overflow-x: auto;
  4302. padding: 10px 0;
  4303. }
  4304. .scenario-preview-box-clean {
  4305. width: 1600px;
  4306. max-width: 100%;
  4307. height: 158px;
  4308. background: var(--s-theme-color, #66e0a3);
  4309. border-radius: 16px; /* 加大圆角 */
  4310. display: flex;
  4311. align-items: center;
  4312. padding: 0 20px 0 32px; /* 减小左边距使标题区左移 */
  4313. box-sizing: border-box;
  4314. position: relative;
  4315. overflow: hidden;
  4316. }
  4317. .s-title-group {
  4318. display: flex;
  4319. align-items: center;
  4320. gap: 12px;
  4321. margin-bottom: 12px;
  4322. white-space: nowrap; /* 强制不换行,向后追加 */
  4323. }
  4324. .s-main-title {
  4325. font-size: 24px; /* 调整为 24px */
  4326. font-weight: 900;
  4327. color: #fff;
  4328. flex-shrink: 0; /* 确保不收缩 */
  4329. }
  4330. .s-sub-title-inline {
  4331. font-size: 24px; /* 调整为 24px */
  4332. font-weight: 900;
  4333. color: #fff;
  4334. flex-shrink: 0; /* 确保不收缩 */
  4335. }
  4336. .s-btn-wrap {
  4337. margin-top: 15px;
  4338. }
  4339. .s-btn-premium {
  4340. display: inline-flex;
  4341. align-items: center;
  4342. background-color: #fff;
  4343. color: #e60012;
  4344. font-size: 14px;
  4345. font-weight: bold;
  4346. padding: 6px 20px;
  4347. border-radius: 20px;
  4348. }
  4349. .scenario-card-premium {
  4350. width: 288px;
  4351. height: 130px;
  4352. border-radius: 8px;
  4353. display: flex;
  4354. flex-direction: column;
  4355. position: relative;
  4356. }
  4357. .card-top-header {
  4358. height: 42px; /* 固定高度,确保下方图片间距准确 */
  4359. display: flex;
  4360. justify-content: space-between;
  4361. align-items: center;
  4362. padding: 0 12px;
  4363. box-sizing: border-box;
  4364. }
  4365. .card-titles-group {
  4366. display: flex;
  4367. align-items: center;
  4368. gap: 8px;
  4369. }
  4370. .card-main-title {
  4371. font-size: 15px;
  4372. font-weight: bold;
  4373. }
  4374. .card-sub-title {
  4375. font-size: 13px;
  4376. font-weight: bold;
  4377. }
  4378. .card-arrow-icon {
  4379. width: 18px;
  4380. height: 18px;
  4381. border-radius: 50%;
  4382. color: #fff;
  4383. display: flex;
  4384. align-items: center;
  4385. justify-content: center;
  4386. font-size: 10px;
  4387. }
  4388. .card-image-content {
  4389. width: 272px;
  4390. height: 80px;
  4391. margin: 0 8px 8px 8px; /* 左右下保留相同间距 (8px) */
  4392. border-radius: 4px;
  4393. overflow: hidden;
  4394. }
  4395. .card-image-content img {
  4396. width: 100%;
  4397. height: 100%;
  4398. object-fit: cover;
  4399. }
  4400. /* 响应式逻辑:优先隐藏最后一个方案卡片,再隐藏副标题 */
  4401. @media (max-width: 1680px) {
  4402. .scenario-preview-box-clean {
  4403. width: 1300px;
  4404. }
  4405. .hidden-card-fourth {
  4406. display: none !important;
  4407. }
  4408. }
  4409. @media (max-width: 1400px) {
  4410. .scenario-preview-box-clean {
  4411. width: 1000px;
  4412. }
  4413. .s-sub-title-inline {
  4414. display: none !important;
  4415. }
  4416. }
  4417. .scenario-header-left {
  4418. width: 320px;
  4419. flex-shrink: 0;
  4420. display: flex;
  4421. flex-direction: column;
  4422. }
  4423. .scenario-cards-wrap {
  4424. flex: 1;
  4425. display: flex;
  4426. justify-content: flex-end;
  4427. gap: 12px; /* 间距调小 */
  4428. }
  4429. .scenario-card {
  4430. width: 288px;
  4431. height: 130px;
  4432. background-color: #fff;
  4433. border-radius: 12px;
  4434. padding: 12px;
  4435. box-sizing: border-box;
  4436. display: flex;
  4437. flex-direction: column;
  4438. transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  4439. cursor: pointer;
  4440. box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
  4441. border: 1px solid rgba(0, 0, 0, 0.02);
  4442. }
  4443. .scenario-card:hover {
  4444. transform: translateY(-8px);
  4445. box-shadow: 0 12px 24px rgba(0, 0, 0, 0.1);
  4446. border-color: rgba(102, 224, 163, 0.3);
  4447. }
  4448. .card-top {
  4449. display: flex;
  4450. justify-content: space-between;
  4451. align-items: center;
  4452. margin-bottom: 8px;
  4453. padding: 0 5px;
  4454. }
  4455. .card-titles {
  4456. display: flex;
  4457. align-items: center;
  4458. gap: 8px;
  4459. }
  4460. .card-main-title {
  4461. font-size: 18px;
  4462. font-weight: bold;
  4463. }
  4464. .card-sub-title {
  4465. font-size: 12px;
  4466. }
  4467. .card-arrow {
  4468. width: 18px;
  4469. height: 18px;
  4470. border-radius: 50%;
  4471. color: #fff;
  4472. display: flex;
  4473. align-items: center;
  4474. justify-content: center;
  4475. font-size: 10px;
  4476. }
  4477. .card-img {
  4478. width: 272px;
  4479. height: 80px;
  4480. border-radius: 6px;
  4481. overflow: hidden;
  4482. background-color: #f5f7fa;
  4483. }
  4484. .card-img img {
  4485. width: 100%;
  4486. height: 100%;
  4487. object-fit: cover;
  4488. }
  4489. /* 响应式调整 */
  4490. @media (max-width: 1500px) {
  4491. .scenario-preview-box {
  4492. width: 1300px;
  4493. }
  4494. .hidden-card-fourth {
  4495. display: none !important;
  4496. }
  4497. }
  4498. @media (max-width: 1200px) {
  4499. .scenario-preview-box {
  4500. width: 1000px;
  4501. }
  4502. .s-sub-title {
  4503. display: none !important;
  4504. }
  4505. }
  4506. /* 广告模块弹窗精修 */
  4507. .ad-setup-dialog :deep(.el-dialog__body) {
  4508. padding: 30px 40px;
  4509. max-height: 700px;
  4510. overflow-y: auto;
  4511. }
  4512. .brand-name-display {
  4513. font-size: 15px;
  4514. font-weight: bold;
  4515. color: #333;
  4516. }
  4517. .ad-setup-dialog :deep(.el-table__row) {
  4518. height: 90px; /* 增加行高,大气美观 */
  4519. }
  4520. .config-subtitle {
  4521. font-size: 15px;
  4522. font-weight: bold;
  4523. color: #333;
  4524. margin: 25px 0 15px;
  4525. display: flex;
  4526. align-items: center;
  4527. line-height: 1;
  4528. }
  4529. .config-subtitle::before {
  4530. content: '';
  4531. width: 3px;
  4532. height: 14px;
  4533. background: #e60012;
  4534. margin-right: 8px;
  4535. }
  4536. /* 快捷入口预览样式 */
  4537. .quick-entry-preview-outer {
  4538. display: flex;
  4539. flex-direction: column;
  4540. align-items: flex-start;
  4541. padding: 20px 0;
  4542. }
  4543. .qe-mockup-card {
  4544. width: 230px;
  4545. height: 167px;
  4546. background: #fff;
  4547. border-radius: 12px;
  4548. box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
  4549. padding: 12px 16px;
  4550. box-sizing: border-box;
  4551. display: flex;
  4552. flex-direction: column;
  4553. overflow: hidden;
  4554. position: relative;
  4555. }
  4556. .qe-card-header {
  4557. display: flex;
  4558. justify-content: space-between;
  4559. align-items: center;
  4560. margin-bottom: 12px;
  4561. }
  4562. .qe-card-title {
  4563. font-size: 16px;
  4564. font-weight: bold;
  4565. color: #333;
  4566. }
  4567. .qe-header-arrow {
  4568. font-size: 12px;
  4569. color: #999;
  4570. }
  4571. .qe-grid-container {
  4572. width: 198px;
  4573. height: 108px;
  4574. margin: 0 auto;
  4575. position: relative;
  4576. overflow: hidden;
  4577. }
  4578. .qe-grid-wrapper {
  4579. display: flex;
  4580. transition: transform 0.4s cubic-bezier(0.4, 0, 0.2, 1);
  4581. height: 100%;
  4582. }
  4583. .qe-grid-page {
  4584. width: 198px;
  4585. flex-shrink: 0;
  4586. display: grid;
  4587. grid-template-columns: repeat(4, 1fr);
  4588. grid-template-rows: repeat(2, 1fr);
  4589. gap: 12px 0;
  4590. }
  4591. .qe-item {
  4592. display: flex;
  4593. flex-direction: column;
  4594. align-items: center;
  4595. gap: 4px;
  4596. }
  4597. .qe-icon-wrap {
  4598. width: 24px;
  4599. height: 24px;
  4600. position: relative;
  4601. display: flex;
  4602. align-items: center;
  4603. justify-content: center;
  4604. }
  4605. .qe-icon-img {
  4606. width: 24px;
  4607. height: 24px;
  4608. object-fit: contain;
  4609. }
  4610. .qe-icon-placeholder {
  4611. font-size: 20px;
  4612. color: #666;
  4613. }
  4614. .qe-tag-bubble {
  4615. position: absolute;
  4616. top: -8px;
  4617. right: -15px;
  4618. background: #ff4d4f;
  4619. color: #fff;
  4620. font-size: 9px; /* 精确 9px */
  4621. padding: 1px 5px;
  4622. border-radius: 10px;
  4623. white-space: nowrap;
  4624. transform: scale(0.9);
  4625. z-index: 100; /* 提升至最高图层 */
  4626. }
  4627. .qe-name {
  4628. font-size: 11px; /* 精确 11px */
  4629. color: #333;
  4630. text-align: center;
  4631. white-space: nowrap;
  4632. overflow: hidden;
  4633. text-overflow: ellipsis;
  4634. width: 100%;
  4635. }
  4636. .qe-nav-btns {
  4637. position: absolute;
  4638. top: 0;
  4639. left: 0;
  4640. right: 0;
  4641. bottom: 0;
  4642. pointer-events: none;
  4643. }
  4644. .qe-nav-btn {
  4645. position: absolute;
  4646. top: 50%;
  4647. transform: translateY(-50%);
  4648. width: 22px;
  4649. height: 22px;
  4650. background: rgba(255, 255, 255, 0.9);
  4651. border-radius: 50%;
  4652. box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
  4653. display: flex;
  4654. align-items: center;
  4655. justify-content: center;
  4656. cursor: pointer;
  4657. pointer-events: auto;
  4658. color: #666;
  4659. z-index: 110; /* 提升至最高图层,确保不被内容遮挡 */
  4660. }
  4661. .qe-nav-btn:hover {
  4662. background: #fff;
  4663. color: #e60012;
  4664. }
  4665. .qe-nav-btn.prev {
  4666. left: -10px;
  4667. }
  4668. .qe-nav-btn.next {
  4669. right: -10px;
  4670. }
  4671. /* 快捷入口编辑器特定样式 */
  4672. .quick-entry-editor {
  4673. display: flex;
  4674. flex-direction: column;
  4675. padding: 20px 40px;
  4676. gap: 30px;
  4677. }
  4678. .config-form-inline {
  4679. background: #fcfdfe;
  4680. padding: 20px;
  4681. border-radius: 8px;
  4682. border: 1px solid #eef2f6;
  4683. }
  4684. .table-icon-cell {
  4685. display: flex;
  4686. align-items: center;
  4687. justify-content: center;
  4688. }
  4689. /* 推荐设置编辑区容器 */
  4690. .recommend-editor-container {
  4691. padding: 24px;
  4692. border-bottom: none !important;
  4693. }
  4694. /* 推荐设置预览样式 */
  4695. .recommend-preview-outer {
  4696. width: 100%;
  4697. padding: 10px 0 20px;
  4698. position: relative;
  4699. }
  4700. .recommend-preview-container {
  4701. width: 1600px !important; /* 严格按照要求设置背景尺寸 */
  4702. height: 88px !important;
  4703. position: relative;
  4704. background: #fff;
  4705. border-radius: 8px;
  4706. box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
  4707. overflow: hidden;
  4708. margin-bottom: 10px;
  4709. }
  4710. .recommend-preview-box {
  4711. width: 100% !important;
  4712. height: 100% !important;
  4713. display: flex;
  4714. align-items: center;
  4715. padding: 0 40px;
  4716. box-sizing: border-box;
  4717. overflow-x: auto;
  4718. scroll-behavior: smooth;
  4719. -ms-overflow-style: none;
  4720. scrollbar-width: none;
  4721. }
  4722. .recommend-preview-box::-webkit-scrollbar {
  4723. display: none;
  4724. }
  4725. .recommend-item {
  4726. display: flex;
  4727. align-items: center;
  4728. padding: 10px 24px;
  4729. margin: 0 4px;
  4730. cursor: pointer;
  4731. transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  4732. height: 60px;
  4733. border-radius: 8px;
  4734. flex-shrink: 0;
  4735. }
  4736. .recommend-item:hover {
  4737. background: #f5f5f5;
  4738. }
  4739. .recommend-item.active {
  4740. background: transparent;
  4741. }
  4742. .recommend-icon {
  4743. width: 32px;
  4744. height: 32px;
  4745. margin-right: 12px;
  4746. flex-shrink: 0;
  4747. display: flex;
  4748. align-items: center;
  4749. justify-content: center;
  4750. }
  4751. .table-icon-preview {
  4752. width: 40px;
  4753. height: 40px;
  4754. background: #f5f5f5;
  4755. border-radius: 4px;
  4756. display: flex;
  4757. align-items: center;
  4758. justify-content: center;
  4759. margin: 0 auto;
  4760. overflow: hidden;
  4761. }
  4762. .row-icon {
  4763. width: 100%;
  4764. height: 100%;
  4765. object-fit: contain;
  4766. }
  4767. .recommend-text {
  4768. display: flex;
  4769. flex-direction: column;
  4770. white-space: nowrap;
  4771. }
  4772. .r-main-title {
  4773. font-size: 16px;
  4774. font-weight: bold;
  4775. line-height: 1.4;
  4776. white-space: nowrap;
  4777. }
  4778. .r-sub-title {
  4779. font-size: 12px;
  4780. color: #999;
  4781. margin-top: 2px;
  4782. white-space: nowrap;
  4783. }
  4784. .recommend-nav-btn {
  4785. position: absolute;
  4786. top: 50%;
  4787. transform: translateY(-50%);
  4788. width: 32px;
  4789. height: 32px;
  4790. background: rgba(255, 255, 255, 0.9);
  4791. box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
  4792. border-radius: 50%;
  4793. display: flex;
  4794. align-items: center;
  4795. justify-content: center;
  4796. cursor: pointer;
  4797. color: #666;
  4798. z-index: 100;
  4799. transition: all 0.2s;
  4800. border: 1px solid #eee;
  4801. }
  4802. .recommend-nav-btn:hover {
  4803. color: var(--r-theme-color);
  4804. background: #fff;
  4805. box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
  4806. }
  4807. .recommend-nav-btn.prev {
  4808. left: 10px;
  4809. }
  4810. .recommend-nav-btn.next {
  4811. right: 10px;
  4812. }
  4813. /* 修复色块标签换行 */
  4814. .config-section-standard :deep(.el-form-item__label) {
  4815. white-space: nowrap;
  4816. }
  4817. /* 去除底部冗余线条 */
  4818. .recommend-editor-container :deep(.el-table__inner-wrapper::before),
  4819. .recommend-editor-container :deep(.el-table--border::after),
  4820. .recommend-editor-container :deep(.el-table--group::after),
  4821. .recommend-editor-container :deep(.el-table::before) {
  4822. display: none !important;
  4823. }
  4824. .recommend-icon img {
  4825. width: 100%;
  4826. height: 100%;
  4827. object-fit: contain;
  4828. background: #f2f2f2;
  4829. border-radius: 4px;
  4830. }
  4831. /* 已选商品管理弹窗增强 */
  4832. .selected-products-header {
  4833. display: flex;
  4834. justify-content: space-between;
  4835. align-items: center;
  4836. margin-bottom: 20px;
  4837. padding: 10px 0;
  4838. }
  4839. .selected-products-header .right-info {
  4840. font-size: 14px;
  4841. color: #666;
  4842. }
  4843. .selected-products-header .count {
  4844. color: #e60012;
  4845. font-weight: 800;
  4846. margin: 0 4px;
  4847. }
  4848. .price-text {
  4849. color: #e60012;
  4850. font-weight: bold;
  4851. }
  4852. .empty-placeholder {
  4853. padding: 60px 0;
  4854. }
  4855. /* 商品多选抽屉样式 */
  4856. .product-selection-drawer :deep(.el-drawer__body) {
  4857. padding: 0;
  4858. background: #fcfdfe;
  4859. }
  4860. .drawer-content-wrapper {
  4861. display: flex;
  4862. flex-direction: column;
  4863. height: 100%;
  4864. }
  4865. .drawer-search-bar {
  4866. padding: 20px;
  4867. background: #fff;
  4868. border-bottom: 1px solid #f0f2f5;
  4869. }
  4870. .drawer-stat-bar {
  4871. padding: 12px 20px;
  4872. background: #e6f7ff;
  4873. border: 1px solid #91d5ff;
  4874. color: #1890ff;
  4875. font-size: 13px;
  4876. display: flex;
  4877. align-items: center;
  4878. gap: 8px;
  4879. margin: 15px 20px 0;
  4880. border-radius: 4px;
  4881. }
  4882. .drawer-stat-bar .highlight {
  4883. font-weight: bold;
  4884. font-size: 16px;
  4885. margin: 0 2px;
  4886. }
  4887. .drawer-content-wrapper :deep(.el-table) {
  4888. margin: 15px 20px;
  4889. width: auto !important;
  4890. }
  4891. .drawer-product-info {
  4892. display: flex;
  4893. align-items: center;
  4894. gap: 12px;
  4895. }
  4896. .drawer-product-info .mini-img {
  4897. width: 50px;
  4898. height: 50px;
  4899. border-radius: 4px;
  4900. border: 1px solid #f0f0f0;
  4901. flex-shrink: 0;
  4902. }
  4903. .drawer-product-info .detail {
  4904. flex: 1;
  4905. overflow: hidden;
  4906. }
  4907. .drawer-product-info .name {
  4908. font-size: 13px;
  4909. color: #333;
  4910. line-height: 1.4;
  4911. margin-bottom: 4px;
  4912. display: -webkit-box;
  4913. -webkit-line-clamp: 2;
  4914. -webkit-box-orient: vertical;
  4915. overflow: hidden;
  4916. }
  4917. .drawer-product-info .id {
  4918. font-size: 11px;
  4919. color: #999;
  4920. }
  4921. .drawer-product-info .price {
  4922. color: #e60012;
  4923. font-weight: bold;
  4924. margin-top: 2px;
  4925. }
  4926. .drawer-pagination {
  4927. padding: 20px;
  4928. display: flex;
  4929. justify-content: center;
  4930. background: #fff;
  4931. border-top: 1px solid #f0f2f5;
  4932. }
  4933. .drawer-footer-actions {
  4934. display: flex;
  4935. justify-content: flex-end;
  4936. gap: 12px;
  4937. padding: 20px;
  4938. }
  4939. .m-l-10 {
  4940. margin-left: 10px;
  4941. }
  4942. </style>