index.vue 2.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182
  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. >
  15. <el-option v-for="info of portfolios" :label="info.name" :value="info.portfolioId"></el-option>
  16. </el-select>
  17. </div>
  18. <div class="asj-tabs">
  19. <div v-for="tab of tabs" :key="tab.name" :class="['asj-tab', { active: tabActiveName === tab.name }]" @click="tabActiveName = tab.name">
  20. {{ tab.label }}
  21. </div>
  22. </div>
  23. <component :is="tabsComponents[tabActiveName]"></component>
  24. </div>
  25. </template>
  26. <script lang="ts" setup>
  27. import { ref, onBeforeMount, Ref, watch, provide } from 'vue'
  28. import { useShopInfo } from '/@/stores/shopInfo'
  29. import { usePublicData } from '/@/stores/publicData'
  30. import { storeToRefs } from 'pinia'
  31. import { GetAllPortfolios } from '/@/views/adManage/portfolios/api'
  32. import DateRangePicker from '/@/components/DateRangePicker/index.vue'
  33. import Campaigns from '/@/views/adManage/sd/campaigns/index.vue'
  34. import Audiences from '/@/views/adManage/sd/audiences/index.vue'
  35. import Targets from '/@/views/adManage/sd/targets/index.vue'
  36. import MatchedDelivery from '/@/views/adManage/sd/matchedDelivery/index.vue'
  37. import PromoteProducts from '/@/views/adManage/sd/promoteProducts/index.vue'
  38. import PurchasedOtherProducts from './purchasedOtherProducts/index.vue'
  39. import Placement from '/@/views/adManage/sb/placement/index.vue'
  40. // const shopInfo = useShopInfo()
  41. const publicData = usePublicData()
  42. const selectedPortfolios: Ref<string[]> = ref([])
  43. const portfolios: Ref<Portfolio[]> = ref([])
  44. const { dateRange } = storeToRefs(publicData)
  45. const tabActiveName = ref('Campaigns')
  46. const tabsComponents: any = {
  47. Campaigns,
  48. Targets,
  49. Audiences,
  50. MatchedDelivery,
  51. PromoteProducts,
  52. // PurchasedOtherProducts,
  53. // Placement
  54. }
  55. const tabs = [
  56. { label: '广告活动', name: 'Campaigns' },
  57. { label: '商品投放', name: 'Targets' },
  58. { label: '受众', name: 'Audiences' },
  59. { label: '匹配的投放', name: 'MatchedDelivery' },
  60. { label: '推广商品', name: 'PromoteProducts' },
  61. // { label: '购买的其他商品', name: 'PurchasedOtherProducts' },
  62. // { label: '广告位', name: 'Placement' }
  63. ]
  64. provide('dateRange', dateRange)
  65. onBeforeMount(async () => {
  66. const resp: APIResponseData = await GetAllPortfolios()
  67. portfolios.value = resp.data
  68. })
  69. </script>
  70. <style scoped>
  71. ::v-deep(.el-table .el-table__header-wrapper .cell) {
  72. border-right: 1px solid rgb(218, 221, 223);
  73. }
  74. </style>