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.

929 lines
29 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"
@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"
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"
:picker-options="pickerOptions"
v-show="recDateShow"
ref="recDate"
v-model="proForm.additionDate"
format="yyyy-MM-dd"
value-format="yyyy-MM-dd"
placeholder="选择日期"
>
</el-date-picker>
</div>
</el-form-item>
<!-- <el-form-item label="转入门店:" :label-width="labelWidth">
<div class="form-width-ms">
<el-select ref="select" filterable default-first-option v-model="storeId" placeholder="请选择门店">
<el-option v-for="(item,index) in options" :key="index" :label="item.label" :value="item.id">
</el-option>
</el-select>
</div>
</el-form-item> -->
<div class="raisetable bg-white margin-left-lg 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 style="width: 150px;">总金额 : {{ outMoneys }}</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="项目编码" show-overflow-tooltip align="center" prop="courseProjectNum" min-width="80"></el-table-column>
<el-table-column label="账户名称" show-overflow-tooltip align="center" prop="courseProjectName" min-width="120"></el-table-column>
<el-table-column label="可用次数" align="center" prop="courseConsumeCount" min-width="70"></el-table-column>
<el-table-column label="疗程单价" align="center" prop="price" min-width="70"></el-table-column>
<el-table-column label="转前次数" align="center" prop="courseBeforeUsableCount" min-width="70"></el-table-column>
<el-table-column label="转出次数" align="center" prop="rollOffCount" min-width="90">
<template slot-scope='scope'>
<div class="form-input-width" v-if="!scope.row.rollOffCountShow" @click="openEditOut(scope.row,scope.$index,scope.row.rollOffCountShow=true)">
{{scope.row.rollOffCount}}
<i class="el-icon-edit text-cyan"></i>
</div>
</template>
</el-table-column>
<el-table-column
label="项目编码"
show-overflow-tooltip
align="center"
prop="courseProjectNum"
min-width="80"
></el-table-column>
<el-table-column
label="账户名称"
show-overflow-tooltip
align="center"
prop="courseProjectName"
min-width="120"
></el-table-column>
<el-table-column
label="可用次数"
align="center"
prop="courseConsumeCount"
min-width="70"
></el-table-column>
<el-table-column
label="疗程单价"
align="center"
prop="price"
min-width="70"
></el-table-column>
<el-table-column
label="转前次数"
align="center"
prop="courseBeforeUsableCount"
min-width="70"
></el-table-column>
<el-table-column
label="转出次数"
align="center"
prop="rollOffCount"
min-width="90"
>
<template slot-scope="scope">
<div
class="form-input-width"
v-if="!scope.row.rollOffCountShow"
@click="
openEditOut(
scope.row,
scope.$index,
(scope.row.rollOffCountShow = true)
)
"
>
{{ scope.row.rollOffCount }}
<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.rollOffCount"
@blur="endrollOffCount(scope.row, scope.$index)"
></el-input>
</template>
</el-table-column>
<el-table-column
label="转后次数"
align="center"
prop="courseAfterUsableCount"
min-width="70"
></el-table-column>
<el-table-column
label="转前金额"
align="center"
prop="courseBeforeUsableMoney"
min-width="70"
></el-table-column>
<el-table-column
label="转出金额"
align="center"
prop="rollOffMoney"
min-width="90"
>
<template slot-scope="scope">
<div
class="form-input-width"
v-if="outMoneyIndex != scope.$index"
@click="
openEditOut(
scope.row,
scope.$index,
(outMoneyIndex = scope.$index)
)
"
>
{{ scope.row.rollOffMoney }}
<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.rollOffMoney"
@blur="endOutMoney(scope.row)"
></el-input>
</template>
</el-table-column>
<el-table-column
label="转后金额"
align="center"
prop="courseAfterUsableMoney"
min-width="70"
></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 margin-left-lg">
<div class="raisetable-sum">
<div>
转入充值
<el-button
v-if="proForm.memberName"
size="mini"
type="primary"
:disabled="inList.length == 1"
@click="openPro(0)"
>添加</el-button
>
<el-select v-if="proForm.memberName" ref="select" filterable default-first-option v-model="storeId" placeholder="请选择门店">
<el-option v-for="(item,index) in options" :key="index" :label="item.label" :value="item.id">
</el-option>
</el-select>
</div>
<div style="width: 150px;">总金额 : {{ inMoneys }}</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="rechargeTypeNum"
min-width="100"
></el-table-column>
<el-table-column
label="充值名称"
show-overflow-tooltip
align="center"
prop="rechargeTypeName"
min-width="110"
></el-table-column>
<el-table-column
label="充值金额"
align="center"
prop="rechargeMoney"
min-width="70"
></el-table-column>
<el-table-column
label="折扣(%)"
align="center"
prop="discount"
min-width="70"
></el-table-column>
<el-table-column
label="转前金额"
align="center"
prop="rechargeBeforeMoney"
min-width="70"
></el-table-column>
<el-table-column
label="转入金额"
align="center"
prop="rechargeInMoney"
min-width="90"
>
<template slot-scope="scope">
<div
class="form-input-width"
v-if="!scope.row.rechargeInMoneyShow"
@click="
openEdit(
scope.row,
scope.$index,
(scope.row.rechargeInMoneyShow = true)
)
"
>
{{ scope.row.rechargeInMoney }}
<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.rechargeInMoney"
@blur="endEditPrice(scope.row, scope.$index)"
></el-input>
</template>
</el-table-column>
<el-table-column
label="转后金额"
align="center"
prop="rechargeAfterMoney"
min-width="70"
></el-table-column>
<el-table-column align="center" fixed="right" min-width="80">
<template slot-scope="scope">
<div
@click="backout"
class="el-icon-delete"
></div>
</template>
</el-table-column>
</el-table>
</div>
<div class="flex justify-center align-start flex-wrap padding-top">
<staffsles ref="staffsles" @staffslesData="staffslesData"></staffsles>
<!-- <admin class="border padding-bottom-xs margin-right-xs" ref="admin" @adminData="adminData"></admin>
<manager class="border padding-bottom-xs " ref="manager" @managerData="managerData"></manager> -->
</div>
<div class="flex justify-center padding-top ">
<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
>列表</el-button
>
<el-button
size="mini"
type="primary"
@click="submit(true, (loading = true))"
:loading="loading"
:disabled="outList.length == 0 && inList.length == 0"
>提交</el-button
>
</div>
</el-form>
<member ref="member" @memberData="memberData"></member>
<Branch ref="Branch" @BranchData="BranchData"></Branch>
<project ref="project" @projectData="projectData"></project>
<staffratio ref="staffratio" @staffratioData="staffratioData"></staffratio>
<recType ref="recType" @recTypeData="recTypeData"></recType>
<staffratio ref="staffratio" @staffratioData="staffratioData"></staffratio>
</div>
</template>
<script>
import { propage ,organizations} from "@/api/storeManage.js";
import {
storeMemberOne,
addRechargeTurnCourse,
recAccountOne
} 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 recType from "@/components/recharge/type/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,
recType,
Branch,
staffratio
},
data() {
return {
pickerOptions: {
disabledDate(time) {
return time.getTime() > Date.now();
}
},
projectDialogVisible: false,
recDateShow: false,
activeName: "现付",
outMoneyIndex: -1,
proForm: {
additionDate: null,
manageStaffName: null,
mobilePhone: null,
Branch: null,
staffLists: [{ ratio: 100 }],
payLists: []
},
outList: [],
inList: [],
labelWidth: "100px",
proPageInfo: {
total: 0,
pageNum: 1,
pageSize: 10,
list: []
},
proRadio: null,
proRadioForm: null,
projectName: null,
couAccountList: [],
inMoneys: 0,
outMoneys: 0,
sessionStorageList: null,
isAddition: 0,
loading: false,
TransactionNum: 0,
StoreIds:"",
label:"",
staff:[],
storeId:sessionStorage.getItem("parentId"),
options:[]
};
},
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) {
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
this.outList.splice(this.editIndex, 1, form);
},
setStaffRatio() {
var that = this;
setTimeout(() => {
if (this.StoreIds) {
that.$refs.staffsles.show(that.proForm.staffLists, that.StoreIds);
} else {
that.$refs.staffsles.show(that.proForm.staffLists);
}
console.log(
"🚀 ~ file: index.vue ~ line 189 ~ setTimeout ~ that.proForm.staffLists",
that.proForm.staffLists
);
}, 800);
},
staffslesData(v) {
this.proForm.staffLists = [...v];
},
openMember() {
this.$refs.member.show();
},
openBranch() {
this.$refs.Branch.show();
},
memberData(v) {
this.proForm.mobilePhone = v.mobilePhone;
this.memberOne();
},
BranchData(v) {
this.StoreIds = v.id;
this.label = v.label;
this.setStaffRatio();
console.log("🚀 ~ file: index.vue ~ line 217 ~ BranchData ~ ", "aaaa");
},
submit() {
this.proForm.rechargeInMoney = this.inMoneys;
this.proForm.courseOutMoney = this.outMoneys;
this.proForm.isAddition = this.isAddition;
this.proForm.coursePayListRequests = this.outList;
this.proForm.staffLists;
this.proForm = Object.assign(this.proForm, this.inList[0]);
this.proForm.storeId = this.storeId
this.proForm.storeName = this.options.filter(item=>item.id == this.storeId)[0].storeName
if (this.isAddition == 1) {
if (this.proForm.additionDate) {
this.addRechargeTurnCourse();
} else {
this.$alert("请选择补单业务时间", "提示", {
confirmButtonText: "确定",
confirmButtonClass: "confirmbtnFalses",
type: "warning",
center: true,
callback: action => {}
});
this.loading = false;
}
} else {
this.addRechargeTurnCourse();
}
},
addRechargeTurnCourse() {
var that = this;
addRechargeTurnCourse(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 => {}
});
}
});
},
tableRowClassName({ row, rowIndex }) {
row.index = rowIndex;
},
projectData(form,rows) {
console.log(rows)
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.courseAfterUsableCount = form.courseConsumeCount;
form.courseBeforeUsableCount = form.courseConsumeCount;
form.courseBeforeUsableMoney = form.courseConsumePrice;
form.memberIdentityCard = this.proForm.identityCard;
form.unitMoney =(form.courseProjectMoney / form.courseCount).toFixed(2) * 1;
form.rollOffCount = form.courseConsumeCount; //转出次数
form.rollOffMoney = (form.price*form.rollOffCount).toFixed(2)*1;
form.courseAfterUsableMoney = (form.courseConsumePrice - form.rollOffMoney).toFixed(2)*1;
form.rollOffCountShow = false;
form.accountId = form.id;
form.staffLists=rows
form.cardAchievementAmount=rows[0].cardAchievementAmount
form.cardCommissionAmount=rows[0].cardCommissionAmount
form.cardSalesAchievement=rows[0].cardSalesAchievement
form.cardSalesCommission=rows[0].cardSalesCommission
let flag = true;
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.forEach(item => {
if (form.id == item.id) {
flag = false;
}
});
if (flag) {
this.outList.push(form);
this.sumMoney();
} else {
this.$message({ message: "项目已存在 !" });
}
},
recTypeData(v) {
let form = {
storeId: this.proForm.storeId,
memberId: this.proForm.memberId,
rechargeTypeId: v.id
};
v.rechargeTypeId = v.id;
recAccountOne(form).then(res => {
if (res.data != undefined && res.data.state == 0) {
this.$message.error({
message: "账户已锁定, 不允许使用 ! "
});
} else {
if (res.code == "000000" || res.code == "200004") {
v.rechargeInMoneyShow = false;
if (res.code == "200004") {
v.rechargeAfterMoney = 0;
v.rechargeAccountId = null;
v.rechargeInMoney = this.inMoneys;
v.rechargeBeforeMoney = this.inMoneys;
} else {
v.rechargeAfterMoney = res.data.cardConsumeMoney;
v.rechargeAccountId = res.data.id;
v.rechargeInMoney = this.inMoneys;
v.rechargeBeforeMoney =
(res.data.cardConsumeMoney + this.inMoneys).toFixed(2) * 1;
}
this.inList.push(v);
this.sumMoney();
} else {
this.$alert(res.message, "提示", {
confirmButtonText: "确定",
confirmButtonClass: "confirmbtnFalses",
type: "warning",
center: true,
callback: action => {}
});
}
}
});
},
memberOne() {
this.inList = [];
this.outList = [];
this.outMoneys = 0;
this.inMoneys = 0;
var mobilePhone = this.proForm.mobilePhone;
// this.empty();
let row = { ...this.proForm };
let form = {
mobilePhone: mobilePhone,
storeId: sessionStorage.getItem("parentId")
};
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.storeId = res.data.storeId;
row.storeName = res.data.storeName;
row.memberIdentityCard = res.data.identityCard;
this.proForm = JSON.parse(JSON.stringify({}));
this.proForm = row;
} else {
this.$alert(res.message, "提示", {
confirmButtonText: "确定",
confirmButtonClass: "confirmbtnFalses",
type: "warning",
center: true,
callback: action => {}
});
}
});
} else {
this.$message.warning({ message: "请输入正确手机号" });
}
},
endEdit(row) {
row.isShow = false;
},
openPro(num) {
if (num == 0) {
this.$refs.recType.show();
}
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
};
this.inList.splice(index, 1, form);
},
openEditOut(row, index) {
let form = {
...row
};
this.outList.splice(index, 1, form);
},
endEditPrice(row, index) {
row.rechargeInMoneyShow = false;
this.sumMoney();
},
endrollOffCount(row, index) {
if (row.courseConsumeCount < row.rollOffCount) {
this.$alert("转出次数不能大于" + row.courseConsumeCount, "提示", {
confirmButtonText: "确定",
confirmButtonClass: "confirmbtnFalses",
type: "warning",
center: true,
callback: action => {}
});
row.rollOffCount = row.courseConsumeCount;
} else {
// row.rollOffMoney =
// (row.rollOffCount * 1 * row.unitMoney).toFixed(2) * 1;
row.rollOffCountShow = false;
this.sumMoney();
}
},
endOutMoney(row) {
let money = row.rollOffCount * row.price;
if (row.rollOffMoney) {
row.rollOffMoney = row.rollOffMoney * 1;
} else {
row.rollOffMoney = 0;
}
if (row.rollOffMoney > money) {
this.$alert("转出金额不能大于" + money, "提示", {
confirmButtonText: "确定",
confirmButtonClass: "confirmbtnFalses",
type: "warning",
center: true,
callback: action => {}
});
row.rollOffMoney = money;
} else {
this.outMoneyIndex = -1;
this.sumMoney();
}
},
sumMoney() {
let inMoneys = 0;
let outMoneys = 0;
this.inList.forEach(item => {
item.rechargeInMoney = this.outMoneys;
inMoneys += item.rechargeInMoney * 1;
item.rechargeAfterMoney =
(item.rechargeBeforeMoney + item.rechargeInMoney).toFixed(2) * 1;
});
this.outList.forEach(item => {
item.courseAfterUsableCount =
(item.courseBeforeUsableCount - item.rollOffCount).toFixed(0) * 1;
item.courseAfterUsableMoney =
(item.courseBeforeUsableMoney - item.rollOffMoney).toFixed(2) * 1;
outMoneys += item.rollOffMoney * 1;
});
this.outMoneys = outMoneys.toFixed(2) * 1;
this.inMoneys = inMoneys.toFixed(2) * 1;
},
empty() {
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 => {}
});
}
});
},
setPage() {
this.setStaffRatio();
this.sessionStorageList = JSON.parse(
sessionStorage.getItem("sessionStorageData")
);
this.proForm.additionDate = this.formatTime(new Date(), "YYYY-MM-DD");
},
async getData() {
organizations({ pageSize: 999 }).then((res) => {
if (res.code == "000000") {
res.rows.forEach((item) => {
item.label = item.storeNum + "-" + item.storeName;
});
this.options=res.rows;
} else {
this.$alert(res.message, "提示", {
confirmButtonText: "确定",
confirmButtonClass: "confirmbtnFalses",
type: "warning",
center: true,
callback: (action) => {},
});
}
});
},
},
created() {
this.setPage();
this.getData()
}
};
</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>