donghaolin 5 months ago
parent
commit
079ee75698
  1. 2
      vue/gold-system/src/views/index.vue
  2. 23
      vue/gold-system/src/views/managerecharge/activity.vue
  3. 483
      vue/gold-system/src/views/recharge/addRecharge.vue
  4. 20
      vue/gold-system/src/views/usergold/index.vue

2
vue/gold-system/src/views/index.vue

@ -156,8 +156,6 @@ onMounted(async function () {
<el-sub-menu index="1" class="admin">
<template #title>
<el-image
:preview-src-list="list"
preview-teleported="true"
:src="imgrule1"
alt="错误"
style="width: 50px; height: 50px"

23
vue/gold-system/src/views/managerecharge/activity.vue

@ -119,6 +119,7 @@ const closeAddActivityVisible = function () {
};
//
const addActicity = function () {
console.log("Date",new Date());
//
addObj.value = {};
addObj.value.adminId = admin.value.adminId;
@ -212,7 +213,7 @@ const checkFreeGoldRadio = function (rule, value, callback) {
};
const checkStartTime = function (rule, value, callback) {
if (value <= new Date()) {
if (value < new Date()) {
callback(new Error("开始时间不能小于当前时间"));
} else {
callback();
@ -220,7 +221,7 @@ const checkStartTime = function (rule, value, callback) {
};
const checkEndTime = function (rule, value, callback) {
if (value <= new Date()) {
if (value < new Date()) {
callback(new Error("结束时间不能小于当前时间"));
} else if (value <= addObj.value.startTime) {
callback(new Error("结束时间不能小于开始时间"));
@ -298,7 +299,7 @@ onMounted(async function () {
<el-text class="mx-1" size="large">添加时间</el-text>
<el-date-picker
v-model="getTime"
type="daterange"
type="datetimerange"
range-separator="至"
start-placeholder="起始时间"
end-placeholder="结束时间"
@ -326,8 +327,16 @@ onMounted(async function () {
<div>
<el-table :data="tableData" :height="tableHeight" style="width: 100%">
<el-table-column prop="activityName" label="活动名称" />
<el-table-column prop="startTime" label="开始时间" />
<el-table-column prop="endTime" label="结束时间" />
<el-table-column prop="startTime" label="开始时间" >
<template #default="scope">
{{ moment(scope.row.startTime).format("YYYY-MM-DD HH:mm:ss") }}
</template>
</el-table-column>
<el-table-column prop="endTime" label="结束时间" >
<template #default="scope">
{{ moment(scope.row.endTime).format("YYYY-MM-DD HH:mm:ss") }}
</template>
</el-table-column>
<el-table-column prop="rechargeRatio" label="免费兑换比">
<template #default="scope">
<span>{{ scope.row.rechargeRatio }}:1</span>
@ -473,7 +482,7 @@ onMounted(async function () {
<el-form-item prop="startTime" label="开始时间:">
<el-date-picker
v-model="addObj.startTime"
type="date"
type="datetime"
placeholder="请选择开始时间"
@change="handleStartTimeChange"
/>
@ -482,7 +491,7 @@ onMounted(async function () {
<el-form-item prop="endTime" label="结束时间:">
<el-date-picker
v-model="addObj.endTime"
type="date"
type="datetime"
placeholder="请选择结束时间"
/>
</el-form-item>

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

@ -439,41 +439,217 @@ const deleteRecharge = function () {
};
imageUrl.value = "";
};
//
//
const batchRechargeVisible = ref(false);
const i = ref(1);
const delObj = ref({});
const batchDelObj = ref([]);
const resetObj = ref({});
//
const batchData = ref([
{
line: 1,
showInput: true,
},
]);
//
const openBatchRechargeVisible = function () {
batchRechargeVisible.value = true;
};
//
const closeBatchRechargeVisible = function () {
batchRechargeVisible.value = false;
};
//
const batchInit = function () {
openBatchRechargeVisible();
}
//
const addLine = function () {
batchData.value.unshift({
line: ++i.value,
showInput: true,
});
}
//
const handleSelectionChangebatch = function (val) {
console.log("val===", val);
batchDelObj.value = val;
}
//
const batchDel = function () {
ElMessageBox.confirm(
'确认批量删除吗?',
'批量删除',
{
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning',
}
)
.then(() => {
console.log("batchDel===", batchDelObj.value);
batchData.value = batchData.value.filter(itemA => { return !batchDelObj.value.some(itemB => itemB.line == itemA.line) })
console.log("batchData===", batchData.value);
ElMessage({
type: 'success',
message: '操作成功',
})
})
.catch(() => {
ElMessage({
type: 'info',
message: '操作撤销',
})
})
}
//
const del = function (row) {
console.log("row===", row);
delObj.value.line = row.line;
}
const delConfirm = function () {
batchData.value = batchData.value.filter(item => item.line != delObj.value.line)
console.log("batchData===", batchData.value);
}
//
const reset = function (row) {
resetObj.value.line = row.line;
}
const resetConfirm = function () {
for (let i = 0; i < batchData.value.length; i++) {
if (batchData.value[i].line == resetObj.value.line) {
batchData.value[i] = {};
batchData.value[i].line = resetObj.value.line;
batchData.value[i].showInput = true;
break;
}
}
}
//
const cancelBatch = function () {
ElMessageBox.confirm(
'确认取消吗?此操作将不会保存任何数据。',
'确认取消',
{
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning',
}
)
.then(() => {
batchData.value = [
{ line: 1, showInput: true }
];
closeBatchRechargeVisible();
ElMessage({
type: 'success',
message: '操作成功',
})
})
.catch(() => {
ElMessage({
type: 'info',
message: '操作撤销',
})
})
}
//
const calculatedRowFreeGold = function (row) {
console.log("row===", row);
let ratio = 0;
for (let i = 0; i < activity.value.length; i++) {
if (activity.value[i].activityId == row.activityId) {
ratio = activity.value[i].ratio;
break;
}
}
for (let i = 0; i < batchData.value.length; i++) {
if (batchData.value[i].line == row.line) {
if (ratio == 0) {
batchData.value[i].freeGold = 0;
} else {
const paidGold = Number(batchData.value[i].paidGold) || 0;
batchData.value[i].freeGold = Math.ceil(paidGold / ratio);
}
break;
};
}
}
const calculatedRowRechargeGold = computed(() => {
if (!addRecharge.value.rateId == 0) {
const paidGold = Number(addRecharge.value.paidGold) || 0;
const rateId = Number(addRecharge.value.rateId) || 1; // 0
return Math.ceil(paidGold * rateId);
}
});
// watch(calculatedRowFreeGold, (newVal) => {
// addRecharge.value.freeGold = Number(newVal);
// });
watch(calculatedRowRechargeGold, (newVal) => {
addRecharge.value.rechargeGold = Number(newVal);
});
//
const batchAdd = function () {
console.log("batchData===", batchData.value);
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
|| batchData.value[i].activityId == "" || batchData.value[i].activityId == null
|| batchData.value[i].paidGold == "" || batchData.value[i].paidGold == null
|| batchData.value[i].rechargeGold == "" || batchData.value[i].rechargeGold == null
|| batchData.value[i].payWay == "" || batchData.value[i].payWay == null
|| batchData.value[i].rechargeTime == "" || batchData.value[i].rechargeTime == null) {
ElMessage({
type: 'error',
message: '信息不能为空!请检查输入内容!',
});
return;
}
}
console.log("batchData===", batchData.value);
ElMessage({
type: 'success',
message: '添加成功!',
})
closeBatchRechargeVisible();
}
</script>
<template>
<div>新增充值</div>
<el-form
:model="addRecharge"
ref="Ref"
:rules="rules"
label-width="auto"
style="max-width: 600px"
class="add-form"
>
<div style="display: flex;">
<div style="margin-right: 20px;">新增充值</div>
<el-button type="primary" plain @click="batchInit()">批量充值</el-button>
</div>
<el-form :model="addRecharge" ref="Ref" :rules="rules" label-width="auto" style="max-width: 600px" class="add-form">
<el-form-item prop="jwcode" label="精网号">
<el-input v-model="addRecharge.jwcode" style="width: 220px" />
<el-button
type="primary"
@click="getUser(addRecharge.jwcode)"
style="margin-left: 20px"
>查询</el-button
>
<el-button type="primary" @click="getUser(addRecharge.jwcode)" style="margin-left: 20px">查询</el-button>
</el-form-item>
<el-form-item prop="activityId" label="活动名称">
<el-select
v-model="addRecharge.activityId"
placeholder="请选择"
style="width: 300px"
@change="handleSelectionChange"
>
<el-option
v-for="item in activity"
:key="item.value"
:label="item.activityName"
:value="item.activityId"
/>
<el-select v-model="addRecharge.activityId" placeholder="请选择" style="width: 300px">
<el-option v-for="item in activity" :key="item.value" :label="item.activityName" :value="item.activityId" />
</el-select>
</el-form-item>
<el-form-item prop="paidGold" label="充值金币">
@ -484,108 +660,49 @@ const deleteRecharge = function () {
<p></p>
</el-form-item>
<el-form-item prop="rechargeGold" label="充值金额">
<el-select
prop="rechargeGold"
v-model="addRecharge.rateId"
placeholder="货币名称"
style="width: 95px; margin-right: 5px"
>
<el-option
v-for="item in currency"
:key="item.value"
:label="item.currency"
:value="item.exchangeRate"
/>
<el-select prop="rechargeGold" v-model="addRecharge.rateId" placeholder="货币名称"
style="width: 95px; margin-right: 5px">
<el-option v-for="item in currency" :key="item.value" :label="item.currency" :value="item.exchangeRate" />
</el-select>
<el-input
disabled
v-model="addRecharge.rechargeGold"
style="width: 200px"
/>
<el-input disabled v-model="addRecharge.rechargeGold" style="width: 200px" />
</el-form-item>
<el-form-item prop="payWay" label="收款方式">
<el-select
v-model="addRecharge.payWay"
placeholder="请选择"
style="width: 300px"
>
<el-option
v-for="item in options"
:key="item.value"
:label="item.label"
:value="item.value"
/>
<el-select v-model="addRecharge.payWay" placeholder="请选择" style="width: 300px">
<el-option v-for="item in options" :key="item.value" :label="item.label" :value="item.value" />
</el-select>
</el-form-item>
<el-form-item prop="rechargeTime" label="交款时间">
<el-date-picker
v-model="addRecharge.rechargeTime"
type="date"
style="width: 300px"
/>
<el-date-picker v-model="addRecharge.rechargeTime" type="date" style="width: 300px" />
</el-form-item>
<el-form-item
prop="rechargeVoucher"
label="交款凭证"
style="margin-bottom: 5px"
>
<el-upload
style="width: 100px; height: 100px"
class="avatar-uploader"
:show-file-list="false"
action="http://192.168.8.93:10010/upload"
:on-success="handleAvatarSuccess"
:before-upload="beforeAvatarUpload"
>
<img
v-if="imageUrl"
:src="imageUrl"
class="avatar"
style="width: 100px; height: 100px"
/>
<el-icon
v-else
class="avatar-uploader-icon"
style="width: 100px; height: 100px"
><Plus
/></el-icon>
<el-form-item prop="rechargeVoucher" label="交款凭证" style="margin-bottom: 5px">
<el-upload class="avatar-uploader" :show-file-list="false" :on-success="handleAvatarSuccess"
:before-upload="beforeAvatarUpload">
<img v-if="imageUrl" :src="imageUrl" class="avatar" />
<el-icon v-else class="avatar-uploader-icon">
<Plus />
</el-icon>
</el-upload>
<p style="margin-left: 10px; color: rgb(177, 176, 176)">
仅支持.jpg .png格式文件1MB
</p>
</el-form-item>
<el-form-item prop="remark" label="备注">
<el-input
v-model="addRecharge.remark"
style="width: 300px"
:rows="2"
maxlength="100"
show-word-limit
type="textarea"
/>
<el-input v-model="addRecharge.remark" style="width: 300px" :rows="2" maxlength="100" show-word-limit
type="textarea" />
</el-form-item>
<el-form-item prop="submitter" label="提交人">
<el-input
style="width: 300px"
:value="adminData.name"
disabled
placeholder="提交人姓名"
/>
<el-input style="width: 300px" :value="adminData.name" disabled placeholder="提交人姓名" />
</el-form-item>
<el-button @click="deleteRecharge" style="margin-left: 280px"
>重置</el-button
>
<el-button @click="deleteRecharge" style="margin-left: 280px">重置</el-button>
<el-button type="primary" @click="addBefore"> 提交 </el-button>
</el-form>
<!-- 客户信息栏 -->
<el-card style="float: right" class="customer-info">
<el-form :model="user" label-width="auto" label-position="left">
<el-text size="large" style="margin-left: 20px; font-weight: bold"
>客户信息</el-text
>
<el-row style="margin-top: 20px; display: flex">
<el-col :span="10">
<el-card style="width: 700px; float: right" class="customer-info">
<el-form :model="user" label-width="auto" style="max-width: 600px" label-position="left">
<el-text size="large" style="margin-left: 20px">客户信息</el-text>
<el-row style="margin-top: 20px">
<el-col :span="12">
<el-form-item label="姓名:">
<p>{{ user.name }}</p>
</el-form-item>
@ -651,12 +768,156 @@ const deleteRecharge = function () {
</el-row>
</el-form>
</el-card>
<el-dialog v-model="batchRechargeVisible" title="批量充值" width="1800px" style="height: 700px;">
<el-row style="margin-bottom: 10px">
<el-button type="primary" @click="addLine()" style="margin-right: auto">新增一行</el-button>
<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">
<el-table-column type="selection" width="50px" />
<el-table-column property="index" label="序号" width="55px">
<template #default="scope">
<span>{{ scope.$index + 1 }}</span>
</template>
</el-table-column>
<el-table-column property="jwcode" label="精网号" width="150px">
<template #default="scope">
<input type="number" v-if="scope.row.showInput" v-model="scope.row.jwcode" style="width: 110px;" />
<span v-else>{{ scope.row.jwcode }}</span>
</template>
</el-table-column>
<el-table-column property="activityName" label="活动名称" width="150px">
<template #default="scope">
<el-select v-if="scope.row.showInput" filterable clearable v-model="scope.row.activityId"
placeholder="请选择活动名称" @change="calculatedRowFreeGold(scope.row)">
<el-option v-for="item in activity" :key="item.value" :label="item.activityName" :value="item.activityId">
</el-option>
</el-select>
<span v-else>{{ scope.row.activityName }}</span>
</template>
</el-table-column>
<el-table-column property="paidGold" label="充值金币" width="110px">
<template #default="scope">
<input v-if="scope.row.showInput" v-model="scope.row.paidGold" style="width: 70px;" />
<span v-else>{{ scope.row.paidGold }}</span>
</template>
</el-table-column>
<el-table-column property="freeGold" label="免费金币" width="110px">
<template #default="scope">
<el-input disabled v-model="scope.row.freeGold"></el-input>
</template>
</el-table-column>
<el-table-column property="rechargeGold" label="充值金额">
<template #default="scope">
<el-select v-if="scope.row.showInput" filterable clearable v-model="scope.row.rateId" placeholder="请选择币种">
<el-option v-for="item in currency" :key="item.value" :label="item.currency" :value="item.exchangeRate">
</el-option>
</el-select>
<span v-else>{{ scope.row.rateId }}</span>
</template>
</el-table-column>
<el-table-column property="rechargeGold" label="充值金额" width="110px">
<template #default="scope">
<el-input disabled v-model="scope.row.rechargeGold"></el-input>
</template>
</el-table-column>
<el-table-column property="payWay" label="收款方式" width="130px">
<template #default="scope">
<el-select v-if="scope.row.showInput" filterable clearable v-model="scope.row.payWay" placeholder="请选择收款方式">
<el-option v-for="item in options" :key="item.value" :label="item.label" :value="item.value">
</el-option>
</el-select>
<span v-else>{{ scope.row.payWay }}</span>
</template>
</el-table-column>
<el-table-column property="rechargeTime" label="交款时间" width="150px">
<template #default="scope">
<el-date-picker v-if="scope.row.showInput" type="date" v-model="scope.row.rechargeTime"
style="width: 120px;" placeholder="请选择交款时间">
</el-date-picker>
<span v-else>{{ moment(scope.row.rechargeTime).format("YYYY-MM-DD HH:mm:ss") }}</span>
</template>
</el-table-column>
<el-table-column property="rechargeVoucher" label="充值凭证">
<span> X </span>
<!-- <template #default="scope">
<el-upload class="avatar-uploader" :show-file-list="true" :on-success="handleAvatarSuccess"
:before-upload="beforeAvatarUpload" v-if="scope.row.showInput">
<img v-if="scope.row.imageUrl" :src="scope.row.imageUrl" class="avatar" />
<el-icon v-else class="avatar-uploader-icon"></el-icon>
</el-upload>
<span v-else>{{ scope.row.rechargeVoucher }}</span>
</template> -->
</el-table-column>
<el-table-column property="remark" label="备注" width="130px">
<template #default="scope">
<textarea v-if="scope.row.showInput" v-model="scope.row.remark" style="max-width: 90px;" rows="1"
cols="12"></textarea>
<span v-else>{{ scope.row.remark }}</span>
</template>
</el-table-column>
<el-table-column property="submitter" label="提交人">
<el-input :value="adminData.name" disabled />
</el-table-column>
<el-table-column fixed="right" prop="operation" label="操作" width="150px">
<template #default="scope">
<div style="display: flex;">
<el-popconfirm title="确定将此条信息删除吗?" @confirm="delConfirm">
<template #reference>
<el-button type="danger" text @click="del(scope.row)">
删除
</el-button>
</template>
<template #actions="{ confirm, cancel }">
<el-button size="small" @click="cancel">取消</el-button>
<el-button type="primary" size="small" @click="confirm">
确定
</el-button>
</template>
</el-popconfirm>
<el-popconfirm title="确定将此条信息重置吗?" @confirm="resetConfirm">
<template #reference>
<el-button type="primary" text @click="reset(scope.row)">
重置
</el-button>
</template>
<template #actions="{ confirm, cancel }">
<el-button size="small" @click="cancel">取消</el-button>
<el-button type="primary" size="small" @click="confirm">
确定
</el-button>
</template>
</el-popconfirm>
</div>
</template>
</el-table-column>
</el-table>
</el-row>
<el-row>
<div class="batch-btn">
<el-button @click="cancelBatch()"> 取消 </el-button>
<el-button type="primary" @click="batchAdd()"> 提交 </el-button>
</div>
</el-row>
</el-dialog>
</template>
<style scoped>
p {
margin: 0px;
}
.batch-btn {
margin-top: 20px;
margin-left: auto;
}
.el-form-item {
margin-left: 50px;
}
@ -690,11 +951,13 @@ p {
height: 50px;
text-align: center;
}
.add-form {
margin-top: 50px;
max-width: 50%;
float: left;
}
.customer-info {
max-width: 50%;
}

20
vue/gold-system/src/views/usergold/index.vue

@ -90,18 +90,14 @@ const get = async function (val) {
total.value = result.data.total;
console.log("total", total.value);
//
rechargeCoin.value = tableAllData.value.reduce(
(pre, cur) => pre + cur.rechargeCoin,
0
);
freeCoin.value = tableAllData.value.reduce(
(pre, cur) => pre + cur.freeCoin,
0
);
taskCoin.value = tableAllData.value.reduce(
(pre, cur) => pre + cur.taskCoin,
0
);
rechargeCoin.value = 0;
freeCoin.value = 0;
taskCoin.value = 0;
for(let i=0;i<tableAllData.value.length;i++){
rechargeCoin.value += tableAllData.value[i].rechargeCoin;
freeCoin.value += tableAllData.value[i].freeCoin;
taskCoin.value += tableAllData.value[i].taskCoin;
}
console.log(
"各金币总数",
rechargeCoin.value,

Loading…
Cancel
Save