185 行
6.1 KiB
HTML
可执行文件
185 行
6.1 KiB
HTML
可执行文件
<!DOCTYPE html>
|
||
<html>
|
||
<!--[1.2.7]-->
|
||
<head>
|
||
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
|
||
<title></title>
|
||
<link rel="stylesheet" href="__PUBLIC__/bootstrap/css/bootstrap.css">
|
||
<link rel="stylesheet" type="text/css" href="__PUBLIC__/layui/css/layui.css" />
|
||
<link rel="stylesheet" type="text/css" href="__PUBLIC__/Retail/css/goodsList.css" />
|
||
<link rel="stylesheet" type="text/css" href="__PUBLIC__/Retail/css/myscroll.css"/>
|
||
<style>
|
||
* {
|
||
margin: 0;
|
||
padding: 0;
|
||
}
|
||
table {
|
||
border: 1px solid #f1f1f1;
|
||
margin-top: 40px;
|
||
}
|
||
|
||
.layui-table-cell{
|
||
height: auto;
|
||
}
|
||
#exchange{
|
||
margin: 0 0 0 20px;
|
||
}
|
||
.goods_edit{
|
||
box-sizing: border-box;
|
||
padding: 10px 25px 0px 25px;
|
||
display: flex;
|
||
align-items: center;
|
||
}
|
||
.goods_table{
|
||
box-sizing: border-box;
|
||
padding: 0px 25px;
|
||
display: flex;
|
||
align-items: center;
|
||
}
|
||
</style>
|
||
</head>
|
||
|
||
<body style="cursor: pointer;">
|
||
<div class="goodsBox">
|
||
<div class="goods_edit">
|
||
<button type="button" class="layui-btn" id="add">返回</button>
|
||
</div>
|
||
<script type="text/html" id="a">
|
||
<span>{{ d.status == 1?'未领取':'已领取'}}</span>
|
||
</script>
|
||
<div class="goods_table">
|
||
<table class="layui-hide" id="test" lay-filter="demo"></table>
|
||
<script type="text/html" id="barDemo">
|
||
<if condition="$authArr['score_receive'] eq true">
|
||
<button class="layui-btn layui-btn-xs {{ d.status == 1?'':'layui-btn-danger'}}" lay-event="{{ d.status == 1?'edit':''}}">{{ d.status == 1?'核销':'已领取'}}</button>
|
||
</if>
|
||
</script>
|
||
</div>
|
||
</div>
|
||
<script src="__PUBLIC__/jquery/js/jquery.min.js"></script>
|
||
<script type="text/javascript" src="__PUBLIC__/layui/layui.js"></script>
|
||
<script>
|
||
layui.use(['form', 'layedit', 'laydate', 'table'], function() {
|
||
// 日期
|
||
var laydate = layui.laydate,form=layui.form;
|
||
var table = layui.table;
|
||
//展示已知数据
|
||
table.render({
|
||
elem: '#test',
|
||
url: "{:U('score_exchangeData')}",
|
||
method:'post',
|
||
cols: [
|
||
[ //标题栏
|
||
{
|
||
field: 'id',
|
||
title: '序号',
|
||
width:60,
|
||
align: 'center'
|
||
}, {
|
||
field: 'name',
|
||
title: '商品名',
|
||
align:'center'
|
||
}, {
|
||
field: 'image',
|
||
title: '商品图片',
|
||
style:'height:100%;',
|
||
align:'center',
|
||
templet:'<div><img src="{{ d.image}}" style="width: 80px;"></div>'
|
||
},{
|
||
field: 'nickname',
|
||
title: '用户名',
|
||
align:'center'
|
||
},{
|
||
field: 'type',
|
||
title: '兑换方式',
|
||
align:'center'
|
||
},{
|
||
field: 'status',
|
||
title: '是否领取',
|
||
align:'center',
|
||
toolbar: '#a'
|
||
},{
|
||
field: 'time',
|
||
title: '兑换时间',
|
||
align:'center'
|
||
}, {
|
||
field: 'right',
|
||
title:'操作',
|
||
align:'center',
|
||
toolbar: '#barDemo'
|
||
}]
|
||
],
|
||
page: {
|
||
layout: [ 'count', 'prev', 'page', 'next', 'skip'] //自定义分页布局
|
||
}, //是否开启分页
|
||
done:function () {
|
||
// console.log(1111);
|
||
}
|
||
});
|
||
$('#Preservation').click(function () {
|
||
table.reload('test', {
|
||
page: {
|
||
curr: 1 //重新从第 1 页开始
|
||
}
|
||
,where: {
|
||
keyword:$('#keyword').val()
|
||
}
|
||
});
|
||
})
|
||
form.on('switch(sexDemo)', function(obj){
|
||
console.log($(this).attr('date-value'));
|
||
this.value = this.value == 1 ? 2 : 1;
|
||
var status = this.value;
|
||
var id = $(obj.elem).attr('data-id');
|
||
// console.log(status);
|
||
// console.log(id);
|
||
$.ajax({
|
||
url: "{:U('upstatus')}",
|
||
type: 'POST',
|
||
data: {
|
||
status: status,
|
||
id: id
|
||
},
|
||
success: function (res) {
|
||
if (res.status == 1) {
|
||
top.layer.msg('修改成功', {icon: 1, time: 500})
|
||
} else {
|
||
top.layer.msg('修改失败', {icon: 4, time: 500})
|
||
}
|
||
}
|
||
})
|
||
layer.tips(this.value + ' ' + this.name + ':'+ obj.elem.checked, obj.othis);
|
||
});
|
||
table.on('tool(demo)', function(obj){
|
||
var data = obj.data;
|
||
var layEvent = obj.event;
|
||
var tr = obj.tr;
|
||
|
||
if(layEvent === 'detail'){ //查看
|
||
//do somehing
|
||
window.location.href="{:U('shiftingdetail')}?id="+data.id;
|
||
}else if(layEvent === 'edit'){ //核销
|
||
top.layer.open({
|
||
type: 2,
|
||
content: "{:U('score_receive')}?id="+data.id,
|
||
title: "领取商品",
|
||
area: ["650px",'240px'],
|
||
btnAlign: 'c',
|
||
end:function () {
|
||
table.reload('test', {
|
||
});
|
||
}
|
||
})
|
||
}
|
||
});
|
||
$('#add').click(function () {
|
||
window.history.go(-1);
|
||
});
|
||
$("#exchange").click(function(){
|
||
window.location.href = "{:U('Index/score_exchange')}";
|
||
});
|
||
})
|
||
</script>
|
||
</body>
|
||
</html>
|