diff --git a/vue/gold-system/src/util/index.js b/vue/gold-system/src/util/index.js deleted file mode 100644 index 17d9080..0000000 --- a/vue/gold-system/src/util/index.js +++ /dev/null @@ -1,37 +0,0 @@ -// 防抖 -function _debounce(fn, delay = 500) { - var timer = null; - return function () { - var _this = this; - var args = arguments; - if (timer) clearTimeout(timer); - timer = setTimeout(function () { - fn.apply(_this, args); - }, delay); - }; -} - -// 节流 -function _throttle(fn, delay = 1000) { - var lastTime, timer, delay; - return function () { - var _this = this; - var args = arguments; - var nowTime = Date.now(); - if (lastTime && nowTime - lastTime < delay) { - if (timer) clearTimeout(timer); - timer = setTimeout(function () { - lastTime = nowTime; - fn.apply(_this, args); - }, delay) - } else { - lastTime = nowTime; - fn.apply(_this, args); - } - } -} - -export { - _debounce, - _throttle, -} \ No newline at end of file diff --git a/vue/gold-system/src/views/consume/addConsume.vue b/vue/gold-system/src/views/consume/addConsume.vue index e3efd6a..a74c252 100644 --- a/vue/gold-system/src/views/consume/addConsume.vue +++ b/vue/gold-system/src/views/consume/addConsume.vue @@ -7,6 +7,7 @@ import axios from "axios"; import { ElMessageBox } from "element-plus"; import API from "../../api/index.js"; import moment from "moment"; +import _ from 'lodash'; //这是获取用户信息的接口 const adminData = ref({}); diff --git a/vue/gold-system/src/views/managerecharge/rate.vue b/vue/gold-system/src/views/managerecharge/rate.vue index b774fc1..fcbdd10 100644 --- a/vue/gold-system/src/views/managerecharge/rate.vue +++ b/vue/gold-system/src/views/managerecharge/rate.vue @@ -5,6 +5,7 @@ import axios from "axios"; import { createApp } from "vue"; import moment from "moment"; import API from "../../api/index.js"; +import _ from "lodash"; // 查询用户接口 const adminData = ref({ @@ -159,7 +160,8 @@ const add = () => { } }); }; - +// 使用 _.throttle 并设置 trailing 为 false 实现严格节流,只执行一次 +const throttledAdd = _.throttle(add, 5000, { trailing: false }); // 编辑方法 const rateEdit = ref({}); //查询已有的数据 @@ -663,7 +665,7 @@ function handleInput(value) { diff --git a/vue/gold-system/src/views/recharge/addRecharge.vue b/vue/gold-system/src/views/recharge/addRecharge.vue index 2ebbf9a..8b18081 100644 --- a/vue/gold-system/src/views/recharge/addRecharge.vue +++ b/vue/gold-system/src/views/recharge/addRecharge.vue @@ -7,8 +7,8 @@ import { ElMessageBox } from "element-plus"; import API from "../../api/index.js"; import moment from "moment"; import { range, re } from "mathjs"; -import { _debounce } from "../../util/index.js"; -import * as xlsx from "xlsx"; +import * as xlsx from 'xlsx'; +import _ from 'lodash'; // 这是添加上传图片的接口 const imageUrl = ref(""); @@ -292,8 +292,6 @@ const deleteRecharge = function () { // 批量充值 // jwcode列表 const jwcodeList = ref([]); -// jwcode下拉框懒加载变量 -const rangeNumber = ref(10); // 获取jwcode列表 const getJwcodeList = async function () { try { @@ -317,30 +315,6 @@ const getJwcodeList = async function () { // 在这里可以处理错误逻辑,比如显示错误提示等 } }; -// 滚动到底部加载更多数据 -const loadMore = (n) => { - return () => { - rangeNumber.value += 5; - }; -}; -// 筛选方法 -const filterMethod = _debounce(function (filterVal) { - if (filterVal) { - const filterArr = jwcodeList.value.fliter((item) => - item.toLowerCase().includes(filterVal.toLowerCase()) - ); - options.value = filterArr; - } else { - options.value = jwcodeList.value; - } -}, 500); -// 下拉框出现时调用过滤方法 -const visibleChange = function (flag) { - if (flag) { - filterMethod(); - } -}; - // 批量充值弹窗 const batchRechargeVisible = ref(false); const jwcodeSelectRef = ref(null); @@ -672,6 +646,7 @@ const handleBatchAvatarSuccess = (response, uploadFile) => { //批量充值确认按钮 const batchAdd = async function () { console.log("batchData===", batchData.value); + let msg = ''; if (batchData.value.length == 0) { ElMessage({ type: "error", @@ -685,24 +660,40 @@ const batchAdd = async function () { batchData.value[i].rechargeWay = "客服充值"; if ( batchData.value[i].jwcode == "" || - batchData.value[i].jwcode == null || + batchData.value[i].jwcode == null) { + msg += `精网号不能为空!
`; + } + if ( batchData.value[i].activityId == "" || - batchData.value[i].activityId == null || + batchData.value[i].activityId == null) { + msg += `活动不能为空!
`; + } + if ( batchData.value[i].paidGold == "" || - batchData.value[i].paidGold == null || + batchData.value[i].paidGold == null) { + msg += `充值金币不能为空!
`; + } + if ( batchData.value[i].rechargeGold == "" || - batchData.value[i].rechargeGold == null || + batchData.value[i].rechargeGold == null) { + msg += `充值金额不能为空!
`; + } + if ( batchData.value[i].payWay == "" || - batchData.value[i].payWay == null || + batchData.value[i].payWay == null) { + msg += `收款方式不能为空!
`; + } + if ( batchData.value[i].rechargeTime == "" || - batchData.value[i].rechargeTime == null - ) { - ElMessage({ - type: "error", - message: "信息不能为空!请检查输入内容!", - }); - return; + batchData.value[i].rechargeTime == null) { + msg += `交款时间不能为空!
`; } + ElMessage({ + dangerouslyUseHTMLString: true, + type: "error", + message: msg, + }); + return; } console.log("batchData===", batchData.value); @@ -723,7 +714,8 @@ const batchAdd = async function () { closeBatchRechargeVisible(); }; - +// 使用 _.throttle 并设置 trailing 为 false 实现严格节流,只执行一次 +const throttledBatchAdd = _.throttle(batchAdd, 5000, { trailing: false }); // 批量设置的对象 const batchSettingObj = ref({}); // 批量充值弹窗 @@ -839,36 +831,14 @@ onMounted(async function () { 批量充值 - + - 查询 + 查询 - - + + @@ -879,66 +849,24 @@ onMounted(async function () {

- - + + - - + + - + - - - - + + + + @@ -947,41 +875,19 @@ onMounted(async function () {

- + - + - 重置 + 重置 提交
- - + + 客户信息 @@ -1004,13 +910,10 @@ onMounted(async function () { {{ user.buyJb + user.free6 + user.free12 + user.coreJb }} - (充值金币:{{ user.buyJb }};免费金币:{{ + (充值金币:{{ user.buyJb + }};免费金币:{{ user.free6 + user.free12 - }};任务金币:{{ user.coreJb }}) + }};任务金币:{{ user.coreJb }}) @@ -1051,50 +954,26 @@ onMounted(async function () { - +
添加 - 添加 + 添加
- 批量设置 + 批量设置 - 批量删除 + 批量删除
- + -->