water_fee_edit.html 6.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166
  1. <!DOCTYPE HTML>
  2. <html xmlns:th="http://www.thymeleaf.org"
  3. xmlns:layout="http://www.ultraq.net.nz/thymeleaf/layout"
  4. layout:decorate="~{admin/common/common}">
  5. <head>
  6. <title>水费编辑</title>
  7. <style>
  8. .line {
  9. display: block;
  10. text-align: left;
  11. background-color: #fff;
  12. color: #333;
  13. border-bottom: 1px solid #0a6999;
  14. border-color: #fff;
  15. border-bottom: 1px solid #0a6999;
  16. margin-top: 10px;
  17. vertical-align: middle;
  18. padding: 4px 12px;
  19. height: 31px;
  20. line-height: 31px;
  21. font-size: 14px;
  22. font-weight: bold;
  23. }
  24. .input-text {
  25. width: 110PX;
  26. }
  27. </style>
  28. </head>
  29. <body layout:fragment="content">
  30. <article class="page-container">
  31. <form class="form form-horizontal" id="form-electricWater-edit">
  32. <div class="line">基本信息</div>
  33. <div class="row cl">
  34. <label class="form-label col-xs-4 col-sm-2">客户名称:</label>
  35. <div class="formControls col-xs-8 col-sm-9">
  36. <span th:text="${companyName}"></span>
  37. </div>
  38. </div>
  39. <div class="row cl">
  40. <label class="form-label col-xs-4 col-sm-2">合同编号:</label>
  41. <div class="formControls col-xs-8 col-sm-9">
  42. <span th:each="contractNo,iterStat:${contractNoes}">
  43. [[*{contractNo}]] <span th:if="${iterStat.last}"></span><span th:unless="${iterStat.last}">,</span>
  44. </span>
  45. </div>
  46. </div>
  47. <div id="waterFee">
  48. <input type="hidden" th:value="${waterFee.id}" th:name="id">
  49. <div class="line">水费信息</div>
  50. <div>
  51. <div class="btn" style="margin-top: 15px">抄表信息</div>
  52. <table id="waterReadTb" class="table table-border table-bordered table-bg table-hover">
  53. <thead>
  54. <tr class="text-c">
  55. <th>水表名称</th>
  56. <th>上期抄表日</th>
  57. <th>本期抄表日</th>
  58. <th>用水量</th>
  59. <th>单价</th>
  60. <th>小计金额(元)</th>
  61. </tr>
  62. </thead>
  63. <tbody>
  64. <tr class="text-c water_read_company" th:each="water,iterStat:${waterReadCompanies}"
  65. th:object="${water}">
  66. <td th:text="*{water_name}"></td>
  67. <td th:text="*{meter_write_before}"></td>
  68. <td th:text="*{meter_write}"></td>
  69. <td class="use_water" th:text="*{use_water}"></td>
  70. <td>
  71. <input type="hidden" th:value="*{id}"
  72. th:name="'waterReadCompanies['+${iterStat.index}+'].id'"/>
  73. <input type="text" required number="true" min="0" max="999.9999" th:value="*{water_price}"
  74. class="input-text water_price"
  75. th:onchange="'isfloat4Fn(this);initTotalFee('+${iterStat.index}+');'"
  76. th:name="'waterReadCompanies['+${iterStat.index}+'].water_price'"/></td>
  77. <td><input type="text" th:value="*{total_fee}" class="input-text total_fee readonly" readonly
  78. th:name="'waterReadCompanies['+${iterStat.index}+'].total_fee'"/>
  79. </td>
  80. </tr>
  81. <tr class="text-c">
  82. <td scope="col" colspan="5">其他费用</td>
  83. <td>
  84. <input type="text" class="input-text other_fee" required number="true" min="0"
  85. max="999.9999" th:value="${waterFee.other_fee}" th:name="other_fee"
  86. onchange="isfloat4Fn(this);initTotalFee();"/></td>
  87. </tr>
  88. <tr class="text-c">
  89. <td scope="col" colspan="4">合计</td>
  90. <td><span>用水量:</span><span th:text="${waterFee.use_water}"></span><span>(吨)</span></td>
  91. <td><input type="text" class="input-text readonly water_fee" readonly
  92. th:value="${waterFee.water_fee}" th:name="water_fee"/></td>
  93. </tr>
  94. </tbody>
  95. </table>
  96. </div>
  97. </div>
  98. <div class="row cl">
  99. <label class="form-label col-xs-4 col-sm-2"><span class="c-red">*</span>是否已缴费:</label>
  100. <div class="formControls col-xs-8 col-sm-3">
  101. <span class="select-box">
  102. <select class="select" th:name="status" id="status" >
  103. <option value="0" th:selected="${waterFee.status}=='0'">未缴费</option>
  104. <option value="2" th:selected="${waterFee.status}=='2'">已缴费</option>
  105. </select>
  106. </span>
  107. </div>
  108. </div>
  109. <div class="row cl" id="manageRow">
  110. <div class="col-xs-8 col-sm-9 col-xs-offset-4 col-sm-offset-2">
  111. <button class="btn btn-primary radius" type="submit"><i class="Hui-iconfont">&#xe632;</i>保存</button>
  112. <button onClick="removeIframe();" class="btn btn-default radius" type="button">&nbsp;&nbsp;取消&nbsp;&nbsp;</button>
  113. </div>
  114. </div>
  115. </form>
  116. </article>
  117. <script type="text/javascript" th:src="@{/js/build/water/water_fee_edit.js}"></script>
  118. <script th:inline="javascript">
  119. /**
  120. * 取消
  121. */
  122. function removeIframe() {
  123. var index = parent.layer.getFrameIndex(window.name);
  124. parent.layer.close(index);
  125. }
  126. function initTotalFee(obj) {
  127. var all_fee = 0;
  128. var other_fee = $(".other_fee").val();
  129. $(".water_read_company").each(function (index, item) {
  130. if (index == obj && obj != null && $.trim(obj) != '') {
  131. $(item).find(".total_fee").val(parseFloat($(item).find(".water_price").val()) * parseFloat($(item).find(".use_water").text()));
  132. }
  133. if ($(item).find(".total_fee").val()) {
  134. all_fee += parseFloat($(item).find(".total_fee").val());
  135. } else {
  136. all_fee += 0;
  137. }
  138. });
  139. if (other_fee) {
  140. all_fee = accAdd(parseFloat(other_fee),all_fee);
  141. }
  142. $(".water_fee").val(all_fee);
  143. }
  144. function isfloat4Fn(obj) {
  145. var val = $(obj).val();
  146. if (/^\d+(\.\d{1,4})?$/.test(String(val)) == false) {
  147. errorMessage("小数点后最多4位小数");
  148. $(obj).val(0);
  149. }
  150. }
  151. </script>
  152. </body>
  153. </html>