更新秘地后台项目

This commit is contained in:
yziiy
2025-08-30 18:58:26 +08:00
parent 7191f62075
commit cd4c050838
23 changed files with 1966 additions and 13 deletions

View File

@@ -73,4 +73,26 @@ export const removeBlindBoxData = data => {
"/adminapi/BlindBox/blind_box_del",
{ data }
);
};
// 巡乐会设置
export const getXunLeRule = params => {
return http.request<Result>(
"get",
"/adminapi/BlindBox/xunlehui_rule_detail",
{ params }
);
};
export const queryGiftByTypeList = params => {
return http.request<Result>(
"get",
"/adminapi/BlindBox/blind_box_gifts", { params }
);
};
export const settingXunLeRule = data => {
return http.request<Result>(
"post",
"/adminapi/BlindBox/xunlehui_set_rule",
{ data }
);
};

View File

@@ -256,3 +256,27 @@ export const getRoomToken = data => {
data
});
};
// 盲盒转盘统计 adminapi/BlindBox/blind_box_turntable_lists
export const queryTurntableList = params => {
return http.request<Result>(
"get",
"/adminapi/BlindBox/blind_box_turntable_lists",
{ params }
);
};
// 盲盒转盘开奖记录
export const queryTurntableRecord = params => {
return http.request<Result>(
"get",
"/adminapi/BlindBox/blind_box_turntable_open_record",
{ params }
);
};
// 巡乐会锁定记录
export const queryLockRecord = params => {
return http.request<Result>(
"get",
"/adminapi/BlindBox/xlh_lock_record",
{ params }
);
};

View File

@@ -76,10 +76,9 @@ const handleFileSuccess = ({ data, code }, file, fileList) => {
<template>
<!-- {{ acceptType http://chat.qxmier.com }} -->
<el-upload v-model:file-list="fileList" drag multiple class="pure-upload" list-type="picture-card"
:accept="acceptType ? acceptType : 'image/jpeg,image/png,image/gif'"
action="http://chat.qxmier.com/adminapi/UploadFile/file_upload" :limit="limit" name="files"
:headers="{ Authorization: getToken().accessToken }" :on-exceed="onExceed" :before-upload="onBefore"
:on-success="handleFileSuccess">
:accept="acceptType ? acceptType : 'image/jpeg,image/png,image/gif'" action="/adminapi/UploadFile/file_upload"
:limit="limit" name="files" :headers="{ Authorization: getToken().accessToken }" :on-exceed="onExceed"
:before-upload="onBefore" :on-success="handleFileSuccess">
<IconifyIconOffline :icon="Add" class="m-auto mt-4" width="30" />
<template #file="{ file }">
<div v-if="file.status == 'ready' || file.status == 'uploading'" class="mt-[35%] m-auto">

Submodule src/store/yusheng-admin added at f5c114b657

View File

@@ -136,7 +136,7 @@ export function useData() {
onSearch(searchForm.value);
};
const getType = async () => {
const { code, data } = await queryBoxTypeList(4)
const { code, data } = await queryBoxTypeList({ activities_id: 4 })
// console.log(code, data)
typeList.value = code ? data.map(ele => {
return {

View File

@@ -0,0 +1,44 @@
<script setup lang="ts">
import { ref, onMounted } from "vue";
import { queryGiftByTypeList } from '@/api/modules/blindBox'
const ruleFormRef = ref();
const typeList = ref([])
const formRules = ref({
gift_id: [{ required: true, message: "请选择礼物", trigger: "change" }],
quantity: [{ required: true, message: "请输入每期数量", trigger: "blur" }]
});
const props = defineProps(["formInline"]);
const newFormInline = ref(
props.formInline
? props.formInline
: {
gift_id: "",
quantity: ""
}
);
function getRef() {
return ruleFormRef.value;
}
const getList = async () => {
const { data, code } = await queryGiftByTypeList({ type: 2, label: 7 })
typeList.value = code ? data : []
}
onMounted(() => {
getList()
})
defineExpose({ getRef });
</script>
<template>
<el-form ref="ruleFormRef" :model="newFormInline" :rules="formRules" label-width="120px">
<el-form-item label="选择礼物" prop="gift_id">
<el-select v-model="newFormInline.gift_id" placeholder="请选择礼物">
<el-option v-for="item in typeList" :key="item.gid" :label="item.gift_name" :value="item.gid">
</el-option>
</el-select>
</el-form-item>
<el-form-item label="每期数量" prop="quantity">
<el-input-number v-model="newFormInline.quantity" :precision="2" :step="0.01" :max="9999.99"></el-input-number>
</el-form-item>
</el-form>
</template>

View File

@@ -0,0 +1,288 @@
import { ref, h } from "vue";
import {
queryBoxTypeList,
queryBlindBoxList,
resetBlindBoxRule,
removeBlindBoxData,
addBlindBoxData,
editBlindBoxData,
getBlindBoxRule,
settingBlindBoxRule
} from "@/api/modules/blindBox";
import editForm from "./form.vue";
import settingRuleView from './settingRule.vue'
import { addDialog } from "@/components/ReDialog";
import { message } from "@/utils/message";
export function useData() {
const formRef = ref();
const loading = ref(true);
const tableList = ref([]);
const isShow = ref(false);
const pagination = ref({
total: 0,
pageSize: 10,
currentPage: 1,
background: true
});
const searchForm = ref({
gift_id: "",
gift_name: "",
});
const activeName = ref(0)
const typeList = ref([])
const statisticsList = ref([
{ label: "每期总次数", prop: "total_count" },
{ label: "每期总礼物价值(收入)", prop: "total_price" },
{
label: "每期总抽奖花费(支出)", prop: "total_cost"
},
{ label: "每期统计(收入/支出)", prop: "profit_loss_ratio", tip: "%" },
// { label: "今日抽奖人数", prop: "today_count_user" },
// { label: "今日抽奖次数", prop: "today_total_count" },
// { label: "今日抽奖收入", prop: "today_total_price" },
])
const statisticsData = ref({})
const searchLabel = ref([
{ label: "礼物ID", prop: "gift_id", type: "input" },
{ label: "礼物名称", prop: "gift_name", type: "input" }
]);
const tableLabel = ref([
{
label: "礼物ID",
prop: "gift_id"
},
{
label: "礼物名称",
prop: "gift_name"
},
{
label: "封面图",
prop: "base_image",
cellRenderer: ({ row }) => (
<el-image
fit="cover"
preview-teleported={true}
src={row.base_image}
preview-src-list={Array.of(row.base_image)}
class="w-[50px] h-[50px] align-middle"
/>
)
},
{
label: "价格",
prop: "gift_price"
},
{
label: "每期数量",
prop: "quantity"
},
{
label: "未开数量",
prop: "remaining_number"
},
{
label: "公屏",
prop: "is_public_screen",
cellRenderer: ({ row }) => (
<el-tag type={row.is_public_screen === 1 ? 'success' : 'error'}>{row.is_public_screen === 1 ? '是' : '否'}</el-tag>
)
},
{
label: "全服播报",
prop: "is_public_server",
cellRenderer: ({ row }) => (
<el-tag type={row.is_public_server === 1 ? 'success' : 'error'}>{row.is_public_server === 1 ? '是' : '否'}</el-tag>
)
},
{
label: "添加时间",
prop: "createtime"
},
{
label: "操作",
fixed: "right",
width: 210,
slot: "operation"
}
]);
const onSearch = async (formData) => {
loading.value = true;
searchForm.value = { ...formData }
const { data, code } = await queryBlindBoxList({
...formData,
gift_bag_id: activeName.value,
page: pagination.value.currentPage,
page_limit: pagination.value.pageSize,
});
if (code) {
tableList.value = data.lists.map(ele => {
return {
...ele, ...data.total
}
});
statisticsData.value = data.total_data
pagination.value.total = data.count;
pagination.value.currentPage = data.page;
}
loading.value = false;
};
const handleSizeChange = (val: number) => {
pagination.value.pageSize = val;
onSearch(searchForm.value);
};
const handleCurrentChange = (val: number) => {
pagination.value.currentPage = val;
onSearch(searchForm.value);
};
const getType = async () => {
const { code, data } = await queryBoxTypeList({ activities_id: 5 })
typeList.value = code ? data.map(ele => {
return {
label: ele.name,
value: ele.id
}
}) : []
if (code) handleClick(data[0].id)
}
const handleClick = (id) => {
activeName.value = id
onSearch(searchForm.value);
}
//
const resetSetting = async () => {
const { data, code } = await resetBlindBoxRule({
gift_bag_id: activeName.value
})
if (code) {
message(`重置成功`, {
type: "success"
});
handleClick(activeName.value);
}
}
const handleDelete = async rowData => {
const { code } = await removeBlindBoxData({ id: rowData.id });
if (code) {
message(`您删除了这条数据`, {
type: "success"
});
onSearch(searchForm.value);
}
};
const openDialog = async (title = "新增", rowData: any) => {
addDialog({
title: `${title}盲盒礼物`,
props: {
formInline: {
gift_id: rowData?.gift_id ?? "",
quantity: rowData?.quantity ?? "",
}
},
width: "40%",
closeOnClickModal: false,
contentRenderer: () => h(editForm, { ref: formRef, formInline: null }),
beforeSure: (done, { options }) => {
const FormRef = formRef.value.getRef();
const curData = options.props.formInline;
const saveData = async form => {
const { code } = await addBlindBoxData({
...form,
gift_bag_id: activeName.value,
});
if (code) {
message("新增成功", { type: "success" });
onSearch(searchForm.value);
done();
} else {
message("新增失败", { type: "error" });
}
};
const updateData = async form => {
const { code, msg } = await editBlindBoxData({
...form,
gift_bag_id: activeName.value,
id: rowData.id
});
if (code) {
message("修改成功", { type: "success" });
onSearch(searchForm.value);
done();
} else {
message(msg, { type: "error" });
}
};
FormRef.validate(valid => {
if (valid) {
console.log("curData", curData);
// 表单规则校验通过
if (title === "新增") {
// 实际开发先调用新增接口,再进行下面操作
saveData(curData);
} else {
// 实际开发先调用修改接口,再进行下面操作
updateData(curData);
}
}
});
}
});
};
const setting = async () => {
const { data, code } = await getBlindBoxRule({ gift_bag_id: activeName.value })
addDialog({
title: `设置盲盒规则`,
props: {
formInline: {
...data
}
},
width: "40%",
closeOnClickModal: false,
contentRenderer: () => h(settingRuleView, { ref: formRef, formInline: null }),
beforeSure: (done, { options }) => {
const FormRef = formRef.value.getRef();
const curData = options.props.formInline;
const saveData = async form => {
const { code } = await settingBlindBoxRule({ ...form });
if (code) {
message("设置成功", { type: "success" });
onSearch(searchForm.value);
done();
} else {
message("设置失败", { type: "error" });
}
};
FormRef.validate(valid => {
if (valid) {
// console.log("curData", curData);
saveData(curData)
}
});
}
});
}
return {
searchForm,
searchLabel,
onSearch,
isShow,
tableList,
tableLabel,
pagination,
handleSizeChange,
handleCurrentChange,
loading,
getType,
activeName,
typeList,
statisticsList,
statisticsData,
handleClick,
openDialog,
resetSetting,
handleDelete,
setting
};
}

View File

@@ -0,0 +1,110 @@
<script setup lang="ts">
import { onMounted } from "vue";
import { useData } from "./hook.tsx";
import SearchForm from "@/components/SearchForm/index.vue";
import { PureTableBar } from "@/components/RePureTableBar";
import { deviceDetection } from "@pureadmin/utils";
import { useRenderIcon } from "@/components/ReIcon/src/hooks";
import AddFill from "@iconify-icons/ri/add-circle-line";
const {
searchLabel,
searchForm,
onSearch,
isShow,
tableList,
pagination,
tableLabel,
handleSizeChange,
handleCurrentChange,
loading,
getType,
typeList,
activeName,
statisticsList,
statisticsData,
handleClick,
openDialog,
resetSetting,
handleDelete,
setting
} = useData();
onMounted(() => {
getType()
});
defineOptions({
name: "boxList"
});
</script>
<template>
<div class="main">
<!-- {{ activeName }} -->
<div v-if="typeList.length" class="content">
<el-button v-for="ele in typeList" :key="ele.value" :label="ele.label" :name="ele.value"
:type="activeName === ele.value ? 'primary' : ''" @click="handleClick(ele.value)">{{ ele.label }}</el-button>
</div>
<SearchForm class="pb-2" :LabelList="searchLabel" :formData="searchForm" @handleSearch="onSearch" />
<div class="content-flex">
<div class="box" v-for="(ele, index) in statisticsList">
<el-statistic :precision="2" decimal-separator="." :value="statisticsData[ele.prop]" :suffix="ele.tip || ''"
:title="ele.label"></el-statistic>
<span></span>
</div>
</div>
<div ref="contentRef" :class="['flex', deviceDetection() ? 'flex-wrap' : '']">
<PureTableBar title="盲盒转盘列表" :class="[isShow && !deviceDetection() ? '!w-[60vw]' : 'w-full']"
:columns="tableLabel" @refresh="onSearch">
<template #buttons>
<el-popconfirm :title="`是否重置当前盲盒转盘的规则数量`" @confirm="resetSetting(row)">
<template #reference>
<el-button type="primary">
重置数量
</el-button>
</template>
</el-popconfirm>
<el-button type="primary" @click="setting(row)">
设置规则
</el-button>
</template>
<template v-slot="{ size, dynamicColumns }">
<pure-table ref="tableRef" align-whole="center" showOverflowTooltip table-layout="auto" default-expand-all
:loading="loading" :size="size" row-key="id" adaptive :adaptiveConfig="{ offsetBottom: 108 }"
:data="tableList" :columns="dynamicColumns" :pagination="{ ...pagination, size }" :header-cell-style="{
background: 'var(--el-fill-color-light)',
color: 'var(--el-text-color-primary)'
}" @page-current-change="handleCurrentChange" @page-size-change="handleSizeChange">
<template #operation="{ row }">
<el-button link type="primary" :size="size" @click="openDialog('编辑', row)">
编辑
</el-button>
<!-- <el-popconfirm :title="`是否确认删除礼物名称为【${row.gift_name}】的这条数据`" @confirm="handleDelete(row)">
<template #reference>
<el-button link type="primary" :size="size"> 删除 </el-button>
</template>
</el-popconfirm> -->
</template>
</pure-table>
</template>
</PureTableBar>
</div>
</div>
</template>
<style scoped lang="scss">
.content {
width: 100%;
background-color: #fff;
padding: 20px;
}
.content-flex {
width: 100%;
display: inline-flex;
background-color: #fff;
padding: 20px;
text-align: center;
align-items: center;
justify-content: space-between
}
</style>

View File

@@ -0,0 +1,57 @@
<script setup lang="ts">
import { ref, onMounted } from "vue";
import RichText from '@/components/RichText/index.vue';
import { queryGiftList } from '@/api/modules/blindBox'
const ruleFormRef = ref();
const typeList = ref([])
const formRules = ref({
gift_id: [{ required: true, message: "请选择礼物", trigger: "change" }],
introd: [{ required: true, message: "请输入玩法介绍", trigger: "blur" }],
description: [{ required: true, message: "请输入说明", trigger: "blur" }]
});
const props = defineProps(["formInline"]);
const newFormInline = ref(
props.formInline
? props.formInline
: {
gift_id: "",
description: "",
introd: ""
}
);
function getRef() {
return ruleFormRef.value;
}
const getList = async () => {
const { data, code } = await queryGiftList()
typeList.value = code ? data : []
}
function chanageEditorValue(val) {
newFormInline.value.introd = val
}
onMounted(() => {
getList()
})
defineExpose({ getRef });
</script>
<template>
<el-form ref="ruleFormRef" :model="newFormInline" :rules="formRules" label-width="120px">
<el-form-item label="绑定礼物ID" prop="gift_id">
<el-input placeholder="请输入绑定礼物ID" v-model="newFormInline.gift_id">
</el-input>
<!-- <el-select v-model="newFormInline.gift_id" placeholder="请选择礼物">
<el-option v-for="item in typeList" :key="item.gid" :label="item.gift_name" :value="item.gid">
</el-option>
</el-select> -->
</el-form-item>
<!-- <el-form-item label="说明" prop="description">
<el-input type="textarea" placeholder="请输入说明" v-model="newFormInline.description" maxlength="16" show-word-limit>
</el-input>
</el-form-item> -->
<el-form-item label="玩法介绍" prop="introd">
<RichText style="border: 1px solid #ccc;" :echoValue="newFormInline.introd" @changeValue="chanageEditorValue">
</RichText>
</el-form-item>
</el-form>
</template>

View File

@@ -0,0 +1,56 @@
<script setup lang="ts">
import { ref, onMounted } from "vue";
import { queryGiftByTypeList } from '@/api/modules/blindBox'
const ruleFormRef = ref();
const typeList = ref([])
const formRules = ref({
gift_id: [{ required: true, message: "请选择礼物", trigger: "change" }],
quantity: [{ required: true, message: "请输入每期数量", trigger: "blur" }],
weight: [{ required: true, message: "请输入起止数量", trigger: "blur" }],
is_world_show: [{ required: true, message: "请选择状态", trigger: "change" }],
});
const props = defineProps(["formInline"]);
const newFormInline = ref(
props.formInline
? props.formInline
: {
gift_id: "",
quantity: 1,
weight: 1
}
);
function getRef() {
return ruleFormRef.value;
}
const getList = async () => {
const { data, code } = await queryGiftByTypeList({ type: 2, label: 6 })
typeList.value = code ? data : []
}
onMounted(() => {
getList()
})
defineExpose({ getRef });
</script>
<template>
<el-form ref="ruleFormRef" :model="newFormInline" :rules="formRules" label-width="150px">
<el-form-item label="选择礼物" prop="gift_id">
<el-select v-model="newFormInline.gift_id" placeholder="请选择礼物">
<el-option v-for="item in typeList" :key="item.gid" :label="item.gift_name" :value="item.gid">
</el-option>
</el-select>
</el-form-item>
<el-form-item label="每期数量" prop="quantity">
<el-input-number v-model="newFormInline.quantity"></el-input-number>
</el-form-item>
<el-form-item label="参与开奖起止数量" prop="weight">
<el-input-number v-model="newFormInline.weight"></el-input-number>
</el-form-item>
<el-form-item label="参与榜单显示" prop="is_world_show">
<el-radio-group v-model="newFormInline.is_world_show">
<el-radio :label="1">显示</el-radio>
<el-radio :label="0">隐藏</el-radio>
</el-radio-group>
</el-form-item>
</el-form>
</template>

View File

@@ -0,0 +1,283 @@
import { ref, h } from "vue";
import {
queryBlindBoxList,
resetBlindBoxRule,
removeBlindBoxData,
addBlindBoxData,
editBlindBoxData,
getXunLeRule,
settingXunLeRule
} from "@/api/modules/blindBox";
import editForm from "./form.vue";
import settingRuleView from './settingRule.vue'
import { addDialog } from "@/components/ReDialog";
import { message } from "@/utils/message";
export function useData() {
const formRef = ref();
const loading = ref(true);
const tableList = ref([]);
const isShow = ref(false);
const pagination = ref({
total: 0,
pageSize: 10,
currentPage: 1,
background: true
});
const searchForm = ref({
gift_id: "",
gift_name: "",
});
const activeName = ref(13)
const typeList = ref([])
const statisticsList = ref([
{ label: "每期总次数", prop: "total_count" },
{ label: "每期总礼物价值(收入)", prop: "total_price" },
{
label: "每期总抽奖花费(支出)", prop: "total_cost"
},
{ label: "每期统计(收入/支出)", prop: "profit_loss_ratio", tip: "%" }
])
const statisticsData = ref({})
const searchLabel = ref([
{ label: "礼物ID", prop: "gift_id", type: "input" },
{ label: "礼物名称", prop: "gift_name", type: "input" }
]);
const tableLabel = ref([
{
label: "礼物ID",
prop: "gift_id"
},
{
label: "礼物名称",
prop: "gift_name"
},
{
label: "封面图",
prop: "base_image",
cellRenderer: ({ row }) => (
<el-image
fit="cover"
preview-teleported={true}
src={row.base_image}
preview-src-list={Array.of(row.base_image)}
class="w-[50px] h-[50px] align-middle"
/>
)
},
{
label: "价格",
prop: "gift_price"
},
{
label: "每期数量",
prop: "quantity"
},
{
label: "多少次后可参与开奖",
prop: "weight"
},
{
label: "公屏",
prop: "is_public_screen",
cellRenderer: ({ row }) => (
<el-tag type={row.is_public_screen === 1 ? 'success' : 'error'}>{row.is_public_screen === 1 ? '是' : '否'}</el-tag>
)
},
{
label: "全服显示",
prop: "is_public_server",
cellRenderer: ({ row }) => (
<el-tag type={row.is_world_show === 1 ? 'success' : 'error'}>{row.is_world_show === 1 ? '是' : '否'}</el-tag>
)
},
{
label: "添加时间",
prop: "createtime"
},
{
label: "操作",
fixed: "right",
width: 210,
slot: "operation"
}
]);
const onSearch = async (formData) => {
loading.value = true;
searchForm.value = { ...formData }
const { data, code } = await queryBlindBoxList({
...formData,
gift_bag_id: activeName.value,
page: pagination.value.currentPage,
page_limit: pagination.value.pageSize,
});
if (code) {
tableList.value = data.lists.map(ele => {
return {
...ele, ...data.total
}
});
statisticsData.value = data.total_data
pagination.value.total = data.count;
pagination.value.currentPage = data.page;
}
loading.value = false;
};
const handleSizeChange = (val: number) => {
pagination.value.pageSize = val;
onSearch(searchForm.value);
};
const handleCurrentChange = (val: number) => {
pagination.value.currentPage = val;
onSearch(searchForm.value);
};
const resetSetting = async () => {
const { data, code } = await resetBlindBoxRule({
gift_bag_id: activeName.value
})
if (code) {
message(`重置成功`, {
type: "success"
});
onSearch(searchForm.value);
}
}
const handleDelete = async rowData => {
const { code } = await removeBlindBoxData({ id: rowData.id });
if (code) {
message(`您删除了这条数据`, {
type: "success"
});
onSearch(searchForm.value);
}
};
const openDialog = async (title = "新增", rowData: any) => {
addDialog({
title: `${title}盲盒礼物`,
props: {
formInline: {
gift_id: rowData?.gift_id ?? "",
quantity: rowData?.quantity ?? 1,
weight: rowData?.weight ?? 1,
is_world_show: rowData?.is_world_show ?? 1,
}
},
width: "40%",
closeOnClickModal: false,
contentRenderer: () => h(editForm, { ref: formRef, formInline: null }),
beforeSure: (done, { options }) => {
const FormRef = formRef.value.getRef();
const curData = options.props.formInline;
const saveData = async form => {
const { code } = await addBlindBoxData({
...form,
gift_bag_id: activeName.value,
});
if (code) {
message("新增成功", { type: "success" });
onSearch(searchForm.value);
done();
} else {
message("新增失败", { type: "error" });
}
};
const updateData = async form => {
const { code, msg } = await editBlindBoxData({
...form,
gift_bag_id: activeName.value,
id: rowData.id
});
if (code) {
message("修改成功", { type: "success" });
onSearch(searchForm.value);
done();
} else {
message(msg, { type: "error" });
}
};
FormRef.validate(valid => {
if (valid) {
console.log("curData", curData);
// 表单规则校验通过
if (title === "新增") {
// 实际开发先调用新增接口,再进行下面操作
saveData(curData);
} else {
// 实际开发先调用修改接口,再进行下面操作
updateData(curData);
}
}
});
}
});
};
const addGiftData = async () => {
}
const setting = async () => {
const { data, code } = await getXunLeRule({ gift_bag_id: activeName.value })
addDialog({
title: `设置巡乐会规则`,
props: {
formInline: {
inlet_bag_id: +data.inlet_bag_id,
introd: data.introd,
waiting_start_num: data.open_condition.waiting_start_num,
start_num: data.open_condition.start_num,
selected_gift_id: +data.locking_condition.selected_gift_id,
locking_gift_id: +data.locking_condition.locking_gift_id,
give_homeowner_gift_id: +data.locking_condition.give_homeowner_gift_id,
end_time: data.locking_time.end_time,
tow_no_locking_time: data.locking_time.tow_no_locking_time,
next_time: data.locking_time.next_time,
price: data.xlh_box_price
}
},
width: "60%",
closeOnClickModal: false,
contentRenderer: () => h(settingRuleView, { ref: formRef, formInline: null }),
beforeSure: (done, { options }) => {
const FormRef = formRef.value.getRef();
const curData = options.props.formInline;
const saveData = async form => {
const { code } = await settingXunLeRule({ ...form });
if (code) {
message("设置成功", { type: "success" });
onSearch(searchForm.value);
done();
} else {
message("设置失败", { type: "error" });
}
};
FormRef.validate(valid => {
if (valid) {
// console.log("curData", curData);
saveData(curData)
}
});
}
});
}
return {
searchForm,
searchLabel,
onSearch,
isShow,
tableList,
tableLabel,
pagination,
handleSizeChange,
handleCurrentChange,
loading,
activeName,
typeList,
statisticsList,
statisticsData,
openDialog,
resetSetting,
handleDelete,
addGiftData,
setting
};
}

View File

@@ -0,0 +1,103 @@
<script setup lang="ts">
import { onMounted } from "vue";
import { useData } from "./hook.tsx";
import SearchForm from "@/components/SearchForm/index.vue";
import { PureTableBar } from "@/components/RePureTableBar";
import { deviceDetection } from "@pureadmin/utils";
import { useRenderIcon } from "@/components/ReIcon/src/hooks";
import AddFill from "@iconify-icons/ri/add-circle-line";
const {
searchLabel,
searchForm,
onSearch,
isShow,
tableList,
pagination,
tableLabel,
handleSizeChange,
handleCurrentChange,
loading,
statisticsList,
statisticsData,
openDialog,
resetSetting,
handleDelete,
setting
} = useData();
onMounted(() => {
onSearch(searchForm.value);
});
defineOptions({
name: "boxList"
});
</script>
<template>
<div class="main">
<SearchForm class="pb-2" :LabelList="searchLabel" :formData="searchForm" @handleSearch="onSearch" />
<div class="content-flex">
<div class="box" v-for="(ele, index) in statisticsList">
<el-statistic :precision="2" decimal-separator="." :value="statisticsData[ele.prop]" :suffix="ele.tip || ''"
:title="ele.label"></el-statistic>
<span></span>
</div>
</div>
<div ref="contentRef" :class="['flex', deviceDetection() ? 'flex-wrap' : '']">
<PureTableBar title="巡乐会管理列表" :class="[isShow && !deviceDetection() ? '!w-[60vw]' : 'w-full']"
:columns="tableLabel" @refresh="onSearch">
<template #buttons>
<el-button type="primary" @click="openDialog('新增', {})">
添加
</el-button>
<el-popconfirm :title="`是否重置当前巡乐会的规则数量吗?`" @confirm="resetSetting">
<template #reference>
<el-button type="primary">
重置数量
</el-button>
</template>
</el-popconfirm>
<el-button type="primary" @click="setting">
设置规则
</el-button>
</template>
<template v-slot="{ size, dynamicColumns }">
<pure-table ref="tableRef" align-whole="center" showOverflowTooltip table-layout="auto" default-expand-all
:loading="loading" :size="size" row-key="id" adaptive :adaptiveConfig="{ offsetBottom: 108 }"
:data="tableList" :columns="dynamicColumns" :pagination="{ ...pagination, size }" :header-cell-style="{
background: 'var(--el-fill-color-light)',
color: 'var(--el-text-color-primary)'
}" @page-current-change="handleCurrentChange" @page-size-change="handleSizeChange">
<template #operation="{ row }">
<el-button link type="primary" :size="size" @click="openDialog('编辑', row)">
编辑
</el-button>
<el-popconfirm :title="`是否确认删除礼物名称为【${row.gift_name}】的这条数据`" @confirm="handleDelete(row)">
<template #reference>
<el-button link type="primary" :size="size"> 删除 </el-button>
</template>
</el-popconfirm>
</template>
</pure-table>
</template>
</PureTableBar>
</div>
</div>
</template>
<style scoped lang="scss">
.content {
width: 100%;
background-color: #fff;
padding: 20px;
}
.content-flex {
width: 100%;
display: inline-flex;
background-color: #fff;
padding: 20px;
text-align: center;
align-items: center;
justify-content: space-between
}
</style>

View File

@@ -0,0 +1,143 @@
<script setup lang="ts">
import { ref, onMounted } from "vue";
import RichText from '@/components/RichText/index.vue';
import { queryGiftByTypeList, queryBoxTypeList } from '@/api/modules/blindBox'
const ruleFormRef = ref();
const typeList = ref([]);
const boxTypeList = ref([]);
const formRules = ref({
gift_id: [{ required: true, message: "请选择礼物", trigger: "change" }],
introd: [{ required: true, message: "请输入玩法介绍", trigger: "blur" }],
description: [{ required: true, message: "请输入说明", trigger: "blur" }]
});
const props = defineProps(["formInline"]);
const newFormInline = ref(
props.formInline
? props.formInline
: {
introd: "",
inlet_bag_id: "",
waiting_start_num: "",
start_num: "",
selected_gift_id: "",
locking_gift_id: "",
give_homeowner_gift_id: "",
end_time: "",
tow_no_locking_time: "",
next_time: "",
price: ""
}
);
function getRef() {
return ruleFormRef.value;
}
const getList = async () => {
const { data, code } = await queryGiftByTypeList({ type: 2, label: 6 })
typeList.value = code ? data : []
}
const getTypeList = async () => {
const { data, code } = await queryBoxTypeList({ activities_id: 5 })
boxTypeList.value = code ? data : []
}
function chanageEditorValue(val) {
newFormInline.value.introd = val
}
onMounted(() => {
getList()
getTypeList()
})
defineExpose({ getRef });
</script>
<template>
<el-form ref="ruleFormRef" :model="newFormInline" :rules="formRules" label-width="150px">
<el-form-item label="巡乐会入口" prop="inlet_bag_id">
<el-select v-model="newFormInline.inlet_bag_id" placeholder="请选择礼物">
<el-option v-for="item in boxTypeList" :key="item.id" :label="item.name" :value="item.id">
</el-option>
</el-select>
</el-form-item>
<el-form-item label="巡乐会开启条件">
<div class="flex">
<div>等待开始</div>
<div class="ml-2 mr-2"><el-input placeholder="请输入" v-model="newFormInline.waiting_start_num">
</el-input></div>
<div></div>
<div>正式开始</div>
<div class="ml-2 mr-2"><el-input placeholder="请输入" v-model="newFormInline.start_num">
</el-input></div>
<div></div>
</div>
</el-form-item>
<el-form-item label="巡乐会锁定礼物条件">
<div class="rule-text">
<span class="text-part">抽出礼物
</span>
<el-select class="input-number" style="min-width: 220px;" v-model="newFormInline.selected_gift_id"
placeholder="请选择礼物">
<el-option v-for="item in typeList" :key="item.gid" :label="item.gift_name" :value="item.gid">
</el-option>
</el-select>
<span class="text-part">锁定礼物
</span>
<el-select class="input-number" style="min-width: 220px;" v-model="newFormInline.locking_gift_id"
placeholder="请选择礼物">
<el-option v-for="item in typeList" :key="item.gid" :label="item.gift_name" :value="item.gid">
</el-option>
</el-select>
<span class="text-part">赠送房主礼物
</span>
<el-select class="input-number" style="min-width: 220px;" v-model="newFormInline.give_homeowner_gift_id"
placeholder="请选择礼物">
<el-option v-for="item in typeList" :key="item.gid" :label="item.gift_name" :value="item.gid">
</el-option>
</el-select>
</div>
</el-form-item>
<el-form-item label="巡乐会锁定时间">
<div class="rule-text">
<span class="text-part">巡乐会正式开始后</span>
<el-input-number class="input-number" v-model="newFormInline.end_time" :min="0" label="时长分钟"></el-input-number>
<span class="text-part">时长分钟没有人锁定话就结束掉首次锁定后
</span>
<el-input-number class="input-number" v-model="newFormInline.tow_no_locking_time" :min="0"
label="时长分钟"></el-input-number>
<span class="text-part">没有人在锁定锁定礼物直接掉落到首次锁定用户的背包如果有二次锁定则每次减少
</span>
<el-input-number class="input-number" v-model="newFormInline.next_time" :min="0" label="时长分钟"></el-input-number>
<span class="text-part">重新等待再次锁定具体倒计时规则操控右侧的表格
</span>
</div>
</el-form-item>
<el-form-item label="价格设置" prop="price">
<div class="rule-text">
<span class="text-part">单次抽奖</span>
<el-input-number class="input-number" v-model="newFormInline.price" :min="0" label=""></el-input-number>
<span class="text-part">金币</span>
</div>
</el-form-item>
<el-form-item label="玩法介绍" prop="introd">
<RichText style="border: 1px solid #ccc;" :echoValue="newFormInline.introd" @changeValue="chanageEditorValue">
</RichText>
</el-form-item>
</el-form>
</template>
<style scoped lang="scss">
.rule-text {
display: flex;
flex-wrap: wrap;
align-items: center;
// line-height: 3;
}
.rule-text .text-part {
white-space: nowrap;
margin-right: 5px;
}
.input-number {
margin: 0 8px;
width: 120px !important;
// margin-bottom: 12px;
}
</style>

View File

@@ -0,0 +1,26 @@
<script setup lang="ts">
import { ref, onMounted } from "vue";
import statisticsView from './statistics.vue'
import lotteryView from './lotteryResults.vue'
const props = defineProps(["roomDetail"]);
console.log(props.roomDetail.room_id)
const activeList = ref([{ index: 0, name: '转盘统计' }, { index: 1, name: '开奖记录' }])
const activeIndex = ref(0)
const changeIndex = (data) => {
activeIndex.value = data.index
}
</script>
<template>
<div class="viewPage">
<el-row>
<el-button @click="changeIndex(ele)" :type="activeIndex === ele.index ? 'primary' : ''" v-for="ele in activeList"
:key="ele.index">{{
ele.name }}</el-button>
</el-row>
<div>
<statisticsView v-if="activeIndex === 0" :roomId="props.roomDetail.room_id" />
<lotteryView v-else :roomId="props.roomDetail.room_id"></lotteryView>
</div>
</div>
</template>

View File

@@ -0,0 +1,182 @@
<script setup lang="ts">
// 开奖记录
import { ref, onMounted, nextTick } from "vue";
import SearchForm from "@/components/SearchForm/index.vue";
import {
queryBoxTypeList
} from "@/api/modules/blindBox";
import {
queryTurntableRecord
} from "@/api/modules/room";
const searchLabel = ref([
{
label: "盲盒礼包",
prop: "gift_bag_id",
type: "select",
optionList: []
},
{ label: "用户ID", prop: "user_id", type: "input" },
{ label: "礼物ID", prop: "gift_id", type: "input" },
{ label: "开奖期数", prop: "periods", type: "input" },
{ label: "开始时间", prop: "stime", type: "date" },
{ label: "结束时间", prop: "etime", type: "date" }
]);
const props = defineProps(["roomId"]);
const typeList = ref([])
const searchForm = ref({
gift_bag_id: "",
user_id: "",
gift_id: "",
periods: "",
stime: "",
etime: ""
});
const pagination = ref({
total: 0,
pageSize: 10,
currentPage: 1,
background: true
});
const statisticsData = ref()
const tableList = ref([])
const statisticsList = ref([
{ label: "总抽奖次数", prop: "total" },
{ label: "总抽奖金额(支出)", prop: "total_money" },
{
label: "总礼物价值(收入)", prop: "total_gift_money"
},
{ label: "统计(收入/支出)", prop: "ratio", tip: "%" },
{ label: "盈亏(收入-支出)", prop: "profit_loss" },
{ label: "盈亏比(盈亏/支出)", prop: "profit_loss_ratio", tip: "%" },
])
const dynamicflowColumns = ref([
{
label: "ID",
prop: "id"
},
{
label: "盲盒转盘类型",
prop: "gift_bag_type"
},
{
label: "期数",
prop: "periods"
},
{
label: "开奖人ID",
prop: "user_name"
},
{
label: "支付价格",
prop: "gift_price"
},
{
label: "礼物ID",
prop: "gift_id"
},
{
label: "礼物名称",
prop: "gift_name"
},
{
label: "礼物价格",
prop: "gift_price"
},
{
label: "接收人ID",
prop: "gift_user_name"
},
{
label: "创建时间",
prop: "createtime"
}
])
const getType = async () => {
const { code, data } = await queryBoxTypeList({ activities_id: 5 })
typeList.value = code ? data.map(ele => {
return {
label: ele.name,
value: ele.id
}
}) : []
if (code) {
searchLabel.value[0].optionList = typeList.value
searchForm.value.gift_bag_id = data[0].id
nextTick(() => {
getData(searchForm.value)
})
}
}
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 ? '是' : '否',
}
});
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)
};
const handleCurrentChange = (val: number) => {
pagination.value.currentPage = val;
getData(searchForm.value)
};
onMounted(() => {
getType()
})
</script>
<template>
<div class="viewPage" v-if="typeList && typeList.length">
<SearchForm class="pb-2 mt-2" :LabelList="searchLabel" :formData="searchForm" @handleSearch="getData" />
<div class="content-flex" v-if="statisticsData">
<div class="box" v-for="(ele, index) in statisticsList">
<el-statistic :precision="2" decimal-separator="." :value="statisticsData[ele.prop] || 0"
:suffix="ele.tip || ''" :title="ele.label"></el-statistic>
<span></span>
</div>
</div>
<pure-table class="mt-5" ref="tableRef" align-whole="center" showOverflowTooltip table-layout="auto"
default-expand-all row-key="id" :adaptiveConfig="{ offsetBottom: 108 }" :data="tableList"
:columns="dynamicflowColumns" :pagination="{ ...pagination }" :header-cell-style="{
background: 'var(--el-fill-color-light)',
color: 'var(--el-text-color-primary)'
}" @page-current-change="handleCurrentChange" @page-size-change="handleSizeChange">
</pure-table>
</div>
</template>
<style lang="scss" scoped>
.content {
width: 100%;
background-color: #fff;
padding: 20px;
}
.content-flex {
width: 100%;
display: inline-flex;
background-color: #f5f5f5;
padding: 20px;
margin-top: 20px;
margin-bottom: 20px;
text-align: center;
align-items: center;
justify-content: space-between
}
</style>

View File

@@ -0,0 +1,217 @@
<script setup lang="ts">
import { ref, onMounted, nextTick } from "vue";
import SearchForm from "@/components/SearchForm/index.vue";
import { message } from "@/utils/message";
import {
queryBoxTypeList,
resetBlindBoxRule
} from "@/api/modules/blindBox";
import {
queryTurntableList
} from "@/api/modules/room";
const searchLabel = ref([
{
label: "盲盒礼包",
prop: "gift_bag_id",
type: "select",
optionList: []
},
{ label: "礼物ID", prop: "gift_id", type: "input" },
{ label: "礼物名称", prop: "gift_name", type: "input" }
]);
const props = defineProps(["roomId"]);
const typeList = ref([])
const searchForm = ref({
gift_bag_id: "",
gift_id: "",
gift_name: ""
});
const pagination = ref({
total: 0,
pageSize: 10,
currentPage: 1,
background: true
});
const statisticsData = ref({})
const tableList = ref([])
const statisticsList = ref([
{ label: "当前期数", prop: "blind_box_turntable_periods" },
{ label: "每期总次数", prop: "total_count" },
{
label: "每期总礼物价值(收入)", prop: "total_price"
},
{ label: "每期总抽奖花费(支出)", prop: "total_cost" },
{ label: "每期统计(收入/支出)", prop: "profit_loss_ratio", tip: "%" },
{ label: "今日抽奖人数", prop: "today_count_user" },
{ label: "今日抽奖次数", prop: "today_total_count" },
{
label: "今日抽奖收入", prop: "today_total_price"
},
])
const dynamicflowColumns = ref([
{
label: "当前期数",
prop: ""
},
{
label: "ID",
prop: "id"
},
{
label: "礼物ID",
prop: "gift_id"
},
{
label: "礼物名称",
prop: "gift_name"
},
{
label: "封面图",
prop: "base_image"
},
{
label: "价格",
prop: "gift_price"
},
{
label: "多少次后参与抽奖",
prop: "weight"
},
{
label: "设定数量",
prop: "quantity"
},
{
label: "未开数量",
prop: "remaining_number"
},
// {
// label: "排序",
// prop: "content"
// },
{
label: "公屏播报",
prop: "is_public_screen"
},
{
label: "全服播报",
prop: "is_public_server"
},
{
label: "参与榜单显示",
prop: "is_world_show"
},
{
label: "本期开始时间",
prop: "createtime"
}
])
const getType = async () => {
const { code, data } = await queryBoxTypeList({ activities_id: 5 })
typeList.value = code ? data.map(ele => {
return {
label: ele.name,
value: ele.id
}
}) : []
if (code) {
searchLabel.value[0].optionList = typeList.value
searchForm.value.gift_bag_id = data[0].id
nextTick(() => {
getData(searchForm.value)
})
}
}
const getData = async (formData) => {
searchForm.value = { ...formData }
const { data, code } = await queryTurntableList({
...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 ? '是' : '否',
}
});
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)
};
const handleCurrentChange = (val: number) => {
pagination.value.currentPage = val;
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)
}
}
onMounted(() => {
getType()
})
</script>
<template>
<div class="viewPage" v-if="typeList && typeList.length">
<SearchForm class="pb-2 pt-2" :LabelList="searchLabel" :formData="searchForm" @handleSearch="getData" />
<div class="content-flex">
<div class="box" v-for="(ele, index) in statisticsList">
<el-statistic :precision="2" decimal-separator="." :value="statisticsData[ele.prop] || 0"
:suffix="ele.tip || ''" :title="ele.label"></el-statistic>
<span></span>
</div>
</div>
<div style="display: inline-flex;justify-content: flex-end;width: 100%;">
<el-popconfirm :title="`是否重置当前转盘数量吗?`" @confirm="resetSetting">
<template #reference>
<el-button type="primary">
重置数量
</el-button>
</template>
</el-popconfirm>
</div>
<pure-table class="mt-5" ref="tableRef" align-whole="center" showOverflowTooltip table-layout="auto"
default-expand-all row-key="id" :adaptiveConfig="{ offsetBottom: 108 }" :data="tableList"
:columns="dynamicflowColumns" :pagination="{ ...pagination }" :header-cell-style="{
background: 'var(--el-fill-color-light)',
color: 'var(--el-text-color-primary)'
}" @page-current-change="handleCurrentChange" @page-size-change="handleSizeChange">
</pure-table>
</div>
</template>
<style lang="scss" scoped>
.content {
width: 100%;
background-color: #fff;
padding: 20px;
}
.content-flex {
width: 100%;
display: inline-flex;
background-color: #f5f5f5;
padding: 20px;
margin-top: 20px;
margin-bottom: 20px;
text-align: center;
align-items: center;
justify-content: space-between
}
</style>

View File

@@ -0,0 +1,143 @@
<script setup lang="ts">
// 开奖记录
import { ref, onMounted, nextTick } from "vue";
import SearchForm from "@/components/SearchForm/index.vue";
import {
queryBoxTypeList
} from "@/api/modules/blindBox";
import {
queryLockRecord
} 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" },
]);
const props = defineProps(["roomId"]);
const typeList = ref([])
const searchForm = ref({
user_id: "",
gift_id: "",
periods: ""
});
const pagination = ref({
total: 0,
pageSize: 10,
currentPage: 1,
background: true
});
const statisticsData = ref()
const tableList = ref([])
const statisticsList = ref([
{ label: "今日锁定次数", prop: "locking_num" }
])
const dynamicflowColumns = ref([
{
label: "ID",
prop: "id"
},
{
label: "期数",
prop: "periods"
},
{
label: "锁定ID",
prop: "user"
},
{
label: "支付价格",
prop: "pay_price"
},
{
label: "礼物ID",
prop: "gift_id"
},
{
label: "礼物名称",
prop: "gift_name"
},
{
label: "礼物价格",
prop: "gift_price"
},
{
label: "锁定数量",
prop: "locking_num"
},
{
label: "是否收入背包",
prop: "is_send_str"
},
{
label: "创建时间",
prop: "createtime"
}
])
const getData = async (formData) => {
searchForm.value = { ...formData }
const { data, code } = await queryLockRecord({
...formData,
page: pagination.value.currentPage,
page_limit: pagination.value.pageSize,
room_id: props.roomId
})
if (code) {
tableList.value = data.lists
statisticsData.value = {
locking_num: data.locking_num
}
pagination.value.total = data.count;
pagination.value.currentPage = data.page;
}
}
const handleSizeChange = (val: number) => {
pagination.value.pageSize = val;
getData(searchForm.value)
};
const handleCurrentChange = (val: number) => {
pagination.value.currentPage = val;
getData(searchForm.value)
};
onMounted(() => {
getData(searchForm.value)
// getType()
})
</script>
<template>
<div class="viewPage">
<div class="content-flex" v-if="statisticsData">
<div class="box" v-for="(ele, index) in statisticsList">
<el-statistic :precision="2" decimal-separator="." :value="statisticsData[ele.prop] || 0"
:suffix="ele.tip || ''" :title="ele.label"></el-statistic>
<span></span>
</div>
</div>
<SearchForm class="pb-2" :LabelList="searchLabel" :formData="searchForm" @handleSearch="getData" />
<pure-table class="mt-5" ref="tableRef" align-whole="center" showOverflowTooltip table-layout="auto"
default-expand-all row-key="id" :adaptiveConfig="{ offsetBottom: 108 }" :data="tableList"
:columns="dynamicflowColumns" :pagination="{ ...pagination }" :header-cell-style="{
background: 'var(--el-fill-color-light)',
color: 'var(--el-text-color-primary)'
}" @page-current-change="handleCurrentChange" @page-size-change="handleSizeChange">
</pure-table>
</div>
</template>
<style lang="scss" scoped>
.content {
width: 100%;
background-color: #fff;
padding: 20px;
}
.content-flex {
width: 100%;
display: inline-flex;
background-color: #f5f5f5;
padding: 20px;
margin-top: 20px;
margin-bottom: 20px;
text-align: center;
align-items: center;
justify-content: center;
}
</style>

View File

@@ -0,0 +1,26 @@
<script setup lang="ts">
import { ref } from "vue";
import statisticsView from './statistics.vue'
import lotteryView from './Results.vue'
const props = defineProps(["roomDetail"]);
console.log(props.roomDetail.room_id)
const activeList = ref([{ index: 0, name: '开奖统计' }, { index: 1, name: '锁定记录' }])
const activeIndex = ref(0)
const changeIndex = (data) => {
activeIndex.value = data.index
}
</script>
<template>
<div class="viewPage">
<el-row>
<el-button @click="changeIndex(ele)" :type="activeIndex === ele.index ? 'primary' : ''" v-for="ele in activeList"
:key="ele.index">{{
ele.name }}</el-button>
</el-row>
<div>
<statisticsView v-if="activeIndex === 0" :roomId="props.roomDetail.room_id" />
<lotteryView v-else :roomId="props.roomDetail.room_id"></lotteryView>
</div>
</div>
</template>

View File

@@ -0,0 +1,176 @@
<script setup lang="ts">
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";
const searchLabel = ref([
{ label: "用户ID", prop: "gift_id", type: "input" },
{ label: "开奖期数", prop: "gift_name", type: "input" },
{ label: "礼物ID", prop: "gift_name", type: "input" },
{ label: "房间ID", prop: "gift_name", type: "input" },
{ label: "类型", prop: "gift_name", type: "input" }
]);
const props = defineProps(["roomId"]);
const searchForm = ref({
gift_bag_id: 13,
gift_id: "",
gift_name: ""
});
const pagination = ref({
total: 0,
pageSize: 10,
currentPage: 1,
background: true
});
const statisticsData = ref()
const tableList = ref([])
const statisticsList = ref([
{ label: "总抽奖次数", prop: "total" },
{ label: "总抽奖金额(支出)", prop: "total_money" },
{
label: "总礼物价值(收入)", prop: "total_gift_money"
},
{ label: "统计(收入/支出)", prop: "ratio", tip: "%" },
{ label: "盈亏(收入-支出)", prop: "profit_loss" },
{ label: "盈亏比(盈亏/支出)", prop: "profit_loss_ratio", tip: "%" },
])
const dynamicflowColumns = ref([
{
label: "ID",
prop: "id"
},
{
label: "期数",
prop: "periods"
},
{
label: "开奖人ID",
prop: "user_name"
},
{
label: "支付价格",
prop: "bag_price"
},
{
label: "礼物ID",
prop: "gift_id"
},
{
label: "礼物名称",
prop: "gift_name"
},
{
label: "礼物价格",
prop: "gift_price"
},
{
label: "抽中数量",
prop: "gift_num"
},
{
label: "创建时间",
prop: "createtime"
}
])
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 ? '是' : '否',
}
});
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)
};
const handleCurrentChange = (val: number) => {
pagination.value.currentPage = val;
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)
}
}
onMounted(() => {
getData(searchForm.value)
// getType()
})
</script>
<template>
<div class="viewPage">
<div class="content-flex" v-if="statisticsData">
<div class="box" v-for="(ele, index) in statisticsList">
<el-statistic :precision="2" decimal-separator="." :value="statisticsData[ele.prop] || 0"
:suffix="ele.tip || ''" :title="ele.label"></el-statistic>
<span></span>
</div>
</div>
<div style="display: inline-flex;justify-content: space-between;align-items: center;width: 100%;">
<SearchForm class="pb-2" :LabelList="searchLabel" :formData="searchForm" @handleSearch="getData" />
<el-popconfirm :title="`是否重置当前巡乐会数量吗?`" @confirm="resetSetting">
<template #reference>
<el-button type="primary" style="margin-bottom: 18px;">
重置数量
</el-button>
</template>
</el-popconfirm>
</div>
<pure-table class="mt-5" ref="tableRef" align-whole="center" showOverflowTooltip table-layout="auto"
default-expand-all row-key="id" :adaptiveConfig="{ offsetBottom: 108 }" :data="tableList"
:columns="dynamicflowColumns" :pagination="{ ...pagination }" :header-cell-style="{
background: 'var(--el-fill-color-light)',
color: 'var(--el-text-color-primary)'
}" @page-current-change="handleCurrentChange" @page-size-change="handleSizeChange">
</pure-table>
</div>
</template>
<style lang="scss" scoped>
.content {
width: 100%;
background-color: #fff;
padding: 20px;
}
.content-flex {
width: 100%;
display: inline-flex;
background-color: #f5f5f5;
padding: 20px;
margin-top: 20px;
margin-bottom: 20px;
text-align: center;
align-items: center;
justify-content: space-between
}
</style>

View File

@@ -45,7 +45,8 @@ const newFormInline = ref(
is_room_password: "",
room_password: "",
is_robot_num: "",
robot_num: ""
robot_num: "",
is_open_blind_box_turntable: ""
}
);
function getRef() {
@@ -69,7 +70,7 @@ defineExpose({ getRef });
<template>
<!-- :rules="formRules" -->
<el-form ref="ruleFormRef" :model="newFormInline" label-width="120px">
<el-form ref="ruleFormRef" :model="newFormInline" label-width="150px">
<!-- <el-form-item label="厅主ID" prop="admin_id">
<el-input v-model="newFormInline.admin_id" disabled clearable placeholder="请输入厅主ID" />
</el-form-item>
@@ -132,6 +133,12 @@ defineExpose({ getRef });
<el-radio :label="3">关闭</el-radio>
</el-radio-group>
</el-form-item>
<el-form-item label="是否开启盲盒转盘" prop="is_open_blind_box_turntable">
<el-radio-group v-model="newFormInline.is_open_blind_box_turntable">
<el-radio :label="1"></el-radio>
<el-radio :label="0"></el-radio>
</el-radio-group>
</el-form-item>
<el-form-item label="是否显示房间" prop="is_show_room">
<el-radio-group v-model="newFormInline.is_show_room">
<el-radio :label="1"></el-radio>

View File

@@ -1,6 +1,8 @@
import { ref, h, nextTick } from "vue";
import editForm from "./form.vue";
import detailView from './detail.vue'
import detailView from './detail.vue';
import TurntableView from './Turntable/Turntable.vue';
import XunLeHuiView from './XunLeHui/index.vue';
import { message } from "@/utils/message";
import {
queryList,
@@ -105,7 +107,7 @@ export function useData() {
{
label: "操作",
fixed: "right",
width: 200,
width: 300,
slot: "operation"
}
]);
@@ -169,7 +171,8 @@ export function useData() {
is_room_password: data?.is_room_password ?? "",
room_password: data?.room_password ?? "",
is_robot_num: data?.is_robot_num ?? "",
robot_num: data?.robot_num ?? ""
robot_num: data?.robot_num ?? "",
is_open_blind_box_turntable: data?.is_open_blind_box_turntable ?? "",
}
},
width: "40%",
@@ -210,6 +213,35 @@ export function useData() {
}
};
// 获取房间盲盒转盘统计
const viewTurntableData = (data) => {
nextTick(() => {
addDialog({
title: `盲盒转盘统计`,
props: {
roomDetail: data,
},
fullscreen: true,
hideFooter: true,
closeOnClickModal: false,
contentRenderer: () => h(TurntableView, { ref: formRef, formInline: null })
});
})
}
const viewXunLeHuiData = (data) => {
nextTick(() => {
addDialog({
title: `巡乐会数据统计`,
props: {
roomDetail: data,
},
fullscreen: true,
hideFooter: true,
closeOnClickModal: false,
contentRenderer: () => h(XunLeHuiView, { ref: formRef, formInline: null })
});
})
}
return {
searchForm,
searchLabel,
@@ -222,6 +254,8 @@ export function useData() {
handleCurrentChange,
loading,
viewDetail,
editDialog
editDialog,
viewTurntableData,
viewXunLeHuiData
};
}

View File

@@ -17,8 +17,10 @@ const {
handleSizeChange,
handleCurrentChange,
viewDetail,
viewTurntableData,
loading,
editDialog
editDialog,
viewXunLeHuiData
} = useData();
defineOptions({
name: "roomList"
@@ -48,6 +50,14 @@ onMounted(() => {
color: 'var(--el-text-color-primary)'
}" @page-current-change="handleCurrentChange" @page-size-change="handleSizeChange">
<template #operation="{ row }">
<el-button type="primary" v-if="row.is_open_blind_box_turntable_str === '是'" link :size="size"
@click="viewTurntableData(row)">
转盘统计
</el-button>
<el-button @click="viewXunLeHuiData(row)" type="primary"
v-if="row.is_open_blind_box_turntable_str === '是'" link :size="size">
巡乐会统计
</el-button>
<el-button link type="primary" :size="size" @click="viewDetail('查看', row)">
查看
</el-button>

View File

@@ -25,9 +25,11 @@ export default ({ mode }: ConfigEnv): UserConfigExport => {
host: "0.0.0.0",
// 本地跨域代理 https://cn.vitejs.dev/config/server-options.html#server-proxy
proxy: {
// http://md.qxmier.com/ 测试API
// http://chat.qxmier.com 正式API
"/adminapi": {
// 这里填写后端地址
target: "https://chat.qxmier.com",
target: "http://md.qxmier.com",
changeOrigin: true
}
},