diff --git a/src/views/BlindBox/turntable/hook.tsx b/src/views/BlindBox/turntable/hook.tsx index 11714b2..380e575 100644 --- a/src/views/BlindBox/turntable/hook.tsx +++ b/src/views/BlindBox/turntable/hook.tsx @@ -48,6 +48,7 @@ export function useData() { const statisticsData = ref({}); const searchLabel = ref([ { label: "礼物ID", prop: "gift_id", type: "input" }, + { label: "房间ID", prop: "room_id", type: "input" }, { label: "礼物名称", prop: "gift_name", type: "input" } ]); const tableLabel = ref([ @@ -151,11 +152,11 @@ export function useData() { const { code, data } = await queryBoxTypeList({ activities_id: 5 }); typeList.value = code ? data.map(ele => { - return { - label: ele.name, - value: ele.id - }; - }) + return { + label: ele.name, + value: ele.id + }; + }) : []; if (code) handleClick(data[0].id); }; diff --git a/src/views/paradise/drawOrlockList/statistics.vue b/src/views/paradise/drawOrlockList/statistics.vue index 4066625..b61ac31 100644 --- a/src/views/paradise/drawOrlockList/statistics.vue +++ b/src/views/paradise/drawOrlockList/statistics.vue @@ -2,24 +2,36 @@ import { ref, onMounted, nextTick } from "vue"; import SearchForm from "@/components/SearchForm/index.vue"; import { message } from "@/utils/message"; -import { - resetBlindBoxRule -} from "@/api/modules/blindBox"; -import { - queryTurntableRecord -} from "@/api/modules/room"; +import { resetBlindBoxRule } from "@/api/modules/blindBox"; +import { queryTurntableRecord } from "@/api/modules/room"; const searchLabel = ref([ { label: "用户ID", prop: "user_id", type: "input" }, { label: "开奖期数", prop: "periods", type: "input" }, { label: "礼物ID", prop: "gift_id", type: "input" }, - { label: "房间ID", prop: "room_id", type: "input" } + { label: "房间ID", prop: "room_id", type: "input" }, + { label: "开始时间", prop: "stime", type: "date" }, + { label: "结束时间", prop: "etime", type: "date" } ]); const props = defineProps(["roomId"]); +// 获取当月第一天 00:00:00 +const getFirstDayOfMonth = () => { + const now = new Date(); + const firstDay = new Date(now.getFullYear(), now.getMonth(), 1); + return firstDay.toISOString().slice(0, 19).replace("T", " "); +}; + +// 获取当前日期时间 +const getCurrentDate = () => { + return new Date().toISOString().slice(0, 19).replace("T", " "); +}; + const searchForm = ref({ gift_bag_id: 13, - user_id: '', + user_id: "", gift_id: "", - gift_name: "" + gift_name: "", + stime: getFirstDayOfMonth(), + etime: getCurrentDate() }); const pagination = ref({ total: 0, @@ -27,20 +39,21 @@ const pagination = ref({ currentPage: 1, background: true }); -const statisticsData = ref() -const tableList = ref([]) +const statisticsData = ref(); +const tableList = ref([]); const statisticsList = ref([ { label: "总抽奖次数", prop: "total" }, { label: "总抽奖金额(支出)", prop: "total_money" }, { - label: "总礼物价值(收入)", prop: "total_gift_money" + label: "总礼物价值(收入)", + prop: "total_gift_money" }, { label: "统计(收入/支出)", prop: "ratio", tip: "%" }, { label: "用户盈亏", prop: "profit_loss" }, { label: "用户盈亏比", prop: "profit_loss_ratio", tip: "%" }, { label: "平台盈亏", prop: "platform_profit_loss" }, - { label: "平台盈亏比", prop: "platform_profit_loss_ratio", tip: "%" }, -]) + { label: "平台盈亏比", prop: "platform_profit_loss_ratio", tip: "%" } +]); const dynamicflowColumns = ref([ { label: "ID", @@ -82,83 +95,86 @@ const dynamicflowColumns = ref([ label: "创建时间", prop: "createtime" } -]) -const getData = async (formData) => { - searchForm.value = { ...formData } +]); +const getData = async formData => { + searchForm.value = { ...formData }; const { data, code } = await queryTurntableRecord({ ...formData, page: pagination.value.currentPage, page_limit: pagination.value.pageSize, room_id: props.roomId - }) + }); if (code) { tableList.value = data.lists.map(ele => { return { - ...ele, ...data.total_data, - is_public_screen: data.is_public_screen === 1 ? '显示' : '隐藏', - is_public_server: data.is_public_server === 1 ? '显示' : '隐藏', - is_world_show: data.is_world_show === 1 ? '显示' : '隐藏', - } + ...ele, + ...data.total_data, + is_public_screen: data.is_public_screen === 1 ? "显示" : "隐藏", + is_public_server: data.is_public_server === 1 ? "显示" : "隐藏", + is_world_show: data.is_world_show === 1 ? "显示" : "隐藏" + }; }); - statisticsData.value = data.total_data + statisticsData.value = data.total_data; pagination.value.total = data.count; pagination.value.currentPage = data.page; } -} +}; const handleSizeChange = (val: number) => { pagination.value.pageSize = val; - getData(searchForm.value) + getData(searchForm.value); }; const handleCurrentChange = (val: number) => { pagination.value.currentPage = val; - getData(searchForm.value) + getData(searchForm.value); }; const resetSetting = async () => { const { data, code } = await resetBlindBoxRule({ gift_bag_id: searchForm.value.gift_bag_id, room_id: props.roomId - }) + }); if (code) { message(`重置成功`, { type: "success" }); - getData(searchForm.value) + getData(searchForm.value); } -} +}; onMounted(() => { - getData(searchForm.value) + getData(searchForm.value); // getType() -}) - +}); \ No newline at end of file +