diff --git a/src/components/MoneyManage/ProductSelect.vue b/src/components/MoneyManage/ProductSelect.vue index e9dfc8d..b6b7491 100644 --- a/src/components/MoneyManage/ProductSelect.vue +++ b/src/components/MoneyManage/ProductSelect.vue @@ -135,8 +135,8 @@ watch(selectedValue, (newVal) => { }); -const AIProduct = ['AI机构追踪', 'AI机构出击', 'AI机构资金', 'AI机活跃度'] -const superProduct = ['超级机构透视', '超级机构伏击', '超级机构猎杀', '超级机构脉搏', '超级机构罗盘'] +const AIProduct = ['AI机构追踪', 'AI机构出击', 'AI机构资金', 'AI机活跃度','AI机构探测神器'] +const superProduct = ['超级机构透视', '超级机构伏击', '超级机构猎杀', '超级机构脉搏', '超级机构罗盘','超级机构探测神器'] const InfoFee = ['静态信息费', '博股会员'] const menuData = [ { diff --git a/src/router/index.js b/src/router/index.js index 28dc0b8..00130fb 100644 --- a/src/router/index.js +++ b/src/router/index.js @@ -407,7 +407,7 @@ const routes = [ { path: 'cart', name: "cart", - component: () => import("../views/channelManage/cart/cart.vue"), + component: () => import("../views/noPermissionPage.vue"), meta: { permissionId: 127 } } ] diff --git a/src/views/channelManage/cart/cart.vue b/src/views/channelManage/cart/cart.vue index 95d90cb..67c097e 100644 --- a/src/views/channelManage/cart/cart.vue +++ b/src/views/channelManage/cart/cart.vue @@ -25,44 +25,17 @@ const adminData = ref({}) // 充值明细表格 const tableData = ref([]) -// 搜索articleVideo 表单 -const beanConsumeArticle = ref({ +// 搜索表单 +const beanCart = ref({ jwcode: null, dept: "", - type: "", - payMode: "", - articleId: "", - articleName: "", - author: "", + goodsName: "", + channelName: "", + liveName: "", startTime: '', endTime: '', - }) -// 频道列表 -const channels = ref([]) -// 抽离类型选项到响应式数组 -const consumeTypes = ref([ - { label: '打赏', value: 9 }, - { label: '打赏', value: 10 }, - { label: '付费购买', value: 11 }, -]) - -// 处理 payMode 选择变化 -const handlePayModeChange = (value) => { - beanConsumeArticle.value.payMode = value; - // 触发搜索 - ConsumeSelectBy(); -} - -//------------------------ - -// 标记当前激活的时间范围按钮 -const activeTimeRange = ref('') -// 日期选择器变化时清除按钮激活状态 -const handleDatePickerChange = () => { - activeTimeRange.value = '' -} // 搜索对象 const getObj = ref({ pageNum: 1, @@ -73,21 +46,32 @@ const getObj = ref({ const total = ref(100) // 搜索对象时间 -const getTime = ref({ - startTime: '', - endTime: '' -}) +const getTime = ref({}) // 搜索地区列表 const dept = ref([]) + + +// 新增排序字段和排序方式 +const sortField = ref('') +const sortOrder = ref('') + +// 合计数 +const permanentBean = ref(0) +const freeBean = ref(0) +const totalNum = ref(0) + + +/* +====================方法================================= +*/ + // 获取地区列表的方法 const getDept = async function () { try { // 发送请求获取地区列表 const result = await request({ - // url: '/general/dept', - - url: '/beanConsume/getDept', // todo 换成实际接口地址 + url: '/beanConsume/getDept', // 地区实际接口地址 data: { account: adminData.value.account } }) console.log('请求地区列表成功', result) @@ -103,27 +87,28 @@ const getDept = async function () { } } -// // 频道模糊查询方法 -// const filterChannel = (query) => { -// if (query) { -// return channels.value.filter(item => item.toLowerCase().includes(query.toLowerCase())); -// } -// return channels.value; -// }; - -// 新增排序字段和排序方式 -const sortField = ref('') -const sortOrder = ref('') - -// 合计数 -const permanentBean = ref(0) -const freeBean = ref(0) -const totalNum = ref(0) - +// 频道列表 +const channels = ref([]) +// 获取频道列表的方法 +const getChannel = async function () { + try { + const result = await request({ + url: '/beanConsume/getLiveChannel', // todo 换成实际接口地址 + data: { account: adminData.value.account } + }) + console.log('请求频道列表成功', result) + // 存储频道数据 + channels.value = result.data + console.log('频道数据', channels.value) + } catch (error) { + console.log('请求频道列表失败', error) + ElMessage({ + type: 'error', + message: '获取频道列表失败,请稍后重试' + }) + } +} -/* -====================方法================================= -*/ // 获取登录用户信息 const getAdminData = async function () { try { @@ -139,10 +124,9 @@ const getAdminData = async function () { } } - -const ConsumeSelectBy = async function (val) { +// 搜索方法 +const searchCart = async function () { try { - // 搜索参数页码赋值 if (typeof val === 'number') { getObj.value.pageNum = val @@ -151,19 +135,16 @@ const ConsumeSelectBy = async function (val) { if (getTime.value != null) { if (getTime.value.startTime != '' && getTime.value.endTime != '') { - beanConsumeArticle.value.startTime = formatTime(getTime.value[0]) - beanConsumeArticle.value.endTime = formatTime(getTime.value[1]) + beanCart.value.startTime = formatTime(getTime.value[0]) + beanCart.value.endTime = formatTime(getTime.value[1]) } } else { - beanConsumeArticle.value.startTime = '' - beanConsumeArticle.value.endTime = '' + beanCart.value.startTime = '' + beanCart.value.endTime = '' } - beanConsumeArticle.value.sortField = sortField.value - beanConsumeArticle.value.sortOrder = sortOrder.value + beanCart.value.sortField = sortField.value + beanCart.value.sortOrder = sortOrder.value - console.log('搜索参数_时间', beanConsumeArticle.value.startTime) - console.log('搜索参数1', getObj.value) - console.log('搜索参数2', beanConsumeArticle.value) // 发送POST请求 const result = await request({ @@ -171,210 +152,134 @@ const ConsumeSelectBy = async function (val) { data: { pageNum: getObj.value.pageNum, pageSize: getObj.value.pageSize, - beanConsumeArticle: { - ...beanConsumeArticle.value, - jwcode: beanConsumeArticle.value.jwcode, - dept: beanConsumeArticle.value.dept, - payMode: beanConsumeArticle.value.payMode, - articleId: beanConsumeArticle.value.articleId, - articleName: beanConsumeArticle.value.articleName, - author: beanConsumeArticle.value.author, - startTime: beanConsumeArticle.value.startTime, - endTime: beanConsumeArticle.value.endTime, - sortField: beanConsumeArticle.value.sortField, - sortOrder: beanConsumeArticle.value.sortOrder, + beanCart: { + ...beanCart.value, + sortField: sortField.value, + sortOrder: sortOrder.value, } } }) - console.log('请求成功4', sortField) - console.log('接口响应结果', result); // 打印接口响应结果 - if (result.code === 200 && result.data && result.data.list) { - // 过滤返回的数据,确保 type 值符合 payMode 规则 - const filteredList = result.data.list.filter(item => { - if (beanConsumeArticle.value.payMode === '0') { - return [9, 10].includes(Number(item.type)); - } else if (beanConsumeArticle.value.payMode === '1') { - return Number(item.type) === 11; - } - return true; - }); - tableData.value = filteredList; - - } - // 合计数的接口 - // 复制一份 beanConsumeArticle.value 并设置固定的 payType 值 8是文章的 const sumConsumeParams = { - payType: 8, // 固定传入 payType 值 8 - beanConsumeArticle: { - ...beanConsumeArticle.value, - + beanCart: { + ...beanCart.value, } - }; + } // 发送 POST 请求获取合计数 const resultTotalGold = await request({ url: '/beanConsume/sumConsumeGold', data: sumConsumeParams - }); + }) - console.log("总计", resultTotalGold); + console.log("总计", resultTotalGold) - const data = resultTotalGold.data || resultTotalGold; - console.log('请求成功3', resultTotalGold.data) - console.log('permanentBean3', data.permanentBean) + const data = resultTotalGold.data || resultTotalGold // 返回字段为 permanentBean、freeBean、totalNum - permanentBean.value = Number(data.permanentBean) || 0; - freeBean.value = Number(data.freeBean) || 0; - totalNum.value = Number(data.totalNum) || 0; + permanentBean.value = Number(data.permanentBean) || 0 + freeBean.value = Number(data.freeBean) || 0 + totalNum.value = Number(data.totalNum) || 0 // 存储分页总数 total.value = result.data.total console.log('total', total.value) } catch (error) { console.log('请求失败', error) + ElMessage({ + type: 'error', + message: '搜索失败,请稍后重试' + }) } } -// 搜索 + const search = function () { getObj.value.pageNum = 1 - if (beanConsumeArticle.value.jwcode) { + if (beanConsumeLive.value.jwcode) { const numRef = /^\d{1,9}$/; - if (!numRef.test(beanConsumeArticle.value.jwcode)) { + if (!numRef.test(beanConsumeLive.value.jwcode)) { ElMessage.error('请检查精网号格式') return } } - if (beanConsumeArticle.value.articleId) { - const numRef = /^\d{1,9}$/; - if (!numRef.test(beanConsumeArticle.value.articleId)) { - ElMessage.error('请检查文章ID格式') - return - } - } - ConsumeSelectBy() + searchCart() } -// 重置 -const reset = function () { - console.log('文章/视频的重置') - - beanConsumeArticle.value.jwcode = null - beanConsumeArticle.value.dept = '' - beanConsumeArticle.value.type = '' - beanConsumeArticle.value.payMode = '' - beanConsumeArticle.value.articleId = '' - beanConsumeArticle.value.articleName = '' - beanConsumeArticle.value.author = '' - beanConsumeArticle.value.startTime = '' - beanConsumeArticle.value.endTime = '' +// 重置 +const reset = function () { + console.log('重置搜索条件') + + beanCart.value = { + jwcode: null, + dept: "", + goodsName: "", + channelName: "", + liveName: "", + startTime: '', + endTime: '', + } sortField.value = '' sortOrder.value = '' getTime.value = {} - activeTimeRange.value = '' // 清除激活状态 - - - // 点完重置后,重新请求数据 - ConsumeSelectBy() - console.log(' beanConsumeArticle', beanConsumeArticle.value) -} -// 今天 -const getToday = function () { - const today = dayjs() - const startTime = today.startOf('day').format('YYYY-MM-DD HH:mm:ss') - const endTime = today.endOf('day').format('YYYY-MM-DD HH:mm:ss') - getTime.value = [startTime, endTime] - console.log('getTime', getTime.value) - activeTimeRange.value = 'today' // 标记当前激活状态 - - ConsumeSelectBy() -} -// 昨天 -const getYesterday = function () { - const today = dayjs() - const startTime = today.subtract(1, 'day').startOf('day').format('YYYY-MM-DD HH:mm:ss') - const endTime = today.subtract(1, 'day').endOf('day').format('YYYY-MM-DD HH:mm:ss') - getTime.value = [startTime, endTime] - console.log('getTime', getTime.value) - activeTimeRange.value = 'yesterday' // 标记当前激活状态 - - ConsumeSelectBy() -} -// 近7天 -const get7Days = function () { - const today = dayjs() - const startTime = today.subtract(6, 'day').startOf('day').format('YYYY-MM-DD HH:mm:ss') - const endTime = today.endOf('day').format('YYYY-MM-DD HH:mm:ss') - getTime.value = [startTime, endTime] - console.log('getTime', getTime.value) - activeTimeRange.value = '7days' // 标记当前激活状态 - - ConsumeSelectBy() + + // 重置后重新请求数据 + searchCart() } +// 处理日期选择 +const handleDatePickerChange = (value) => { + if (value && value.length === 2) { + beanCart.value.startTime = formatTime(value[0]) + beanCart.value.endTime = formatTime(value[1]) + } else { + beanCart.value.startTime = '' + beanCart.value.endTime = '' + } +} // 处理排序事件 const handleSortChange = (column) => { console.log('排序字段:', column.prop) console.log('排序方式:', column.order) - if (column.prop === 'beanNum') { - sortField.value = 'beanNum' - } else if (column.prop === 'consumeTime') { - sortField.value = 'consumeTime' - } else if (column.prop === 'buyBean') { - sortField.value = 'buyBean' - } else if (column.prop === 'freeBean') { - sortField.value = 'freeBean' + + // 只允许指定字段排序 + const allowedSortFields = ['beanNum', 'consumeTime'] + if (allowedSortFields.includes(column.prop)) { + sortField.value = column.prop + sortOrder.value = column.order === 'ascending' ? 'DESC' : 'ASC' + searchCart() } - sortOrder.value = column.order === 'ascending' ? 'DESC' : 'ASC' - ConsumeSelectBy() } const handlePageSizeChange = function (val) { getObj.value.pageSize = val - ConsumeSelectBy() + searchCart() } const handleCurrentChange = function (val) { getObj.value.pageNum = val - ConsumeSelectBy() + searchCart() } -/* -====================计算属性================================= -*/ - -// 计算总金币数 -// const totalBean = computed(() => permanentBean.value + freeBean.value) - -/* -====================监听================================= -*/ - -/* -====================挂载================================= -*/ const format3 = (num) => { // 每三位添加逗号 return num.toLocaleString('en-US') } + onMounted(async function () { await getAdminData() - await ConsumeSelectBy() - await getDept() - + await getChannel() + await searchCart() }) - const exportExcel = async function () { - const params = { //需要修改 + const params = { ...getObj.value, - "beanConsumeArticle": { - ...beanConsumeArticle.value, + "beanCart": { + ...beanCart.value, sortField: sortField.value, sortOrder: sortOrder.value, }, @@ -384,7 +289,10 @@ const exportExcel = async function () { ElMessage.success('导出成功') } } + const exportListVisible = ref(false) +const exportList = ref([]) +const exportListLoading = ref(false) // 打开导出列表弹窗 const openExportList = () => { @@ -392,22 +300,15 @@ const openExportList = () => { exportListVisible.value = true } -// 导出列表数据 -const exportList = ref([]) -// 导出列表加载状态 -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 === 8; //8表示文章/视频 - }); - exportList.value = filteredData + ElMessage.success('导出成功') } else { - ElMessage.error(result.msg || '获取导出列表失败') + ElMessage.error(result.msg || '获取导出列表失败') } } catch (error) { console.error('获取导出列表出错:', error) @@ -416,6 +317,7 @@ const getExportList = async () => { exportListLoading.value = false } } + // 下载导出文件 const downloadExportFile = (item) => { if (item.state === 2) { @@ -427,34 +329,36 @@ const downloadExportFile = (item) => { ElMessage.warning('文件还在导出中,请稍后再试') } } + //根据状态返回对应的标签类型 const getTagType = (state) => { switch (state) { case 0: - return 'info'; + return 'info' case 1: - return 'primary'; + return 'primary' case 2: - return 'success'; + return 'success' case 3: - return 'danger'; + return 'danger' default: - return 'info'; + return 'info' } } + //根据状态返回对应的标签文案 const getTagText = (state) => { switch (state) { case 0: - return '待执行'; + return '待执行' case 1: - return '执行中'; + return '执行中' case 2: - return '执行完成'; + return '执行完成' case 3: - return '执行出错'; + return '执行出错' default: - return '未知状态'; + return '未知状态' } } @@ -465,31 +369,28 @@ const getTagText = (state) => {
精网号: - +
所属地区: - +
商品名称: - - - - - +
-
- 频道名称: - - +
+ 频道: + +
- -
@@ -497,31 +398,34 @@ const getTagText = (state) => {
下单时间: - -
- - - 近7天 -
+
直播间名称: - +
-
- 查询 - 导出Excel + 查询 + 导出Excel 查看导出列表 - 重置 + 重置
+
金豆总数:{{ format3(Math.abs(permanentBean + freeBean)) }}     @@ -529,8 +433,13 @@ const getTagText = (state) => { 免费金豆数:{{ format3(Math.abs(freeBean)) }}
- +