payment.blade.php 10.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235
  1. @extends('admin/layout')
  2. @section('header')
  3. <link href="{{asset('css/plugins/chosen/chosen.css')}}" rel="stylesheet">
  4. <link href="{{asset('css/plugins/switchery/switchery.css')}}" rel="stylesheet">
  5. <style>
  6. .upload_img {
  7. height: 150px;
  8. }
  9. </style>
  10. @endsection
  11. @section('content')
  12. <body class="gray-bg">
  13. <div class="wrapper wrapper-content animated fadeInRight">
  14. <div class="row">
  15. <div class="col-sm-12">
  16. <div class="ibox float-e-margins">
  17. <div class="ibox-content">
  18. <form method="get" class="form-horizontal" id="form">
  19. <div class="form-group">
  20. <label class="col-sm-2 control-label" for="head">首付:</label>
  21. <div class="col-sm-8">
  22. <input type="text" class="form-control" id="head" name="head"
  23. value="{{$data->head??''}}">
  24. </div>
  25. </div>
  26. <div class="form-group">
  27. <label class="col-sm-2 control-label">首付快照:</label>
  28. <div class="col-sm-2">
  29. <button type="button" class="btn btn-primary" name="file_upload">文件上传
  30. </button>
  31. <input type="file" value="" style="display: none" name="uploadFile"
  32. data-for="head_img">
  33. <input type="hidden" id="head_pic" name="head_pic" value="{{$data->head_pic??''}}">
  34. </div>
  35. </div>
  36. <div class="form-group">
  37. <div class="col-sm-8 col-sm-offset-2">
  38. <img id="head_img" class="upload_img" src="{{$data->head_pic??''}}">
  39. </div>
  40. </div>
  41. <div class="hr-line-dashed"></div>
  42. <div class="form-group">
  43. <label class="col-sm-2 control-label" for="done">交款:</label>
  44. <div class="col-sm-8">
  45. <input type="text" class="form-control" id="done" name="done"
  46. value="{{$data->done??''}}">
  47. </div>
  48. </div>
  49. <div class="form-group">
  50. <label class="col-sm-2 control-label" for="done_pic">交款快照:</label>
  51. <div class="col-sm-2">
  52. <button type="button" class="btn btn-primary" name="file_upload">文件上传
  53. </button>
  54. <input type="file" value="" style="display: none" name="uploadFile"
  55. data-for="done_img">
  56. <input type="hidden" id="done_pic" name="done_pic"
  57. value="{{$data->done_pic??''}}">
  58. </div>
  59. </div>
  60. <div class="form-group">
  61. <div class="col-sm-8 col-sm-offset-2">
  62. <img id="done_img" class="upload_img" src="{{$data->done_pic??''}}">
  63. </div>
  64. </div>
  65. <div class="hr-line-dashed"></div>
  66. <div class="form-group">
  67. <label class="col-sm-2 control-label" for="reach">尾款:</label>
  68. <div class="col-sm-8">
  69. <input type="text" class="form-control" id="reach" name="reach"
  70. value="{{$data->reach??''}}">
  71. </div>
  72. </div>
  73. <div class="form-group">
  74. <label class="col-sm-2 control-label" for="reach_pic">尾款快照:</label>
  75. <div class="col-sm-2">
  76. <button type="button" class="btn btn-primary" name="file_upload">文件上传
  77. </button>
  78. <input type="file" value="" style="display: none" name="uploadFile"
  79. data-for="reach_img">
  80. <input type="hidden" class="form-control" id="reach_pic" name="reach_pic"
  81. value="{{$data->reach_pic??''}}">
  82. </div>
  83. </div>
  84. <div class="form-group">
  85. <div class="col-sm-8 col-sm-offset-2">
  86. <img id="reach_img" class="upload_img" src="{{$data->reach_pic??''}}">
  87. </div>
  88. </div>
  89. <div class="hr-line-dashed"></div>
  90. <div class="form-group">
  91. <label class="col-sm-2 control-label" for="renewal">续费:</label>
  92. <div class="col-sm-8">
  93. <input type="text" class="form-control" id="renewal" name="renewal"
  94. value="{{$data->renewal??''}}">
  95. </div>
  96. </div>
  97. <div class="form-group">
  98. <label class="col-sm-2 control-label" for="renewal_pic">续费快照:</label>
  99. <div class="col-sm-8">
  100. <button type="button" class="btn btn-primary" name="file_upload">文件上传
  101. </button>
  102. <input type="file" value="" style="display: none" name="uploadFile"
  103. data-for="renewal_img">
  104. <input type="hidden" id="renewal_pic" name="renewal_pic"
  105. value="{{$data->renewal_pic??''}}">
  106. </div>
  107. </div>
  108. <div class="form-group">
  109. <div class="col-sm-8 col-sm-offset-2">
  110. <img id="renewal_img" class="upload_img" src="{{$data->renewal_pic??''}}">
  111. </div>
  112. </div>
  113. <div class="hr-line-dashed"></div>
  114. <div class="form-group">
  115. <div class="col-sm-4 col-sm-offset-2">
  116. <button class="btn btn-primary" type="button" data-id="{{$data->id??$siteId}}"
  117. id="save">
  118. 保存
  119. </button>
  120. <button class="btn btn-white closeLayer" type="button">取消</button>
  121. </div>
  122. </div>
  123. </form>
  124. </div>
  125. </div>
  126. </div>
  127. </div>
  128. </div>
  129. </body>
  130. @endsection
  131. @section('footer')
  132. <script src="{{asset('js/plugins/chosen/chosen.jquery.js')}}"></script>
  133. <script src="{{asset('js/plugins/switchery/switchery.js')}}"></script>
  134. <script src="{{asset('js/plugins/layDate-v5.0.9/laydate/laydate.js')}}"></script>
  135. <script>
  136. $(document).on('click', '#save', function () {
  137. var id = $(this).data('id');
  138. var url = '/admin/sites/payment/' + id;
  139. var data = tips.getFormValues('#form');
  140. var ajaxConfig = {
  141. url: url,
  142. type: 'put',
  143. data: data,
  144. success: function (result) {
  145. layer.msg(result.message, {icon: 6, time: 1000}, function () {
  146. tips.closeParentLayer();
  147. window.parent.tips.tableRefresh('#table');
  148. });
  149. }
  150. };
  151. tips.ajax(ajaxConfig);
  152. });
  153. $(document).on('click', '[name=file_upload]', function () {
  154. $(this).next().trigger('click');
  155. });
  156. $(document).on('change', '[name=uploadFile]', function () {
  157. var _this = this;
  158. if (!$(this)[0].files[0]) {
  159. return;
  160. }
  161. var formData = new FormData();
  162. formData.append('file', $(this)[0].files[0]);
  163. var ln;
  164. $.ajax({
  165. url: '/admin/tool/upload',
  166. type: 'POST',
  167. cache: false,
  168. data: formData,
  169. processData: false,
  170. contentType: false,
  171. beforeSend: function () {
  172. ln = layer.load();
  173. },
  174. complete: function () {
  175. layer.close(ln);
  176. },
  177. success: function (result) {
  178. var data = result.data;
  179. $('#' + $(_this).data('for')).attr('src', data.file_url);
  180. $(_this).next().val(data.file_url);
  181. },
  182. error: function (XMLHttpRequest) {
  183. if (XMLHttpRequest.status === 500) {
  184. layer.alert("异步请求失败", {icon: 5});
  185. return;
  186. }
  187. layer.alert(JSON.parse(XMLHttpRequest.responseText).message, {icon: 0});
  188. }
  189. });
  190. });
  191. </script>
  192. @endsection