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.

583 lines
21 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" 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>
<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 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-button size="mini" v-if="proForm.memberName" type="warning" :disabled="inList.length==0" @click='backout'>撤销</el-button>
</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>
</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>
<recType ref="recType" @recTypeData="recTypeData"></recType>
</div>
</template>
<script>
import { propage } from "@/api/storeManage.js";
import {
storeMemberOne,
addRechargeTurnCourse,
recAccountOne,
} from "@/api/eashier.js";
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
},
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,
StoreIds:"",
label:""
};
},
methods: {
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.coursePayLists = this.outList;
this.proForm.staffLists;
this.proForm = Object.assign(this.proForm, this.inList[0]);
this.inList[0];
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) {
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.courseAfterUsableMoney = form.courseConsumePrice;
form.courseBeforeUsableMoney = form.courseConsumePrice;
form.memberIdentityCard = this.proForm.identityCard;
form.unitMoney =
(form.courseProjectMoney / form.courseCount).toFixed(2) * 1;
form.rollOffCount = form.courseConsumeCount;
form.rollOffMoney = 0;
form.rollOffCountShow = false;
form.accountId = form.id;
let flag = true;
this.outList.forEach((item) => {
if (form.id == item.form.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) {
console.log("🚀 ~ file: index.vue ~ line 347 ~ memberOne ~ this.StoreIds", this.StoreIds)
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");
},
},
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>