You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
simple-yewu/frontend/views/gift/edit.php

120 lines
5.4 KiB

5 years ago
<?php
use \common\libs\MyLib;
?>
<?php $this->beginBlock('header_css'); ?>
<link rel="stylesheet" type="text/css" href="/assets/css/plugins/webuploader/webuploader.css">
<?php $this->endBlock(); ?>
<div class="wrapper wrapper-content animated fadeInRight">
<div class="ibox float-e-margins">
<div class="ibox-content">
<div class="row">
<div class="col-sm-12">
5 years ago
<form role="form" class="form-horizontal data-from" id="theFrm">
<input type="hidden" name="id" value="<?=intval($info->id)?>">
<div class="form-group">
<label class="col-sm-1 control-label">名称</label>
<div class="col-sm-3">
5 years ago
<input type="text" name="name" value="<?=$info->name?>" class="form-control">
</div>
<label class="col-sm-2 control-label">所属分类</label>
<div class="col-sm-2">
5 years ago
<select name="type_id" class="form-control">
<option value="0">---请选择---</option>
<option value="1" <?=$info->type_id==1?'selected':''?>>实物礼品</option>
<option value="2" <?=$info->type_id==2?'selected':''?>>礼券</option>
</select>
</div>
</div>
<div class="form-group">
<label class="control-label col-sm-1">图片</label>
<div class="col-sm-8">
<div class="input-group">
<input type="text" name="img" id="img" class="form-control" value="<?=$info->original_img?>">
<a href="javascript:void(0);" class="input-group-addon" id="upload">
上传文件
</a>
</div>
5 years ago
</div>
</div>
<div class="form-group">
<label class="col-sm-1 control-label">价格</label>
<div class="col-sm-2">
<div class="input-group">
<input type="text" name="price" value="<?=$info->price?>" class="form-control">
<div class="input-group-addon"></div>
</div>
5 years ago
</div>
<label class="col-sm-3 control-label">使用次数</label>
<div class="col-sm-2">
5 years ago
<input type="text" name="use_num" value="<?=$info->use_num?>" class="form-control">
</div>
</div>
<div class="form-group">
<label class="col-sm-1 control-label">描述</label>
<div class="col-sm-10">
5 years ago
<textarea name="remark" class="form-control"><?=$info->remark?></textarea>
</div>
</div>
<div>
<div class="row">
<div class="col-sm-5 col-sm-offset-5">
5 years ago
<button class="btn btn-primary btn-save" type="button">
<strong><?=$info ? '保 存':'添 加'?></strong>
</button>
</div>
</div>
</div>
</form>
</div>
</div>
</div>
</div>
</div>
<?php $this->beginBlock('footer_js'); ?>
<script src="/assets/js/plugins/webuploader/webuploader.min.js"></script>
5 years ago
<script type="text/javascript" language="javascript">
layui.use(['upload'], function(){
var upload = layui.upload;
var uploadInst = upload.render({
elem: '#upload' //绑定元素
,url: '/common/upload' //上传接口
,accept: 'file'
,done: function(res){
//上传完毕回调
if(res.status == 'SUCCESS') {
$('#img').val(res.fileUrl);
}
}
,error: function(){
//请求异常回调
}
});
});
5 years ago
$(function () {
//提交按钮
5 years ago
$(".btn-save").click(function(){
parent.layer.confirm('是否确认提交?', {
btn: ['确认','取消'], //按钮
shade: false //不显示遮罩
}, function(){
5 years ago
var params = $("#theFrm").serialize();
$.post('/gift/save',params,function(obj){
if(obj.success) {
5 years ago
parent.layer.msg('保存成功');
parent.refreshList();
layer_close();
} else {
parent.layer.msg(data.msg);
5 years ago
}
},'json');
5 years ago
}, function(){
//
});
5 years ago
});
5 years ago
})
5 years ago
</script>
5 years ago
<?php $this->endBlock('footer_js'); ?>