分润配置页面

This commit is contained in:
BOOL\25024
2024-09-28 17:00:25 +08:00
parent a7b69567ce
commit 1aff2edea8
2 changed files with 282 additions and 286 deletions

View File

@@ -1,92 +1,79 @@
<template>
<div class="app-container">
<el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="68px">
<el-form-item label="交易日期" prop="tradeDate">
<el-date-picker
v-model="value"
style="width: 240px"
value-format="yyyy-MM-dd HH:mm:ss"
:default-time="['00:00:00', '23:59:59']"
type="daterange"
range-separator=""
start-placeholder="开始日期"
end-placeholder="结束日期"
:clearable=false
></el-date-picker>
</el-form-item>
<el-form-item>
<el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
<el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
</el-form-item>
</el-form>
<el-table v-loading="loading" :data="reportList" @selection-change="handleSelectionChange">
<el-table-column type="selection" width="55" align="center" />
<el-table-column label="交易日期" align="center" prop="tradeDate" />
<el-table-column label="用电度数" align="center" prop="useElectricity" />
<el-table-column label="充电次数" align="center" prop="chargeNum" />
<el-table-column label="充电时长" align="center" prop="chargeTime" />
<el-table-column label="电费金额" align="center" prop="electricityAmount" />
<el-table-column label="服务费金额" align="center" prop="serviceAmount" />
<el-table-column label="收入金额" align="center" prop="totalAmount" />
<el-table-column label="虚拟金额" align="center" prop="virtualAmount" />
<el-table-column label="交易金额" align="center" prop="tradeAmount" />
<el-table-column label="交易手续费" align="center" prop="tradeFee" />
<el-row :gutter="10">
<el-col :span="1.5">
<el-button
type="primary"
plain
icon="el-icon-plus"
size="mini"
@click="handleAdd"
>
新增
</el-button>
</el-col>
</el-row>
<el-table :data="carList" stripe style="width: 100%; margin-top: 20px">
<el-table-column label="分润人" align="center" prop="aaa" />
<el-table-column label="电费比例(%" align="center" prop="bbb">
<template slot-scope="scope">
<el-input
style="width: 200px"
v-model="scope.row.bbb"
placeholder="请输入手机号码"
/>
</template>
</el-table-column>
<el-table-column label="服务费比例(%" align="center" prop="ccc">
<template slot-scope="scope">
<el-input
style="width: 200px"
v-model="scope.row.ccc"
placeholder="请输入手机号码"
/>
</template>
</el-table-column>
<el-table-column label="是否承担手续费" align="center" width="200">
<template slot-scope="scope">
<!-- <el-switch
v-model="scope.row.state"
active-text=""
inactive-text=""
></el-switch> -->
<el-switch
v-model="scope.row.state"
></el-switch>
</template>
</el-table-column>
</el-table>
<pagination
v-show="total>0"
:total="total"
:page.sync="queryParams.pageNum"
:limit.sync="queryParams.pageSize"
@pagination="getList"
/>
<!-- 添加或修改结算订单报对话框 -->
<el-dialog :title="title" :visible.sync="open" width="500px" append-to-body>
<el-form ref="form" :model="form" :rules="rules" label-width="80px">
<el-form-item label="运营商id" prop="merchantId">
<el-input v-model="form.merchantId" placeholder="请输入运营商id" />
</el-form-item>
<el-form-item label="站点id" prop="stationId">
<el-input v-model="form.stationId" placeholder="请输入站点id" />
</el-form-item>
<el-form-item label="用电度数" prop="useElectricity">
<el-input v-model="form.useElectricity" placeholder="请输入用电度数" />
</el-form-item>
<el-form-item label="充电次数" prop="chargeNum">
<el-input v-model="form.chargeNum" placeholder="请输入充电次数" />
</el-form-item>
<el-form-item label="充电时长" prop="chargeTime">
<el-input v-model="form.chargeTime" placeholder="请输入充电时长" />
</el-form-item>
<el-form-item label="电费金额" prop="electricityAmount">
<el-input v-model="form.electricityAmount" placeholder="请输入电费金额" />
</el-form-item>
<el-form-item label="服务费金额" prop="serviceAmount">
<el-input v-model="form.serviceAmount" placeholder="请输入服务费金额" />
</el-form-item>
<el-form-item label="收入金额" prop="totalAmount">
<el-input v-model="form.totalAmount" placeholder="请输入收入金额" />
</el-form-item>
<el-form-item label="虚拟金额" prop="virtualAmount">
<el-input v-model="form.virtualAmount" placeholder="请输入虚拟金额" />
</el-form-item>
<el-form-item label="交易日期" prop="tradeDate">
<el-input v-model="form.tradeDate" placeholder="请输入交易日期" />
</el-form-item>
<el-form-item label="交易金额" prop="tradeAmount">
<el-input v-model="form.tradeAmount" placeholder="请输入交易金额" />
</el-form-item>
<el-form-item label="交易手续费" prop="tradeFee">
<el-input v-model="form.tradeFee" placeholder="请输入交易手续费" />
</el-form-item>
<el-form-item label="删除标识" prop="delFlag">
<el-input v-model="form.delFlag" placeholder="请输入删除标识" />
<div class="save">
<el-button type="primary" @click="getSave"> 保存 </el-button>
</div>
<!-- 添加分润人弹框 -->
<el-dialog
title="添加分润人"
:visible.sync="open"
width="600px"
append-to-body
:before-close="cancel"
>
<el-form ref="form" :model="form" label-width="100px">
<el-form-item label="选择运营商">
<el-select
v-model="createMerchantVip.targetMerchantId"
clearable
filterable
placeholder="请选择运营商"
@change="$forceUpdate()"
>
<el-option
v-for="item in merchantList"
:key="item.merchantId"
:label="item.merchantName"
:value="item.merchantId"
>
</el-option>
</el-select>
</el-form-item>
</el-form>
<div slot="footer" class="dialog-footer">
@@ -98,168 +85,98 @@
</template>
<script>
import { listReport, getReport, delReport, addReport, updateReport } from "@/api/settle/orderReport";
import { getMerchantListByAuth } from "@/api/member/info";
export default {
name: "Report",
data() {
return {
value:'',
// 遮罩层
loading: true,
// 选中数组
ids: [],
// 非单个禁用
single: true,
// 非多个禁用
multiple: true,
// 显示搜索条件
showSearch: true,
// 总条数
total: 0,
// 结算订单报表格数据
reportList: [],
// 弹出层标题
title: "",
// 是否显示弹出层
open: false,
// 查询参数
queryParams: {
pageNum: 1,
pageSize: 10,
merchantId: null,
stationId: null,
useElectricity: null,
chargeNum: null,
chargeTime: null,
electricityAmount: null,
serviceAmount: null,
totalAmount: null,
virtualAmount: null,
tradeDate: null,
tradeAmount: null,
tradeFee: null,
},
// 运营商列表
merchantList: [],
// 表单参数
form: {},
// 表单校验
rules: {
}
createMerchantVip: {},
carList: [
{
aaa: "运营商A",
bbb: "20",
ccc: "20",
state: false,
},
{
aaa: "运营商B",
bbb: "60",
ccc: "40",
state: true,
},
{
aaa: "运营商C",
bbb: "30",
ccc: "40",
state: true,
},
],
};
},
created() {
// this.getList();
this.getMerchantList();
},
methods: {
/** 查询结算订单报列表 */
getList() {
this.loading = true;
this.queryParams.stationId = this.$route.params.id
listReport(this.queryParams).then(response => {
console.log('查询订单日报',response)
this.reportList = response.rows;
this.total = response.total;
this.loading = false;
});
/** 新增按钮操作 */
handleAdd() {
this.open = true;
},
// 取消按钮
cancel() {
this.open = false;
this.reset();
},
// 表单重置
reset() {
this.form = {
id: null,
merchantId: null,
stationId: null,
useElectricity: null,
chargeNum: null,
chargeTime: null,
electricityAmount: null,
serviceAmount: null,
totalAmount: null,
virtualAmount: null,
tradeDate: null,
tradeAmount: null,
tradeFee: null,
createTime: null,
delFlag: null
};
this.resetForm("form");
this.createMerchantVip = {};
},
/** 搜索按钮操作 */
handleQuery() {
console.log('this.value 日期',this.value)
this.queryParams.pageNum = 1;
this.getList();
},
/** 重置按钮操作 */
resetQuery() {
this.value = null
this.resetForm("queryForm");
this.handleQuery();
},
// 多选框选中数据
handleSelectionChange(selection) {
this.ids = selection.map(item => item.id)
this.single = selection.length!==1
this.multiple = !selection.length
},
/** 新增按钮操作 */
handleAdd() {
this.reset();
this.open = true;
this.title = "添加结算订单报";
},
/** 修改按钮操作 */
handleUpdate(row) {
this.reset();
const id = row.id || this.ids
getReport(id).then(response => {
this.form = response.data;
this.open = true;
this.title = "修改结算订单报";
// 获取运营商列表
getMerchantList() {
getMerchantListByAuth().then((response) => {
console.log("response", response);
this.merchantList = response.obj;
});
},
/** 提交按钮 */
submitForm() {
this.$refs["form"].validate(valid => {
if (valid) {
if (this.form.id != null) {
updateReport(this.form).then(response => {
this.$modal.msgSuccess("修改成功");
this.open = false;
this.getList();
});
} else {
addReport(this.form).then(response => {
this.$modal.msgSuccess("新增成功");
this.open = false;
this.getList();
});
}
}
this.$refs["form"].validate((valid) => {
this.$modal.msgSuccess("新增成功");
this.open = false;
// this.getList();
});
},
/** 删除按钮操作 */
handleDelete(row) {
const ids = row.id || this.ids;
this.$modal.confirm('是否确认删除结算订单报编号为"' + ids + '"的数据项?').then(function() {
return delReport(ids);
}).then(() => {
this.getList();
this.$modal.msgSuccess("删除成功");
}).catch(() => {});
// 保存
getSave() {
let totalBbbA = 0;
this.carList.forEach((car) => {
totalBbbA += Number(car.bbb);
});
// 检查总和是否等于100
if (totalBbbA != 100) return this.$modal.msgError("电费分成比例相加必须等于100%");
let totalBbbB = 0;
this.carList.forEach((car) => {
totalBbbB += Number(car.ccc);
});
// 检查总和是否等于100
if (totalBbbB != 100) return this.$modal.msgError("服务费分成比例相加必须等于100%");
let trueCount = 0;
this.carList.forEach((car) => {
if (car.state) trueCount++;
});
// 检查是否只有一个人承担手续费
if (trueCount != 1) return this.$modal.msgError("手续费只能有一个人承担");
},
/** 导出按钮操作 */
handleExport() {
this.download('pile/report/export', {
...this.queryParams
}, `report_${new Date().getTime()}.xlsx`)
}
}
},
};
</script>
<style scoped>
.save {
text-align: right;
margin-top: 20px;
}
</style>