diff --git a/vue/gold-system/src/views/recharge/addRecharge.vue b/vue/gold-system/src/views/recharge/addRecharge.vue index 0cfc42f..9572c52 100644 --- a/vue/gold-system/src/views/recharge/addRecharge.vue +++ b/vue/gold-system/src/views/recharge/addRecharge.vue @@ -10,6 +10,8 @@ import { range, re } from "mathjs"; import * as xlsx from 'xlsx'; import _, { before } from 'lodash'; import { th } from "element-plus/es/locales.mjs"; +import * as xlsx from "xlsx"; +import _ from "lodash"; // 这是添加上传图片的接口 const imageUrl = ref(""); @@ -382,15 +384,18 @@ const addLine = function () { paidGold: "0", }); }; -const loading = ref(false); +const loading = ref(true); // 添加多行 const addLines = async function () { + loading.value = true; try { loading.value = true; // 操作开始前,将loading设为true,显示加载动画 console.log(loading.value, "loading.value") await new Promise(resolve => setTimeout(resolve, 100)); // 人为创建一个小延迟 + // 操作开始前,将loading设为true,显示加载动画 + await nextTick(); // 等待视图更新,确保加载动画能及时显示出来 for (let j = 0; j < addLineObj.value; j++) { batchData.value.unshift({ line: ++i.value, @@ -401,7 +406,15 @@ const addLines = async function () { rechargeGold: "0", paidGold: "0", }); + batchData.value.unshift({ + line: ++i.value, + showInput: true, + }); } + + // 所有数据添加操作完成后,准备关闭加载动画 + await nextTick(); // 再次等待视图更新,确保数据添加操作引起的视图变化已完成 + loading.value = false; // 将loading设为false,关闭加载动画 ElMessage.success("添加成功"); console.log(batchData.value, "batchData.value"); } catch (error) { @@ -715,6 +728,57 @@ const batchAdd = async function () { } } console.log("batchData::", batchData.value); + console.log("batchData===", batchData.value); + let msg = ""; + if (batchData.value.length == 0) { + ElMessage({ + type: "error", + message: "至少需要输入一条数据!", + }); + return; + } + for (let i = 0; i < batchData.value.length; i++) { + batchData.value[i].adminId = adminData.value.adminId; + batchData.value[i].area = adminData.value.area; + batchData.value[i].rechargeWay = "客服充值"; + if (batchData.value[i].jwcode == "" || batchData.value[i].jwcode == null) { + msg += `精网号不能为空!
`; + } + if ( + batchData.value[i].activityId == "" || + batchData.value[i].activityId == null + ) { + msg += `活动不能为空!
`; + } + if ( + batchData.value[i].paidGold == "" || + batchData.value[i].paidGold == null + ) { + msg += `充值金币不能为空!
`; + } + if ( + batchData.value[i].rechargeGold == "" || + batchData.value[i].rechargeGold == null + ) { + msg += `充值金额不能为空!
`; + } + if (batchData.value[i].payWay == "" || batchData.value[i].payWay == null) { + msg += `收款方式不能为空!
`; + } + if ( + batchData.value[i].rechargeTime == "" || + batchData.value[i].rechargeTime == null + ) { + msg += `交款时间不能为空!
`; + } + ElMessage({ + dangerouslyUseHTMLString: true, + type: "error", + message: msg, + }); + return; + } + console.log("batchData===", batchData.value); const result = await API.post( "http://192.168.8.93:10010/recharge/recharge/addmore", @@ -867,14 +931,36 @@ onMounted(async function () { 批量充值 - + - 查询 + 查询 - - + + @@ -885,24 +971,66 @@ onMounted(async function () {

- - + + - - + + - + - - - - + + + + @@ -911,19 +1039,41 @@ onMounted(async function () {

- + - + - 重置 + 重置 提交
- - + + 客户信息 @@ -948,8 +1098,13 @@ onMounted(async function () { }} (永久金币:{{ user.buyJb }};免费金币:{{ + (充值金币:{{ user.buyJb }};免费金币:{{ user.free6 + user.free12 - }};任务金币:{{ user.coreJb }}) + }};任务金币:{{ user.coreJb }}) @@ -990,8 +1145,13 @@ onMounted(async function () { - +
@@ -999,17 +1159,38 @@ onMounted(async function () { 添加 + 添加
- 批量设置 + 批量设置 - 批量删除 + 批量删除
+