1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495 |
- <!-- 支付占比分析分析 -->
- <template>
- <view class="revenue">
- <view class="revenue-line">
- <PieChart v-if="chartData.series[0].data.length" :chartData="chartData" :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: []
- }]
- }
- }
- },
- 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 = []
- }
- }
- })
- },
- 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;
- .empty {
- padding: 15px;
- }
- }
- </style>
|