guide.vue 7.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361
  1. <template>
  2. <div class="solve">
  3. <div class="solve-head">
  4. <div class="head-bos">
  5. <div class="nav-bos flex-row-start">
  6. <div
  7. @click="onNav(item)"
  8. v-for="(item, index) in navList"
  9. :key="index"
  10. class="nav-list"
  11. :class="item.id == httpObj.tweetCategory ? 'hig' : ''"
  12. >
  13. {{ item.categoryName }}
  14. </div>
  15. </div>
  16. <div class="filter-bos">
  17. <div v-for="(item1, index1) in filterListy" :key="index1" class="filter-list flex-row-start">
  18. <div class="filter-title">{{ item1.title }}</div>
  19. <div
  20. @click="onFilter(item1, item2)"
  21. v-for="(item2, index2) in item1.list"
  22. :key="index2"
  23. class="filter-item"
  24. :class="item1.id == item2.id ? 'hig' : ''"
  25. >
  26. {{ item2.title }}
  27. </div>
  28. </div>
  29. </div>
  30. </div>
  31. </div>
  32. <!-- 数据 -->
  33. <div class="procure-bos">
  34. <div v-for="(item, index) in dataList" :key="index" class="procure-list" @click="onPath('/plan_info/guide?id=' + item.id)">
  35. <img :src="item.coverImage" alt="" />
  36. <div class="procure1">{{ item.title }}</div>
  37. <div class="procure2">{{ item.releaseTime }}</div>
  38. </div>
  39. </div>
  40. <!-- 游标分页控制 -->
  41. <div class="pagination-bos flex-row-between">
  42. <div></div>
  43. <pagination
  44. v-show="dataList.length > 0"
  45. v-model:page="httpObj.pageNum"
  46. v-model:limit="httpObj.pageSize"
  47. v-model:way="way"
  48. :cursor-mode="true"
  49. :has-more="hasMore"
  50. @pagination="getList"
  51. />
  52. </div>
  53. </div>
  54. </template>
  55. <script setup lang="ts">
  56. import { onPath } from '@/utils/siteConfig';
  57. import {
  58. getPurchaseGuideList,
  59. getPurchaseCategoryList,
  60. getAdaptSceneList,
  61. getCustomerIndustry,
  62. getPriceRangeList,
  63. getCustomerTag
  64. } from '@/api/plan/index';
  65. import Pagination from '@/components/Pagination/index.vue';
  66. const httpObj = ref<any>({
  67. tweetCategory: '',
  68. adaptNo: '',
  69. adaptIndustry: '',
  70. price: '',
  71. lable: '',
  72. pageSize: 10,
  73. pageNum: 1
  74. });
  75. const dataList = ref<any>([]);
  76. const hasMore = ref(true); // 是否还有更多数据
  77. const way = ref<any>(1);
  78. const navList = ref<any>([
  79. { title: '专题分类' },
  80. { title: '大中型企业采购' },
  81. { title: '政府&公共采购' },
  82. { title: '营销福利' },
  83. { title: '商用工程' },
  84. { title: '中小型企业采购' }
  85. ]);
  86. const filterListy = ref<any>([
  87. {
  88. title: '适配场景',
  89. key: 'adaptNo',
  90. id: '',
  91. list: [
  92. {
  93. id: '',
  94. title: '全部'
  95. }
  96. ]
  97. },
  98. {
  99. title: '适配行业',
  100. key: 'adaptIndustry',
  101. id: '',
  102. list: [
  103. {
  104. id: '',
  105. title: '全部'
  106. }
  107. ]
  108. },
  109. {
  110. title: '价格区间',
  111. key: 'price',
  112. id: '',
  113. list: [
  114. {
  115. id: '',
  116. title: '全部'
  117. }
  118. ]
  119. },
  120. {
  121. title: '推荐标签',
  122. key: 'lable',
  123. id: '',
  124. list: [
  125. {
  126. id: '',
  127. title: '全部'
  128. }
  129. ]
  130. }
  131. ]);
  132. const navIndex = ref(0);
  133. const router = useRouter();
  134. onMounted(() => {
  135. // 采购分类列表
  136. getPurchaseCategoryList({}).then((res) => {
  137. if (res.code == 200) {
  138. res.data.unshift({
  139. id: '',
  140. categoryName: '全部'
  141. });
  142. navList.value = res.data;
  143. httpObj.value.tweetCategory = '';
  144. }
  145. });
  146. // 适配场景列表
  147. getAdaptSceneList({}).then((res) => {
  148. if (res.code == 200) {
  149. res.data.forEach((item: any) => {
  150. item.title = item.sceneName;
  151. filterListy.value[0].list.push(item);
  152. });
  153. }
  154. });
  155. //适配行业
  156. getCustomerIndustry({}).then((res) => {
  157. if (res.code == 200) {
  158. res.data.forEach((item: any) => {
  159. item.title = item.industryCategoryName;
  160. filterListy.value[1].list.push(item);
  161. });
  162. }
  163. });
  164. // 获取价格区间列表
  165. getPriceRangeList({}).then((res) => {
  166. if (res.code == 200) {
  167. res.data.forEach((item: any) => {
  168. item.title = item.minPrice + '-' + item.maxPrice;
  169. item.id = item.minPrice + '-' + item.maxPrice;
  170. filterListy.value[2].list.push(item);
  171. });
  172. }
  173. });
  174. // 推荐标签
  175. getCustomerTag({}).then((res) => {
  176. if (res.code == 200) {
  177. res.data.forEach((item: any) => {
  178. item.title = item.tagName;
  179. filterListy.value[3].list.push(item);
  180. });
  181. }
  182. });
  183. getList();
  184. });
  185. const getList = () => {
  186. getPurchaseGuideList(httpObj.value).then((res) => {
  187. if (res.code == 200) {
  188. dataList.value = res.rows;
  189. // 判断是否还有更多数据
  190. hasMore.value = res.total > httpObj.value.pageSize * httpObj.value.pageNum;
  191. }
  192. });
  193. };
  194. const onNav = (item: any) => {
  195. httpObj.value.tweetCategory = item.id;
  196. getList();
  197. };
  198. const onFilter = (item1: any, item2: any) => {
  199. item1.id = item2.id;
  200. httpObj.value[item1.key] = item2.id;
  201. getList();
  202. };
  203. const handleSizeChange = (val: number) => {
  204. console.log(`${val} items per page`);
  205. };
  206. const handleCurrentChange = (val: number) => {
  207. console.log(`current page: ${val}`);
  208. };
  209. </script>
  210. <style lang="scss" scoped>
  211. .solve {
  212. width: 100%;
  213. .solve-head {
  214. width: 100%;
  215. background: #ffffff;
  216. .head-bos {
  217. width: 1200px;
  218. margin: 0 auto;
  219. padding-bottom: 20px;
  220. }
  221. }
  222. .nav-bos {
  223. border-bottom: 1px solid #e5e7eb;
  224. width: 1200px;
  225. padding-bottom: 20px;
  226. .nav-list {
  227. height: 32px;
  228. padding: 0 12px;
  229. background: #f7f8fa;
  230. border-radius: 2px 2px 2px 2px;
  231. font-size: 14px;
  232. color: #4e5969;
  233. margin-right: 8px;
  234. line-height: 32px;
  235. cursor: pointer;
  236. &.hig {
  237. background: #ffe8e8;
  238. color: #e7000b;
  239. }
  240. &:hover {
  241. color: #e7000b;
  242. }
  243. }
  244. }
  245. .filter-bos {
  246. .filter-list {
  247. margin-top: 20px;
  248. .filter-title {
  249. font-size: 14px;
  250. color: #101828;
  251. margin-right: 40px;
  252. }
  253. .filter-item {
  254. font-size: 14px;
  255. color: #364153;
  256. margin-right: 30px;
  257. cursor: pointer;
  258. &.hig {
  259. color: #e7000b;
  260. }
  261. }
  262. }
  263. }
  264. // 采购指南
  265. .procure-bos {
  266. display: flex;
  267. width: 1200px;
  268. margin-top: 12px;
  269. gap: 15px;
  270. flex-wrap: wrap;
  271. margin: 0 auto;
  272. padding: 22px 0 40px 0;
  273. .procure-list {
  274. width: 390px;
  275. height: 268px;
  276. background: #ffffff;
  277. cursor: pointer;
  278. border-radius: 10px;
  279. overflow: hidden;
  280. img {
  281. width: 390px;
  282. height: 200px;
  283. }
  284. .procure1 {
  285. padding: 12px 0 4px 20px;
  286. font-weight: 600;
  287. font-size: 14px;
  288. color: #101828;
  289. }
  290. .procure2 {
  291. padding-left: 20px;
  292. font-size: 12px;
  293. color: #364153;
  294. }
  295. }
  296. }
  297. //分页
  298. .pagination-bos {
  299. width: 1200px;
  300. margin: 0 auto;
  301. padding-bottom: 60px;
  302. :deep(.el-select__wrapper) {
  303. background: #f4f4f4;
  304. box-shadow: 0 0 0 1px #e5e6eb inset;
  305. border-radius: 2px;
  306. }
  307. :deep(.el-select__placeholder) {
  308. color: #1d2129;
  309. }
  310. :deep(.el-input__wrapper) {
  311. background: #f4f4f4;
  312. box-shadow: 0 0 0 1px #e5e6eb inset;
  313. border-radius: 2px;
  314. }
  315. :deep(.el-input__inner) {
  316. color: #1d2129;
  317. }
  318. :deep(.btn-prev) {
  319. background: #f4f4f4;
  320. border: 1px solid #e5e6eb;
  321. margin-right: 8px;
  322. }
  323. :deep(.btn-next) {
  324. background: #f4f4f4;
  325. border: 1px solid #e5e6eb;
  326. margin-left: 8px;
  327. }
  328. :deep(.el-pager) {
  329. gap: 0 8px;
  330. li {
  331. background: #f4f4f4;
  332. border: 1px solid #e5e6eb;
  333. color: #1d2129;
  334. }
  335. }
  336. }
  337. }
  338. </style>