init
Showing
2 changed files
with
116 additions
and
2 deletions
| ... | @@ -14,7 +14,11 @@ class Config extends CI_Controller { | ... | @@ -14,7 +14,11 @@ class Config extends CI_Controller { |
| 14 | 14 | ||
| 15 | public function edit($id = null) | 15 | public function edit($id = null) |
| 16 | { | 16 | { |
| 17 | var_dump($id); | 17 | $res = json_decode(file_get_contents('http://151.28ms.com:8088/config/product/' . $id)); |
| 18 | $this->load->view('config/add'); | 18 | $data = $res->data; |
| 19 | $arr = array( | ||
| 20 | 'data'=>$data | ||
| 21 | ); | ||
| 22 | $this->load->view('config/edit',$arr); | ||
| 19 | } | 23 | } |
| 20 | } | 24 | } | ... | ... |
application/views/config/edit.php
0 → 100644
| 1 | <?php $this->load->view('common/header'); ?> | ||
| 2 | |||
| 3 | <body> | ||
| 4 | <div class="panel panel-default mb-20"> | ||
| 5 | <div class="panel-body cl"> | ||
| 6 | <form action='config/product' method="post" class="form form-horizontal" id="add"> | ||
| 7 | <div class="row cl"> | ||
| 8 | <div class="form-group col-sm-4 col-md-2"> | ||
| 9 | <label>产品名称</label> | ||
| 10 | <input type="text" name="productName" class="form-control input-text" value="<?=$data->productName?>"> | ||
| 11 | </div> | ||
| 12 | </div> | ||
| 13 | <div class="row cl"> | ||
| 14 | <div class="form-group col-sm-4 col-md-2"> | ||
| 15 | <label>年化利率</label> | ||
| 16 | <input type="text" class="form-control input-text" name="annualInterestRate" value="<?=$data->annualInterestRate?>"> | ||
| 17 | <span class="glyphicon form-control-feedback">%</span> | ||
| 18 | </div> | ||
| 19 | </div> | ||
| 20 | <div class="row cl"> | ||
| 21 | <div class="form-group col-sm-4 col-md-2"> | ||
| 22 | <label>罚息</label> | ||
| 23 | <smail class="c-999">罚息=利率*N%</smail> | ||
| 24 | <input name="interestPenalty" type="text" class="form-control input-text" value="" placeholder="请输入N"> | ||
| 25 | </div> | ||
| 26 | </div> | ||
| 27 | <div class="row cl"> | ||
| 28 | <div class="form-group col-sm-4 col-md-2"> | ||
| 29 | <label>滞纳金</label> | ||
| 30 | <input name="overdueFine" type="text" class="form-control input-text" value=""> | ||
| 31 | </div> | ||
| 32 | </div> | ||
| 33 | <div class="row cl"> | ||
| 34 | <div class="form-group col-sm-4 col-md-2"> | ||
| 35 | <label>还款方式</label> | ||
| 36 | <span class="form-control select-box"> | ||
| 37 | <select class="select" size="1" name="repaymentMode"> | ||
| 38 | <option>请选择</option> | ||
| 39 | <option value="1">1</option> | ||
| 40 | </select> | ||
| 41 | </span> | ||
| 42 | </div> | ||
| 43 | </div> | ||
| 44 | <div class="row cl"> | ||
| 45 | <div class="form-group col-sm-4 col-md-2"> | ||
| 46 | <label>借款期限</label> | ||
| 47 | <input name="loanDeadline" type="text" class="form-control input-text" value=""> | ||
| 48 | <span class="glyphicon form-control-feedback">月</span> | ||
| 49 | </div> | ||
| 50 | </div> | ||
| 51 | <div class="row cl"> | ||
| 52 | <div class="form-group col-sm-4 col-md-2"> | ||
| 53 | <label>授额上限</label> | ||
| 54 | <input type="text" name="loanLimit" class="form-control input-text" value=""> | ||
| 55 | <span class="glyphicon form-control-feedback">元</span> | ||
| 56 | </div> | ||
| 57 | </div> | ||
| 58 | <div class="row cl"> | ||
| 59 | <div class="form-group col-sm-12 col-md-12"> | ||
| 60 | <label>备注</label> | ||
| 61 | <textarea name="remark" class="textarea"></textarea> | ||
| 62 | </div> | ||
| 63 | </div> | ||
| 64 | </form> | ||
| 65 | </div> | ||
| 66 | </div> | ||
| 67 | |||
| 68 | <div class="row cl col-sm-12 pb-20"> | ||
| 69 | <div class="col-sm-2"> | ||
| 70 | <button class="btn btn-primary btn-block" onclick="save();">保存</button> | ||
| 71 | </div> | ||
| 72 | <div class="col-sm-2"> | ||
| 73 | <button class="btn btn-warning btn-block" onclick="layer_close();">取消</button> | ||
| 74 | </div> | ||
| 75 | </div> | ||
| 76 | |||
| 77 | <?php $this->load->view('common/footer'); ?> | ||
| 78 | |||
| 79 | <script> | ||
| 80 | function save() { | ||
| 81 | var targetUrl = $("#add").attr("action"); | ||
| 82 | var data = $("#add").serializeJson(); | ||
| 83 | $.ajax({ | ||
| 84 | type: 'post', | ||
| 85 | url: apiBaseUrl + targetUrl, | ||
| 86 | cache: false, | ||
| 87 | data: JSON.stringify(data), | ||
| 88 | dataType: 'json', | ||
| 89 | contentType: "application/json; charset=UTF-8", | ||
| 90 | success: function (data) { | ||
| 91 | if (data.msg) { | ||
| 92 | layer.alert(data.msg); | ||
| 93 | } else if (data.code != 0) { | ||
| 94 | layer.alert('请求失败'); | ||
| 95 | } else { | ||
| 96 | layer.alert('请求成功'); | ||
| 97 | } | ||
| 98 | if(!data.code) { | ||
| 99 | window.parent.reload(); | ||
| 100 | layer_close(); | ||
| 101 | } | ||
| 102 | }, | ||
| 103 | error: function () { | ||
| 104 | layer.alert("请求失败") | ||
| 105 | } | ||
| 106 | }) | ||
| 107 | } | ||
| 108 | </script> | ||
| 109 | </body> | ||
| 110 | </html> |
-
Please register or sign in to post a comment