-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #2 from xxm1995/dev
2.0.4
- Loading branch information
Showing
34 changed files
with
817 additions
and
385 deletions.
There are no files selected for viewing
87 changes: 87 additions & 0 deletions
87
src/views/dashboard/analysis/components/CockpitReport.api.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,87 @@ | ||
import { defHttp } from '/@/utils/http/axios' | ||
import { Result } from '/#/axios' | ||
|
||
/** | ||
* 支付金额 | ||
*/ | ||
export function getPayAmount(params: CockpitReportQuery) { | ||
return defHttp.get<Result<number>>({ | ||
url: '/report/cockpit//getPayAmount', | ||
method: 'post', | ||
params: params, | ||
}) | ||
} | ||
/** | ||
* 退款金额 | ||
*/ | ||
export function getRefundAmount(params: CockpitReportQuery) { | ||
return defHttp.get<Result<number>>({ | ||
url: '/report/cockpit/getRefundAmount', | ||
method: 'post', | ||
params: params, | ||
}) | ||
} | ||
/** | ||
* 退款金额 | ||
*/ | ||
export function getPayOrderCount(params: CockpitReportQuery) { | ||
return defHttp.get<Result<number>>({ | ||
url: '/report/cockpit/getPayOrderCount', | ||
method: 'post', | ||
params: params, | ||
}) | ||
} | ||
/** | ||
* 退款金额 | ||
*/ | ||
export function getRefundOrderCount(params: CockpitReportQuery) { | ||
return defHttp.get<Result<number>>({ | ||
url: '/report/cockpit/getRefundOrderCount', | ||
method: 'post', | ||
params: params, | ||
}) | ||
} | ||
/** | ||
* 退款金额 | ||
*/ | ||
export function getPayChannelInfo(params: CockpitReportQuery) { | ||
return defHttp.get<Result<ChannelLineReport[]>>({ | ||
url: '/report/cockpit/getPayChannelInfo', | ||
method: 'post', | ||
params: params, | ||
}) | ||
} | ||
/** | ||
* 退款金额 | ||
*/ | ||
export function getRefundChannelInfo(params: CockpitReportQuery) { | ||
return defHttp.get<Result<ChannelLineReport[]>>({ | ||
url: '/report/cockpit/getRefundChannelInfo', | ||
method: 'post', | ||
params: params, | ||
}) | ||
} | ||
|
||
/** | ||
* 支付通道折线图报表 | ||
*/ | ||
export interface ChannelLineReport { | ||
// 支付通道编码 | ||
channelCode: string | ||
// 支付通道名称 | ||
channelName: string | ||
// 订单金额 | ||
orderAmount: number | ||
// 订单数量 | ||
orderCount: number | ||
} | ||
|
||
/** | ||
* 查询条件 | ||
*/ | ||
export interface CockpitReportQuery { | ||
// 开始时间 | ||
startTime: string | ||
// 结束时间 | ||
endTime: string | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
<template> | ||
<Card :tab-list="tabListTitle" v-bind="$attrs" :active-tab-key="activeKey" @tab-change="onTabChange"> | ||
<p v-if="activeKey === 't1'"> | ||
<OrderAmountLine :head="payHead" :data="payAmount" :max="payMax" /> | ||
</p> | ||
<p v-if="activeKey === 't2'"> | ||
<OrderAmountLine :head="refundHead" :data="refundAmount" :max="refundMax" /> | ||
</p> | ||
</Card> | ||
</template> | ||
<script lang="ts" setup> | ||
import { computed, ref } from 'vue' | ||
import { Card } from 'ant-design-vue' | ||
import OrderAmountLine from './OrderAmountLine.vue' | ||
const activeKey = ref('t1') | ||
const tabListTitle = [ | ||
{ | ||
key: 't1', | ||
tab: '支付金额', | ||
}, | ||
{ | ||
key: 't2', | ||
tab: '退款金额', | ||
}, | ||
] | ||
const prop = defineProps({ | ||
payOrder: { | ||
type: Array<object>, | ||
}, | ||
refundOrder: { | ||
type: Array<object>, | ||
}, | ||
}) | ||
// 表头 | ||
const payHead = computed(() => (prop.payOrder as any).map((o) => o.name)) | ||
const refundHead = computed(() => (prop.refundOrder as any).map((o) => o.name)) | ||
// 订单金额 | ||
const payAmount = computed(() => (prop.payOrder as any).map((o) => o.value)) | ||
const refundAmount = computed(() => (prop.refundOrder as any).map((o) => o.value)) | ||
// 最大值 | ||
const payMax = computed(() => Math.max(...(prop.payOrder as any).map((o) => o.value))) | ||
const refundMax = computed(() => Math.max(...(prop.refundOrder as any).map((o) => o.value))) | ||
function onTabChange(key) { | ||
activeKey.value = key | ||
} | ||
</script> |
87 changes: 87 additions & 0 deletions
87
src/views/dashboard/analysis/components/OrderAmountLine.vue
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,87 @@ | ||
<template> | ||
<div ref="chartRef" :style="{ height: '280px', width: '95%' }"></div> | ||
</template> | ||
<script lang="ts" setup> | ||
import { ref, Ref, watch } from 'vue' | ||
import { useECharts } from '/@/hooks/web/useECharts' | ||
const chartRef = ref<HTMLDivElement | null>(null) | ||
const { setOptions } = useECharts(chartRef as Ref<HTMLDivElement>) | ||
const prop = defineProps({ | ||
max: { | ||
type: Number, | ||
default: 100, | ||
}, | ||
head: { | ||
type: Array, | ||
default: () => [], | ||
}, | ||
data: { | ||
type: Array, | ||
default: () => [], | ||
}, | ||
}) | ||
watch( | ||
() => prop.data, | ||
() => { | ||
setOptions({ | ||
tooltip: { | ||
trigger: 'axis', | ||
axisPointer: { | ||
lineStyle: { | ||
width: 1, | ||
color: '#019680', | ||
}, | ||
}, | ||
}, | ||
xAxis: { | ||
type: 'category', | ||
boundaryGap: false, | ||
data: ['', ...prop.head, ''] as any, | ||
splitLine: { | ||
show: true, | ||
lineStyle: { | ||
width: 1, | ||
type: 'solid', | ||
color: 'rgba(226,226,226,0.5)', | ||
}, | ||
}, | ||
axisTick: { | ||
show: false, | ||
}, | ||
}, | ||
yAxis: [ | ||
{ | ||
type: 'value', | ||
max: prop.max, | ||
splitNumber: 4, | ||
axisTick: { | ||
show: false, | ||
}, | ||
splitArea: { | ||
show: true, | ||
areaStyle: { | ||
color: ['rgba(255,255,255,0.2)', 'rgba(226,226,226,0.2)'], | ||
}, | ||
}, | ||
}, | ||
], | ||
grid: { left: '1%', right: '1%', top: '2 %', bottom: 0, containLabel: true }, | ||
series: [ | ||
{ | ||
smooth: true, | ||
data: [0, ...prop.data, 0] as any, | ||
type: 'line', | ||
areaStyle: {}, | ||
itemStyle: { | ||
color: '#5ab1ef', | ||
}, | ||
}, | ||
], | ||
}) | ||
}, | ||
{ immediate: true }, | ||
) | ||
</script> |
23 changes: 10 additions & 13 deletions
23
...ashboard/analysis/components/GrowCard.vue → ...hboard/analysis/components/OrderCount.vue
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,39 +1,36 @@ | ||
<template> | ||
<div class="md:flex"> | ||
<template v-for="(item, index) in growCardList" :key="item.title"> | ||
<template v-for="(item, index) in data" :key="item.title"> | ||
<Card | ||
size="small" | ||
:loading="loading" | ||
:title="item.title" | ||
class="md:w-1/4 w-full !md:mt-0" | ||
:class="{ '!md:mr-4': index + 1 < 4, '!mt-4': index > 0 }" | ||
> | ||
<template #extra> | ||
<Tag :color="item.color">{{ item.action }}</Tag> | ||
<template v-if="item.action" #extra> | ||
<Tag>{{ item.action }}</Tag> | ||
</template> | ||
|
||
<div class="py-4 px-4 flex justify-between items-center"> | ||
<CountTo prefix="$" :startVal="1" :endVal="item.value" class="text-2xl" /> | ||
<CountTo :startVal="0" :decimals="item.decimals" :endVal="item.value" class="text-2xl" /> | ||
<Icon :icon="item.icon" :size="40" /> | ||
</div> | ||
|
||
<div class="p-2 px-4 flex justify-between"> | ||
<span>总{{ item.title }}</span> | ||
<CountTo prefix="$" :startVal="1" :endVal="item.total" /> | ||
</div> | ||
</Card> | ||
</template> | ||
</div> | ||
</template> | ||
<script lang="ts" setup> | ||
import { CountTo } from '/@/components/CountTo/index' | ||
import { Icon } from '/@/components/Icon' | ||
import { CountTo } from '/@/components/CountTo' | ||
import { Tag, Card } from 'ant-design-vue' | ||
import { growCardList } from '../data' | ||
import Icon from '/@/components/Icon/src/Icon.vue' | ||
import { OrderCountData } from '/@/views/dashboard/analysis/data' | ||
defineProps({ | ||
loading: { | ||
type: Boolean, | ||
}, | ||
data: { | ||
type: Array<OrderCountData>, | ||
}, | ||
}) | ||
</script> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.