diff --git a/src/components/customerOrg/customerOrgEdit.vue b/src/components/customerOrg/customerOrgEdit.vue index 9ebd95e..5c70e86 100644 --- a/src/components/customerOrg/customerOrgEdit.vue +++ b/src/components/customerOrg/customerOrgEdit.vue @@ -19,12 +19,30 @@ :disabled="customerOrg.oprStatus ? false : true" /> - + + + + + + + + + + + + + @@ -45,7 +63,14 @@ - + + + + + + + + + + - - @@ -75,24 +101,6 @@ - - - - - - - - - - - - @@ -210,7 +218,7 @@ export default { routeUrlorPageName: 'customerOrg', //当前页面归属路由或归属页面权限名称 privs: [] // 页面权限 }, - isActiveBox: false, + customerOrgEditStyle: "height:400px;", data: { organizationdata: [], //体检中心数据 @@ -235,15 +243,13 @@ export default { remark: "", isLock: "N", isActive: "Y", - isLockBox: false, - isActiveBox: true, medicalCenterId: null, creatorName: "", creationTime: null, lastModifierName: "", lastModificationTime: null, - salesPerson:"", - salesPersonPhone:"" + salesPerson: "", + salesPersonPhone: "" }, //初始化 单位 记录 目前新增与更新是一致 formInit: {}, rules: { @@ -282,19 +288,19 @@ export default { }, computed: { - ...mapState(["customerOrg", "window", "dataTransOpts"]), + ...mapState(["customerOrg", "dict", "window", "dataTransOpts"]), }, methods: { ...mapMutations(["setData"]), checkPagePriv, - changeBox(type) { - //赋值 - if (this.form[type + "Box"]) { - this.form[type] = "Y"; - } else { - this.form[type] = "N"; - } - }, + // changeBox(type) { + // //赋值 + // if (this.form[type + "Box"]) { + // this.form[type] = "Y"; + // } else { + // this.form[type] = "N"; + // } + // }, //获取单位信息 getCustomerOrgRd(id) { @@ -307,16 +313,16 @@ export default { this.dataTransOpts.tableS.customer_org.id = res.data.id objCopy(res.data, this.form); - if (res.data.isActive == "Y") { - this.form.isActiveBox = true; - } else { - this.form.isActiveBox = false; - } - if (res.data.isLock == "Y") { - this.form.isLockBox = true; - } else { - this.form.isLockBox = false; - } + // if (res.data.isActive == "Y") { + // this.form.isActiveBox = true; + // } else { + // this.form.isActiveBox = false; + // } + // if (res.data.isLock == "Y") { + // this.form.isLockBox = true; + // } else { + // this.form.isLockBox = false; + // } } }); }, @@ -332,6 +338,14 @@ export default { getapi("/api/app/customer-org-type/get-all").then((res) => { this.data.customerOrgType = res.data; }); + + //体检类别 + getapi("/api/app/medical-type/in-filter").then((res) => { + if (res.code > -1) { + this.dict.medicalType = res.data; + } + }); + }, //更新获取单位树节点数据(局部刷新) @@ -347,7 +361,7 @@ export default { let node = { id: body.id, displayName: body.displayName, - label:(body.customerOrgCode ? body.customerOrgCode + ' ':'') + body.displayName, + label: (body.customerOrgCode ? body.customerOrgCode + ' ' : '') + body.displayName, parentId: body.parentId, }; @@ -383,7 +397,7 @@ export default { body.id ); node2.displayName = body.displayName; - node2.label = (body.customerOrgCode ? body.customerOrgCode + ' ':'') + body.displayName + node2.label = (body.customerOrgCode ? body.customerOrgCode + ' ' : '') + body.displayName break; case "delete": @@ -410,10 +424,10 @@ export default { pids[pids.length - 1] ); //console.log('node3',node3) - if(node3){ + if (node3) { lfind = arrayExistObj(node3.treeChildren, "id", body); if (lfind > -1) node3.treeChildren.splice(lfind, 1); - } + } } break; default: @@ -461,7 +475,7 @@ export default { //id为空则新增 postapi(`/api/app/customerorg/create`, body).then(async (res) => { if (res.code == 1) { - this.$message.success({showClose:true,message:'操作成功!'}) + this.$message.success({ showClose: true, message: '操作成功!' }) //console.log("创健 操作成功"); //this.setData({ key: "customerOrg.customerOrgRd", value: res }); this.form = res.data @@ -481,7 +495,7 @@ export default { putapi(`/api/app/customer-org/${this.form.id}`, body).then( (res) => { if (res.code == 1) { - this.$message.success({showClose:true,message:'操作成功!'}) + this.$message.success({ showClose: true, message: '操作成功!' }) let lbody = { ...deepCopy(body), id: this.form.id }; this.getCustomerOrgTree("update", lbody); this.customerOrg.oprStatus = 'edit' @@ -495,7 +509,7 @@ export default { } }); }, - + // 获取顶级单位ID async getParentCustomerOrgId(customerOrgId) { let customerOrgParentId = null @@ -517,16 +531,16 @@ export default { async btnAdd(formName, child) { switch (child) { case 'newCopy': - if(!this.form.id) return + if (!this.form.id) return //let copyForm = deepCopy(this.form) //this.from = deepCopy(copyForm) this.form.displayName = '' this.form.shortName = '' this.form.id = '' - this.$message.warning({showClose:true,message:'复制新增,请记得要点击【保存】!'}) - break; + this.$message.warning({ showClose: true, message: '复制新增,请记得要点击【保存】!' }) + break; default: - let formPre = deepCopy(this.form) + let formPre = deepCopy(this.form) await this.$refs[formName].resetFields(); //console.log('this.peisid',this.peisid) if (!this.peisid || this.peisid == 'null') { diff --git a/src/utlis/proFunc.js b/src/utlis/proFunc.js index e6bdc0b..55c0d91 100644 --- a/src/utlis/proFunc.js +++ b/src/utlis/proFunc.js @@ -4,7 +4,7 @@ function tcdate(date) { for (var i = 0; i < date.length; i++) { if (date[i].treeChildren && Array.isArray(date[i].treeChildren) && date[i].treeChildren.length > 0) { tcdate(date[i].treeChildren); - }else{ + } else { delete date[i].treeChildren } } @@ -12,17 +12,17 @@ function tcdate(date) { exports.tcdate = tcdate; // 单位树节点,重新组装 -function reMadeOrgTree(treeData,dispCustomerOrgCode){ +function reMadeOrgTree(treeData, dispCustomerOrgCode) { treeData.forEach(e => { - if(dispCustomerOrgCode == 'Y'){ - e.label = (e.customerOrgCode ? e.customerOrgCode + '--':'') + e.displayName - }else{ + if (dispCustomerOrgCode == 'Y') { + e.label = (e.customerOrgCode ? e.customerOrgCode + '--' : '') + e.displayName + } else { e.label = e.displayName - } + } if (e.treeChildren && Array.isArray(e.treeChildren) && e.treeChildren.length > 0) { - e.treeChildren = reMadeOrgTree(e.treeChildren,dispCustomerOrgCode) + e.treeChildren = reMadeOrgTree(e.treeChildren, dispCustomerOrgCode) //e.isLeaf = false - }else{ + } else { delete e.treeChildren //e.isLeaf = true } @@ -52,7 +52,7 @@ function deepCopy(obj) { let copy = null; try { // 日期数据直接返回 - if(obj instanceof Date) return obj + if (obj instanceof Date) return obj if (Array.isArray(obj)) { copy = []; @@ -66,8 +66,8 @@ function deepCopy(obj) { } } } catch (error) { - console.log('deepCopy',error) - } + console.log('deepCopy', error) + } return copy; }; exports.deepCopy = deepCopy; @@ -179,6 +179,33 @@ function arrayExistObj(arr, key, value) { }; exports.arrayExistObj = arrayExistObj; +//判断数组中 是否存在 某个值的对象记录 如不存在返回 - 1,存在返回相应的 序列 +function arrayExistObjPos(arr, key, value, pos) { + let ret = - 1 + for (let i = pos; i < arr.length; i++) { + if (arr[i][key] == value) { + ret = i + break + } + } + return ret +}; +exports.arrayExistObjPos = arrayExistObjPos; + +//判断数组中 是否存在 某个值的对象记录 如不存在返回 - 1,存在返回相应的 序列 +function arrayExistObjByKeys(arr, keys, values) { + let ret = - 1 + for (let i = 0; i < arr.length; i++) { + ret = i + keys.forEach((key, index) => { + if (arr[i][key] !== values[index]) ret = -1 + }); + if (ret == i) break + } + return ret +}; +exports.arrayExistObjByKeys = arrayExistObjByKeys; + //判断身份证是否合法 function checkIDCode(IDCode) { // 身份证号码为15位或者18位,15位时全为数字,18位前17位为数字,最后一位是校验位,可能为数字或字符X @@ -206,7 +233,7 @@ function parseID(id) { age: -1, sex: 'U', } - if(!id) return ret + if (!id) return ret if (!checkIDCode(id)) return ret let yearInMs = 1000 * 60 * 60 * 24 * 365.2425; @@ -342,12 +369,12 @@ exports.setData = setData; function getColorStr(intColor) { let color = '000000' try { - if(intColor){ + if (intColor) { color += Number(intColor).toString(16) color = color.substring(color.length - 6) - } + } } catch (error) { - console.log('getColorStr',error) + console.log('getColorStr', error) } return '#' + color } @@ -404,46 +431,46 @@ function listOrderBy(arr, keyObjs) { lKeyObjs = [] let colNames = keyObjs.split(',') colNames.forEach(colName => { - lKeyObjs.push({colName,sortType}) + lKeyObjs.push({ colName, sortType }) }); } if (!(Array.isArray(lKeyObjs) && lKeyObjs.length > 0)) return arr - - let temp = null + + let temp = null try { - for (let i = 0; i < arrCount; i++) { - for (let j = 0; j < arrCount - 1; j++) { - for (let k = 0; k < lKeyObjs.length; k++) { - sortType = (lKeyObjs[k]['sortType'] || 'A').toUpperCase() - if (sortType == 'A'){ - if (arr[j][lKeyObjs[k]['colName']] > arr[j + 1][lKeyObjs[k]['colName']]) { - temp = deepCopy(arr[j]) - arr[j] = deepCopy(arr[j + 1]) - arr[j + 1] = deepCopy(temp) - break; - }else if(arr[j][lKeyObjs[k]['colName']] < arr[j + 1][lKeyObjs[k]['colName']]){ - break; - }else{ - continue - } - }else{ - if (arr[j][lKeyObjs[k]['colName']] < arr[j + 1][lKeyObjs[k]['colName']]) { - temp = deepCopy(arr[j]) - arr[j] = deepCopy(arr[j + 1]) - arr[j + 1] = deepCopy(temp) - break; - }else if(arr[j][lKeyObjs[k]['colName']] > arr[j + 1][lKeyObjs[k]['colName']]){ - break; - }else{ - continue - } - } - } + for (let i = 0; i < arrCount; i++) { + for (let j = 0; j < arrCount - 1; j++) { + for (let k = 0; k < lKeyObjs.length; k++) { + sortType = (lKeyObjs[k]['sortType'] || 'A').toUpperCase() + if (sortType == 'A') { + if (arr[j][lKeyObjs[k]['colName']] > arr[j + 1][lKeyObjs[k]['colName']]) { + temp = deepCopy(arr[j]) + arr[j] = deepCopy(arr[j + 1]) + arr[j + 1] = deepCopy(temp) + break; + } else if (arr[j][lKeyObjs[k]['colName']] < arr[j + 1][lKeyObjs[k]['colName']]) { + break; + } else { + continue + } + } else { + if (arr[j][lKeyObjs[k]['colName']] < arr[j + 1][lKeyObjs[k]['colName']]) { + temp = deepCopy(arr[j]) + arr[j] = deepCopy(arr[j + 1]) + arr[j + 1] = deepCopy(temp) + break; + } else if (arr[j][lKeyObjs[k]['colName']] > arr[j + 1][lKeyObjs[k]['colName']]) { + break; + } else { + continue + } + } } - } + } + } } catch (error) { - console.log(`listOrderBy error: ${error}`); + console.log(`listOrderBy error: ${error}`); } return arr; } diff --git a/src/views/charge/charge.vue b/src/views/charge/charge.vue index f6e1b0f..308ea3f 100644 --- a/src/views/charge/charge.vue +++ b/src/views/charge/charge.vue @@ -75,7 +75,6 @@ - @@ -178,10 +177,12 @@ - + @@ -332,7 +333,7 @@ import moment from 'moment'; import { mapState, mapActions } from "vuex"; import { getapi, postapi, putapi, deletapi } from "@/api/api"; -import { tcdate, dddw, arrayExistObj, deepCopy } from "../../utlis/proFunc"; +import { tcdate, dddw, arrayExistObj,arrayExistObjPos, deepCopy } from "../../utlis/proFunc"; import PatientRegisterQuery from "../../components/patientRegister/patientRegisterQuery.vue"; import PatientRegisterRefuseList from "../../components/patientRegister/PatientRegisterRefuseList.vue"; @@ -622,7 +623,7 @@ export default { this.asbItemsForFee = res.data; for (let i = this.asbItemsForFee.length - 1; i >= 0; i--) { - if (this.asbItemsForFee[i].isCharge == 'Y' || this.asbItemsForFee[i].payTypeFlag == '1') { + if (this.asbItemsForFee[i].isCharge == 'Y' || this.asbItemsForFee[i].payTypeFlag !== '0' ) { this.asbItemsForFee.splice(i, 1); continue; } @@ -668,6 +669,21 @@ export default { }); }, + // 清除选的卡 + brushCard(index){ + this.chargePays[index].cardNo = '' + this.chargePays[index].cardRegisterId = '' + this.chargePays[index].chargeMoney = 0 + + delete this.chargePays[index].discount + delete this.chargePays[index].cardBalance + + // 刷新预收金额 及 找零 + this.inputMoney() + + }, + + // 弹出卡号查询窗口 getCardId(index) { console.log('index', index) @@ -705,10 +721,36 @@ export default { // 确定选中卡记录 btnOkCard() { - this.chargePays[this.cardSeq].cardNo = this.cardChoosed.cardNo + ' 余:' + this.cardChoosed.cardBalance + // 单次收费不允重复同一张卡 + let lfind = arrayExistObj(this.chargePays,'cardRegisterId',this.cardChoosed.id) + if(lfind > -1){ + this.$message.warning({showClose:true,message:'单次收费不允重复同一张卡!'}) + return + } + // 单次收费不允出现不同折扣的充值卡 + let diffDiscount = false //默认相同折扣 + let preDiscount = 100 + let curDiscount = this.cardChoosed.discount||100 + this.chargePays.forEach(e => { + if(e.payModeId == '05' && e.discount){ + if(Number(e.discount) !== Number(curDiscount)){ + preDiscount = e.discount + diffDiscount = true + } + } + }); + // 多张卡时,出现不同折扣,则返回 + if(diffDiscount){ + this.$message.warning({showClose:true,message:`当前所选卡折扣 ${curDiscount} 与 上次所选卡折扣 ${preDiscount} 不同,不可执行此操作`}) + return + } + + this.chargePays[this.cardSeq].cardNo = this.cardChoosed.cardNo + ' 余:' + this.cardChoosed.cardBalance + ' 折:' + curDiscount + this.chargePays[this.cardSeq].discount = curDiscount + this.chargePays[this.cardSeq].cardBalance = this.cardChoosed.cardBalance this.chargePays[this.cardSeq].cardRegisterId = this.cardChoosed.id // 将折扣带回,并触发 - this.form.discount = this.cardChoosed.discount || 100 + this.form.discount = curDiscount this.discountToDetails() this.winDialog.queryCard = false @@ -746,16 +788,21 @@ export default { //获取收费方式明细 getChargePayByChargeId(ChargeId) { + let curPayModeId = '' let lfind = -1; getapi(`/api/app/chargepay/getchargepayinchargeid?ChargeId=${ChargeId}`).then(res => { if (res.code != - 1) { res.data.forEach(e => { - lfind = arrayExistObj(this.chargePays, 'payModeId', e.payModeId); + if(curPayModeId != e.payModeId) lfind = -1 + lfind++ + console.log('lfind',lfind) + lfind = arrayExistObjPos(this.chargePays, 'payModeId', e.payModeId,lfind); if (lfind > - 1) { this.chargePays[lfind].chargeMoney = e.chargeMoney; this.chargePays[lfind].cardRegisterId = e.cardRegisterId; this.chargePays[lfind].cardNo = e.cardNo; } + curPayModeId = e.payModeId }); } }); @@ -888,6 +935,7 @@ export default { //输入收费方式金额 inputMoney() { // 现金 id = 01 + let err = '' let cashTotal = Number(0), unCashTotal = Number(0); this.chargePays.forEach(e => { console.log('e', e) @@ -896,7 +944,17 @@ export default { } else { unCashTotal += Number(e.chargeMoney); } + + if(e.payModeId == '05'){ + if(Number(e.cardBalance) < Number(e.chargeMoney)){ + err = `会员卡【${e.cardNo}】 余额不足` + } + } }); + if(err){ + this.$message.warning({showClose:true,message:err}) + return + } this.form.preTotal = cashTotal + unCashTotal this.findBalance() if (unCashTotal > this.form.total) this.$message.warning(`数据校验失败:输入的非现金金额${unCashTotal}不能超过应收金额${this.form.total}!`); @@ -968,11 +1026,13 @@ export default { if (e.payModeId == '05' && e.chargeMoney) { //console.log(e.payModeId,e.chargeMoney,e.cardRegisterId); if (!e.cardRegisterId) msg = dddw(this.dict.payMode, "id", e.payModeId, "displayName") + '付费,必需选择会员卡号'; + if(Number(e.cardBalance) < Number(e.chargeMoney)) msg = `会员卡【${e.cardNo}】 余额不足` } else { e.cardRegisterId = null; } }); + /**/ if (msg) { this.$message.warning(msg); return; @@ -988,8 +1048,7 @@ export default { this.$message.warning("收费方式合计收款不可小于应收金额!"); return; } - - + this.chargePays.forEach(e => { if (e.chargeMoney) { if (e.payModeId == '01') {