houseList2.jsp 17 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428
  1. <%--填写票据号,生成合同号 --%>
  2. <%@ page language="java" contentType="text/html; charset=utf-8" pageEncoding="utf-8"%>
  3. <jsp:include page="../../common/include.jsp" />
  4. <% String basePath = request.getScheme()+ "://" + request.getServerName() + ":" +request.getServerPort() + request.getContextPath(); %>
  5. <script type="text/javascript">
  6. //家庭收入情况
  7. var incomeTypeObj = null;
  8. var incomeType_array = null;
  9. $.ajax({
  10. type: "post",//使用post方法访问后台
  11. dataType: "json",//返回json格式的数据
  12. url: "aa10Action_listAa10All",//要访问的后台地址
  13. data:{"aa10.letter":"incomeType" ,"aa10.name":"家庭收入类型" },
  14. complete :function(){$("#load").hide();},//AJAX请求完成时隐藏loading提示
  15. success: function(msg){//msg为返回的数据,在这里做数据绑定
  16. if(msg.success){
  17. incomeTypeObj = msg.obj.rows;
  18. }
  19. }
  20. });
  21. /**小区显示区*/
  22. $(function() {
  23. $('#rentDataGrid').datagrid({
  24. rownumbers:true,
  25. fit:true,
  26. pageSize:10,
  27. pageList : [ 10, 20, 30, 40, 50 ],
  28. fitColumns:false,
  29. border:false,
  30. sortOrder:'desc',
  31. pagination:true,
  32. idField:'id',
  33. toolbar:'#searchtool',
  34. url:whzl.basePath + '/rent10Action_rentList?rentStatus=0',
  35. pageNumber:1,
  36. nowrap:true,
  37. loadFilter:function(result){
  38. if(result.success){
  39. return result.obj;
  40. }else{
  41. $.messager.alert("提示",result.message);
  42. return ;
  43. }
  44. }
  45. });
  46. });
  47. /**查询*/
  48. function searchFun(){
  49. $("#rentDataGrid").datagrid("load", {
  50. "rent10.house.community.id":trim($('#communityId').combobox("getValue")),
  51. "rent10.house.no":trim($('#no').combobox("getValue")),
  52. "rent10.house.houseNumber":trim($('#houseNumber').combobox("getValue")),
  53. "rent10.lesseeId":trim($('#lesseeId').val()),
  54. "createStartDay":trim($('#createStartDay').datebox('getValue')),
  55. "createEndDay":trim($('#createEndDay').datebox('getValue')),
  56. "rent10.startDay":trim($('#startDay').datebox('getValue')),
  57. "rent10.endDay":trim($('#endDay').datebox('getValue'))
  58. });
  59. }
  60. /*清除查询条件**/
  61. function ClearQuery() {
  62. $("#tblQuery").find("input").val("");
  63. $("#tblQuery").find("select").val("-1");
  64. }
  65. var communityNameFormatter = function(value , row , index){
  66. return row.house.communityName;
  67. }
  68. var noFormatter = function(value , row , index){
  69. return row.house.no;
  70. }
  71. var houseNumberFormatter = function(value , row , index){
  72. return row.house.houseNumber;
  73. }
  74. var dateFormatter = function(value , row , index){
  75. return dealDate(value);
  76. }
  77. //填写票据号
  78. var addBillNoFormatter = function(value , row , index){
  79. if(row.billNo == ''||row.billNo == null){
  80. if(row.rentStatus == 1 && row.rentType != '3'){
  81. return "<img src='<%=basePath%>/images/pencil.png' title='票据号' onclick=findPayOnlineResult(" + row.id + ") style='cursor:pointer' />"
  82. }else{
  83. return "";
  84. }
  85. }else{
  86. return row.billNo;
  87. }
  88. }
  89. function addBillNo(rentId){
  90. $("#addBillNoDialog").dialog({
  91. buttons : [{
  92. text : '确定',
  93. iconCls : 'icon-ok',
  94. handler : function(){
  95. addBillNo_submit();
  96. }
  97. },{
  98. text : '取消',
  99. iconCls : 'icon-cancel',
  100. handler : function(){
  101. $("#addBillNoDialog").dialog("close");
  102. }
  103. }],
  104. onLoad : function(){
  105. addBillNo_load(rentId);
  106. }
  107. })
  108. }
  109. function findPayOnlineResult(rentId){
  110. var payOnlineResult=""
  111. $.ajax({
  112. type: "post",//使用get方法访问后台
  113. dataType: "json",//返回json格式的数据
  114. url: "rent10Action_findById",//要访问的后台地址
  115. data: "rent10.id="+rentId,//要发送的数据
  116. complete :function(){$("#load").hide();},//AJAX请求完成时隐藏loading提示
  117. success: function(msg){
  118. if(msg.success){
  119. if(msg.obj.payOnlineResult== undefined||msg.obj.payOnlineResult==""){
  120. payOnlineResult="未查询到电子支付结果,是否填写票据号"
  121. $.messager.confirm('提醒',payOnlineResult,function(r){
  122. if (r) {
  123. addBillNo(rentId)
  124. }
  125. })
  126. }else{
  127. var payOnlineResultJSON= $.parseJSON(msg.obj.payOnlineResult);
  128. payOnlineResult="已查询到支付结果,电子支付"+payOnlineResultJSON.totalFee+"元,可以填写票据号。";
  129. $.messager.alert('消息',payOnlineResult,'info',function(){
  130.       addBillNo(rentId)
  131.       }
  132.     );
  133. }
  134. }
  135. }
  136. })
  137. return payOnlineResult
  138. }
  139. var addContractNoFormatter = function(value , row , index){
  140. if(row.rentStatus == 1){
  141. if(row.contractNo == ''||row.contractNo == null){
  142. if(row.billNo != "" && row.billNo != null && row.rentType != '3'){
  143. return "<img src='<%=basePath%>/images/pencil.png' title='合同编号' onclick=addContractNo(" + row.id + ") style='cursor:pointer' />"
  144. }else{
  145. return "";
  146. }
  147. }else{
  148. return row.contractNo;
  149. }
  150. }else{
  151. return "";
  152. }
  153. }
  154. function addContractNo(rentId){
  155. $.messager.confirm('提醒','是否生成合同编号?',function(r){
  156. $.ajax({
  157. type: "post",//使用get方法访问后台
  158. dataType: "json",//返回json格式的数据
  159. url: "rent10Action_addContractNo",//要访问的后台地址
  160. data: "rent10.id="+rentId,//要发送的数据
  161. complete :function(){$("#load").hide();},//AJAX请求完成时隐藏loading提示
  162. success: function(msg){
  163. if(msg.success){
  164. $.messager.alert("提醒","已生成合同编号 ");
  165. $("#rentDataGrid").datagrid("reload");
  166. }
  167. }
  168. })
  169. })
  170. }
  171. var rentTypeFormatter = function(value , row , index){
  172. if(value == 1) {
  173. return "租赁";
  174. }else if(value == 2) {
  175. return "退租";
  176. }else if(value == 3) {
  177. return "抵扣";
  178. }
  179. }
  180. //合同当前状态
  181. var rentStatusFormatter = function(value , row , index){
  182. if(value == 1) {
  183. return "正常";
  184. }else if(value == 0) {
  185. return "作废";
  186. }else if(value == 2) {
  187. return "申请作废中";
  188. }
  189. }
  190. /**详情*/
  191. var detailFormatter = function(value , row , index){
  192. return "<img src='<%=basePath%>/images/details.png' title='详情' onclick=rentDetail(" + row.id + ") style='cursor:pointer' />";
  193. }
  194. var rentDetail = function(id){
  195. $("#rentDetailDialog").dialog(
  196. {
  197. buttons : [
  198. {
  199. text : '关闭',
  200. iconCls : 'icon-ok',
  201. handler : function(){
  202. $("#rentDetailDialog").dialog("close");
  203. }
  204. }
  205. ],
  206. onLoad : function(){
  207. rentDetail_load(id);
  208. }
  209. }
  210. );
  211. };
  212. //申请作废
  213. var applyInvalidFormatter = function(value , row , index){
  214. if(row.rentStatus == 1 && row.rentType != '3'){
  215. return "<img src='<%=basePath%>/images/pencil.png' title='申请作废' onclick=applyInvalid(" + row.id + ") style='cursor:pointer' />"
  216. }else if(row.rentStatus == 2){
  217. return "";
  218. }
  219. }
  220. function applyInvalid(rentId){
  221. $.messager.prompt('提醒', '请输入申请作废原因(必填)', function(r){
  222. if (r){
  223. $.ajax({
  224. type: "post",//使用get方法访问后台
  225. dataType: "json",//返回json格式的数据
  226. url: "rent10Action_applyInvalid",//要访问的后台地址
  227. data: "rent10.id="+rentId+"&rent10.invalidApplyRemark="+r+"&house.id="+0,//要发送的数据
  228. complete :function(){$("#load").hide();},//AJAX请求完成时隐藏loading提示
  229. success: function(msg){
  230. if(msg.success){
  231. $.messager.alert("提醒","当前合同已申请作废");
  232. $("#rentDataGrid").datagrid("reload");
  233. }
  234. }
  235. })
  236. }
  237. });
  238. }
  239. /**电子支付*/
  240. payOnlineFormatter = function(value , row , index){
  241. if(row.billNo == ''||row.billNo == null){
  242. if(row.rentStatus == 1 && row.rentType != '3'){
  243. return "<img src='<%=basePath%>/images/zjsq.png' title='电子支付' onclick=payOnline(" + row.id+","+row.rentYear+","+row.deposit+","+row.electricityDeposit+","+row.waterDeposit + ") style='cursor:pointer' />"
  244. }else{
  245. return "";
  246. }
  247. }else{
  248. return "";
  249. }
  250. }
  251. function payOnline(id,rentYear,deposit,electricityDeposit,waterDeposit){
  252. var totalFee = rentYear+deposit+electricityDeposit+waterDeposit+"";
  253. $.messager.confirm('提醒','确认电子支付'+totalFee+'元?',function(r){
  254. if (r) {
  255. var version = whzlFun.pay(totalFee);
  256. var resultversionJson = $.parseJSON(version);
  257. if(resultversionJson.orderStatus=="1"){
  258. $.ajax({
  259. type: "post",//使用get方法访问后台
  260. async:false,
  261. dataType: "json",//返回json格式的数据
  262. url: "rent10Action_payOnline",//要访问的后台地址
  263. data: "rent10.id="+id+"&rent10.payOnlineResult="+version,//要发送的数据
  264. complete :function(){$("#load").hide();},//AJAX请求完成时隐藏loading提示
  265. success: function(msg){
  266. $.messager.alert("提醒","支付成功");
  267. }
  268. })
  269. }else if(resultversionJson.orderStatus=="2"){
  270. $.messager.progress({
  271. title: '提示',
  272. msg: '支付中,请稍候……',
  273. text: ''
  274. });
  275. setTimeout( function(){
  276. var result = whzlFun.payCheck(resultversionJson.outTradeNo);
  277. var resultJson = $.parseJSON(result);
  278. $.messager.progress('close');
  279. if(resultJson.orderStatus=="3"){
  280. $.messager.alert("提醒","支付失败,请重新支付");
  281. }else if(resultJson.orderStatus=="1"){
  282. $.ajax({
  283. type: "post",//使用get方法访问后台
  284. async:false,
  285. dataType: "json",//返回json格式的数据
  286. url: "rent10Action_payOnline",//要访问的后台地址
  287. data: "rent10.id="+id+"&rent10.payOnlineResult="+result,//要发送的数据
  288. complete :function(){$("#load").hide();},//AJAX请求完成时隐藏loading提示
  289. success: function(msg){
  290. $.messager.alert("提醒","支付成功");
  291. }
  292. })
  293. }
  294. }, 40 * 1000 );//延迟3000毫米
  295. }
  296. }
  297. })
  298. }
  299. </script>
  300. <div class="easyui-layout" data-options="fit:true,border:false">
  301. <div data-options="region:'center',border:false">
  302. <div id="searchtool" data-options="region:'north',border:false">
  303. <div class="clear"></div>
  304. <table id="tblQuery" style="width:100%;font-size:12px;">
  305. <tr>
  306. <td><span>小区名称</span></td>
  307. <td>
  308. <input id="communityId">
  309. <input id="no" style="width: 60px;">&nbsp;幢&nbsp;
  310. <input id="houseNumber" style="width: 80px;">&nbsp;室
  311. </td>
  312. <td>承租人身份证号</td>
  313. <td><input id="lesseeId"/></td>
  314. <td align="center">
  315. <a href="javascript:searchFun();" class="easyui-linkbutton" data-options="iconCls:'icon-search',plain:true">查询</a>
  316. <a href="javascript:ClearQuery();" class="easyui-linkbutton" data-options="iconCls:'icon-emptied',plain:true">清空</a>
  317. </td>
  318. </tr>
  319. <tr>
  320. <td><span>录入合同时间从</span></td>
  321. <td>
  322. <input class="easyui-datebox" id="createStartDay"/>&nbsp;至&nbsp;
  323. <input class="easyui-datebox" id="createEndDay"/>
  324. </td>
  325. <td><span>合同时间从</span></td>
  326. <td>
  327. <input class="easyui-datebox" id="startDay"/>&nbsp;至&nbsp;
  328. <input class="easyui-datebox" id="endDay"/>
  329. </td>
  330. </tr>
  331. </table>
  332. <div class="clear"></div>
  333. </div>
  334. <table id="rentDataGrid">
  335. <thead frozen="true">
  336. <tr>
  337. <th data-options="field:'id',checkbox:true,width:30">ID</th>
  338. <th data-options="field:'communityName',sortable:true,width:100,formatter:communityNameFormatter">小区名称</th>
  339. </tr>
  340. </thead>
  341. <thead>
  342. <tr>
  343. <th data-options="field:'no',width:80,formatter:noFormatter">楼号</th>
  344. <th data-options="field:'houseNumber',width:80,formatter:houseNumberFormatter">房号</th>
  345. <th data-options="field:'lessee',width:80">承租人</th>
  346. <th data-options="field:'lesseeId',width:150">承租人身份证</th>
  347. <th data-options="field:'startDay',width:80,formatter:dateFormatter">开始时间</th>
  348. <th data-options="field:'endDay',width:80,formatter:dateFormatter">结束时间</th>
  349. <th data-options="field:'rentType',width:80,formatter:rentTypeFormatter">合同类型</th>
  350. <th data-options="field:'rentStatus',align:'center',width:80,formatter:rentStatusFormatter">合同当前状态</th>
  351. <th data-options="field:'detail',width:80,align:'center',formatter:detailFormatter">详情</th>
  352. <th data-options="field:'addBillNo',align:'center',width:100,formatter:addBillNoFormatter">填写票据</th>
  353. <th data-options="field:'addContractNo',align:'center',width:110,formatter:addContractNoFormatter">合同编号</th>
  354. <th data-options="field:'applyInvalid',align:'center',width:70,formatter:applyInvalidFormatter">申请作废</th>
  355. <th data-options="field:'payOnline',align:'center',width:70,formatter:payOnlineFormatter">电子支付</th>
  356. </tr>
  357. </thead>
  358. </table>
  359. </div>
  360. </div>
  361. <div id="addBillNoDialog" data-options="title:'&nbsp;增加票据号信息',iconCls:'icon-add',width:1200,height:500,modal:true,href:'<%=basePath %>/rent10Action_toAddBillNo'">
  362. </div>
  363. <div id="rentDetailDialog" data-options="title:'&nbsp;合同详情信息',iconCls:'icon-detail',width:1200,height:500,modal:true,href:'<%=basePath %>/rent10Action_toRentDetail'">
  364. </div>
  365. <script type="text/javascript">
  366. $(function(){
  367. parent.$.messager.progress('close');
  368. $('#communityId').combobox({
  369. url: whzl.basePath + '/communityAction_findAll',
  370. valueField:'value',
  371. textField:'text',
  372. filter:function(q,row){
  373. var opts=$(this).combobox("options");
  374. //return row[opts.textField].indexOf(q)==0;//
  375. return row[opts.textField].indexOf(q)>-1;//将从头位置匹配改为任意匹配
  376. },
  377. onChange:function (newValue,oldValue) {
  378. $('#no').combobox("setValue","");
  379. $('#houseNumber').combobox("setValue","");
  380. $('#no').combobox('reload',whzl.basePath + '/houseAction_findAllNo?house.community.id='+$('#communityId').combobox("getValue"));
  381. }
  382. });
  383. $('#no').combobox({
  384. //editable:false,
  385. url: whzl.basePath + '/houseAction_findAllNo?house.community.id='+$('#communityId').combobox("getValue"),
  386. valueField:'value',
  387. textField:'text',
  388. filter:function(q,row){
  389. var opts=$(this).combobox("options");
  390. //return row[opts.textField].indexOf(q)==0;//
  391. return row[opts.textField].indexOf(q)>-1;//将从头位置匹配改为任意匹配
  392. },
  393. onChange:function (newValue,oldValue) {
  394. $('#houseNumber').combobox("setValue","");
  395. $('#houseNumber').combobox('reload',whzl.basePath + '/houseAction_findAllHouseNumber?house.community.id='+$('#communityId').combobox("getValue") + '&house.no='+newValue);
  396. }
  397. });
  398. $('#houseNumber').combobox({
  399. //editable:false,
  400. url: whzl.basePath + '/houseAction_findAllHouseNumber?house.community.id='+$('#communityId').combobox("getValue") + '&house.no='+$('#no').combobox("getValue"),
  401. valueField:'value',
  402. textField:'text',
  403. filter:function(q,row){
  404. var opts=$(this).combobox("options");
  405. //return row[opts.textField].indexOf(q)==0;//
  406. return row[opts.textField].indexOf(q)>-1;//将从头位置匹配改为任意匹配
  407. }
  408. });
  409. })
  410. </script>