web-zk-admin/src/views/configManage/bonus/jjkx.vue

226 lines
4.7 KiB
Vue

<template>
<div class="page">
<topBar
v-if="topList.length > 0"
:topList="topList"
:moren="moren"
></topBar>
<div class="main">
<div class="maintable">
<el-table
:data="tableData"
height="730px"
style="width: 100%"
:header-cell-style="{ background: '#EEEEEE' }"
:row-class-name="tableRowClassName"
>
<el-table-column
align="center"
prop="bonusName"
:label="'奖金名称'"
>
</el-table-column>
<el-table-column
align="center"
prop="backRatio"
:label="'重复消费'+'(%)'"
>
<template slot-scope="scope">
<el-input clearable
:disabled="ifupdate"
v-model="scope.row.backRatio"
></el-input>
</template>
</el-table-column>
<el-table-column
align="center"
prop="platformRatio"
:label="'平台消费'+'(%)'"
>
<template slot-scope="scope">
<el-input clearable
:disabled="ifupdate"
v-model="scope.row.platformRatio"
></el-input>
</template>
</el-table-column>
</el-table>
</div>
</div>
<div class="footer">
<div style="margin: 0 auto">
<el-button class="thebtn btn1" @click="ifupdate = false"
> {{ '修改' }}</el-button
>
<el-button class="thebtn btn2" @click="savedate">{{'保存'}}</el-button>
</div>
</div>
</div>
</template>
<script>
import topBar from "@/components/topBar";
import { getDeductList, updateDeduct, getDeductTypeList } from "@/api/bonus";
export default {
name: "Jjkx",
components: {
topBar,
},
data() {
return {
moren: "jjkx",
topList: [
{
name: '奖项配置',
path: "bonus",
},
{
name: '直推配置',
path: "ztpz",
},
{
name: '拓展配置',
path: "kzpz",
},
{
name: '辅导分红',
path: "fdfh",
},
{
name: '服务补贴',
path: "fwbt",
},
{
name: '奖金扣项',
path: "jjkx",
},
{
name: '云代配置',
path: "ydpz",
},
{
name: '环球积分',
path: "hqjf",
},
{
name: '车奖积分',
path: "njjf",
},
],
tableData: [
{
name: "asads",
put: 2,
},
],
ifupdate: true,
deductTypeList: [],
};
},
created() {
this.getDeductList();
this.getDeductTypeList();
},
methods: {
//列表枚举对应
// checkType(row){
// let state = "";
// this.deductTypeList.forEach(item=>{
// if(item.value==row.deductType){
// state = item.label
// }
// })
// return state
// },
//奖金扣项列表
getDeductList() {
getDeductList().then((res) => {
this.tableData = res.data;
});
},
//奖金扣项枚举查询
getDeductTypeList() {
getDeductTypeList().then((res) => {
this.deductTypeList = res.data;
});
},
//保存
savedate() {
this.ifupdate = true;
updateDeduct({ bonusDeductList: this.tableData }).then((res) => {
if (res.code == 200) {
this.$message({
message: res.msg,
type: "success",
});
} else {
this.$message({
message: res.msg,
type: "warning",
});
}
this.getDeductList();
});
},
tableRowClassName({ row, rowIndex }) {
if (rowIndex % 2 == 1) {
return "warning-row";
} else if (rowIndex % 2 == 0) {
return "success-row";
}
return "";
},
},
};
</script>
<style lang="scss" scoped>
::v-deep .el-table thead {
color: #000000;
}
::v-deep .el-table .warning-row {
background: #f9f9f9;
}
::v-deep .el-input__inner {
width: 40% !important;
}
::v-deep .el-table .success-row {
background: #ffffff;
}
.page {
padding: 10px 20px;
background: #f9f9f9;
font-size: 14px;
.main {
background: #ffffff;
border-radius: 8px;
box-shadow: 0px 2px 20px 0px rgba(238, 238, 238, 0.5);
}
.footer {
display: flex;
margin-top: 20px;
.thebtn {
width: 120px;
height: 48px;
color: #ffffff;
font-size: 14px;
font-weight: bold;
}
.btn1 {
background: #4391fd;
margin-right: 80px;
}
.btn2 {
background: #ffad41;
}
}
}
</style>