Commit dfc4b8ee authored by chenqikuai's avatar chenqikuai

fix

parent 3ac1c8d7
...@@ -134,3 +134,16 @@ export function deleteCopyRights(ids: number[]) { ...@@ -134,3 +134,16 @@ export function deleteCopyRights(ids: number[]) {
}, },
}); });
} }
export function getBills(payload: {
name?: string;
type?: number;
page: number;
page_size: number;
}) {
return $ajax({
type: "get",
url: "/api/billings",
params: payload,
});
}
...@@ -4,29 +4,48 @@ ...@@ -4,29 +4,48 @@
ref="tableRef" ref="tableRef"
:columns="tableColumns" :columns="tableColumns"
height="100%" height="100%"
:data="data" :data="tableData"
v-loading="loading" v-loading="loading"
element-loading-text="加载中..." element-loading-text="加载中..."
> >
<template #fee="slotProps"> <template #fee="slotProps">
<div <div
:style="{ :style="{
color: green.color || red.color, color: (
slotProps.amount !== 0
? slotProps.amount
: slotProps.chain_times > 0
)
? green.color
: red.color,
}" }"
> >
{{ 11 }} 元 积分 {{ slotProps.amount !== 0 ? slotProps.amount + "元" : "" }}
{{ slotProps.amount === 0 ? slotProps.chain_times + "次" : "" }}
</div> </div>
</template> </template>
<template #type="slotProps">
{{ (slotProps.type === 1 && "实名认证") || "" }}
{{ (slotProps.type === 2 && "套餐购买") || "" }}
{{ (slotProps.type === 3 && "存证上链") || "" }}
{{ (slotProps.type === 4 && "文件上链") || "" }}
{{ (slotProps.type === 5 && "版权备案") || "" }}
</template>
<template #create_time="slotProps">
{{ formatTime(slotProps.create_time) }}
</template>
</Table> </Table>
</template> </template>
<script setup lang="ts"> <script setup lang="ts">
import Table from "@/components/Table/index.vue"; import Table from "@/components/Table/index.vue";
import { tableColumns } from "./table"; import { tableColumns } from "./table";
import { ref } from "vue"; import { onMounted, ref } from "vue";
import { formatTime } from "cqk-sy-ui";
import { eStatusOfCopyright } from "@/components/ApproveStatus/status"; import { eStatusOfCopyright } from "@/components/ApproveStatus/status";
import { useTableScrollListener } from "@/components/Table/hooks"; import { useTableData, useTableScrollListener } from "@/components/Table/hooks";
import { green, red } from "@/components/ApproveStatus/btnStyle"; import { green, red } from "@/components/ApproveStatus/btnStyle";
import { getBills } from "@/service/copyrightService";
// defineProps<{ // defineProps<{
// // data: any[]; // // data: any[];
...@@ -37,7 +56,6 @@ const data = [] as any[]; ...@@ -37,7 +56,6 @@ const data = [] as any[];
const loading = false; const loading = false;
const emit = defineEmits<{ const emit = defineEmits<{
(e: "scrollToEnd"): void;
( (
e: "clickOperate", e: "clickOperate",
payload: { payload: {
...@@ -50,8 +68,22 @@ const emit = defineEmits<{ ...@@ -50,8 +68,22 @@ const emit = defineEmits<{
const tableRef = ref<InstanceType<typeof Table>>(); const tableRef = ref<InstanceType<typeof Table>>();
const { tableData, fetchNextPage } = useTableData({
fetchData: async ({ page, page_size }) => {
const res = await getBills({
name: "",
page,
page_size,
});
return {
total: res?.data.total,
data: res?.data.results || [],
};
},
});
useTableScrollListener(tableRef, () => { useTableScrollListener(tableRef, () => {
emit("scrollToEnd"); fetchNextPage();
}); });
</script> </script>
......
...@@ -6,18 +6,16 @@ export const tableColumns = [ ...@@ -6,18 +6,16 @@ export const tableColumns = [
prop: "name", prop: "name",
}, },
{ {
label: "商品名称",
prop: "address",
},
{
label: "费用", label: "费用",
slotName: "fee", slotName: "fee",
}, },
{ {
label: "费用类型", label: "费用类型",
prop: "date", prop: "type",
slotName: "type",
}, },
{ {
label: "费用时间", label: "费用时间",
slotName: "create_time",
}, },
] as iTableColumn[]; ] as iTableColumn[];
\ No newline at end of file
...@@ -38,7 +38,9 @@ ...@@ -38,7 +38,9 @@
:infos="userInfo" :infos="userInfo"
@ToUpdate="ToUpdate" @ToUpdate="ToUpdate"
></Secutiry> ></Secutiry>
<OrderRecords></OrderRecords> <div style="height: 400px">
<OrderRecords></OrderRecords>
</div>
</ModuleContainer> </ModuleContainer>
</div> </div>
<div class=""> <div class="">
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment