zsk 10 months ago
parent bbeda9e09f
commit d2b82cba13

Binary file not shown.

@ -0,0 +1,52 @@
import request from "../utils/request";
// 获取彩票列表
export function getLotteryListApi(page, limit, classify) {
return request({
url: `/admin/lottery/${page}/${limit}?classify=${classify}`,
method: "get",
})
}
// 获取今日开奖通告
export function getTodayLotteryApi() {
return request({
url: `/admin/lottery/last`,
method: "get",
})
}
// 获取彩票详情
export function getLotteryDetailApi(id) {
return request({
url: `/admin/lottery/get/${id}`,
method: "get",
})
}
// 删除彩票记录
export function deleteLotteryApi(id) {
return request({
url: `/admin/lottery/remove/${id}`,
method: "delete",
})
}
// 保存彩票记录
export function saveLotteryApi(data) {
return request({
url: `/admin/lottery/save`,
method: "post",
data,
})
}
// 更新彩票记录
export function updateLotteryApi(data) {
return request({
url: `/admin/lottery/update`,
method: "put",
data,
})
}

@ -119,7 +119,12 @@ onMounted(() => {
case "content":
items.push(getItem(item.title, item.id, item.component, () => h(SettingOutlined)));
break;
case "gameManagement":
items.push(getItem(item.title, item.id, item.component, () => h(AccountBookOutlined)));
break;
case "winningInformation":
items.push(getItem(item.title, item.id, item.component, () => h(AuditOutlined)));
break;
case "ServiceMarket":
items.push(getItem(item.title, item.id, item.component, () => h(SketchOutlined)));
break;

@ -63,6 +63,22 @@ const router = createRouter({
title: '内容管理',
},
component: () => import("../views/message/content.vue")
},
{
path: "/merchantManagement/winningInformation",
name: "winningInformation",
meta: {
title: '开奖信息',
},
component: () => import("../views/message/winningInformation.vue")
},
{
path: "/merchantManagement/gameManagement",
name: "gameManagement",
meta: {
title: '笔记',
},
component: () => import("../views/message/gameManagement.vue")
}
// ,{
// path: "/merchantManagement/record",

@ -110,7 +110,60 @@ export let mockMenuList = {
"exportTag": 0,
"childrenList": []
},
{
"id": 51,
"creator": "",
"updator": "",
"createTime": "",
"updateTime": "",
"deleted": 0,
"title": "笔记",
"menuName": "gameManagement",
"parentName": "",
"path": "gameManagement",
"component": "/merchantManagement/gameManagement.vue",
"visible": 0,
"perms": "",
"icon": "icon-houtaishouye",
"remark": "",
"parentId": "",
"tagNames": "queryTag,addTag,updateTag,deleteTag",
"idx": 10,
"queryTag": 0,
"addTag": 0,
"deleteTag": 0,
"updateTag": 0,
"importTag": 0,
"exportTag": 0,
"childrenList": []
},
{
"id": 52,
"creator": "",
"updator": "",
"createTime": "",
"updateTime": "",
"deleted": 0,
"title": "开奖信息",
"menuName": "winningInformation",
"parentName": "",
"path": "winningInformation",
"component": "/merchantManagement/winningInformation.vue",
"visible": 0,
"perms": "",
"icon": "icon-houtaishouye",
"remark": "",
"parentId": "",
"tagNames": "queryTag,addTag,updateTag,deleteTag",
"idx": 10,
"queryTag": 0,
"addTag": 0,
"deleteTag": 0,
"updateTag": 0,
"importTag": 0,
"exportTag": 0,
"childrenList": []
},
{
"id": 1,
"creator": "",

@ -173,7 +173,7 @@ const handleModalOk = async () => {
title: formState.title,
content: formState.classify === 1 ? '' : formState.content,
img: processImagePath(formState.img),
status: formState.status,
status: formState.status ? 1 : 0,
};
if (modalMode.value === 'add') {
await saveContentApi(data);

@ -0,0 +1,207 @@
<template>
<div class="game-management">
<a-tabs v-model:activeKey="activeTab">
<a-tab-pane v-for="type in gameTypes" :key="type.key" :tab="type.label">
<a-table :columns="columns" :data-source="filteredData" :rowKey="record => record.id">
<template #bodyCell="{ column, record }">
<template v-if="column.key === 'action'">
<a-space>
<a-button type="link" @click="editItem(record)"></a-button>
<a-button type="link" @click="deleteItem(record)"></a-button>
</a-space>
</template>
</template>
</a-table>
</a-tab-pane>
<template #rightExtra>
<a-button type="primary" @click="showAddModal"></a-button>
</template>
</a-tabs>
<a-modal
v-model:visible="modalVisible"
:title="(modalMode === 'add' ? '新增' : '编辑') + currentGameTypeLabel"
@ok="handleModalOk"
@cancel="handleModalCancel"
width="600px"
>
<a-form :model="formState" :label-col="{ span: 6 }" :wrapper-col="{ span: 18 }">
<a-form-item label="日期" name="date" :rules="[{ required: true, message: '请选择日期' }]">
<a-date-picker v-model:value="formState.date" style="width: 100%" />
</a-form-item>
<a-form-item label="比赛" name="match" :rules="[{ required: true, message: '请输入比赛' }]">
<a-input v-model:value="formState.match" />
</a-form-item>
<a-form-item label="玩法" name="playType" :rules="[{ required: true, message: '请输入玩法' }]">
<a-input v-model:value="formState.playType" />
</a-form-item>
<a-form-item label="方向" name="direction" :rules="[{ required: true, message: '请输入方向' }]">
<a-input v-model:value="formState.direction" />
</a-form-item>
<a-form-item label="SP值" name="spValue" :rules="[{ required: true, message: '请输入SP值' }]">
<a-input-number v-model:value="formState.spValue" :min="0" :step="0.01" style="width: 100%" />
</a-form-item>
</a-form>
</a-modal>
</div>
</template>
<script setup>
import { ref, reactive, computed, onMounted } from 'vue';
import { message } from 'ant-design-vue';
import dayjs from 'dayjs';
const gameTypes = [
{ key: 'julong_zhongaobei', label: '聚龙中高倍' },
{ key: 'julong_zongjinqiu', label: '聚龙总进球' },
{ key: 'julong_shibei', label: '聚龙十倍' },
{ key: 'julong_2', label: '聚龙2.0' },
{ key: 'julong_gaobei', label: '聚龙高倍' },
{ key: 'julong_lanqiu', label: '聚龙篮球' },
{ key: 'julong_3', label: '聚龙3.0' },
{ key: 'julong_pailie3', label: '聚龙排列三' },
{ key: 'julong_kuaile8', label: '聚龙快乐八' },
];
const activeTab = ref(gameTypes[0].key);
const modalVisible = ref(false);
const modalMode = ref('add');
const columns = [
{ title: '日期', dataIndex: 'date', key: 'date' },
{ title: '比赛', dataIndex: 'match', key: 'match' },
{ title: '玩法', dataIndex: 'playType', key: 'playType' },
{ title: '方向', dataIndex: 'direction', key: 'direction' },
{ title: 'SP值', dataIndex: 'spValue', key: 'spValue' },
{ title: '操作', key: 'action' },
];
const data = reactive({});
gameTypes.forEach(type => {
data[type.key] = [];
});
const formState = reactive({
id: null,
date: dayjs(),
match: '',
playType: '',
direction: '',
spValue: 0,
});
const filteredData = computed(() => {
return data[activeTab.value] || [];
});
const currentGameTypeLabel = computed(() => {
return gameTypes.find(type => type.key === activeTab.value)?.label || '';
});
const showAddModal = () => {
modalMode.value = 'add';
Object.assign(formState, {
id: null,
date: dayjs(),
match: '',
playType: '',
direction: '',
spValue: 0
});
modalVisible.value = true;
};
const editItem = (record) => {
modalMode.value = 'edit';
Object.assign(formState, {
...record,
date: dayjs(record.date),
});
modalVisible.value = true;
};
const deleteItem = async (record) => {
try {
// Implement API call to delete item
// await deleteGameApi(record.id);
const index = data[activeTab.value].findIndex(item => item.id === record.id);
if (index !== -1) {
data[activeTab.value].splice(index, 1);
}
message.success('删除成功');
} catch (error) {
message.error('删除失败');
}
};
const handleModalOk = async () => {
try {
const newData = {
...formState,
date: formState.date.format('YYYY-MM-DD'),
};
if (modalMode.value === 'add') {
// Implement API call to add item
// const response = await addGameApi(newData);
// newData.id = response.data.id;
newData.id = Date.now(); // Temporary ID for demonstration
data[activeTab.value].push(newData);
} else {
// Implement API call to update item
// await updateGameApi(newData);
const index = data[activeTab.value].findIndex(item => item.id === newData.id);
if (index !== -1) {
data[activeTab.value][index] = newData;
}
}
message.success(modalMode.value === 'add' ? '添加成功' : '编辑成功');
modalVisible.value = false;
} catch (error) {
message.error(modalMode.value === 'add' ? '添加失败' : '编辑失败');
}
};
const handleModalCancel = () => {
modalVisible.value = false;
};
const fetchData = async () => {
try {
// Implement API call to fetch data for each game type
// For now, we'll use mock data
gameTypes.forEach(type => {
data[type.key] = [
{
id: 1,
date: '2023-05-20',
match: '曼城 vs 切尔西',
playType: '让球',
direction: '主队',
spValue: 1.75,
},
{
id: 2,
date: '2023-05-21',
match: '利物浦 vs 阿森纳',
playType: '大小球',
direction: '大球',
spValue: 2.05,
},
];
});
} catch (error) {
message.error('获取数据失败');
}
};
onMounted(() => {
fetchData();
});
</script>
<style scoped>
.game-management {
padding: 24px;
}
</style>

@ -0,0 +1,221 @@
<template>
<div class="lottery-management">
<a-tabs v-model:activeKey="activeTab" @change="handleTabChange">
<a-tab-pane v-for="type in lotteryTypes" :key="type.key" :tab="type.label">
<a-table :columns="columns" :data-source="filteredData" :rowKey="record => record.recordId">
<template #bodyCell="{ column, record }">
<template v-if="column.key === 'numbers'">
<span>
{{ getFormattedNumbers(record) }}
</span>
</template>
<template v-if="column.key === 'action'">
<a-space>
<a-button type="link" @click="editItem(record)"></a-button>
<a-button type="link" @click="deleteItem(record)"></a-button>
</a-space>
</template>
</template>
</a-table>
</a-tab-pane>
<template #rightExtra>
<a-button type="primary" @click="showAddModal"></a-button>
</template>
</a-tabs>
<a-modal
v-model:visible="modalVisible"
:title="(modalMode === 'add' ? '新增' : '编辑') + currentLotteryTypeLabel"
@ok="handleModalOk"
@cancel="handleModalCancel"
width="800px"
>
<a-form :model="formState" :label-col="{ span: 6 }" :wrapper-col="{ span: 18 }">
<a-form-item label="日期" name="todayStr" :rules="[{ required: true, message: '请选择日期' }]">
<a-date-picker v-model:value="formState.todayStr" style="width: 100%" format="YYYY-MM-DD" />
</a-form-item>
<a-form-item label="期数" name="lotteryNo" :rules="[{ required: true, message: '请输入期数' }]">
<a-input v-model:value="formState.lotteryNo" placeholder="例如第250007期" />
</a-form-item>
<a-form-item v-for="i in currentLotteryType.blueCount" :key="`blue${i}`" :label="`蓝球${i}`" :name="`blue${i}`" :rules="[{ required: true, message: '请输入数字' }]">
<a-input-number v-model:value="formState[`blue${i}`]" :min="1" :max="99" />
</a-form-item>
<a-form-item v-for="i in currentLotteryType.redCount" :key="`red${i}`" :label="`红球${i}`" :name="`red${i}`" :rules="[{ required: true, message: '请输入数字' }]">
<a-input-number v-model:value="formState[`red${i}`]" :min="1" :max="99" />
</a-form-item>
</a-form>
</a-modal>
</div>
</template>
<script setup>
import { ref, reactive, computed, onMounted } from 'vue';
import { message } from 'ant-design-vue';
import dayjs from 'dayjs';
import { getLotteryListApi, deleteLotteryApi, saveLotteryApi, updateLotteryApi } from '../../api/lotteryConfig';
const lotteryTypes = [
{ key: 1, label: '超级大乐透', blueCount: 5, redCount: 2 },
{ key: 2, label: '双色球', blueCount: 6, redCount: 1 },
{ key: 3, label: '排列三', blueCount: 3, redCount: 0 },
{ key: 4, label: '排列五', blueCount: 5, redCount: 0 },
{ key: 5, label: '3D', blueCount: 3, redCount: 0 },
{ key: 6, label: '快乐八', blueCount: 20, redCount: 0 },
];
const activeTab = ref(lotteryTypes[0].key);
const modalVisible = ref(false);
const modalMode = ref('add');
const columns = [
{ title: '日期', dataIndex: 'today', key: 'today' },
{ title: '期数', dataIndex: 'lotteryNo', key: 'lotteryNo' },
{ title: '开奖号码', key: 'numbers', width: '300px' },
{ title: '操作', key: 'action' },
];
const data = reactive([]);
const formState = reactive({
recordId: null,
todayStr: '',
classify: 1,
lotteryNo: '',
});
for (let i = 1; i <= 20; i++) {
formState[`blue${i}`] = '';
}
for (let i = 1; i <= 5; i++) {
formState[`red${i}`] = '';
}
const filteredData = computed(() => {
return data.filter(item => item.classify === activeTab.value);
});
const currentLotteryType = computed(() => {
return lotteryTypes.find(type => type.key === activeTab.value) || lotteryTypes[0];
});
const currentLotteryTypeLabel = computed(() => {
return currentLotteryType.value.label;
});
const showAddModal = () => {
modalMode.value = 'add';
Object.assign(formState, {
recordId: null,
todayStr: dayjs(),
classify: activeTab.value,
lotteryNo: '',
});
for (let i = 1; i <= 20; i++) {
formState[`blue${i}`] = '';
}
for (let i = 1; i <= 5; i++) {
formState[`red${i}`] = '';
}
modalVisible.value = true;
};
const editItem = (record) => {
modalMode.value = 'edit';
Object.assign(formState, {
...record,
todayStr: dayjs(record.today),
});
modalVisible.value = true;
};
const deleteItem = async (record) => {
try {
await deleteLotteryApi(record.id);
message.success('删除成功');
fetchData();
} catch (error) {
message.error('删除失败');
}
};
const removeEmptyFields = (obj) => {
return Object.fromEntries(
Object.entries(obj).filter(([_, v]) => v !== '' && v !== null)
);
};
const handleModalOk = async () => {
try {
delete formState.today;
delete formState.createTime;
delete formState.isDeleted;
delete formState.updateTime;
delete formState.week;
let payload = {
...formState,
todayStr: formState.todayStr.format('YYYY-MM-DD'),
classify: activeTab.value,
recordId: formState.id,
};
payload = removeEmptyFields(payload);
if (modalMode.value === 'add') {
await saveLotteryApi(payload);
} else {
await updateLotteryApi(payload);
}
message.success(modalMode.value === 'add' ? '添加成功' : '编辑成功');
modalVisible.value = false;
fetchData();
} catch (error) {
message.error(modalMode.value === 'add' ? '添加失败' : '编辑失败');
}
};
const handleModalCancel = () => {
modalVisible.value = false;
};
const fetchData = async () => {
try {
const response = await getLotteryListApi(1, 100, activeTab.value);
data.splice(0, data.length, ...response.data.records.map(record => ({
...record,
today: dayjs(record.today).format('YYYY-MM-DD')
})));
} catch (error) {
message.error('获取数据失败');
}
};
const handleTabChange = (newActiveKey) => {
activeTab.value = newActiveKey;
fetchData();
};
onMounted(() => {
fetchData();
});
const getFormattedNumbers = (record) => {
const type = lotteryTypes.find(t => t.key === record.classify);
const numbers = [];
for (let i = 1; i <= type.blueCount; i++) {
if (record[`blue${i}`]) numbers.push(record[`blue${i}`]);
}
for (let i = 1; i <= type.redCount; i++) {
if (record[`red${i}`]) numbers.push(record[`red${i}`]);
}
return numbers.join(', ');
};
</script>
<style scoped>
.lottery-management {
padding: 24px;
}
</style>
Loading…
Cancel
Save