rentRefundAdd.jsp 9.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211
  1. <%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
  2. <script type="text/javascript">
  3. var communityPrice = 0;
  4. //车库单价
  5. var garagePrice = 0;
  6. //房源面积
  7. var area = 0
  8. //车库面积
  9. var garageArea = 0
  10. function addRentRefund_load(houseId){
  11. $.ajax({
  12. type: "post",//使用get方法访问后台
  13. dataType: "json",//返回json格式的数据
  14. async: false,
  15. url: "houseAction_findById",//要访问的后台地址
  16. data: "house.id="+houseId,//要发送的数据
  17. complete :function(){$("#load").hide();},//AJAX请求完成时隐藏loading提示
  18. success: function(msg){
  19. if(msg.success){
  20. $("#houseAddress").text(msg.obj.address);
  21. $("#houseArea").text(msg.obj.area);
  22. $("#housePrice").text(msg.obj.housePrice);
  23. $("#garageArea").text(msg.obj.garageArea);
  24. $("#garagePrice").text(msg.obj.garagePrice);
  25. $("#endDay").text(dealDate(msg.obj.endTime));
  26. $("#endDay_add").val(dealDate(msg.obj.endTime));
  27. $("#houseId_add").val(msg.obj.id);
  28. $("#houseAddress_add").val(msg.obj.address);
  29. $("#area_add").val(msg.obj.area);
  30. $("#garageArea_add").val(msg.obj.garageArea);
  31. $("#housePrice_add").val(msg.obj.housePrice);
  32. $("#garagePrice_add").val(msg.obj.garagePrice);
  33. communityPrice = msg.obj.housePrice;
  34. garagePrice = msg.obj.garagePrice;
  35. area = msg.obj.area;
  36. garageArea = msg.obj.garageArea;
  37. if(msg.obj.lessee != null && msg.obj.lessee != ""){
  38. $("#idCard").text(msg.obj.lesseeId)
  39. $("#securityPersonName").text(msg.obj.lessee);
  40. $("#phone").text(msg.obj.lesseeTel);
  41. $("#personType").text(msg.obj.incomeType);
  42. $("#securityPersonName_add").val(msg.obj.lessee);
  43. $("#idCard_add").val(msg.obj.lesseeId);
  44. $("#phone_add").val(msg.obj.lesseeTel);
  45. $("#personType_add").val(msg.obj.incomeType);
  46. }
  47. }
  48. }
  49. })
  50. $.ajax({
  51. type: "post",//使用get方法访问后台
  52. dataType: "json",//返回json格式的数据
  53. async: false,
  54. url: "rent10Action_findSecurityPersonByHouseId",//要访问的后台地址
  55. data: "house.id="+houseId,//要发送的数据
  56. complete :function(){$("#load").hide();},//AJAX请求完成时隐藏loading提示
  57. success: function(msg){
  58. if(msg.success){
  59. if(msg.obj!=undefined){
  60. $("#idCard").text(msg.obj.securityPerson.idCard)
  61. $("#securityPersonName").text(msg.obj.securityPerson.name);
  62. $("#phone").text(msg.obj.securityPerson.phone);
  63. $("#personType").text(msg.obj.securityPerson.personType);
  64. $("#securityPersonId_add").val(msg.obj.securityPerson.id);
  65. $("#securityPersonName_add").val(msg.obj.securityPerson.name);
  66. $("#idCard_add").val(msg.obj.securityPerson.idCard);
  67. $("#phone_add").val(msg.securityPerson.phone);
  68. $("#personType_add").val(msg.obj.securityPerson.personType);
  69. }
  70. }
  71. }
  72. })
  73. }
  74. function calculate(){
  75. var startDay = $("#startDay_add").datebox('getValue');
  76. var endDay = $("#endDay").text();
  77. month = countMonth(startDay,endDay);
  78. $("#refundMonth").text(month);
  79. $("#refundMonth_add").val(month);
  80. var refundMoney =0;
  81. var discount = 0;
  82. if($("#personType_add").val()== 1){
  83. discount = 0.1;
  84. }else if($("#personType_add").val()== 2){
  85. discount = 0.3;
  86. }else{
  87. discount = 0.7;
  88. }
  89. var houseMoney = Number(Number(communityPrice * area)+Number(garagePrice * garageArea)).toFixed(2);
  90. refundMoney = Number(houseMoney * month * discount * 0.5).toFixed(2);
  91. $("#refundMoney").text(refundMoney);
  92. $("#refundMoney_add").val(refundMoney);
  93. }
  94. function countMonth(start,end){
  95. var endDate = new Date(end);
  96. var startDate = new Date(start);
  97. var renNumber = 0;
  98. var yearToMonth = (endDate.getFullYear() - startDate.getFullYear()) * 12;
  99. var monthToMonth = endDate.getMonth() - startDate.getMonth();
  100. var day = endDate.getDate() - startDate.getDate();
  101. if(day>0){
  102. renNumber = yearToMonth + monthToMonth +1;
  103. }else{
  104. renNumber = yearToMonth + monthToMonth;
  105. }
  106. return renNumber;
  107. }
  108. var addRentRefund_submit = function(){
  109. if($("refundMoney_add").val()==''){
  110. $.messager.alert("提示","请计算退还金额");
  111. }
  112. parent.$.messager.progress({
  113. title : '提示',
  114. text : '数据处理中,请稍候....'
  115. });
  116. $('#addRentRefundForm').form('submit',{
  117. url : whzl.basePath+'/rentRefundAction_addRentRefund',
  118. success : function(result){
  119. parent.$.messager.progress('close');
  120. var parseResult = $.parseJSON(result);
  121. if(parseResult.success){
  122. $("#addRentRefundDialog").dialog("close");
  123. $("#houseDataGrid").datagrid("reload");
  124. }else{
  125. $.messager.alert("提示",parseResult.message);
  126. }
  127. }
  128. });
  129. }
  130. </script>
  131. <table class="mytable" style="width: 100%;">
  132. <tr>
  133. <th width="9%">房源地址</th>
  134. <td width="20%"><span id="houseAddress"></span></td>
  135. <th width="9%">面积</th>
  136. <td width="9%"><span id="houseArea"></span></td>
  137. <th width="9%">租金</th>
  138. <td width="9%"><span id="housePrice"></span></td>
  139. <th width="9%">车库面积</th>
  140. <td width="9%"><span id="garageArea"></span></td>
  141. <th width="9%">车库租金</th>
  142. <td><span id="garagePrice"></span></td>
  143. </tr>
  144. <tr>
  145. <th>身份证号</th>
  146. <td><span id="idCard"></span></td>
  147. <th>姓名</th>
  148. <td><span id="securityPersonName"></span></td>
  149. <th>联系电话</th>
  150. <td><span id="phone"></span></td>
  151. <th>收入类别</th>
  152. <td><span id="personType"></span></td>
  153. </tr>
  154. </table>
  155. <form id="addRentRefundForm" method="post">
  156. <table class="mytable" style="width: 100%;table-layout: fixed">
  157. <tr>
  158. <th width="25%">租金到期时间</th>
  159. <td width="25%">
  160. <span id="endDay"></span>
  161. <input type="hidden" id="endDay_add" name="rentRefund.endDay"/>
  162. <input type="hidden" id="houseId_add" name="rentRefund.houseId">
  163. <input type="hidden" id="securityPersonId_add" name="rentRefund.securityPersonId">
  164. <input type="hidden" id="securityPersonName_add" name="rentRefund.securityPersonName">
  165. <input type="hidden" id="idCard_add" name="rentRefund.idCard">
  166. <input type="hidden" id="phone_add" name="rentRefund.phone">
  167. <input type="hidden" id="personType_add" name="rentRefund.personType">
  168. <input type="hidden" id="houseAddress_add" name="rentRefund.houseAddress">
  169. <input type="hidden" id="area_add" name="rentRefund.area">
  170. <input type="hidden" id="garageArea_add" name="rentRefund.garageArea">
  171. <input type="hidden" id="housePrice_add" name="rentRefund.housePrice">
  172. <input type="hidden" id="garagePrice_add" name="rentRefund.garagePrice">
  173. </td>
  174. <th width="25%">截止时间</th>
  175. <td width="25%">
  176. <input type="text" id="startDay_add" name="rentRefund.startDay" class="easyui-datebox" style='width: 110px;'/>
  177. <input type="button" value="计算" onclick="calculate()">
  178. </td>
  179. </tr>
  180. <tr>
  181. <th>退还月份</th>
  182. <td>
  183. <span id="refundMonth"></span>
  184. <input type="hidden" id="refundMonth_add" name="rentRefund.refundMonth"/>
  185. </td>
  186. <th>退还金额</th>
  187. <td>
  188. <span id="refundMoney"></span>
  189. <input type="hidden" id="refundMoney_add" name="rentRefund.refundMoney"/>
  190. </td>
  191. </tr>
  192. <tr>
  193. <th>备注</th>
  194. <td colspan="3">
  195. <textarea rows="4" cols="70" id="remark_add" name="rentRefund.remark"></textarea>
  196. </td>
  197. </tr>
  198. </table>
  199. </form>