diff --git a/vue/gold-system/src/views/managerecharge/activity.vue b/vue/gold-system/src/views/managerecharge/activity.vue index 616625b..329fd48 100644 --- a/vue/gold-system/src/views/managerecharge/activity.vue +++ b/vue/gold-system/src/views/managerecharge/activity.vue @@ -27,10 +27,9 @@ const getObj = ref({ const addObj = ref({ add: '', }) +// 删除 // 删除对象 -const delObj = ref({ - del: '', -}); +const delObj = ref({}); //表格高度 const tableHeight = computed(function () { return (getObj.value.pageSize + 1) * 50 + 'px'; diff --git a/vue/gold-system/src/views/recharge/adminRecharge.vue b/vue/gold-system/src/views/recharge/adminRecharge.vue index ea27184..6f37819 100644 --- a/vue/gold-system/src/views/recharge/adminRecharge.vue +++ b/vue/gold-system/src/views/recharge/adminRecharge.vue @@ -2,7 +2,7 @@ import { ref, onMounted, reactive, computed } from "vue"; import ElementPlus from "element-plus"; import { AiFillRead } from "vue-icons-plus/ai"; - +import axios from 'axios'; // 变量 // 用户对象假的 const admin = ref({ @@ -13,47 +13,54 @@ const admin = ref({ // 充值明细表格 const tableData = ref([]); - +// 搜索=========================================== // 搜索recharge const rechargeVo = ref({ - name: admin.value.name, - area: admin.value.area, adminId: admin.value.adminId, }); - // 搜索对象 const getObj = ref({ pageNum: 1, pageSize: 5, }); //分页总条目 -const total = ref(100) -//下拉框 -const value = ref('') -//默认高亮选项 +const total = ref(100); +// 搜索对象时间 +const getTime = ref([]); +// 搜索活动列表 +const activity = ref([]); +// 所有信息 +const allData = ref([]); +// 搜索地区列表 +const area = ref([]); +//标签页默认高亮选项 const activeName = ref('all') -const options = [ +// 支付方式选项 +const payWay = [ { - value: 'Option1', - label: 'Option1', + value: '微信', + label: '微信', }, { - value: 'Option2', - label: 'Option2', + value: '支付宝', + label: '支付宝', }, { - value: 'Option3', - label: 'Option3', + value: '银联', + label: '银联', }, { - value: 'Option4', - label: 'Option4', + value: '信用卡', + label: '信用卡', }, { - value: 'Option5', - label: 'Option5', + value: '借记卡', + label: '借记卡', }, ] +// 删除========================================================== +// 删除对象 +const delObj = ref({}); //表格高度 const tableHeight = computed(function () { @@ -61,6 +68,7 @@ const tableHeight = computed(function () { }); // 方法 +// 搜索=========================================================================== // 搜索方法 const get = async function (val) { try { @@ -68,9 +76,19 @@ const get = async function (val) { if (typeof val === 'number') { getObj.value.pageNum = val; } + // 搜索参数时间赋值 + if (getTime.value != null) { + if (getTime.value.startDate != '' && getTime.value.endDate != '') { + rechargeVo.value.startDate = getTime.value[0]; + rechargeVo.value.endDate = getTime.value[1]; + } + } else { + rechargeVo.value.startDate = ''; + rechargeVo.value.endDate = ''; + } console.log('搜索参数', getObj.value); // 发送POST请求 - const result = await axios.post('http://192.168.8.93:10010/recharge/recharge', {...getObj.value,rechargeVo:{...rechargeVo.value}}); + const result = await axios.post('http://192.168.8.93:10010/recharge/recharge', { ...getObj.value, rechargeVo: { ...rechargeVo.value } }); // 将响应结果存储到响应式数据中 console.log('请求成功', result); @@ -86,28 +104,64 @@ const get = async function (val) { } } - +// 重置 +const reset = function () { + rechargeVo.value.activityId = ''; + rechargeVo.value.payWay = ''; + rechargeVo.value.area = ''; + rechargeVo.value.startDate = ''; + rechargeVo.value.endDate = ''; + get(); +} +// 今天 +const getToday = function () { + const today = new Date(); + const startDate = new Date(today.getFullYear(), today.getMonth(), today.getDate()); + const endDate = new Date(today.getFullYear(), today.getMonth(), today.getDate() + 1); + getTime.value = [startDate, endDate]; + console.log('getTime', getTime.value); + get(); +} +// 昨天 +const getYesterday = function () { + const yesterday = new Date(); + yesterday.setDate(yesterday.getDate() - 1); + const startDate = new Date(yesterday.getFullYear(), yesterday.getMonth(), yesterday.getDate()); + const endDate = new Date(yesterday.getFullYear(), yesterday.getMonth(), yesterday.getDate() + 1); + getTime.value = [startDate, endDate]; + console.log('getTime', getTime.value); + get(); +} +// 近7天 +const get7Days = function () { + const today = new Date(); + const startDate = new Date(today.getFullYear(), today.getMonth(), today.getDate() - 6); + const endDate = new Date(today.getFullYear(), today.getMonth(), today.getDate() + 1); + getTime.value = [startDate, endDate]; + console.log('getTime', getTime.value); + get(); +} //全部充值明细 const adminAll = function () { console.log('adminAll'); - rechargeVo.value.status=''; + rechargeVo.value.status = ''; get(); } //待审核充值明细 const adminWait = function () { - rechargeVo.value.status=0; + rechargeVo.value.status = 0; get(); console.log('adminWait'); } //已通过充值明细 const adminPass = function () { - rechargeVo.value.status=1; + rechargeVo.value.status = 1; get(); console.log('adminPass'); } //已驳回充值明细 const adminReject = function () { - rechargeVo.value.status=2; + rechargeVo.value.status = 2; get(); console.log('adminReject'); } @@ -123,12 +177,70 @@ const handleClick = function (tab, event) { adminReject(); } } +// 获取活动名称 +const getActivity = async function () { + try { + // 发送POST请求 + const result = await axios.post('http://192.168.8.93:10010/recharge/activity/select', {}); + // 将响应结果存储到响应式数据中 + console.log('请求成功', result); + // 存储表格数据 + activity.value = result.data.data; + console.log('activity', activity.value); + } catch (error) { + console.log('请求失败', error); + // 在这里可以处理错误逻辑,比如显示错误提示等 + } +} +// 获取地区 +const getArea = async function () { + try { + // 发送POST请求 + const result = await axios.post('http://192.168.8.93:10010/recharge/recharge', {}); + // 将响应结果存储到响应式数据中 + console.log('请求成功', result); + // 存储全部数据 + allData.value = result.data.data; + console.log('allData', allData.value); + // 分离并去重地区列表 + area.value = [...new Set(allData.value.map(item => item.area))] + console.log('地区', area.value); + } catch (error) { + console.log('请求失败', error); + // 在这里可以处理错误逻辑,比如显示错误提示等 + } -const Delete = function (index, row) { - console.log(index, row) +} +// 删除================================= +// 点击删除按钮 +const del = function (row) { + delObj.value.rechargeId = row.rechargeId; + console.log('delObj1', delObj.value); +} +// 确认删除按钮 +const delConfirm = async function () { + try { + console.log('delObj2', delObj.value); + const result = await axios.post('http://192.168.8.93:10010/recharge/recharge/edit', delObj.value); + console.log('删除成功', result); + // 刷新表格数据 + get(); + } catch (error) { + console.log('请求失败', error); + // 在这里可以处理错误逻辑,比如显示错误提示等 + } } +// 挂载 +onMounted(async function () { + await get(); + getActivity(); + await getArea(); +}) + + +