index-fuli.vue 19 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729
  1. <template>
  2. <div class="home-pages">
  3. <div class="head-pages">
  4. <!-- 头部 -->
  5. <div class="home-head" @mouseleave="leaveClassify">
  6. <div class="classify" :class="classifyShow ? 'classify-show' : ''">
  7. <div
  8. class="classify-list"
  9. v-for="(item, index) in classifyList"
  10. :class="item.id == classifyId && classifyShow ? 'classify-hig' : ''"
  11. :key="index"
  12. @mouseenter="enterClassify(item)"
  13. v-show="classifyShow ? true : Number(index) < 13"
  14. >
  15. <div class="label ellipsis" @click="onPath('/search?id=' + item.id)">{{ item.label }}</div>
  16. <div class="info info1 ellipsis" v-if="item.extra && item.extra.oneLable1">{{ item.extra.oneLable1 }}</div>
  17. <div class="info ellipsis" v-if="item.extra && item.extra.oneLable2">{{ item.extra.oneLable2 }}</div>
  18. <div v-if="item.id == classifyId && classifyShow" class="classify-border"></div>
  19. <!-- -->
  20. </div>
  21. </div>
  22. <div class="classify-bos" v-if="classifyShow">
  23. <div v-for="(item, index) in classifyInfo" :key="index" class="classify-item">
  24. <div class="two-level ellipsis">{{ item.label || '' }}</div>
  25. <el-icon class="classify-icon" :size="14" color="#364153">
  26. <ArrowRight />
  27. </el-icon>
  28. <div class="classify-label">
  29. <div v-for="(item1, index1) in item.children" :key="index1">{{ item1.label || '' }}</div>
  30. </div>
  31. </div>
  32. </div>
  33. <!-- 轮播区域 -->
  34. <div class="carousel-bos">
  35. <el-carousel trigger="click" height="540px">
  36. <el-carousel-item v-for="item in carouselList" :key="item">
  37. <img :src="item.imageUrl" alt="" />
  38. </el-carousel-item>
  39. </el-carousel>
  40. </div>
  41. <!-- 右边 -->
  42. <div class="head-right">
  43. <div class="login-bos">
  44. <div class="login-box">
  45. <img :src="userInfo.avatar ? userInfo.avatar : profile" alt="" />
  46. <div>
  47. <div class="login1">您好,欢迎来到优易达</div>
  48. <div class="login2">{{ userInfo.nickName ? userInfo.nickName : '请先登录' }}</div>
  49. </div>
  50. </div>
  51. <div class="login-btn">
  52. <el-button v-if="!userInfo.nickName" type="primary" round size="small" style="width: 64px" @click="onPath('/login')">登录</el-button>
  53. <el-button v-if="!userInfo.nickName" type="primary" plain round size="small" style="width: 64px" @click="onPath('/reg')"
  54. >注册</el-button
  55. >
  56. <el-button v-if="userInfo.nickName" type="primary" plain round size="small" style="width: 64px" @click="onPath('/reg')">退出</el-button>
  57. </div>
  58. </div>
  59. <div class="real-time">
  60. <div class="real-title flex-row-between">
  61. <div class="real1">优易资讯</div>
  62. <div class="real2 flex-row-start">
  63. <div>更多</div>
  64. <el-icon :size="13" color="#83899F">
  65. <ArrowRight />
  66. </el-icon>
  67. </div>
  68. </div>
  69. <template v-for="(item, index) in realList" :key="index">
  70. <div class="real-list ellipsis" v-if="Number(index) < 7">{{ item.announcementTitle }}</div>
  71. </template>
  72. </div>
  73. <div class="interests">
  74. <div class="interests-title">企业会员权益</div>
  75. <div class="interests-bos">
  76. <div v-for="(item, index) in interestsList" :key="index" class="interests-item flex-column-center">
  77. <img :src="item.imageUrl" alt="" />
  78. <div>{{ item.title }}</div>
  79. </div>
  80. </div>
  81. </div>
  82. </div>
  83. </div>
  84. </div>
  85. <div class="pages-bos">
  86. <!-- 场景采购 -->
  87. <div class="home-title flex-row-center">
  88. <img src="@/assets/images/home/indexFuli1.png" alt="" />
  89. 场景采购
  90. <img src="@/assets/images/home/indexFuli2.png" alt="" />
  91. </div>
  92. <div class="scenario-bos">
  93. <template v-for="(item, index) in scenario" :key="index">
  94. <div v-if="Number(index) < 4" class="scenario-list">
  95. <img class="shop-img" :src="item.imageUrl" alt="" />
  96. </div>
  97. </template>
  98. </div>
  99. <!-- 热门定制 -->
  100. <div class="home-title flex-row-center">
  101. <img src="@/assets/images/home/indexFuli1.png" alt="" />
  102. 热门定制
  103. <img src="@/assets/images/home/indexFuli2.png" alt="" />
  104. </div>
  105. <div class="sell-bos">
  106. <template v-for="(item, index) in popular" :key="index">
  107. <div v-if="Number(index) < 5" class="sell-list">
  108. <img class="sell-img" :src="item.productImage" alt="" />
  109. <div class="sell-name ellipsis2">{{ item.itemName || '' }}</div>
  110. <div class="sell-price">
  111. <span class="price1">¥{{ item.memberPrice || '' }}</span>
  112. <span class="price2">¥{{ item.marketPrice || '' }}</span>
  113. </div>
  114. </div>
  115. </template>
  116. </div>
  117. <!-- 循环数据 -->
  118. <div class="goods-bos" v-for="(item, index) in goodsList" :key="index">
  119. <img class="goods-main" :src="item.mainImg" alt="" />
  120. <div class="goods-box">
  121. <div v-for="(item1, index1) in 8" :key="index1" class="goods-list">
  122. <img class="goods-img" :src="item.productImage ? item.productImage.split(',')[0] : ''" alt="" />
  123. <div class="goods-name ellipsis2">{{ item.name || '' }}</div>
  124. <div class="goods-price">
  125. <span class="price1">¥{{ item.memberPrice || '' }}</span>
  126. <span class="price2">¥{{ item.marketPrice || '' }}</span>
  127. </div>
  128. </div>
  129. </div>
  130. </div>
  131. <!-- 为您推荐 -->
  132. <div class="home-title flex-row-center">
  133. <img src="@/assets/images/home/indexFuli1.png" alt="" />
  134. 为您推荐
  135. <img src="@/assets/images/home/indexFuli2.png" alt="" />
  136. </div>
  137. <div class="sell-bos recommend">
  138. <div v-for="(item, index) in recommend" :key="index" class="sell-list">
  139. <img class="sell-img" :src="item.productImage ? item.productImage.split(',')[0] : ''" alt="" />
  140. <div class="sell-name ellipsis2">{{ item.name || '格力KFR-72LW/定频冷暖空调柜机3P格力KFR行车自行车自行车行政村在' }}</div>
  141. <div class="sell-price">
  142. <span class="price1">¥{{ item.memberPrice || '23.22' }}</span>
  143. <span class="price2">¥{{ item.marketPrice || '52.12' }}</span>
  144. </div>
  145. </div>
  146. </div>
  147. </div>
  148. </div>
  149. </template>
  150. <script setup lang="ts">
  151. import { onPath } from '@/utils/siteConfig';
  152. import { getToken } from '@/utils/auth';
  153. import { getInfo } from '@/api/login';
  154. import profile from '@/assets/images/profile.jpg';
  155. import {
  156. getGiftCategoryList,
  157. getHomeAdList,
  158. getIconAdList,
  159. getNoticeList,
  160. getRecommendAdList,
  161. getHotCustomGiftFloorList,
  162. getAdvertisementGiftFloorList,
  163. getGiftFloorLinkProductList,
  164. getRecommendGiftFloorList
  165. } from '@/api/home/index-fuli';
  166. import { getProductCategoryTree } from '@/api/home/index';
  167. onMounted(() => {
  168. if (getToken()) {
  169. getInfo().then((res) => {
  170. if (res.code == 200) {
  171. userInfo.value = res.data.user;
  172. }
  173. });
  174. }
  175. });
  176. const userInfo = ref<any>({});
  177. const classifyList = ref<any>([]);
  178. const classifyShow = ref<any>(false);
  179. const classifyId = ref<any>('');
  180. const classifyInfo = ref<any>([]);
  181. const carouselList = ref<any>([]);
  182. const realList = ref<any>([]);
  183. const interestsList = ref<any>([]);
  184. const scenario = ref<any>([]);
  185. const popular = ref<any>([]);
  186. const goodsList = ref<any>([]);
  187. const recommend = ref<any>([]);
  188. //头部分类
  189. getProductCategoryTree({}).then((res) => {
  190. if (res.code == 200) {
  191. classifyList.value = res.data;
  192. }
  193. });
  194. //移入分类
  195. const enterClassify = (res: any) => {
  196. classifyShow.value = true;
  197. classifyId.value = res.id;
  198. classifyInfo.value = res.children;
  199. };
  200. //移出分类
  201. const leaveClassify = () => {
  202. classifyShow.value = false;
  203. };
  204. // //头部分类
  205. // getGiftCategoryList({}).then((res) => {
  206. // if (res.code == 200) {
  207. // classifyList.value = res.data;
  208. // }
  209. // });
  210. //轮播广告
  211. getHomeAdList({}).then((res) => {
  212. if (res.code == 200) {
  213. carouselList.value = res.data;
  214. }
  215. });
  216. // 会员权益
  217. getIconAdList({}).then((res) => {
  218. if (res.code == 200) {
  219. interestsList.value = res.data;
  220. }
  221. });
  222. // 咨询
  223. getNoticeList({}).then((res) => {
  224. if (res.code == 200) {
  225. realList.value = res.data;
  226. }
  227. });
  228. // 荐广告(福利装修-推荐广告)场景采购
  229. getRecommendAdList({}).then((res) => {
  230. if (res.code == 200) {
  231. scenario.value = res.data;
  232. }
  233. });
  234. //热门定制
  235. getHotCustomGiftFloorList({}).then((res) => {
  236. if (res.code == 200) {
  237. getGiftFloorLinkProductList({ floorId: res.data[0].id }).then((res1) => {
  238. if (res1.code == 200) {
  239. popular.value = res1.data;
  240. }
  241. });
  242. }
  243. });
  244. //循环
  245. getAdvertisementGiftFloorList({}).then((res) => {
  246. if (res.code == 200) {
  247. goodsList.value = res.data;
  248. res.data.forEach((item: any) => {
  249. getGiftFloorLinkProductList({ floorId: item.id }).then((res) => {
  250. if (res.code == 200) {
  251. }
  252. });
  253. });
  254. }
  255. });
  256. //为你推荐
  257. getRecommendGiftFloorList({}).then((res) => {
  258. if (res.code == 200) {
  259. recommend.value = res.data;
  260. }
  261. });
  262. </script>
  263. <style lang="scss" scoped>
  264. .home-pages {
  265. width: 100%;
  266. .head-pages {
  267. width: 100%;
  268. background: #ead3ab;
  269. // 头部
  270. .home-head {
  271. width: 1200px;
  272. margin: 0 auto;
  273. position: relative;
  274. display: flex;
  275. gap: 0px 10px;
  276. .classify {
  277. width: 234px;
  278. height: 540px;
  279. background: #ffffff;
  280. &.classify-show {
  281. position: absolute;
  282. z-index: 10;
  283. height: auto;
  284. min-height: 540px;
  285. }
  286. .classify-list {
  287. width: 100%;
  288. height: 40px;
  289. cursor: pointer;
  290. display: flex;
  291. align-items: center;
  292. padding-left: 15px;
  293. position: relative;
  294. z-index: 12;
  295. &.classify-hig {
  296. border: 1px solid var(--el-color-primary);
  297. border-right: 0px solid #ffffff;
  298. }
  299. .label {
  300. max-width: 100px;
  301. font-weight: 600;
  302. font-size: 14px;
  303. color: #101828;
  304. white-space: nowrap;
  305. margin-right: 10px;
  306. &:hover {
  307. color: var(--el-color-primary);
  308. }
  309. }
  310. .info {
  311. max-width: 50px;
  312. font-size: 12px;
  313. color: #364153;
  314. white-space: nowrap;
  315. &.info1 {
  316. margin-right: 6px;
  317. }
  318. &:hover {
  319. color: var(--el-color-primary);
  320. }
  321. }
  322. .classify-border {
  323. position: absolute;
  324. right: -1px;
  325. top: 0px;
  326. width: 1px;
  327. height: 38px;
  328. background-color: #ffffff;
  329. z-index: 6;
  330. }
  331. }
  332. }
  333. .classify-bos {
  334. position: absolute;
  335. top: 0;
  336. right: 0;
  337. width: 966px;
  338. height: 100%;
  339. border: 1px solid var(--el-color-primary);
  340. background-color: #ffffff;
  341. overflow-y: auto;
  342. padding-left: 30px;
  343. z-index: 5;
  344. .classify-item {
  345. display: flex;
  346. padding-top: 10px;
  347. border-bottom: 1px solid #e5e7eb;
  348. .two-level {
  349. width: 90px;
  350. font-size: 14px;
  351. color: var(--el-color-primary);
  352. cursor: pointer;
  353. }
  354. .classify-icon {
  355. margin: 4px 15px 0 15px;
  356. }
  357. .classify-label {
  358. display: flex;
  359. flex-wrap: wrap;
  360. flex: 1;
  361. font-size: 14px;
  362. color: #364153;
  363. div {
  364. margin-right: 20px;
  365. margin-bottom: 10px;
  366. cursor: pointer;
  367. &:hover {
  368. color: var(--el-color-primary);
  369. }
  370. }
  371. }
  372. }
  373. }
  374. // 头部中间
  375. .carousel-bos {
  376. width: 756px;
  377. height: 540px;
  378. img {
  379. width: 756px;
  380. height: 540px;
  381. }
  382. }
  383. //右边
  384. .head-right {
  385. flex: 1;
  386. width: 0;
  387. height: 540px;
  388. background: #ffffff;
  389. display: flex;
  390. flex-direction: column;
  391. .login-bos {
  392. width: calc(100% - 20px);
  393. height: 110px;
  394. border-bottom: 1px solid #e5e7eb;
  395. margin: 0 10px;
  396. display: flex;
  397. flex-direction: column;
  398. justify-content: space-between;
  399. padding: 16px 0;
  400. .login-box {
  401. display: flex;
  402. align-items: center;
  403. img {
  404. width: 40px;
  405. height: 40px;
  406. margin-right: 8px;
  407. border-radius: 40px;
  408. }
  409. .login-btn {
  410. width: 100%;
  411. }
  412. .login1 {
  413. font-size: 13px;
  414. color: #444444;
  415. }
  416. .login2 {
  417. margin-top: 2px;
  418. font-size: 12px;
  419. color: #6a7282;
  420. }
  421. }
  422. }
  423. .real-time {
  424. width: calc(100% - 20px);
  425. height: 227px;
  426. border-bottom: 1px solid #e5e7eb;
  427. margin: 0 10px;
  428. padding-top: 15px;
  429. .real-title {
  430. position: relative;
  431. margin-bottom: 12px;
  432. &::after {
  433. content: '';
  434. top: 3px;
  435. left: 0;
  436. position: absolute;
  437. width: 4px;
  438. height: 14px;
  439. background: var(--el-color-primary);
  440. }
  441. .real1 {
  442. font-weight: 600;
  443. font-size: 14px;
  444. color: #1d2129;
  445. padding-left: 15px;
  446. }
  447. .real2 {
  448. font-size: 13px;
  449. color: #83899f;
  450. cursor: pointer;
  451. }
  452. }
  453. .real-list {
  454. width: 100%;
  455. font-size: 14px;
  456. color: #1d2129;
  457. margin-bottom: 12px;
  458. cursor: pointer;
  459. &:hover {
  460. color: var(--el-color-primary);
  461. }
  462. }
  463. }
  464. .interests {
  465. flex: 1;
  466. width: calc(100% - 20px);
  467. margin: 0 10px;
  468. padding-top: 15px;
  469. .interests-title {
  470. position: relative;
  471. font-weight: 600;
  472. font-size: 14px;
  473. color: #1d2129;
  474. padding-left: 15px;
  475. &::after {
  476. content: '';
  477. top: 3px;
  478. left: 0;
  479. position: absolute;
  480. width: 4px;
  481. height: 14px;
  482. background: var(--el-color-primary);
  483. }
  484. }
  485. .interests-bos {
  486. display: flex;
  487. flex-wrap: wrap;
  488. .interests-item {
  489. width: 33.333%;
  490. font-size: 12px;
  491. color: #101828;
  492. margin-top: 15px;
  493. cursor: pointer;
  494. &:hover {
  495. color: var(--el-color-primary);
  496. }
  497. img {
  498. width: 34px;
  499. height: 34px;
  500. margin-bottom: 7px;
  501. }
  502. }
  503. }
  504. }
  505. }
  506. }
  507. }
  508. .pages-bos {
  509. width: 1200px;
  510. margin: 0 auto;
  511. //标题
  512. .home-title {
  513. width: 1200px;
  514. height: 56px;
  515. background: #ffffff;
  516. border-radius: 10px;
  517. margin-top: 30px;
  518. font-weight: 600;
  519. font-size: 20px;
  520. color: #ff4f20;
  521. img {
  522. width: 43px;
  523. height: 28px;
  524. margin: 0 10px;
  525. }
  526. }
  527. // 场景采购
  528. .scenario-bos {
  529. width: 1200px;
  530. display: flex;
  531. gap: 0 10px;
  532. margin-top: 12px;
  533. .scenario-list {
  534. width: 292.5px;
  535. height: 182px;
  536. border-radius: 10px;
  537. overflow: hidden;
  538. cursor: pointer;
  539. transition: transform 0.2s ease;
  540. img {
  541. width: 292.5px;
  542. height: 182px;
  543. }
  544. &:hover {
  545. transform: translateY(-2px);
  546. }
  547. }
  548. }
  549. //热门定制
  550. .sell-bos {
  551. width: 1200px;
  552. display: flex;
  553. gap: 0 20px;
  554. margin-top: 12px;
  555. .sell-list {
  556. width: 224px;
  557. height: 306px;
  558. background: #ffffff;
  559. border-radius: 10px;
  560. padding: 20px;
  561. display: flex;
  562. flex-direction: column;
  563. justify-content: space-between;
  564. cursor: pointer;
  565. transition: transform 0.2s ease;
  566. &:hover {
  567. transform: translateY(-2px);
  568. }
  569. .sell-img {
  570. width: 184px;
  571. height: 182px;
  572. }
  573. .sell-name {
  574. width: 184px;
  575. height: 38px;
  576. font-size: 14px;
  577. color: #101828;
  578. }
  579. .sell-price {
  580. .price1 {
  581. color: var(--el-color-primary);
  582. font-size: 16px;
  583. color: #e7000b;
  584. }
  585. .price2 {
  586. font-size: 12px;
  587. color: #99a1af;
  588. line-height: 20px;
  589. text-decoration-line: line-through;
  590. text-transform: none;
  591. margin-left: 6px;
  592. }
  593. }
  594. }
  595. }
  596. //循环数据
  597. .goods-bos {
  598. width: 1200px;
  599. margin-top: 30px;
  600. display: flex;
  601. .goods-main {
  602. width: 232px;
  603. height: 560px;
  604. border-radius: 10px;
  605. margin-right: 10px;
  606. }
  607. .goods-box {
  608. flex: 1;
  609. height: 560px;
  610. display: flex;
  611. flex-wrap: wrap;
  612. gap: 10px;
  613. .goods-list {
  614. width: 232px;
  615. height: 275px;
  616. background: #ffffff;
  617. border-radius: 10px;
  618. padding: 20px;
  619. display: flex;
  620. flex-direction: column;
  621. justify-content: space-between;
  622. cursor: pointer;
  623. transition: transform 0.2s ease;
  624. &:hover {
  625. transform: translateY(-2px);
  626. }
  627. .goods-img {
  628. height: 150px;
  629. width: 192px;
  630. }
  631. .goods-name {
  632. width: 192px;
  633. height: 38px;
  634. font-size: 14px;
  635. color: #101828;
  636. }
  637. .goods-price {
  638. .price1 {
  639. color: var(--el-color-primary);
  640. font-size: 16px;
  641. color: #e7000b;
  642. }
  643. .price2 {
  644. font-size: 12px;
  645. color: #99a1af;
  646. line-height: 20px;
  647. text-decoration-line: line-through;
  648. text-transform: none;
  649. margin-left: 6px;
  650. }
  651. }
  652. }
  653. }
  654. }
  655. .recommend {
  656. margin-bottom: 30px;
  657. gap: 10px 20px;
  658. flex-wrap: wrap;
  659. }
  660. }
  661. }
  662. </style>