<!DOCTYPE html>
<html>
<head>
  <meta charset="utf-8">
  <title>系统设置</title>
  <meta name="renderer" content="webkit">
  <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
  <meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=0">
  <link rel="stylesheet" href="../../layuiadmin/layui/css/layui.css" media="all">
  <link rel="stylesheet" href="../../layuiadmin/style/admin.css" media="all">
</head>
<body>

  <div class="layui-fluid">
    <div class="layui-card">
        <div class="layui-card-body" pad15>
        <div class="layui-row layui-col-space15">
          <div class="layui-col-md12">
              <form class="layui-form" action="" lay-filter="component-form-element">
                <table class="layui-table">
                    <tr>
                        <td class="cell" width="120">公司全称：</td>
                        <td class="cell">
                            <input type="text" id="id_company_full_name" name="company_full_name" lay-verify="required" autocomplete="off" class="layui-input">
                        </td>
                    </tr>
                    <tr>
                        <td class="cell">公司简称：</td>
                        <td class="cell">
                            <input type="text" id="id_company_short_name" name="company_short_name" lay-verify="required" autocomplete="off" class="layui-input">
                        </td>
                    </tr>
                    <tr>
                        <td class="cell">公司账号：</td>
                        <td class="cell">
                            <input type="text" id="id_company_account" name="company_account" autocomplete="off" class="layui-input">
                        </td>
                    </tr>
                    <tr>
                        <td class="cell">开户银行：</td>
                        <td class="cell">
                            <input type="text" id="id_company_bank" name="company_bank" autocomplete="off" class="layui-input">
                        </td>
                    </tr>
                    <tr>
                        <td class="cell">信用代码：</td>
                        <td class="cell">
                            <input type="text" id="id_company_creditno" name="company_creditno" autocomplete="off" class="layui-input">
                        </td>
                    </tr>
                    <tr>
                        <td class="cell">默认车牌号前缀：</td>
                        <td class="cell">
                            <input type="text" id="id_default_platenumber_prefix" name="default_platenumber_prefix" autocomplete="off" class="layui-input">
                        </td>
                    </tr>
                    <tr>
                        <td class="cell">默认税率：</td>
                        <td class="cell">
                            <input type="number" id="id_default_tax_rate" name="default_tax_rate" autocomplete="off" class="layui-input">
                        </td>
                    </tr>
                    <tr>
                        <td class="cell"></td>
                        <td class="cell">
                            <button class="layui-btn" lay-submit lay-filter="component-form-element">保存设置</button>
                        </td>
                    </tr>
                </table>
              </form>
          </div>
        </div>
        </div>
    </div>
  </div>

  <script src="../../layuiadmin/layui/layui.js?t=1"></script>
  <script>
  layui.config({
    base: '../../../layuiadmin/'
  }).extend({
    index: 'lib/index'
  }).use(['index', 'form'], function(){
    var $ = layui.$
    ,form = layui.form
    ,admin = layui.admin;

    admin.req({
      url: '/foundation/config/data/',
      done: function(res){
        var data = res.data;
        for (var k in data) {
            var v = data[k];
            $('#id_' + k).val(v);
        }
        form.render();
      }
    });

    form.on('submit(component-form-element)', function(data){
      admin.req({
        url: '/foundation/config/save/'
        ,data: JSON.stringify(data.field)
        ,type: 'post'
        ,done: function(res){
            layer.msg('保存成功！', {icon: 6});
        }
    });

      return false;
    });
  });
  </script>
</body>
</html>

