all-brands.vue 6.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202
  1. <script lang='ts' setup>
  2. import { ref, watch } from 'vue'
  3. import { ArrowRight } from '@element-plus/icons-vue'
  4. import { useBrandData } from './useBrandData'
  5. import { PageSizeEnum } from '~/enums/sizeEnum'
  6. import { getCategoryListApi } from '~/api/model/common'
  7. import { ConstKeys } from '~/enums/const-enums'
  8. import { getParentsById } from '~/utils/object'
  9. import {
  10. getFeatureListApi,
  11. } from '~/api/model/feature'
  12. import { useUserStore } from '@/stores/modules/user'
  13. useHead({
  14. title: 'Discover and Shop New Brands Wholesale in China | EJET Selection ',
  15. meta: [
  16. {
  17. name: 'description',
  18. content:
  19. `Explore EJET Selection's Top Brands, featuring trusted Chinese wholesale suppliers known for quality and innovation. Discover unique and exclusive home decor products for your store.`,
  20. },
  21. {
  22. property: 'og:title',
  23. content: 'Discover and Shop New Brands Wholesale in China | EJET Selection ',
  24. },
  25. {
  26. property: 'og:description',
  27. content: `Explore EJET Selection's Top Brands, featuring trusted Chinese wholesale suppliers known for quality and innovation. Discover unique and exclusive home decor products for your store.`,
  28. },
  29. {
  30. property: 'og:type',
  31. content: 'website',
  32. },
  33. {
  34. property: 'twitter:title',
  35. content: 'Discover and Shop New Brands Wholesale in China | EJET Selection ',
  36. },
  37. {
  38. property: 'twitter:description',
  39. content: `Explore EJET Selection's Top Brands, featuring trusted Chinese wholesale suppliers known for quality and innovation. Discover unique and exclusive home decor products for your store.`,
  40. },
  41. {
  42. property: 'twitter:card',
  43. content: 'summary_large_image',
  44. },
  45. ],
  46. link: [
  47. {
  48. rel: 'canonical',
  49. href: `${ConstKeys.DOMAINPRO}/suppliers/all-brands`,
  50. },
  51. ],
  52. })
  53. const userStore = useUserStore()
  54. const { isLogin } = storeToRefs(userStore)
  55. const { openLoginModal } = useLoginModal()
  56. const { handleSelectedCategory, page_size, brandList, getBrandList, total, selectedCategoryId, currentPage, changePage } = useBrandData()
  57. const categories = ref<any>([])
  58. const levelTopList = ref<any>([])
  59. const list = ref<any>([])
  60. const crumbs = ref<any>([
  61. { name: 'All Brands', url: '/' },
  62. ])
  63. async function getCategories() {
  64. try {
  65. const data = await getCategoryListApi({ all: true })
  66. categories.value = data
  67. levelTopList.value = data.map((item: any) => {
  68. const { children, ...rest } = item
  69. return rest
  70. })
  71. levelTopList.value.unshift({
  72. key: '',
  73. title: 'All Brands',
  74. })
  75. }
  76. catch (error) {
  77. console.log(error)
  78. }
  79. }
  80. async function getFeatureList(pageNo = PageSizeEnum.PAGE, pageSize = 3) {
  81. const params = {
  82. pageNo,
  83. pageSize,
  84. }
  85. const res: any = await getFeatureListApi(params)
  86. list.value = res.records
  87. }
  88. watch(() => selectedCategoryId.value, (value: any) => {
  89. if (value) {
  90. const filterArr = getParentsById(categories.value, value)
  91. const baseCrumb = [
  92. { name: 'All Brands', url: '/' },
  93. ]
  94. const arr: any = []
  95. filterArr.forEach((ele) => {
  96. arr.unshift({
  97. name: ele.title,
  98. url: '',
  99. })
  100. })
  101. crumbs.value = [...baseCrumb, ...arr]
  102. }
  103. else {
  104. crumbs.value = [
  105. { name: 'All Brands', url: '/' },
  106. ]
  107. }
  108. })
  109. getFeatureList()
  110. getCategories()
  111. getBrandList()
  112. </script>
  113. <template>
  114. <div class="">
  115. <div>
  116. <div class="relative">
  117. <img src="~/assets/images/all_brand_banner.jpg" class="w-full h-[400px] object-cover" alt="" srcset="">
  118. <div class="pos-absolute top-[50%] left-[50%] translate-x-[-50%] translate-y-[-50%] w-1400px mx-auto">
  119. <h1 class="!mb-20px text-#333333 text-40px fw-700 custom-title-font">
  120. Find The Best Wholesale Suppliers
  121. </h1>
  122. <div class="mb-20px text-#999999">
  123. Shop premium Chinese manufacturing brands at wholesale prices.
  124. </div>
  125. <div v-if="!isLogin">
  126. <el-button type="primary" plain class="w-160px !bg-#C58C64 !text-#fff !h-40px !text-16px !fw-500 !b-rd-150px">
  127. <nuxt-link to="/register">
  128. Shop on EJET
  129. </nuxt-link>
  130. </el-button>
  131. </div>
  132. </div>
  133. </div>
  134. <div class="w-1400px mx-auto pt-60px pb-46px">
  135. <div class="fw-300 mb-46px">
  136. <el-breadcrumb :separator-icon="ArrowRight">
  137. <el-breadcrumb-item v-for="item, index in crumbs" :key="index" :to="!!item.url ? { path: item.url } : null">
  138. {{ item.name }}
  139. </el-breadcrumb-item>
  140. </el-breadcrumb>
  141. </div>
  142. <div class="flex gap-48px">
  143. <div v-for="item in levelTopList" :key="item.key" :class="selectedCategoryId === item.key && 'fw-700 underline'" class="cursor-pointer text-#666666 hover:underline" @click="handleSelectedCategory(item.key)">
  144. {{ item.title }}
  145. </div>
  146. </div>
  147. </div>
  148. </div>
  149. <div class="w-1400px mx-auto mb-160px">
  150. <!-- <el-row class="row-bg">
  151. <el-col :span="5">
  152. <div>
  153. <h2 class="fw-700 text-24px !mb-40px">
  154. Categories
  155. </h2>
  156. <category-sider :list="categories" class="b-rd-20px" style="box-shadow: 0px 4px 10px 0px rgba(0,0,0,0.1);border-radius: 20px;overflow: hidden;" @click="handleSelectedCategory" />
  157. </div>
  158. </el-col>
  159. <el-col :span="1" />
  160. <el-col :span="18"> -->
  161. <div v-if="brandList.length">
  162. <div class="grid grid-gap-x-65px grid-gap-y-80px grid-cols-4">
  163. <div v-for="item in brandList" :key="item.id">
  164. <common-brand-item :item="item" :is-favorite="true" />
  165. </div>
  166. </div>
  167. <div class="mt-60px flex justify-center">
  168. <el-pagination
  169. v-model:current-page="currentPage"
  170. :page-size="page_size"
  171. :pager-count="10"
  172. layout="prev, pager, next" :total="total"
  173. @change="changePage"
  174. />
  175. </div>
  176. </div>
  177. <common-empty v-else class="mt-200px" title="No brand found ~" />
  178. <!-- </el-col>
  179. </el-row> -->
  180. </div>
  181. <div class="w-1400px mx-auto mb-160px">
  182. <h1 class="fw-500 text-30px text-center text-#333 !mb-50px">
  183. Explore More Product Collections
  184. </h1>
  185. <div class="grid grid-cols-3 gap-x-106px px-66px">
  186. <div v-for="item, index in list" :key="index">
  187. <common-featured-item2 :item />
  188. </div>
  189. </div>
  190. </div>
  191. <AppFooter />
  192. </div>
  193. </template>
  194. <style lang='less' scoped>
  195. </style>