| | |
| | | >重置套餐</el-button |
| | | > |
| | | <el-button |
| | | type="primary" |
| | | @click="submitPrice" |
| | | :disabled="confirm" |
| | | v-if="showHidden.has_charge == 'N'" |
| | | size="mini" |
| | | >签到登记</el-button |
| | | > |
| | | type="primary" |
| | | @click="submitPrice" |
| | | :loading="loadingSubmit" |
| | | :disabled="confirm || loadingSubmit" |
| | | v-if="showHidden.has_charge == 'N'" |
| | | size="mini" |
| | | >签到登记</el-button> |
| | | |
| | | <el-button |
| | | type="primary" |
| | | @click="submitCheckinfee" |
| | |
| | | ], |
| | | isNow: 1, |
| | | marryall: 0, |
| | | loadingSubmit: false, |
| | | treeId: [], |
| | | treeList: [], |
| | | defaultKeys: [], |
| | |
| | | // 最新使用webSocket通信 |
| | | readCardWebSocket(resultObj) { |
| | | let _this = this; |
| | | |
| | | if (resultObj.code === 200 && resultObj.data.name != null) { |
| | | //回显相关数据 |
| | | _this.form.cusName = resultObj.data.name; |
| | |
| | | /^(\d{4})(\d{2})(\d{2})$/, |
| | | "$1-$2-$3" |
| | | ); |
| | | } else if (_this.form.cusIdcard) { |
| | | // 从身份证号码提取出生日期 |
| | | var org_birthday = _this.form.cusIdcard.substring(6, 14); |
| | | _this.form.cusBrithday = |
| | | org_birthday.substring(0, 4) + |
| | | "-" + |
| | | org_birthday.substring(4, 6) + |
| | | "-" + |
| | | org_birthday.substring(6, 8); |
| | | } |
| | | // 如果出生日期存在,计算年龄 |
| | | if (_this.form.cusBrithday) { |
| | | var birthdays = new Date(_this.form.cusBrithday); |
| | | let d = new Date(); |
| | | let age = |
| | | d.getFullYear() - |
| | | birthdays.getFullYear() - |
| | | (d.getMonth() < birthdays.getMonth() || |
| | | (d.getMonth() == birthdays.getMonth() && |
| | | d.getDate() < birthdays.getDate()) |
| | | ? 1 |
| | | : 0); |
| | | _this.form.age = age; // 赋值计算的年龄 |
| | | } |
| | | _this.form.cusAddr = resultObj.data.addres; |
| | | _this.form.cusIdcard = resultObj.data.card; |
| | |
| | | }); |
| | | this.$tab.refreshPage(); |
| | | }, |
| | | |
| | | // 最后提交按钮 |
| | | submitPrice() { |
| | | let _this = this; |
| | | if (_this.tjCategory !== "") { |
| | | let List = _this.tableData1; //单个项目信息 |
| | | if (this.responseList.cusId) { |
| | | var userId = this.responseList.cusId; |
| | | let _this = this; |
| | | |
| | | if (_this.tjCategory !== "") { |
| | | this.loadingSubmit = true; // Start loading |
| | | |
| | | // Your existing code here... |
| | | |
| | | gaibianzhekou(newArray).then((res) => { |
| | | if (res.code === 200) { |
| | | let data; |
| | | |
| | | if (pacId || this.tjOrderList.length > 0) { |
| | | data = { |
| | | photo: this.srcUrl, |
| | | pacId, |
| | | tjOrderList: this.tjOrderList, |
| | | tjFlowingWater: this.tjFlowingWater, |
| | | userId, |
| | | tjType, |
| | | tjCategory: this.tjCategory, |
| | | firmId: this.form.firmId, |
| | | firmName: this.form.firmName, |
| | | firmDeptName: this.form.firmDeptName, |
| | | }; |
| | | |
| | | this.listgetOrder(data).finally(() => { |
| | | this.loadingSubmit = false; // End loading |
| | | }); |
| | | } else { |
| | | var userId = _this.form.cusId; |
| | | // Handle case where pacId or tjOrderList is not available |
| | | this.loadingSubmit = false; // End loading |
| | | this.$message({ |
| | | type: "warning", |
| | | message: "请选择套餐!", |
| | | }); |
| | | } |
| | | let tjType = _this.form.tjType; |
| | | if (this.tableData[0]) { |
| | | var pacId = this.tableData[0].pacId; |
| | | } |
| | | |
| | | //tjOrderList//这个是处理完的每一项套餐信息 |
| | | List.forEach((item) => { |
| | | if (item.list) { |
| | | item.list.forEach((item1) => { |
| | | this.tjOrderList.push({ |
| | | proName: item1.proName, |
| | | proPrice: item1.nowPrice, |
| | | proId: item1.proId, |
| | | }); |
| | | }); |
| | | } else if (item.tjProjectList) { |
| | | item.tjProjectList.forEach((item1) => { |
| | | this.tjOrderList.push({ |
| | | proName: item1.proName, |
| | | proPrice: item1.priceNow, |
| | | proId: item1.proId, |
| | | }); |
| | | }); |
| | | } else { |
| | | this.tjOrderList.push({ |
| | | proName: item.proName, |
| | | proPrice: item.ysPrice, |
| | | proId: item.proId, |
| | | }); |
| | | } |
| | | }); |
| | | let copeWith = this.TotalPrice1; |
| | | let paidIn = this.TotalPrice.toString(); |
| | | let discount = this.discount; |
| | | this.tjFlowingWater = { copeWith, paidIn, discount }; |
| | | const newArray = this.tableData1 |
| | | .filter((item) => item.discount < 10) // 过滤出 discount < 10 的项 |
| | | .map((item) => ({ |
| | | discount: item.discount, |
| | | parentProId: item.parentProId, |
| | | cusIdCard: item.cusId, |
| | | })); // 创建新的对象,包含 discount 和 id |
| | | gaibianzhekou(newArray).then((res) => { |
| | | if (res.code === 200) { |
| | | let data; |
| | | |
| | | if (pacId || this.tjOrderList.length > 0) { |
| | | data = { |
| | | photo: this.srcUrl, |
| | | pacId, |
| | | tjOrderList: this.tjOrderList, |
| | | tjFlowingWater: this.tjFlowingWater, |
| | | userId, |
| | | tjType, |
| | | tjCategory: this.tjCategory, |
| | | firmId: this.form.firmId, |
| | | firmName: this.form.firmName, |
| | | firmDeptName: this.form.firmDeptName, |
| | | }; |
| | | |
| | | this.listgetOrder(data); |
| | | } else if (pacId || this.tjOrderList.length > 0) { |
| | | data = { |
| | | photo: this.srcUrl, |
| | | tjOrderList: this.tjOrderList, |
| | | tjFlowingWater: this.tjFlowingWater, |
| | | userId, |
| | | tjType, |
| | | tjCategory: this.tjCategory, |
| | | firmId: this.form.firmId, |
| | | firmName: this.form.firmName, |
| | | firmDeptName: this.form.firmDeptName, |
| | | }; |
| | | this.listgetOrder(data); |
| | | } else { |
| | | this.$message({ |
| | | type: "warning ", |
| | | message: "请选择套餐!", |
| | | }); |
| | | } |
| | | } else { |
| | | this.$modal.msgError("改变折扣错误"); |
| | | } |
| | | }); |
| | | } else { |
| | | this.$modal.msgError("请选择体检类别"); |
| | | this.loadingSubmit = false; // End loading on error |
| | | this.$modal.msgError("改变折扣错误"); |
| | | } |
| | | }, |
| | | }).catch(() => { |
| | | this.loadingSubmit = false; // Ensure loading stops even on error |
| | | }); |
| | | } else { |
| | | this.loadingSubmit = false; // End loading if tjCategory is empty |
| | | this.$modal.msgError("请选择体检类别"); |
| | | } |
| | | }, |
| | | }, |
| | | }; |
| | | </script> |