|
|
@ -1,8 +1,8 @@ |
|
|
|
<script setup> |
|
|
|
import { ref, onMounted, reactive, computed } from 'vue' |
|
|
|
import {ref, onMounted, reactive, computed} from 'vue' |
|
|
|
import ElementPlus from 'element-plus' |
|
|
|
import { ElMessage, ElMessageBox } from 'element-plus' |
|
|
|
import { AiFillRead } from 'vue-icons-plus/ai' |
|
|
|
import {ElMessage, ElMessageBox} from 'element-plus' |
|
|
|
import {AiFillRead} from 'vue-icons-plus/ai' |
|
|
|
import axios from 'axios' |
|
|
|
import moment from 'moment' |
|
|
|
import API from '@/util/http' |
|
|
@ -10,7 +10,7 @@ import API from '@/util/http' |
|
|
|
const adminData = ref({}) |
|
|
|
const getAdminData = async function () { |
|
|
|
try { |
|
|
|
const result = await API({ url: '/admin/userinfo', data: {} }) |
|
|
|
const result = await API({url: '/admin/userinfo', data: {}}) |
|
|
|
adminData.value = result |
|
|
|
rechargeUser.value.adminId = adminData.value.id |
|
|
|
console.log('请求成功', result) |
|
|
@ -96,7 +96,7 @@ const delObj = ref({}) |
|
|
|
const getActivity = async function () { |
|
|
|
try { |
|
|
|
// 发送POST请求 |
|
|
|
const result = await API({ url: '/general/activity', data: {} }) |
|
|
|
const result = await API({url: '/general/activity', data: {}}) |
|
|
|
|
|
|
|
// 将响应结果存储到响应式数据中 |
|
|
|
console.log('请求成功', result) |
|
|
@ -104,7 +104,7 @@ const getActivity = async function () { |
|
|
|
// 检查返回的数据是否为数组 |
|
|
|
if (Array.isArray(result.data)) { |
|
|
|
// 将字符串数组转换为 { value, label } 格式 |
|
|
|
activity.value = result.data.map(item => ({ value: item, label: item })); |
|
|
|
activity.value = result.data.map(item => ({value: item, label: item})); |
|
|
|
} else { |
|
|
|
console.error('活动数据格式错误', result) |
|
|
|
ElMessage.error('活动数据格式错误,请联系管理员') |
|
|
@ -119,9 +119,14 @@ const getActivity = async function () { |
|
|
|
// 获取地区 |
|
|
|
// 获取地区 |
|
|
|
const getArea = async function () { |
|
|
|
console.log('获取地区adminid', adminData.value) |
|
|
|
try { |
|
|
|
// 发送POST请求 |
|
|
|
const result = await API({ url: '/general/market', data: {} }) |
|
|
|
const result = await API({ |
|
|
|
|
|
|
|
url: '/general/roleMarkets', |
|
|
|
data: {account: adminData.value.account} |
|
|
|
}); |
|
|
|
// 将响应结果存储到响应式数据中 |
|
|
|
console.log('请求成功', result) |
|
|
|
// 存储地区信息 |
|
|
@ -148,7 +153,7 @@ const getPlatform = async () => { |
|
|
|
}) |
|
|
|
// 假设后端返回的是字符串数组,转换为 { value, label } 格式 |
|
|
|
if (Array.isArray(result.data)) { |
|
|
|
platform.value = result.data.map(item => ({ value: item, label: item })); |
|
|
|
platform.value = result.data.map(item => ({value: item, label: item})); |
|
|
|
} else { |
|
|
|
console.error('充值方式格式错误', result) |
|
|
|
ElMessage.error('充值方式格式错误,请联系管理员') |
|
|
@ -188,7 +193,7 @@ const get = async function (val) { |
|
|
|
url: '/recharge/selectBy', |
|
|
|
data: { |
|
|
|
...getObj.value, |
|
|
|
rechargeUser: { ...rechargeUser.value } |
|
|
|
rechargeUser: {...rechargeUser.value} |
|
|
|
} |
|
|
|
}) |
|
|
|
// 复制一份 rechargeUser.value 并移除排序字段和排序方式 |
|
|
@ -265,14 +270,14 @@ const reset = function () { |
|
|
|
const getToday = function () { |
|
|
|
const today = new Date() |
|
|
|
const startTime = new Date( |
|
|
|
today.getFullYear(), |
|
|
|
today.getMonth(), |
|
|
|
today.getDate() |
|
|
|
today.getFullYear(), |
|
|
|
today.getMonth(), |
|
|
|
today.getDate() |
|
|
|
) |
|
|
|
const endTime = new Date( |
|
|
|
today.getFullYear(), |
|
|
|
today.getMonth(), |
|
|
|
today.getDate() + 1 |
|
|
|
today.getFullYear(), |
|
|
|
today.getMonth(), |
|
|
|
today.getDate() + 1 |
|
|
|
) |
|
|
|
getTime.value = [startTime, endTime] |
|
|
|
console.log('getTime', getTime.value) |
|
|
@ -293,14 +298,14 @@ const getYesterday = function () { |
|
|
|
const yesterday = new Date() |
|
|
|
yesterday.setDate(yesterday.getDate() - 1) |
|
|
|
const startTime = new Date( |
|
|
|
yesterday.getFullYear(), |
|
|
|
yesterday.getMonth(), |
|
|
|
yesterday.getDate() |
|
|
|
yesterday.getFullYear(), |
|
|
|
yesterday.getMonth(), |
|
|
|
yesterday.getDate() |
|
|
|
) |
|
|
|
const endTime = new Date( |
|
|
|
yesterday.getFullYear(), |
|
|
|
yesterday.getMonth(), |
|
|
|
yesterday.getDate() + 1 |
|
|
|
yesterday.getFullYear(), |
|
|
|
yesterday.getMonth(), |
|
|
|
yesterday.getDate() + 1 |
|
|
|
) |
|
|
|
getTime.value = [startTime, endTime] |
|
|
|
console.log('getTime', getTime.value) |
|
|
@ -312,14 +317,14 @@ const getYesterday = function () { |
|
|
|
const get7Days = function () { |
|
|
|
const today = new Date() |
|
|
|
const startTime = new Date( |
|
|
|
today.getFullYear(), |
|
|
|
today.getMonth(), |
|
|
|
today.getDate() - 6 |
|
|
|
today.getFullYear(), |
|
|
|
today.getMonth(), |
|
|
|
today.getDate() - 6 |
|
|
|
) |
|
|
|
const endTime = new Date( |
|
|
|
today.getFullYear(), |
|
|
|
today.getMonth(), |
|
|
|
today.getDate() + 1 |
|
|
|
today.getFullYear(), |
|
|
|
today.getMonth(), |
|
|
|
today.getDate() + 1 |
|
|
|
) |
|
|
|
getTime.value = [startTime, endTime] |
|
|
|
console.log('getTime', getTime.value) |
|
|
@ -333,6 +338,7 @@ const get7Days = function () { |
|
|
|
onMounted(async function () { |
|
|
|
await get() |
|
|
|
await getActivity() |
|
|
|
await getAdminData() |
|
|
|
await getArea() |
|
|
|
await getPlatform() |
|
|
|
}) |
|
|
@ -361,7 +367,7 @@ const handleSortChange = (column) => { |
|
|
|
get() |
|
|
|
} |
|
|
|
|
|
|
|
const exportExcel = async function () { |
|
|
|
const exportExcel = async function () { |
|
|
|
const params = { |
|
|
|
rechargeUser: { |
|
|
|
jwcode: rechargeUser.value.jwcode || '', |
|
|
@ -375,8 +381,8 @@ const exportExcel = async function () { |
|
|
|
size: total.value |
|
|
|
} |
|
|
|
try { |
|
|
|
const res = await API({ url: '/export/exportRecharge', data: params }) |
|
|
|
if (res.code === 200) { |
|
|
|
const res = await API({url: '/export/exportRecharge', data: params}) |
|
|
|
if (res.code === 200) { |
|
|
|
ElMessage.success('导出成功') |
|
|
|
} else { |
|
|
|
ElMessage.error(res.message || '导出失败,请稍后重试') |
|
|
@ -403,7 +409,7 @@ const exportListLoading = ref(false) |
|
|
|
const getExportList = async () => { |
|
|
|
exportListLoading.value = true |
|
|
|
try { |
|
|
|
const result = await API({ url: '/export/export' }) |
|
|
|
const result = await API({url: '/export/export'}) |
|
|
|
if (result.code === 200) { |
|
|
|
const filteredData = result.data.filter(item => { |
|
|
|
return item.type === 2; //2表示金币充值列表 |
|
|
@ -437,8 +443,8 @@ const getTagType = (state) => { |
|
|
|
return 'info'; |
|
|
|
case 1: |
|
|
|
return 'primary'; |
|
|
|
case 2: |
|
|
|
return'success'; |
|
|
|
case 2: |
|
|
|
return 'success'; |
|
|
|
case 3: |
|
|
|
return 'danger'; |
|
|
|
default: |
|
|
@ -452,8 +458,8 @@ const getTagText = (state) => { |
|
|
|
return '待执行'; |
|
|
|
case 1: |
|
|
|
return '执行中'; |
|
|
|
case 2: |
|
|
|
return'执行完成'; |
|
|
|
case 2: |
|
|
|
return '执行完成'; |
|
|
|
case 3: |
|
|
|
return '执行出错'; |
|
|
|
default: |
|
|
@ -470,14 +476,14 @@ const getTagText = (state) => { |
|
|
|
<el-col :span="5"> |
|
|
|
<div class="head-card-element"> |
|
|
|
<el-text class="mx-1" size="large">精网号:</el-text> |
|
|
|
<el-input v-model="rechargeUser.jwcode" placeholder="请输入精网号" style="width: 150px" clearable /> |
|
|
|
<el-input v-model="rechargeUser.jwcode" placeholder="请输入精网号" style="width: 150px" clearable/> |
|
|
|
</div> |
|
|
|
</el-col> |
|
|
|
<el-col :span="6"> |
|
|
|
<div class="head-card-element"> |
|
|
|
<el-text class="mx-1" size="large">活动名称:</el-text> |
|
|
|
<el-select v-model="rechargeUser.activity" placeholder="请选择活动名称" style="width: 180px" clearable> |
|
|
|
<el-option v-for="item in activity" :key="item.value" :label="item.label" :value="item.value" /> |
|
|
|
<el-option v-for="item in activity" :key="item.value" :label="item.label" :value="item.value"/> |
|
|
|
</el-select> |
|
|
|
</div> |
|
|
|
</el-col> |
|
|
@ -485,7 +491,7 @@ const getTagText = (state) => { |
|
|
|
<div class="head-card-element"> |
|
|
|
<el-text class="mx-1" size="large">所属地区:</el-text> |
|
|
|
<el-select v-model="rechargeUser.market" placeholder="请选择所属地区" style="width: 180px" clearable> |
|
|
|
<el-option v-for="item in market" :key="item" :label="item" :value="item" /> |
|
|
|
<el-option v-for="item in market" :key="item" :label="item" :value="item"/> |
|
|
|
</el-select> |
|
|
|
</div> |
|
|
|
</el-col> |
|
|
@ -493,7 +499,7 @@ const getTagText = (state) => { |
|
|
|
<div class="head-card-element"> |
|
|
|
<el-text class="mx-1" size="large">充值方式:</el-text> |
|
|
|
<el-select v-model="rechargeUser.payPlatform" placeholder="请选择充值方式" style="width: 180px" clearable> |
|
|
|
<el-option v-for="item in platform" :key="item.value" :label="item.label" :value="item.value" /> |
|
|
|
<el-option v-for="item in platform" :key="item.value" :label="item.label" :value="item.value"/> |
|
|
|
</el-select> |
|
|
|
</div> |
|
|
|
</el-col> |
|
|
@ -504,10 +510,16 @@ const getTagText = (state) => { |
|
|
|
<div class="head-card-element"> |
|
|
|
<el-text class="mx-1" size="large">充值时间:</el-text> |
|
|
|
<el-date-picker v-model="getTime" type="datetimerange" range-separator="至" start-placeholder="起始时间" |
|
|
|
end-placeholder="结束时间" style="width: 400px" @change="handleDatePickerChange"/> |
|
|
|
<el-button @click="getToday()" style="margin-left: 10px" :type="activeTimeRange === 'today' ? 'primary' : ''"> 今</el-button> |
|
|
|
<el-button @click="getYesterday()" style="margin-left: 10px" :type="activeTimeRange === 'yesterday' ? 'primary' : ''"> 昨</el-button> |
|
|
|
<el-button @click="get7Days()" style="margin-left: 10px" :type="activeTimeRange === '7days' ? 'primary' : ''"> 近7天</el-button> |
|
|
|
end-placeholder="结束时间" style="width: 400px" @change="handleDatePickerChange"/> |
|
|
|
<el-button @click="getToday()" style="margin-left: 10px" |
|
|
|
:type="activeTimeRange === 'today' ? 'primary' : ''"> 今 |
|
|
|
</el-button> |
|
|
|
<el-button @click="getYesterday()" style="margin-left: 10px" |
|
|
|
:type="activeTimeRange === 'yesterday' ? 'primary' : ''"> 昨 |
|
|
|
</el-button> |
|
|
|
<el-button @click="get7Days()" style="margin-left: 10px" |
|
|
|
:type="activeTimeRange === '7days' ? 'primary' : ''"> 近7天 |
|
|
|
</el-button> |
|
|
|
<el-button type="success" @click="reset()">重置</el-button> |
|
|
|
<el-button type="primary" @click="search()">查询</el-button> |
|
|
|
<el-button type="primary" @click="exportExcel()">导出Excel</el-button> |
|
|
@ -522,9 +534,9 @@ const getTagText = (state) => { |
|
|
|
<el-col> |
|
|
|
<el-card> |
|
|
|
<div> |
|
|
|
充值金额:{{ (permanentGolds ) /100 }}新币,永久金币:{{ |
|
|
|
permanentGolds /100 |
|
|
|
}}金币,免费金币:{{ freeGolds /100 }}金币 |
|
|
|
充值金额:{{ (permanentGolds) / 100 }}新币,永久金币:{{ |
|
|
|
permanentGolds / 100 |
|
|
|
}}金币,免费金币:{{ freeGolds / 100 }}金币 |
|
|
|
</div> |
|
|
|
<!-- 设置表格容器的高度和滚动样式 --> |
|
|
|
<div style="height: 520px; overflow-y: auto;margin-top: 10px;"> |
|
|
@ -532,22 +544,22 @@ const getTagText = (state) => { |
|
|
|
<el-table-column type="index" label="序号" width="80px" fixed="left"> |
|
|
|
<template #default="scope"> |
|
|
|
<span>{{ |
|
|
|
scope.$index + 1 + (getObj.pageNum - 1) * getObj.pageSize |
|
|
|
}}</span> |
|
|
|
scope.$index + 1 + (getObj.pageNum - 1) * getObj.pageSize |
|
|
|
}}</span> |
|
|
|
</template> |
|
|
|
</el-table-column> |
|
|
|
<el-table-column fixed="left" prop="name" label="姓名" width="150px" /> |
|
|
|
<el-table-column fixed="left" prop="jwcode" label="精网号" width="110px" /> |
|
|
|
<el-table-column prop="market" label="所属地区" width="100px" /> |
|
|
|
<el-table-column fixed="left" prop="name" label="姓名" width="150px"/> |
|
|
|
<el-table-column fixed="left" prop="jwcode" label="精网号" width="110px"/> |
|
|
|
<el-table-column prop="market" label="所属地区" width="100px"/> |
|
|
|
<el-table-column prop="activity" label="活动名称" width="110px" show-overflow-tooltip/> |
|
|
|
<el-table-column prop="rateName" label="货币名称" width="110px" /> |
|
|
|
<el-table-column prop="money" sortable="custom" label="充值金额" width="110px" /> |
|
|
|
<el-table-column prop="permanentGold" label="永久金币" sortable="custom" width="110px" /> |
|
|
|
<el-table-column prop="freeGold" label="免费金币" sortable="custom" width="110px" /> |
|
|
|
<el-table-column prop="payPlatform" label="充值方式" width="100px" /> |
|
|
|
<el-table-column prop="payModel" label="支付方式" width="100px" /> |
|
|
|
<el-table-column prop="remark" label="备注" width="150px" show-overflow-tooltip /> |
|
|
|
<el-table-column prop="adminName" label="提交人" width="100px" /> |
|
|
|
<el-table-column prop="rateName" label="货币名称" width="110px"/> |
|
|
|
<el-table-column prop="money" sortable="custom" label="充值金额" width="110px"/> |
|
|
|
<el-table-column prop="permanentGold" label="永久金币" sortable="custom" width="110px"/> |
|
|
|
<el-table-column prop="freeGold" label="免费金币" sortable="custom" width="110px"/> |
|
|
|
<el-table-column prop="payPlatform" label="充值方式" width="100px"/> |
|
|
|
<el-table-column prop="payModel" label="支付方式" width="100px"/> |
|
|
|
<el-table-column prop="remark" label="备注" width="150px" show-overflow-tooltip/> |
|
|
|
<el-table-column prop="adminName" label="提交人" width="100px"/> |
|
|
|
<el-table-column prop="payTime" sortable label="充值时间" width="200px"> |
|
|
|
<template #default="scope"> |
|
|
|
{{ moment(scope.row.payTime).format('YYYY-MM-DD HH:mm:ss') }} |
|
|
@ -559,44 +571,45 @@ const getTagText = (state) => { |
|
|
|
<!-- 分页 --> |
|
|
|
<div class="pagination" style="margin-top: 20px"> |
|
|
|
<el-pagination background :page-size="getObj.pageSize" :page-sizes="[5, 10, 20, 50, 100]" |
|
|
|
layout="total, sizes, prev, pager, next, jumper" :total="total" @size-change="handlePageSizeChange" |
|
|
|
@current-change="handleCurrentChange"></el-pagination> |
|
|
|
layout="total, sizes, prev, pager, next, jumper" :total="total" |
|
|
|
@size-change="handlePageSizeChange" |
|
|
|
@current-change="handleCurrentChange"></el-pagination> |
|
|
|
</div> |
|
|
|
</el-card> |
|
|
|
</el-col> |
|
|
|
</el-row> |
|
|
|
<!-- 导出弹窗 --> |
|
|
|
<!-- 导出弹窗 --> |
|
|
|
<el-dialog v-model="exportListVisible" title="导出列表" width="80%"> |
|
|
|
<el-table :data="exportList" style="width: 100%" :loading="exportListLoading"> |
|
|
|
<el-table-column prop="fileName" label="文件名" /> |
|
|
|
<el-table-column prop="state" label="状态"> |
|
|
|
<template #default="scope"> |
|
|
|
<el-tag :type="getTagType(scope.row.state)" |
|
|
|
:effect="scope.row.state === 3 ? 'light' : 'plain'"> |
|
|
|
{{ getTagText(scope.row.state) }} |
|
|
|
</el-tag> |
|
|
|
</template> |
|
|
|
</el-table-column> |
|
|
|
<el-table-column prop="createTime" label="创建时间"> |
|
|
|
<template #default="scope"> |
|
|
|
{{ moment(scope.row.createTime).format('YYYY-MM-DD HH:mm:ss') }} |
|
|
|
</template> |
|
|
|
</el-table-column> |
|
|
|
<el-table-column label="操作"> |
|
|
|
<template #default="scope"> |
|
|
|
<el-button type="primary" size="small" @click="downloadExportFile(scope.row)" |
|
|
|
:disabled="scope.row.state !== 2"> |
|
|
|
下载 |
|
|
|
</el-button> |
|
|
|
</template> |
|
|
|
</el-table-column> |
|
|
|
</el-table> |
|
|
|
<template #footer> |
|
|
|
<div class="dialog-footer"> |
|
|
|
<el-button text @click="exportListVisible = false">关闭</el-button> |
|
|
|
</div> |
|
|
|
</template> |
|
|
|
</el-dialog> |
|
|
|
<el-table :data="exportList" style="width: 100%" :loading="exportListLoading"> |
|
|
|
<el-table-column prop="fileName" label="文件名"/> |
|
|
|
<el-table-column prop="state" label="状态"> |
|
|
|
<template #default="scope"> |
|
|
|
<el-tag :type="getTagType(scope.row.state)" |
|
|
|
:effect="scope.row.state === 3 ? 'light' : 'plain'"> |
|
|
|
{{ getTagText(scope.row.state) }} |
|
|
|
</el-tag> |
|
|
|
</template> |
|
|
|
</el-table-column> |
|
|
|
<el-table-column prop="createTime" label="创建时间"> |
|
|
|
<template #default="scope"> |
|
|
|
{{ moment(scope.row.createTime).format('YYYY-MM-DD HH:mm:ss') }} |
|
|
|
</template> |
|
|
|
</el-table-column> |
|
|
|
<el-table-column label="操作"> |
|
|
|
<template #default="scope"> |
|
|
|
<el-button type="primary" size="small" @click="downloadExportFile(scope.row)" |
|
|
|
:disabled="scope.row.state !== 2"> |
|
|
|
下载 |
|
|
|
</el-button> |
|
|
|
</template> |
|
|
|
</el-table-column> |
|
|
|
</el-table> |
|
|
|
<template #footer> |
|
|
|
<div class="dialog-footer"> |
|
|
|
<el-button text @click="exportListVisible = false">关闭</el-button> |
|
|
|
</div> |
|
|
|
</template> |
|
|
|
</el-dialog> |
|
|
|
</template> |
|
|
|
<style scoped> |
|
|
|
.pagination { |
|
|
|