updae : 修复报表订单统计订单销售趋势图因无数据一直加载问题

This commit is contained in:
hufflzp 2025-12-19 11:06:50 +08:00
parent 2540abad3d
commit 2801dff0c7

View File

@ -6,17 +6,10 @@
<vab-query-form-right-panel :span="24"> <vab-query-form-right-panel :span="24">
<el-form :inline="true" :model="queryForm" @submit.prevent> <el-form :inline="true" :model="queryForm" @submit.prevent>
<el-form-item class="ml10"> <el-form-item class="ml10">
<ms-date-range-picker <ms-date-range-picker v-model="order_time_range" @update:modelValue="order_time_range = $event" />
v-model="order_time_range"
@update:modelValue="order_time_range = $event"
/>
</el-form-item> </el-form-item>
<el-form-item> <el-form-item>
<el-button <el-button icon="el-icon-search" type="primary" @click="fetchData">
icon="el-icon-search"
type="primary"
@click="fetchData"
>
{{ t('查询') }} {{ t('查询') }}
</el-button> </el-button>
</el-form-item> </el-form-item>
@ -27,44 +20,20 @@
</el-row> </el-row>
<el-row :gutter="20"> <el-row :gutter="20">
<el-col :lg="6" :md="12" :sm="24" :xl="6" :xs="24"> <el-col :lg="6" :md="12" :sm="24" :xl="6" :xs="24">
<top-num <top-num background="white" :bottom-text="t('订单数量')" :count-config="orderNumConfig" icon="numbers-line"
background="white" :title="t('订单数量')" :unit-text="t('单')" />
:bottom-text="t('订单数量')"
:count-config="orderNumConfig"
icon="numbers-line"
:title="t('订单数量')"
:unit-text="t('单')"
/>
</el-col> </el-col>
<el-col :lg="6" :md="12" :sm="24" :xl="6" :xs="24"> <el-col :lg="6" :md="12" :sm="24" :xl="6" :xs="24">
<top-num <top-num background="white" :bottom-text="t('支付单数')" :count-config="orderNumPaidConfig" icon="alipay-line"
background="white" :title="t('支付单数')" :unit-text="t('个')" />
:bottom-text="t('支付单数')"
:count-config="orderNumPaidConfig"
icon="alipay-line"
:title="t('支付单数')"
:unit-text="t('个')"
/>
</el-col> </el-col>
<el-col :lg="6" :md="12" :sm="24" :xl="6" :xs="24"> <el-col :lg="6" :md="12" :sm="24" :xl="6" :xs="24">
<top-num <top-num background="white" :bottom-text="t('用券数量')" :count-config="voucherNumConfig" icon="newspaper-line"
background="white" :title="t('用券数量')" :unit-text="t('个')" />
:bottom-text="t('用券数量')"
:count-config="voucherNumConfig"
icon="newspaper-line"
:title="t('用券数量')"
:unit-text="t('个')"
/>
</el-col> </el-col>
<el-col :lg="6" :md="12" :sm="24" :xl="6" :xs="24"> <el-col :lg="6" :md="12" :sm="24" :xl="6" :xs="24">
<top-num <top-num background="white" :bottom-text="t('退款单数')" :count-config="refundNumConfig" icon="refund-line"
background="white" :title="t('退款单数')" :unit-text="t('个')" />
:bottom-text="t('退款单数')"
:count-config="refundNumConfig"
icon="refund-line"
:title="t('退款单数')"
:unit-text="t('个')"
/>
</el-col> </el-col>
</el-row> </el-row>
@ -75,12 +44,8 @@
<div slot="header"> <div slot="header">
{{ __('订单统计') }} {{ __('订单统计') }}
</div> </div>
<ms-chart <ms-chart :init-options="initOptions" :option="columnOptions" style="width: 100%"
:init-options="initOptions" theme="vab-echarts-theme" />
:option="columnOptions"
style="width: 100%"
theme="vab-echarts-theme"
/>
</el-card> </el-card>
</div> </div>
</el-col> </el-col>
@ -90,12 +55,8 @@
<div slot="header"> <div slot="header">
{{ __('退单统计') }} {{ __('退单统计') }}
</div> </div>
<ms-chart <ms-chart :init-options="initOptions" :option="columnReturnOptions" style="width: 100%"
:init-options="initOptions" theme="vab-echarts-theme" />
:option="columnReturnOptions"
style="width: 100%"
theme="vab-echarts-theme"
/>
</el-card> </el-card>
</div> </div>
</el-col> </el-col>
@ -105,33 +66,15 @@
<template #header> <template #header>
<vab-icon icon="file-chart-line" /> <vab-icon icon="file-chart-line" />
{{ __('订单销售趋势图') }} {{ __('订单销售趋势图') }}
<el-radio-group <el-radio-group v-model="saleTime" class="radio-inline" size="small" style="float: right"
v-model="saleTime" @change="statisticCountEvt">
class="radio-inline" <el-radio-button :label="7">{{ __('7天') }}</el-radio-button>
size="small" <el-radio-button :label="30">{{ __('30天') }}</el-radio-button>
style="float: right" <el-radio-button :label="90">{{ __('3个月') }}</el-radio-button>
@change="statisticCountEvt" <el-radio-button :label="180">{{ __('半年') }}</el-radio-button>
>
<el-radio-button
:label="7"
>{{ __('7天') }}</el-radio-button>
<el-radio-button
:label="30"
>{{ __('30天') }}</el-radio-button>
<el-radio-button
:label="90"
>{{ __('3个月') }}</el-radio-button>
<el-radio-button
:label="180"
>{{ __('半年') }}</el-radio-button>
</el-radio-group> </el-radio-group>
</template> </template>
<ms-chart <ms-chart :init-options="initOptions" :option="polylineOption" style="width: 100%" theme="vab-echarts-theme" />
:init-options="initOptions"
:option="polylineOption"
style="width: 100%"
theme="vab-echarts-theme"
/>
</el-card> </el-card>
</div> </div>
</template> </template>
@ -144,16 +87,16 @@ import TopNum from '@/components/MsWidget/TopNum'
import MsDateRangePicker from '@/components/MsDateRangePicker' import MsDateRangePicker from '@/components/MsDateRangePicker'
import MsChart from '@/extra/VabChart' import MsChart from '@/extra/VabChart'
import {statisticState as statisticRetrunState} from "@/api/order/return"; import { statisticState as statisticRetrunState } from "@/api/order/return";
import {getOrderNum, getVoucherActiveNum} from "@/api/analytics/order"; import { getOrderNum, getVoucherActiveNum } from "@/api/analytics/order";
import {getReturnNum} from "@/api/analytics/return"; import { getReturnNum } from "@/api/analytics/return";
export default { export default {
name: 'OverviewOrder', name: 'OverviewOrder',
components: { MsChart, MsDateRangePicker, TopNum }, components: { MsChart, MsDateRangePicker, TopNum },
data() { data() {
return { return {
saleTime:7, saleTime: 7,
columnLoading: true, columnLoading: true,
polylineLoading: true, polylineLoading: true,
initOptions: { initOptions: {
@ -371,7 +314,7 @@ export default {
this.fetchData() this.fetchData()
}, },
methods: { methods: {
t:__, t: __,
__, __,
queryData() { queryData() {
this.fetchData() this.fetchData()
@ -437,14 +380,18 @@ export default {
async statisticCount(days) { async statisticCount(days) {
this.polylineLoading = true this.polylineLoading = true
const { data } = await statisticCount({ days: days }) const { data } = await statisticCount({ days: days })
this.polylineOption.xAxis.data = data.map((item) => item.curr_date) if (data == null || data.length == 0) {
this.polylineOption.series[0].data = data.map( this.polylineLoading = false
(item) => item.effective_count } else {
) this.polylineOption.xAxis.data = data.map((item) => item.curr_date)
this.polylineOption.series[1].data = data.map( this.polylineOption.series[0].data = data.map(
(item) => item.cancel_count (item) => item.effective_count
) )
this.polylineLoading = false this.polylineOption.series[1].data = data.map(
(item) => item.cancel_count
)
this.polylineLoading = false
}
}, },