增加默认时间
This commit is contained in:
@@ -1,16 +1,16 @@
|
|||||||
import { ref, h } from "vue";
|
import { ref, h } from "vue";
|
||||||
import { utils, writeFile } from "xlsx";
|
import { utils, writeFile } from "xlsx";
|
||||||
import { message } from "@/utils/message";
|
import { message } from "@/utils/message";
|
||||||
import {
|
import { queryGiftRankList } from "@/api/modules/statistics";
|
||||||
queryGiftRankList
|
import ExportForm from "@/components/exportDialog/index.vue";
|
||||||
} from "@/api/modules/statistics";
|
|
||||||
import ExportForm from '@/components/exportDialog/index.vue';
|
|
||||||
import { addDialog } from "@/components/ReDialog";
|
import { addDialog } from "@/components/ReDialog";
|
||||||
|
import dayjs from "dayjs";
|
||||||
|
|
||||||
export function useData() {
|
export function useData() {
|
||||||
const loading = ref(true);
|
const loading = ref(true);
|
||||||
const tableList = ref([]);
|
const tableList = ref([]);
|
||||||
const isShow = ref(false);
|
const isShow = ref(false);
|
||||||
const total_price = ref(0)
|
const total_price = ref(0);
|
||||||
const pagination = ref({
|
const pagination = ref({
|
||||||
total: 0,
|
total: 0,
|
||||||
pageSize: 10,
|
pageSize: 10,
|
||||||
@@ -18,18 +18,29 @@ export function useData() {
|
|||||||
currentPage: 1,
|
currentPage: 1,
|
||||||
background: true
|
background: true
|
||||||
});
|
});
|
||||||
|
|
||||||
|
// 获取当月第一天 00:00:00 和当前时间
|
||||||
|
const getDefaultTimeRange = () => {
|
||||||
|
const now = dayjs();
|
||||||
|
const startOfMonth = now.startOf("month").format("YYYY-MM-DD HH:mm:ss");
|
||||||
|
const currentTime = now.format("YYYY-MM-DD HH:mm:ss");
|
||||||
|
return { begin_time: startOfMonth, end_time: currentTime };
|
||||||
|
};
|
||||||
|
|
||||||
|
const defaultTime = getDefaultTimeRange();
|
||||||
|
|
||||||
const searchForm = ref({
|
const searchForm = ref({
|
||||||
search_uid: "",
|
search_uid: "",
|
||||||
begin_time: "",
|
begin_time: defaultTime.begin_time,
|
||||||
username: "",
|
username: "",
|
||||||
end_time: "",
|
end_time: defaultTime.end_time,
|
||||||
type: 2
|
type: 2
|
||||||
});
|
});
|
||||||
const searchLabel = ref([
|
const searchLabel = ref([
|
||||||
{ label: "用户ID", prop: "search_uid", type: "input" },
|
{ label: "用户ID", prop: "search_uid", type: "input" },
|
||||||
{ label: "用户昵称", prop: "username", type: "input" },
|
{ label: "用户昵称", prop: "username", type: "input" },
|
||||||
{ label: "开始时间", prop: "begin_time", type: "date" },
|
{ label: "开始时间", prop: "begin_time", type: "date" },
|
||||||
{ label: "结束时间", prop: "end_time", type: "date" },
|
{ label: "结束时间", prop: "end_time", type: "date" }
|
||||||
]);
|
]);
|
||||||
const tableLabel = ref([
|
const tableLabel = ref([
|
||||||
// {
|
// {
|
||||||
@@ -56,20 +67,19 @@ export function useData() {
|
|||||||
{
|
{
|
||||||
label: "总收益",
|
label: "总收益",
|
||||||
prop: "total_price"
|
prop: "total_price"
|
||||||
},
|
}
|
||||||
// {
|
// {
|
||||||
// label: "生成时间",
|
// label: "生成时间",
|
||||||
// prop: "createtime"
|
// prop: "createtime"
|
||||||
// }
|
// }
|
||||||
]);
|
]);
|
||||||
const onSearch = async (formData) => {
|
const onSearch = async formData => {
|
||||||
loading.value = true;
|
loading.value = true;
|
||||||
searchForm.value = { ...formData }
|
searchForm.value = { ...formData };
|
||||||
const { data, code } = await queryGiftRankList({
|
const { data, code } = await queryGiftRankList({
|
||||||
...formData,
|
...formData,
|
||||||
page: pagination.value.currentPage,
|
page: pagination.value.currentPage,
|
||||||
page_limit: pagination.value.pageSize,
|
page_limit: pagination.value.pageSize
|
||||||
|
|
||||||
});
|
});
|
||||||
if (code) {
|
if (code) {
|
||||||
tableList.value = data.lists;
|
tableList.value = data.lists;
|
||||||
@@ -87,23 +97,24 @@ export function useData() {
|
|||||||
pagination.value.currentPage = val;
|
pagination.value.currentPage = val;
|
||||||
onSearch(searchForm.value);
|
onSearch(searchForm.value);
|
||||||
};
|
};
|
||||||
const exportFormRef = ref(null)
|
const exportFormRef = ref(null);
|
||||||
const exportExcel = () => {
|
const exportExcel = () => {
|
||||||
let exportTableList = []
|
let exportTableList = [];
|
||||||
addDialog({
|
addDialog({
|
||||||
title: `导出数据`,
|
title: `导出数据`,
|
||||||
props: {
|
props: {
|
||||||
formInline: {
|
formInline: {
|
||||||
time: ''
|
time: ""
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
width: "40%",
|
width: "40%",
|
||||||
closeOnClickModal: false,
|
closeOnClickModal: false,
|
||||||
contentRenderer: () => h(ExportForm, { ref: exportFormRef, formInline: null }),
|
contentRenderer: () =>
|
||||||
|
h(ExportForm, { ref: exportFormRef, formInline: null }),
|
||||||
beforeSure: (done, { options }) => {
|
beforeSure: (done, { options }) => {
|
||||||
const FormRef = exportFormRef.value.getRef();
|
const FormRef = exportFormRef.value.getRef();
|
||||||
const curData = options.props.formInline;
|
const curData = options.props.formInline;
|
||||||
const exportData = async (formData) => {
|
const exportData = async formData => {
|
||||||
const { data, code } = await queryGiftRankList({
|
const { data, code } = await queryGiftRankList({
|
||||||
...formData,
|
...formData,
|
||||||
page: 1,
|
page: 1,
|
||||||
@@ -126,28 +137,33 @@ export function useData() {
|
|||||||
const workSheet = utils.aoa_to_sheet(res);
|
const workSheet = utils.aoa_to_sheet(res);
|
||||||
const workBook = utils.book_new();
|
const workBook = utils.book_new();
|
||||||
utils.book_append_sheet(workBook, workSheet, "数据报表");
|
utils.book_append_sheet(workBook, workSheet, "数据报表");
|
||||||
writeFile(workBook, `收礼排行统计${formData.begin_time} - ${formData.end_time}.xlsx`);
|
writeFile(
|
||||||
|
workBook,
|
||||||
|
`收礼排行统计${formData.begin_time} - ${formData.end_time}.xlsx`
|
||||||
|
);
|
||||||
message("导出成功", {
|
message("导出成功", {
|
||||||
type: "success"
|
type: "success"
|
||||||
});
|
});
|
||||||
done()
|
done();
|
||||||
} else {
|
} else {
|
||||||
message("获取数据失败,请重试!", {
|
message("获取数据失败,请重试!", {
|
||||||
type: "error"
|
type: "error"
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
};
|
||||||
FormRef.validate(valid => {
|
FormRef.validate(valid => {
|
||||||
if (valid) {
|
if (valid) {
|
||||||
if (curData.time && curData.time.length) {
|
if (curData.time && curData.time.length) {
|
||||||
exportData({ begin_time: curData.time[0] || '', end_time: curData.time[1] || '' })
|
exportData({
|
||||||
|
begin_time: curData.time[0] || "",
|
||||||
|
end_time: curData.time[1] || ""
|
||||||
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
};
|
||||||
}
|
|
||||||
return {
|
return {
|
||||||
searchForm,
|
searchForm,
|
||||||
searchLabel,
|
searchLabel,
|
||||||
|
|||||||
@@ -1,16 +1,16 @@
|
|||||||
import { ref, h } from "vue";
|
import { ref, h } from "vue";
|
||||||
import { utils, writeFile } from "xlsx";
|
import { utils, writeFile } from "xlsx";
|
||||||
import ExportForm from '@/components/exportDialog/index.vue';
|
import ExportForm from "@/components/exportDialog/index.vue";
|
||||||
import { addDialog } from "@/components/ReDialog";
|
import { addDialog } from "@/components/ReDialog";
|
||||||
import { message } from "@/utils/message";
|
import { message } from "@/utils/message";
|
||||||
import {
|
import { queryConsumerRankList } from "@/api/modules/statistics";
|
||||||
queryConsumerRankList
|
import dayjs from "dayjs";
|
||||||
} from "@/api/modules/statistics";
|
|
||||||
export function useData() {
|
export function useData() {
|
||||||
const loading = ref(true);
|
const loading = ref(true);
|
||||||
const tableList = ref([]);
|
const tableList = ref([]);
|
||||||
const isShow = ref(false);
|
const isShow = ref(false);
|
||||||
const total_price = ref(0)
|
const total_price = ref(0);
|
||||||
const pagination = ref({
|
const pagination = ref({
|
||||||
total: 0,
|
total: 0,
|
||||||
pageSize: 10,
|
pageSize: 10,
|
||||||
@@ -18,17 +18,28 @@ export function useData() {
|
|||||||
currentPage: 1,
|
currentPage: 1,
|
||||||
background: true
|
background: true
|
||||||
});
|
});
|
||||||
|
|
||||||
|
// 获取当月第一天 00:00:00 和当前时间
|
||||||
|
const getDefaultTimeRange = () => {
|
||||||
|
const now = dayjs();
|
||||||
|
const startOfMonth = now.startOf("month").format("YYYY-MM-DD HH:mm:ss");
|
||||||
|
const currentTime = now.format("YYYY-MM-DD HH:mm:ss");
|
||||||
|
return { begin_time: startOfMonth, end_time: currentTime };
|
||||||
|
};
|
||||||
|
|
||||||
|
const defaultTime = getDefaultTimeRange();
|
||||||
|
|
||||||
const searchForm = ref({
|
const searchForm = ref({
|
||||||
search_uid: "",
|
search_uid: "",
|
||||||
begin_time: "",
|
begin_time: defaultTime.begin_time,
|
||||||
username: '',
|
username: "",
|
||||||
end_time: ""
|
end_time: defaultTime.end_time
|
||||||
});
|
});
|
||||||
const searchLabel = ref([
|
const searchLabel = ref([
|
||||||
{ label: "用户ID", prop: "search_uid", type: "input" },
|
{ label: "用户ID", prop: "search_uid", type: "input" },
|
||||||
{ label: "用户昵称", prop: "username", type: "input" },
|
{ label: "用户昵称", prop: "username", type: "input" },
|
||||||
{ label: "开始时间", prop: "begin_time", type: "date" },
|
{ label: "开始时间", prop: "begin_time", type: "date" },
|
||||||
{ label: "结束时间", prop: "end_time", type: "date" },
|
{ label: "结束时间", prop: "end_time", type: "date" }
|
||||||
]);
|
]);
|
||||||
const tableLabel = ref([
|
const tableLabel = ref([
|
||||||
// {
|
// {
|
||||||
@@ -55,28 +66,28 @@ export function useData() {
|
|||||||
{
|
{
|
||||||
label: "消费总额",
|
label: "消费总额",
|
||||||
prop: "change_value"
|
prop: "change_value"
|
||||||
},
|
}
|
||||||
// {
|
// {
|
||||||
// label: "消费时间",
|
// label: "消费时间",
|
||||||
// prop: "createtime"
|
// prop: "createtime"
|
||||||
// }
|
// }
|
||||||
]);
|
]);
|
||||||
const onSearch = async (formData) => {
|
const onSearch = async formData => {
|
||||||
loading.value = true;
|
loading.value = true;
|
||||||
searchForm.value = { ...formData }
|
searchForm.value = { ...formData };
|
||||||
const { data, code } = await queryConsumerRankList({
|
const { data, code } = await queryConsumerRankList({
|
||||||
...formData,
|
...formData,
|
||||||
page: pagination.value.currentPage,
|
page: pagination.value.currentPage,
|
||||||
page_limit: pagination.value.pageSize,
|
page_limit: pagination.value.pageSize
|
||||||
|
|
||||||
});
|
});
|
||||||
if (code) {
|
if (code) {
|
||||||
tableList.value = data.lists.map(ele => {
|
tableList.value = data.lists.map(ele => {
|
||||||
return {
|
return {
|
||||||
...ele, ...data.total
|
...ele,
|
||||||
}
|
...data.total
|
||||||
|
};
|
||||||
});
|
});
|
||||||
total_price.value = data.total.total_price
|
total_price.value = data.total.total_price;
|
||||||
pagination.value.total = data.count;
|
pagination.value.total = data.count;
|
||||||
pagination.value.currentPage = data.page;
|
pagination.value.currentPage = data.page;
|
||||||
}
|
}
|
||||||
@@ -90,23 +101,24 @@ export function useData() {
|
|||||||
pagination.value.currentPage = val;
|
pagination.value.currentPage = val;
|
||||||
onSearch(searchForm.value);
|
onSearch(searchForm.value);
|
||||||
};
|
};
|
||||||
const exportFormRef = ref(null)
|
const exportFormRef = ref(null);
|
||||||
const exportExcel = () => {
|
const exportExcel = () => {
|
||||||
let exportTableList = []
|
let exportTableList = [];
|
||||||
addDialog({
|
addDialog({
|
||||||
title: `导出数据`,
|
title: `导出数据`,
|
||||||
props: {
|
props: {
|
||||||
formInline: {
|
formInline: {
|
||||||
time: ''
|
time: ""
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
width: "40%",
|
width: "40%",
|
||||||
closeOnClickModal: false,
|
closeOnClickModal: false,
|
||||||
contentRenderer: () => h(ExportForm, { ref: exportFormRef, formInline: null }),
|
contentRenderer: () =>
|
||||||
|
h(ExportForm, { ref: exportFormRef, formInline: null }),
|
||||||
beforeSure: (done, { options }) => {
|
beforeSure: (done, { options }) => {
|
||||||
const FormRef = exportFormRef.value.getRef();
|
const FormRef = exportFormRef.value.getRef();
|
||||||
const curData = options.props.formInline;
|
const curData = options.props.formInline;
|
||||||
const exportData = async (formData) => {
|
const exportData = async formData => {
|
||||||
const { data, code } = await queryConsumerRankList({
|
const { data, code } = await queryConsumerRankList({
|
||||||
...formData,
|
...formData,
|
||||||
page: 1,
|
page: 1,
|
||||||
@@ -129,28 +141,33 @@ export function useData() {
|
|||||||
const workSheet = utils.aoa_to_sheet(res);
|
const workSheet = utils.aoa_to_sheet(res);
|
||||||
const workBook = utils.book_new();
|
const workBook = utils.book_new();
|
||||||
utils.book_append_sheet(workBook, workSheet, "数据报表");
|
utils.book_append_sheet(workBook, workSheet, "数据报表");
|
||||||
writeFile(workBook, `消费排行统计${formData.begin_time} - ${formData.end_time}.xlsx`);
|
writeFile(
|
||||||
|
workBook,
|
||||||
|
`消费排行统计${formData.begin_time} - ${formData.end_time}.xlsx`
|
||||||
|
);
|
||||||
message("导出成功", {
|
message("导出成功", {
|
||||||
type: "success"
|
type: "success"
|
||||||
});
|
});
|
||||||
done()
|
done();
|
||||||
} else {
|
} else {
|
||||||
message("获取数据失败,请重试!", {
|
message("获取数据失败,请重试!", {
|
||||||
type: "error"
|
type: "error"
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
};
|
||||||
FormRef.validate(valid => {
|
FormRef.validate(valid => {
|
||||||
if (valid) {
|
if (valid) {
|
||||||
if (curData.time && curData.time.length) {
|
if (curData.time && curData.time.length) {
|
||||||
exportData({ begin_time: curData.time[0] || '', end_time: curData.time[1] || '' })
|
exportData({
|
||||||
|
begin_time: curData.time[0] || "",
|
||||||
|
end_time: curData.time[1] || ""
|
||||||
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
};
|
||||||
}
|
|
||||||
return {
|
return {
|
||||||
searchForm,
|
searchForm,
|
||||||
searchLabel,
|
searchLabel,
|
||||||
|
|||||||
@@ -1,11 +1,11 @@
|
|||||||
import { ref, h } from "vue";
|
import { ref, h } from "vue";
|
||||||
import {
|
import { queryGiftRankList } from "@/api/modules/statistics";
|
||||||
queryGiftRankList
|
|
||||||
} from "@/api/modules/statistics";
|
|
||||||
import { utils, writeFile } from "xlsx";
|
import { utils, writeFile } from "xlsx";
|
||||||
import ExportForm from '@/components/exportDialog/index.vue';
|
import ExportForm from "@/components/exportDialog/index.vue";
|
||||||
import { addDialog } from "@/components/ReDialog";
|
import { addDialog } from "@/components/ReDialog";
|
||||||
import { message } from "@/utils/message";
|
import { message } from "@/utils/message";
|
||||||
|
import dayjs from "dayjs";
|
||||||
|
|
||||||
export function useData() {
|
export function useData() {
|
||||||
const loading = ref(true);
|
const loading = ref(true);
|
||||||
const tableList = ref([]);
|
const tableList = ref([]);
|
||||||
@@ -17,19 +17,30 @@ export function useData() {
|
|||||||
currentPage: 1,
|
currentPage: 1,
|
||||||
background: true
|
background: true
|
||||||
});
|
});
|
||||||
|
|
||||||
|
// 获取当月第一天 00:00:00 和当前时间
|
||||||
|
const getDefaultTimeRange = () => {
|
||||||
|
const now = dayjs();
|
||||||
|
const startOfMonth = now.startOf("month").format("YYYY-MM-DD HH:mm:ss");
|
||||||
|
const currentTime = now.format("YYYY-MM-DD HH:mm:ss");
|
||||||
|
return { begin_time: startOfMonth, end_time: currentTime };
|
||||||
|
};
|
||||||
|
|
||||||
|
const defaultTime = getDefaultTimeRange();
|
||||||
|
|
||||||
const searchForm = ref({
|
const searchForm = ref({
|
||||||
search_uid: "",
|
search_uid: "",
|
||||||
begin_time: "",
|
begin_time: defaultTime.begin_time,
|
||||||
end_time: "",
|
end_time: defaultTime.end_time,
|
||||||
username: "",
|
username: "",
|
||||||
type: 1
|
type: 1
|
||||||
});
|
});
|
||||||
const total_price = ref(0)
|
const total_price = ref(0);
|
||||||
const searchLabel = ref([
|
const searchLabel = ref([
|
||||||
{ label: "用户ID", prop: "search_uid", type: "input" },
|
{ label: "用户ID", prop: "search_uid", type: "input" },
|
||||||
{ label: "用户昵称", prop: "username", type: "input" },
|
{ label: "用户昵称", prop: "username", type: "input" },
|
||||||
{ label: "开始时间", prop: "begin_time", type: "date" },
|
{ label: "开始时间", prop: "begin_time", type: "date" },
|
||||||
{ label: "结束时间", prop: "end_time", type: "date" },
|
{ label: "结束时间", prop: "end_time", type: "date" }
|
||||||
]);
|
]);
|
||||||
const tableLabel = ref([
|
const tableLabel = ref([
|
||||||
// {
|
// {
|
||||||
@@ -60,24 +71,23 @@ export function useData() {
|
|||||||
{
|
{
|
||||||
label: "礼物总量",
|
label: "礼物总量",
|
||||||
prop: "number"
|
prop: "number"
|
||||||
},
|
}
|
||||||
// {
|
// {
|
||||||
// label: "生成时间",
|
// label: "生成时间",
|
||||||
// prop: "createtime"
|
// prop: "createtime"
|
||||||
// }
|
// }
|
||||||
]);
|
]);
|
||||||
const onSearch = async (formData) => {
|
const onSearch = async formData => {
|
||||||
loading.value = true;
|
loading.value = true;
|
||||||
searchForm.value = { ...formData }
|
searchForm.value = { ...formData };
|
||||||
const { data, code } = await queryGiftRankList({
|
const { data, code } = await queryGiftRankList({
|
||||||
...formData,
|
...formData,
|
||||||
page: pagination.value.currentPage,
|
page: pagination.value.currentPage,
|
||||||
page_limit: pagination.value.pageSize,
|
page_limit: pagination.value.pageSize
|
||||||
|
|
||||||
});
|
});
|
||||||
if (code) {
|
if (code) {
|
||||||
total_price.value = data.total.total_price || 0;
|
total_price.value = data.total.total_price || 0;
|
||||||
tableList.value = data.lists
|
tableList.value = data.lists;
|
||||||
pagination.value.total = data.count;
|
pagination.value.total = data.count;
|
||||||
pagination.value.currentPage = data.page;
|
pagination.value.currentPage = data.page;
|
||||||
}
|
}
|
||||||
@@ -91,23 +101,24 @@ export function useData() {
|
|||||||
pagination.value.currentPage = val;
|
pagination.value.currentPage = val;
|
||||||
onSearch(searchForm.value);
|
onSearch(searchForm.value);
|
||||||
};
|
};
|
||||||
const exportFormRef = ref(null)
|
const exportFormRef = ref(null);
|
||||||
const exportExcel = () => {
|
const exportExcel = () => {
|
||||||
let exportTableList = []
|
let exportTableList = [];
|
||||||
addDialog({
|
addDialog({
|
||||||
title: `导出数据`,
|
title: `导出数据`,
|
||||||
props: {
|
props: {
|
||||||
formInline: {
|
formInline: {
|
||||||
time: ''
|
time: ""
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
width: "40%",
|
width: "40%",
|
||||||
closeOnClickModal: false,
|
closeOnClickModal: false,
|
||||||
contentRenderer: () => h(ExportForm, { ref: exportFormRef, formInline: null }),
|
contentRenderer: () =>
|
||||||
|
h(ExportForm, { ref: exportFormRef, formInline: null }),
|
||||||
beforeSure: (done, { options }) => {
|
beforeSure: (done, { options }) => {
|
||||||
const FormRef = exportFormRef.value.getRef();
|
const FormRef = exportFormRef.value.getRef();
|
||||||
const curData = options.props.formInline;
|
const curData = options.props.formInline;
|
||||||
const exportData = async (formData) => {
|
const exportData = async formData => {
|
||||||
const { data, code } = await queryGiftRankList({
|
const { data, code } = await queryGiftRankList({
|
||||||
...formData,
|
...formData,
|
||||||
page: 1,
|
page: 1,
|
||||||
@@ -130,28 +141,33 @@ export function useData() {
|
|||||||
const workSheet = utils.aoa_to_sheet(res);
|
const workSheet = utils.aoa_to_sheet(res);
|
||||||
const workBook = utils.book_new();
|
const workBook = utils.book_new();
|
||||||
utils.book_append_sheet(workBook, workSheet, "数据报表");
|
utils.book_append_sheet(workBook, workSheet, "数据报表");
|
||||||
writeFile(workBook, `送礼排行统计${formData.begin_time} - ${formData.end_time}.xlsx`);
|
writeFile(
|
||||||
|
workBook,
|
||||||
|
`送礼排行统计${formData.begin_time} - ${formData.end_time}.xlsx`
|
||||||
|
);
|
||||||
message("导出成功", {
|
message("导出成功", {
|
||||||
type: "success"
|
type: "success"
|
||||||
});
|
});
|
||||||
done()
|
done();
|
||||||
} else {
|
} else {
|
||||||
message("获取数据失败,请重试!", {
|
message("获取数据失败,请重试!", {
|
||||||
type: "error"
|
type: "error"
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
};
|
||||||
FormRef.validate(valid => {
|
FormRef.validate(valid => {
|
||||||
if (valid) {
|
if (valid) {
|
||||||
if (curData.time && curData.time.length) {
|
if (curData.time && curData.time.length) {
|
||||||
exportData({ begin_time: curData.time[0] || '', end_time: curData.time[1] || '' })
|
exportData({
|
||||||
|
begin_time: curData.time[0] || "",
|
||||||
|
end_time: curData.time[1] || ""
|
||||||
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
};
|
||||||
}
|
|
||||||
|
|
||||||
return {
|
return {
|
||||||
searchForm,
|
searchForm,
|
||||||
|
|||||||
@@ -1,11 +1,11 @@
|
|||||||
import { ref, h } from "vue";
|
import { ref, h } from "vue";
|
||||||
import {
|
import { queryGiftGiveList } from "@/api/modules/statistics";
|
||||||
queryGiftGiveList
|
|
||||||
} from "@/api/modules/statistics";
|
|
||||||
import { utils, writeFile } from "xlsx";
|
import { utils, writeFile } from "xlsx";
|
||||||
import ExportForm from '@/components/exportDialog/index.vue';
|
import ExportForm from "@/components/exportDialog/index.vue";
|
||||||
import { addDialog } from "@/components/ReDialog";
|
import { addDialog } from "@/components/ReDialog";
|
||||||
import { message } from "@/utils/message";
|
import { message } from "@/utils/message";
|
||||||
|
import dayjs from "dayjs";
|
||||||
|
|
||||||
export function useData() {
|
export function useData() {
|
||||||
const loading = ref(true);
|
const loading = ref(true);
|
||||||
const tableList = ref([]);
|
const tableList = ref([]);
|
||||||
@@ -17,17 +17,28 @@ export function useData() {
|
|||||||
currentPage: 1,
|
currentPage: 1,
|
||||||
background: true
|
background: true
|
||||||
});
|
});
|
||||||
const statisticsList = ref()
|
const statisticsList = ref();
|
||||||
|
|
||||||
|
const totalData = ref(null);
|
||||||
|
|
||||||
|
// 获取当月第一天 00:00:00 和当前时间
|
||||||
|
const getDefaultTimeRange = () => {
|
||||||
|
const now = dayjs();
|
||||||
|
const startOfMonth = now.startOf("month").format("YYYY-MM-DD HH:mm:ss");
|
||||||
|
const currentTime = now.format("YYYY-MM-DD HH:mm:ss");
|
||||||
|
return { start_time: startOfMonth, end_time: currentTime };
|
||||||
|
};
|
||||||
|
|
||||||
|
const defaultTime = getDefaultTimeRange();
|
||||||
|
|
||||||
const totalData = ref(null)
|
|
||||||
const searchForm = ref({
|
const searchForm = ref({
|
||||||
send_user: "",
|
send_user: "",
|
||||||
gift_user: "",
|
gift_user: "",
|
||||||
from_id: "",
|
from_id: "",
|
||||||
gift_id: "",
|
gift_id: "",
|
||||||
from: "",
|
from: "",
|
||||||
start_time: "",
|
start_time: defaultTime.start_time,
|
||||||
end_time: ""
|
end_time: defaultTime.end_time
|
||||||
});
|
});
|
||||||
const searchLabel = ref([
|
const searchLabel = ref([
|
||||||
{ label: "送礼用户ID", prop: "send_user", type: "input" },
|
{ label: "送礼用户ID", prop: "send_user", type: "input" },
|
||||||
@@ -35,7 +46,9 @@ export function useData() {
|
|||||||
{ label: "房间ID", prop: "from_id", type: "input" },
|
{ label: "房间ID", prop: "from_id", type: "input" },
|
||||||
{ label: "礼物ID", prop: "gift_id", type: "input" },
|
{ label: "礼物ID", prop: "gift_id", type: "input" },
|
||||||
{
|
{
|
||||||
label: "来源", prop: "from", type: "select",
|
label: "来源",
|
||||||
|
prop: "from",
|
||||||
|
type: "select",
|
||||||
optionList: [
|
optionList: [
|
||||||
{ label: "聊天送礼物", value: 1 },
|
{ label: "聊天送礼物", value: 1 },
|
||||||
{ label: "房间语聊送礼", value: 2 },
|
{ label: "房间语聊送礼", value: 2 },
|
||||||
@@ -44,9 +57,9 @@ export function useData() {
|
|||||||
]
|
]
|
||||||
},
|
},
|
||||||
{ label: "开始时间", prop: "start_time", type: "date" },
|
{ label: "开始时间", prop: "start_time", type: "date" },
|
||||||
{ label: "结束时间", prop: "end_time", type: "date" },
|
{ label: "结束时间", prop: "end_time", type: "date" }
|
||||||
]);
|
]);
|
||||||
const tableLabel = ref([])
|
const tableLabel = ref([]);
|
||||||
const tableLabelS = ref([
|
const tableLabelS = ref([
|
||||||
{
|
{
|
||||||
label: "送礼人ID-昵称",
|
label: "送礼人ID-昵称",
|
||||||
@@ -80,22 +93,23 @@ export function useData() {
|
|||||||
label: "来源",
|
label: "来源",
|
||||||
prop: "type",
|
prop: "type",
|
||||||
cellRenderer: ({ row }) => (
|
cellRenderer: ({ row }) => (
|
||||||
<el-tag type={row.type === 1 ? 'success' : ''}>{row.type === 1 ? '金币购买' : '背包礼物'}</el-tag>
|
<el-tag type={row.type === 1 ? "success" : ""}>
|
||||||
),
|
{row.type === 1 ? "金币购买" : "背包礼物"}
|
||||||
|
</el-tag>
|
||||||
|
)
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
label: "生成时间",
|
label: "生成时间",
|
||||||
prop: "createtime"
|
prop: "createtime"
|
||||||
}
|
}
|
||||||
]);
|
]);
|
||||||
const onSearch = async (formData) => {
|
const onSearch = async formData => {
|
||||||
loading.value = true;
|
loading.value = true;
|
||||||
searchForm.value = { ...formData }
|
searchForm.value = { ...formData };
|
||||||
const { data, code } = await queryGiftGiveList({
|
const { data, code } = await queryGiftGiveList({
|
||||||
...formData,
|
...formData,
|
||||||
page: pagination.value.currentPage,
|
page: pagination.value.currentPage,
|
||||||
page_limit: pagination.value.pageSize,
|
page_limit: pagination.value.pageSize
|
||||||
|
|
||||||
});
|
});
|
||||||
if (code) {
|
if (code) {
|
||||||
const objLabel = [
|
const objLabel = [
|
||||||
@@ -111,7 +125,7 @@ export function useData() {
|
|||||||
label: `房主收益(${data.total.room_owner_earning_ratio}%)钻石`,
|
label: `房主收益(${data.total.room_owner_earning_ratio}%)钻石`,
|
||||||
prop: "room_owner_earning"
|
prop: "room_owner_earning"
|
||||||
}
|
}
|
||||||
]
|
];
|
||||||
const objStatistics = [
|
const objStatistics = [
|
||||||
{
|
{
|
||||||
label: `平台收益(${data.total.app_earning_ratio}%)钻石`,
|
label: `平台收益(${data.total.app_earning_ratio}%)钻石`,
|
||||||
@@ -125,24 +139,26 @@ export function useData() {
|
|||||||
label: `房主收益(${data.total.room_owner_earning_ratio}%)钻石`,
|
label: `房主收益(${data.total.room_owner_earning_ratio}%)钻石`,
|
||||||
prop: "room_owner_earning"
|
prop: "room_owner_earning"
|
||||||
}
|
}
|
||||||
]
|
];
|
||||||
statisticsList.value = [...[
|
statisticsList.value = [
|
||||||
{ label: "礼物总数量", prop: "gift_num" },
|
...[
|
||||||
{ label: "礼物总价", prop: "total_price" }
|
{ label: "礼物总数量", prop: "gift_num" },
|
||||||
], ...objStatistics]
|
{ label: "礼物总价", prop: "total_price" }
|
||||||
tableLabel.value = [...tableLabelS.value]
|
],
|
||||||
tableLabel.value.splice(7, 0, ...objLabel)
|
...objStatistics
|
||||||
console.log(tableLabel.value)
|
];
|
||||||
|
tableLabel.value = [...tableLabelS.value];
|
||||||
|
tableLabel.value.splice(7, 0, ...objLabel);
|
||||||
|
console.log(tableLabel.value);
|
||||||
tableList.value = data.lists.map(ele => {
|
tableList.value = data.lists.map(ele => {
|
||||||
return {
|
return {
|
||||||
...ele,
|
...ele,
|
||||||
app_earning: parseFloat(ele.app_earning),
|
app_earning: parseFloat(ele.app_earning),
|
||||||
room_owner_earning: parseFloat(ele.room_owner_earning),
|
room_owner_earning: parseFloat(ele.room_owner_earning),
|
||||||
gift_user_earning: parseFloat(ele.gift_user_earning),
|
gift_user_earning: parseFloat(ele.gift_user_earning)
|
||||||
}
|
};
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
totalData.value = data.total;
|
totalData.value = data.total;
|
||||||
pagination.value.total = data.count;
|
pagination.value.total = data.count;
|
||||||
pagination.value.currentPage = parseFloat(data.page);
|
pagination.value.currentPage = parseFloat(data.page);
|
||||||
@@ -158,23 +174,24 @@ export function useData() {
|
|||||||
// console.log(searchForm.value, 'yzy')
|
// console.log(searchForm.value, 'yzy')
|
||||||
onSearch(searchForm.value);
|
onSearch(searchForm.value);
|
||||||
};
|
};
|
||||||
const exportFormRef = ref(null)
|
const exportFormRef = ref(null);
|
||||||
const exportExcel = () => {
|
const exportExcel = () => {
|
||||||
let exportTableList = []
|
let exportTableList = [];
|
||||||
addDialog({
|
addDialog({
|
||||||
title: `导出数据`,
|
title: `导出数据`,
|
||||||
props: {
|
props: {
|
||||||
formInline: {
|
formInline: {
|
||||||
time: ''
|
time: ""
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
width: "40%",
|
width: "40%",
|
||||||
closeOnClickModal: false,
|
closeOnClickModal: false,
|
||||||
contentRenderer: () => h(ExportForm, { ref: exportFormRef, formInline: null }),
|
contentRenderer: () =>
|
||||||
|
h(ExportForm, { ref: exportFormRef, formInline: null }),
|
||||||
beforeSure: (done, { options }) => {
|
beforeSure: (done, { options }) => {
|
||||||
const FormRef = exportFormRef.value.getRef();
|
const FormRef = exportFormRef.value.getRef();
|
||||||
const curData = options.props.formInline;
|
const curData = options.props.formInline;
|
||||||
const exportData = async (formData) => {
|
const exportData = async formData => {
|
||||||
const { data, code } = await queryGiftGiveList({
|
const { data, code } = await queryGiftGiveList({
|
||||||
...formData,
|
...formData,
|
||||||
send_user: searchForm.value.send_user,
|
send_user: searchForm.value.send_user,
|
||||||
@@ -202,28 +219,34 @@ export function useData() {
|
|||||||
const workSheet = utils.aoa_to_sheet(res);
|
const workSheet = utils.aoa_to_sheet(res);
|
||||||
const workBook = utils.book_new();
|
const workBook = utils.book_new();
|
||||||
utils.book_append_sheet(workBook, workSheet, "数据报表");
|
utils.book_append_sheet(workBook, workSheet, "数据报表");
|
||||||
writeFile(workBook, `礼物记录列表统计${formData.start_time} - ${formData.end_time}.xlsx`);
|
writeFile(
|
||||||
|
workBook,
|
||||||
|
`礼物记录列表统计${formData.start_time} - ${formData.end_time}.xlsx`
|
||||||
|
);
|
||||||
message("导出成功", {
|
message("导出成功", {
|
||||||
type: "success"
|
type: "success"
|
||||||
});
|
});
|
||||||
done()
|
done();
|
||||||
} else {
|
} else {
|
||||||
message("获取数据失败,请重试!", {
|
message("获取数据失败,请重试!", {
|
||||||
type: "error"
|
type: "error"
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
};
|
||||||
FormRef.validate(valid => {
|
FormRef.validate(valid => {
|
||||||
if (valid) {
|
if (valid) {
|
||||||
if (curData.time && curData.time.length) {
|
if (curData.time && curData.time.length) {
|
||||||
exportData({ start_time: curData.time[0] || '', end_time: curData.time[1] || '' })
|
exportData({
|
||||||
|
start_time: curData.time[0] || "",
|
||||||
|
end_time: curData.time[1] || ""
|
||||||
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
};
|
||||||
|
|
||||||
}
|
|
||||||
return {
|
return {
|
||||||
searchForm,
|
searchForm,
|
||||||
searchLabel,
|
searchLabel,
|
||||||
|
|||||||
@@ -1,12 +1,12 @@
|
|||||||
import { ref, h } from "vue";
|
import { ref, h } from "vue";
|
||||||
import {
|
import { getLuckyRank } from "@/api/modules/statistics";
|
||||||
getLuckyRank
|
|
||||||
} from "@/api/modules/statistics";
|
|
||||||
import { utils, writeFile } from "xlsx";
|
import { utils, writeFile } from "xlsx";
|
||||||
import ExportForm from '@/components/exportDialog/index.vue';
|
import ExportForm from "@/components/exportDialog/index.vue";
|
||||||
import { addDialog } from "@/components/ReDialog";
|
import { addDialog } from "@/components/ReDialog";
|
||||||
import { message } from "@/utils/message";
|
import { message } from "@/utils/message";
|
||||||
import detailView from './form.vue';
|
import detailView from "./form.vue";
|
||||||
|
import dayjs from "dayjs";
|
||||||
|
|
||||||
export function useData() {
|
export function useData() {
|
||||||
const loading = ref(true);
|
const loading = ref(true);
|
||||||
const tableList = ref([]);
|
const tableList = ref([]);
|
||||||
@@ -18,13 +18,24 @@ export function useData() {
|
|||||||
currentPage: 1,
|
currentPage: 1,
|
||||||
background: true
|
background: true
|
||||||
});
|
});
|
||||||
|
|
||||||
|
// 获取当月第一天 00:00:00 和当前时间
|
||||||
|
const getDefaultTimeRange = () => {
|
||||||
|
const now = dayjs();
|
||||||
|
const startOfMonth = now.startOf("month").format("YYYY-MM-DD HH:mm:ss");
|
||||||
|
const currentTime = now.format("YYYY-MM-DD HH:mm:ss");
|
||||||
|
return { stime: startOfMonth, etime: currentTime };
|
||||||
|
};
|
||||||
|
|
||||||
|
const defaultTime = getDefaultTimeRange();
|
||||||
|
|
||||||
const searchForm = ref({
|
const searchForm = ref({
|
||||||
stime: "",
|
stime: defaultTime.stime,
|
||||||
etime: ""
|
etime: defaultTime.etime
|
||||||
});
|
});
|
||||||
const searchLabel = ref([
|
const searchLabel = ref([
|
||||||
{ label: "开始时间", prop: "stime", type: "date" },
|
{ label: "开始时间", prop: "stime", type: "date" },
|
||||||
{ label: "结束时间", prop: "etime", type: "date" },
|
{ label: "结束时间", prop: "etime", type: "date" }
|
||||||
]);
|
]);
|
||||||
const tableLabel = ref([
|
const tableLabel = ref([
|
||||||
{
|
{
|
||||||
@@ -56,14 +67,13 @@ export function useData() {
|
|||||||
prop: "createtime"
|
prop: "createtime"
|
||||||
}
|
}
|
||||||
]);
|
]);
|
||||||
const onSearch = async (formData) => {
|
const onSearch = async formData => {
|
||||||
loading.value = true;
|
loading.value = true;
|
||||||
searchForm.value = { ...formData }
|
searchForm.value = { ...formData };
|
||||||
const { data, code } = await getLuckyRank({
|
const { data, code } = await getLuckyRank({
|
||||||
...formData,
|
...formData,
|
||||||
page: pagination.value.currentPage,
|
page: pagination.value.currentPage,
|
||||||
page_limit: pagination.value.pageSize,
|
page_limit: pagination.value.pageSize
|
||||||
|
|
||||||
});
|
});
|
||||||
if (code) {
|
if (code) {
|
||||||
tableList.value = data.lists.map(ele => {
|
tableList.value = data.lists.map(ele => {
|
||||||
@@ -71,9 +81,9 @@ export function useData() {
|
|||||||
...ele,
|
...ele,
|
||||||
pool_amount: parseFloat(ele.pool_amount),
|
pool_amount: parseFloat(ele.pool_amount),
|
||||||
prize_amount: parseFloat(ele.prize_amount)
|
prize_amount: parseFloat(ele.prize_amount)
|
||||||
}
|
};
|
||||||
});
|
});
|
||||||
pagination.value.total = data.count
|
pagination.value.total = data.count;
|
||||||
pagination.value.currentPage = parseFloat(data.page);
|
pagination.value.currentPage = parseFloat(data.page);
|
||||||
}
|
}
|
||||||
loading.value = false;
|
loading.value = false;
|
||||||
@@ -87,23 +97,24 @@ export function useData() {
|
|||||||
// console.log(searchForm.value, 'yzy')
|
// console.log(searchForm.value, 'yzy')
|
||||||
onSearch(searchForm.value);
|
onSearch(searchForm.value);
|
||||||
};
|
};
|
||||||
const exportFormRef = ref(null)
|
const exportFormRef = ref(null);
|
||||||
const exportExcel = () => {
|
const exportExcel = () => {
|
||||||
let exportTableList = []
|
let exportTableList = [];
|
||||||
addDialog({
|
addDialog({
|
||||||
title: `导出数据`,
|
title: `导出数据`,
|
||||||
props: {
|
props: {
|
||||||
formInline: {
|
formInline: {
|
||||||
time: ''
|
time: ""
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
width: "40%",
|
width: "40%",
|
||||||
closeOnClickModal: false,
|
closeOnClickModal: false,
|
||||||
contentRenderer: () => h(ExportForm, { ref: exportFormRef, formInline: null }),
|
contentRenderer: () =>
|
||||||
|
h(ExportForm, { ref: exportFormRef, formInline: null }),
|
||||||
beforeSure: (done, { options }) => {
|
beforeSure: (done, { options }) => {
|
||||||
const FormRef = exportFormRef.value.getRef();
|
const FormRef = exportFormRef.value.getRef();
|
||||||
const curData = options.props.formInline;
|
const curData = options.props.formInline;
|
||||||
const exportData = async (formData) => {
|
const exportData = async formData => {
|
||||||
const { data, code } = await getLuckyRank({
|
const { data, code } = await getLuckyRank({
|
||||||
...formData,
|
...formData,
|
||||||
page: 1,
|
page: 1,
|
||||||
@@ -126,28 +137,33 @@ export function useData() {
|
|||||||
const workSheet = utils.aoa_to_sheet(res);
|
const workSheet = utils.aoa_to_sheet(res);
|
||||||
const workBook = utils.book_new();
|
const workBook = utils.book_new();
|
||||||
utils.book_append_sheet(workBook, workSheet, "数据报表");
|
utils.book_append_sheet(workBook, workSheet, "数据报表");
|
||||||
writeFile(workBook, `幸运币中奖记录列表统计${formData.start_time} - ${formData.end_time}.xlsx`);
|
writeFile(
|
||||||
|
workBook,
|
||||||
|
`幸运币中奖记录列表统计${formData.start_time} - ${formData.end_time}.xlsx`
|
||||||
|
);
|
||||||
message("导出成功", {
|
message("导出成功", {
|
||||||
type: "success"
|
type: "success"
|
||||||
});
|
});
|
||||||
done()
|
done();
|
||||||
} else {
|
} else {
|
||||||
message("获取数据失败,请重试!", {
|
message("获取数据失败,请重试!", {
|
||||||
type: "error"
|
type: "error"
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
};
|
||||||
FormRef.validate(valid => {
|
FormRef.validate(valid => {
|
||||||
if (valid) {
|
if (valid) {
|
||||||
if (curData.time && curData.time.length) {
|
if (curData.time && curData.time.length) {
|
||||||
exportData({ start_time: curData.time[0] || '', end_time: curData.time[1] || '' })
|
exportData({
|
||||||
|
start_time: curData.time[0] || "",
|
||||||
|
end_time: curData.time[1] || ""
|
||||||
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
};
|
||||||
}
|
|
||||||
// 实时状态查询
|
// 实时状态查询
|
||||||
const openDiglog = () => {
|
const openDiglog = () => {
|
||||||
addDialog({
|
addDialog({
|
||||||
@@ -157,7 +173,7 @@ export function useData() {
|
|||||||
closeOnClickModal: false,
|
closeOnClickModal: false,
|
||||||
contentRenderer: () => h(detailView)
|
contentRenderer: () => h(detailView)
|
||||||
});
|
});
|
||||||
}
|
};
|
||||||
return {
|
return {
|
||||||
searchForm,
|
searchForm,
|
||||||
searchLabel,
|
searchLabel,
|
||||||
|
|||||||
@@ -1,11 +1,11 @@
|
|||||||
import { ref, h } from "vue";
|
import { ref, h } from "vue";
|
||||||
import {
|
import { queryRechargeRankList } from "@/api/modules/statistics";
|
||||||
queryRechargeRankList
|
|
||||||
} from "@/api/modules/statistics";
|
|
||||||
import { utils, writeFile } from "xlsx";
|
import { utils, writeFile } from "xlsx";
|
||||||
import { message } from "@/utils/message";
|
import { message } from "@/utils/message";
|
||||||
import ExportForm from '@/components/exportDialog/index.vue';
|
import ExportForm from "@/components/exportDialog/index.vue";
|
||||||
import { addDialog } from "@/components/ReDialog";
|
import { addDialog } from "@/components/ReDialog";
|
||||||
|
import dayjs from "dayjs";
|
||||||
|
|
||||||
export function useData() {
|
export function useData() {
|
||||||
const loading = ref(true);
|
const loading = ref(true);
|
||||||
const tableList = ref([]);
|
const tableList = ref([]);
|
||||||
@@ -17,18 +17,29 @@ export function useData() {
|
|||||||
currentPage: 1,
|
currentPage: 1,
|
||||||
background: true
|
background: true
|
||||||
});
|
});
|
||||||
const total_price = ref(0)
|
const total_price = ref(0);
|
||||||
|
|
||||||
|
// 获取当月第一天 00:00:00 和当前时间
|
||||||
|
const getDefaultTimeRange = () => {
|
||||||
|
const now = dayjs();
|
||||||
|
const startOfMonth = now.startOf("month").format("YYYY-MM-DD HH:mm:ss");
|
||||||
|
const currentTime = now.format("YYYY-MM-DD HH:mm:ss");
|
||||||
|
return { begin_time: startOfMonth, end_time: currentTime };
|
||||||
|
};
|
||||||
|
|
||||||
|
const defaultTime = getDefaultTimeRange();
|
||||||
|
|
||||||
const searchForm = ref({
|
const searchForm = ref({
|
||||||
search_uid: "",
|
search_uid: "",
|
||||||
begin_time: "",
|
begin_time: defaultTime.begin_time,
|
||||||
username: "",
|
username: "",
|
||||||
end_time: ""
|
end_time: defaultTime.end_time
|
||||||
});
|
});
|
||||||
const searchLabel = ref([
|
const searchLabel = ref([
|
||||||
{ label: "用户ID", prop: "search_uid", type: "input" },
|
{ label: "用户ID", prop: "search_uid", type: "input" },
|
||||||
{ label: "用户昵称", prop: "username", type: "input" },
|
{ label: "用户昵称", prop: "username", type: "input" },
|
||||||
{ label: "开始时间", prop: "begin_time", type: "date" },
|
{ label: "开始时间", prop: "begin_time", type: "date" },
|
||||||
{ label: "结束时间", prop: "end_time", type: "date" },
|
{ label: "结束时间", prop: "end_time", type: "date" }
|
||||||
]);
|
]);
|
||||||
const tableLabel = ref([
|
const tableLabel = ref([
|
||||||
// {
|
// {
|
||||||
@@ -59,26 +70,26 @@ export function useData() {
|
|||||||
{
|
{
|
||||||
label: "总获取金币",
|
label: "总获取金币",
|
||||||
prop: "coin"
|
prop: "coin"
|
||||||
},
|
}
|
||||||
// {
|
// {
|
||||||
// label: "充值时间",
|
// label: "充值时间",
|
||||||
// prop: "createtime"
|
// prop: "createtime"
|
||||||
// }
|
// }
|
||||||
]);
|
]);
|
||||||
const onSearch = async (formData) => {
|
const onSearch = async formData => {
|
||||||
loading.value = true;
|
loading.value = true;
|
||||||
searchForm.value = { ...formData }
|
searchForm.value = { ...formData };
|
||||||
const { data, code } = await queryRechargeRankList({
|
const { data, code } = await queryRechargeRankList({
|
||||||
...formData,
|
...formData,
|
||||||
page: pagination.value.currentPage,
|
page: pagination.value.currentPage,
|
||||||
page_limit: pagination.value.pageSize,
|
page_limit: pagination.value.pageSize
|
||||||
|
|
||||||
});
|
});
|
||||||
if (code) {
|
if (code) {
|
||||||
tableList.value = data.lists.map(ele => {
|
tableList.value = data.lists.map(ele => {
|
||||||
return {
|
return {
|
||||||
...ele, ...data.total
|
...ele,
|
||||||
}
|
...data.total
|
||||||
|
};
|
||||||
});
|
});
|
||||||
total_price.value = data.total.total_price || 0;
|
total_price.value = data.total.total_price || 0;
|
||||||
pagination.value.total = data.count;
|
pagination.value.total = data.count;
|
||||||
@@ -94,23 +105,24 @@ export function useData() {
|
|||||||
pagination.value.currentPage = val;
|
pagination.value.currentPage = val;
|
||||||
onSearch(searchForm.value);
|
onSearch(searchForm.value);
|
||||||
};
|
};
|
||||||
const exportFormRef = ref(null)
|
const exportFormRef = ref(null);
|
||||||
const exportExcel = () => {
|
const exportExcel = () => {
|
||||||
let exportTableList = []
|
let exportTableList = [];
|
||||||
addDialog({
|
addDialog({
|
||||||
title: `导出数据`,
|
title: `导出数据`,
|
||||||
props: {
|
props: {
|
||||||
formInline: {
|
formInline: {
|
||||||
time: ''
|
time: ""
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
width: "40%",
|
width: "40%",
|
||||||
closeOnClickModal: false,
|
closeOnClickModal: false,
|
||||||
contentRenderer: () => h(ExportForm, { ref: exportFormRef, formInline: null }),
|
contentRenderer: () =>
|
||||||
|
h(ExportForm, { ref: exportFormRef, formInline: null }),
|
||||||
beforeSure: (done, { options }) => {
|
beforeSure: (done, { options }) => {
|
||||||
const FormRef = exportFormRef.value.getRef();
|
const FormRef = exportFormRef.value.getRef();
|
||||||
const curData = options.props.formInline;
|
const curData = options.props.formInline;
|
||||||
const exportData = async (formData) => {
|
const exportData = async formData => {
|
||||||
const { data, code } = await queryRechargeRankList({
|
const { data, code } = await queryRechargeRankList({
|
||||||
...formData,
|
...formData,
|
||||||
page: 1,
|
page: 1,
|
||||||
@@ -133,28 +145,33 @@ export function useData() {
|
|||||||
const workSheet = utils.aoa_to_sheet(res);
|
const workSheet = utils.aoa_to_sheet(res);
|
||||||
const workBook = utils.book_new();
|
const workBook = utils.book_new();
|
||||||
utils.book_append_sheet(workBook, workSheet, "数据报表");
|
utils.book_append_sheet(workBook, workSheet, "数据报表");
|
||||||
writeFile(workBook, `充值排行统计${formData.begin_time} - ${formData.end_time}.xlsx`);
|
writeFile(
|
||||||
|
workBook,
|
||||||
|
`充值排行统计${formData.begin_time} - ${formData.end_time}.xlsx`
|
||||||
|
);
|
||||||
message("导出成功", {
|
message("导出成功", {
|
||||||
type: "success"
|
type: "success"
|
||||||
});
|
});
|
||||||
done()
|
done();
|
||||||
} else {
|
} else {
|
||||||
message("获取数据失败,请重试!", {
|
message("获取数据失败,请重试!", {
|
||||||
type: "error"
|
type: "error"
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
};
|
||||||
FormRef.validate(valid => {
|
FormRef.validate(valid => {
|
||||||
if (valid) {
|
if (valid) {
|
||||||
if (curData.time && curData.time.length) {
|
if (curData.time && curData.time.length) {
|
||||||
exportData({ begin_time: curData.time[0] || '', end_time: curData.time[1] || '' })
|
exportData({
|
||||||
|
begin_time: curData.time[0] || "",
|
||||||
|
end_time: curData.time[1] || ""
|
||||||
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
};
|
||||||
}
|
|
||||||
return {
|
return {
|
||||||
searchForm,
|
searchForm,
|
||||||
searchLabel,
|
searchLabel,
|
||||||
|
|||||||
@@ -1,16 +1,16 @@
|
|||||||
import { ref, h } from "vue";
|
import { ref, h } from "vue";
|
||||||
import { utils, writeFile } from "xlsx";
|
import { utils, writeFile } from "xlsx";
|
||||||
import ExportForm from '@/components/exportDialog/index.vue';
|
import ExportForm from "@/components/exportDialog/index.vue";
|
||||||
import { addDialog } from "@/components/ReDialog";
|
import { addDialog } from "@/components/ReDialog";
|
||||||
import { message } from "@/utils/message";
|
import { message } from "@/utils/message";
|
||||||
import {
|
import { queryRoomFlowRankList } from "@/api/modules/statistics";
|
||||||
queryRoomFlowRankList
|
import dayjs from "dayjs";
|
||||||
} from "@/api/modules/statistics";
|
|
||||||
export function useData() {
|
export function useData() {
|
||||||
const loading = ref(true);
|
const loading = ref(true);
|
||||||
const tableList = ref([]);
|
const tableList = ref([]);
|
||||||
const isShow = ref(false);
|
const isShow = ref(false);
|
||||||
const total_price = ref(0)
|
const total_price = ref(0);
|
||||||
const pagination = ref({
|
const pagination = ref({
|
||||||
total: 0,
|
total: 0,
|
||||||
pageSize: 10,
|
pageSize: 10,
|
||||||
@@ -18,17 +18,28 @@ export function useData() {
|
|||||||
currentPage: 1,
|
currentPage: 1,
|
||||||
background: true
|
background: true
|
||||||
});
|
});
|
||||||
|
|
||||||
|
// 获取当月第一天 00:00:00 和当前时间
|
||||||
|
const getDefaultTimeRange = () => {
|
||||||
|
const now = dayjs();
|
||||||
|
const startOfMonth = now.startOf("month").format("YYYY-MM-DD HH:mm:ss");
|
||||||
|
const currentTime = now.format("YYYY-MM-DD HH:mm:ss");
|
||||||
|
return { begin_time: startOfMonth, end_time: currentTime };
|
||||||
|
};
|
||||||
|
|
||||||
|
const defaultTime = getDefaultTimeRange();
|
||||||
|
|
||||||
const searchForm = ref({
|
const searchForm = ref({
|
||||||
search_room_id: "",
|
search_room_id: "",
|
||||||
begin_time: "",
|
begin_time: defaultTime.begin_time,
|
||||||
room_name: '',
|
room_name: "",
|
||||||
end_time: ""
|
end_time: defaultTime.end_time
|
||||||
});
|
});
|
||||||
const searchLabel = ref([
|
const searchLabel = ref([
|
||||||
{ label: "房间ID", prop: "search_room_id", type: "input" },
|
{ label: "房间ID", prop: "search_room_id", type: "input" },
|
||||||
{ label: "房间名称", prop: "room_name", type: "input" },
|
{ label: "房间名称", prop: "room_name", type: "input" },
|
||||||
{ label: "开始时间", prop: "begin_time", type: "date" },
|
{ label: "开始时间", prop: "begin_time", type: "date" },
|
||||||
{ label: "结束时间", prop: "end_time", type: "date" },
|
{ label: "结束时间", prop: "end_time", type: "date" }
|
||||||
]);
|
]);
|
||||||
const tableLabel = ref([
|
const tableLabel = ref([
|
||||||
// {
|
// {
|
||||||
@@ -54,7 +65,7 @@ export function useData() {
|
|||||||
preview-src-list={Array.of(row.room_cover)}
|
preview-src-list={Array.of(row.room_cover)}
|
||||||
class="w-[35px] h-[35px] align-middle"
|
class="w-[35px] h-[35px] align-middle"
|
||||||
/>
|
/>
|
||||||
),
|
)
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
label: "幸运值流水",
|
label: "幸运值流水",
|
||||||
@@ -63,28 +74,27 @@ export function useData() {
|
|||||||
{
|
{
|
||||||
label: "房间流水",
|
label: "房间流水",
|
||||||
prop: "total_price"
|
prop: "total_price"
|
||||||
},
|
}
|
||||||
// {
|
// {
|
||||||
// label: "生成时间",
|
// label: "生成时间",
|
||||||
// prop: "createtime"
|
// prop: "createtime"
|
||||||
// }
|
// }
|
||||||
]);
|
]);
|
||||||
const onSearch = async (formData) => {
|
const onSearch = async formData => {
|
||||||
loading.value = true;
|
loading.value = true;
|
||||||
searchForm.value = { ...formData }
|
searchForm.value = { ...formData };
|
||||||
const { data, code } = await queryRoomFlowRankList({
|
const { data, code } = await queryRoomFlowRankList({
|
||||||
...formData,
|
...formData,
|
||||||
page: pagination.value.currentPage,
|
page: pagination.value.currentPage,
|
||||||
page_limit: pagination.value.pageSize,
|
page_limit: pagination.value.pageSize
|
||||||
|
|
||||||
});
|
});
|
||||||
if (code) {
|
if (code) {
|
||||||
tableList.value = data.lists.map(ele => {
|
tableList.value = data.lists.map(ele => {
|
||||||
return {
|
return {
|
||||||
...ele
|
...ele
|
||||||
}
|
};
|
||||||
});
|
});
|
||||||
total_price.value = data.total
|
total_price.value = data.total;
|
||||||
pagination.value.total = data.count;
|
pagination.value.total = data.count;
|
||||||
pagination.value.currentPage = data.page;
|
pagination.value.currentPage = data.page;
|
||||||
}
|
}
|
||||||
@@ -98,23 +108,24 @@ export function useData() {
|
|||||||
pagination.value.currentPage = val;
|
pagination.value.currentPage = val;
|
||||||
onSearch(searchForm.value);
|
onSearch(searchForm.value);
|
||||||
};
|
};
|
||||||
const exportFormRef = ref(null)
|
const exportFormRef = ref(null);
|
||||||
const exportExcel = () => {
|
const exportExcel = () => {
|
||||||
let exportTableList = []
|
let exportTableList = [];
|
||||||
addDialog({
|
addDialog({
|
||||||
title: `导出数据`,
|
title: `导出数据`,
|
||||||
props: {
|
props: {
|
||||||
formInline: {
|
formInline: {
|
||||||
time: ''
|
time: ""
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
width: "40%",
|
width: "40%",
|
||||||
closeOnClickModal: false,
|
closeOnClickModal: false,
|
||||||
contentRenderer: () => h(ExportForm, { ref: exportFormRef, formInline: null }),
|
contentRenderer: () =>
|
||||||
|
h(ExportForm, { ref: exportFormRef, formInline: null }),
|
||||||
beforeSure: (done, { options }) => {
|
beforeSure: (done, { options }) => {
|
||||||
const FormRef = exportFormRef.value.getRef();
|
const FormRef = exportFormRef.value.getRef();
|
||||||
const curData = options.props.formInline;
|
const curData = options.props.formInline;
|
||||||
const exportData = async (formData) => {
|
const exportData = async formData => {
|
||||||
const { data, code } = await queryRoomFlowRankList({
|
const { data, code } = await queryRoomFlowRankList({
|
||||||
...formData,
|
...formData,
|
||||||
page: 1,
|
page: 1,
|
||||||
@@ -137,28 +148,33 @@ export function useData() {
|
|||||||
const workSheet = utils.aoa_to_sheet(res);
|
const workSheet = utils.aoa_to_sheet(res);
|
||||||
const workBook = utils.book_new();
|
const workBook = utils.book_new();
|
||||||
utils.book_append_sheet(workBook, workSheet, "数据报表");
|
utils.book_append_sheet(workBook, workSheet, "数据报表");
|
||||||
writeFile(workBook, `房间流水统计${formData.begin_time} - ${formData.end_time}.xlsx`);
|
writeFile(
|
||||||
|
workBook,
|
||||||
|
`房间流水统计${formData.begin_time} - ${formData.end_time}.xlsx`
|
||||||
|
);
|
||||||
message("导出成功", {
|
message("导出成功", {
|
||||||
type: "success"
|
type: "success"
|
||||||
});
|
});
|
||||||
done()
|
done();
|
||||||
} else {
|
} else {
|
||||||
message("获取数据失败,请重试!", {
|
message("获取数据失败,请重试!", {
|
||||||
type: "error"
|
type: "error"
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
};
|
||||||
FormRef.validate(valid => {
|
FormRef.validate(valid => {
|
||||||
if (valid) {
|
if (valid) {
|
||||||
if (curData.time && curData.time.length) {
|
if (curData.time && curData.time.length) {
|
||||||
exportData({ begin_time: curData.time[0] || '', end_time: curData.time[1] || '' })
|
exportData({
|
||||||
|
begin_time: curData.time[0] || "",
|
||||||
|
end_time: curData.time[1] || ""
|
||||||
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
};
|
||||||
}
|
|
||||||
return {
|
return {
|
||||||
searchForm,
|
searchForm,
|
||||||
searchLabel,
|
searchLabel,
|
||||||
|
|||||||
@@ -1,17 +1,16 @@
|
|||||||
import { ref, h } from "vue";
|
import { ref, h } from "vue";
|
||||||
import { utils, writeFile } from "xlsx";
|
import { utils, writeFile } from "xlsx";
|
||||||
import ExportForm from '@/components/exportDialog/index.vue';
|
import ExportForm from "@/components/exportDialog/index.vue";
|
||||||
import { addDialog } from "@/components/ReDialog";
|
import { addDialog } from "@/components/ReDialog";
|
||||||
import { message } from "@/utils/message";
|
import { message } from "@/utils/message";
|
||||||
import {
|
import { taskRankList, taskRewardPriceData } from "@/api/modules/statistics";
|
||||||
taskRankList,
|
import dayjs from "dayjs";
|
||||||
taskRewardPriceData
|
|
||||||
} from "@/api/modules/statistics";
|
|
||||||
export function useData() {
|
export function useData() {
|
||||||
const loading = ref(true);
|
const loading = ref(true);
|
||||||
const tableList = ref([]);
|
const tableList = ref([]);
|
||||||
const isShow = ref(false);
|
const isShow = ref(false);
|
||||||
const total_price = ref(0)
|
const total_price = ref(0);
|
||||||
const pagination = ref({
|
const pagination = ref({
|
||||||
total: 0,
|
total: 0,
|
||||||
pageSize: 10,
|
pageSize: 10,
|
||||||
@@ -19,13 +18,24 @@ export function useData() {
|
|||||||
currentPage: 1,
|
currentPage: 1,
|
||||||
background: true
|
background: true
|
||||||
});
|
});
|
||||||
|
|
||||||
|
// 获取当月第一天 00:00:00 和当前时间
|
||||||
|
const getDefaultTimeRange = () => {
|
||||||
|
const now = dayjs();
|
||||||
|
const startOfMonth = now.startOf("month").format("YYYY-MM-DD HH:mm:ss");
|
||||||
|
const currentTime = now.format("YYYY-MM-DD HH:mm:ss");
|
||||||
|
return { begin_time: startOfMonth, end_time: currentTime };
|
||||||
|
};
|
||||||
|
|
||||||
|
const defaultTime = getDefaultTimeRange();
|
||||||
|
|
||||||
const searchForm = ref({
|
const searchForm = ref({
|
||||||
search_uid: "",
|
search_uid: "",
|
||||||
search_name: "",
|
search_name: "",
|
||||||
search_task_id: '',
|
search_task_id: "",
|
||||||
search_task_name: '',
|
search_task_name: "",
|
||||||
begin_time: "",
|
begin_time: defaultTime.begin_time,
|
||||||
end_time: ""
|
end_time: defaultTime.end_time
|
||||||
});
|
});
|
||||||
const searchLabel = ref([
|
const searchLabel = ref([
|
||||||
{ label: "用户ID", prop: "search_uid", type: "input" },
|
{ label: "用户ID", prop: "search_uid", type: "input" },
|
||||||
@@ -33,7 +43,7 @@ export function useData() {
|
|||||||
{ label: "任务ID", prop: "search_task_id", type: "input" },
|
{ label: "任务ID", prop: "search_task_id", type: "input" },
|
||||||
{ label: "任务昵称", prop: "search_task_name", type: "input" },
|
{ label: "任务昵称", prop: "search_task_name", type: "input" },
|
||||||
{ label: "开始时间", prop: "begin_time", type: "date" },
|
{ label: "开始时间", prop: "begin_time", type: "date" },
|
||||||
{ label: "结束时间", prop: "end_time", type: "date" },
|
{ label: "结束时间", prop: "end_time", type: "date" }
|
||||||
]);
|
]);
|
||||||
const tableLabel = ref([
|
const tableLabel = ref([
|
||||||
{
|
{
|
||||||
@@ -60,7 +70,9 @@ export function useData() {
|
|||||||
label: "领取状态",
|
label: "领取状态",
|
||||||
prop: "is_completed_str",
|
prop: "is_completed_str",
|
||||||
cellRenderer: ({ row }) => (
|
cellRenderer: ({ row }) => (
|
||||||
<el-tag type={row.is_completed == 0 ? 'error' : 'success'}>{row.is_completed == 0 ? '未领取' : '已领取'}</el-tag>
|
<el-tag type={row.is_completed == 0 ? "error" : "success"}>
|
||||||
|
{row.is_completed == 0 ? "未领取" : "已领取"}
|
||||||
|
</el-tag>
|
||||||
)
|
)
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@@ -72,28 +84,27 @@ export function useData() {
|
|||||||
prop: "reward_price"
|
prop: "reward_price"
|
||||||
}
|
}
|
||||||
]);
|
]);
|
||||||
const onSearch = async (formData) => {
|
const onSearch = async formData => {
|
||||||
loading.value = true;
|
loading.value = true;
|
||||||
searchForm.value = { ...formData }
|
searchForm.value = { ...formData };
|
||||||
const { data, code } = await taskRankList({
|
const { data, code } = await taskRankList({
|
||||||
...formData,
|
...formData,
|
||||||
page: pagination.value.currentPage,
|
page: pagination.value.currentPage,
|
||||||
page_limit: pagination.value.pageSize,
|
page_limit: pagination.value.pageSize
|
||||||
|
|
||||||
});
|
});
|
||||||
if (code) {
|
if (code) {
|
||||||
tableList.value = data.lists.map(ele => {
|
tableList.value = data.lists.map(ele => {
|
||||||
return {
|
return {
|
||||||
...ele
|
...ele
|
||||||
}
|
};
|
||||||
});
|
});
|
||||||
// total_price.value = data.total_reward_price
|
// total_price.value = data.total_reward_price
|
||||||
pagination.value.total = data.count;
|
pagination.value.total = data.count;
|
||||||
pagination.value.currentPage = data.page;
|
pagination.value.currentPage = data.page;
|
||||||
}
|
}
|
||||||
const res = await taskRewardPriceData({ ...formData })
|
const res = await taskRewardPriceData({ ...formData });
|
||||||
// console.log(res)
|
// console.log(res)
|
||||||
total_price.value = res.code ? res.data.total_reward_price : 0
|
total_price.value = res.code ? res.data.total_reward_price : 0;
|
||||||
loading.value = false;
|
loading.value = false;
|
||||||
};
|
};
|
||||||
const handleSizeChange = (val: number) => {
|
const handleSizeChange = (val: number) => {
|
||||||
@@ -104,23 +115,24 @@ export function useData() {
|
|||||||
pagination.value.currentPage = val;
|
pagination.value.currentPage = val;
|
||||||
onSearch(searchForm.value);
|
onSearch(searchForm.value);
|
||||||
};
|
};
|
||||||
const exportFormRef = ref(null)
|
const exportFormRef = ref(null);
|
||||||
const exportExcel = () => {
|
const exportExcel = () => {
|
||||||
let exportTableList = []
|
let exportTableList = [];
|
||||||
addDialog({
|
addDialog({
|
||||||
title: `导出数据`,
|
title: `导出数据`,
|
||||||
props: {
|
props: {
|
||||||
formInline: {
|
formInline: {
|
||||||
time: ''
|
time: ""
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
width: "40%",
|
width: "40%",
|
||||||
closeOnClickModal: false,
|
closeOnClickModal: false,
|
||||||
contentRenderer: () => h(ExportForm, { ref: exportFormRef, formInline: null }),
|
contentRenderer: () =>
|
||||||
|
h(ExportForm, { ref: exportFormRef, formInline: null }),
|
||||||
beforeSure: (done, { options }) => {
|
beforeSure: (done, { options }) => {
|
||||||
const FormRef = exportFormRef.value.getRef();
|
const FormRef = exportFormRef.value.getRef();
|
||||||
const curData = options.props.formInline;
|
const curData = options.props.formInline;
|
||||||
const exportData = async (formData) => {
|
const exportData = async formData => {
|
||||||
const { data, code } = await taskRankList({
|
const { data, code } = await taskRankList({
|
||||||
...formData,
|
...formData,
|
||||||
page: 1,
|
page: 1,
|
||||||
@@ -143,28 +155,33 @@ export function useData() {
|
|||||||
const workSheet = utils.aoa_to_sheet(res);
|
const workSheet = utils.aoa_to_sheet(res);
|
||||||
const workBook = utils.book_new();
|
const workBook = utils.book_new();
|
||||||
utils.book_append_sheet(workBook, workSheet, "数据报表");
|
utils.book_append_sheet(workBook, workSheet, "数据报表");
|
||||||
writeFile(workBook, `任务领取记录统计${formData.begin_time} - ${formData.end_time}.xlsx`);
|
writeFile(
|
||||||
|
workBook,
|
||||||
|
`任务领取记录统计${formData.begin_time} - ${formData.end_time}.xlsx`
|
||||||
|
);
|
||||||
message("导出成功", {
|
message("导出成功", {
|
||||||
type: "success"
|
type: "success"
|
||||||
});
|
});
|
||||||
done()
|
done();
|
||||||
} else {
|
} else {
|
||||||
message("获取数据失败,请重试!", {
|
message("获取数据失败,请重试!", {
|
||||||
type: "error"
|
type: "error"
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
};
|
||||||
FormRef.validate(valid => {
|
FormRef.validate(valid => {
|
||||||
if (valid) {
|
if (valid) {
|
||||||
if (curData.time && curData.time.length) {
|
if (curData.time && curData.time.length) {
|
||||||
exportData({ begin_time: curData.time[0] || '', end_time: curData.time[1] || '' })
|
exportData({
|
||||||
|
begin_time: curData.time[0] || "",
|
||||||
|
end_time: curData.time[1] || ""
|
||||||
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
};
|
||||||
}
|
|
||||||
return {
|
return {
|
||||||
searchForm,
|
searchForm,
|
||||||
searchLabel,
|
searchLabel,
|
||||||
|
|||||||
Reference in New Issue
Block a user