index.vue 2.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485
  1. <template>
  2. <div class="asj-container">
  3. <div class="public-search">
  4. <DateRangePicker v-model="dateRange"></DateRangePicker>
  5. <el-select
  6. v-model="selectedPortfolios"
  7. placeholder="广告组合"
  8. clearable
  9. multiple
  10. style="width: 400px"
  11. collapse-tags
  12. collapse-tags-tooltip
  13. :max-collapse-tags="3"
  14. disabled="true"
  15. >
  16. <el-option v-for="info of portfolios" :label="info.name" :value="info.portfolioId"></el-option>
  17. </el-select>
  18. </div>
  19. <div class="asj-tabs">
  20. <div v-for="tab of tabs" :key="tab.name" :class="['asj-tab', { active: tabActiveName === tab.name }]" @click="tabActiveName = tab.name">
  21. {{ tab.label }}
  22. </div>
  23. </div>
  24. <component :is="tabsComponents[tabActiveName]"></component>
  25. </div>
  26. </template>
  27. <script lang="ts" setup>
  28. import { ref, onBeforeMount, Ref, watch, provide } from 'vue'
  29. import { useShopInfo } from '/@/stores/shopInfo'
  30. import { usePublicData } from '/@/stores/publicData'
  31. import { storeToRefs } from 'pinia'
  32. import { GetAllPortfolios } from '/@/views/adManage/portfolios/api'
  33. import DateRangePicker from '/@/components/DateRangePicker/index.vue'
  34. import Campaigns from './campaigns/index.vue'
  35. import Keywords from './keywords/index.vue'
  36. import Targets from './targets/index.vue'
  37. import SearchTerm from './searchTerm/index.vue'
  38. import AdvertisedProducts from './advertisedProducts/index.vue'
  39. import PurchasedOtherProducts from './purchasedOtherProducts/index.vue'
  40. import Placement from './placement/index.vue'
  41. // const shopInfo = useShopInfo()
  42. const publicData = usePublicData()
  43. const selectedPortfolios: Ref<string[]> = ref([])
  44. const portfolios: Ref<Portfolio[]> = ref([])
  45. const { dateRange } = storeToRefs(publicData)
  46. const tabActiveName = ref('Campaigns')
  47. const tabs = [
  48. { label: '广告活动', name: 'Campaigns' },
  49. { label: '关键词投放', name: 'Keywords' },
  50. { label: '商品投放', name: 'Targets' },
  51. { label: '推广商品', name: 'AdvertisedProducts' },
  52. { label: '购买的其他商品', name: 'PurchasedOtherProducts' },
  53. { label: '搜索词', name: 'SearchTerm' },
  54. { label: '广告位', name: 'Placement' }
  55. ]
  56. const tabsComponents: any = {
  57. Campaigns,
  58. Keywords,
  59. Targets,
  60. AdvertisedProducts,
  61. PurchasedOtherProducts,
  62. SearchTerm,
  63. Placement
  64. }
  65. provide('dateRange', dateRange)
  66. onBeforeMount(async () => {
  67. const resp: APIResponseData = await GetAllPortfolios()
  68. portfolios.value = resp.data
  69. })
  70. </script>
  71. <style scoped>
  72. ::v-deep(.el-table .el-table__header-wrapper .cell) {
  73. border-right: 1px solid rgb(218, 221, 223);
  74. }
  75. ::v-deep(.el-table__footer-wrapper .el-table__footer tr) {
  76. background-color: #f5f7fa;
  77. }
  78. </style>