|
@@ -4,15 +4,8 @@
|
|
<DateRangePicker v-model="dateRange"></DateRangePicker>
|
|
<DateRangePicker v-model="dateRange"></DateRangePicker>
|
|
</div>
|
|
</div>
|
|
<div class="container-main">
|
|
<div class="container-main">
|
|
- <!--<div class="top-car" style="display: flex; justify-content: space-around">-->
|
|
|
|
- <!-- <ShowCard :cardData="cardData"></ShowCard>-->
|
|
|
|
- <!-- <ShowCard :cardData="cardData" style="margin: 0 5px"></ShowCard>-->
|
|
|
|
- <!-- <ShowCard :cardData="cardData" style="margin-right: 5px;"></ShowCard>-->
|
|
|
|
- <!-- <ShowCard :cardData="cardData"></ShowCard>-->
|
|
|
|
- <!--</div>-->
|
|
|
|
-
|
|
|
|
- <!-- 不要删除这个类 -->
|
|
|
|
- <div class="home-container">
|
|
|
|
|
|
+ <!-- 卡片内容 不要删除这个类 -->
|
|
|
|
+ <div class="home-container" style="margin-top: 2px">
|
|
<el-row :gutter="15" class="home-card-one mb15">
|
|
<el-row :gutter="15" class="home-card-one mb15">
|
|
<el-col
|
|
<el-col
|
|
:xs="24"
|
|
:xs="24"
|
|
@@ -50,30 +43,30 @@
|
|
</el-col>
|
|
</el-col>
|
|
</el-row>
|
|
</el-row>
|
|
</div>
|
|
</div>
|
|
-
|
|
|
|
|
|
+ <!-- 折线图 -->
|
|
<el-card v-loading="loading" style="margin-top: -5px;">
|
|
<el-card v-loading="loading" style="margin-top: -5px;">
|
|
<div style="height: 350px;" ref="chartRefOne"></div>
|
|
<div style="height: 350px;" ref="chartRefOne"></div>
|
|
</el-card>
|
|
</el-card>
|
|
<el-row :gutter="5" style="margin-top: 10px">
|
|
<el-row :gutter="5" style="margin-top: 10px">
|
|
<el-col :span="12">
|
|
<el-col :span="12">
|
|
- <el-card>
|
|
|
|
|
|
+ <el-card v-loading="loading">
|
|
<div style="height: 350px;" ref="chartRefAcos"></div>
|
|
<div style="height: 350px;" ref="chartRefAcos"></div>
|
|
</el-card>
|
|
</el-card>
|
|
</el-col>
|
|
</el-col>
|
|
<el-col :span="12">
|
|
<el-col :span="12">
|
|
- <el-card>
|
|
|
|
|
|
+ <el-card v-loading="loading">
|
|
<div style="height: 350px;" ref="chartRefCPCandCTR"></div>
|
|
<div style="height: 350px;" ref="chartRefCPCandCTR"></div>
|
|
</el-card>
|
|
</el-card>
|
|
</el-col>
|
|
</el-col>
|
|
</el-row>
|
|
</el-row>
|
|
<el-row :gutter="5" style="margin-top: 10px">
|
|
<el-row :gutter="5" style="margin-top: 10px">
|
|
<el-col :span="12">
|
|
<el-col :span="12">
|
|
- <el-card>
|
|
|
|
|
|
+ <el-card v-loading="loading">
|
|
<div style="height: 350px;" ref="chartRefTotalPurchases"></div>
|
|
<div style="height: 350px;" ref="chartRefTotalPurchases"></div>
|
|
</el-card>
|
|
</el-card>
|
|
</el-col>
|
|
</el-col>
|
|
<el-col :span="12">
|
|
<el-col :span="12">
|
|
- <el-card>
|
|
|
|
|
|
+ <el-card v-loading="loading">
|
|
<div style="height: 350px;" ref="chartRefImpandCli"></div>
|
|
<div style="height: 350px;" ref="chartRefImpandCli"></div>
|
|
</el-card>
|
|
</el-card>
|
|
</el-col>
|
|
</el-col>
|
|
@@ -85,18 +78,56 @@
|
|
</template>
|
|
</template>
|
|
|
|
|
|
<script lang="ts" setup>
|
|
<script lang="ts" setup>
|
|
-import {onBeforeMount, onMounted, provide, reactive, ref} from 'vue'
|
|
|
|
|
|
+import {onBeforeMount, onMounted, provide, reactive, ref, watch} from 'vue'
|
|
import * as echarts from 'echarts'
|
|
import * as echarts from 'echarts'
|
|
import {useShopInfo} from '/@/stores/shopInfo'
|
|
import {useShopInfo} from '/@/stores/shopInfo'
|
|
import {usePublicData} from '/@/stores/publicData'
|
|
import {usePublicData} from '/@/stores/publicData'
|
|
import {storeToRefs} from 'pinia'
|
|
import {storeToRefs} from 'pinia'
|
|
import DateRangePicker from '/@/components/DateRangePicker/index.vue'
|
|
import DateRangePicker from '/@/components/DateRangePicker/index.vue'
|
|
|
|
+import {createCrudOptions} from '/@/views/adManage/sp/targets/crud'
|
|
|
|
+import {useFs} from '@fast-crud/fast-crud'
|
|
|
|
+import {getTotalData} from '/@/views/adManage/ad-overview/api'
|
|
|
|
|
|
-const shopInfo = useShopInfo()
|
|
|
|
const publicData = usePublicData()
|
|
const publicData = usePublicData()
|
|
const {dateRange} = storeToRefs(publicData)
|
|
const {dateRange} = storeToRefs(publicData)
|
|
|
|
+const shopInfo = useShopInfo()
|
|
|
|
+const { profile } = storeToRefs(shopInfo)
|
|
const tabActiveName = ref('Campaigns')
|
|
const tabActiveName = ref('Campaigns')
|
|
-provide('dateRange', dateRange)
|
|
|
|
|
|
+const queryParams = ref({
|
|
|
|
+ profileId: profile.value.profile_id,
|
|
|
|
+ dateRange
|
|
|
|
+})
|
|
|
|
+const {crudBinding, crudRef, crudExpose} = useFs({createCrudOptions, context: queryParams})
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+// 发送请求获取数据
|
|
|
|
+let totalData = ref()
|
|
|
|
+async function setTotalData() {
|
|
|
|
+ try {
|
|
|
|
+ const data = await getTotalData({ startDate: dateRange.value[0], endDate: dateRange.value[1], profileId: queryParams.value.profileId })
|
|
|
|
+ totalData.value = data
|
|
|
|
+ console.log('totalData', data)
|
|
|
|
+ } catch (error) {
|
|
|
|
+ console.log('获取数据失败', error)
|
|
|
|
+ }
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
+onMounted(async () => {
|
|
|
|
+ // crudExpose.doRefresh()
|
|
|
|
+ await setTotalData()
|
|
|
|
+})
|
|
|
|
+
|
|
|
|
+watch(queryParams, async() => {
|
|
|
|
+ try {
|
|
|
|
+ loading.value = true
|
|
|
|
+ await setChartOptions()
|
|
|
|
+ console.log('queryParams.value', queryParams.value)
|
|
|
|
+ } catch (error) {
|
|
|
|
+ console.log(error)
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+}, {deep: true})
|
|
|
|
+
|
|
|
|
|
|
// 卡片相关功能
|
|
// 卡片相关功能
|
|
const state = reactive({
|
|
const state = reactive({
|
|
@@ -176,6 +207,7 @@ function changeCardData() {
|
|
|
|
|
|
// 折线图相关功能
|
|
// 折线图相关功能
|
|
const loading = ref(true)
|
|
const loading = ref(true)
|
|
|
|
+
|
|
const chartRefOne = ref()
|
|
const chartRefOne = ref()
|
|
let chartObjOne
|
|
let chartObjOne
|
|
const option = {
|
|
const option = {
|
|
@@ -244,7 +276,7 @@ const option = {
|
|
colorStops: [{
|
|
colorStops: [{
|
|
offset: 0, color: 'rgba(58, 131, 247, 0.5)' // 顶部不透明
|
|
offset: 0, color: 'rgba(58, 131, 247, 0.5)' // 顶部不透明
|
|
}, {
|
|
}, {
|
|
- offset: 0.5, color: 'rgba(58, 131, 247, 0.2)' // 中间更透明
|
|
|
|
|
|
+ offset: 0.2, color: 'rgba(58, 131, 247, 0.2)' // 中间更透明
|
|
}, {
|
|
}, {
|
|
offset: 1, color: 'rgba(58, 131, 247, 0)' // 底部完全透明
|
|
offset: 1, color: 'rgba(58, 131, 247, 0)' // 底部完全透明
|
|
}],
|
|
}],
|
|
@@ -274,7 +306,7 @@ const option = {
|
|
colorStops: [{
|
|
colorStops: [{
|
|
offset: 0, color: 'rgba(241, 154, 55, 0.5)' // 顶部半透明
|
|
offset: 0, color: 'rgba(241, 154, 55, 0.5)' // 顶部半透明
|
|
}, {
|
|
}, {
|
|
- offset: 0.5, color: 'rgba(241, 154, 55, 0.2)' // 中间更透明
|
|
|
|
|
|
+ offset: 0.2, color: 'rgba(241, 154, 55, 0.2)' // 中间更透明
|
|
}, {
|
|
}, {
|
|
offset: 1, color: 'rgba(241, 154, 55, 0)' // 底部完全透明
|
|
offset: 1, color: 'rgba(241, 154, 55, 0)' // 底部完全透明
|
|
}],
|
|
}],
|
|
@@ -345,7 +377,7 @@ const option2 = {
|
|
colorStops: [{
|
|
colorStops: [{
|
|
offset: 0, color: 'rgba(58, 131, 247, 0.5)' // 顶部不透明
|
|
offset: 0, color: 'rgba(58, 131, 247, 0.5)' // 顶部不透明
|
|
}, {
|
|
}, {
|
|
- offset: 0.5, color: 'rgba(58, 131, 247, 0.2)' // 中间更透明
|
|
|
|
|
|
+ offset: 0.2, color: 'rgba(58, 131, 247, 0.2)' // 中间更透明
|
|
}, {
|
|
}, {
|
|
offset: 1, color: 'rgba(58, 131, 247, 0)' // 底部完全透明
|
|
offset: 1, color: 'rgba(58, 131, 247, 0)' // 底部完全透明
|
|
}],
|
|
}],
|
|
@@ -424,7 +456,7 @@ const option3 = {
|
|
colorStops: [{
|
|
colorStops: [{
|
|
offset: 0, color: 'rgba(58, 131, 247, 0.5)' // 顶部不透明
|
|
offset: 0, color: 'rgba(58, 131, 247, 0.5)' // 顶部不透明
|
|
}, {
|
|
}, {
|
|
- offset: 0.5, color: 'rgba(58, 131, 247, 0.2)' // 中间更透明
|
|
|
|
|
|
+ offset: 0.2, color: 'rgba(58, 131, 247, 0.2)' // 中间更透明
|
|
}, {
|
|
}, {
|
|
offset: 1, color: 'rgba(58, 131, 247, 0)' // 底部完全透明
|
|
offset: 1, color: 'rgba(58, 131, 247, 0)' // 底部完全透明
|
|
}],
|
|
}],
|
|
@@ -451,7 +483,7 @@ const option3 = {
|
|
colorStops: [{
|
|
colorStops: [{
|
|
offset: 0, color: 'rgba(241, 154, 55, 0.5)' // 顶部半透明
|
|
offset: 0, color: 'rgba(241, 154, 55, 0.5)' // 顶部半透明
|
|
}, {
|
|
}, {
|
|
- offset: 0.5, color: 'rgba(241, 154, 55, 0.2)' // 中间更透明
|
|
|
|
|
|
+ offset: 0.2, color: 'rgba(241, 154, 55, 0.2)' // 中间更透明
|
|
}, {
|
|
}, {
|
|
offset: 1, color: 'rgba(241, 154, 55, 0)' // 底部完全透明
|
|
offset: 1, color: 'rgba(241, 154, 55, 0)' // 底部完全透明
|
|
}],
|
|
}],
|
|
@@ -522,7 +554,7 @@ const option4 = {
|
|
colorStops: [{
|
|
colorStops: [{
|
|
offset: 0, color: 'rgba(58, 131, 247, 0.5)' // 顶部不透明
|
|
offset: 0, color: 'rgba(58, 131, 247, 0.5)' // 顶部不透明
|
|
}, {
|
|
}, {
|
|
- offset: 0.5, color: 'rgba(58, 131, 247, 0.2)' // 中间更透明
|
|
|
|
|
|
+ offset: 0.2, color: 'rgba(58, 131, 247, 0.2)' // 中间更透明
|
|
}, {
|
|
}, {
|
|
offset: 1, color: 'rgba(58, 131, 247, 0)' // 底部完全透明
|
|
offset: 1, color: 'rgba(58, 131, 247, 0)' // 底部完全透明
|
|
}],
|
|
}],
|
|
@@ -601,7 +633,7 @@ const option5 = {
|
|
colorStops: [{
|
|
colorStops: [{
|
|
offset: 0, color: 'rgba(58, 131, 247, 0.5)' // 顶部不透明
|
|
offset: 0, color: 'rgba(58, 131, 247, 0.5)' // 顶部不透明
|
|
}, {
|
|
}, {
|
|
- offset: 0.5, color: 'rgba(58, 131, 247, 0.2)' // 中间更透明
|
|
|
|
|
|
+ offset: 0.2, color: 'rgba(58, 131, 247, 0.2)' // 中间更透明
|
|
}, {
|
|
}, {
|
|
offset: 1, color: 'rgba(58, 131, 247, 0)' // 底部完全透明
|
|
offset: 1, color: 'rgba(58, 131, 247, 0)' // 底部完全透明
|
|
}],
|
|
}],
|
|
@@ -628,7 +660,7 @@ const option5 = {
|
|
colorStops: [{
|
|
colorStops: [{
|
|
offset: 0, color: 'rgba(241, 154, 55, 0.5)' // 顶部半透明
|
|
offset: 0, color: 'rgba(241, 154, 55, 0.5)' // 顶部半透明
|
|
}, {
|
|
}, {
|
|
- offset: 0.5, color: 'rgba(241, 154, 55, 0.2)' // 中间更透明
|
|
|
|
|
|
+ offset: 0.2, color: 'rgba(241, 154, 55, 0.2)' // 中间更透明
|
|
}, {
|
|
}, {
|
|
offset: 1, color: 'rgba(241, 154, 55, 0)' // 底部完全透明
|
|
offset: 1, color: 'rgba(241, 154, 55, 0)' // 底部完全透明
|
|
}],
|
|
}],
|
|
@@ -639,15 +671,15 @@ const option5 = {
|
|
]
|
|
]
|
|
}
|
|
}
|
|
|
|
|
|
-
|
|
|
|
-const initLine = async () => {
|
|
|
|
|
|
+function initLine() {
|
|
chartObjOne = echarts.init(chartRefOne.value)
|
|
chartObjOne = echarts.init(chartRefOne.value)
|
|
chartObjAcos = echarts.init(chartRefAcos.value)
|
|
chartObjAcos = echarts.init(chartRefAcos.value)
|
|
chartObjCPCandCTR = echarts.init(chartRefCPCandCTR.value)
|
|
chartObjCPCandCTR = echarts.init(chartRefCPCandCTR.value)
|
|
chartObjTotalPurchases = echarts.init(chartRefTotalPurchases.value)
|
|
chartObjTotalPurchases = echarts.init(chartRefTotalPurchases.value)
|
|
chartObjImpandCli = echarts.init(chartRefImpandCli.value)
|
|
chartObjImpandCli = echarts.init(chartRefImpandCli.value)
|
|
- // const items = await getDataset()
|
|
|
|
- // option.dataset.source = items
|
|
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
+function setChartOptions() {
|
|
chartObjOne.setOption(option)
|
|
chartObjOne.setOption(option)
|
|
chartObjAcos.setOption(option2)
|
|
chartObjAcos.setOption(option2)
|
|
chartObjCPCandCTR.setOption(option3)
|
|
chartObjCPCandCTR.setOption(option3)
|
|
@@ -666,6 +698,7 @@ function resizeChart() {
|
|
|
|
|
|
onMounted(async () => {
|
|
onMounted(async () => {
|
|
await initLine()
|
|
await initLine()
|
|
|
|
+ await setChartOptions()
|
|
window.addEventListener('resize', resizeChart) // 监听窗口大小变化,调整图表大小
|
|
window.addEventListener('resize', resizeChart) // 监听窗口大小变化,调整图表大小
|
|
setTimeout(() => {
|
|
setTimeout(() => {
|
|
resizeChart()
|
|
resizeChart()
|