From 2c4189febf04adb1505ad3ed9816d9258fd852b8 Mon Sep 17 00:00:00 2001 From: zhaoxiaohao <279049017@qq.com> Date: Tue, 24 Nov 2020 12:06:10 +0800 Subject: [PATCH] 添加taocan 的功能 --- kidgrow-web/kidgrow-web-manager/src/main/resources/static/pages/opration/recharge.html | 640 +++++++++++++++++++++++++++++++++++++++------------------ 1 files changed, 436 insertions(+), 204 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 23df499..c8105fc 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 @@ -58,43 +58,77 @@ </div> <div class="layui-form-item" style="padding: 0; margin-bottom: 0px;"> <div class="layui-row"> - <div class="layui-col-sm4"> + <div class="layui-col-sm6"> <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 class="layui-col-sm3"> + <div class="layui-col-sm6"> <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 /> + maxlength="50" autocomplete="off" lay-verify="required" required /> </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-col-sm6"> + <label class="layui-form-label">当前软件服务周期:</label> + <div class="layui-col-sm4" style="margin-right: 30px;"> + <input autocomplete="off" name="contractBeginTime_not" disabled id="contractBeginTime_not" + type="text" placeholder="请输开始时间" class="layui-input" maxlength="50"/> + </div> + <div class="layui-col-sm4 "> + <input autocomplete="off" name="contractEndTime_not" disabled id="contractEndTime_not" type="text" + placeholder="请输入结束时间" class="layui-input" maxlength="50" /> </div> </div> - <div class="layui-col-sm4"> + <div class="layui-col-sm6"> + <label class="layui-form-label">当前读片总量:</label> + <div class="layui-input-inline"> + <input autocomplete="off" name="contractNum_not" id="contractNum_not" disabled type="text" class="layui-input" maxlength="50" + /> + </div> + </div> + <!-- <div class="layui-col-sm6"> <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 class="layui-form-item" style="margin: 10px 0px 0px 0px;"> + <div class="layui-row"> + <div class="layui-col-sm6"> + <label class="layui-form-label">合同服务周期:</label> + <!-- <input autocomplete="off" name="contractBeginTime" id="contractBeginTime" type="text" + class="layui-input" maxlength="50" lay-verify="required" + required /> --> + <!-- <input autocomplete="off" name="contractEndTime" id="contractEndTime" type="text" + class="layui-input" maxlength="50" lay-verify="required" required /> --> + + <div class="layui-col-sm4" style="margin-right: 30px;"> + <input autocomplete="off" name="contractBeginTime" id="contractBeginTime" + type="text" placeholder="请输开始时间" class="layui-input" maxlength="50" + lay-verify="required" required /> + </div> + <div class="layui-col-sm4 "> + <input autocomplete="off" name="contractEndTime" id="contractEndTime" type="text" + placeholder="请输入结束时间" class="layui-input" maxlength="50" lay-verify="required" + required /> + </div> + </div> + <div class="layui-col-sm6"> + <label class="layui-form-label">合同读片充值量:</label> + <div class="layui-input-inline"> + <input autocomplete="off" name="contractNum" id="contractNum" onkeyup="this.value=this.value.replace(/[^\d]/g,'') " type="text" class="layui-input" + maxlength="50" lay-verify="required" required /> </div> </div> </div> @@ -105,12 +139,66 @@ <div class="layui-tab" style="margin: 0px;"> <ul class="layui-tab-title"> - <li class="layui-this">产品信息</li> + <li class="layui-this">套餐列表</li> + <li>自定义充值</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 class="layui-tab-item"> + <div class="layui-form-item" style="margin: 10px 0px 0px 0px;"> + <div class="layui-row"> + <div class="layui-col-sm12"> + <label class="layui-form-label">充值名称:</label> + <div class="layui-input-inline"> + <input autocomplete="off" id="custom_proName" type="text" class="layui-input" maxlength="50" + value="1000" lay-verify="required" required /> + </div> + </div> + </div> + </div> + <div class="layui-form-item" style="margin: 10px 0px 0px 0px;"> + <div class="layui-row"> + <div class="layui-col-sm6"> + <label class="layui-form-label">读片充值量:</label> + <div class="layui-input-inline"> + <input autocomplete="off" id="custom_ailightCount" onkeyup="this.value=this.value.replace(/[^\d]/g,'') " type="text" class="layui-input" maxlength="50" + value="1000" lay-verify="required" required />张 + </div> + </div> + <div class="layui-col-sm6"> + <div class="layui-input-inline"> + <input type="radio" id="custom_isShare" name="gongxiang" value="1" title="是否共享" /> + </div> + </div> + </div> + </div> + <div class="layui-form-item" style="margin: 10px 0px 0px 0px;"> + <div class="layui-row"> + <div class="layui-col-sm6"> + <div class="layui-input-inline"> + <input type="radio" id="termType" name="termType" value="true" title="期限限制" /> + </div> + </div> + <div class="layui-col-sm6"> + <div class="layui-col-sm4" style="margin-right: 30px;"> + <input autocomplete="off" id="custom_beginTime" + type="text" placeholder="请输开始时间" class="layui-input" maxlength="50"/> + </div> + <div class="layui-col-sm4 "> + <input autocomplete="off" type="text" + placeholder="请输入结束时间" id="custom_endTime" class="layui-input" maxlength="50" /> + </div> + </div> + </div> + </div> + <div class="layui-form-item"> + <div class="layui-input-block" style="width: 50;"> + <input class="layui-btn" type="button" id="custom_submit" value="确定" /> + </div> + </div> </div> </div> </div> @@ -151,28 +239,71 @@ <input type="checkbox" lay-filter="product-tpl-isShare" value="{{d.id}}" lay-skin="switch" lay-text="共享|不共享" /> </script> <script> - layui.use(['form', 'table', 'util', 'config', 'laydate', 'admin'], function () { + layui.use(['form', 'table', 'util', 'config', 'laydate', 'jquery','admin'], function () { var form = layui.form; var table = layui.table; var config = layui.config; var layer = layui.layer; var util = layui.util; var admin = layui.admin; + // element=layui.element; var $ = layui.jquery; var laydate = layui.laydate; + + var contractNum=0; //充值进行中 var isRun = false; //执行一个laydate实例 laydate.render({ - elem: '#contractBeginTime' //指定元素 + elem: '#contractBeginTime', //指定元素 + done: function (value, date, endDate) { + var startDate = new Date(value).getTime(); + var endTime = new Date($('#contractEndTime').val()).getTime(); + if (endTime < startDate) { + layer.msg('结束时间不能小于开始时间'); + $('#contractBeginTime').val($('#contractEndTime').val()); + } + } }); laydate.render({ - elem: '#contractEndTime' //指定元素 + elem: '#contractEndTime', //指定元素 + done: function (value, date, endDate) { + var startDate = new Date($('#contractBeginTime').val()).getTime(); + var endTime = new Date(value).getTime(); + if (endTime < startDate) { + layer.msg('结束时间不能小于开始时间'); + $('#contractEndTime').val($('#contractBeginTime').val()); + } + } }); laydate.render({ - elem: '#contractTime', //指定元素 - value: new Date().dateFormat("yyyy-MM-dd") + elem: '#contractBeginTime_not' //指定元素 + }); + laydate.render({ + elem: '#contractEndTime_not' //指定元素 + }); + laydate.render({ + elem: '#custom_beginTime', //指定元素 + done: function (value, date, endDate) { + var startDate = new Date(value).getTime(); + var endTime = new Date($('#custom_endTime').val()).getTime(); + if (endTime < startDate) { + layer.msg('结束时间不能小于开始时间'); + $('#custom_beginTime').val($('#custom_endTime').val()); + } + } + }); + laydate.render({ + elem: '#custom_endTime', //指定元素 + done: function (value, date, endDate) { + var startDate = new Date($('#custom_beginTime').val()).getTime(); + var endTime = new Date(value).getTime(); + if (endTime < startDate) { + layer.msg('结束时间不能小于开始时间'); + $('#custom_endTime').val($('#custom_beginTime').val()); + } + } }); //现将临时数据清理 admin.putTempData("t_tempProduct", ""); @@ -185,93 +316,96 @@ cellMinWidth: 100, cols: [ [{ - field: 'proName', - width: 330, - title: '产品名称', - align: 'center', - fixed: 'left' + field: 'proName', + width: 330, + title: '产品名称', + align: 'center', + fixed: 'left' + }, + { + field: 'proType', + align: 'center', + width: 80, + templet: function (d) { + if (d.proType === 0) + return "试用" + else + return "正式" }, - { - field: 'proType', - 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; - } + 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: '开始日期' - }, - { - field: 'endTime', - align: 'center', - width: 120, - title: '结束日期' - }, - { - field: 'isShare', - fixed: 'right', - align: 'center', - width: 100, - templet: function (d) { - if (d.isShare == 0) - return "不共享" - else - return "共享" - }, - title: '共享' - }, - { - field: 'id', - fixed: 'right', - align: 'center', - width: 100, - toolbar: '#product-tpl-bar-temp', - title: '操作' + return ""; } + }, + { + field: 'ailightCount', + width: 100, + align: 'center', + title: '读片量' + }, + { + field: 'recordCount', + width: 100, + align: 'center', + title: '报告量' + }, + { + field: 'beginTime', + align: 'center', + width: 120, + title: '开始日期' + }, + { + field: 'endTime', + align: 'center', + width: 120, + title: '结束日期' + }, + { + field: 'isShare', + fixed: 'right', + align: 'center', + width: 100, + templet: function (d) { + if (d.isShare == 0) + return "不共享" + else + return "共享" + }, + title: '共享' + }, + { + field: 'id', + fixed: 'right', + align: 'center', + width: 100, + toolbar: '#product-tpl-bar-temp', + title: '操作' + } ] ] }); } + + //回显医院基本数据 let hospitalData = admin.getTempData('t_hospital'); if (hospitalData != null) { @@ -281,7 +415,7 @@ if (0 === data.code) { queryData = data.data; if (queryData === true) { - admin.finishPopupCenter(); + admin.finishPopupCenter(); layer.msg("当前科室开通了单次支付功能,不能进行充值业务!", { icon: 3, time: 5000 @@ -308,87 +442,87 @@ }, cols: [ [{ - field: 'proName', - sort: true, - width: 330, - title: '产品名称', - align: 'center', - fixed: 'left' + 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 "正式" }, - { - 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; - } + 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: '操作' } + }, + { + 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) { @@ -397,18 +531,84 @@ }); } } - else - { + else { admin.finishPopupCenter(); layer.msg("验证医院科室数据异常!", { - icon: 2, - time: 3000 - }); + icon: 2, + time: 3000 + }); } }, 'get'); + //报告数量事件 + $("#contractNum").blur(function(){ + if($("#contractNum").val()<=0){ + layer.msg("输入的读片量大于0"); + $("#contractNum").val("") + return false; + } + var listData = admin.getTempData("t_tempProduct"); + var listNum=0; + if (!strUtil.isEmpty(listData)) { + listData.forEach(item =>{ + listNum+=item.ailightCount; + }) + } + if($("#contractNum").val()<listNum){ + layer.msg("请先删除待充值套餐"); + $("#contractNum").val(contractNum) + return false; + }else{ + contractNum=$("#contractNum").val(); + } + }) + //自定义的确定 + $("#custom_submit").click(function(){ + var custom_proName=$("#custom_proName").val() + var custom_ailightCount=$("#custom_ailightCount").val() + var custom_isShare=$("#custom_isShare").prop("checked") ? 1:0; + var termType=$("#termType").prop("checked")? 1:0; + var custom_beginTime=""; + var custom_endTime=""; + if(termType==1){ + custom_beginTime=$("#custom_beginTime").val(); + custom_endTime=$("#custom_endTime").val(); + }else{ + custom_beginTime=$("#contractBeginTime").val(); + custom_endTime=$("#contractEndTime").val(); + } + var listData = admin.getTempData("t_tempProduct"); + //添加一个id,删除用 + var max=0; + if (strUtil.isEmpty(listData)) { + listData = new Array(); + } + listData.forEach(element => { + if(max<element.id){ + max=element.id + } + }); + //判断待加入产品的总数是否大于合同的总数 + var msg=isthenNum(parseInt(custom_ailightCount)); + if(msg!=null){ + layer.msg(msg); + return false; + } + var data={ + id: max+1, + ailightCount: parseInt(custom_ailightCount), + beginTime: custom_beginTime, + endTime: custom_endTime, + isShare: custom_isShare, + proName: custom_proName, + proTime: "", + proType: 1, + termType: termType + } + tempDataList(data); + waitRecharge(); + }) } - //待充值列表功能操作 table.on('tool(product-table-temp)', function (obj) { if (obj.event === "del") { @@ -455,9 +655,15 @@ "td[data-field='endTime'] div").text(); data.isShare = obj.tr.find("td[data-field='isShare'] em").text(); data.isShare = (data.isShare.indexOf("不") == 0) ? 0 : 1; + //判断待加入产品的总数是否大于合同的总数 + var msg=isthenNum(data.ailightCount); + if(msg!=null){ + layer.msg(msg); + return false; + } if (!strUtil.isEmpty(data.beginTime) && !strUtil.isEmpty(data.endTime)) { if (dateUtil.compareDate(data.endTime, data.beginTime)) { - data.id=data.id+''; + data.id = data.id + ''; tempDataList(data); waitRecharge(); } else { @@ -470,6 +676,28 @@ } } }); + function isthenNum(num){ + if(num<=0){ + return "请输入读片量大于0"; + } + var listData = admin.getTempData("t_tempProduct"); + var listNum=0; + if (!strUtil.isEmpty(listData)) { + listData.forEach(item =>{ + listNum+=item.ailightCount; + }) + } + listNum+=num; + if($("#contractNum").val()==undefined||$("#contractNum").val()==""){ + return "请输入读片量!"; + }else{ + if($("#contractNum").val()<listNum){ + return "当前产品总数不得大于合同总量"; + }else{ + return null; + } + } + } //监听单元格编辑 判断日期格式 table.on('edit(product-table)', function (obj) { var value = obj.value //得到修改后的值 @@ -477,7 +705,7 @@ data = obj.data //得到所在行所有键值 , field = obj.field; //得到字段 - if (dateUtil.isDate(value)) {} else { + if (dateUtil.isDate(value)) { } else { layer.msg("输入的日期格式无效!"); } }); @@ -515,13 +743,13 @@ if (strUtil.isEmpty(listData)) { listData = new Array(); } - $.each(listData, function (index, value) { - if (value.id === data.id) { - //移除 - listData.splice(index, 1); - return false; - } - }) + // $.each(listData, function (index, value) { + // if (value.id === data.id) { + // //移除 + // listData.splice(index, 1); + // return false; + // } + // }) listData.push(data); admin.putTempData("t_tempProduct", listData); } else { @@ -556,7 +784,10 @@ " 00:00:00"; data.field.contractEndTime = data.field.contractEndTime + " 23:59:59"; - data.field.contractTime = data.field.contractTime + " 00:00:00"; + // data.field.contractTime = data.field.contractTime + " 00:00:00"; + delete data.field.contractNum_not + delete data.field.contractBeginTime_not + delete data.field.contractEndTime_not admin.req('api-opration/contract', JSON.stringify(data.field), function (data) { layer.closeAll('loading'); @@ -566,17 +797,18 @@ var listDetailData = new Array(); $.each(listData, function (index, item) { var detailData = { - orderId: orderData.id+'', - proId: item.id+'', + orderId: orderData.id + '', + proId: item.termType==null? item.id + '': "0", 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' + ailightCount: item.ailightCount!=null ? item.ailightCount : 0, + recordCount: item.recordCount!=null ? item.recordCount : 0, + termType: item.termType, + proBegintime: item.beginTime!="" ? item.beginTime+ + ' 00:00:00':"", + proEndtime: item.endTime !="" ? item.endTime + + ' 23:59:59':"" }; listDetailData.push(detailData); }) -- Gitblit v1.8.0