index-fuli.vue 19 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747
  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 item.goodsList" :key="index1" class="goods-list">
  122. <img class="goods-img" :src="item1.productImage ? item1.productImage.split(',')[0] : ''" alt="" />
  123. <div class="goods-name ellipsis2">{{ item1.itemName || '' }}</div>
  124. <div class="goods-price">
  125. <span class="price1">¥{{ item1.memberPrice || '' }}</span>
  126. <span class="price2">¥{{ item1.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, getYouYiZiXunPage } 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. getYouYiZiXunPage({}).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(async (res) => {
  246. if (res.code == 200) {
  247. for (const item of res.data) {
  248. try {
  249. const datas2 = await getGiftFloorLinkProductList({ floorId: item.id });
  250. if (datas2.code == 200) {
  251. item.goodsList = datas2.data;
  252. }
  253. } catch (error) {}
  254. }
  255. goodsList.value = res.data;
  256. }
  257. });
  258. // getAdvertisementGiftFloorList({}).then((res) => {
  259. // if (res.code == 200) {
  260. // goodsList.value = res.data;
  261. // res.data.forEach((item: any) => {
  262. // getGiftFloorLinkProductList({ floorId: item.id }).then((res) => {
  263. // if (res.code == 200) {
  264. // }
  265. // });
  266. // });
  267. // }
  268. // });
  269. //为你推荐
  270. getRecommendGiftFloorList({}).then((res) => {
  271. if (res.code == 200) {
  272. getGiftFloorLinkProductList({ floorId: res.data[0].id }).then((res1) => {
  273. if (res1.code == 200) {
  274. recommend.value = res1.data;
  275. }
  276. });
  277. }
  278. });
  279. </script>
  280. <style lang="scss" scoped>
  281. .home-pages {
  282. width: 100%;
  283. .head-pages {
  284. width: 100%;
  285. background: #ead3ab;
  286. // 头部
  287. .home-head {
  288. width: 1200px;
  289. margin: 0 auto;
  290. position: relative;
  291. display: flex;
  292. gap: 0px 10px;
  293. .classify {
  294. width: 234px;
  295. height: 540px;
  296. background: #ffffff;
  297. &.classify-show {
  298. position: absolute;
  299. z-index: 10;
  300. height: auto;
  301. min-height: 540px;
  302. }
  303. .classify-list {
  304. width: 100%;
  305. height: 40px;
  306. cursor: pointer;
  307. display: flex;
  308. align-items: center;
  309. padding-left: 15px;
  310. position: relative;
  311. z-index: 12;
  312. &.classify-hig {
  313. border: 1px solid var(--el-color-primary);
  314. border-right: 0px solid #ffffff;
  315. }
  316. .label {
  317. max-width: 100px;
  318. font-weight: 600;
  319. font-size: 14px;
  320. color: #101828;
  321. white-space: nowrap;
  322. margin-right: 10px;
  323. &:hover {
  324. color: var(--el-color-primary);
  325. }
  326. }
  327. .info {
  328. max-width: 50px;
  329. font-size: 12px;
  330. color: #364153;
  331. white-space: nowrap;
  332. &.info1 {
  333. margin-right: 6px;
  334. }
  335. &:hover {
  336. color: var(--el-color-primary);
  337. }
  338. }
  339. .classify-border {
  340. position: absolute;
  341. right: -1px;
  342. top: 0px;
  343. width: 1px;
  344. height: 38px;
  345. background-color: #ffffff;
  346. z-index: 6;
  347. }
  348. }
  349. }
  350. .classify-bos {
  351. position: absolute;
  352. top: 0;
  353. right: 0;
  354. width: 966px;
  355. height: 100%;
  356. border: 1px solid var(--el-color-primary);
  357. background-color: #ffffff;
  358. overflow-y: auto;
  359. padding-left: 30px;
  360. z-index: 5;
  361. .classify-item {
  362. display: flex;
  363. padding-top: 10px;
  364. border-bottom: 1px solid #e5e7eb;
  365. .two-level {
  366. width: 90px;
  367. font-size: 14px;
  368. color: var(--el-color-primary);
  369. cursor: pointer;
  370. }
  371. .classify-icon {
  372. margin: 4px 15px 0 15px;
  373. }
  374. .classify-label {
  375. display: flex;
  376. flex-wrap: wrap;
  377. flex: 1;
  378. font-size: 14px;
  379. color: #364153;
  380. div {
  381. margin-right: 20px;
  382. margin-bottom: 10px;
  383. cursor: pointer;
  384. &:hover {
  385. color: var(--el-color-primary);
  386. }
  387. }
  388. }
  389. }
  390. }
  391. // 头部中间
  392. .carousel-bos {
  393. width: 756px;
  394. height: 540px;
  395. img {
  396. width: 756px;
  397. height: 540px;
  398. }
  399. }
  400. //右边
  401. .head-right {
  402. flex: 1;
  403. width: 0;
  404. height: 540px;
  405. background: #ffffff;
  406. display: flex;
  407. flex-direction: column;
  408. .login-bos {
  409. width: calc(100% - 20px);
  410. height: 110px;
  411. border-bottom: 1px solid #e5e7eb;
  412. margin: 0 10px;
  413. display: flex;
  414. flex-direction: column;
  415. justify-content: space-between;
  416. padding: 16px 0;
  417. .login-box {
  418. display: flex;
  419. align-items: center;
  420. img {
  421. width: 40px;
  422. height: 40px;
  423. margin-right: 8px;
  424. border-radius: 40px;
  425. }
  426. .login-btn {
  427. width: 100%;
  428. }
  429. .login1 {
  430. font-size: 13px;
  431. color: #444444;
  432. }
  433. .login2 {
  434. margin-top: 2px;
  435. font-size: 12px;
  436. color: #6a7282;
  437. }
  438. }
  439. }
  440. .real-time {
  441. width: calc(100% - 20px);
  442. height: 227px;
  443. border-bottom: 1px solid #e5e7eb;
  444. margin: 0 10px;
  445. padding-top: 15px;
  446. .real-title {
  447. position: relative;
  448. margin-bottom: 12px;
  449. &::after {
  450. content: '';
  451. top: 3px;
  452. left: 0;
  453. position: absolute;
  454. width: 4px;
  455. height: 14px;
  456. background: var(--el-color-primary);
  457. }
  458. .real1 {
  459. font-weight: 600;
  460. font-size: 14px;
  461. color: #1d2129;
  462. padding-left: 15px;
  463. }
  464. .real2 {
  465. font-size: 13px;
  466. color: #83899f;
  467. cursor: pointer;
  468. }
  469. }
  470. .real-list {
  471. width: 100%;
  472. font-size: 14px;
  473. color: #1d2129;
  474. margin-bottom: 12px;
  475. cursor: pointer;
  476. &:hover {
  477. color: var(--el-color-primary);
  478. }
  479. }
  480. }
  481. .interests {
  482. flex: 1;
  483. width: calc(100% - 20px);
  484. margin: 0 10px;
  485. padding-top: 15px;
  486. .interests-title {
  487. position: relative;
  488. font-weight: 600;
  489. font-size: 14px;
  490. color: #1d2129;
  491. padding-left: 15px;
  492. &::after {
  493. content: '';
  494. top: 3px;
  495. left: 0;
  496. position: absolute;
  497. width: 4px;
  498. height: 14px;
  499. background: var(--el-color-primary);
  500. }
  501. }
  502. .interests-bos {
  503. display: flex;
  504. flex-wrap: wrap;
  505. .interests-item {
  506. width: 33.333%;
  507. font-size: 12px;
  508. color: #101828;
  509. margin-top: 15px;
  510. cursor: pointer;
  511. &:hover {
  512. color: var(--el-color-primary);
  513. }
  514. img {
  515. width: 34px;
  516. height: 34px;
  517. margin-bottom: 7px;
  518. }
  519. }
  520. }
  521. }
  522. }
  523. }
  524. }
  525. .pages-bos {
  526. width: 1200px;
  527. margin: 0 auto;
  528. //标题
  529. .home-title {
  530. width: 1200px;
  531. height: 56px;
  532. background: #ffffff;
  533. border-radius: 10px;
  534. margin-top: 30px;
  535. font-weight: 600;
  536. font-size: 20px;
  537. color: #ff4f20;
  538. img {
  539. width: 43px;
  540. height: 28px;
  541. margin: 0 10px;
  542. }
  543. }
  544. // 场景采购
  545. .scenario-bos {
  546. width: 1200px;
  547. display: flex;
  548. gap: 0 10px;
  549. margin-top: 12px;
  550. .scenario-list {
  551. width: 292.5px;
  552. height: 182px;
  553. border-radius: 10px;
  554. overflow: hidden;
  555. cursor: pointer;
  556. transition: transform 0.2s ease;
  557. img {
  558. width: 292.5px;
  559. height: 182px;
  560. }
  561. &:hover {
  562. transform: translateY(-2px);
  563. }
  564. }
  565. }
  566. //热门定制
  567. .sell-bos {
  568. width: 1200px;
  569. display: flex;
  570. gap: 0 20px;
  571. margin-top: 12px;
  572. .sell-list {
  573. width: 224px;
  574. height: 306px;
  575. background: #ffffff;
  576. border-radius: 10px;
  577. padding: 20px;
  578. display: flex;
  579. flex-direction: column;
  580. justify-content: space-between;
  581. cursor: pointer;
  582. transition: transform 0.2s ease;
  583. &:hover {
  584. transform: translateY(-2px);
  585. }
  586. .sell-img {
  587. width: 184px;
  588. height: 182px;
  589. }
  590. .sell-name {
  591. width: 184px;
  592. height: 38px;
  593. font-size: 14px;
  594. color: #101828;
  595. }
  596. .sell-price {
  597. .price1 {
  598. color: var(--el-color-primary);
  599. font-size: 16px;
  600. color: #e7000b;
  601. }
  602. .price2 {
  603. font-size: 12px;
  604. color: #99a1af;
  605. line-height: 20px;
  606. text-decoration-line: line-through;
  607. text-transform: none;
  608. margin-left: 6px;
  609. }
  610. }
  611. }
  612. }
  613. //循环数据
  614. .goods-bos {
  615. width: 1200px;
  616. margin-top: 30px;
  617. display: flex;
  618. .goods-main {
  619. width: 232px;
  620. height: 560px;
  621. border-radius: 10px;
  622. margin-right: 10px;
  623. }
  624. .goods-box {
  625. flex: 1;
  626. height: 560px;
  627. display: flex;
  628. flex-wrap: wrap;
  629. gap: 10px;
  630. .goods-list {
  631. width: 232px;
  632. height: 275px;
  633. background: #ffffff;
  634. border-radius: 10px;
  635. padding: 20px;
  636. display: flex;
  637. flex-direction: column;
  638. justify-content: space-between;
  639. cursor: pointer;
  640. transition: transform 0.2s ease;
  641. &:hover {
  642. transform: translateY(-2px);
  643. }
  644. .goods-img {
  645. height: 150px;
  646. width: 192px;
  647. }
  648. .goods-name {
  649. width: 192px;
  650. height: 38px;
  651. font-size: 14px;
  652. color: #101828;
  653. }
  654. .goods-price {
  655. .price1 {
  656. color: var(--el-color-primary);
  657. font-size: 16px;
  658. color: #e7000b;
  659. }
  660. .price2 {
  661. font-size: 12px;
  662. color: #99a1af;
  663. line-height: 20px;
  664. text-decoration-line: line-through;
  665. text-transform: none;
  666. margin-left: 6px;
  667. }
  668. }
  669. }
  670. }
  671. }
  672. .recommend {
  673. margin-bottom: 30px;
  674. gap: 10px 20px;
  675. flex-wrap: wrap;
  676. }
  677. }
  678. }
  679. </style>