|
|
@ -7,7 +7,7 @@ import { ElMessageBox } from "element-plus"; |
|
|
|
import API from "../../api/index.js"; |
|
|
|
import moment from "moment"; |
|
|
|
import { range, re } from "mathjs"; |
|
|
|
import * as xlsx from 'xlsx'; |
|
|
|
import * as xlsx from "xlsx"; |
|
|
|
import _ from "lodash"; |
|
|
|
|
|
|
|
// 这是添加上传图片的接口 |
|
|
@ -256,7 +256,9 @@ function handleActivityChange(value) { |
|
|
|
// 监听 paidGold 的变化 |
|
|
|
const calculatedFree = computed(() => { |
|
|
|
if ( |
|
|
|
Math.trunc(addRecharge.value.paidGold / addRecharge.value.rechargeRatio) < 1 |
|
|
|
Math.trunc(addRecharge.value.paidGold / addRecharge.value.rechargeRatio) < |
|
|
|
1 || |
|
|
|
addRecharge.value.rechargeRatio == 0 |
|
|
|
) { |
|
|
|
return 0; |
|
|
|
} else { |
|
|
@ -322,17 +324,17 @@ const errorCount = ref(0); |
|
|
|
// 校验规则 |
|
|
|
const validateInput = function (row, index) { |
|
|
|
console.log(jwcodeSet.has(row.jwcode), "has"); |
|
|
|
if (!jwcodeSet.has(row.jwcode) && row.jwcode != '' && row.jwcode != null) { |
|
|
|
if (!jwcodeSet.has(row.jwcode) && row.jwcode != "" && row.jwcode != null) { |
|
|
|
row.isInputInvalid = true; |
|
|
|
row.inputErrorMessage = '精网号不存在'; |
|
|
|
row.inputErrorMessage = "精网号不存在"; |
|
|
|
errorCount.value++; |
|
|
|
return; |
|
|
|
} else { |
|
|
|
row.isInputInvalid = false; |
|
|
|
row.inputErrorMessage = ''; |
|
|
|
row.inputErrorMessage = ""; |
|
|
|
errorCount.value--; |
|
|
|
} |
|
|
|
} |
|
|
|
}; |
|
|
|
|
|
|
|
// 批量充值弹窗 |
|
|
|
const batchRechargeVisible = ref(false); |
|
|
@ -347,7 +349,7 @@ const batchData = ref([ |
|
|
|
line: 1, |
|
|
|
showInput: true, |
|
|
|
isInputInvalid: false, |
|
|
|
inputErrorMessage: '', |
|
|
|
inputErrorMessage: "", |
|
|
|
freeGold: "0", |
|
|
|
rechargeGold: "0", |
|
|
|
paidGold: "0", |
|
|
@ -375,7 +377,7 @@ const addLine = function () { |
|
|
|
line: ++i.value, |
|
|
|
showInput: true, |
|
|
|
isInputInvalid: false, |
|
|
|
inputErrorMessage: '', |
|
|
|
inputErrorMessage: "", |
|
|
|
freeGold: "0", |
|
|
|
rechargeGold: "0", |
|
|
|
paidGold: "0", |
|
|
@ -387,9 +389,9 @@ const addLines = async function () { |
|
|
|
loading.value = true; |
|
|
|
try { |
|
|
|
loading.value = true; // 操作开始前,将loading设为true,显示加载动画 |
|
|
|
console.log(loading.value, "loading.value") |
|
|
|
console.log(loading.value, "loading.value"); |
|
|
|
|
|
|
|
await new Promise(resolve => setTimeout(resolve, 100)); // 人为创建一个小延迟 |
|
|
|
await new Promise((resolve) => setTimeout(resolve, 100)); // 人为创建一个小延迟 |
|
|
|
|
|
|
|
// 操作开始前,将loading设为true,显示加载动画 |
|
|
|
await nextTick(); // 等待视图更新,确保加载动画能及时显示出来 |
|
|
@ -398,7 +400,7 @@ const addLines = async function () { |
|
|
|
line: ++i.value, |
|
|
|
showInput: true, |
|
|
|
isInputInvalid: false, |
|
|
|
inputErrorMessage: '', |
|
|
|
inputErrorMessage: "", |
|
|
|
freeGold: "0", |
|
|
|
rechargeGold: "0", |
|
|
|
paidGold: "0", |
|
|
@ -415,9 +417,9 @@ const addLines = async function () { |
|
|
|
ElMessage.error("添加失败"); |
|
|
|
} finally { |
|
|
|
loading.value = false; |
|
|
|
console.log(loading.value, "loading.value") |
|
|
|
console.log(loading.value, "loading.value"); |
|
|
|
} |
|
|
|
} |
|
|
|
}; |
|
|
|
// 添加多行点击按钮 |
|
|
|
// const addLines = async function () { |
|
|
|
// try { |
|
|
@ -451,7 +453,7 @@ const addLines = async function () { |
|
|
|
// } |
|
|
|
// }; |
|
|
|
// 使用 _.throttle 并设置 trailing 为 false 实现严格节流,只执行一次 |
|
|
|
const throttledAddLines = _.throttle(addLines, 500, { trailing: false }); |
|
|
|
const throttledAddLines = _.throttle(addLines, 500, { trailing: false }); |
|
|
|
// 导入excel按钮的ref |
|
|
|
const uploadRefMap = ref({}); |
|
|
|
// 获取excel数据 |
|
|
@ -655,7 +657,7 @@ const handleBatchAvatarSuccess = (response, uploadFile) => { |
|
|
|
const batchAdd = async function () { |
|
|
|
try { |
|
|
|
console.log("batchData===", batchData.value); |
|
|
|
let msg = ''; |
|
|
|
let msg = ""; |
|
|
|
if (batchData.value.length == 0) { |
|
|
|
ElMessage({ |
|
|
|
type: "error", |
|
|
@ -677,40 +679,47 @@ const batchAdd = async function () { |
|
|
|
batchData.value[i].rechargeWay = "客服充值"; |
|
|
|
if ( |
|
|
|
batchData.value[i].jwcode == "" || |
|
|
|
batchData.value[i].jwcode == null) { |
|
|
|
batchData.value[i].jwcode == null |
|
|
|
) { |
|
|
|
msg += `精网号不能为空! <br/>`; |
|
|
|
} |
|
|
|
if ( |
|
|
|
batchData.value[i].activityId == "" || |
|
|
|
batchData.value[i].activityId == null) { |
|
|
|
batchData.value[i].activityId == null |
|
|
|
) { |
|
|
|
msg += `活动不能为空! <br/>`; |
|
|
|
} |
|
|
|
if ( |
|
|
|
batchData.value[i].paidGold == "" || |
|
|
|
batchData.value[i].paidGold == null) { |
|
|
|
batchData.value[i].paidGold == null |
|
|
|
) { |
|
|
|
msg += `永久金币不能为空! <br/>`; |
|
|
|
} |
|
|
|
if ( |
|
|
|
batchData.value[i].freeGold == "" || |
|
|
|
batchData.value[i].freeGold == null) { |
|
|
|
batchData.value[i].freeGold == null |
|
|
|
) { |
|
|
|
msg += `免费金币不能为空! <br/>`; |
|
|
|
} |
|
|
|
if ( |
|
|
|
batchData.value[i].rechargeGold == "" || |
|
|
|
batchData.value[i].rechargeGold == null) { |
|
|
|
batchData.value[i].rechargeGold == null |
|
|
|
) { |
|
|
|
msg += `充值金额不能为空! <br/>`; |
|
|
|
} |
|
|
|
if ( |
|
|
|
batchData.value[i].payWay == "" || |
|
|
|
batchData.value[i].payWay == null) { |
|
|
|
batchData.value[i].payWay == null |
|
|
|
) { |
|
|
|
msg += `收款方式不能为空! <br/>`; |
|
|
|
} |
|
|
|
if ( |
|
|
|
batchData.value[i].rechargeTime == "" || |
|
|
|
batchData.value[i].rechargeTime == null) { |
|
|
|
batchData.value[i].rechargeTime == null |
|
|
|
) { |
|
|
|
msg += `交款时间不能为空! <br/>`; |
|
|
|
} |
|
|
|
if (msg != '' && msg != null) { |
|
|
|
if (msg != "" && msg != null) { |
|
|
|
console.log(batchData.value[i]); |
|
|
|
ElMessage({ |
|
|
|
dangerouslyUseHTMLString: true, |
|
|
@ -720,8 +729,8 @@ const batchAdd = async function () { |
|
|
|
return; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
console.log("batchData===", batchData.value); |
|
|
|
|
|
|
|
console.log("batchData===", batchData.value); |
|
|
|
|
|
|
|
const result = await API.post( |
|
|
|
"http://192.168.8.93:10010/recharge/recharge/addmore", |
|
|
@ -743,8 +752,8 @@ const batchAdd = async function () { |
|
|
|
console.log("error===", error); |
|
|
|
ElMessage.error("添加失败"); |
|
|
|
return; |
|
|
|
}; |
|
|
|
} |
|
|
|
} |
|
|
|
}; |
|
|
|
// 使用 _.throttle 并设置 trailing 为 false 实现严格节流,只执行一次 |
|
|
|
const throttledBatchAdd = _.throttle(batchAdd, 2000, { trailing: false }); |
|
|
|
// 批量设置的对象 |
|
|
@ -1039,8 +1048,10 @@ onMounted(async function () { |
|
|
|
<span style="color: #2fa1ff; margin-right: 5px" v-if="user.buyJb">{{ |
|
|
|
user.buyJb + user.free6 + user.free12 + user.coreJb |
|
|
|
}}</span> |
|
|
|
<span style="display: inline; white-space: nowrap; color: #b1b1b1" v-if="user.buyJb">(永久金币:{{ user.buyJb |
|
|
|
}};免费金币:{{ |
|
|
|
<span |
|
|
|
style="display: inline; white-space: nowrap; color: #b1b1b1" |
|
|
|
v-if="user.buyJb" |
|
|
|
>(永久金币:{{ user.buyJb }};免费金币:{{ |
|
|
|
user.free6 + user.free12 |
|
|
|
}};任务金币:{{ user.coreJb }})</span |
|
|
|
> |
|
|
@ -1095,9 +1106,19 @@ onMounted(async function () { |
|
|
|
<!-- <el-button type="primary" @click="addLine()" style="margin-right: 10px">新增一行</el-button> --> |
|
|
|
<div style="font-weight: bold; font-size: 20px"> |
|
|
|
<span>添加</span> |
|
|
|
<el-input-number min="1" style="width: 100px;" controls-position="right" v-model="addLineObj"></el-input-number> |
|
|
|
<el-input-number |
|
|
|
min="1" |
|
|
|
style="width: 100px" |
|
|
|
controls-position="right" |
|
|
|
v-model="addLineObj" |
|
|
|
></el-input-number> |
|
|
|
<span>行</span> |
|
|
|
<el-button type="primary" @click="throttledAddLines" style="margin-right: 10px">添加</el-button> |
|
|
|
<el-button |
|
|
|
type="primary" |
|
|
|
@click="throttledAddLines" |
|
|
|
style="margin-right: 10px" |
|
|
|
>添加</el-button |
|
|
|
> |
|
|
|
</div> |
|
|
|
<el-button |
|
|
|
type="warning" |
|
|
@ -1133,10 +1154,16 @@ onMounted(async function () { |
|
|
|
</el-table-column> |
|
|
|
<el-table-column property="jwcode" label="精网号" width="150px"> |
|
|
|
<template #default="scope"> |
|
|
|
<el-input v-if="scope.row.showInput" :class="{ 'is-invalid': scope.row.isInputInvalid }" |
|
|
|
@blur="validateInput(scope.row)" v-model="scope.row.jwcode" style="width: 110px" /> |
|
|
|
<p v-if="scope.row.isInputInvalid" class="error-message">{{ |
|
|
|
scope.row.inputErrorMessage }}</p> |
|
|
|
<el-input |
|
|
|
v-if="scope.row.showInput" |
|
|
|
:class="{ 'is-invalid': scope.row.isInputInvalid }" |
|
|
|
@blur="validateInput(scope.row)" |
|
|
|
v-model="scope.row.jwcode" |
|
|
|
style="width: 110px" |
|
|
|
/> |
|
|
|
<p v-if="scope.row.isInputInvalid" class="error-message"> |
|
|
|
{{ scope.row.inputErrorMessage }} |
|
|
|
</p> |
|
|
|
</template> |
|
|
|
<!-- <template #default="scope"> |
|
|
|
<el-select-v2 v-if="scope.row.showInput" filterable clearable v-model="scope.row.jwcode" |
|
|
@ -1188,7 +1215,11 @@ onMounted(async function () { |
|
|
|
</el-table-column> |
|
|
|
<el-table-column property="freeGold" label="免费金币" width="110px"> |
|
|
|
<template #default="scope"> |
|
|
|
<el-input v-if="scope.row.showInput" v-model="scope.row.freeGold" style="width: 70px" /> |
|
|
|
<el-input |
|
|
|
v-if="scope.row.showInput" |
|
|
|
v-model="scope.row.freeGold" |
|
|
|
style="width: 70px" |
|
|
|
/> |
|
|
|
<span v-else>{{ scope.row.freeGold }}</span> |
|
|
|
</template> |
|
|
|
</el-table-column> |
|
|
@ -1369,7 +1400,10 @@ onMounted(async function () { |
|
|
|
</el-select> |
|
|
|
</el-form-item> |
|
|
|
<el-form-item label="永久金币"> |
|
|
|
<el-input v-model="batchSettingObj.paidGold" placeholder="请输入永久金币"></el-input> |
|
|
|
<el-input |
|
|
|
v-model="batchSettingObj.paidGold" |
|
|
|
placeholder="请输入永久金币" |
|
|
|
></el-input> |
|
|
|
</el-form-item> |
|
|
|
<el-form-item label="免费金币"> |
|
|
|
<el-input v-model="batchSettingObj.freeGold"></el-input> |
|
|
|