ad90a9ee by yangjianbin

init

1 parent 48392166
...@@ -12,14 +12,14 @@ ...@@ -12,14 +12,14 @@
12 </span> 12 </span>
13 </div> 13 </div>
14 14
15 <form> 15 <form id="form">
16 <div class="panel panel-default"> 16 <div class="panel panel-default">
17 <div class="panel-body"> 17 <div class="panel-body">
18 <div class="row cl"> 18 <div class="row cl">
19 <div class="form-group col-sm-3 col-md-2"> 19 <div class="form-group col-sm-3 col-md-2">
20 <label>产品名称</label> 20 <label>产品名称</label>
21 <span class="form-control select-box"> 21 <span class="form-control select-box">
22 <select class="select" size="1" id="product"> 22 <select class="select" size="1" id="productId">
23 <?php foreach ($this->session->products as $k=>$v):?> 23 <?php foreach ($this->session->products as $k=>$v):?>
24 <option data-repaymentMode="<?=$v->repaymentMode?>" data-loanDeadline="<?=$v->loanDeadline?>" value="<?=$v->id?>"><?=$v->productName?></option> 24 <option data-repaymentMode="<?=$v->repaymentMode?>" data-loanDeadline="<?=$v->loanDeadline?>" value="<?=$v->id?>"><?=$v->productName?></option>
25 <?php endforeach;?> 25 <?php endforeach;?>
...@@ -28,7 +28,7 @@ ...@@ -28,7 +28,7 @@
28 </div> 28 </div>
29 <div class="form-group col-sm-3 col-md-2"> 29 <div class="form-group col-sm-3 col-md-2">
30 <label>借款金额</label> 30 <label>借款金额</label>
31 <input type="text" class="form-control input-text" value=""> 31 <input name="borrowAmount" type="text" class="form-control input-text" value="">
32 <span class="glyphicon form-control-feedback"></span> 32 <span class="glyphicon form-control-feedback"></span>
33 </div> 33 </div>
34 <div class="form-group col-sm-3 col-md-2"> 34 <div class="form-group col-sm-3 col-md-2">
...@@ -49,12 +49,12 @@ ...@@ -49,12 +49,12 @@
49 <div class="row cl"> 49 <div class="row cl">
50 <div class="form-group col-sm-3 col-md-2"> 50 <div class="form-group col-sm-3 col-md-2">
51 <label>每月应还</label> 51 <label>每月应还</label>
52 <input type="text" class="form-control input-text" value="" disabled> 52 <input type="text" id="totalAmount" class="form-control input-text" value="" disabled>
53 <span class="glyphicon form-control-feedback"></span> 53 <span class="glyphicon form-control-feedback"></span>
54 </div> 54 </div>
55 <div class="form-group col-sm-3 col-md-2"> 55 <div class="form-group col-sm-3 col-md-2">
56 <label>总共应还</label> 56 <label>总共应还</label>
57 <input type="text" class="form-control input-text" value="" disabled> 57 <input type="text" id="totalRepay" class="form-control input-text" value="" disabled>
58 <span class="glyphicon form-control-feedback"></span> 58 <span class="glyphicon form-control-feedback"></span>
59 </div> 59 </div>
60 </div> 60 </div>
...@@ -63,7 +63,7 @@ ...@@ -63,7 +63,7 @@
63 63
64 <div class="row cl pb-20 col-sm-12"> 64 <div class="row cl pb-20 col-sm-12">
65 <div class="col-sm-offset-4 col-sm-2"> 65 <div class="col-sm-offset-4 col-sm-2">
66 <input class="btn btn-primary btn-block" value="计算" type="button"> 66 <input class="btn btn-primary btn-block" value="计算" onclick="submit()" type="button">
67 </div> 67 </div>
68 <div class="col-sm-2"> 68 <div class="col-sm-2">
69 <input class="btn btn-warning btn-block" value="重置" type="reset"> 69 <input class="btn btn-warning btn-block" value="重置" type="reset">
...@@ -79,6 +79,31 @@ ...@@ -79,6 +79,31 @@
79 $('#repaymentMode').val(data.repaymentmode); 79 $('#repaymentMode').val(data.repaymentmode);
80 $('#loanDeadline').val(data.loandeadline); 80 $('#loanDeadline').val(data.loandeadline);
81 }) 81 })
82
83 function submit (){
84 var borrowAmount = $('[name=borrowAmount]').val();
85 var productId = $('[name=productId]').val();
86 var str = 'borrowAmount=' + borrowAmount + '&productId=' + productId;
87 $.ajax({
88 type:'get',
89 url:apiBaseUrl + 'application/tool/interest?' + str,
90 cache: false,
91 dataType:'json',
92 contentType: "application/json; charset=UTF-8",
93 success:function(data){
94 if(data.code != 0){
95 layer.alert('请求失败');
96 } else {
97 $('#totalRepay').val(data.data.totalRepay);
98 $('#totalAmount').val(data.data[0].totalAmount);
99 }
100
101 },
102 error:function(){
103 layer.alert("请求失败")
104 }
105 })
106 }
82 </script> 107 </script>
83 </body> 108 </body>
84 <html> 109 <html>
......
Styling with Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!