fix
This commit is contained in:
@@ -6,9 +6,7 @@ import type { PayNumData, SaleroomResult, VisitData, CloudData } from './model';
|
||||
* 获取支付笔数数据
|
||||
*/
|
||||
export async function getPayNumList() {
|
||||
const res = await request.get<ApiResult<PayNumData[]>>(
|
||||
'https://oa.gxwebsoft.com/20230508/analysis-pay-num.json'
|
||||
);
|
||||
const res = await request.get<ApiResult<PayNumData[]>>('/shop/dashboard/statistics');
|
||||
if (res.data.code === 0 && res.data.data) {
|
||||
return res.data.data;
|
||||
}
|
||||
@@ -20,7 +18,7 @@ export async function getPayNumList() {
|
||||
*/
|
||||
export async function getSaleroomList() {
|
||||
const res = await request.get<ApiResult<SaleroomResult>>(
|
||||
'https://oa.gxwebsoft.com/20230508/analysis-saleroom.json'
|
||||
'/shop/dashboard/statistics/chart'
|
||||
);
|
||||
if (res.data.code === 0 && res.data.data) {
|
||||
return res.data.data;
|
||||
@@ -34,7 +32,7 @@ export async function getSaleroomList() {
|
||||
*/
|
||||
export async function getVisitHourList() {
|
||||
const res = await request.get<ApiResult<VisitData[]>>(
|
||||
'https://oa.gxwebsoft.com/20230508/analysis-visits.json'
|
||||
'/shop/dashboard/statistics/sales'
|
||||
);
|
||||
if (res.data.code === 0 && res.data.data) {
|
||||
return res.data.data;
|
||||
|
||||
@@ -6,6 +6,10 @@ export interface PayNumData {
|
||||
date?: string;
|
||||
// 支付笔数
|
||||
value?: number;
|
||||
totalSale?: number;
|
||||
dayNewOrderNum?: number;
|
||||
totalOrderNum?: number;
|
||||
dayTotalSale?: number;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -13,14 +17,22 @@ export interface PayNumData {
|
||||
*/
|
||||
export interface SaleroomData {
|
||||
// 月份
|
||||
month?: string;
|
||||
startStatisticsDate?: string;
|
||||
// 销售量
|
||||
value?: number;
|
||||
dailySale?: number;
|
||||
}
|
||||
/**
|
||||
* 销售量数据格式
|
||||
*/
|
||||
export interface OrderroomData {
|
||||
// 月份
|
||||
startStatisticsDate?: string;
|
||||
// 销售量
|
||||
dailyNewOrders?: number;
|
||||
}
|
||||
|
||||
export interface SaleroomResult {
|
||||
list1: SaleroomData[];
|
||||
list2: SaleroomData[];
|
||||
orderStatisticsList: OrderroomData[];
|
||||
salesAmountStatisticsList: SaleroomData[];
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -28,9 +40,9 @@ export interface SaleroomResult {
|
||||
*/
|
||||
export interface VisitData {
|
||||
// 时间
|
||||
time?: string;
|
||||
startStatisticsDate?: string;
|
||||
// 访问量
|
||||
visits?: number;
|
||||
dailySale?: number;
|
||||
// 浏览量
|
||||
views?: number;
|
||||
}
|
||||
|
||||
@@ -32,7 +32,6 @@ export async function listOrder(params?: OrderParam) {
|
||||
return Promise.reject(new Error(res.data.message));
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 查询订单列表
|
||||
*/
|
||||
@@ -136,8 +135,11 @@ export async function checkExistence(
|
||||
/**
|
||||
* 更改电池
|
||||
*/
|
||||
export async function batteryChange(data){
|
||||
const res = await request.post<ApiResult<unknown>>('/open/equipment/change', data);
|
||||
export async function batteryChange(data) {
|
||||
const res = await request.post<ApiResult<unknown>>(
|
||||
'/open/equipment/change',
|
||||
data
|
||||
);
|
||||
if (res.data.code === 0) {
|
||||
return res.data.data;
|
||||
}
|
||||
@@ -147,8 +149,11 @@ export async function batteryChange(data){
|
||||
/**
|
||||
* 强制退租
|
||||
*/
|
||||
export async function rentingOut(data:Order){
|
||||
const res = await request.post<ApiResult<unknown>>('/open/equipment/rentingOut', data);
|
||||
export async function rentingOut(data: Order) {
|
||||
const res = await request.post<ApiResult<unknown>>(
|
||||
'/open/equipment/rentingOut',
|
||||
data
|
||||
);
|
||||
if (res.data.code === 0) {
|
||||
return res.data.message;
|
||||
}
|
||||
|
||||
@@ -6,30 +6,30 @@
|
||||
class="monitor-card-tabs"
|
||||
@change="onSaleTypeChange"
|
||||
>
|
||||
<a-tab-pane tab="商品销售排行(全门店)" key="saleroom" />
|
||||
<a-tab-pane tab="用户消费排行(全门店)" />
|
||||
<template #rightExtra>
|
||||
<a-space
|
||||
size="middle"
|
||||
:class="[
|
||||
'analysis-tabs-extra',
|
||||
{ 'hidden-lg-and-down': styleResponsive }
|
||||
]"
|
||||
>
|
||||
<a-radio-group v-model:value="saleSearch.dateType">
|
||||
<a-radio-button value="1">今天</a-radio-button>
|
||||
<a-radio-button value="2">本周</a-radio-button>
|
||||
<a-radio-button value="3">本月</a-radio-button>
|
||||
<a-radio-button value="4">本年</a-radio-button>
|
||||
</a-radio-group>
|
||||
<div style="width: 300px">
|
||||
<a-range-picker
|
||||
value-format="YYYY-MM-DD"
|
||||
v-model:value="saleSearch.datetime"
|
||||
/>
|
||||
</div>
|
||||
</a-space>
|
||||
</template>
|
||||
<a-tab-pane tab="消费统计(全门店)" key="saleroom" />
|
||||
<!-- <a-tab-pane tab="用户消费排行(全门店)" />-->
|
||||
<!-- <template #rightExtra>-->
|
||||
<!-- <a-space-->
|
||||
<!-- size="middle"-->
|
||||
<!-- :class="[-->
|
||||
<!-- 'analysis-tabs-extra',-->
|
||||
<!-- { 'hidden-lg-and-down': styleResponsive }-->
|
||||
<!-- ]"-->
|
||||
<!-- >-->
|
||||
<!-- <a-radio-group v-model:value="saleSearch.dateType">-->
|
||||
<!-- <a-radio-button value="1">今天</a-radio-button>-->
|
||||
<!-- <a-radio-button value="2">本周</a-radio-button>-->
|
||||
<!-- <a-radio-button value="3">本月</a-radio-button>-->
|
||||
<!-- <a-radio-button value="4">本年</a-radio-button>-->
|
||||
<!-- </a-radio-group>-->
|
||||
<!-- <div style="width: 300px">-->
|
||||
<!-- <a-range-picker-->
|
||||
<!-- value-format="YYYY-MM-DD"-->
|
||||
<!-- v-model:value="saleSearch.datetime"-->
|
||||
<!-- />-->
|
||||
<!-- </div>-->
|
||||
<!-- </a-space>-->
|
||||
<!-- </template>-->
|
||||
</a-tabs>
|
||||
<div style="padding-bottom: 10px">
|
||||
<a-row :gutter="16">
|
||||
@@ -41,55 +41,14 @@
|
||||
<div v-if="saleSearch.type === 'saleroom'" class="demo-monitor-title">
|
||||
销售量趋势
|
||||
</div>
|
||||
<div v-else class="demo-monitor-title">访问量趋势</div>
|
||||
|
||||
<v-chart
|
||||
ref="saleChartRef"
|
||||
:option="saleChartOption"
|
||||
style="height: 320px"
|
||||
/>
|
||||
</a-col>
|
||||
<a-col
|
||||
v-bind="
|
||||
styleResponsive ? { lg: 7, md: 9, sm: 24, xs: 24 } : { span: 7 }
|
||||
"
|
||||
>
|
||||
<div v-if="saleSearch.type === 'saleroom'">
|
||||
<div class="demo-monitor-title">门店销售额排名</div>
|
||||
<div
|
||||
v-for="(item, index) in saleroomRankData"
|
||||
:key="index"
|
||||
class="demo-monitor-rank-item ele-cell"
|
||||
>
|
||||
<ele-tag
|
||||
shape="circle"
|
||||
:color="index < 3 ? '#314659' : ''"
|
||||
style="border: none"
|
||||
>
|
||||
{{ index + 1 }}
|
||||
</ele-tag>
|
||||
<div class="ele-cell-content ele-elip">{{ item.name }}</div>
|
||||
<div class="ele-text-secondary">{{ item.value }}</div>
|
||||
</div>
|
||||
</div>
|
||||
<div v-else>
|
||||
<div class="demo-monitor-title">门店访问量排名</div>
|
||||
<div
|
||||
v-for="(item, index) in visitsRankData"
|
||||
:key="index"
|
||||
class="demo-monitor-rank-item ele-cell"
|
||||
>
|
||||
<ele-tag
|
||||
shape="circle"
|
||||
:color="index < 3 ? '#314659' : ''"
|
||||
style="border: none"
|
||||
>
|
||||
{{ index + 1 }}
|
||||
</ele-tag>
|
||||
<div class="ele-cell-content ele-elip">{{ item.name }}</div>
|
||||
<div class="ele-text-secondary">{{ item.value }}</div>
|
||||
</div>
|
||||
</div>
|
||||
</a-col>
|
||||
|
||||
</a-row>
|
||||
</div>
|
||||
</a-card>
|
||||
@@ -169,8 +128,8 @@
|
||||
const getSaleroomData = () => {
|
||||
getSaleroomList()
|
||||
.then((data) => {
|
||||
saleroomData1.value = data.list1;
|
||||
saleroomData2.value = data.list2;
|
||||
saleroomData1.value = data.orderStatisticsList;
|
||||
saleroomData2.value = data.salesAmountStatisticsList;
|
||||
onSaleTypeChange();
|
||||
})
|
||||
.catch((e) => {
|
||||
@@ -188,7 +147,7 @@
|
||||
xAxis: [
|
||||
{
|
||||
type: 'category',
|
||||
data: saleroomData1.value.map((d) => d.month)
|
||||
data: saleroomData1.value.map((d) => d.startStatisticsDate)
|
||||
}
|
||||
],
|
||||
yAxis: [
|
||||
@@ -199,7 +158,7 @@
|
||||
series: [
|
||||
{
|
||||
type: 'bar',
|
||||
data: saleroomData1.value.map((d) => d.value)
|
||||
data: saleroomData1.value.map((d) => d.dailyNewOrders)
|
||||
}
|
||||
]
|
||||
});
|
||||
@@ -211,7 +170,7 @@
|
||||
xAxis: [
|
||||
{
|
||||
type: 'category',
|
||||
data: saleroomData2.value.map((d) => d.month)
|
||||
data: saleroomData2.value.map((d) => d.startStatisticsDate)
|
||||
}
|
||||
],
|
||||
yAxis: [
|
||||
@@ -222,7 +181,7 @@
|
||||
series: [
|
||||
{
|
||||
type: 'bar',
|
||||
data: saleroomData2.value.map((d) => d.value)
|
||||
data: saleroomData2.value.map((d) => d.dailySale)
|
||||
}
|
||||
]
|
||||
});
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<!-- 统计卡片 -->
|
||||
<template>
|
||||
<a-row :gutter="16" v-if="data">
|
||||
<a-row :gutter="16">
|
||||
<a-col
|
||||
v-bind="styleResponsive ? { lg: 6, md: 12, sm: 24, xs: 24 } : { span: 6 }"
|
||||
>
|
||||
@@ -12,12 +12,12 @@
|
||||
</a-tooltip>
|
||||
</div>
|
||||
<h1 class="analysis-chart-card-num"
|
||||
>¥ {{ formatNumber(data[0].totalPrice) }}</h1
|
||||
>¥{{ salesAmountStatistics.totalSale }}</h1
|
||||
>
|
||||
<a-divider />
|
||||
<div class="flex justify-between">
|
||||
<span>本月订单数</span>
|
||||
<span>{{ data.todayOrders }}单</span>
|
||||
<span>今日销售额</span>
|
||||
<span>{{ salesAmountStatistics.dailySale }}</span>
|
||||
</div>
|
||||
</a-card>
|
||||
</a-col>
|
||||
@@ -29,11 +29,13 @@
|
||||
<div class="ele-cell-content">订单总数</div>
|
||||
<ele-tag color="green">全门店</ele-tag>
|
||||
</div>
|
||||
<h1 class="analysis-chart-card-num">{{ data.totalOrders }}</h1>
|
||||
<h1 class="analysis-chart-card-num">{{
|
||||
orderStatistics.totalOrders
|
||||
}}</h1>
|
||||
<a-divider />
|
||||
<div class="flex justify-between">
|
||||
<span>昨日订单数</span>
|
||||
<span>{{ 634 }}单</span>
|
||||
<span>今日订单数</span>
|
||||
<span>{{ orderStatistics.dailyNewOrders }}单</span>
|
||||
</div>
|
||||
</a-card>
|
||||
</a-col>
|
||||
@@ -45,11 +47,13 @@
|
||||
<div class="ele-cell-content">会员总数</div>
|
||||
<ele-tag color="blue">全门店</ele-tag>
|
||||
</div>
|
||||
<h1 class="analysis-chart-card-num">16,560</h1>
|
||||
<h1 class="analysis-chart-card-num">{{
|
||||
userStatistics.totalUsers
|
||||
}}</h1>
|
||||
<a-divider />
|
||||
<div class="flex justify-between">
|
||||
<span>今日订单数</span>
|
||||
<span>1单</span>
|
||||
<span>今日新增会员</span>
|
||||
<span>{{ userStatistics.dailyNewUsers }}</span>
|
||||
</div>
|
||||
</a-card>
|
||||
</a-col>
|
||||
@@ -58,16 +62,18 @@
|
||||
>
|
||||
<a-card class="analysis-chart-card" :bordered="false">
|
||||
<div class="ele-text-secondary ele-cell">
|
||||
<div class="ele-cell-content">商品总数</div>
|
||||
<div class="ele-cell-content">设备总数</div>
|
||||
<ele-tag color="green">全门店</ele-tag>
|
||||
</div>
|
||||
<h1 class="analysis-chart-card-num">78</h1>
|
||||
<h1 class="analysis-chart-card-num">{{
|
||||
equipmentStatistics.totalEquipment
|
||||
}}</h1>
|
||||
<!-- <div class="analysis-chart-card-content" style="padding-top: 16px">-->
|
||||
<!-- </div>-->
|
||||
<a-divider />
|
||||
<div class="flex justify-between">
|
||||
<span>今日订单数</span>
|
||||
<span>1单</span>
|
||||
<span>今日新增设备数</span>
|
||||
<span>{{ equipmentStatistics.dailyEquipment }}</span>
|
||||
</div>
|
||||
</a-card>
|
||||
</a-col>
|
||||
@@ -94,6 +100,9 @@
|
||||
import { getPayNumList } from '@/api/dashboard/analysis';
|
||||
import useEcharts from '@/utils/use-echarts';
|
||||
import { Count } from '@/api/shop/count/model';
|
||||
import { PayNumData } from '@/api/dashboard/analysis/model';
|
||||
import { assignObject, toDateString } from 'ele-admin-pro';
|
||||
import type { Goods } from '@/api/goods/model';
|
||||
|
||||
use([CanvasRenderer, LineChart, BarChart, GridComponent, TooltipComponent]);
|
||||
|
||||
@@ -101,11 +110,25 @@
|
||||
const themeStore = useThemeStore();
|
||||
const { styleResponsive } = storeToRefs(themeStore);
|
||||
|
||||
const orderStatistics = ref({
|
||||
dailyNewOrders: '',
|
||||
totalOrders: ''
|
||||
});
|
||||
const equipmentStatistics = ref({
|
||||
dailyEquipment: '',
|
||||
totalOrders: ''
|
||||
});
|
||||
const salesAmountStatistics = ref({
|
||||
dailyNewOrders: 0,
|
||||
totalEquipment: 0
|
||||
});
|
||||
const userStatistics = ref({
|
||||
dailyNewUsers: 0,
|
||||
totalUsers: ''
|
||||
});
|
||||
const props = defineProps<{
|
||||
// 弹窗是否打开
|
||||
visible: boolean;
|
||||
// 修改回显的数据
|
||||
data?: Count | null;
|
||||
}>();
|
||||
|
||||
//
|
||||
@@ -124,84 +147,12 @@
|
||||
const getPayNumData = () => {
|
||||
getPayNumList()
|
||||
.then((data) => {
|
||||
Object.assign(visitChartOption, {
|
||||
color: '#975fe5',
|
||||
tooltip: {
|
||||
trigger: 'axis',
|
||||
formatter:
|
||||
'<i class="ele-chart-dot" style="background: #975fe5;"></i>{b0}: {c0}'
|
||||
},
|
||||
grid: {
|
||||
top: 10,
|
||||
bottom: 0,
|
||||
left: 0,
|
||||
right: 0
|
||||
},
|
||||
xAxis: [
|
||||
{
|
||||
show: false,
|
||||
type: 'category',
|
||||
boundaryGap: false,
|
||||
data: data.map((d) => d.date)
|
||||
}
|
||||
],
|
||||
yAxis: [
|
||||
{
|
||||
show: false,
|
||||
type: 'value',
|
||||
splitLine: {
|
||||
show: false
|
||||
}
|
||||
}
|
||||
],
|
||||
series: [
|
||||
{
|
||||
type: 'line',
|
||||
smooth: true,
|
||||
symbol: 'none',
|
||||
areaStyle: {
|
||||
opacity: 0.5
|
||||
},
|
||||
data: data.map((d) => d.value)
|
||||
}
|
||||
]
|
||||
});
|
||||
|
||||
Object.assign(payNumChartOption, {
|
||||
tooltip: {
|
||||
trigger: 'axis',
|
||||
formatter:
|
||||
'<i class="ele-chart-dot" style="background: #5b8ff9;"></i>{b0}: {c0}'
|
||||
},
|
||||
grid: {
|
||||
top: 10,
|
||||
bottom: 0,
|
||||
left: 0,
|
||||
right: 0
|
||||
},
|
||||
xAxis: [
|
||||
{
|
||||
show: false,
|
||||
type: 'category',
|
||||
data: data.map((d) => d.date)
|
||||
}
|
||||
],
|
||||
yAxis: [
|
||||
{
|
||||
show: false,
|
||||
type: 'value',
|
||||
splitLine: {
|
||||
show: false
|
||||
}
|
||||
}
|
||||
],
|
||||
series: [
|
||||
{
|
||||
type: 'bar',
|
||||
data: data.map((d) => d.value)
|
||||
}
|
||||
]
|
||||
});
|
||||
console.log(data);
|
||||
orderStatistics.value = data.orderStatistics;
|
||||
equipmentStatistics.value = data.equipmentStatistics;
|
||||
salesAmountStatistics.value = data.salesAmountStatistics;
|
||||
userStatistics.value = data.userStatistics;
|
||||
//console.log(statistics);
|
||||
})
|
||||
.catch((e) => {
|
||||
message.error(e.message);
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
<template>
|
||||
<a-card
|
||||
:bordered="false"
|
||||
title="最近1小时访问情况"
|
||||
title="销售额趋势图"
|
||||
:body-style="{ padding: '16px 6px 0 0' }"
|
||||
>
|
||||
<v-chart
|
||||
@@ -25,7 +25,7 @@
|
||||
LegendComponent
|
||||
} from 'echarts/components';
|
||||
import VChart from 'vue-echarts';
|
||||
import { getVisitHourList } from '@/api/dashboard/analysis';
|
||||
import { getSaleroomList, getVisitHourList } from "@/api/dashboard/analysis";
|
||||
import useEcharts from '@/utils/use-echarts';
|
||||
|
||||
use([
|
||||
@@ -53,14 +53,14 @@
|
||||
trigger: 'axis'
|
||||
},
|
||||
legend: {
|
||||
data: ['浏览量', '访问量'],
|
||||
data: ['销售额'],
|
||||
right: 20
|
||||
},
|
||||
xAxis: [
|
||||
{
|
||||
type: 'category',
|
||||
boundaryGap: false,
|
||||
data: data.map((d) => d.time)
|
||||
data: data.map((d) => d.startStatisticsDate)
|
||||
}
|
||||
],
|
||||
yAxis: [
|
||||
@@ -70,25 +70,25 @@
|
||||
],
|
||||
series: [
|
||||
{
|
||||
name: '浏览量',
|
||||
name: '销售额',
|
||||
type: 'line',
|
||||
smooth: true,
|
||||
symbol: 'none',
|
||||
areaStyle: {
|
||||
opacity: 0.5
|
||||
},
|
||||
data: data.map((d) => d.views)
|
||||
},
|
||||
{
|
||||
name: '访问量',
|
||||
type: 'line',
|
||||
smooth: true,
|
||||
symbol: 'none',
|
||||
areaStyle: {
|
||||
opacity: 0.5
|
||||
},
|
||||
data: data.map((d) => d.visits)
|
||||
data: data.map((d) => d.dailySale)
|
||||
}
|
||||
// {
|
||||
// name: '访问量',
|
||||
// type: 'line',
|
||||
// smooth: true,
|
||||
// symbol: 'none',
|
||||
// areaStyle: {
|
||||
// opacity: 0.5
|
||||
// },
|
||||
// data: data.map((d) => d.visits)
|
||||
// }
|
||||
]
|
||||
});
|
||||
})
|
||||
|
||||
@@ -1,28 +1,32 @@
|
||||
<template>
|
||||
<div class="ele-body ele-body-card">
|
||||
<statistics-card :data="statistics" />
|
||||
<sale-card />
|
||||
<statistics-card />
|
||||
<!-- <sale-card />-->
|
||||
<visit-hour />
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script lang="ts" setup>
|
||||
import { ref } from 'vue';
|
||||
import { reactive, ref } from 'vue';
|
||||
import { storeToRefs } from 'pinia';
|
||||
import { useThemeStore } from '@/store/modules/theme';
|
||||
//import * as ShopCountApi from '@/api/shop/count';
|
||||
import StatisticsCard from './components/statistics-card.vue';
|
||||
import SaleCard from './components/sale-card.vue';
|
||||
import VisitHour from './components/visit-hour.vue';
|
||||
import visitHour from './components/visit-hour.vue';
|
||||
import { PayNumData } from '@/api/dashboard/analysis/model';
|
||||
|
||||
import HotSearch from './components/hot-search.vue';
|
||||
import { getPayNumList } from '@/api/dashboard/analysis';
|
||||
import { Company } from '@/api/system/company/model';
|
||||
|
||||
// 是否开启响应式布局
|
||||
const themeStore = useThemeStore();
|
||||
const { styleResponsive } = storeToRefs(themeStore);
|
||||
|
||||
const statistics = ref();
|
||||
|
||||
const reload = () => {
|
||||
// ShopCountApi.data({}).then((list) => {
|
||||
// getPayNumList().then((list) => {
|
||||
// console.log(list);
|
||||
// if (list) {
|
||||
// statistics.value = list;
|
||||
// }
|
||||
|
||||
Reference in New Issue
Block a user