123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125 |
- <!-- 支付占比分析分析 -->
- <template>
- <view class="revenue-box">
- <view class="revenue-line revenue">
- <PieChart v-if="chartData.series[0].data.length" :chartData="chartData" :title="`路段(${title})`"/>
- <view class="empty" v-else>
- <u-empty></u-empty>
- </view>
- </view>
- <view class="revenue-line revenue">
- <PieChart v-if="chartData1.series[0].data.length" :chartData="chartData1" :title="`停车场(${title})`"/>
- <view class="empty" v-else>
- <u-empty></u-empty>
- </view>
- </view>
- </view>
- </template>
- <script>
- import PieChart from '@/components/pieChart.vue'
- export default {
- components: {
- PieChart
- },
- props: {
- title: {
- type: String,
- default: ''
- }
- },
- data() {
- return {
- reportType: '',
- queryDate: '',
- paySourceList: [],
- chartData: {
- series: [{
- data: []
- }]
- },
- chartData1: {
- series: [{
- data: []
- }]
- }
- }
- },
- created() {
- this.getDict()
- },
- methods: {
- getData({ reportType, queryDate }) {
- this.reportType = reportType
- this.queryDate = queryDate
- this.getPaymentWaysData()
- },
- getDict() {
- uni.$u.api.getDictApi({ type: 'pay_source'}).then(res => {
- if (res.code === 200) {
- this.paySourceList = res.data
- }
- })
- },
- getPaymentWaysData() {
- uni.$u.api.operationalAnalysisApi.getPaymentWaysDataApi({
- reportType: this.reportType,
- queryDate: this.queryDate
- }).then(res => {
- if (res.code === 200) {
- if (res.data.itemList && res.data.itemList.length) {
- let list = res.data.itemList.map(item => {
- return {
- name: this.getDictLabel(item.paySource),
- value: item.amt
- }
- })
- this.chartData.series[0].data = list
- } else {
- this.chartData.series[0].data = []
- }
- }
- })
- uni.$u.api.operationalAnalysisApi.getParkingPaymentWaysDataApi({
- reportType: this.reportType,
- queryDate: this.queryDate
- }).then(res => {
- if (res.code === 200) {
- if (res.data.itemList && res.data.itemList.length) {
- let list = res.data.itemList.map(item => {
- return {
- name: this.getDictLabel(item.paySource),
- value: item.amt
- }
- })
- this.chartData1.series[0].data = list
- } else {
- this.chartData1.series[0].data = []
- }
- }
- })
- },
- getDictLabel(value) {
- let name
- this.paySourceList.forEach(item => {
- if (item.dictValue == value) {
- name = item.dictLabel
- }
- })
- if (!name) name = '其他'
- return name
- }
- }
- }
- </script>
- <style lang="scss" scoped>
- .revenue {
- background-color: #fff;
- border-radius: 5px;
- margin-bottom: 10px;
- .empty {
- padding: 15px;
- }
- }
- </style>
|