AreaStatistic.nvue
2.01 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
<template>
<view class="fixed-date">
<DatePicker @change="handleDateChange" :has-today="false"></DatePicker>
</view>
<view class="h-page">
<view class="mall" style="height: 0;overflow: hidden;">
<MallSelectNvue has-store="1" choose-group="0" @change="handlStoreChange" />
</view>
<AreaStatisticsComp ref="areaStatisticRef" />
</view>
</template>
<script setup>
import {
ref,
onMounted,
computed,
nextTick
} from 'vue'
import {
getUserIndicatorIndexApi,
getAreaAnalysisStatisApi
} from '@/api'
import DatePicker from '@/components/DatePicker.nvue'
import PageOptions from '@/components/PageOptions.vue'
import CustomNavBar from '@/components/CustomNav.nvue'
import MallSelectNvue from '@/components/MallSelect.nvue';
import IndicatorsFilter from '@/components/IndicatorsFilter.nvue'
import AreaStatisticsComp from '@/subPackages/accountGroup/pages/store-analysis/area-statistics/components/AreaStatisticsComp.vue'
import {
getStageObj
} from '../../utils'
const params = ref({})
const flag = ref(false) // 是否初始化完成
const handlStoreChange = (e) => {
params.value = {
...params.value,
...e
}
if(!params.value.storeId){
const store = getStageObj('store')
params.value.storeId = store.id
nextTick(()=>{
areaStatisticRef.value?.initData(params.value)
})
}
}
const handleDateChange = (e) => {
const [startDate, endDate] = e.range
params.value = {
...params.value,
startDate,
endDate,
...e
}
// 日期更改时直接加载数据
if (!flag.value) {
nextTick(()=>{
areaStatisticRef.value?.initData(params.value)
})
}
}
// 组件ref
const areaStatisticRef = ref(null)
</script>
<style lang="scss" scoped>
.fixed-date {
width: 750rpx;
height: 100rpx;
background-color: #f2f3f6;
position: sticky;
left: 0;
top: 0;
padding: 20rpx;
z-index: 100;
}
.h-page {
padding: 0 20rpx;
}
</style>