index-fuli.vue 6.1 KB

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