123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211 |
- <%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
- <script type="text/javascript">
- var communityPrice = 0;
- //车库单价
- var garagePrice = 0;
- //房源面积
- var area = 0
- //车库面积
- var garageArea = 0
-
- function addRentRefund_load(houseId){
- $.ajax({
- type: "post",//使用get方法访问后台
- dataType: "json",//返回json格式的数据
- async: false,
- url: "houseAction_findById",//要访问的后台地址
- data: "house.id="+houseId,//要发送的数据
- complete :function(){$("#load").hide();},//AJAX请求完成时隐藏loading提示
- success: function(msg){
- if(msg.success){
- $("#houseAddress").text(msg.obj.address);
- $("#houseArea").text(msg.obj.area);
- $("#housePrice").text(msg.obj.housePrice);
- $("#garageArea").text(msg.obj.garageArea);
- $("#garagePrice").text(msg.obj.garagePrice);
- $("#endDay").text(dealDate(msg.obj.endTime));
- $("#endDay_add").val(dealDate(msg.obj.endTime));
-
- $("#houseId_add").val(msg.obj.id);
- $("#houseAddress_add").val(msg.obj.address);
- $("#area_add").val(msg.obj.area);
- $("#garageArea_add").val(msg.obj.garageArea);
- $("#housePrice_add").val(msg.obj.housePrice);
- $("#garagePrice_add").val(msg.obj.garagePrice);
-
- communityPrice = msg.obj.housePrice;
- garagePrice = msg.obj.garagePrice;
- area = msg.obj.area;
- garageArea = msg.obj.garageArea;
-
- if(msg.obj.lessee != null && msg.obj.lessee != ""){
- $("#idCard").text(msg.obj.lesseeId)
- $("#securityPersonName").text(msg.obj.lessee);
- $("#phone").text(msg.obj.lesseeTel);
- $("#personType").text(msg.obj.incomeType);
-
- $("#securityPersonName_add").val(msg.obj.lessee);
- $("#idCard_add").val(msg.obj.lesseeId);
- $("#phone_add").val(msg.obj.lesseeTel);
- $("#personType_add").val(msg.obj.incomeType);
- }
- }
- }
- })
- $.ajax({
- type: "post",//使用get方法访问后台
- dataType: "json",//返回json格式的数据
- async: false,
- url: "rent10Action_findSecurityPersonByHouseId",//要访问的后台地址
- data: "house.id="+houseId,//要发送的数据
- complete :function(){$("#load").hide();},//AJAX请求完成时隐藏loading提示
- success: function(msg){
- if(msg.success){
- if(msg.obj!=undefined){
- $("#idCard").text(msg.obj.securityPerson.idCard)
- $("#securityPersonName").text(msg.obj.securityPerson.name);
- $("#phone").text(msg.obj.securityPerson.phone);
- $("#personType").text(msg.obj.securityPerson.personType);
-
- $("#securityPersonId_add").val(msg.obj.securityPerson.id);
- $("#securityPersonName_add").val(msg.obj.securityPerson.name);
- $("#idCard_add").val(msg.obj.securityPerson.idCard);
- $("#phone_add").val(msg.securityPerson.phone);
- $("#personType_add").val(msg.obj.securityPerson.personType);
- }
- }
- }
- })
- }
-
- function calculate(){
- var startDay = $("#startDay_add").datebox('getValue');
- var endDay = $("#endDay").text();
- month = countMonth(startDay,endDay);
- $("#refundMonth").text(month);
- $("#refundMonth_add").val(month);
-
- var refundMoney =0;
- var discount = 0;
- if($("#personType_add").val()== 1){
- discount = 0.1;
- }else if($("#personType_add").val()== 2){
- discount = 0.3;
- }else{
- discount = 0.7;
- }
- var houseMoney = Number(Number(communityPrice * area)+Number(garagePrice * garageArea)).toFixed(2);
- refundMoney = Number(houseMoney * month * discount * 0.5).toFixed(2);
- $("#refundMoney").text(refundMoney);
- $("#refundMoney_add").val(refundMoney);
- }
-
- function countMonth(start,end){
- var endDate = new Date(end);
- var startDate = new Date(start);
- var renNumber = 0;
- var yearToMonth = (endDate.getFullYear() - startDate.getFullYear()) * 12;
- var monthToMonth = endDate.getMonth() - startDate.getMonth();
- var day = endDate.getDate() - startDate.getDate();
- if(day>0){
- renNumber = yearToMonth + monthToMonth +1;
- }else{
- renNumber = yearToMonth + monthToMonth;
- }
- return renNumber;
- }
-
- var addRentRefund_submit = function(){
- if($("refundMoney_add").val()==''){
- $.messager.alert("提示","请计算退还金额");
- }
- parent.$.messager.progress({
- title : '提示',
- text : '数据处理中,请稍候....'
- });
- $('#addRentRefundForm').form('submit',{
- url : whzl.basePath+'/rentRefundAction_addRentRefund',
- success : function(result){
- parent.$.messager.progress('close');
- var parseResult = $.parseJSON(result);
- if(parseResult.success){
- $("#addRentRefundDialog").dialog("close");
- $("#houseDataGrid").datagrid("reload");
- }else{
- $.messager.alert("提示",parseResult.message);
- }
- }
- });
- }
- </script>
- <table class="mytable" style="width: 100%;">
- <tr>
- <th width="9%">房源地址</th>
- <td width="20%"><span id="houseAddress"></span></td>
- <th width="9%">面积</th>
- <td width="9%"><span id="houseArea"></span></td>
- <th width="9%">租金</th>
- <td width="9%"><span id="housePrice"></span></td>
- <th width="9%">车库面积</th>
- <td width="9%"><span id="garageArea"></span></td>
- <th width="9%">车库租金</th>
- <td><span id="garagePrice"></span></td>
-
- </tr>
- <tr>
- <th>身份证号</th>
- <td><span id="idCard"></span></td>
- <th>姓名</th>
- <td><span id="securityPersonName"></span></td>
- <th>联系电话</th>
- <td><span id="phone"></span></td>
- <th>收入类别</th>
- <td><span id="personType"></span></td>
- </tr>
- </table>
- <form id="addRentRefundForm" method="post">
- <table class="mytable" style="width: 100%;table-layout: fixed">
- <tr>
- <th width="25%">租金到期时间</th>
- <td width="25%">
- <span id="endDay"></span>
- <input type="hidden" id="endDay_add" name="rentRefund.endDay"/>
-
- <input type="hidden" id="houseId_add" name="rentRefund.houseId">
- <input type="hidden" id="securityPersonId_add" name="rentRefund.securityPersonId">
- <input type="hidden" id="securityPersonName_add" name="rentRefund.securityPersonName">
- <input type="hidden" id="idCard_add" name="rentRefund.idCard">
- <input type="hidden" id="phone_add" name="rentRefund.phone">
- <input type="hidden" id="personType_add" name="rentRefund.personType">
- <input type="hidden" id="houseAddress_add" name="rentRefund.houseAddress">
- <input type="hidden" id="area_add" name="rentRefund.area">
- <input type="hidden" id="garageArea_add" name="rentRefund.garageArea">
- <input type="hidden" id="housePrice_add" name="rentRefund.housePrice">
- <input type="hidden" id="garagePrice_add" name="rentRefund.garagePrice">
- </td>
- <th width="25%">截止时间</th>
- <td width="25%">
- <input type="text" id="startDay_add" name="rentRefund.startDay" class="easyui-datebox" style='width: 110px;'/>
- <input type="button" value="计算" onclick="calculate()">
- </td>
- </tr>
- <tr>
- <th>退还月份</th>
- <td>
- <span id="refundMonth"></span>
- <input type="hidden" id="refundMonth_add" name="rentRefund.refundMonth"/>
- </td>
- <th>退还金额</th>
- <td>
- <span id="refundMoney"></span>
- <input type="hidden" id="refundMoney_add" name="rentRefund.refundMoney"/>
- </td>
- </tr>
- <tr>
- <th>备注</th>
- <td colspan="3">
- <textarea rows="4" cols="70" id="remark_add" name="rentRefund.remark"></textarea>
- </td>
- </tr>
- </table>
- </form>
|