Browse Source

TODO活动删除+中奖查询

lihuilin/feature-20250718094329-25周年庆后台
wangxiangwen4 1 month ago
parent
commit
29527ddb37
  1. 62
      activitylink/src/api/manage/activity.js
  2. 6
      activitylink/src/api/manage/win.js
  3. 371
      activitylink/src/views/zhongchou/activity/detail/index.vue
  4. 124
      activitylink/src/views/zhongchou/activity/index.vue
  5. 393
      activitylink/src/views/zhongchou/activity/set/index.vue
  6. 2
      activitylink/src/views/zhongchou/winning/index.vue

62
activitylink/src/api/manage/activity.js

@ -34,7 +34,67 @@ export function getDetailList() {
return request({
url: '/admin/funding/getActivityDetail',
method: 'post',
})
}
export function getDetailListbyActivityId(data) {
return request({
url: '/admin/funding/getActivityDetail',
method: 'post',
data
})
}
export function getDetailMessage(activityId){
return request({
url: '/admin/funding/getActivityDate',
method: 'post',
params: { activityId }
})
}
export function showsetDetail(activityId){
return request({
url: '/admin/funding/getDate',
method: 'post',
params: { activityId }
})
}
export function showaddDetail(activityId,stock,addTotal){
return request({
url: '/admin/funding/addDateVirtual',
method: 'post',
params: { activityId,stock,addTotal }
})
}
export function setTime(activityId,time){
return request({
url: '/admin/funding/setActivityTime',
method: 'post',
params: { activityId,time }
})
}
export function getMarket(){
return request({
url: '/admin/funding/getMarketList',
method: 'get',
})
}
export function deleteActivityById(activityId)
{
return request({
url: 'activityId/admin/funding/deleteActivity',
method: 'post',
params: { activityId }
})
}

6
activitylink/src/api/manage/win.js

@ -1,9 +1,9 @@
import request from '@/utils/request'
export function deleteUser(id) {
export function getWinList(data) {
return request({
url: '/admin/user/delete',
url: '/admin/win/list',
method: 'post',
params: { id }
data
})
}

371
activitylink/src/views/zhongchou/activity/detail/index.vue

@ -1,63 +1,58 @@
<!-- 美股是0 港股是1 精网号现在用的是字符串类型-->
<template>
<el-card style="margin-top:50px ; min-height: 90vh; max-height: 90vh;">
<div class="gray-container">
<el-button type="primary" @click="goBack">
<i class="el-icon-back"></i> 返回
<i class="el-icon-back"></i> 返回
</el-button>
<!-- 顶部信息栏 -->
<div class="info-bar">
当前总参与人数{{ totalParticipants }} &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
参与美股总人数{{ usParticipants }} &nbsp;&nbsp;&nbsp;&nbsp; 美股助力总次数{{ usAssists }} &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
参与港股总人数{{ hkParticipants }} &nbsp;&nbsp;&nbsp;&nbsp; 港股助力总次数{{ hkAssists }} &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
</div>
<!-- 顶部信息栏 -->
<div class="info-bar">
当前总参与人数{{ totalParticipants }} &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
参与{{marketOneLabel}}总人数{{ usParticipants }} &nbsp;&nbsp;&nbsp;&nbsp; {{marketOneLabel}}助力总次数{{ usAssists }} &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
参与{{marketTwoLabel}}总人数{{ hkParticipants }} &nbsp;&nbsp;&nbsp;&nbsp; {{marketTwoLabel}}助力总次数{{ hkAssists }} &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
当前活动id{{ activityStone.selectactivityId }}
</div>
<!-- 搜索栏 -->
<el-form :inline="true" class="search-bar">
<el-form-item label="姓名">
<el-input v-model="searchdata.name" placeholder="请输入姓名"></el-input>
</el-form-item>
<el-form-item label="精网号">
<el-input v-model="searchdata.jingwangId" placeholder="请输入精网号" @input="handleJingwangIdInput"></el-input>
</el-form-item>
<el-form-item label="市场" class="market-item">
<el-select v-model="searchdata.market" placeholder="请选择" class="market-select">
<el-option label="全部" value="0"></el-option>
<el-option label="美股" value="1"></el-option>
<el-option label="港股" value="2"></el-option>
</el-select>
</el-form-item>
<el-form-item>
<el-button type="primary" @click="handleSearch">搜索</el-button>
</el-form-item>
<el-form-item>
<el-button @click="handleReset">重置</el-button>
</el-form-item>
<el-form-item>
<el-button type="primary" @click="handleExport">导出数据</el-button>
</el-form-item>
</el-form>
<!-- 表格 -->
<div class="table-container">
<el-table :data="currentPageData" style="width: 100%" :row-style="{ height: '55px' }">
<el-table-column prop="id" label="ID" width="100" align="center"></el-table-column>
<el-table-column prop="name" label="姓名" width="300" align="center"></el-table-column>
<el-table-column prop="jingwangId" label="精网号" width="300" align="center"></el-table-column>
<el-table-column prop="market" label="参与市场" width="300" align="center">
<template #default="scope">
<span v-if="scope.row.market == '0' ">美股</span>
<span v-if="scope.row.market == '1' ">港股</span>
</template>
</el-table-column>
<el-table-column prop="participationTime" label="参与时间" align="center"></el-table-column>
</el-table>
</div>
<!-- 搜索栏 -->
<el-form :inline="true" class="search-bar">
<el-form-item label="姓名">
<el-input v-model="searchdata.username" placeholder="请输入姓名"></el-input>
</el-form-item>
<el-form-item label="精网号">
<el-input v-model="searchdata.jwcode" placeholder="请输入精网号" @input="handleJwcodeInput"></el-input>
</el-form-item>
<el-form-item label="市场" class="market-item">
<el-select v-model="searchdata.marketSign" placeholder="请选择" style="width: 100%" class="market-select">
<el-option
v-for="market in marketList"
:key="market"
:label="market"
:value="market"
/>
</el-select>
</el-form-item>
<el-form-item>
<el-button type="primary" @click="handleSearch">搜索</el-button>
</el-form-item>
<el-form-item>
<el-button @click="handleReset">重置</el-button>
</el-form-item>
<el-form-item>
<el-button type="primary" @click="handleExport">导出数据</el-button>
</el-form-item>
</el-form>
<!-- 表格 -->
<div class="table-container">
<el-table :data="tableData" style="width: 100%" :row-style="{ height: '55px' }">
<el-table-column prop="id" label="ID" width="100" align="center"></el-table-column>
<el-table-column prop="username" label="姓名" width="300" align="center"></el-table-column>
<el-table-column prop="jwcode" label="精网号" width="300" align="center"></el-table-column>
<el-table-column prop="marketSign" label="参与市场" width="300" align="center"></el-table-column>
<el-table-column prop="joinTime" label="参与时间" align="center"></el-table-column>
</el-table>
</div>
</div>
<!-- 返回按钮 -->
<!-- 分页 -->
<el-pagination
@ -67,151 +62,58 @@
:page-sizes="[10, 20, 50, 100]"
:page-size="pageSize"
layout="total, sizes, prev, pager, next, jumper"
:total="tableData.length"
:total="total"
>
</el-pagination>
</el-card>
</el-card>
</template>
<script setup>
import { ref, computed } from 'vue'
import { ref, onMounted } from 'vue'
import { useRouter } from 'vue-router'
import { useactivitytone } from '@/stone/activityStone'
import { getDetailListbyActivityId, getDetailMessage, getMarket } from '@/api/manage/activity'
import { ElMessage } from 'element-plus'
const activityStone = useactivitytone()
const router = useRouter()
//
const totalParticipants = ref(156)
const usParticipants = ref(78)
const usAssists = ref(345)
const hkParticipants = ref(78)
const hkAssists = ref(234)
const totalParticipants = ref(0)
const usParticipants = ref(0)
const usAssists = ref(0)
const hkParticipants = ref(0)
const hkAssists = ref(0)
const marketOneLabel = ref('')
const marketTwoLabel = ref('')
const marketList = ref([])
//
const fetchMarketList = async () => {
try {
const response = await getMarket()
if (response.code === 200) {
marketList.value = response.data
} else {
console.error('获取市场列表失败:', response.message)
}
} catch (error) {
console.error('请求市场列表失败:', error)
}
}
const searchdata = ref({
name: '',
jingwangId: '',
market: ''
username: '',
jwcode: '',
marketSign: ''
})
const tableData = ref([
{
id: 1,
name: '张家伟',
jingwangId: '90047666',
market: '0',
participationTime: '2025年7月11日 09:46'
},
{
id: 2,
name: '张三',
jingwangId: '90047666',
market: '1',
participationTime: '2025年7月11日 09:46'
},
{
id: 2,
name: '张三',
jingwangId: '90047666',
market: '1',
participationTime: '2025年7月11日 09:46'
},
{
id: 2,
name: '张三',
jingwangId: '90047666',
market: '1',
participationTime: '2025年7月11日 09:46'
},
{
id: 2,
name: '张三',
jingwangId: '90047666',
market: '1',
participationTime: '2025年7月11日 09:46'
},
{
id: 2,
name: '张三',
jingwangId: '90047666',
market: '1',
participationTime: '2025年7月11日 09:46'
},
{
id: 2,
name: '张三',
jingwangId: '90047666',
market: '1',
participationTime: '2025年7月11日 09:46'
},
{
id: 2,
name: '张三',
jingwangId: '90047666',
market: '1',
participationTime: '2025年7月11日 09:46'
},
{
id: 2,
name: '张三',
jingwangId: '90047666',
market: '1',
participationTime: '2025年7月11日 09:46'
},
{
id: 2,
name: '张三',
jingwangId: '90047666',
market: '1',
participationTime: '2025年7月11日 09:46'
},
{
id: 2,
name: '张三',
jingwangId: '90047666',
market: '1',
participationTime: '2025年7月11日 09:46'
},
{
id: 2,
name: '张三',
jingwangId: '90047666',
market: '1',
participationTime: '2025年7月11日 09:46'
},
{
id: 2,
name: '张三',
jingwangId: '90047666',
market: '1',
participationTime: '2025年7月11日 09:46'
},
{
id: 2,
name: '张三',
jingwangId: '90047666',
market: '1',
participationTime: '2025年7月11日 09:46'
},
{
id: 2,
name: '张三',
jingwangId: '90047666',
market: '1',
participationTime: '2025年7月11日 09:46'
}
])
const tableData = ref([])
const total = ref(0) // total
const currentPage = ref(1)
const pageSize = ref(10)
//
const currentPageData = computed(() => {
const start = (currentPage.value - 1) * pageSize.value
const end = start + pageSize.value
return tableData.value.slice(start, end)
})
//
const goBack = () => {
router.back()
@ -219,16 +121,23 @@ const goBack = () => {
//
const handleSearch = () => {
console.log('Search:', searchdata.value)
currentPage.value = 1
getDetailData()
searchdata.value = {
username: '',
jwcode: '',
marketSign: ''
}
}
//
const handleReset = () => {
searchdata.value = {
name: '',
jingwangId: '',
market: ''
username: '',
jwcode: '',
marketSign: ''
}
getDetailData()
}
//
@ -240,16 +149,90 @@ const handleExport = () => {
const handleSizeChange = (val) => {
pageSize.value = val
currentPage.value = 1
getDetailData()
}
//
const handleCurrentChange = (val) => {
currentPage.value = val
getDetailData()
}
//
const handleJingwangIdInput = (value) => {
searchdata.value.jingwangId = value.replace(/\D/g, '')
const handleJwcodeInput = (value) => {
searchdata.value.jwcode = value.replace(/\D/g, '')
}
//
onMounted(async () => {
getDetailData()
fetchDetailMessage()
fetchMarketList()
})
//
const getDetailData = async () => {
try {
const activityId = activityStone.selectactivityId
const { username, jwcode, marketSign } = searchdata.value
if (!activityId) {
console.warn('未获取到 activityId')
return
}
const response = await getDetailListbyActivityId({
activityId,
username,
jwcode,
marketSign,
page: currentPage.value,
pagesize: pageSize.value
})
if (response.code === 200) {
tableData.value = response.data.list
total.value = response.data.total || 0
} else {
console.error('获取数据失败:', response.message)
ElMessage.error(response.message || '获取数据失败')
}
} catch (error) {
console.error('请求失败:', error)
ElMessage.error('请求失败,请重试')
}
}
//
const fetchDetailMessage = async () => {
try {
const activityId = activityStone.selectactivityId
if (!activityId) {
console.warn('未获取到 activityId')
return
}
const response = await getDetailMessage(activityId)
if (response.code === 200) {
const data = response.data
totalParticipants.value = data.people_total
usParticipants.value = data.marketOnePeople
usAssists.value = data.marketOneTotal
hkParticipants.value = data.marketTwoPeople
hkAssists.value = data.marketTwoTotal
marketOneLabel.value = data.market_one
marketTwoLabel.value = data.market_two
} else {
console.error('获取顶部信息失败:', response.message)
ElMessage.error(response.message || '获取顶部信息失败')
}
} catch (error) {
console.error('请求顶部信息失败:', error)
ElMessage.error('请求失败,请重试')
}
}
</script>
@ -260,11 +243,11 @@ const handleJingwangIdInput = (value) => {
}
.gray-container {
width: 100%; /* 宽度自适应 */
background-color: #ffffff; /* 浅灰色背景 */
padding: 20px; /* 内边距 */
box-sizing: border-box; /* 包含内边距在总宽度内 */
min-height: 80vh; /* 设置最小高度 */
width: 100%;
background-color: #ffffff;
padding: 20px;
box-sizing: border-box;
min-height: 80vh;
overflow-x: hidden;
}
@ -273,15 +256,15 @@ const handleJingwangIdInput = (value) => {
}
.market-item {
width: 200px; /* 根据需要调整宽度 */
width: 200px;
}
.market-select {
width: 100%; /* 确保 select 宽度与 form-item 一致 */
width: 100%;
}
.table-container {
height: 600px; /* 根据需要调整高度 */
overflow-y: auto; /* 启用垂直滚动条 */
height: 600px;
overflow-y: auto;
}
</style>

124
activitylink/src/views/zhongchou/activity/index.vue

@ -12,10 +12,11 @@
</div>
<!-- 其他内容区域 -->
<div class="content-area">
<el-table :data="currentPageData" style="width: auto" :row-style="{ height: '60px' }">
<div class="table-container">
<el-table :data="currentPageData" style="width: auto" :row-style="{ height: '60px' } ">
<el-table-column prop="activityName" label="活动名称"></el-table-column>
<el-table-column prop="marketOne" label="股票一"></el-table-column>
<el-table-column prop="marketTwo" label="股票二"></el-table-column>
<el-table-column prop="marketOne" label="市场一"></el-table-column>
<el-table-column prop="marketTwo" label="市场二"></el-table-column>
<!-- 新增两列 -->
<el-table-column prop="startTime" label="开始时间"></el-table-column>
@ -28,8 +29,8 @@
</el-table-column>
<el-table-column label="设置数据">
<template #default="{ $index }">
<a href="#" style="color: red;" @click.prevent="goToSet">设置</a>
<template #default="scope">
<a href="#" style="color: red;" @click.prevent="goToSet(scope.row)">设置</a>
</template>
</el-table-column>
@ -45,7 +46,29 @@
/>
</template>
</el-table-column>
<el-table-column label="操作">
<template #default="scope">
<el-button size="small" type="danger" @click="openDeleteDialog(scope.row)">删除</el-button>
</template>
</el-table-column>
</el-table>
</div>
<!-- 删除确认对话框 -->
<el-dialog v-model="deleteConfirmVisible" title="提示" width="30%">
<span>您确定删除该活动吗</span>
<template #footer>
<span class="dialog-footer">
<el-button @click="deleteConfirmVisible = false"> </el-button>
<el-button type="primary" @click="confirmDelete"> </el-button>
</span>
</template>
</el-dialog>
<el-dialog
v-model="centerDialogVisible"
@ -59,10 +82,25 @@
<el-input v-model="activity.activityName" placeholder="请输入活动名称" />
</el-form-item>
<el-form-item label="股票一" prop="marketOne">
<el-input v-model="activity.marketOne" placeholder="请输入股票一" />
<el-select v-model="activity.marketOne" placeholder="请选择市场一" style="width: 100%">
<el-option
v-for="market in marketList"
:key="market"
:label="market"
:value="market"
/>
</el-select>
</el-form-item>
<el-form-item label="股票二" prop="marketTwo">
<el-input v-model="activity.marketTwo" placeholder="请输入股票二" />
<el-select v-model="activity.marketTwo" placeholder="请选择市场二" style="width: 100%">
<el-option
v-for="market in marketList"
:key="market"
:label="market"
:value="market"
/>
</el-select>
</el-form-item>
<el-form-item label="活动状态" prop="status">
<el-select v-model="activity.status" placeholder="请选择活动状态">
@ -125,8 +163,8 @@
<script setup>
import { ref, computed, onMounted } from 'vue';
import { useRouter } from 'vue-router';
import { getActivityList , changeStatusbyId ,addActivityandtime} from '@/api/manage/activity';
import { ElMessage } from 'element-plus';
import { getActivityList , changeStatusbyId ,addActivityandtime ,getMarket , deleteActivityById} from '@/api/manage/activity';
import { ElButton, ElMessage } from 'element-plus';
import { useactivitytone } from '@/stone/activityStone';
const router = useRouter();
const centerDialogVisible = ref(false);
@ -134,6 +172,25 @@ const centerDialogVisible = ref(false);
// 使 ref
const tableData = ref([]);
const activityStone = useactivitytone();
//
const marketList = ref([])
//
const fetchMarketList = async () => {
try {
const response = await getMarket()
if (response.code === 200) {
marketList.value = response.data
} else {
console.error('获取市场列表失败:', response.message)
}
} catch (error) {
console.error('请求市场列表失败:', error)
}
}
//
const cancel = () => {
centerDialogVisible.value = false;
@ -181,6 +238,41 @@ const addActivity = async () => {
}
}
//
const deleteConfirmVisible = ref(false)
const activityToDelete = ref(null)
//
const openDeleteDialog = (row) => {
activityToDelete.value = row.id
deleteConfirmVisible.value = true
}
//
const confirmDelete = async () => {
if (!activityToDelete.value) {
ElMessage.warning('未获取到活动ID')
return
}
try {
const response = await deleteActivityById(activityToDelete.value)
if (response.code === 200) {
ElMessage.success('活动删除成功')
fetchActivityList() //
} else {
ElMessage.error(response.message || '删除失败')
}
} catch (error) {
console.error('删除活动失败:', error)
ElMessage.error('请求失败,请重试')
} finally {
deleteConfirmVisible.value = false
activityToDelete.value = null
}
}
const activity = ref({
activityName: '',
marketOne: '',
@ -212,11 +304,12 @@ const handleCurrentChange = (val) => {
//
const goToDetail = (row) => {
activityStone.setselectedactivity(row.id);
activityStone.setselectedactivityId(row.id);
router.push({ name: 'activityDetail' });
};
const goToSet = () => {
const goToSet = (row) => {
activityStone.setselectedactivityId(row.id);
router.push({ name: 'activitySet' });
};
@ -265,6 +358,7 @@ const updateStatus = async (row) => {
//
onMounted(() => {
fetchActivityList();
fetchMarketList();
});
</script>
@ -275,7 +369,8 @@ onMounted(() => {
padding: 20px; /* 内边距 */
box-sizing: border-box; /* 包含内边距在总宽度内 */
min-height: 80vh; /* 设置最小高度 */
overflow-x: hidden;
/* overflow-x: hidden; */
overflow-y: auto;
}
.activity-header {
@ -319,4 +414,9 @@ th {
margin-top: 20px;
text-align: center;
}
.table-container {
height: 650px; /* 根据需要调整高度 */
overflow-y: auto; /* 启用垂直滚动条 */
}
</style>

393
activitylink/src/views/zhongchou/activity/set/index.vue

@ -1,93 +1,140 @@
<template>
<el-card style="margin-top:50px; min-height: 90vh; max-height: 90vh;">
<div class="data-settings">
<br><br><br><br><br>
<el-button type="primary" @click="goBack">
<i class="el-icon-back"></i> 返回
</el-button>
<el-card style="margin-top:50px; min-height: 90vh; max-height: 90vh;">
<div class="data-settings">
<!-- 返回按钮 -->
<h3>数据设置</h3>
<br><br><br><br><br>
<el-button type="primary" @click="goBack">
<i class="el-icon-back"></i> 返回
</el-button>
<div class="setting-item">
<label>设置初始数据</label>
<el-input-number :precision="0" :min="0" v-model="setinitiaData" placeholder="分钟" size="large"></el-input-number>
&nbsp;&nbsp;分钟
&nbsp;&nbsp;&nbsp;&nbsp;
<el-button type="primary" @click="openInitialConfirmDialog">确认</el-button>
</div>
<h3>数据设置</h3>
<!-- 市场一 -->
<div class="setting-item">
<label>当前{{ marketOneName }}市场助力次数{{ markerOneTotal }} </label>
<el-input-number :precision="0" :min="0" v-model="addCountOne" placeholder="设置添加次数" size="large"></el-input-number>
&nbsp;&nbsp;&nbsp;&nbsp;
<el-button type="primary" @click="openConfirmDialog('one')">确认</el-button>
&nbsp;&nbsp;&nbsp;&nbsp;
<label>前端展示次数{{ showOne }} </label>
</div>
<div class="setting-item">
<label>设置初始数据</label>
<el-input-number :precision="0" :min="0" v-model="initialData" placeholder="分钟" size="large"></el-input-number>
&nbsp;&nbsp;分钟
&nbsp;&nbsp;&nbsp;&nbsp;
<el-button type="primary" @click="openInitialConfirmDialog">确认</el-button>
</div>
<!-- 市场二 -->
<div class="setting-item">
<label>当前{{ marketTwoName }}市场助力次数{{ markerTwoTotal }} </label>
<el-input-number :precision="0" :min="0" v-model="addCountTwo" placeholder="设置添加次数" size="large"></el-input-number>
&nbsp;&nbsp;&nbsp;&nbsp;
<el-button type="primary" @click="openConfirmDialog('two')">确认</el-button>
&nbsp;&nbsp;&nbsp;&nbsp;
<label>前端展示次数{{ showTwo }} </label>
</div>
<div class="setting-item">
<label>当前美股助力次数{{ usStockBoostCount }} </label>
<el-input-number :precision="0" :min="0" v-model="usStockAddCount" placeholder="设置添加次数" size="large"></el-input-number>
&nbsp;&nbsp;&nbsp;&nbsp;
<el-button type="primary" @click="openConfirmDialog('us')">确认</el-button>
&nbsp;&nbsp;&nbsp;&nbsp;
<label>前端展示次数{{ usStockDisplayCount }} </label>
</div>
<!-- 时间数据 -->
<div class="setting-item">
<label>当前初始数据为{{ initialData }} 分钟</label>
</div>
<div class="setting-item">
<label>当前港股助力次数{{ hkStockBoostCount }} </label>
<el-input-number :precision="0" :min="0" v-model="hkStockAddCount" placeholder="设置添加次数" size="large"></el-input-number>
&nbsp;&nbsp;&nbsp;&nbsp;
<el-button type="primary" @click="openConfirmDialog('hk')">确认</el-button>
&nbsp;&nbsp;&nbsp;&nbsp;
<label>前端展示次数{{ hkStockDisplayCount }} </label>
</div>
<!-- 确认对话框 -->
<el-dialog v-model="showConfirmDialog" title="确认添加" width="30%">
<span>您确定要添加这些次数吗</span>
<template #footer>
<span class="dialog-footer">
<el-button @click="showConfirmDialog = false"> </el-button>
<el-button type="primary" @click="confirmAdd"> </el-button>
</span>
</template>
</el-dialog>
<!-- 确认对话框 -->
<el-dialog v-model="showConfirmDialog" title="确认添加" width="30%">
<span>您确定要添加这些次数吗</span>
<template #footer>
<span class="dialog-footer">
<el-button @click="showConfirmDialog = false"> </el-button>
<el-button type="primary" @click="confirmAdd"> </el-button>
</span>
</template>
</el-dialog>
<!-- 初始数据确认对话框 -->
<el-dialog v-model="showInitialConfirmDialog" title="确认设置初始数据" width="30%">
<span>您确定要设置初始数据为 {{ initialData }} 分钟吗</span>
<template #footer>
<span class="dialog-footer">
<el-button @click="showInitialConfirmDialog = false"> </el-button>
<el-button type="primary" @click="confirmInitialData"> </el-button>
</span>
</template>
</el-dialog>
</div>
</el-card>
<!-- 初始数据确认对话框 -->
<el-dialog v-model="showInitialConfirmDialog" title="确认设置初始数据" width="30%" @closed="cancelset">
<span>您确定要设置初始数据为 {{ setinitiaData }} 分钟吗</span>
<template #footer>
<span class="dialog-footer">
<el-button @click="cancelset"> </el-button>
<el-button type="primary" @click="confirmInitialData"> </el-button>
</span>
</template>
</el-dialog>
</div>
</el-card>
</template>
<script setup>
import { ref } from 'vue';
import { ref, onMounted } from 'vue';
import { useRouter } from 'vue-router';
import { showsetDetail , showaddDetail , setTime } from '@/api/manage/activity'
import { useactivitytone } from '@/stone/activityStone'
import { ElMessage } from 'element-plus';
const router = useRouter();
const activityStone = useactivitytone()
//
const initialData = ref(0);
const setinitiaData = ref(0);
const addCountOne = ref(null);
const addCountTwo = ref(null);
const showConfirmDialog = ref(false);
const showInitialConfirmDialog = ref(false);
const pendingAction = ref(null); // ('one' or 'two')
//
const initialData = ref(null);
const usStockBoostCount = ref(234);
const usStockAddCount = ref(null);
const usStockDisplayCount = ref(345);
// API
const marketOne = ref(''); //
const marketTwo = ref(''); //
const markerOneTotal = ref(0); //
const markerTwoTotal = ref(0); //
const showOne = ref(0); //
const showTwo = ref(0); //
const hkStockBoostCount = ref(164);
const hkStockAddCount = ref(null);
const hkStockDisplayCount = ref(355);
//
// const marketNames = {
// 'usa': '',
// 'hk': ''
// };
//
const showConfirmDialog = ref(false);
//
const marketOneName = ref('');
const marketTwoName = ref('');
const showInitialConfirmDialog = ref(false);
const pendingInitialData = ref('');
let pendingAction = ref(null); // ('us' or 'hk')
//
const fetchData = async () => {
try {
const response = await showsetDetail(activityStone.selectactivityId);
const data = response.data;
console.log(data);
//
marketOne.value = data.marketOne;
marketTwo.value = data.marketTwo;
markerOneTotal.value = data.markerOneTotal;
markerTwoTotal.value = data.markerTwoTotal;
showOne.value = data.showOne;
showTwo.value = data.showTwo;
initialData.value = data.time;
//
marketOneName.value = data.marketOne;
marketTwoName.value = data.marketTwo;
} catch (error) {
console.error('获取数据失败:', error);
//
}
};
//
onMounted(() => {
fetchData();
});
//
const openConfirmDialog = (type) => {
if ((type === 'us' && usStockAddCount.value) || (type === 'hk' && hkStockAddCount.value)) {
if ((type === 'one' && addCountOne.value !== null) ||
(type === 'two' && addCountTwo.value !== null)) {
pendingAction.value = type;
showConfirmDialog.value = true;
}
@ -95,38 +142,122 @@ const openConfirmDialog = (type) => {
//
const openInitialConfirmDialog = () => {
if (initialData.value) {
pendingInitialData.value = initialData.value;
if (initialData.value !== null) {
showInitialConfirmDialog.value = true;
}
};
const cancelset = () => {
showInitialConfirmDialog.value = false
setinitiaData.value = 0
};
//
//
const confirmInitialData = () => {
//
console.log('已设置初始数据:', pendingInitialData.value);
const confirmInitialData = async () => {
try {
const id = activityStone.selectactivityId
const time = setinitiaData.value
//
initialData.value = null;
showInitialConfirmDialog.value = false;
};
if (!id) {
ElMessage.warning('未获取到活动ID')
return
}
if (time === null || time <= 0) {
ElMessage.warning('请输入有效的分钟数')
return
}
const response = await setTime(
id,
time
)
if (response.code === 200) {
await fetchData()
showInitialConfirmDialog.value = false
setinitiaData.value=0
ElMessage.success('设置成功')
} else {
ElMessage.error(response.message || '设置失败')
}
} catch (error) {
console.error('设置初始数据失败:', error)
ElMessage.error('请求失败,请重试')
}
}
//
const confirmAdd = () => {
const confirmAdd = async () => {
const type = pendingAction.value;
if (type === 'us') {
usStockBoostCount.value += parseInt(usStockAddCount.value);
usStockDisplayCount.value = usStockBoostCount.value;
usStockAddCount.value = null;
} else if (type === 'hk') {
hkStockBoostCount.value += parseInt(hkStockAddCount.value);
hkStockDisplayCount.value = hkStockBoostCount.value;
hkStockAddCount.value = null;
if (type === 'one' && addCountOne.value !== null && addCountOne.value > 0) {
markerOneTotal.value += parseInt(addCountOne.value);
showOne.value = markerOneTotal.value;
//
try {
const response = await showaddDetail(
activityStone.selectactivityId,
marketOne.value,
addCountOne.value
);
if (response.code === 200) {
fetchData();
ElMessage.success('助力次数添加成功');
} else {
ElMessage.error(response.message || '添加失败');
//
markerOneTotal.value -= parseInt(addCountOne.value);
showOne.value = markerOneTotal.value;
}
} catch (error) {
console.error('添加助力次数失败:', error);
ElMessage.error('请求失败,请重试');
//
markerOneTotal.value -= parseInt(addCountOne.value);
showOne.value = markerOneTotal.value;
}
addCountOne.value = null;
} else if (type === 'two' && addCountTwo.value !== null && addCountTwo.value > 0) {
markerTwoTotal.value += parseInt(addCountTwo.value);
showTwo.value = markerTwoTotal.value;
//
try {
const response = await showaddDetail(
activityStone.selectactivityId,
marketTwo.value,
addCountTwo.value
);
if (response.code === 200) {
fetchData();
ElMessage.success('助力次数添加成功');
} else {
ElMessage.error(response.message || '添加失败');
//
markerTwoTotal.value -= parseInt(addCountTwo.value);
showTwo.value = markerTwoTotal.value;
}
} catch (error) {
console.error('添加助力次数失败:', error);
ElMessage.error('请求失败,请重试');
//
markerTwoTotal.value -= parseInt(addCountTwo.value);
showTwo.value = markerTwoTotal.value;
}
addCountTwo.value = null;
}
//
pendingAction.value = null;
showConfirmDialog.value = false;
pendingAction.value = null;
};
//
@ -135,45 +266,43 @@ const goBack = () => {
};
</script>
<style scoped>
.data-settings {
background-color: #ffffff;
padding: 40px;
border-radius: 16px;
width: 100%;
max-width: 800px;
margin: 0 auto;
font-size: 1.2rem;
}
.setting-item {
margin-bottom: 25px;
display: flex;
align-items: center;
justify-content: flex-start;
}
.setting-item label {
margin-right: 20px;
font-size: 1.1rem;
}
.setting-item input {
width: 150px;
height: 40px;
font-size: 1.1rem;
text-align: center;
margin-right: 20px;
}
.el-button {
height: 40px;
font-size: 1.1rem;
padding: 0 20px;
}
h3 {
font-size: 1.8rem;
margin-bottom: 20px;
}
</style>
<style scoped>
.data-settings {
background-color: #ffffff;
padding: 40px;
border-radius: 16px;
width: 100%;
max-width: 800px;
margin: 0 auto;
font-size: 1.2rem;
}
.setting-item {
margin-bottom: 25px;
display: flex;
align-items: center;
justify-content: flex-start;
flex-wrap: wrap;
}
.setting-item label {
margin-right: 20px;
font-size: 1.1rem;
min-width: 200px;
}
.el-input-number {
width: 180px;
}
.el-button {
height: 40px;
font-size: 1.1rem;
padding: 0 20px;
}
h3 {
font-size: 1.8rem;
margin-bottom: 20px;
}
</style>

2
activitylink/src/views/zhongchou/winning/index.vue

@ -78,7 +78,7 @@
<script setup>
import { ref, computed } from 'vue'
import { useRouter } from 'vue-router'
import { getWinList } from '@/api/manage/win'
const router = useRouter()
//

Loading…
Cancel
Save