index-fuli.vue 5.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207
  1. <template>
  2. <div class="home-pages">
  3. <!-- 头部 -->
  4. <comHead v-if="headData.show" :row="headData" :datas="realList"></comHead>
  5. <!-- 场景采购 -->
  6. <indexFuilTitle :datas="{ title: '场景采购' }"></indexFuilTitle>
  7. <imageCube v-if="scenario.length > 0" :datas="scenario" :row="imageCubeData"></imageCube>
  8. <!-- 热门定制 -->
  9. <indexFuilTitle :datas="{ title: '热门定制' }"></indexFuilTitle>
  10. <comGoods :row="{ styleType: 1, goodsShow: [1, 2, 3], goodsTitleType: 3 }" :datas="popular"></comGoods>
  11. <!-- 循环数据 -->
  12. <div class="goods-bos" v-for="(item, index) in goodsList" :key="index">
  13. <div class="h-[15px]"></div>
  14. <floor v-if="item.floorData && item.floorData.show" :row="item.floorData"></floor>
  15. </div>
  16. <!-- 为您推荐 -->
  17. <indexFuilTitle :datas="{ title: '为您推荐' }"></indexFuilTitle>
  18. <comGoods :row="{ styleType: 1, goodsShow: [1, 2, 3], goodsTitleType: 3 }" :datas="recommend"></comGoods>
  19. </div>
  20. </template>
  21. <script setup lang="ts">
  22. import indexFuilTitle from '@/views/home/pccomponents/pages/indexFuilTitle.vue';
  23. import comHead from '@/views/home/pccomponents/pages/head.vue';
  24. import imageCube from '@/views/home/pccomponents/pages/imageCube.vue';
  25. import comGoods from '@/views/home/pccomponents/pages/goods.vue';
  26. import floor from '@/views/home/pccomponents/pages/floor.vue';
  27. import fuli from '@/assets/images/fuli.png';
  28. import {
  29. getHomeAdList,
  30. getIconAdList,
  31. getRecommendAdList,
  32. getHotCustomGiftFloorList,
  33. getAdvertisementGiftFloorList,
  34. getGiftFloorLinkProductList,
  35. getRecommendGiftFloorList
  36. } from '@/api/home/index-fuli';
  37. import { getSearchTitle, getYouYiZiXunPage, getHomeNav } from '@/api/home/index';
  38. const headData = ref<any>({});
  39. const imageCubeData = ref<any>({});
  40. const realList = ref<any>([]);
  41. const scenario = ref<any>([]);
  42. const popular = ref<any>([]);
  43. const goodsList = ref<any>([]);
  44. const recommend = ref<any>([]);
  45. onMounted(() => {
  46. document.documentElement.style.setProperty('--hover-color', '#E7000B');
  47. getHead();
  48. });
  49. //头部
  50. const getHead = async () => {
  51. headData.value.topStyle = 2;
  52. headData.value.logo = fuli;
  53. headData.value.toplabel = [];
  54. headData.value.classifyShow = true;
  55. headData.value.carouselStyle = true;
  56. headData.value.headType = 2;
  57. headData.value.leftStyle = 1;
  58. headData.value.carouselList = [];
  59. headData.value.advertNum = 0;
  60. headData.value.advertList = [];
  61. headData.value.realDataType = 1;
  62. headData.value.realNumber = 6;
  63. headData.value.navlList = [];
  64. try {
  65. const datas1 = await getSearchTitle(3);
  66. if (datas1.code == 200) {
  67. datas1.data.forEach((item: any) => {
  68. headData.value.toplabel.push({
  69. title: item.navigationName
  70. });
  71. });
  72. }
  73. const datas2 = await getHomeNav(3);
  74. headData.value.topNav = [];
  75. datas2.data.forEach((item: any) => {
  76. headData.value.topNav.push({
  77. title: item.navigationName,
  78. url: item.url ? item.url : ''
  79. });
  80. });
  81. const datas3 = await getHomeAdList({});
  82. if (datas3.code == 200) {
  83. datas3.data.forEach((item: any) => {
  84. headData.value.carouselList.push({
  85. imageUrl: item.imageUrl
  86. });
  87. });
  88. }
  89. const datas5 = await getYouYiZiXunPage({});
  90. if (datas5.code == 200) realList.value = datas5.data;
  91. const datas6 = await getIconAdList({});
  92. if (datas6.code == 200) {
  93. datas6.data.forEach((item: any) => {
  94. headData.value.navlList.push({
  95. imageUrl: item.imageUrl,
  96. title: item.title,
  97. url: item.link ? item.link : ''
  98. });
  99. });
  100. }
  101. headData.value.show = true;
  102. } catch (error) {}
  103. };
  104. // 场景采购
  105. getRecommendAdList({}).then((res) => {
  106. if (res.code == 200) {
  107. imageCubeData.value.imageHeight = 182;
  108. imageCubeData.value.number = 4;
  109. imageCubeData.value.gap = 10;
  110. imageCubeData.value.imageTopRounded = 5;
  111. imageCubeData.value.imageBottomRoundedRounded = 5;
  112. res.data.forEach((item: any) => {
  113. item.imageUrl = item.imageUrl;
  114. item.url = item.link ? item.link : '';
  115. });
  116. scenario.value = res.data;
  117. }
  118. });
  119. //热门定制
  120. getHotCustomGiftFloorList({}).then((res) => {
  121. if (res.code == 200) {
  122. getGiftFloorLinkProductList({ floorId: res.data[0].id }).then((res1) => {
  123. if (res1.code == 200) {
  124. popular.value = res1.data;
  125. }
  126. });
  127. }
  128. });
  129. //外面的循环
  130. getAdvertisementGiftFloorList({}).then(async (res) => {
  131. if (res.code == 200) {
  132. for (const item of res.data) {
  133. item.floorData = {};
  134. item.floorData.imageUrl = item.mainImg;
  135. item.floorData.url = '';
  136. item.floorData.imgType = 1;
  137. item.floorData.brandList = [];
  138. item.floorData.styleType = 1;
  139. item.floorData.imageRadius = 5;
  140. item.floorData.goodsIds = [];
  141. item.floorData.goodsShow = [1, 2, 3];
  142. item.floorData.btnStyle = 1;
  143. item.floorData.btnColor = '#ffffff';
  144. item.floorData.btnbackgroundColor = '#E7000B';
  145. item.floorData.moreUrl = '';
  146. item.floorData.moreColor = '#E7000B';
  147. item.floorData.moreShow = true;
  148. try {
  149. const datas2 = await getGiftFloorLinkProductList({ floorId: item.id });
  150. if (datas2.code == 200) {
  151. item.goodsList = datas2.data;
  152. item.floorData.goodsList = datas2.data;
  153. item.floorData.goodsDefault = true;
  154. }
  155. item.floorData.show = true;
  156. } catch (error) {}
  157. }
  158. goodsList.value = res.data;
  159. }
  160. });
  161. // 为您推荐
  162. getRecommendGiftFloorList({}).then((res) => {
  163. if (res.code == 200) {
  164. getGiftFloorLinkProductList({ floorId: res.data[0].id }).then((res1) => {
  165. if (res1.code == 200) {
  166. recommend.value = res1.data;
  167. }
  168. });
  169. }
  170. });
  171. </script>
  172. <style lang="scss" scoped>
  173. .home-pages {
  174. width: 100%;
  175. padding-bottom: 30px;
  176. :deep(.hover-color) {
  177. cursor: pointer;
  178. &:hover {
  179. color: var(--hover-color) !important;
  180. .zi-hover {
  181. color: var(--hover-color) !important;
  182. }
  183. }
  184. }
  185. }
  186. </style>