123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178 |
- <!-- 今日概况 -->
- <template>
- <view class="overview">
- <!-- 顶部切换停车场和路段 -->
- <view class="overview-tabs">
- <view
- class="overview-tabs-item"
- v-for="(item, index) in tabs"
- :key="index"
- :class="{ active: tabCur === item.key }"
- @click="tabCur = item.key"
- >
- <text>{{ item.label }}</text>
- </view>
- </view>
- <template v-if="tabCur === 'road'">
- <view class="overview-content">
- <view class="overview-content-item" v-for="(item, index) in roadObj.list" :key="index">
- <view class="overview-content-item-left">
- <view>
- <text class="title">{{ item.label }}({{ item.unit }})</text>
- </view>
- <view>
- <count-up
- :num="roadData[item.key] || 0"
- color="#1767F2"
- width="20"
- height="42"
- fontSize="30"
- />
- </view>
- </view>
- <view class="overview-content-item-right">
- <template v-if="roadData[item.flag]">
- <u--image
- v-if="roadData[item.flag].indexOf('-') === -1"
- :showLoading="true"
- src="/static/icons/upward-trend-icon.svg"
- width="60px"
- height="35px"
- />
- <u--image
- v-if="roadData[item.flag].indexOf('-') > -1"
- :showLoading="true"
- src="/static/icons/downward-trend-icon.svg"
- width="60px"
- height="35px"
- />
- </template>
- <template v-else>--</template>
- </view>
- </view>
- </view>
- </template>
- <template v-if="tabCur === 'park'">
- <view class="overview-content">
- <view class="overview-content-item" v-for="(item, index) in roadObj.list" :key="index">
- <view class="overview-content-item-left">
- <view>
- <text class="title">{{ item.label }}({{ item.unit }})</text>
- </view>
- <view>
- <count-up
- :num="parkData[item.key] || 0"
- color="#1767F2"
- width="20"
- height="42"
- fontSize="30"
- />
- </view>
- </view>
- <view class="overview-content-item-right">
- <template v-if="parkData[item.flag]">
- <u--image
- v-if="parkData[item.flag].indexOf('-') === -1"
- :showLoading="true"
- src="/static/icons/upward-trend-icon.svg"
- width="60px"
- height="35px"
- />
- <u--image
- v-if="parkData[item.flag].indexOf('-') > -1"
- :showLoading="true"
- src="/static/icons/downward-trend-icon.svg"
- width="60px"
- height="35px"
- />
- </template>
- <template v-else>--</template>
- </view>
- </view>
- </view>
- </template>
- <u-toast ref="uToast"></u-toast>
- </view>
- </template>
- <script>
- import countUp from '@/components/p-countUp/countUp.vue';
- export default {
- components: {
- countUp
- },
- data() {
- return {
- tabs: [
- { key: 'road', label: '路段' },
- { key: 'park', label: '停车场' }
- ],
- tabCur: 'road',
- roadObj: {
- list: [
- { key: 'amtIn', label: '今日营收', unit: '元', flag: 'linkRatIn' },
- { key: 'amtOwe', label: '今日欠费', unit: '元', flag: 'linkRatOwe' },
- { key: 'countQr', label: '今日停车', unit: '次', flag: 'linkRatQr' },
- {
- key: 'countVehicle',
- label: '今日扫码',
- unit: '次',
- flag: 'linkRatVehicle'
- }
- ]
- },
- roadData: {},
- parkData: {}
- };
- },
- onShow() {
- this.getTodayData();
- this.getRoadData();
- },
- methods: {
- /**
- * 获取今日路段概况
- */
- getTodayData() {
- uni.$u.api.todayOverviewApi.getTodayDataApi().then((res) => {
- if (res.code === 200) {
- this.roadData = res.data;
- } else {
- this.$refs.uToast.show({
- loading: true,
- message: res.msg || '获取今日概况失败!',
- type: 'error'
- });
- }
- });
- },
- /**
- * 获取今日停车场情况
- */
- getRoadData() {
- uni.$u.api.todayOverviewApi.getParkDataApi().then((res) => {
- if (res.code === 200) {
- this.parkData = res.data;
- } else {
- this.$refs.uToast.show({
- loading: true,
- message: res.msg || '获取路段概况失败!',
- type: 'error'
- });
- }
- });
- }
- }
- };
- </script>
- <style lang="scss">
- page {
- min-height: calc(100vh - 44px);
- background-color: #1767f2;
- }
- </style>
- <style lang="scss" scoped>
- @import './todayOverview.scss';
- </style>
|