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/recharge/addRecharge.vue b/vue/gold-system/src/views/recharge/addRecharge.vue
index b3736e8..d71e15a 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 _ from 'lodash';
// 这是添加上传图片的接口
const imageUrl = ref("");
@@ -270,8 +270,6 @@ const deleteRecharge = function () {
// 批量充值
// jwcode列表
const jwcodeList = ref([]);
-// jwcode下拉框懒加载变量
-const rangeNumber = ref(10);
// 获取jwcode列表
const getJwcodeList = async function () {
try {
@@ -292,30 +290,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);
@@ -687,7 +661,8 @@ const batchAdd = async function () {
closeBatchRechargeVisible();
};
-
+// 使用 _.throttle 并设置 trailing 为 false 实现严格节流,只执行一次
+const throttledBatchAdd = _.throttle(batchAdd, 5000, { trailing: false });
// 批量设置的对象
const batchSettingObj = ref({});
// 批量充值弹窗
@@ -925,12 +900,6 @@ onMounted(async function () {
{{ scope.row.jwcode }}
-->
-
@@ -1055,7 +1024,7 @@ onMounted(async function () {
取消
- 提交
+ 提交
diff --git a/vue/gold-system/src/views/refund/addRefund.vue b/vue/gold-system/src/views/refund/addRefund.vue
index 3fccc9a..d593220 100644
--- a/vue/gold-system/src/views/refund/addRefund.vue
+++ b/vue/gold-system/src/views/refund/addRefund.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 addRe = ref({
typeR: "0",