123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281 |
- <!--
- * @Description: 统计报表 => 停车场模块
- * @Author: 空白格
- * @Date: 2022-08-03 11:55:13
- * @LastEditors: 空白格
- * @LastEditTime: 2022-08-03 13:51:11
- * @FilePath: \parking_operation\pages\statisticalReport\parkModel\index.vue
- * @Copyright: Copyright (c) 2016~2022 by 空白格, All Rights Reserved.
- -->
- <template>
- <view class="report">
- <view class="report-header">
- <view class="report-header-left"> </view>
- <view class="report-header-right" v-if="templateKey === 'reallyReceivable'">
- <view class="tab">
- <view
- class="tab-item"
- v-for="(item, index) in tabList"
- :key="index"
- :class="{'active': tabCur === item.value}"
- @click="tabClick(item)"
- >{{ item.label }}</view>
- </view>
- </view>
- <view class="report-header-right" v-else>
- <uni-datetime-picker v-model="curDate" type="daterange" @change="dateChange">
- <u--text text="日期查询" color="#1767F2"></u--text>
- </uni-datetime-picker>
- </view>
- </view>
- <view class="report-content">
- <template v-if="templateKey === 'parkingReallyIncome'">
- <ParkingReallyIncome ref="parkingReallyIncome"/>
- </template>
- <template v-else-if="templateKey === 'arrearsReport'">
- <ArrearsReport ref="arrearsReport" />
- </template>
- <template v-else-if="templateKey === 'revenueReport'">
- <RevenueReport ref="revenueReport" />
- </template>
- <template v-else-if="templateKey === 'reallyReceivable'">
- <ReallyReceivable ref="reallyReceivable" />
- </template>
- </view>
- <!-- 年 -->
- <u-picker
- :show="yearPicker"
- :columns="yearList"
- :defaultIndex="defaultYear"
- @confirm="yearConfirm"
- @cancel="yearPicker = false"
- />
- <!-- 月 -->
- <u-picker
- :show="monthPicker"
- :columns="monthList"
- :defaultIndex="defaultMonth"
- @confirm="monthConfirm"
- @cancel="monthPicker = false"
- />
- <!-- 日 -->
- <u-picker
- :show="dayPicker"
- :columns="dayList"
- :defaultIndex="defaultDay"
- @confirm="dayConfirm"
- @cancel="dayPicker = false"
- />
- </view>
- </template>
- <script>
- import ParkingReallyIncome from './components/parkingReallyIncome.vue';
- import ArrearsReport from './components/arrearsReport.vue';
- import RevenueReport from './components/revenueReport.vue';
- import ReallyReceivable from './components/reallyReceivable.vue';
- export default {
- components: {
- ParkingReallyIncome,
- ArrearsReport,
- RevenueReport,
- ReallyReceivable
- },
- data() {
- return {
- tabList: [
- {
- label: '年',
- value: 2
- },
- {
- label: '月',
- value: 1
- },
- {
- label: '日',
- value: 0
- }
- ],
- templateKey: '',
- // 日期
- curDate: [],
- tabCur: 2,
- // 参数
- params: {
- reportType: 2,
- queryDate: '',
- title: ''
- },
- // 年
- yearPicker: false,
- yearList: this.getYearList(),
- defaultYear: [4],
- currentYear: '',
- yearObj: {},
- // 月
- monthPicker: false,
- monthList: this.getMonthList(),
- defaultMonth: [],
- currentMonth: '01',
- monthObj: {},
- // 日
- dayPicker: false,
- dayList: this.getDayList(),
- defaultDay: [],
- currentDay: '01',
- dayObj: {}
- };
- },
- onLoad(options) {
- uni.setNavigationBarTitle({
- title: options.title || '路段报表'
- });
- this.templateKey = options.key;
- console.log(this.templateKey);
- },
- onShow() {
- if (
- this.templateKey === 'revenueReport' ||
- this.templateKey === 'reallyReceivable'
- ) {
- let today = uni.$u.timeFormat(new Date(), 'yyyy-mm-dd');
- this.curDate = [today, today];
- } else {
- this.curDate = [];
- }
- this.$nextTick(() => {
- if (this.templateKey === 'reallyReceivable') {
- this.currentYear = this.yearList[0][4].value;
- this.yearObj = this.yearList[0][4];
- this.params.title = this.yearList[0][4].text;
- this.params.queryDate = `${this.currentYear}-${this.currentMonth}-${this.currentDay}`;
- this.$refs[this.templateKey].getData(this.params);
- } else {
- this.$refs[this.templateKey].getData(this.curDate);
- }
- });
- },
- methods: {
- getYearList() {
- const date = new Date();
- const year = date.getFullYear();
- const list = [[]];
- for (let i = year - 4; i < year + 1; i++) {
- const obj = {
- text: String(i),
- value: String(i)
- };
- list[0].push(obj);
- }
- return list;
- },
- getMonthList() {
- const date = new Date();
- const month = date.getMonth();
- const list = [[]];
- for (let i = 1; i < 13; i++) {
- const obj = {
- text: String(i),
- value: String(i)
- };
- if (i < 10) {
- obj.text = '0' + i;
- obj.value = '0' + i;
- }
- list[0].push(obj);
- }
- setTimeout(() => {
- this.defaultMonth = [0];
- }, 1000);
- return list;
- },
- getDayList() {
- const date = new Date();
- const year = date.getFullYear();
- let month = date.getMonth();
- if (this.monthObj) {
- month = parseInt(this.monthObj.value);
- month = String(month);
- }
- const day = date.getDate();
- const dayLen = new Date(year, month, 0).getDate();
- const list = [[]];
- for (let i = 1; i < dayLen + 1; i++) {
- const obj = {
- text: String(i),
- value: String(i)
- };
- if (i < 10) {
- obj.text = '0' + i;
- obj.value = '0' + i;
- }
- list[0].push(obj);
- }
- setTimeout(() => {
- this.defaultDay = [0];
- }, 1000);
- return list;
- },
- tabClick(item) {
- this.tabCur = item.value;
- switch (item.value) {
- case 2:
- this.yearPicker = true;
- break;
- case 1:
- this.monthPicker = true;
- break;
- case 0:
- this.dayPicker = true;
- break;
- }
- this.params.reportType = this.tabCur;
- },
- dateChange(e) {
- this.curDate = e;
- this.$refs[this.templateKey].getData(this.curDate);
- },
- yearConfirm(e) {
- this.defaultYear = [e.indexs[0]];
- this.currentYear = e.value[0].value;
- this.params.title = e.value[0].text;
- this.yearObj = e.value[0];
- this.params.queryDate = `${this.currentYear}-${this.currentMonth}-${this.currentDay}`;
- this.$refs[this.templateKey].getData(this.params);
- this.yearPicker = false;
- },
- monthConfirm(e) {
- this.defaultMonth = [e.indexs[0]];
- this.currentMonth = e.value[0].value;
- this.monthObj = e.value[0];
- this.params.title = `${this.yearObj.text}-${this.monthObj.text}`;
- this.params.queryDate = `${this.currentYear}-${this.currentMonth}-${this.currentDay}`;
- this.$refs[this.templateKey].getData(this.params);
- this.monthPicker = false;
- this.dayList = this.getDayList();
- },
- dayConfirm(e) {
- this.defaultDay = [e.indexs[0]];
- this.title = e.value[0].text;
- this.currentDay = e.value[0].value;
- this.dayObj = e.value[0];
- this.params.title = `${this.yearObj.text}-${this.monthObj.text}-${this.dayObj.text}`;
- this.params.queryDate = `${this.currentYear}-${this.currentMonth}-${this.currentDay}`;
- this.$refs[this.templateKey].getData(this.params);
- this.dayPicker = false;
- }
- }
- };
- </script>
- <style lang="scss">
- page {
- background-color: #1767f2;
- min-height: calc(100vh - 44px);
- }
- </style>
- <style lang="scss" scoped>
- @import './../styles/report.scss';
- </style>
|