|
{layout name="layout" /}
<nav class="breadcrumb">
<span><a href="/" class="maincolor">首页</a></span>
<span>></span>
<span><a href="/company">购货单位管理</a></span>
<span>></span>
<span><a href="javascript:void(0);">{empty name="data.id"}新增{else/}修改{/empty}</a></span>
</nav>
<div class="content">
<div class="row">
<div class="blank">
</div>
</div>
<form role="form" id="form-seller" action="" method="POST">
<input type="hidden" name="id" id="id" value="{$data.id}">
<div class="row">
<div class="col-md-2">
<div class="form-group" style="text-align:right;line-height:40px;">
<label form-label for="name"><span class="c-red">*</span>名称:</label>
</div>
</div>
<div class="col-md-4">
<div class="form-group">
<input type="text" class="form-control" name="name" id="name" value="{$data.name}" placeholder="公司名称">
</div>
</div>
</div>
<div class="row">
<div class="col-md-2">
<div class="form-group" style="text-align:right;line-height:40px;">
<label form-label for="name">初期余额:</label>
</div>
</div>
<div class="col-md-4">
<div class="form-group">
<input type="number" class="form-control" name="initial_balance" id="initial_balance" value="{:number_format(bcdiv($data['initial_balance'],100,2),2)}" placeholder="初期余额">
</div>
</div>
</div>
<div class="row">
<div class="col-xs-8 col-sm-9 col-xs-offset-4 col-sm-offset-3">
<input class="btn btn-success radius" type="submit" value=" 提交 ">
<input class="btn btn-default radius" type="button" value=" 取消 " onClick="window.history.back();">
</div>
</div>
</form>
</div>
<div class="modal fade" id="myModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
<div class="modal-dialog" style="width: 800px;">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">
×
</button>
<h4 class="modal-title" id="myModalLabel">
新增销售单位
</h4>
</div>
<div class="modal-body">
<form role="form" id="company-form">
<input type="hidden" name="id" id="id" value="0">
<div class="row">
<div class="col-md-2">
<div class="form-group" style="text-align:right;line-height:40px;">
<label form-label for="name">公司名称:</label>
</div>
</div>
<div class="col-md-4">
<div class="form-group">
<input type="text" class="form-control" name="name" id="name" value="" placeholder="公司名称">
</div>
</div>
<span style='color:red;' id="error_msg"></span>
</div>
<div class="row">
<div class="col-md-2">
<div class="form-group" style="text-align:right;line-height:40px;">
<label form-label for="department">初期余额:</label>
</div>
</div>
<div class="col-md-4">
<div class="form-group">
<input type="number" class="form-control" name="initial_balance" id="initial_balance" value="" placeholder="初期余额">
</div>
</div>
</div>
</form>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-default" onclick="closeModel()">关闭</button>
<button type="button" class="btn btn-primary" onclick="save()">保存</button>
</div>
</div><!-- /.modal-content -->
</div><!-- /.modal -->
</div>
<script>
function closeModel() {
$("#error_msg").html('');
$("#company-form")[0].reset();
$('#myModal').modal('hide');
}
function modify(id, name, initial_balance) {
$("#id").val(id);
$("#name").val(name);
$("#initial_balance").val(initial_balance);
$('#myModal').modal('show');
}
function save(params) {
var id = $("#id").val();
var name = $("#name").val();
var initial_balance = Number($("#initial_balance").val());
$.post('/index/company/save', {
'id': id,
'name': name,
'initial_balance': initial_balance
}, function(res) {
if (res.code == 0) {
alert('保存成功');
$('#myModal').modal('hide');
$("#company-form")[0].reset();
window.location.reload();
} else {
// $("#company-form").children('div:first').append("<span style='color:red;'>" + res.msg + "</span>");
$("#error_msg").html(res.msg);
}
return false;
}, 'json');
return false;
}
</script>
|