charge_add.html 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354
  1. <title>收费管理</title>
  2. <div class="layui-card layadmin-header">
  3. <div class="layui-breadcrumb" lay-filter="breadcrumb">
  4. <a lay-href="">主页</a>
  5. <a><cite>车辆检测管理</cite></a>
  6. <a><cite>收费管理</cite></a>
  7. </div>
  8. </div>
  9. <div class="layui-fluid">
  10. <div class="layui-card">
  11. <div class="layui-card-body" id="getInfo">
  12. <button class="layui-btn" data-type="getCarInfo" id="LAY_layer_iframe_demo">获取数据</button>
  13. </div>
  14. <!--<div class="layui-card-header">收费管理</div>-->
  15. <div class="layui-card-body" style="padding: 15px;">
  16. <form class="layui-form" action="" lay-filter="component-form-group">
  17. <!--<div class="layui-col-md4">-->
  18. <!--<label class="layui-form-label">移交单位<span style="color:red">*</span></label>-->
  19. <!--<div class="layui-input-block">-->
  20. <!--<input type="text" name="HandoverCompany" id="HandoverCompany" class="layui-input" style="position:absolute;z-index:2;width:80%;" lay-verify="required" value="111" onkeyup="search()" autocomplete="off">-->
  21. <!--<select type="text" id="hc_select" lay-filter="hc_select" autocomplete="off" placeholder="移交单位全称" lay-verify="required" class="layui-select" lay-search>-->
  22. <!--<option value="111">111</option>-->
  23. <!--<option value="222">222</option>-->
  24. <!--<option value="333">333</option>-->
  25. <!--<option value="444">444</option>-->
  26. <!--<option value="555">555</option>-->
  27. <!--</select>-->
  28. <!--</div>-->
  29. <!--</div>-->
  30. <div class="layui-form-item">
  31. <div class="layui-inline">
  32. <label class="layui-form-label">车牌号码</label>
  33. <div class="layui-input-inline">
  34. <input type="text" name="license" lay-verify="required" autocomplete="off" class="layui-input" id="LAY_license">
  35. </div>
  36. </div>
  37. <div class="layui-inline">
  38. <label class="layui-form-label">车架号</label>
  39. <div class="layui-input-inline">
  40. <input type="text" name="VIN" lay-verify="required" autocomplete="off" class="layui-input" id="LAY_VIN">
  41. </div>
  42. </div>
  43. <div class="layui-inline">
  44. <label class="layui-form-label">所有人</label>
  45. <div class="layui-input-inline">
  46. <input type="text" name="owner" lay-verify="required" autocomplete="off" class="layui-input" id="LAY_owner">
  47. </div>
  48. </div>
  49. <div class="layui-inline">
  50. <label class="layui-form-label">环保检测</label>
  51. <div class="layui-input-inline layui-form" lay-filter="detectionSelect">
  52. <select name="EP_type" lay-verify="required" lay-search="" lay-filter="detectionChangeType" id="detectionSelect">
  53. </select>
  54. </div>
  55. </div>
  56. <div class="layui-inline">
  57. <label class="layui-form-label">环检应收</label>
  58. <div class="layui-input-inline">
  59. <input type="text" class="layui-input" name="EP_receivable" id="HJYS" value="200" readonly unselectable="on" style="background-color: #e4e4e4">
  60. </div>
  61. </div>
  62. <div class="layui-inline">
  63. <label class="layui-form-label">挂账客户</label>
  64. <div class="layui-input-inline layui-form" lay-filter="customerSelect">
  65. <select name="customer" lay-search="" id="customerSelect"></select>
  66. </div>
  67. </div>
  68. <div class="layui-inline">
  69. <label class="layui-form-label">车型判断</label>
  70. <div class="layui-input-inline layui-form" lay-filter="carTypeSelect">
  71. <select name="car_type" lay-verify="required" lay-search="" lay-filter="carChangeType" id="carTypeSelect"></select>
  72. </div>
  73. </div>
  74. <div class="layui-inline">
  75. <label class="layui-form-label">安检应收</label>
  76. <div class="layui-input-inline">
  77. <input type="text" name="Safe_receivable" class="layui-input" id="AJYS" value="150" readonly unselectable="on" style="background-color: #e4e4e4">
  78. </div>
  79. </div>
  80. <div class="layui-inline">
  81. <label class="layui-form-label">应收总和</label>
  82. <div class="layui-input-inline" >
  83. <input type="text" name="receivable" class="layui-input" id="YSZH" value="350" readonly unselectable="on" style="background-color: #e4e4e4">
  84. </div>
  85. </div>
  86. <div class="layui-inline">
  87. <label class="layui-form-label">支付宝金额</label>
  88. <div class="layui-input-inline" >
  89. <input type="text" name="ali_pay" lay-verify="ali_pay" class="layui-input" id="ali_pay" autocomplete="off" placeholder="0" >
  90. </div>
  91. </div>
  92. <div class="layui-inline">
  93. <label class="layui-form-label">挂账金额</label>
  94. <div class="layui-input-inline" >
  95. <input type="text" name="on_account" lay-verify="on_account" class="layui-input" id="on_account" autocomplete="off" placeholder="0" >
  96. </div>
  97. </div>
  98. <div class="layui-inline">
  99. <label class="layui-form-label">实收总和</label>
  100. <div class="layui-input-inline" >
  101. <input type="text" name="cost" class="layui-input" id="SSZH" value="350">
  102. </div>
  103. </div>
  104. <div class="layui-inline">
  105. <label class="layui-form-label">手机</label>
  106. <div class="layui-input-inline">
  107. <input type="tel" name="telephone" autocomplete="off" class="layui-input" id="telephone"><!--lay-verify="phone"-->
  108. </div>
  109. </div>
  110. <div class="layui-inline">
  111. <label class="layui-form-label">签约客户</label>
  112. <div class="layui-input-inline layui-form" lay-filter="contractedSelect">
  113. <select name="contracted_customer" lay-search="" id="contractedSelect" lay-filter="contractedType"></select>
  114. </div>
  115. </div>
  116. <!--<div class="layui-inline">-->
  117. <!--<label class="layui-form-label">日期</label>-->
  118. <!--<div class="layui-input-inline">-->
  119. <!--<input type="text" name="date" id="LAY-component-form-group-date" lay-verify="date" autocomplete="off" class="layui-input" style="background-color: #e4e4e4">-->
  120. <!--</div>-->
  121. <!--</div>-->
  122. </div>
  123. <div class="layui-form-item layui-form-text">
  124. <label class="layui-form-label">备注</label>
  125. <div class="layui-input-block">
  126. <textarea name="remarks" placeholder="请输入内容" class="layui-textarea" style="width: 80%" id="remarks"></textarea>
  127. </div>
  128. </div>
  129. <div class="layui-form-item">
  130. <div class="layui-input-block">
  131. <div class="layui-footer">
  132. <button class="layui-btn" lay-submit="" lay-filter="component-form-demo1">立即提交</button>
  133. <button type="reset" class="layui-btn layui-btn-primary">重置</button>
  134. </div>
  135. </div>
  136. </div>
  137. </form>
  138. </div>
  139. </div>
  140. </div>
  141. <script>
  142. layui.use(['admin', 'form', 'laydate'], function(){
  143. var $ = layui.$
  144. ,admin = layui.admin
  145. ,element = layui.element
  146. ,layer = layui.layer
  147. ,laydate = layui.laydate
  148. ,form = layui.form;
  149. form.render(null, 'component-form-group');
  150. // laydate.render({
  151. // elem: '#LAY-component-form-group-date',
  152. // value: new Date(),
  153. // format:'yyyy-MM-dd',
  154. // });
  155. form.verify({
  156. on_account:function (value) {
  157. if (value==="") {
  158. $('#on_account').val(0)//为空自动赋值0
  159. }else {
  160. if (isNaN(value)){
  161. return "请输入数字!"
  162. }
  163. }
  164. },
  165. ali_pay:function (value) {
  166. if (value==="") {
  167. $('#ali_pay').val(0)//为空自动赋值0
  168. }else {
  169. if (isNaN(value)){
  170. return "请输入数字!"
  171. }
  172. }
  173. }
  174. });
  175. $('#on_account').focus(function () {
  176. if($('#customerSelect').val()===""){
  177. $('#on_account').val(0)//为空自动赋值0
  178. layer.msg("需要先选择挂账客户!")
  179. }
  180. })
  181. //常用挂账客户
  182. $.ajax({
  183. url:"/customer/getCustomer",
  184. success:function (res) {
  185. var data = res;
  186. $.each(data,function (index,item) {
  187. if (index===0){
  188. $('#customerSelect').append('<option value="">'+item.name+'</option>');
  189. }else {
  190. $('#customerSelect').append('<option value="'+item.name+'">'+item.name+'</option>');
  191. }
  192. });
  193. form.render('select', 'customerSelect');
  194. }
  195. });
  196. //签约客户
  197. $.ajax({
  198. url:"/contracted/getContracted",
  199. success:function (res) {
  200. var data = res;
  201. $.each(data,function (index,item) {
  202. if (index===0){
  203. $('#contractedSelect').append('<option value="">'+item.name+'</option>');
  204. }else {
  205. $('#contractedSelect').append('<option value="'+item.name+'">'+item.name+'</option>');
  206. }
  207. });
  208. form.render('select', 'contractedSelect');
  209. }
  210. });
  211. //环检下拉
  212. $.ajax({
  213. url:"/chargingStandard/getSelect",
  214. type:'POST',
  215. data:{"project":"环检"},
  216. success:function (res) {
  217. var data = res;
  218. $.each(data,function (index,item) {
  219. $('#detectionSelect').append('<option value="'+item.carType+'">'+item.carType+'</option>');
  220. });
  221. form.render('select', 'detectionSelect');
  222. }
  223. });
  224. //安检下拉
  225. $.ajax({
  226. url:"/chargingStandard/getSelect",
  227. type:'POST',
  228. data:{"project":"安检"},
  229. success:function (res) {
  230. var data = res;
  231. $.each(data,function (index,item) {
  232. $('#carTypeSelect').append('<option value="'+item.carType+'">'+item.carType+'</option>');
  233. });
  234. form.render('select', 'carTypeSelect');
  235. }
  236. });
  237. //根据carType(安检)改变,联动默认价格
  238. form.on('select(carChangeType)',function (data) {
  239. $.ajax({
  240. url:"/chargingStandard/getSelect",
  241. type:'POST',
  242. data:{"carType":data.value},
  243. success:function (res) {
  244. $('#AJYS').val(res[0].cost);
  245. $('#YSZH').val(parseInt($('#AJYS').val()) + parseInt($('#HJYS').val()));//应收总和
  246. $('#SSZH').val($('#YSZH').val());
  247. }
  248. })
  249. });
  250. //根据EP_type(环检)改变,联动默认价格
  251. form.on('select(detectionChangeType)',function (data) {
  252. $.ajax({
  253. url:"/chargingStandard/getSelect",
  254. type:'POST',
  255. data:{"carType":data.value},
  256. success:function (res) {
  257. $('#HJYS').val(res[0].cost);
  258. $('#YSZH').val(parseInt($('#AJYS').val()) + parseInt($('#HJYS').val()))//应收总和
  259. $('#SSZH').val($('#YSZH').val());
  260. }
  261. })
  262. });
  263. //根据签约客户的选择,自动添加备注内容和手机号
  264. form.on('select(contractedType)',function (data) {
  265. $.ajax({
  266. url:"/contracted/getList",
  267. type:"POST",
  268. data:{"name":data.value},
  269. success:function (res) {
  270. //给备注栏赋值
  271. $('#remarks').val(res.data[0].remarks)
  272. //给手机号码赋值
  273. $('#telephone').val(res.data[0].phone)
  274. }
  275. })
  276. });
  277. /* 监听提交 */
  278. form.on('submit(component-form-demo1)', function(data){
  279. // layer.alert(JSON.stringify(data.field), {
  280. // title: '最终的提交信息'
  281. // })
  282. // return false;
  283. admin.req({
  284. url:"/charge/saveCharge",
  285. type:'POST',
  286. data:data.field,
  287. done:function (res) {
  288. if (res.code===0){
  289. layer.msg("提交成功")
  290. }else {
  291. layer.msg(res.msg)
  292. }
  293. }
  294. })
  295. });
  296. //
  297. var active = {
  298. getCarInfo: function(){
  299. layer.open({
  300. type: 2,
  301. area: ['700px', '650px'],
  302. fixed: false,
  303. maxmin: true,
  304. content: layui.setter.base + 'views/detection/layer/getCarInfo.html'
  305. });
  306. }
  307. }
  308. $('#getInfo .layui-btn').on('click', function(){
  309. var type = $(this).data('type');
  310. active[type] && active[type].call(this);
  311. });
  312. //可搜索、可输入暂不启用
  313. // form.on('select(hc_select)', function (data) { //选择移交单位 赋值给input框
  314. // $("#HandoverCompany").val(data.value);
  315. // $("#hc_select").next().find("dl").css({ "display": "none" });
  316. // form.render();
  317. // });
  318. // window.search = function () {
  319. // var value = $("#HandoverCompany").val();
  320. // $("#hc_select").val(value);
  321. // form.render();
  322. // $("#hc_select").next().find("dl").css({ "display": "block" });
  323. // var dl = $("#hc_select").next().find("dl").children();
  324. // var j = -1;
  325. // for (var i = 0; i < dl.length; i++) {
  326. // if (dl[i].innerHTML.indexOf(value) <= -1) {
  327. // dl[i].style.display = "none";
  328. // j++;
  329. // }
  330. // if (j == dl.length-1) {
  331. // $("#hc_select").next().find("dl").css({ "display": "none" });
  332. // }
  333. // }
  334. // };
  335. });
  336. </script>