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/index.php

121 lines
4.5 KiB

5 years ago
<?php
5 years ago
use \common\libs\MyLib;
5 years ago
?>
5 years ago
<?php $this->beginBlock('header_css'); ?>
<link href="/assets/css/plugins/bootstrap-table/bootstrap-table.min.css" rel="stylesheet">
<?php $this->endBlock(); ?>
<div class="wrapper wrapper-content animated fadeInRight">
<div class="ibox float-e-margins">
<div class="ibox-title">
<h5>礼品管理</h5>
<div class="ibox-tools">
<a class="btn btn-primary btn-xs edit-btn" data-id="0" href="javascript:void(0);" onclick="create(0)">
<i class="fa fa-plus"></i> 添加
</a>
<a class="btn btn-primary btn-xs edit-btn" data-id="0" href="javascript:void(0);" onclick="$('#listTable').bootstrapTable('refresh');">
<i class="fa fa-refresh"></i> 刷新
</a>
</div>
</div>
<div class="ibox-content">
<form role="form" class="form-inline" onsubmit="return search();">
<div class="form-group" style="margin-bottom: 8px;">
<label for="free_type">礼品类型</label>
<select id="is_leave" name="is_leave" class="form-control">
<option value="">全部</option>
<option value="1">实名礼品</option>
<option value="2">礼券</option>
</select>
5 years ago
</div>
<div class="form-group" style="margin-bottom: 8px;">
<label for="name">名称</label>
<input type="text" id="name" name="name" class="form-control">
</div>
<button type="submit" class="btn btn-primary mb-8">搜索</button>
5 years ago
</form>
<div class="row">
<div class="col-md-12">
<table id="listTable">
<thead>
<tr>
<th data-field="id">ID</th>
<th data-field="name">名称</th>
<th data-field="type">所属类型</th>
<th data-field="price">价格</th>
<th data-field="use_num">使用次数</th>
<th data-field="remark">描述</th>
<th data-field="original_img">商品图片</th>
<th data-formatter="opFormatter">操作</th>
</tr>
</thead>
</table>
</div>
</div>
</div>
</div>
</div>
<?php $this->beginBlock('footer_js'); ?>
<script src="/assets/js/plugins/bootstrap-table/bootstrap-table.min.js"></script>
<script src="/assets/js/plugins/bootstrap-table/bootstrap-table-mobile.min.js"></script>
<script src="/assets/js/plugins/bootstrap-table/locale/bootstrap-table-zh-CN.min.js"></script>
<script>
function opFormatter(value, row, index) {
var opStr = [];
opStr.push('<a href="javascript:void(0);" onclick="edit(' + row.id + ')">');
opStr.push('<i class="fa fa-edit" title="编辑"></i>');
opStr.push('</a>');
opStr.push('<a href="javascript:void(0);" onclick="del(' + row.id + ')">');
opStr.push('<i class="fa fa-trash" title="删除"></i>');
opStr.push('</a>');
return opStr.join(' ');
}
function create() {
title = '新增礼品';
layer_show(title, '/gift/edit?id=0');
}
5 years ago
function edit(id) {
5 years ago
var title = '编辑礼品';
layer_show(title, '/gift/edit?id=' + id);
5 years ago
}
function del(id) {
5 years ago
parent.layer.confirm('是否确认删除?', {
btn: ['删除','取消'], //按钮
shade: false //不显示遮罩
}, function(){
$.post('/gift/delete',{id:id},function(data) {
parent.layer.msg(data.msg);
refreshList();
}, 'json');
}, function(){
//
5 years ago
});
5 years ago
}
function refreshList() {
$('#listTable').bootstrapTable('refresh');
}
function search() {
$('#listTable').bootstrapTable('destroy');
$('#listTable').bootstrapTable({
url: "/gift/index-json",
pagination: true,
sidePagination: 'server',
queryParams: function(params) {
params.type_id = $('#type_id').val();
params.name = $('#name').val();
return params;
}
5 years ago
});
5 years ago
return false;
}
$(function() {
search();
5 years ago
});
</script>
5 years ago
<?php $this->endBlock(); ?>