还款计算修改

master
十七 3 years ago
parent df135edb0b
commit 16a3098cc1

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

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

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

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

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

Loading…
Cancel
Save