增加期数

This commit is contained in:
yziiy
2026-01-07 18:02:51 +08:00
parent 43b5895df6
commit d9d14eddee
3 changed files with 112 additions and 105 deletions

View File

@@ -9,9 +9,9 @@ import {
getBlindBoxRule, getBlindBoxRule,
settingBlindBoxRule settingBlindBoxRule
} from "@/api/modules/blindBox"; } from "@/api/modules/blindBox";
import TurntableView from './Turntable.vue'; import TurntableView from "./Turntable.vue";
import editForm from "./form.vue"; import editForm from "./form.vue";
import settingRuleView from './settingRule.vue' import settingRuleView from "./settingRule.vue";
import { addDialog } from "@/components/ReDialog"; import { addDialog } from "@/components/ReDialog";
import { message } from "@/utils/message"; import { message } from "@/utils/message";
export function useData() { export function useData() {
@@ -28,22 +28,23 @@ export function useData() {
}); });
const searchForm = ref({ const searchForm = ref({
gift_id: "", gift_id: "",
gift_name: "", gift_name: ""
}); });
const activeName = ref(0) const activeName = ref(0);
const typeList = ref([]) const typeList = ref([]);
const statisticsList = ref([ const statisticsList = ref([
{ label: "每期总次数", prop: "total_count" }, { label: "每期总次数", prop: "total_count" },
{ label: "每期总礼物价值(收入)", prop: "total_price" }, { label: "每期总礼物价值(收入)", prop: "total_price" },
{ {
label: "每期总抽奖花费(支出)", prop: "total_cost" label: "每期总抽奖花费(支出)",
prop: "total_cost"
}, },
{ label: "每期统计(收入/支出)", prop: "profit_loss_ratio", tip: "%" }, { label: "每期统计(收入/支出)", prop: "profit_loss_ratio", tip: "%" }
// { label: "今日抽奖人数", prop: "today_count_user" }, // { label: "今日抽奖人数", prop: "today_count_user" },
// { label: "今日抽奖次数", prop: "today_total_count" }, // { label: "今日抽奖次数", prop: "today_total_count" },
// { label: "今日抽奖收入", prop: "today_total_price" }, // { label: "今日抽奖收入", prop: "today_total_price" },
]) ]);
const statisticsData = ref({}) const statisticsData = ref({});
const searchLabel = ref([ const searchLabel = ref([
{ label: "礼物ID", prop: "gift_id", type: "input" }, { label: "礼物ID", prop: "gift_id", type: "input" },
{ label: "礼物名称", prop: "gift_name", type: "input" } { label: "礼物名称", prop: "gift_name", type: "input" }
@@ -90,14 +91,18 @@ export function useData() {
label: "公屏", label: "公屏",
prop: "is_public_screen", prop: "is_public_screen",
cellRenderer: ({ row }) => ( cellRenderer: ({ row }) => (
<el-tag type={row.is_public_screen === 1 ? 'success' : 'error'}>{row.is_public_screen === 1 ? '是' : '否'}</el-tag> <el-tag type={row.is_public_screen === 1 ? "success" : "error"}>
{row.is_public_screen === 1 ? "是" : "否"}
</el-tag>
) )
}, },
{ {
label: "全服播报", label: "全服播报",
prop: "is_public_server", prop: "is_public_server",
cellRenderer: ({ row }) => ( cellRenderer: ({ row }) => (
<el-tag type={row.is_public_server === 1 ? 'success' : 'error'}>{row.is_public_server === 1 ? '是' : '否'}</el-tag> <el-tag type={row.is_public_server === 1 ? "success" : "error"}>
{row.is_public_server === 1 ? "是" : "否"}
</el-tag>
) )
}, },
{ {
@@ -111,23 +116,23 @@ export function useData() {
slot: "operation" slot: "operation"
} }
]); ]);
const onSearch = async (formData) => { const onSearch = async formData => {
loading.value = true; loading.value = true;
searchForm.value = { ...formData } searchForm.value = { ...formData };
const { data, code } = await queryBlindBoxList({ const { data, code } = await queryBlindBoxList({
...formData, ...formData,
gift_bag_id: activeName.value, gift_bag_id: activeName.value,
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
};
}); });
statisticsData.value = data.total_data statisticsData.value = data.total_data;
pagination.value.total = data.count; pagination.value.total = data.count;
pagination.value.currentPage = data.page; pagination.value.currentPage = data.page;
} }
@@ -142,32 +147,33 @@ export function useData() {
onSearch(searchForm.value); onSearch(searchForm.value);
}; };
const getType = async () => { const getType = async () => {
const { code, data } = await queryBoxTypeList({ activities_id: 5 }) const { code, data } = await queryBoxTypeList({ activities_id: 5 });
typeList.value = code ? data.map(ele => { typeList.value = code
return { ? data.map(ele => {
label: ele.name, return {
value: ele.id label: ele.name,
} value: ele.id
}) : [] };
if (code) handleClick(data[0].id) })
} : [];
const handleClick = (id) => { if (code) handleClick(data[0].id);
activeName.value = id };
const handleClick = id => {
activeName.value = id;
onSearch(searchForm.value); onSearch(searchForm.value);
} };
// //
const resetSetting = async () => { const resetSetting = async () => {
const { data, code } = await resetBlindBoxRule({ const { data, code } = await resetBlindBoxRule({
gift_bag_id: activeName.value gift_bag_id: activeName.value
}) });
if (code) { if (code) {
message(`重置成功`, { message(`重置成功`, {
type: "success" type: "success"
}); });
handleClick(activeName.value); handleClick(activeName.value);
} }
};
}
const handleDelete = async rowData => { const handleDelete = async rowData => {
const { code } = await removeBlindBoxData({ id: rowData.id }); const { code } = await removeBlindBoxData({ id: rowData.id });
if (code) { if (code) {
@@ -197,7 +203,7 @@ export function useData() {
const saveData = async form => { const saveData = async form => {
const { code } = await addBlindBoxData({ const { code } = await addBlindBoxData({
...form, ...form,
gift_bag_id: activeName.value, gift_bag_id: activeName.value
}); });
if (code) { if (code) {
message("新增成功", { type: "success" }); message("新增成功", { type: "success" });
@@ -238,7 +244,9 @@ export function useData() {
}); });
}; };
const setting = async () => { const setting = async () => {
const { data, code } = await getBlindBoxRule({ gift_bag_id: activeName.value }) const { data, code } = await getBlindBoxRule({
gift_bag_id: activeName.value
});
addDialog({ addDialog({
title: `设置盲盒规则`, title: `设置盲盒规则`,
props: { props: {
@@ -248,7 +256,8 @@ export function useData() {
}, },
width: "40%", width: "40%",
closeOnClickModal: false, closeOnClickModal: false,
contentRenderer: () => h(settingRuleView, { ref: formRef, formInline: null }), contentRenderer: () =>
h(settingRuleView, { ref: formRef, formInline: null }),
beforeSure: (done, { options }) => { beforeSure: (done, { options }) => {
const FormRef = formRef.value.getRef(); const FormRef = formRef.value.getRef();
const curData = options.props.formInline; const curData = options.props.formInline;
@@ -265,12 +274,12 @@ export function useData() {
FormRef.validate(valid => { FormRef.validate(valid => {
if (valid) { if (valid) {
// console.log("curData", curData); // console.log("curData", curData);
saveData(curData) saveData(curData);
} }
}); });
} }
}); });
} };
// 开奖记录 // 开奖记录
const openLotteryRecord = () => { const openLotteryRecord = () => {
addDialog({ addDialog({
@@ -281,9 +290,10 @@ export function useData() {
fullscreen: true, fullscreen: true,
hideFooter: true, hideFooter: true,
closeOnClickModal: false, closeOnClickModal: false,
contentRenderer: () => h(TurntableView, { ref: formRef, formInline: null }) contentRenderer: () =>
h(TurntableView, { ref: formRef, formInline: null })
}); });
} };
return { return {
searchForm, searchForm,
searchLabel, searchLabel,
@@ -307,4 +317,4 @@ export function useData() {
setting, setting,
openLotteryRecord openLotteryRecord
}; };
} }

View File

@@ -2,12 +2,8 @@
// 开奖记录 // 开奖记录
import { ref, onMounted, nextTick } from "vue"; import { ref, onMounted, nextTick } from "vue";
import SearchForm from "@/components/SearchForm/index.vue"; import SearchForm from "@/components/SearchForm/index.vue";
import { import { queryBoxTypeList } from "@/api/modules/blindBox";
queryBoxTypeList import { queryTurntableRecord } from "@/api/modules/room";
} from "@/api/modules/blindBox";
import {
queryTurntableRecord
} from "@/api/modules/room";
const searchLabel = ref([ const searchLabel = ref([
{ {
label: "盲盒礼包", label: "盲盒礼包",
@@ -21,19 +17,19 @@ const searchLabel = ref([
{ label: "开始时间", prop: "stime", type: "date" }, { label: "开始时间", prop: "stime", type: "date" },
{ label: "结束时间", prop: "etime", type: "date" } { label: "结束时间", prop: "etime", type: "date" }
]); ]);
const props = defineProps(["roomId", 'BagId', 'giftBagId']); const props = defineProps(["roomId", "BagId", "giftBagId"]);
// console.log('传递过来的参数', ) // console.log('传递过来的参数', )
const typeList = ref([]) const typeList = ref([]);
const formatDate = (date) => { const formatDate = date => {
// 获取年份 // 获取年份
const year = date.getFullYear(); const year = date.getFullYear();
// 获取月份,并将其转为两位数格式 // 获取月份,并将其转为两位数格式
const month = String(date.getMonth() + 1).padStart(2, '0'); const month = String(date.getMonth() + 1).padStart(2, "0");
// 获取日期,并将其转为两位数格式 // 获取日期,并将其转为两位数格式
const day = String(date.getDate()).padStart(2, '0'); const day = String(date.getDate()).padStart(2, "0");
// 返回格式化后的日期字符串 // 返回格式化后的日期字符串
return `${year}-${month}-${day} 00:00:00`; return `${year}-${month}-${day} 00:00:00`;
} };
const getTodayAndWeekAgo = () => { const getTodayAndWeekAgo = () => {
const today = new Date(); // 获取今天的日期对象 const today = new Date(); // 获取今天的日期对象
const weekAgo = new Date(); // 获取当前日期对象 const weekAgo = new Date(); // 获取当前日期对象
@@ -44,7 +40,7 @@ const getTodayAndWeekAgo = () => {
today: formatDate(today), today: formatDate(today),
weekAgo: formatDate(weekAgo) weekAgo: formatDate(weekAgo)
}; };
} };
const searchForm = ref({ const searchForm = ref({
gift_bag_id: "", gift_bag_id: "",
user_id: "", user_id: "",
@@ -59,18 +55,19 @@ const pagination = ref({
currentPage: 1, currentPage: 1,
background: true background: true
}); });
const statisticsData = ref() const statisticsData = ref();
const tableList = ref([]) const tableList = ref([]);
const statisticsList = ref([ const statisticsList = ref([
{ label: "总抽奖次数", prop: "total" }, { label: "总抽奖次数", prop: "total" },
{ label: "总抽奖金额(支出)", prop: "total_money" }, { label: "总抽奖金额(支出)", prop: "total_money" },
{ {
label: "总礼物价值(收入)", prop: "total_gift_money" label: "总礼物价值(收入)",
prop: "total_gift_money"
}, },
{ label: "统计(收入/支出)", prop: "ratio", tip: "%" }, { label: "统计(收入/支出)", prop: "ratio", tip: "%" },
{ label: "盈亏(收入-支出)", prop: "profit_loss" }, { label: "盈亏(收入-支出)", prop: "profit_loss" },
{ label: "盈亏比(盈亏/支出)", prop: "profit_loss_ratio", tip: "%" }, { label: "盈亏比(盈亏/支出)", prop: "profit_loss_ratio", tip: "%" }
]) ]);
const dynamicflowColumns = ref([ const dynamicflowColumns = ref([
{ {
label: "ID", label: "ID",
@@ -80,10 +77,10 @@ const dynamicflowColumns = ref([
label: "盲盒转盘类型", label: "盲盒转盘类型",
prop: "gift_bag_type" prop: "gift_bag_type"
}, },
// { {
// label: "期数", label: "期数",
// prop: "periods" prop: "periods"
// }, },
{ {
label: "开奖人ID", label: "开奖人ID",
prop: "user_name" prop: "user_name"
@@ -116,75 +113,77 @@ const dynamicflowColumns = ref([
label: "创建时间", label: "创建时间",
prop: "createtime" prop: "createtime"
} }
]) ]);
const getType = async () => { const getType = async () => {
const { code, data } = await queryBoxTypeList({ activities_id: 5 }) const { code, data } = await queryBoxTypeList({ activities_id: 5 });
typeList.value = code ? data.map(ele => { typeList.value = code
return { ? data.map(ele => {
label: ele.name, return {
value: ele.id label: ele.name,
} value: ele.id
}) : [] };
if (code) {
searchLabel.value[0].optionList = typeList.value
searchForm.value.gift_bag_id = Number(props.giftBagId) || data[0].id
nextTick(() => {
getData(searchForm.value)
}) })
: [];
if (code) {
searchLabel.value[0].optionList = typeList.value;
searchForm.value.gift_bag_id = Number(props.giftBagId) || data[0].id;
nextTick(() => {
getData(searchForm.value);
});
} }
} };
const getData = async (formData) => { const getData = async formData => {
searchForm.value = { ...formData } searchForm.value = { ...formData };
const { data, code } = await queryTurntableRecord({ const { data, code } = await queryTurntableRecord({
...formData, ...formData,
page: pagination.value.currentPage, page: pagination.value.currentPage,
page_limit: pagination.value.pageSize, page_limit: pagination.value.pageSize,
room_id: props.roomId room_id: props.roomId
}) });
if (code) { if (code) {
tableList.value = data.lists.map(ele => { tableList.value = data.lists.map(ele => {
return { return {
...ele, ...data.total_data, ...ele,
is_public_screen: data.is_public_screen === 1 ? '显示' : '隐藏', ...data.total_data,
is_public_server: data.is_public_server === 1 ? '显示' : '隐藏', is_public_screen: data.is_public_screen === 1 ? "显示" : "隐藏",
is_world_show: data.is_world_show === 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.total = data.count;
pagination.value.currentPage = data.page; pagination.value.currentPage = data.page;
} }
} };
const handleSizeChange = (val: number) => { const handleSizeChange = (val: number) => {
pagination.value.pageSize = val; pagination.value.pageSize = val;
getData(searchForm.value) getData(searchForm.value);
}; };
const handleCurrentChange = (val: number) => { const handleCurrentChange = (val: number) => {
pagination.value.currentPage = val; pagination.value.currentPage = val;
getData(searchForm.value) getData(searchForm.value);
}; };
onMounted(() => { onMounted(() => {
getType() getType();
}) });
</script> </script>
<template> <template>
<div class="viewPage" v-if="typeList && typeList.length"> <div v-if="typeList && typeList.length" class="viewPage">
<SearchForm class="pb-2 mt-2" :LabelList="searchLabel" :formData="searchForm" @handleSearch="getData" /> <SearchForm class="pb-2 mt-2" :LabelList="searchLabel" :formData="searchForm" @handleSearch="getData" />
<div class="content-flex" v-if="statisticsData"> <div v-if="statisticsData" class="content-flex">
<div class="box" v-for="(ele, index) in statisticsList"> <div v-for="(ele, index) in statisticsList" class="box">
<el-statistic :precision="2" decimal-separator="." :value="statisticsData[ele.prop] || 0" <el-statistic :precision="2" decimal-separator="." :value="statisticsData[ele.prop] || 0"
:suffix="ele.tip || ''" :title="ele.label"></el-statistic> :suffix="ele.tip || ''" :title="ele.label" />
<span></span> <span />
</div> </div>
</div> </div>
<pure-table class="mt-5" ref="tableRef" align-whole="center" showOverflowTooltip table-layout="auto" <pure-table ref="tableRef" class="mt-5" align-whole="center" showOverflowTooltip table-layout="auto"
default-expand-all row-key="id" :adaptiveConfig="{ offsetBottom: 108 }" :data="tableList" default-expand-all row-key="id" :adaptiveConfig="{ offsetBottom: 108 }" :data="tableList"
:columns="dynamicflowColumns" :pagination="{ ...pagination }" :header-cell-style="{ :columns="dynamicflowColumns" :pagination="{ ...pagination }" :header-cell-style="{
background: 'var(--el-fill-color-light)', background: 'var(--el-fill-color-light)',
color: 'var(--el-text-color-primary)' color: 'var(--el-text-color-primary)'
}" @page-current-change="handleCurrentChange" @page-size-change="handleSizeChange"> }" @page-current-change="handleCurrentChange" @page-size-change="handleSizeChange" />
</pure-table>
</div> </div>
</template> </template>
<style lang="scss" scoped> <style lang="scss" scoped>
@@ -203,6 +202,6 @@ onMounted(() => {
margin-bottom: 20px; margin-bottom: 20px;
text-align: center; text-align: center;
align-items: center; align-items: center;
justify-content: space-between justify-content: space-between;
} }
</style> </style>

View File

@@ -35,9 +35,7 @@ export default ({ mode }: ConfigEnv): UserConfigExport => {
onProxyReq: (proxyReq, req, res) => { onProxyReq: (proxyReq, req, res) => {
if (req.method === 'OPTIONS') { if (req.method === 'OPTIONS') {
proxyReq.method = 'OPTIONS'; proxyReq.method = 'OPTIONS';
// https://test.vespa.qxyushen.top res.setHeader('Access-Control-Allow-Origin', 'http://yushenggliht.qxyushen.top');
// 'http://yushenggliht.qxyushen.top'
res.setHeader('Access-Control-Allow-Origin', 'http://ysmanagementconsole.qxyushen.top');
// res.setHeader('Access-Control-Allow-Origin', 'https://test.vespa.qxyushen.top'); // res.setHeader('Access-Control-Allow-Origin', 'https://test.vespa.qxyushen.top');
res.setHeader('Access-Control-Allow-Methods', 'GET, POST, PUT, DELETE, OPTIONS'); res.setHeader('Access-Control-Allow-Methods', 'GET, POST, PUT, DELETE, OPTIONS');
res.setHeader('Access-Control-Allow-Headers', 'Content-Type, Authorization'); res.setHeader('Access-Control-Allow-Headers', 'Content-Type, Authorization');