|
|
@ -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"; |
|
|
|
|
|
|
|
// 这是添加上传图片的接口 |
|
|
@ -17,10 +17,7 @@ const Rate = ref(); |
|
|
|
const adminData = ref({}); |
|
|
|
const getAdminData = async function () { |
|
|
|
try { |
|
|
|
const result = await API.post( |
|
|
|
"/hwjb/admin/userinfo", |
|
|
|
{} |
|
|
|
); |
|
|
|
const result = await API.post("/hwjb/admin/userinfo", {}); |
|
|
|
adminData.value = result; |
|
|
|
addRecharge.value.adminId = adminData.value.adminId; |
|
|
|
addRecharge.value.area = adminData.value.area; |
|
|
@ -160,10 +157,9 @@ const activity = ref([]); |
|
|
|
const getActivity = async function () { |
|
|
|
try { |
|
|
|
// 发送POST请求 |
|
|
|
const result = await API.post( |
|
|
|
"/hwjb/recharge/activity/select", |
|
|
|
{ activity: { status: 1 } } |
|
|
|
); |
|
|
|
const result = await API.post("/hwjb/recharge/activity/select", { |
|
|
|
activity: { status: 1 }, |
|
|
|
}); |
|
|
|
|
|
|
|
// 将响应结果存储到响应式数据中 |
|
|
|
console.log("请求成功", result); |
|
|
@ -237,10 +233,9 @@ const options = [ |
|
|
|
const getActivityById = async function (row) { |
|
|
|
try { |
|
|
|
// 发送POST请求 |
|
|
|
const result = await API.post( |
|
|
|
"/hwjb/recharge/activity/select", |
|
|
|
{ activity: { activityId: row } } |
|
|
|
); |
|
|
|
const result = await API.post("/hwjb/recharge/activity/select", { |
|
|
|
activity: { activityId: row }, |
|
|
|
}); |
|
|
|
addRecharge.value.rechargeRatio = result.data[0].rechargeRatio; |
|
|
|
console.log("看看有了吗", addRecharge.value.rechargeRatio); |
|
|
|
} catch (error) { |
|
|
@ -256,7 +251,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 { |
|
|
@ -297,10 +294,7 @@ let jwcodeSet; |
|
|
|
const getJwcodeList = async function () { |
|
|
|
try { |
|
|
|
// 发送POST请求 |
|
|
|
const result = await API.post( |
|
|
|
"/hwjb/recharge/user/jwcode", |
|
|
|
{} |
|
|
|
); |
|
|
|
const result = await API.post("/hwjb/recharge/user/jwcode", {}); |
|
|
|
|
|
|
|
// 将响应结果存储到响应式数据中 |
|
|
|
console.log("请求成功", result); |
|
|
@ -322,17 +316,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); |
|
|
@ -346,7 +340,7 @@ const batchData = ref([ |
|
|
|
line: 1, |
|
|
|
showInput: true, |
|
|
|
isInputInvalid: false, |
|
|
|
inputErrorMessage: '', |
|
|
|
inputErrorMessage: "", |
|
|
|
freeGold: "0", |
|
|
|
rechargeGold: "0", |
|
|
|
paidGold: "0", |
|
|
@ -374,7 +368,7 @@ const addLine = function () { |
|
|
|
line: ++i.value, |
|
|
|
showInput: true, |
|
|
|
isInputInvalid: false, |
|
|
|
inputErrorMessage: '', |
|
|
|
inputErrorMessage: "", |
|
|
|
freeGold: "0", |
|
|
|
rechargeGold: "0", |
|
|
|
paidGold: "0", |
|
|
@ -385,16 +379,16 @@ const loading = ref(false); |
|
|
|
const addLines = async function () { |
|
|
|
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)); // 人为创建一个小延迟 |
|
|
|
|
|
|
|
for (let j = 0; j < addLineObj.value; j++) { |
|
|
|
batchData.value.unshift({ |
|
|
|
line: ++i.value, |
|
|
|
showInput: true, |
|
|
|
isInputInvalid: false, |
|
|
|
inputErrorMessage: '', |
|
|
|
inputErrorMessage: "", |
|
|
|
freeGold: "0", |
|
|
|
rechargeGold: "0", |
|
|
|
paidGold: "0", |
|
|
@ -408,9 +402,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 { |
|
|
@ -444,7 +438,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数据 |
|
|
@ -648,7 +642,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", |
|
|
@ -670,40 +664,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, |
|
|
@ -714,12 +715,11 @@ const batchAdd = async function () { |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
console.log("batchData===", batchData.value); |
|
|
|
console.log("batchData===", batchData.value); |
|
|
|
|
|
|
|
const result = await API.post( |
|
|
|
"/hwjb/recharge/recharge/addmore", |
|
|
|
{ ...batchData.value } |
|
|
|
); |
|
|
|
const result = await API.post("/hwjb/recharge/recharge/addmore", { |
|
|
|
...batchData.value, |
|
|
|
}); |
|
|
|
|
|
|
|
if (result.code === 0) { |
|
|
|
ElMessage.error("添加失败"); |
|
|
@ -736,8 +736,8 @@ const batchAdd = async function () { |
|
|
|
console.log("error===", error); |
|
|
|
ElMessage.error("添加失败"); |
|
|
|
return; |
|
|
|
}; |
|
|
|
} |
|
|
|
} |
|
|
|
}; |
|
|
|
// 使用 _.throttle 并设置 trailing 为 false 实现严格节流,只执行一次 |
|
|
|
const throttledBatchAdd = _.throttle(batchAdd, 2000, { trailing: false }); |
|
|
|
// 批量设置的对象 |
|
|
@ -1032,8 +1032,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 |
|
|
|
> |
|
|
@ -1088,9 +1090,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" |
|
|
@ -1127,10 +1139,16 @@ onMounted(async function () { |
|
|
|
</el-table-column> |
|
|
|
<el-table-column property="jwcode" label="精网号" width="150px"> |
|
|
|
<template #default="scope"> |
|
|
|
<el-input clearable 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" |
|
|
@ -1182,7 +1200,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> |
|
|
@ -1363,7 +1385,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> |
|
|
|