From 5aefc9797093fe880ef02c9f28fafc3a6ed2d444 Mon Sep 17 00:00:00 2001 From: lihuilin Date: Wed, 14 May 2025 10:34:40 +0800 Subject: [PATCH] =?UTF-8?q?0514=E6=97=A9=EF=BC=8C=E4=BF=AE=E5=87=A0?= =?UTF-8?q?=E4=B8=AAbug?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- gold-system/.env.development | 2 +- gold-system/.env.production | 2 +- gold-system/src/views/managerecharge/rate.vue | 141 ++++++++++------------- gold-system/src/views/recharge/addRecharge.vue | 78 +++++++++---- gold-system/src/views/recharge/adminRecharge.vue | 17 ++- gold-system/stats.html | 6 +- 6 files changed, 129 insertions(+), 117 deletions(-) diff --git a/gold-system/.env.development b/gold-system/.env.development index e9f1785..cd0100f 100644 --- a/gold-system/.env.development +++ b/gold-system/.env.development @@ -2,4 +2,4 @@ # VITE_API_BASE='http://192.168.8.94:8080/' VITE_API_BASE='https://hwjb.homilychart.com/gold_htms_dev' # VITE_API_BASE='http://54.251.137.151:10704/' -# VITE_API_BASE='http://192.168.8.220:8080/' +# VITE_API_BASE='http://192.168.8.232:8080/' diff --git a/gold-system/.env.production b/gold-system/.env.production index 70912af..5670e06 100644 --- a/gold-system/.env.production +++ b/gold-system/.env.production @@ -1,5 +1,5 @@ # VITE_API_BASE='http://54.251.137.151:10702/' VITE_API_BASE='https://hwjb.homilychart.com/gold_htms_prod' # VITE_API_BASE='https://hwjb.homilychart.com/gold_htms_dev' -# VITE_API_BASE='http://192.168.8.220:8080/' +# VITE_API_BASE='http://192.168.8.232:8080/' diff --git a/gold-system/src/views/managerecharge/rate.vue b/gold-system/src/views/managerecharge/rate.vue index 2a4b7e3..d4800f4 100644 --- a/gold-system/src/views/managerecharge/rate.vue +++ b/gold-system/src/views/managerecharge/rate.vue @@ -42,35 +42,63 @@ const getObj = ref({ const total = ref(0) //分页总条目 -// 时间选择器 -// const value1 = ref([]) // 时间数组 -// function handleDateChange(value) { -// if (value && value.length === 2) { -// value1.value.startTime = value[0] // 开始日期 -// value1.value.endTime = value[1] // 结束日期 -// } -// console.log(value1) -// } - -const time = ref({}) + +// 替换原来的time,用数组 +const timeRange = ref([]) + +// 格式化日期为YYYY-MM-DD HH:mm:ss,否则格式不对无法填充日期时间选择器 +const formatDateTime = (date) => { + return moment(date).format('YYYY-MM-DD HH:mm:ss') +} + +// 今天 +const getToday = () => { + const today = new Date() + const start = new Date(today.getFullYear(), today.getMonth(), today.getDate(), 0, 0, 0) + const end = new Date(today.getFullYear(), today.getMonth(), today.getDate() + 1, 0, 0, 0) + timeRange.value = [formatDateTime(start), formatDateTime(end)] + search() +} + +// 昨天 +const getYesterday = () => { + const yesterday = new Date() + yesterday.setDate(yesterday.getDate() - 1) + const start = new Date(yesterday.getFullYear(), yesterday.getMonth(), yesterday.getDate(), 0, 0, 0) + const end = new Date(yesterday.getFullYear(), yesterday.getMonth(), yesterday.getDate() + 1, 0, 0, 0) + timeRange.value = [formatDateTime(start), formatDateTime(end)] + search() +} + +// 近 7 天 +const get7Days = () => { + const today = new Date() + const start = new Date(today.getFullYear(), today.getMonth(), today.getDate() - 6, 0, 0, 0) + const end = new Date(today.getFullYear(), today.getMonth(), today.getDate() + 1, 0, 0, 0) + timeRange.value = [formatDateTime(start), formatDateTime(end)] + search() +} + const get = async function (val) { - // 搜索参数时间赋值 - // if (value1.value && value1.value.length === 2) { - // time.value.startTime = value1.value[0]; - // time.value.endTime = value1.value[1]; - // } else { - // time.value.startTime = ''; - // time.value.endTime = ''; - // } try { // 搜索参数页码赋值 if (typeof val === 'number') { getObj.value.pageNum = val; } + // 时间赋值 + const time = {} + if (timeRange.value.length === 2) { + time.startTime = moment(timeRange.value[0]).format('YYYY-MM-DD HH:mm:ss') + time.endTime = moment(timeRange.value[1]).format('YYYY-MM-DD HH:mm:ss') + } else { + time.startTime = '' + time.endTime = '' + } + console.log('搜索参数', { ...getObj.value, - rate: { ...time.value } + rate: { ...time } }); // 发送POST请求 const result = await request({ @@ -78,7 +106,7 @@ const get = async function (val) { method: 'POST', data: { ...getObj.value, - rate: { ...time.value } + rate: { ...time } } }); @@ -96,41 +124,6 @@ const get = async function (val) { } } -// 今天 -const getToday = () => { - const today = new Date() - // 格式化开始时间 - const startDate = moment(today).startOf('day').format('YYYY-MM-DD HH:mm:ss') - // 格式化结束时间,将结束时间设为当天 00:00:00 - const endDate = moment(today).add(1, 'days').startOf('day').format('YYYY-MM-DD HH:mm:ss') - time.value.startTime = startDate - time.value.endTime = endDate - search() -} - -// 昨天 -const getYesterday = () => { - const yesterday = moment().subtract(1, 'days') - // 格式化开始时间 - const startDate = yesterday.startOf('day').format('YYYY-MM-DD HH:mm:ss') - // 格式化结束时间,将结束时间设为当天 00:00:00 - const endDate = yesterday.add(1, 'days').startOf('day').format('YYYY-MM-DD HH:mm:ss') - time.value.startTime = startDate - time.value.endTime = endDate - search() -} - -// 近7天 -const get7Days = () => { - // 格式化开始时间 - const startDate = moment().subtract(6, 'days').startOf('day').format('YYYY-MM-DD HH:mm:ss') - // 格式化结束时间,将结束时间设为当天 00:00:00 - const endDate = moment().add(1, 'days').startOf('day').format('YYYY-MM-DD HH:mm:ss') - time.value.startTime = startDate - time.value.endTime = endDate - search() -} - // 搜索 const search = function () { getObj.value.pageNum = 1 @@ -414,8 +407,7 @@ const rules = reactive({ // 重置的按钮 const handledelete = function () { - time.value.startTime = '' - time.value.endTime = '' + timeRange.value={} getObj.value.pageNum = 1 } // 验证跳转输入框的数字是否合法 @@ -494,27 +486,16 @@ function handleInput(value) {
- - - 开始时间: - - - - - - 结束时间: + + + 时间范围: @@ -716,7 +697,7 @@ function handleInput(value) { { Ref.value.validate(async (valid) => { if (valid) { + if (Rate.value == null || Rate.value == '' || Rate.value == undefined) { + ElMessage({ + type: 'error', + message: '请选择币种' + }) + return + } + if(addRecharge.value.rechargeGold == null || addRecharge.value.rechargeGold == '' || addRecharge.value.rechargeGold == undefined){ + ElMessage({ + type: 'error', + message: '请输入充值金额' + }) + return + } ElMessageBox.confirm('确认添加?') .then(() => { add() @@ -165,19 +179,40 @@ const rules = reactive({ trigger: 'blur' } ], - // 必须进行选择 rechargeGold: [ { - required: true,message: '请选择充值方式',trigger: 'blur' - },{ - validator: (rule, value, callback) => { - if (value >= 0) { - callback() - } else { - callback(new Error('输入金额至少为0')) - } - } + required: true, + message: '请选择货币名称', + trigger: 'blur' + } + // { + // validator: (rule, value, callback) => { + // if (value != null && value!= '') { + // callback() + // } else { + // callback(new Error('请选择货币名称')) + // } + // }, + // trigger: 'blur' + // } + ], + 'addRecharge.rechargeGold': [ + { + required: true, + message: '请输入充值金额', + trigger: 'blur' } + // { + // validator: (rule, value, callback) => { + // if (typeof value === 'number' && value >= 0) { + // callback() + // } else { + // callback(new Error('输入金额至少为 0')) + // } + // }, + // trigger: 'blur' + // } + // 以上两个字段的校验在提交时触发 ], payWay: [{ required: true, message: '请选择付款方式', trigger: 'blur' }], rechargeTime: [{ required: true, message: '请选择交款时间', trigger: 'blur' }] @@ -336,9 +371,9 @@ const deleteRecharge = function () { area: adminData.value.area, rechargeVoucher: '', rechargeWay: '客服充值', - freeGold: Number(0), - rechargeGold: 0, - paidGold: Number(0) + freeGold: Number(), + rechargeGold: null, + paidGold: Number() } imageUrl.value = '' Rate.value = '' @@ -927,12 +962,13 @@ onMounted(async function () {

- + - + {{ scope.row.rate }} - + diff --git a/gold-system/src/views/recharge/adminRecharge.vue b/gold-system/src/views/recharge/adminRecharge.vue index 51c6c1a..75fe9aa 100644 --- a/gold-system/src/views/recharge/adminRecharge.vue +++ b/gold-system/src/views/recharge/adminRecharge.vue @@ -416,6 +416,7 @@ const sortField = ref('') const sortOrder = ref('') // 处理排序事件 const handleSortChange = (column) => { + get() console.log('排序字段:', column.prop) console.log('排序方式:', column.order) if (column.prop === 'paidGold') { @@ -426,11 +427,9 @@ const handleSortChange = (column) => { sortField.value = 'recharge_time' } else if (column.prop === 'createTime') { sortField.value = 'create_time' - } else if (column.prop === 'paidMoney') { - sortField.value = 'paid_gold' - } + } sortOrder.value = column.order === 'ascending' ? 'ASC' : 'DESC' - get() + } @@ -582,23 +581,23 @@ const handleSortChange = (column) => { label="活动名称" width="150px" /> - + { /> diff --git a/gold-system/stats.html b/gold-system/stats.html index 3574152..bb5c14d 100644 --- a/gold-system/stats.html +++ b/gold-system/stats.html @@ -4929,11 +4929,7 @@ var drawChart = (function (exports) {