You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

1008 lines
36 KiB
Vue

<template>
<!-- 转入 0 转出 1 -->
<div>
<el-form inline>
<el-form-item label="分店名称:" :label-width="labelWidth">
<div class="form-width-ms">
<el-input v-model="label">
<el-button size="mini" slot="append" icon="el-icon-search" @click="openBranch"></el-button>
</el-input>
</div>
</el-form-item>
<el-form-item label="手机号码:" :label-width="labelWidth">
<div class="form-width-ms">
<el-input oninput="this.value=this.value.replace(/\D/g,'')" pattern="[0-9]*" maxlength="11"
v-model="proForm.mobilePhone" @blur="memberOne" @change="memberOne">
<el-button size="mini" slot="append" icon="el-icon-search" @click="openMember"></el-button>
</el-input>
</div>
</el-form-item>
<el-form-item label="会员名字:" :label-width="labelWidth">
<div class="form-width-ms">
{{ proForm.memberName }}
</div>
</el-form-item>
<el-form-item label="待付金额:" :label-width="labelWidth">
<div class="form-width-ms">
{{ (0>debtMoney)? '超出 ' + (debtMoney * -1) : debtMoney }} </div>
</el-form-item>
<el-form-item label="业务时间:" :label-width="labelWidth" v-show="isAddition == 1">
<div class="form-width-ms">
<span style="cursor: pointer;" @click="(recDateShow = true)" v-show="!recDateShow">{{ proForm.additionDate }}
<i class="el-icon-edit"></i> </span>
<el-date-picker size="medium" @blur='(recDateShow = false)' v-show="recDateShow" ref="recDate"
v-model="proForm.additionDate" :picker-options="pickerOptions" format="yyyy-MM-dd" value-format="yyyy-MM-dd"
placeholder="选择日期">
</el-date-picker>
</div>
</el-form-item>
<div class="flex justify-center align-start flex-wrap padding-top">
<div class="into-table-width margin-right-xs padding-left-lg">
<div class="raisetable bg-white margin-bottom-xs">
<div class="raisetable-sum">
<div>转出疗程 <el-button v-if="proForm.memberName" :disabled="!proForm.memberId" size="mini" type="primary"
@click='openPro(1)'>添加
</el-button>
</div>
</div>
<el-table :data="outList" empty-text='暂无数据 , 点击添加疗程' max-height="200"
:header-cell-style="{ background: 'linear-gradient(#6cb3ff, #1873d4)', color: '#eeeeee' }"
style="margin-top: 5px;">
<el-table-column type="expand">
<template slot-scope="scope">
<div class="flex justify-start align-center flex-wrap ">
<el-form inline class="margin-top-xs margin-left-xs">
<el-form-item label="员工">
<div class="flex align-center form-width-m">
<el-select
filterable
default-first-option
clearable
v-model="scope.row.staffLists[0].staffName"
placeholder="请选择"
>
</el-select>
<!-- <div class="el-icon-circle-close text-xs text-cyan" @click.stop="scope.row.smallLists=null,scope.row.smallList.splice(0,1)"></div> -->
<div
class="el-icon-edit-outline text-xs text-cyan"
@click.stop="
openStaffRatio(scope.row.staffLists, scope.$index)
"
></div>
</div>
</el-form-item>
<br />
</el-form>
</div>
</template>
</el-table-column>
<el-table-column label="项目编码" align="center" prop="courseProjectNum" min-width="80"></el-table-column>
<el-table-column label="账户名称" align="center" prop="courseProjectName" min-width="140"></el-table-column>
<el-table-column label="可用次数" align="center" prop="courseConsumeCount" min-width="80"></el-table-column>
<el-table-column label="可用金额" align="center" prop="courseConsumePrice" min-width="80"></el-table-column>
<!-- <el-table-column label="疗程单价" align="center" prop="unitMoney" min-width="80"></el-table-column> -->
<el-table-column label="疗程单价" align="center" prop="price" min-width="80"></el-table-column>
<el-table-column label="转出次数" align="center" prop="changeOutTime" min-width="100">
<template slot-scope='scope'>
<div class="form-input-width" v-if="!scope.row.changeOutTimeShow"
@click="openEditOut(scope.row, scope.$index, scope.row.changeOutTimeShow = true)">
{{ scope.row.changeOutTime }}
<i class="el-icon-edit text-cyan"></i>
</div>
<el-input v-else v-focus class="form-input-width-xs" type='number' v-model="scope.row.changeOutTime"
@blur="endChangeOutTime(scope.row, scope.$index, scope.row.changeOutTime, scope.row.price)">
</el-input>
</template>
</el-table-column>
<el-table-column label="转出金额" align="center" prop="changeOutMoney" min-width="100">
<template slot-scope='scope'>
<div class="form-input-width" v-if="outMoneyIndex != scope.$index"
@click="openOutMoney(scope.row, scope.$index)">
{{ scope.row.changeOutMoney }}
<i class="el-icon-edit text-cyan"></i>
</div>
<el-input v-else v-focus class="form-input-width-xs" type='number' v-model="scope.row.changeOutMoney"
@blur="endOutMoney(scope.row)"></el-input>
</template>
</el-table-column>
<el-table-column align="center" fixed="right" min-width="80">
<template slot-scope='scope'>
<div @click="delOldPro(scope.$index)" class="el-icon-delete"></div>
</template>
</el-table-column>
</el-table>
</div>
<div class="raisetable bg-white ">
<div class="raisetable-sum">
<div>转入疗程 <el-button v-if="proForm.memberName" size="mini" type="primary" @click='openPro(0)'>添加
</el-button>
<el-button v-if="proForm.memberName" size="mini" type="warning" @click='backout'>撤销</el-button>
</div>
<div style="width: 150px;">成交金额 : {{ inMoneys }}</div>
<div style="width: 150px;">转入金额 : {{ outMoneys }}</div>
<div style="width: 150px;">现付金额 : {{ payMoneys }}</div>
<div style="width: 150px;">欠款金额 : {{ debtMoney }}</div>
</div>
<el-table :data="inList" max-height="150" empty-text='暂无数据 , 点击添加疗程'
:header-cell-style="{ background: 'linear-gradient(#6cb3ff, #1873d4)', color: '#eeeeee' }"
style="margin-top: 5px;">
<el-table-column label="项目编码" show-overflow-tooltip align="center" prop="projectNum" min-width="90">
</el-table-column>
<el-table-column label="账户名称" show-overflow-tooltip align="center" prop="projectName" min-width="110">
</el-table-column>
<el-table-column label="标准单价" align="center" prop="priceMember" min-width="70"></el-table-column>
<el-table-column label="最低单价" align="center" prop="minumumPriceMember" min-width="70"></el-table-column>
<el-table-column label="单价" align="center" prop="prices" min-width="90">
<template slot-scope='scope'>
<div class="form-input-width" v-if="inNumberIndexs != scope.$index"
@click="openEdit(scope.row, scope.$index, inNumberIndexs = scope.$index)">
{{ scope.row.prices }}
<i class="el-icon-edit text-cyan"></i>
</div>
<el-input v-focus class="form-input-width-xs" type="number" v-else v-model="scope.row.prices"
@blur="endEditprices(scope.row)"></el-input>
</template>
</el-table-column>
<el-table-column label="转入次数" align="center" prop="changeInTime" min-width="90">
<template slot-scope='scope'>
<div class="form-input-width" v-if="inNumberIndex != scope.$index"
@click="openEdit(scope.row, scope.$index, inNumberIndex = scope.$index)">
{{ scope.row.changeInTime }}
<i class="el-icon-edit text-cyan"></i>
</div>
<el-input v-focus class="form-input-width-xs" type="number" v-else v-model="scope.row.changeInTime"
@blur="endEditTimes(scope.row)"></el-input>
</template>
</el-table-column>
<!-- <el-table-column label="欠款金额" v-if="sessionStorageData.allowdebt" align="center" prop="debtMoney"
min-width="90"></el-table-column> -->
<el-table-column label="成交金额" align="center" prop="transactionMoney" min-width="80">
</el-table-column>
</el-table>
</div>
</div>
<div style="width:280px;" class="border-radius-10 border bg-white padding-xs">
<el-table :data="proForm.payLists" max-height="350">
<el-table-column align="center" prop="payName" label="支付方式" min-width="100"></el-table-column>
<el-table-column align="center" prop="payMoney" fixed="right" label="本次支付" min-width="80">
<template slot-scope="scope">
<div class="form-input-width" v-if="!scope.row.isShow" @click="editPay(scope.row, scope.$index)">
{{ scope.row.payMoney }}
<i class="el-icon-edit text-cyan"></i>
</div>
<el-input v-else v-focus @click="endEdit(scope.row)" @blur="endEdit(scope.row)"
@change="endEdit(scope.row)" @keydown.enter="endEdit(scope.row)" v-model="scope.row.payMoney"
type="number" class="form-input-wdith-xs"></el-input>
</template>
</el-table-column>
</el-table>
<div style="text-align:center;width: 100%;" @click="endEdits()" v-if="!shows">合计</div>
<div style="display:flex" v-if="shows">
<div style="margin-left:30%">现付金额为:</div>
<div style="margin-left: 20%;">{{ payMoneys }}</div>
</div>
</div>
</div>
<div class="into-table-width flex justify-center align-start flex-wrap padding-top padding-left-lg">
<staffsles ref="staffsles" @staffslesData="staffslesData"></staffsles>
<admin ref="admin" @adminData="adminData"></admin>
<manager ref="manager" @managerData="managerData"></manager>
</div>
<div class="into-table-width padding-top text-center padding-left-lg">
<el-button size="mini" type="info" @click='empty()' plain>清空</el-button>
<el-button size="mini" v-if="isAddition == 0" type="primary" @click="isAddition = 1">补单</el-button>
<el-button size="mini" v-else type="success" @click="isAddition = 0">加价</el-button>
<el-button size="mini" type="primary" @click='raiseProList()' plain v-role='5004103'>列表</el-button>
<el-button size="mini" type="primary" @click='submit(true, loading = true)' :loading="loading" v-role="5004101" :disabled="outList.length == 0 && inList.length == 0">提交</el-button>
</div>
</el-form>
<member ref="member" @memberData="memberData"></member>
<project ref="project" @projectData="projectData" :storeId='StoreIds'></project>
<Branch ref="Branch" @BranchData="BranchData"></Branch>
<staffratio ref="staffratio" @staffratioData="staffratioData"></staffratio>
</div>
</template>
<script>
import { propage } from "@/api/storeManage.js";
import {
ctlist,
selectList,
storeMemberOne,
couAccountList,
addCardChange,
} from "@/api/eashier.js";
import staffratio from "./staffratio";
import member from "@/components/member/index";
import Branch from "@/components/Branch/index";
import project from "@/components/project/index";
import admin from "@/components/staffList/admin/index";
import manager from "@/components/staffList/manager/index";
import staffsles from "@/components/staffList/staff/index";
export default {
components: {
staffsles,
manager,
admin,
member,
project,
Branch,
staffratio
},
data() {
return {
pickerOptions: {
disabledDate(time) {
return time.getTime() > Date.now();
},
},
storeName:"",
storeId:"",
projectDialogVisible: false,
shows: false,
recDateShow: false,
activeName: "现付",
outMoneyIndex: -1,
inNumberIndex: -1,
inNumberIndexs: -1,
payMoneys: 0,
proForm: {
additionDate: null,
manageStaffName: null,
mobilePhone: null,
staffLists: [{ ratio: 100 }], //员工占比初始化
managerLists: [{ ratio: 100 }], //员工占比初始化
adminList: [{ ratio: 100 }], //员工占比初始化
payLists: [], //现付列表
Branch:null,
},
outList: [],
inList: [],
staffList: [],
labelWidth: "100px",
proPageInfo: {
total: 0, //分页总条数
pageNum: 1,
pageSize: 10,
list: [], //主数组
},
proRadio: null,
proRadioForm: null,
projectName: null,
openProText: 0,
couAccountList: [],
inMoneys: 0,
outMoneys: 0,
sessionStorageData: null,
debtMoney: 0,
isAddition: 0,
loading: false,
TransactionNum: 0,
StoreIds:"",
label:"",
staff:[]
};
},
methods: {
openStaffRatio(row, index, text) {
this.editIndex = index
this.$refs.staffratio.show(row);
this.$refs.staffratio.showdetele();
localStorage.setItem("row", JSON.stringify(row));
localStorage.setItem("text", text);
},
staffratioData(v) {
console.log('v--->',v)
let form = this.outList[this.editIndex];
form.rows = v.list;
form.staffLists=v.list
form.cardAchievementAmount=v.list[0].cardAchievementAmount
form.cardCommissionAmount=v.list[0].cardCommissionAmount
form.cardSalesAchievement=v.list[0].cardSalesAchievement
form.cardSalesCommission=v.list[0].cardSalesCommission
console.log("🚀 ~ file: index.vue ~ line 302 ~ staffratioData ~ form", form)
this.outList.splice(this.editIndex, 1, form);
},
BranchData(v) {
this.StoreIds=v.id
this.label=v.label
this.setStaffRatio();
console.log("🚀 ~ file: index.vue ~ line 217 ~ BranchData ~ " , 'aaaa')
},
openBranch(){
this.$refs.Branch.show();
},
setStaffRatio() {
var that = this;
setTimeout(() => {
if(this.StoreIds){
that.$refs.staffsles.show(that.proForm.staffLists,that.StoreIds);
that.$refs.manager.show(that.proForm.managerLists,that.StoreIds);
that.$refs.admin.show(that.proForm.adminList,that.StoreIds);
}else{
that.$refs.staffsles.show(that.proForm.staffLists);
that.$refs.manager.show(that.proForm.managerLists);
that.$refs.admin.show(that.proForm.adminList);
}
}, 800);
},
//员工占比返回方法
staffslesData(v) {
this.proForm.staffLists = [...v];
},
//高管占比返回方法
managerData(v) {
this.proForm.managerLists = [...v];
},
//管理员占比返回方法
adminData(v) {
this.proForm.adminList = [...v];
},
//打开选择会员弹窗
openMember() {
this.$refs.member.show();
},
//选中会员返回方法
memberData(v) {
this.proForm.mobilePhone = v.mobilePhone;
this.memberOne();
},
//提交信息
submit() {
let payMoneys = 0;
let payLists = [];
this.proForm.payLists.forEach((item) => {
payMoneys += item.payMoney * 1;
if (item.payMoney > 0) {
let items = {
payId: item.payId,
payMoney: item.payMoney,
payName: item.payName,
};
payLists.push(items);
}
});
let salesmens = [];
if(this.storeName){
this.proForm.storeName = this.storeName
this.proForm.storeId = this.storeId
}
this.proForm.managerLists.forEach((item) => {
if (item.id) {
item.staffType = 0;
salesmens.push(item);
}
});
this.proForm.adminList.forEach((item) => {
if (item.id) {
item.staffType = 1;
salesmens.push(item);
}
});
this.proForm.changeInPayMoney = payMoneys;
this.proForm.changeInMoney = this.inMoneys.toFixed(2) * 1;
this.proForm.changeOutMoney = this.outMoneys.toFixed(2) * 1;
this.proForm.isAddition = this.isAddition;
this.proForm.payLists = payLists;
this.proForm.cardChangeOutProjectRequests = this.outList;
this.proForm.cardChangeInProjectRequest = this.inList[0];
this.proForm.cardChangeInProjectRequest.salesmens = salesmens;
this.proForm.cardChangeInProjectRequest.staffLists =
this.proForm.staffLists;
if (this.debtMoney < 0) {
this.proForm.differenceMoney = this.debtMoney * -1;
this.proForm.debtMoney = 0;
this.proForm.isDebt = 0;
this.proForm.cardChangeInProjectRequest.isDebt = 0;
} else {
this.proForm.debtMoney = this.debtMoney;
this.proForm.isDebt = 1;
this.proForm.cardChangeInProjectRequest.isDebt = 1;
}
let falg = true;
if (this.isAddition == 1) {
if (this.proForm.additionDate) {
} else {
falg = false;
this.$alert("请选择补单业务时间", "提示", {
confirmButtonText: "确定",
confirmButtonClass: "confirmbtnFalses",
type: "warning",
center: true,
callback: (action) => { },
});
this.loading = false;
}
} else {
let sessionStorageData = JSON.parse(sessionStorage.getItem("sessionStorageData"));
if(sessionStorageData.cardCangeListDebt==true){
}else{
if (this.debtMoney * 1 != 0) {
this.$alert("转入金额和转出加支付金额不相等(本店不允许加价转疗程存在欠)", "提示", {
confirmButtonText: "确定",
confirmButtonClass: "confirmbtnFalses",
type: "warning",
center: true,
callback: (action) => { },
});
this.loading = false;
falg = false;
}
}
}
if (falg) {
this.addCardChange();
}
},
addCardChange() {
var that = this;
console.log("🚀 ~ file: index.vue ~ line 461 ~ addCardChange ~ this.proForm", this.proForm)
addCardChange(this.proForm).then((res) => {
this.loading = false;
if (res.code == "000000") {
this.$message.success({
message: res.message,
});
this.empty();
} else {
this.$alert(res.message, "提示", {
confirmButtonText: "确定",
confirmButtonClass: "confirmbtnFalses",
type: "warning",
center: true,
callback: (action) => {
that.ctlist();
},
});
}
});
},
//返回当前行的下标
tableRowClassName({ row, rowIndex }) {
row.index = rowIndex;
},
projectData(form,rows) {
this.storeName = form.storeName
this.storeId = form.storeId
form.memberId = this.proForm.memberId;
form.memberName = this.proForm.memberName;
form.mobilePhone = this.proForm.mobilePhone;
form.storeId = this.proForm.storeId;
form.storeName = this.proForm.storeName;
form.memberIdentityCard = this.proForm.identityCard;
if (this.openProText == 0) {
(form.priceMember * form.minumumTimes).toFixed(2) * 1;
form.prices = form.priceMember
form.changeInTime = 0;
form.projectId = form.id;
form.debtMoney = 0;
form.transactionMoney = form.changeInMoney;
form.changeInMoneyShow = false;
form.debtMoneyShow = false;
form.changeInCaseTimeShow = false;
if (this.inList.length < 1) {
this.inList.push(form);
this.inMoneys = 0;
} else {
this.$alert("只能选择一个项目进行转入", "提示", {
confirmButtonText: "确定",
confirmButtonClass: "confirmbtnFalses",
type: "warning",
center: true,
callback: (action) => { },
});
}
}
if (this.openProText == 1) {
form.unitMoney =
(form.courseProjectMoney / form.courseCount).toFixed(2) * 1;project
// form.changeOutMoney =
// (form.courseConsumeCount * form.unitMoney).toFixed(2) * 1;
form.changeOutMoney = 0;
form.changeOutTime = 0;
form.changeOutTimeShow = false;
form.accountId = form.id;
console.log("🚀 ~ file: index.vue ~ line 520 ~ projectData ~ rows", rows)
form.staffLists=rows
form.cardAchievementAmount=rows[0].cardAchievementAmount
form.cardCommissionAmount=rows[0].cardCommissionAmount
form.cardSalesAchievement=rows[0].cardSalesAchievement
form.cardSalesCommission=rows[0].cardSalesCommission
this.outList.push(form);
console.log("🚀 ~ file: index.vue ~ line 520 ~ projectData ~ this.outList", this.outList)
this.sumMoney();
}
//
},
//查询会员信息
memberOne() {
let row = { ...this.proForm };
var mobilePhone = this.proForm.mobilePhone;
// this.empty();
if (mobilePhone) {
let form = {
mobilePhone: mobilePhone,
storeId: sessionStorage.getItem("parentId"),
};
storeMemberOne(form).then((res) => {
this.proForm.mobilePhone = mobilePhone;
if (res.code == "000000") {
row.memberId = res.data.id;
row.id = res.data.id;
row.memberName = res.data.memberName;
row.mobilePhone = res.data.mobilePhone;
row.memberIdentityCard = res.data.identityCard;
this.proForm = {};
this.proForm = row;
this.outList = []
this.inList = []
if(this.proForm.payLists.length){
this.proForm.payLists.forEach(item=>{
item.payMoney = 0
})
}
this.inMoneys = 0
this.outMoneys = 0
this.payMoneys = 0
this.debtMoney = 0
this.$refs.staffsles.staffLists= [{ ratio: 100 }]
this.$refs.admin.staffLists= [{ ratio: 100 }]
this.$refs.admin.staffLists = [{ ratio: 100 }]
} else {
this.$alert(res.message, "提示", {
confirmButtonText: "确定",
confirmButtonClass: "confirmbtnFalses",
type: "warning",
center: true,
callback: (action) => { },
});
}
});
} else {
this.$message.warning({ message: "请输入正确手机号" });
}
},
//选择金额.
editPay(row, index) {
// scope.row.payMoney
// console.log(row)
var form = {
...row,
};
// console.log()
var payLists = [...this.proForm.payLists];
payLists[index] = form;
form.isShow = true;
this.proForm.payLists = [];
this.proForm.payLists = payLists;
// console.log(this.proForm.payLists)
this.sumMoney()
// }
},
endEdit(row) {
if (row.payMoney && row.payMoney <= this.debtMoney) {
row.payMoney = row.payMoney * 1;
} else {
if (row.payMoney > this.debtMoney) {
this.$alert("现付金额大于需付金额,已将金额调整适合金额", "提示", {
confirmButtonText: "确定",
confirmButtonClass: "confirmbtnFalses",
type: "warning",
center: true,
callback: (action) => { },
});
}
row.payMoney = this.debtMoney;
}
row.isShow = false;
this.shows = false;
// this.endEditTimes()
this.sumMoney()
},
endEdits() {
this.shows = true,
this.sumMoney()
},
openPro(num) {
this.openProText = num;
if (num == 0) {
this.$refs.project.show(0);
this.TransactionNum = this.inList.transactionMoney;
}
if (num == 1) {
if(this.StoreIds){
this.proForm.storeId=this.StoreIds
}else{
this.proForm.storeId=""
}
this.$refs.project.show(this.proForm);
}
},
delOldPro(index) {
this.outList.splice(index, 1);
this.sumMoney();
},
backout() {
this.inList.splice(0, 1);
this.sumMoney();
},
openEdit(row, index) {
let form = {
...row,
};
if (row.debtMoneyShow) {
form.debtMoney = (this.inMoneys - this.outMoneys).toFixed(2);
if (form.debtMoney < 0) {
form.debtMoney = 0;
}
}
this.inList.splice(index, 1, form);
},
openEditOut(row, index) {
let form = {
...row,
};
this.outList.splice(index, 1, form);
},
endEditPrice(row, index) {
let minMoney = row.minumumPriceMember * row.changeInTime;
let topMoney = row.topPriceMember * row.changeInTime;
let changeInMoney = (row.priceMember * row.changeInTime).toFixed(2) * 1;
if (
minMoney > row.changeInMoney * 1 ||
topMoney < row.changeInMoney * 1
) {
this.$message.warning({
message:
"转入金额不能低于项目最低价: " +
minMoney +
"高于最高价: " +
topMoney,
});
row.changeInMoney = changeInMoney;
row.transactionMoney = row.changeInMoney;
}
row.transactionMoney = row.changeInMoney;
row.changeInMoneyShow = false;
this.sumMoney();
},
endDebtMoney(row, index) {
row.debtMoneyShow = false;
this.sumMoney();
},
endChangeOutTime(row, index, time, price) {
row.changeOutTimeShow = false;
if (this.outList[index].courseConsumeCount < time) {
this.$alert("次数不可以大于可用次数", "提示", {
confirmButtonText: "确定",
confirmButtonClass: "confirmbtnFalses",
type: "warning",
center: true,
callback: (action) => { },
});
this.outList[index].changeOutTime = this.outList[index].courseConsumeCount
this.outList[index].changeOutMoney = this.outList[index].changeOutTime * price
} else if (time < 1) {
this.$alert("次数不可以小于1", "提示", {
confirmButtonText: "确定",
confirmButtonClass: "confirmbtnFalses",
type: "warning",
center: true,
callback: (action) => { },
});
this.outList[index].changeOutTime = 1
this.outList[index].changeOutMoney = this.outList[index].changeOutTime * price
} else {
this.outList[index].changeOutMoney = time * price
}
let num = 0;
this.outList.forEach((item) => {
num = num + item.changeOutMoney
});
this.outMoneys = num;
// if(this.outList.length!=0){
// this.inList[0].changeInMoney=num
// }
},
openOutMoney(row, index) {
let form = { ...row };
this.outMoneyIndex = index;
this.outList.splice(index, 1, form);
},
endOutMoney(row) {
// console.log(row);
let money = row.changeOutTime * row.price;
if (row.changeOutMoney) {
row.changeOutMoney = row.changeOutMoney * 1;
} else {
row.changeOutMoney = 0;
}
// if (row.changeOutMoney > money) {
// this.$alert("转出金额不能大于" + money, "提示", {
// confirmButtonText: "确定",
// confirmButtonClass: "confirmbtnFalses",
// type: "warning",
// center: true,
// callback: (action) => {},
// });
// } else {
// }
this.outMoneyIndex = -1;
this.sumMoney();
},
endEditTimes(row, index) {
// console.log("🚀 ~ file: index.vue ~ line 647 ~ endEditTimes ~ row", row)
if (row.changeInTime < row.minumumTimes) {
this.$message.info({
message: "最低不能少于" + row.minumumTimes + "次",
});
row.changeInTime = row.minumumTimes;
}
row.changeInMoney = (row.prices * row.changeInTime).toFixed(2) * 1;
row.transactionMoney = row.changeInMoney;
this.inNumberIndex = -1;
this.sumMoney();
if (this.outMoneys > row.changeInMoney) {
this.$alert("成交金额不能小于转入金额: ", "提示", {
confirmButtonText: "确定",
confirmButtonClass: "confirmbtnFalses",
type: "warning",
center: true,
callback: (action) => { },
});
this.inList[0].changeInTime = 0
this.inList[0].transactionMoney = 0
this.sumMoney();
}
},
endEditprices(row, index) {
// if (row.changeInTime < row.minumumTimes) {
// this.$message.info({
// message: "最低不能少于" + row.minumumTimes + "次",
// });
// row.changeInTime = row.minumumTimes;
// }
if (row.minumumPriceMember > row.prices) {
this.$alert("单价不可以低于最低单价: ", "提示", {
confirmButtonText: "确定",
confirmButtonClass: "confirmbtnFalses",
type: "warning",
center: true,
callback: (action) => { },
});
row.prices = row.minumumPriceMember
} else if (row.priceMember < row.prices) {
this.$alert("单价不可以高于标准单价: ", "提示", {
confirmButtonText: "确定",
confirmButtonClass: "confirmbtnFalses",
type: "warning",
center: true,
callback: (action) => { },
});
row.prices = row.priceMember
}
row.changeInMoney = (row.prices * row.changeInTime).toFixed(2) * 1;
row.transactionMoney = row.changeInMoney;
this.inNumberIndexs = -1;
this.sumMoney();
if (this.outMoneys > row.changeInMoney) {
this.$alert("成交金额不能小于转入金额,请修改单价或者转入次数: ", "提示", {
confirmButtonText: "确定",
confirmButtonClass: "confirmbtnFalses",
type: "warning",
center: true,
callback: (action) => { },
});
this.sumMoney();
}
},
projectRadio(row) {
if (row) {
this.proRadio = row.id;
this.proRadioForm = row;
}
},
sumMoney() {
// debtMoney
// scope.row.payMoney
console.log('this.inList',this.inList,'this.outList',this.outList,'this.proForm.payLists',this.proForm.payLists)
let inMoneys = 0;
let outMoneys = 0;
let payMoneys = 0;
let debtMoney = 0;
// 转入疗程数组
this.inList.forEach((item) => {
inMoneys += item.transactionMoney * 1;
debtMoney = item.debtMoney * 1;
});
// 转出疗程数组
this.outList.forEach((item) => {
outMoneys += item.changeOutMoney * 1;
});
// 现金支付
this.proForm.payLists.forEach((item) => {
item.payMoney = item.payMoney?item.payMoney*1:0
payMoneys += item.payMoney * 1;
});
this.outMoneys = outMoneys.toFixed(2) * 1;
this.inMoneys = inMoneys.toFixed(2) * 1;
this.payMoneys = payMoneys.toFixed(2) * 1;
if (inMoneys != 0) {
this.debtMoney =
(inMoneys - outMoneys - payMoneys - debtMoney).toFixed(2) * 1;
} else {
this.debtMoney = inMoneys;
}
},
empty() {
this.proForm = JSON.parse(JSON.stringify({}));
this.outList = [];
this.inList = [];
this.$forceUpdate();
Object.assign(this.$data, this.$options.data.call(this));
this.setPage();
},
raiseProList() {
this.$emit("proData");
},
//------------------------------------------------------分页方法
handleSizeChange(val) {
this.proPageInfo.pageSize = val;
},
handleCurrentChange(val) {
this.proPageInfo.pageNum = val;
},
//------------------------------------------------------ 门店项目 搜索 page
//搜索方法
search() {
var page = {
pageSize: this.proPageInfo.pageSize,
pageNum: this.proPageInfo.pageNum,
projectName: this.input,
state: 1,
directConsumption: 0,
storeIds: JSON.parse(sessionStorage.getItem("storeIdLists")),
isCooperation: 0,
};
propage(page).then((res) => {
if (res.code == "000000") {
this.proPageInfo = res.pageInfo;
} else {
this.$alert(res.message, "提示", {
confirmButtonText: "确定",
confirmButtonClass: "confirmbtnFalses",
type: "warning",
center: true,
callback: (action) => { },
});
}
});
},
propage() {
var page = {
pageNum: this.proPageInfo.pageNum,
pageSize: this.proPageInfo.pageSize,
state: 1,
directConsumption: 0,
storeIds: JSON.parse(sessionStorage.getItem("storeIdLists")),
};
propage(page).then((res) => {
if (res.code == "000000") {
this.proPageInfo = res.pageInfo;
} else {
this.$alert(res.message, "提示", {
confirmButtonText: "确定",
confirmButtonClass: "confirmbtnFalses",
type: "warning",
center: true,
callback: (action) => { },
});
}
});
},
ctlist() {
ctlist({
id: null,
}).then((res) => {
if (res.code == "000000") {
var payLists = [];
res.rows.forEach((item) => {
item.payMoney = 0;
item.isShow = false;
item.payName = item.collectionTypeName;
item.payId = item.id;
payLists.push(item);
});
this.proForm.payLists = payLists;
} else {
this.$alert("加载现付列表: " + res.message, "提示", {
confirmButtonText: "确定",
confirmButtonClass: "confirmbtnFalses",
type: "warning",
center: true,
callback: (action) => { },
});
}
});
},
selectList() {
selectList({
id: null,
}).then((res) => {
if (res.code == "000000") {
this.staffList = res.rows;
} else {
this.$alert("加载员工列表: " + res.message, "提示", {
confirmButtonText: "确定",
confirmButtonClass: "confirmbtnFalses",
type: "warning",
center: true,
callback: (action) => { },
});
}
});
},
setPage() {
this.selectList();
this.ctlist();
this.setStaffRatio();
this.sessionStorageData = JSON.parse(
sessionStorage.getItem("sessionStorageData")
);
this.proForm.additionDate = this.formatTime(new Date(), "YYYY-MM-DD");
},
},
created() {
this.setPage();
},
};
</script>
<style>
.raisetable {
border: 1px solid #ccc;
border-radius: 15px;
padding: 10px;
min-width: 500px;
}
.inputdiv {
cursor: pointer;
line-height: 35px;
}
.inputinput {
line-height: 35px;
margin: 0 auto;
width: 60%;
text-align: center;
}
.raisetable-sum {
width: 100%;
display: flex;
justify-content: space-between;
}
</style>