还款计算修改

master
十七 3 years ago
parent df135edb0b
commit 16a3098cc1

@ -239,6 +239,7 @@ export default {
},
//
openPro(row) {
let proList = [];
this.list.forEach((item, index) => {
console.log(item);
item.proList.forEach((items) => {
@ -258,9 +259,9 @@ export default {
this.list.splice(form.index, 1, form);
console.log(this.list);
this.sumList();
this.restList(form);
// this.restPro(form);
},
restList(form) {
restPro(form) {
if (form.courseMoney > 0) {
var list = [];
var listCopy = [];
@ -293,7 +294,11 @@ export default {
},
recData(v) {
let form = JSON.parse(JSON.stringify(v));
console.log(form);
this.list.splice(form.index, 1, form);
this.sumList();
// this.restRec(form);
},
restRec(form) {
if (form.recMoney > 0) {
var list = [];
form.recList.forEach((item) => {
@ -316,8 +321,6 @@ export default {
}
});
}
this.list.splice(form.index, 1, form);
this.sumList();
},
//
handleClose() {

@ -1,213 +1,214 @@
<template>
<el-dialog :close-on-click-model="false" v-dialogDrag :title="staffTitle" :visible.sync="dialogVisible" width="500px" append-to-body>
<el-button size="mini" type="primary" @click="add()"></el-button>
<el-button size="mini" type="primary" @click="del()"></el-button>
<div class="flex">
<el-table :data="list" max-height="600">
<el-table-column align="center" :label="staffTitle">
<el-table-column min-width="140" align="center" label="员工">
<template slot-scope="scope">
<el-select filterable default-first-option v-model="scope.row.label" placeholder="请选择" @change="editChange($event,scope.$index)">
<el-option v-for="item in options" :key="item.id" :label="item.label" :value="item.id">
</el-option>
</el-select>
</template>
</el-table-column>
<el-table-column min-width="100" align="center" label="占比">
<template slot-scope="scope">
<el-input v-focus type="number" @blur="endEdit(scope.row,scope.$index)" :disabled="scope.$index==0" size="samll" v-model="scope.row.ratio"></el-input>
</template>
</el-table-column>
</el-table-column>
</el-table>
</div>
<span slot="footer" class="dialog-footer">
<el-button size="mini" type="primary" plain @click="dialogVisible = false"> </el-button>
<el-button size="mini" type="primary" @click="confirms()">
</el-button>
</span>
</el-dialog>
</template>
<script>
import { selectList, selectListType, QuerCompetent } from "@/api/eashier.js";
export default {
data() {
return {
dialogVisible: false, //
staffList: [],
list: [], //
form: {}, //
options: [{ label: "10001-刘乐乐" }],
staffText: "",
staffTitle: "",
staffListCopy: [],
};
},
methods: {
add() {
this.list.push({});
this.changeStaff();
},
endEdit(row, index) {
if (!row.ratio) {
row.ratio = 0;
}
row.ratio = row.ratio * 1;
let number = 0;
this.list.forEach((item, index) => {
if (index != 0) {
number += item.ratio * 1;
}
});
this.list[0].ratio = 100 - number;
this.changeStaff();
},
editChange(e, index) {
let row = this.list[index];
let form = {};
this.options.forEach((item) => {
if (e == item.id) {
form = { ...item };
}
});
if (row.ratio > 0) {
form.ratio = row.ratio;
}
this.list.splice(index, 1, form);
console.log(this.options);
this.changeStaff();
},
del() {
let index = this.list.length - 1;
this.list[0].ratio += this.list[index].ratio;
this.list.splice(index, 1);
this.changeStaff();
},
//
show(form, text) {
this.list = [];
this.form = { ...form };
this.staffText = text;
if (text == "zhonggongList") {
this.staffTitle = "美发师";
}
if (text == "largeList") {
this.staffTitle = "美容师";
}
if (text == "smallList") {
this.staffTitle = "助理";
}
if (text == "technicianList") {
this.staffTitle = "技师";
}
if (text == "adminList") {
this.staffTitle = "门店管理层";
}
if (text == "managerList") {
this.staffTitle = "高管";
}
this.list = form[text];
this.list.forEach((item) => {
if (item.id) {
item.label = item.brandNumber + "-" + item.staffName;
}
});
this.dialogVisible = true;
this.getData();
this.changeStaff();
this.endEdit()
},
changeStaff() {
var that = this;
console.log(that.list);
console.log(that.staffListCopy);
var list = that.list.concat(that.staffListCopy).filter(function (v) {
return (
that.list.indexOf(v) === -1 || that.staffListCopy.indexOf(v) === -1
);
});
this.options = list;
},
//
async getData() {
if (this.text == "adminList") {
selectListType({ type: 0 }).then((res) => {
if (res.code == "000000") {
res.rows.forEach((item) => {
item.label = item.brandNumber + "-" + item.staffName;
item.ratio = 100;
delete item.state;
});
this.options = res.rows;
this.staffListCopy = res.rows;
} else {
this.$alert(res.message, "加载员工提示", {
confirmButtonText: "确定",
confirmButtonClass: "confirmbtnFalses",
type: "warning",
center: true,
callback: (action) => {},
});
}
});
} else if (this.text == "managerList") {
QuerCompetent({ type: 0, pageSize: 999 }).then((res) => {
if (res.code == "000000") {
res.pageInfo.list.forEach((item) => {
item.label = item.brandNumber + "-" + item.staffName;
item.ratio = 100;
delete item.state;
});
this.options = res.pageInfo.list;
this.staffListCopy = res.pageInfo.list;
} else {
this.$alert(res.message, "加载高管提示", {
confirmButtonText: "确定",
confirmButtonClass: "confirmbtnFalses",
type: "warning",
center: true,
callback: (action) => {},
});
}
});
} else {
let form = { id: "" };
if (this.staffName) {
form.staffName = this.staffName;
}
selectList(form).then((res) => {
if (res.code == "000000") {
res.rows.forEach((item) => {
item.label = item.brandNumber + "-" + item.staffName;
item.ratio = 0;
});
this.options = res.rows;
this.staffListCopy = res.rows;
} else {
this.$alert(res.message, "提示", {
confirmButtonText: "确定",
confirmButtonClass: "confirmbtnFalses",
type: "warning",
center: true,
callback: (action) => {},
});
}
});
}
},
confirms() {
let form = {
text: this.staffText,
list: this.list,
};
this.$emit("staffratioData", form);
this.dialogVisible = false;
},
},
};
</script>
<style>
</style>
<template>
<el-dialog :close-on-click-model="false" v-dialogDrag :title="staffTitle" :visible.sync="dialogVisible" width="500px" append-to-body>
<el-button size="mini" type="primary" @click="add()"></el-button>
<el-button size="mini" type="primary" @click="del()"></el-button>
<div class="flex">
<el-table :data="list" max-height="600">
<el-table-column align="center" :label="staffTitle">
<el-table-column min-width="140" align="center" label="员工">
<template slot-scope="scope">
<el-select filterable default-first-option v-model="scope.row.label" placeholder="请选择" @change="editChange($event,scope.$index)">
<el-option v-for="item in options" :key="item.id" :label="item.label" :value="item.id">
</el-option>
</el-select>
</template>
</el-table-column>
<el-table-column min-width="100" align="center" label="占比">
<template slot-scope="scope">
<el-input v-focus type="number" @blur="endEdit(scope.row,scope.$index)" :disabled="scope.$index==0" size="samll" v-model="scope.row.ratio"></el-input>
</template>
</el-table-column>
</el-table-column>
</el-table>
</div>
<span slot="footer" class="dialog-footer">
<el-button size="mini" type="primary" plain @click="dialogVisible = false"> </el-button>
<el-button size="mini" type="primary" @click="confirms()">
</el-button>
</span>
</el-dialog>
</template>
<script>
import { selectList, selectListType, QuerCompetent } from "@/api/eashier.js";
export default {
data() {
return {
dialogVisible: false, //
staffList: [],
list: [], //
form: {}, //
options: [{ label: "10001-刘乐乐" }],
staffText: "",
staffTitle: "",
staffListCopy: [],
};
},
methods: {
add() {
this.list.push({});
this.changeStaff();
},
endEdit(row, index) {
if (row.ratio || row.ratio * 1 < 101) {
row.ratio = row.ratio * 1;
} else {
row.ratio = 0;
}
let number = 0;
this.list.forEach((item, index) => {
if (index != 0) {
number += item.ratio * 1;
}
});
this.list[0].ratio = 100 - number;
this.changeStaff();
},
editChange(e, index) {
let row = this.list[index];
let form = {};
this.options.forEach((item) => {
if (e == item.id) {
form = { ...item };
}
});
if (row.ratio > 0) {
form.ratio = row.ratio;
}
this.list.splice(index, 1, form);
console.log(this.options);
this.changeStaff();
},
del() {
let index = this.list.length - 1;
this.list[0].ratio += this.list[index].ratio;
this.list.splice(index, 1);
this.changeStaff();
},
//
show(form, text) {
this.list = [];
this.form = { ...form };
this.staffText = text;
if (text == "zhonggongList") {
this.staffTitle = "美发师";
}
if (text == "largeList") {
this.staffTitle = "美容师";
}
if (text == "smallList") {
this.staffTitle = "助理";
}
if (text == "technicianList") {
this.staffTitle = "技师";
}
if (text == "adminList") {
this.staffTitle = "门店管理层";
}
if (text == "managerList") {
this.staffTitle = "高管";
}
this.list = form[text];
this.list.forEach((item) => {
if (item.id) {
item.label = item.brandNumber + "-" + item.staffName;
}
});
this.dialogVisible = true;
this.getData();
this.changeStaff();
this.endEdit();
},
changeStaff() {
var that = this;
console.log(that.list);
console.log(that.staffListCopy);
var list = that.list.concat(that.staffListCopy).filter(function (v) {
return (
that.list.indexOf(v) === -1 || that.staffListCopy.indexOf(v) === -1
);
});
this.options = list;
},
//
async getData() {
if (this.text == "adminList") {
selectListType({ type: 0 }).then((res) => {
if (res.code == "000000") {
res.rows.forEach((item) => {
item.label = item.brandNumber + "-" + item.staffName;
item.ratio = 100;
delete item.state;
});
this.options = res.rows;
this.staffListCopy = res.rows;
} else {
this.$alert(res.message, "加载员工提示", {
confirmButtonText: "确定",
confirmButtonClass: "confirmbtnFalses",
type: "warning",
center: true,
callback: (action) => {},
});
}
});
} else if (this.text == "managerList") {
QuerCompetent({ type: 0, pageSize: 999 }).then((res) => {
if (res.code == "000000") {
res.pageInfo.list.forEach((item) => {
item.label = item.brandNumber + "-" + item.staffName;
item.ratio = 100;
delete item.state;
});
this.options = res.pageInfo.list;
this.staffListCopy = res.pageInfo.list;
} else {
this.$alert(res.message, "加载高管提示", {
confirmButtonText: "确定",
confirmButtonClass: "confirmbtnFalses",
type: "warning",
center: true,
callback: (action) => {},
});
}
});
} else {
let form = { id: "" };
if (this.staffName) {
form.staffName = this.staffName;
}
selectList(form).then((res) => {
if (res.code == "000000") {
res.rows.forEach((item) => {
item.label = item.brandNumber + "-" + item.staffName;
item.ratio = 0;
});
this.options = res.rows;
this.staffListCopy = res.rows;
} else {
this.$alert(res.message, "提示", {
confirmButtonText: "确定",
confirmButtonClass: "confirmbtnFalses",
type: "warning",
center: true,
callback: (action) => {},
});
}
});
}
},
confirms() {
let form = {
text: this.staffText,
list: this.list,
};
this.$emit("staffratioData", form);
this.dialogVisible = false;
},
},
};
</script>
<style>
</style>

@ -50,10 +50,11 @@ export default {
this.changeStaff();
},
endEdit(row, index) {
if (!row.ratio) {
if (row.ratio || row.ratio * 1 < 101) {
row.ratio = row.ratio * 1;
} else {
row.ratio = 0;
}
row.ratio = row.ratio * 1;
let number = 0;
this.list.forEach((item, index) => {
if (index != 0) {

@ -877,11 +877,6 @@ export default {
}
form.memberId = this.memberForm.id;
form.integral = this.memberForm.integral;
if (this.proIndex != -1) {
// if (this.list[this.proIndex].projectName) {
// this.czRecList(this.list[this.proIndex]);
// }
}
form.rechargeAccountList = this.recListCopy;
} else {
form.amount = res.data.price;
@ -898,7 +893,12 @@ export default {
form.cashAmount = form.amount;
form.collectionAmount = form.cashAmount;
}
if (this.list.length > 0) {
console.log(this.list.length);
if (!this.list[0].projectName) {
this.proIndex = 0;
}
}
if (this.proIndex != -1) {
if (this.list[this.proIndex].projectName) {
this.czRecList(this.list[this.proIndex]);

@ -53,10 +53,11 @@ export default {
this.changeStaff();
},
endEdit(row, index) {
if (!row.ratio) {
if (row.ratio || row.ratio * 1 < 101) {
row.ratio = row.ratio * 1;
} else {
row.ratio = 0;
}
row.ratio = row.ratio * 1;
let number = 0;
this.list.forEach((item, index) => {
if (index != 0) {

Loading…
Cancel
Save