From 5a62719618555fe165d42c06eda1cf71bb1564ce Mon Sep 17 00:00:00 2001 From: houruijun <411269194@kidgrow.com> Date: Mon, 02 Nov 2020 15:29:26 +0800 Subject: [PATCH] 修改bug:删除充值记录的时候,页面被刷新的问题 --- kidgrow-web/kidgrow-web-manager/src/main/resources/static/pages/opration/recharge.html | 660 +++++++++++++++++++++++++++++++++--------------------------- 1 files changed, 363 insertions(+), 297 deletions(-) diff --git a/kidgrow-web/kidgrow-web-manager/src/main/resources/static/pages/opration/recharge.html b/kidgrow-web/kidgrow-web-manager/src/main/resources/static/pages/opration/recharge.html index 209a50f..23df499 100644 --- a/kidgrow-web/kidgrow-web-manager/src/main/resources/static/pages/opration/recharge.html +++ b/kidgrow-web/kidgrow-web-manager/src/main/resources/static/pages/opration/recharge.html @@ -1,124 +1,130 @@ <form id="recharge-form" lay-filter="recharge-form" class="layui-form"> - <div class="layui-tab" style="margin-top: 5px;"> - <ul class="layui-tab-title"> - <li class="layui-this">合同信息</li> - </ul> - <div class="layui-tab-content" style="margin: 0px;"> - <div class="layui-tab-item layui-show"> - <div class="layui-form-item" style="padding: 0; margin-bottom: 0px;"> - <div class="layui-row"> - <div class="layui-col-sm5"> - <label class="layui-form-label" style="padding: 0;">医院名称</label> - <div class="layui-input-block"> - <input name="hospitalName" id="hospitalName" type="text" class="layui-input" - style="border: none; margin-top:-10px" readonly /> + <div style="overflow-y: auto; height:700px;"> + <div class="layui-tab"> + <ul class="layui-tab-title"> + <li class="layui-this">合同信息</li> + </ul> + <div class="layui-tab-content" style="margin: 0px 0px -10px 0px;"> + <div class="layui-tab-item layui-show"> + <div class="layui-form-item" style="padding: 0; margin-bottom: 0px;"> + <div class="layui-row"> + <div class="layui-col-sm5"> + <label class="layui-form-label" style="padding: 0;">医院名称</label> + <div class="layui-input-block"> + <input name="hospitalName" id="hospitalName" type="text" class="layui-input" + style="border: none; margin-top:-10px" readonly /> + </div> </div> - </div> - <div class="layui-col-sm3"> - <label class="layui-form-label" style="padding: 0;">科室名称</label> - <div class="layui-input-block"> - <input name="departmentName" id="departmentName" style="border: none; margin-top:-10px" - readonly class="layui-input" /> + <div class="layui-col-sm3"> + <label class="layui-form-label" style="padding: 0;">科室名称</label> + <div class="layui-input-block"> + <input name="departmentName" id="departmentName" + style="border: none; margin-top:-10px" readonly class="layui-input" /> + </div> </div> - </div> - <div class="layui-col-sm2"> - <label class="layui-form-label" style="padding: 0;">服务人员</label> - <div class="layui-input-block"> - <input name="serverUserName" id="serverUserName" - style="border: none; margin-top:-10px;width: 120px;" readonly class="layui-input" /> + <div class="layui-col-sm2"> + <label class="layui-form-label" style="padding: 0;">服务人员</label> + <div class="layui-input-block"> + <input name="serverUserName" id="serverUserName" + style="border: none; margin-top:-10px;width: 120px;" readonly + class="layui-input" /> + </div> </div> </div> </div> - </div> - <div class="layui-form-item" style="padding: 0; margin-bottom: 0px;"> - <div class="layui-row"> - <div class="layui-col-sm5"> - <label class="layui-form-label" style="padding: 0 30px 0 0;">地区</label> - <input name="hospitalAreas" id="hospitalAreas" type="text" - style="border: none; width: 250px; margin-top:-10px" readonly class="layui-input" /> - </div> - <div class="layui-col-sm3"> - <label class="layui-form-label" style="padding: 0;">联系电话</label> - <div class="layui-input-block"> - <input name="hospitalTel" id="hospitalTel" type="text" class="layui-input" - style="border: none; margin-top:-10px" readonly /> + <div class="layui-form-item" style="padding: 0; margin-bottom: 0px;"> + <div class="layui-row"> + <div class="layui-col-sm5"> + <label class="layui-form-label" style="padding: 0 30px 0 0;">地区</label> + <input name="hospitalAreas" id="hospitalAreas" type="text" + style="border: none; width: 250px; margin-top:-10px" readonly class="layui-input" /> </div> - </div> - <div class="layui-col-sm2"> - <label class="layui-form-label" style="padding: 0;">联系人</label> - <div class="layui-input-block"> - <input name="hospitalLink" type="text" class="layui-input" - style="border: none; margin-top:-10px;width: 120px;" readonly /> + <div class="layui-col-sm3"> + <label class="layui-form-label" style="padding: 0;">联系电话</label> + <div class="layui-input-block"> + <input name="hospitalTel" id="hospitalTel" type="text" class="layui-input" + style="border: none; margin-top:-10px" readonly /> + </div> + </div> + <div class="layui-col-sm2"> + <label class="layui-form-label" style="padding: 0;">联系人</label> + <div class="layui-input-block"> + <input name="hospitalLink" type="text" class="layui-input" + style="border: none; margin-top:-10px;width: 120px;" readonly /> + </div> </div> </div> </div> - </div> - <div class="layui-form-item" style="padding: 0; margin-bottom: 0px;"> - <div class="layui-row"> - <div class="layui-col-sm4"> - <label class="layui-form-label" style="padding: 10px 30px 0 0px;">合同名称</label> - <div class="layui-input-block"> - <input name="contractTitle" id="contractTitle" type="text" class="layui-input" - maxlength="50" lay-verify="required" required autocomplete="off" /> + <div class="layui-form-item" style="padding: 0; margin-bottom: 0px;"> + <div class="layui-row"> + <div class="layui-col-sm4"> + <label class="layui-form-label" style="padding: 10px 30px 0 0px;">合同名称</label> + <div class="layui-input-block"> + <input name="contractTitle" id="contractTitle" type="text" class="layui-input" + maxlength="50" lay-verify="required" required autocomplete="off" /> + </div> </div> - </div> - <div class="layui-col-sm3"> - <label class="layui-form-label">合同编号</label> - <div class="layui-input-block"> - <input name="contractNo" id="contractNo" type="text" class="layui-input" maxlength="50" - style="width: 185px;" autocomplete="off" /> + <div class="layui-col-sm3"> + <label class="layui-form-label">合同编号</label> + <div class="layui-input-block"> + <input name="contractNo" id="contractNo" type="text" class="layui-input" + maxlength="50" style="width: 185px;" autocomplete="off" lay-verify="required" + required /> + </div> </div> </div> </div> - </div> - <div class="layui-form-item" style="margin: 10px 0px 0px 0px;"> - <div class="layui-row"> - <div class="layui-col-sm4"> - <label class="layui-form-label" style="padding: 10px 30px 0 0px;">开始日期</label> - <input autocomplete="off" name="contractBeginTime" id="contractBeginTime" type="text" - class="layui-input" style="width: 182px;" maxlength="50" lay-verify="required" - required /> - </div> - <div class="layui-col-sm4"> - <label class="layui-form-label">截止日期</label> - <div class="layui-input-block"> - <input autocomplete="off" name="contractEndTime" id="contractEndTime" type="text" - class="layui-input" maxlength="50" lay-verify="required" required /> + <div class="layui-form-item" style="margin: 10px 0px 0px 0px;"> + <div class="layui-row"> + <div class="layui-col-sm4"> + <label class="layui-form-label" style="padding: 10px 30px 0 0px;">开始日期</label> + <input autocomplete="off" name="contractBeginTime" id="contractBeginTime" type="text" + class="layui-input" style="width: 182px;" maxlength="50" lay-verify="required" + required /> </div> - </div> - <div class="layui-col-sm4"> - <label class="layui-form-label">签订日期</label> - <div class="layui-input-block"> - <input autocomplete="off" name="contractTime" id="contractTime" type="text" - class="layui-input" maxlength="50" lay-verify="required" required /> + <div class="layui-col-sm4"> + <label class="layui-form-label">截止日期</label> + <div class="layui-input-block"> + <input autocomplete="off" name="contractEndTime" id="contractEndTime" type="text" + class="layui-input" maxlength="50" lay-verify="required" required /> + </div> + </div> + <div class="layui-col-sm4"> + <label class="layui-form-label">签订日期</label> + <div class="layui-input-block"> + <input autocomplete="off" name="contractTime" id="contractTime" type="text" + class="layui-input" maxlength="50" lay-verify="required" required /> + </div> </div> </div> </div> </div> </div> </div> - </div> - <div class="layui-tab" style="margin: 0px;"> - <ul class="layui-tab-title"> - <li class="layui-this">产品信息</li> - </ul> - <div class="layui-tab-content" style="margin: 0px;"> - <div class="layui-tab-item layui-show" style="padding-top: 0px;"> - <table class="layui-table" id="product-table" lay-filter="product-table" style="margin: 0px;"></table> + <div class="layui-tab" style="margin: 0px;"> + <ul class="layui-tab-title"> + <li class="layui-this">产品信息</li> + </ul> + <div class="layui-tab-content" style="margin: -10px 0px -10px 0px;"> + <div class="layui-tab-item layui-show" style="padding-top: 0px;"> + <table class="layui-table" id="product-table" lay-filter="product-table" style="margin: 0px;"> + </table> + </div> </div> </div> - </div> - <div class="layui-tab" style="margin: 0px;"> - <ul class="layui-tab-title"> - <li class="layui-this">待充值产品</li> - </ul> - <div class="layui-tab-content"> - <div class="layui-tab-item layui-show" style="padding-top: 0px;"> - <table class="layui-table" id="product-table-temp" lay-filter="product-table-temp" style="margin: 0px;"> - </table> + <div class="layui-tab" style="margin: 0px;"> + <ul class="layui-tab-title"> + <li class="layui-this">待充值产品</li> + </ul> + <div class="layui-tab-content" style="margin: -10px 0px -10px 0px;"> + <div class="layui-tab-item layui-show" style="padding-top: 0px;"> + <table class="layui-table" id="product-table-temp" lay-filter="product-table-temp" + style="margin: 0px;"> + </table> + </div> </div> </div> </div> @@ -155,6 +161,8 @@ var $ = layui.jquery; var laydate = layui.laydate; + //充值进行中 + var isRun = false; //执行一个laydate实例 laydate.render({ elem: '#contractBeginTime' //指定元素 @@ -174,11 +182,11 @@ elem: '#product-table-temp', data: admin.getTempData("t_tempProduct"), page: false, - height: '120px', + cellMinWidth: 100, cols: [ [{ field: 'proName', - width: 320, + width: 330, title: '产品名称', align: 'center', fixed: 'left' @@ -186,7 +194,7 @@ { field: 'proType', align: 'center', - width: 100, + width: 80, templet: function (d) { if (d.proType === 0) return "试用" @@ -215,16 +223,16 @@ } }, { - field: 'recordCount', - width: 110, - align: 'center', - title: '报告数' - }, - { field: 'ailightCount', width: 100, align: 'center', title: '读片量' + }, + { + field: 'recordCount', + width: 100, + align: 'center', + title: '报告量' }, { field: 'beginTime', @@ -255,7 +263,7 @@ field: 'id', fixed: 'right', align: 'center', - width: 80, + width: 100, toolbar: '#product-tpl-bar-temp', title: '操作' } @@ -267,120 +275,140 @@ //回显医院基本数据 let hospitalData = admin.getTempData('t_hospital'); if (hospitalData != null) { - form.val('recharge-form', hospitalData); - $("#hospitalAreas").val(hospitalData.hospitalProvince + " " + hospitalData.hospitalCity + " " + - hospitalData.hospitalArea); - } - //装载产品数据 - table.render({ - elem: '#product-table', - url: config.base_server + 'api-opration/product', - method: 'GET', - headers: { - 'Authorization': 'Bearer ' + config.getToken().access_token - }, - page: false, - height: '300px', - where: { - enabled: 1 - }, - cols: [ - [{ - field: 'proName', - sort: true, - width: 300, - title: '产品名称', - align: 'center', - fixed: 'left' - }, - { - field: 'proType', - sort: true, - align: 'center', - width: 80, - templet: function (d) { - if (d.proType === 0) - return "试用" - else - return "正式" - }, - title: '类型' - }, - { - field: 'proTime', - width: 100, - title: '时长', - align: 'center', - templet: function (d) { - switch (d.proTimeUnit) { - case 0: - return d.proTime + "天"; - break; - case 1: - return d.proTime + "月"; - break; - case 2: - return d.proTime + "年"; - break; - } + admin.req('api-user/sysdepartment/getPayMes?departmentId=' + hospitalData.departmentId, {}, + function (data) { + layer.closeAll('loading'); + if (0 === data.code) { + queryData = data.data; + if (queryData === true) { + admin.finishPopupCenter(); + layer.msg("当前科室开通了单次支付功能,不能进行充值业务!", { + icon: 3, + time: 5000 + }); + } else { + form.val('recharge-form', hospitalData); + $("#hospitalAreas").val(hospitalData.hospitalProvince + " " + hospitalData + .hospitalCity + " " + + hospitalData.hospitalArea); + + //装载产品数据 + table.render({ + elem: '#product-table', + url: config.base_server + 'api-opration/product/all', + method: 'GET', + cellMinWidth: 50, + headers: { + 'Authorization': 'Bearer ' + config.getToken().access_token + }, + page: false, + where: { + is_del: 0, + enabled: 1 + }, + cols: [ + [{ + field: 'proName', + sort: true, + width: 330, + title: '产品名称', + align: 'center', + fixed: 'left' + }, + { + field: 'proType', + sort: true, + align: 'center', + width: 80, + templet: function (d) { + if (d.proType === 0) + return "试用" + else + return "正式" + }, + title: '类型' + }, + { + field: 'proTime', + width: 100, + title: '时长', + align: 'center', + templet: function (d) { + switch (d.proTimeUnit) { + case 0: + return d.proTime + "天"; + break; + case 1: + return d.proTime + "月"; + break; + case 2: + return d.proTime + "年"; + break; + } + } + }, + { + field: 'ailightCount', + width: 100, + align: 'center', + title: '读片量' + }, + { + field: 'recordCount', + width: 100, + align: 'center', + title: '报告量' + }, + { + field: 'beginTime', + align: 'center', + width: 120, + title: '开始日期', + event: "date" + }, + { + field: 'endTime', + align: 'center', + width: 120, + title: '结束日期', + event: "date" + }, + { + field: 'isShare', + fixed: 'right', + align: 'center', + width: 100, + templet: '#product-tpl-isShare', + title: '共享' + }, + { + field: 'id', + fixed: 'right', + align: 'center', + width: 100, + toolbar: '#product-tpl-bar', + title: '操作' + } + ] + ], + done: function (res) { + permissionsInput(res, config); + } + }); } - }, - { - field: 'recordCount', - width: 100, - align: 'center', - title: '报告数' - }, - { - field: 'ailightCount', - width: 100, - align: 'center', - title: '读片量' - }, - { - field: 'beginTime', - align: 'center', - width: 130, - title: '开始日期', - templet: function (d) { - return getNowDate(); - }, - event: "date", - edit: 'text' - }, - { - field: 'endTime', - align: 'center', - width: 130, - title: '结束日期', - templet: function (d) { - return getNowDate(d.proTime, d.proTimeUnit); - }, - event: "date", - edit: 'text' - }, - { - field: 'isShare', - fixed: 'right', - align: 'center', - width: 100, - templet: '#product-tpl-isShare', - title: '共享' - }, - { - field: 'id', - fixed: 'right', - align: 'center', - width: 100, - toolbar: '#product-tpl-bar', - title: '操作' } - ] - ], - done: function (res) { - permissionsInput(res, config); - } - }); + else + { + admin.finishPopupCenter(); + layer.msg("验证医院科室数据异常!", { + icon: 2, + time: 3000 + }); + } + }, 'get'); + + } + //待充值列表功能操作 table.on('tool(product-table-temp)', function (obj) { if (obj.event === "del") { @@ -392,8 +420,32 @@ }); //单元格点击事件 table.on('tool(product-table)', function (obj) { + var newdata = {}; var data = obj.data; var selectData = {}; + if (obj.event === 'date') { + var field = $(this).data('field'); + laydate.render({ + elem: this.firstChild, + format: "yyyy-MM-dd", + show: true, + done: function (value, date) { + var nowTr = obj.tr; + if (field === "beginTime") { + var endTimes = getNowDate(data.proTime, data.proTimeUnit, + value); + newdata["beginTime"] = value; + newdata["endTime"] = endTimes; + } else if (field === "endTime") { + newdata["endTime"] = value; + var beginTimes = getNowDate((0 - parseInt(data.proTime)), + data.proTimeUnit, value); + newdata["beginTime"] = beginTimes; + } + obj.update(newdata); + } + }); + } if (obj.event === "pay") { data.beginTime = obj.tr.find("td[data-field='beginTime'] input").val(); data.endTime = obj.tr.find("td[data-field='endTime'] input").val(); @@ -405,6 +457,7 @@ data.isShare = (data.isShare.indexOf("不") == 0) ? 0 : 1; if (!strUtil.isEmpty(data.beginTime) && !strUtil.isEmpty(data.endTime)) { if (dateUtil.compareDate(data.endTime, data.beginTime)) { + data.id=data.id+''; tempDataList(data); waitRecharge(); } else { @@ -429,8 +482,12 @@ } }); //自动计算时间 - var getNowDate = function (proTime, proTimeUnit) { - var now = new Date(); + var getNowDate = function (proTime, proTimeUnit, now) { + if (strUtil.isEmpty(now)) { + now = new Date(); + } else { + now = dateUtil.strTurnDate(now); + } if (strUtil.isEmpty(proTime) && strUtil.isEmpty(proTimeUnit)) { return now.dateFormat("yyyy-MM-dd"); } else { @@ -441,8 +498,8 @@ return new Date(now.setDate(now.getDate() + proTime)).dateFormat("yyyy-MM-dd"); break; case 1: - return new Date(now.setMonth(now.getMonth() + proTime + 1)).dateFormat( - "yyyy-MM-dd"); + return new Date(now.setMonth(now.getMonth() + proTime)).dateFormat( + "yyyy-MM-dd"); break; case 2: return new Date(now.setFullYear(now.getFullYear() + proTime)).dateFormat( @@ -486,93 +543,102 @@ } } form.on('submit(recharge-form-submit)', function (data) { - layer.load(2); - var listData = admin.getTempData("t_tempProduct"); - if (listData != null) { - if (data.field != null) { - layer.confirm("确定要将待充值列表中的" + listData.length + "个产品充值给当前医院吗?", { - btn: ["确定", "返回"] - }, function () { - data.field.contractBeginTime = data.field.contractBeginTime + - " 00:00:00"; - data.field.contractEndTime = data.field.contractEndTime + " 23:59:59"; - data.field.contractTime = data.field.contractTime + " 00:00:00"; - admin.req('api-opration/contract', JSON.stringify(data.field), - function (data) { - layer.closeAll('loading'); - if (data.code === 0) { - var orderData = data.data; - //处理订单明细数据 - var listDetailData = new Array(); - $.each(listData, function (index, item) { - var detailData = { - orderId: orderData.id, - proId: item.id, - proType: item.proType, - proName: item.proName, - isShare: item.isShare, - ailightCount: item.ailightCount, - recordCount: item.recordCount, - proBegintime: item.beginTime + - ' 00:00:00', - proEndtime: item.endTime + - ' 23:59:59' - }; - listDetailData.push(detailData); - }) + if (!isRun) { + layer.load(2); + var listData = admin.getTempData("t_tempProduct"); + if (listData != null) { + if (data.field != null) { + layer.confirm("确定要将待充值列表中的" + listData.length + "个产品充值给当前医院的科室吗?", { + btn: ["确定", "返回"] + }, function () { + isRun = true; + data.field.contractBeginTime = data.field.contractBeginTime + + " 00:00:00"; + data.field.contractEndTime = data.field.contractEndTime + + " 23:59:59"; + data.field.contractTime = data.field.contractTime + " 00:00:00"; + admin.req('api-opration/contract', JSON.stringify(data.field), + function (data) { + layer.closeAll('loading'); + if (data.code === 0) { + var orderData = data.data; + //处理订单明细数据 + var listDetailData = new Array(); + $.each(listData, function (index, item) { + var detailData = { + orderId: orderData.id+'', + proId: item.id+'', + proType: item.proType, + proName: item.proName, + isShare: item.isShare, + ailightCount: item.ailightCount, + recordCount: item.recordCount, + proBegintime: item.beginTime + + ' 00:00:00', + proEndtime: item.endTime + + ' 23:59:59' + }; + listDetailData.push(detailData); + }) - if (listDetailData.length > 0) { - //提交订单数据 - admin.req('api-opration/productorderdetail/saveall', - JSON.stringify(listDetailData), - function (data) { - layer.closeAll('loading'); - if (data.code === 0) { - //现将临时数据清理 - admin.putTempData("t_tempProduct", - ""); - layer.msg(data.msg, { - icon: 1, - time: 3000 - }, function () { - admin - .finishPopupCenter(); - }); - } else { - layer.msg(data.msg, { - icon: 2, - time: 1000 - }); - } - }, 'POST'); + if (listDetailData.length > 0) { + //提交订单数据 + admin.req( + 'api-opration/productorderdetail/saveall', + JSON.stringify(listDetailData), + function (data) { + isRun = false; + layer.closeAll('loading'); + if (data.code === 0) { + //现将临时数据清理 + admin.putTempData( + "t_tempProduct", + ""); + layer.msg(data.msg, { + icon: 1, + time: 2000 + }, function () { + admin + .finishPopupCenter(); + }); + } else { + layer.msg(data.msg, { + icon: 2, + time: 1000 + }); + } + }, 'POST'); + } else { + layer.msg("充值数据异常为空!", { + icon: 2, + time: 1000 + }); + isRun = false; + } } else { - layer.msg("充值数据异常为空!", { + layer.msg(data.msg, { icon: 2, time: 1000 }); + isRun = false; } - } else { - layer.msg(data.msg, { - icon: 2, - time: 1000 - }); - } - }, 'POST'); - }) + }, 'POST'); + }) + } else { + layer.msg("数据异常!", { + icon: 2, + time: 1000 + }); + } } else { - layer.msg("数据异常!", { + layer.msg("请先将要充值的产品加入待充值!", { icon: 2, - time: 1000 + time: 2000 }); } - } else { - layer.msg("请先将要充值的产品加入待充值!", { - icon: 2, - time: 2000 - }); + layer.closeAll('loading'); + return false; } - layer.closeAll('loading'); - return false; }); }); </script> \ No newline at end of file -- Gitblit v1.8.0