|
|
@@ -1,276 +1,214 @@
|
|
|
<template>
|
|
|
<div>
|
|
|
- <basic-container>
|
|
|
- <avue-crud :option="option" :data="dataList" ref="crud" v-model="form" :page.sync="page" :search.sync="search"
|
|
|
- @search-change="searchChange" @current-change="currentChange" @size-change="sizeChange"
|
|
|
- @refresh-change="refreshChange" @on-load="onLoad" :table-loading="loading" @saveColumn="saveColumn"
|
|
|
- @resetColumn="resetColumn" @expand-change="expandChange" @row-update="rowUpdate">
|
|
|
- <template slot-scope="{row,index}" slot="expand">
|
|
|
- <avue-crud :data="row.insideList" :option="expandOption">
|
|
|
- <template slot="headerSerial">
|
|
|
- <el-button type="primary" icon="el-icon-plus" size="mini" @click.stop="addRow(row)" circle>
|
|
|
- </el-button>
|
|
|
- </template>
|
|
|
- <template slot="menu" slot-scope="{row,index}">
|
|
|
- <el-button size="small" icon="el-icon-edit" :disabled="row.id" type="text" @click.stop="rowCell(row)">
|
|
|
- {{ row.$cellEdit ? "保存" : "修改" }}
|
|
|
- </el-button>
|
|
|
- </template>
|
|
|
- </avue-crud>
|
|
|
- <!-- <el-table :data="scope.row.insideList" v-loading="scope.row.loading">
|
|
|
- <el-table-column label="订单号" prop="orderNo" align="center" show-overflow-tooltip width="200"></el-table-column>
|
|
|
- <el-table-column label="变动总返利" prop="changeProfitReturn" align="center" show-overflow-tooltip width="200"></el-table-column>
|
|
|
- <el-table-column label="变动已用返利" prop="changeUsedProfit" align="center" show-overflow-tooltip width="200">
|
|
|
- </el-table-column>
|
|
|
- <el-table-column label="变动可用返利" prop="changeSurplusProfit" align="center" show-overflow-tooltip width="200"></el-table-column>
|
|
|
- <el-table-column label="变动本月待到账返利" prop="changeMonthProfit" align="center" show-overflow-tooltip width="200"></el-table-column>
|
|
|
- <el-table-column label="变动时间" prop="createTime" align="center" show-overflow-tooltip width="200"></el-table-column>
|
|
|
- </el-table> -->
|
|
|
- <!-- <el-pagination
|
|
|
- :total="page.total"
|
|
|
- small
|
|
|
- hide-on-single-page
|
|
|
- @size-change="insideSizeChange"
|
|
|
- @current-change="insideCurrentChange"
|
|
|
- ></el-pagination> -->
|
|
|
+ <basic-container v-if="isShow">
|
|
|
+ <avue-crud :option="option" :table-loading="loading" :data="data" :page.sync="page" :search.sync="query"
|
|
|
+ id="out-table" :header-cell-class-name="headerClassName" ref="crud" @row-del="rowDel"
|
|
|
+ @search-change="searchChange" @search-reset="searchReset" @selection-change="selectionChange"
|
|
|
+ @current-change="currentChange" @size-change="sizeChange" @refresh-change="refreshChange"
|
|
|
+ @resetColumn="resetColumn('crud', 'option', 'optionBack', 68)"
|
|
|
+ @saveColumn="saveColumn('crud', 'option', 'optionBack', 68)" @on-load="onLoad">
|
|
|
+ <template slot="menu" slot-scope="{ row, index }">
|
|
|
+ <el-button size="small" icon="el-icon-edit" type="text" @click="rowEdit(row)">编辑</el-button>
|
|
|
</template>
|
|
|
- <template slot="corpIdSearch">
|
|
|
- <crop-select v-model="search.corpId" corpType="KH"></crop-select>
|
|
|
- </template>
|
|
|
- <template slot-scope="scope" slot="corpId">
|
|
|
- {{ scope.row.corpName }}
|
|
|
- </template>
|
|
|
- <template slot-scope="{ row, index }" slot="profitReturn">
|
|
|
- <el-input v-if="row.$cellEdit" v-model="row.profitReturn" placeholder="请输入" size="small"
|
|
|
- oninput='this.value=this.value.replace(/[^(\d.)]/g,"").replace(/^(\d+)\.(\d\d).*$/, "$1.$2")'
|
|
|
- @change="profitChange(row)"></el-input>
|
|
|
- <span v-else>{{ row.profitReturn }}</span>
|
|
|
+ <template slot="cname" slot-scope="{ row }">
|
|
|
+ <span style="color: #1e9fff;cursor: pointer;" @click="rowEdit(row)">{{ row.cname }}</span>
|
|
|
</template>
|
|
|
</avue-crud>
|
|
|
</basic-container>
|
|
|
+ <detailsPage v-if="!isShow" :detailData="detailData" @goBack="goBack"></detailsPage>
|
|
|
</div>
|
|
|
</template>
|
|
|
|
|
|
<script>
|
|
|
-import option from './config/mainList.json';
|
|
|
-import { customerList, getRebateDetail } from "@/api/basicData/customerInformation";
|
|
|
-import { typeSave2 } from "@/api/basicData/customerInformation";
|
|
|
-
|
|
|
+import { customerList } from "@/api/basicData/customerInformation";
|
|
|
+import detailsPage from "./detailsPage";
|
|
|
export default {
|
|
|
- name: "index",
|
|
|
data() {
|
|
|
return {
|
|
|
- option: {},
|
|
|
- dataList: [],
|
|
|
- form: {},
|
|
|
+ detailData: {},
|
|
|
+ isShow: true,
|
|
|
+ query: {},
|
|
|
+ loading: false,
|
|
|
page: {
|
|
|
- pageSize: 20,
|
|
|
- pagerCount: 5,
|
|
|
+ pageSize: 10,
|
|
|
currentPage: 1,
|
|
|
- total: 0,
|
|
|
- pageSizes: [20, 30, 40, 50, 100, 200, 300, 400, 500]
|
|
|
- },
|
|
|
- search: {},
|
|
|
- loading: false,
|
|
|
- saveProfit: 0,
|
|
|
- insidePage: {
|
|
|
- total: 0,
|
|
|
- size: 10,
|
|
|
- current: 1,
|
|
|
+ total: 0
|
|
|
},
|
|
|
- expandOption: {
|
|
|
+ option: {},
|
|
|
+ optionBack: {
|
|
|
+ height: 'auto',
|
|
|
+ calcHeight: 30,
|
|
|
+ menuWidth: 140,
|
|
|
+ tip: false,
|
|
|
+ searchShow: true,
|
|
|
+ searchMenuSpan: 12,
|
|
|
border: true,
|
|
|
- align: 'center',
|
|
|
- menuAlign: 'center',
|
|
|
- header: false,
|
|
|
index: true,
|
|
|
+ addBtn: false,
|
|
|
+ viewBtn: false,
|
|
|
editBtn: false,
|
|
|
delBtn: false,
|
|
|
- menuWidth: "80",
|
|
|
- dialogClickModal: false,
|
|
|
- indexSlot: true,
|
|
|
+ searchIcon: true,
|
|
|
+ align: 'center',
|
|
|
+ searchIndex: 3,
|
|
|
column: [
|
|
|
{
|
|
|
- label: '订单号',
|
|
|
- prop: 'orderNo',
|
|
|
- width: 100,
|
|
|
- cell: true,
|
|
|
- overHidden: true
|
|
|
- }, {
|
|
|
- label: '变动总返利',
|
|
|
- prop: 'changeProfitReturn',
|
|
|
+ label: "编码",
|
|
|
+ prop: "code",
|
|
|
+ search: true,
|
|
|
+ searchOrder: 1,
|
|
|
+ overHidden: true,
|
|
|
+ },
|
|
|
+ {
|
|
|
+ label: "客户",
|
|
|
+ prop: "cname",
|
|
|
+ search: true,
|
|
|
+ searchOrder: 2,
|
|
|
+ overHidden: true,
|
|
|
+ },
|
|
|
+ {
|
|
|
+ label: "总返利",
|
|
|
+ prop: "profitReturn",
|
|
|
+ overHidden: true,
|
|
|
+ },
|
|
|
+ {
|
|
|
+ label: "已用返利",
|
|
|
+ prop: "usedProfit",
|
|
|
+ overHidden: true,
|
|
|
+ },
|
|
|
+ {
|
|
|
+ label: "可用返利",
|
|
|
+ prop: "surplusProfit",
|
|
|
+ overHidden: true,
|
|
|
+ },
|
|
|
+ {
|
|
|
+ label: "本月待到账",
|
|
|
+ prop: "monthProfit",
|
|
|
overHidden: true,
|
|
|
- width: 120,
|
|
|
- cell: true
|
|
|
- }, {
|
|
|
- label: '变动已用返利',
|
|
|
- prop: 'changeUsedProfit',
|
|
|
- width: 120,
|
|
|
- overHidden: true
|
|
|
- }, {
|
|
|
- label: '变动可用返利',
|
|
|
- prop: 'changeSurplusProfit',
|
|
|
- width: 120,
|
|
|
- overHidden: true
|
|
|
- }, {
|
|
|
- label: '变动本月待到账返利',
|
|
|
- prop: 'changeMonthProfit',
|
|
|
- width: 160,
|
|
|
- overHidden: true
|
|
|
- }, {
|
|
|
- label: '变动时间',
|
|
|
- prop: 'createTime',
|
|
|
- width: 120,
|
|
|
- overHidden: true
|
|
|
}
|
|
|
]
|
|
|
},
|
|
|
- }
|
|
|
+ data: [],
|
|
|
+ };
|
|
|
+ },
|
|
|
+ components: {
|
|
|
+ detailsPage
|
|
|
},
|
|
|
async created() {
|
|
|
- // this.option = option
|
|
|
- this.option = await this.getColumnData(this.getColumnName(68), option);
|
|
|
- let i = 0;
|
|
|
- this.option.column.forEach(item => {
|
|
|
- if (item.search) i++
|
|
|
- })
|
|
|
- if (i % 3 !== 0) {
|
|
|
- const num = 3 - Number(i % 3)
|
|
|
- this.option.searchMenuSpan = num * 8;
|
|
|
- this.option.searchMenuPosition = "right";
|
|
|
- }
|
|
|
+ this.option = await this.getColumnData(this.getColumnName(68), this.optionBack);
|
|
|
},
|
|
|
methods: {
|
|
|
+ rowEdit(row) {
|
|
|
+ this.detailData = {
|
|
|
+ id: row.id
|
|
|
+ };
|
|
|
+ this.isShow = false
|
|
|
+ },
|
|
|
+ searchReset() {
|
|
|
+ this.query = this.$options.data().query;
|
|
|
+ this.onLoad(this.page);
|
|
|
+ },
|
|
|
+ // 搜索按钮点击
|
|
|
searchChange(params, done) {
|
|
|
- this.onLoad(this.page, params);
|
|
|
+ this.page.currentPage = 1;
|
|
|
+ this.onLoad(this.page, this.query);
|
|
|
done();
|
|
|
},
|
|
|
- currentChange(val) {
|
|
|
- this.page.currentPage = val;
|
|
|
+ currentChange(currentPage) {
|
|
|
+ this.page.currentPage = currentPage;
|
|
|
},
|
|
|
- sizeChange(val) {
|
|
|
- this.page.currentPage = 1;
|
|
|
- this.page.pageSize = val;
|
|
|
+ sizeChange(pageSize) {
|
|
|
+ this.page.pageSize = pageSize;
|
|
|
},
|
|
|
refreshChange() {
|
|
|
- this.dataList.forEach(item => {
|
|
|
- this.$refs.crud.toggleRowExpansion(item, false)
|
|
|
- })
|
|
|
- this.page.currentPage = 1;
|
|
|
- this.onLoad(this.page, this.search);
|
|
|
+ this.onLoad(this.page, this.query);
|
|
|
},
|
|
|
- onLoad(page, params = { parentId: 0 }) {
|
|
|
- this.dataList.forEach(item => {
|
|
|
- this.$refs.crud.toggleRowExpansion(item, false)
|
|
|
- })
|
|
|
- let queryParams = Object.assign({}, params, {
|
|
|
- size: page.pageSize,
|
|
|
- current: page.currentPage,
|
|
|
- corpsTypeId: '',
|
|
|
- corpType: 'KH'
|
|
|
- });
|
|
|
+ onLoad(page, params = {}) {
|
|
|
+ let obj = {}
|
|
|
+ obj = {
|
|
|
+ size:this.page.pageSize,
|
|
|
+ current:this.page.currentPage,
|
|
|
+ ...Object.assign(params, this.query),
|
|
|
+ }
|
|
|
this.loading = true;
|
|
|
- customerList(queryParams).then(res => {
|
|
|
- this.dataList = res.data.data.records;
|
|
|
+ customerList(obj).then(res => {
|
|
|
+ this.data = res.data.data.records;
|
|
|
this.page.total = res.data.data.total;
|
|
|
- if (this.page.total) {
|
|
|
- this.option.height = window.innerHeight - 240;
|
|
|
- }
|
|
|
- this.dataList.forEach(item => {
|
|
|
- this.$set(item, 'insideList', [])
|
|
|
- this.$set(item, 'loading', true)
|
|
|
- })
|
|
|
+ this.$nextTick(() => {
|
|
|
+ this.$refs.crud.doLayout();
|
|
|
+ this.$refs.crud.dicInit();
|
|
|
+ });
|
|
|
}).finally(() => {
|
|
|
this.loading = false;
|
|
|
- });
|
|
|
+ })
|
|
|
+ },
|
|
|
+ // 详情的返回列表
|
|
|
+ goBack() {
|
|
|
+ this.detailData = {}
|
|
|
+ this.isShow = true;
|
|
|
+ this.onLoad(this.page, this.query);
|
|
|
},
|
|
|
- async saveColumn() {
|
|
|
- const inSave = await this.saveColumnData(
|
|
|
- this.getColumnName(68),
|
|
|
- this.option
|
|
|
- );
|
|
|
+ //自定义列保存
|
|
|
+ async saveColumn(ref, option, optionBack, code) {
|
|
|
+ /**
|
|
|
+ * 已定义全局方法,直接使用,saveColumnData保存列数据方法,参数传值(表格名称,当前表格的option数据)
|
|
|
+ * 已定义全局方法,直接使用,getColumnName方法用来获取枚举值,参数根据自己定义的code值获取中文名
|
|
|
+ * 一定要执行异步操作,要等接口成功返回,才能执行下一行代码
|
|
|
+ */
|
|
|
+ const inSave = await this.saveColumnData(this.getColumnName(code), this[option]);
|
|
|
if (inSave) {
|
|
|
this.$message.success("保存成功");
|
|
|
//关闭窗口
|
|
|
- this.$refs.crud.$refs.dialogColumn.columnBox = false;
|
|
|
+ this.$refs[ref].$refs.dialogColumn.columnBox = false;
|
|
|
+ this.searchReset()
|
|
|
}
|
|
|
},
|
|
|
- async resetColumn() {
|
|
|
- this.option = option;
|
|
|
- const inSave = await this.delColumnData(
|
|
|
- this.getColumnName(68),
|
|
|
- option
|
|
|
- );
|
|
|
+ //自定义列重置
|
|
|
+ async resetColumn(ref, option, optionBack, code) {
|
|
|
+ this[option] = this[optionBack];
|
|
|
+ const inSave = await this.delColumnData(this.getColumnName(code), this[optionBack]);
|
|
|
if (inSave) {
|
|
|
this.$message.success("重置成功");
|
|
|
- //关闭窗口
|
|
|
- this.$refs.crud.$refs.dialogColumn.columnBox = false;
|
|
|
- }
|
|
|
- },
|
|
|
- //编辑
|
|
|
- rowCell(row) {
|
|
|
- if (row.$cellEdit) {
|
|
|
- typeSave2(row).then(res => {
|
|
|
- this.$message.success('保存成功')
|
|
|
- this.$set(row, "$cellEdit", false);
|
|
|
- })
|
|
|
- } else {
|
|
|
- this.$set(row, "$cellEdit", true);
|
|
|
- }
|
|
|
- },
|
|
|
- // 修改保存调用
|
|
|
- rowUpdate(row, index, done) {
|
|
|
- typeSave2(row).then(res => {
|
|
|
- this.$message.success(row.id ? '修改成功' : '新增成功')
|
|
|
- })
|
|
|
- done()
|
|
|
- },
|
|
|
- profitChange(row) {
|
|
|
- if (Number(row.profitReturn) < Number(row.usedProfit)) {
|
|
|
- row.profitReturn = this.saveProfit
|
|
|
- return this.$message.error('总返利不能小于使用返利')
|
|
|
+ this.$refs[ref].$refs.dialogColumn.columnBox = false;
|
|
|
+ this.searchReset()
|
|
|
}
|
|
|
- row.surplusProfit = (Number(row.profitReturn) - Number(row.usedProfit)).toFixed(2)
|
|
|
},
|
|
|
- expandGetList() {
|
|
|
- // const data = {
|
|
|
- // corpId: row.id
|
|
|
- // }
|
|
|
- // getRebateDetail({corpId: row.id}).then(res => {
|
|
|
- // row.insideList = res.data.data? res.data.data.records: []
|
|
|
- // row.loading = false
|
|
|
- // })
|
|
|
- },
|
|
|
- addRow(row) {
|
|
|
- row.insideList.push({corpId:row.id,$cellEdit: true })
|
|
|
- },
|
|
|
- // 表格展开触发
|
|
|
- expandChange(row, index) {
|
|
|
- if (row.loading) {
|
|
|
- getRebateDetail({ corpId: row.id }).then(res => {
|
|
|
- row.insideList = res.data.data ? res.data.data : []
|
|
|
- row.loading = false
|
|
|
- })
|
|
|
+ // 更改表格颜色
|
|
|
+ headerClassName(tab) {
|
|
|
+ //颜色间隔
|
|
|
+ let back = ""
|
|
|
+ if (tab.columnIndex >= 0 && tab.column.level === 1) {
|
|
|
+ if (tab.columnIndex % 2 === 0) {
|
|
|
+ back = "back-one"
|
|
|
+ } else if (tab.columnIndex % 2 === 1) {
|
|
|
+ back = "back-two"
|
|
|
+ }
|
|
|
}
|
|
|
+ return back;
|
|
|
},
|
|
|
- insideSizeChange(val) {
|
|
|
- this.insidePage.size = val
|
|
|
- },
|
|
|
- insideCurrentChange(val) {
|
|
|
- this.insidePage.current = val
|
|
|
- },
|
|
|
- },
|
|
|
+
|
|
|
+ }
|
|
|
}
|
|
|
+
|
|
|
</script>
|
|
|
|
|
|
<style scoped>
|
|
|
-/deep/ .el-table__expanded-cell .el-table__header-wrapper .cell {
|
|
|
- //font-size: 8px !important;
|
|
|
- font-size: 12px !important;
|
|
|
+::v-deep#out-table .back-one {
|
|
|
+ background: #ecf5ff !important;
|
|
|
+ text-align: center;
|
|
|
+}
|
|
|
+
|
|
|
+::v-deep#out-table .back-two {
|
|
|
+ background: #ecf5ff !important;
|
|
|
+ text-align: center;
|
|
|
+}
|
|
|
+
|
|
|
+.pointerClick {
|
|
|
+ cursor: pointer;
|
|
|
+ color: #1e9fff;
|
|
|
}
|
|
|
|
|
|
-/deep/ .el-table__body-wrapper .cell {
|
|
|
- //font-size: 8px;
|
|
|
- font-size: 12px;
|
|
|
+::v-deep .el-col-md-8 {
|
|
|
+ width: 24.33333%;
|
|
|
}
|
|
|
-</style>
|
|
|
+</style>
|