This commit is contained in:
Leo_Ding 2025-12-04 17:07:52 +08:00
commit 285e6a8b31
4 changed files with 75 additions and 35 deletions

View File

@ -2,7 +2,7 @@
import request from '@/utils/index'
// 账单列表
export const orderList = () => request.get('/v1/order/pay_list')
export const orderList = (params:any) => request.get('/v1/order/pay_list',{params})
// 我的订单
export const useList = () => request.get('/v1/order/use_list')
export const useList = (params:any) => request.get('/v1/order/use_list',{params})

View File

@ -22,17 +22,25 @@
</a-col>
<a-col :span="24">
<a-table :dataSource="listData" :columns="columns" bordered :pagination="paginationState" @change="onTableChange"/>
<a-table :dataSource="listData" :columns="columns" bordered :pagination="paginationState" @change="onTableChange">
<template #bodyCell="{ column, record }">
<template v-if="column.key === 'created_at'">
<div>
{{ record.created_at ? dayjs(record.created_at).format('YYYY-MM-DD HH:mm') : '-' }}
</div>
</template>
</template>
</a-table>
</a-col>
</a-row>
</template>
<script setup>
<script lang = "ts" setup>
import { ref,onBeforeMount } from 'vue'
import { usePagination } from '@/hooks'
import { orderList } from '@/apis/admin'
import dayjs from 'dayjs'
// const listData=ref([ {title:1}])
// const paginationState=ref({
// total: 0,
@ -43,21 +51,29 @@ import { usePagination } from '@/hooks'
// })
const { listData, loading, showLoading, hideLoading, paginationState, resetPagination, searchFormData } = usePagination()
const columns = ref([
{ title: '日期', dataIndex: 'flowNum', key: 'flowNum' },
{ title: '交易类型', dataIndex: 'transactionTime', key: 'transactionTime' },
{ title: '交易金额', dataIndex: 'flowNum', key: 'flowNum' },
{ title: '优惠金额', dataIndex: 'flowNum', key: 'flowNum' },
{ title: '余额支付', dataIndex: 'flowNum', key: 'flowNum' },
{ title: '代金卷抵扣', dataIndex: 'flowNum', key: 'flowNum' },
{ title: '日期', dataIndex: 'created_at', key: 'created_at' },
{ title: '交易类型', dataIndex: 'status', key: 'status' },
{ title: '交易金额', dataIndex: 'amount', key: 'amount' },
{ title: '优惠金额', dataIndex: 'dis_count_amount', key: 'dis_count_amount' },
{ title: '余额支付', dataIndex: 'real_amount', key: 'real_amount' },
// { title: '', dataIndex: 'flowNum', key: 'flowNum' },
])
onBeforeMount(()=>{
getPageList()
})
const getPageList=()=>{
listData.value=[
{flowNum:1}
]
const getPageList = async()=>{
try {
const { pageSize, current } = paginationState
const res: any = await orderList({ pageSize: pageSize, pageNum: current });
listData.value = res.list;
paginationState.total = res.count;
console.log('支付列表:', res);
// advantageList.value = list;
} catch (error: any) {
console.error('产品优势请求失败:', error);
}
}
/**
* 分页

View File

@ -4,9 +4,9 @@
<a-tab-pane key="1" tab="按日">
<day-detail></day-detail>
</a-tab-pane>
<a-tab-pane key="2" tab="明细">
<!-- <a-tab-pane key="2" tab="明细">
<flowDetail />
</a-tab-pane>
</a-tab-pane> -->
</a-tabs>
</a-card>

View File

@ -34,16 +34,31 @@
<a-col :span="24">
<a-card>
<a-table :dataSource="listData" :columns="columns" bordered :pagination="paginationState"
@change="onTableChange" />
@change="onTableChange">
<template #bodyCell="{ column, record }">
<template v-if="column.key === 'created_at'">
<div>
{{ record.created_at ? dayjs(record.created_at).format('YYYY-MM-DD HH:mm') : '-' }}
</div>
</template>
<template v-if="column.key === 'billing_end'">
<div>
{{ dayjs(record.billing_start).format('YYYY-MM-DD HH:mm') +"~" +dayjs(record.billing_end).format('YYYY-MM-DD HH:mm') }}
</div>
</template>
</template>
</a-table>
</a-card>
</a-col>
</a-row>
</template>
<script setup>
<script setup lang="ts">
import { ref, onBeforeMount } from 'vue'
import { usePagination } from '@/hooks'
import { useList } from '@/apis/admin'
import dayjs from 'dayjs'
// const listData=ref([ {title:1}])
// const paginationState=ref({
// total: 0,
@ -52,7 +67,7 @@ import { usePagination } from '@/hooks'
// showTotal: (total) => ` ${total} `,
// pageSizeOptions: ['10', '20', '30', '40'],
// })
const { listData, loading, showLoading, hideLoading, paginationState, resetPagination, searchFormData } = usePagination()
const { listData, paginationState, resetPagination, searchFormData } = usePagination()
const columns = ref([
// { title: '', dataIndex: 'flowNum', key: 'flowNum' },
// { title: '', dataIndex: 'transactionTime', key: 'transactionTime' },
@ -62,25 +77,34 @@ const columns = ref([
// { title: '', dataIndex: 'flowNum', key: 'flowNum' },
// { title: '', dataIndex: 'flowNum', key: 'flowNum' },
// { title: '', dataIndex: 'flowNum', key: 'flowNum' },
{ title: '流水号', dataIndex: 'flowNum', key: 'flowNum' },
{ title: '交易时间', dataIndex: 'transactionTime', key: 'transactionTime' },
{ title: '主机ID', dataIndex: 'flowNum', key: 'flowNum' },
{ title: '实例ID', dataIndex: 'flowNum', key: 'flowNum' },
{ title: '算力型号', dataIndex: 'flowNum', key: 'flowNum' },
{ title: '算力数量', dataIndex: 'flowNum', key: 'flowNum' },
{ title: '计费时间范围', dataIndex: 'flowNum', key: 'flowNum' },
{ title: '计费时长', dataIndex: 'flowNum', key: 'flowNum' },
{ title: '单价', dataIndex: 'flowNum', key: 'flowNum' },
{ title: '交易金额', dataIndex: 'flowNum', key: 'flowNum' },
{ title: '流水号', dataIndex: 'serial_number', key: 'serial_number' },
{ title: '交易时间', dataIndex: 'created_at', key: 'created_at' },
{ title: '主机ID', dataIndex: 'host_id', key: 'host_id' },
{ title: '实例ID', dataIndex: 'host_case_id', key: 'host_case_id' },
{ title: '算力型号', dataIndex: 'computing_power_model', key: 'computing_power_model' },
{ title: '算力数量', dataIndex: 'gpu_count', key: 'gpu_count' },
{ title: '计费时间范围', dataIndex: 'billing_end', key: 'billing_end' },
{ title: '计费时长', dataIndex: 'bill_time', key: 'bill_time' },
{ title: '单价', dataIndex: 'price', key: 'price' },
{ title: '交易金额', dataIndex: 'real_amount', key: 'real_amount' },
])
onBeforeMount(() => {
getPageList()
})
const getPageList = () => {
listData.value = [
{ flowNum: 1 }
]
const getPageList = async () => {
try {
const { pageSize, current } = paginationState
const res: any = await useList({ pageSize: pageSize, pageNum: current });
listData.value = res.list;
paginationState.total = res.count;
console.log('订单列表:', res);
// advantageList.value = list;
} catch (error: any) {
console.error('产品优势请求失败:', error);
}
}
/**
* 分页