Browse Source

新增充值只能选正在进行的活动

Hongxilin
hongxilin 5 months ago
parent
commit
141e02f248
  1. 49
      vue/gold-system/src/views/recharge/addRecharge.vue

49
vue/gold-system/src/views/recharge/addRecharge.vue

@ -1,5 +1,5 @@
<script setup>
import { ref, onMounted, reactive, computed, watch, nextTick, h } from "vue";
import { ref, onMounted, reactive, computed, watch, nextTick } from "vue";
import { ElMessage } from "element-plus";
import { Plus } from "@element-plus/icons-vue";
import axios from "axios";
@ -160,7 +160,7 @@ const getActivity = async function () {
// POST
const result = await API.post(
"http://192.168.8.93:10010/recharge/activity/select",
{}
{ activity: { status: 1 } }
);
//
@ -385,8 +385,6 @@ const vJwcodeLoadmore = {
// directives.loadmore(jwcodeSelectRef.value, loadMore(rangeNumber.value));
// }
// };
//
const loading = ref(false);
//
const addLineObj = ref(0);
//
@ -396,27 +394,50 @@ const addLine = function () {
showInput: true,
});
};
const loading = ref(false);
//
const addLines = function () {
// const addLines = async function () {
// try {
// for (let j = 0; j < addLineObj.value; j++) {
// batchData.value.unshift({
// line: ++i.value,
// showInput: true,
// });
// }
// ElMessage.success("");
// } catch (error) {
// console.log("", error);
// ElMessage.error("");
// }
// }
const addLines = async function () {
try {
loading.value = true;
if (loading.value) {
console.log("loading===", loading.value);
loading.value = true; // loadingtrue
await nextTick(); //
const addLinesPromises = [];
for (let j = 0; j < addLineObj.value; j++) {
addLinesPromises.push(new Promise((resolve) => {
batchData.value.unshift({
line: ++i.value,
showInput: true,
});
resolve();
}));
}
loading.value = false;
}
await Promise.all(addLinesPromises);
//
await nextTick(); //
loading.value = false; // loadingfalse
ElMessage.success("添加成功");
} catch (error) {
console.log("添加失败", error);
ElMessage.error("添加失败");
//
loading.value = false;
}
}
};
// excelref
const uploadRefMap = ref({});
// excel
@ -878,7 +899,7 @@ 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 style="width: 40px;" v-model="addLineObj"></el-input>
<el-input style="width: 60px;" v-model="addLineObj"></el-input>
<span></span>
<el-button type="primary" @click="addLines()" style="margin-right: 10px;">添加</el-button>
</div>
@ -890,8 +911,8 @@ onMounted(async function () {
<el-button type="danger" plain @click="batchDel()" style="margin-right: 10px; width: 130px">批量删除</el-button>
</el-row>
<el-row >
<el-table :data="batchData" border max-height="540px" style="height: 540px"
@selection-change="handleSelectionChangebatch" v-loading="loading">
<el-table v-loading="loading" :data="batchData" border max-height="540px" style="height: 540px"
@selection-change="handleSelectionChangebatch">
<el-table-column type="selection" width="50px" />
<el-table-column property="index" label="序号" width="55px">
<template #default="scope">

Loading…
Cancel
Save