文件
mashangyoujiu/Application/Retail/View/Plug/gift_detail.html

296 行
10 KiB
HTML
可执行文件

<!DOCTYPE html>
<html>
<!--[1.8.67]-->
<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;
}
</style>
</head>
<body style="cursor: pointer;">
<div class="goodsBox" style="padding: 20px">
<div class="goods_edit">
<form action="#" class="form-inline PromotionForm">
<button type="button" class="layui-btn" id="previous">返回</button>
<if condition="$authArr['gift_addcover'] eq true">
<button type="button" class="layui-btn" id="addStyle">添加封面</button>
</if>
<if condition="$authArr['gift_addprice'] eq true">
<button type="button" class="layui-btn" id="addPrice">添加金额</button>
</if>
</form>
</div>
<div class="goods_title" style="padding-bottom: 0;">
<div class="goods_title_inner">
封面图
</div>
</div>
<script type="text/html" id="switchTpStyle">
<input type="checkbox" name="status" <if condition="$authArr['gift_card_upcover'] neq true"> disabled</if> date-value="{{d.status}}" data-id="{{d.id}}" value="{{d.status}}"
lay-skin="switch" lay-text="上架|下架" lay-filter="statusStyle" {{ d.status== 1 ? 'checked' : '' }}>
</script>
<div class="goods_edit">
<table class="layui-hide" id="style" lay-filter="demo1"></table>
<script type="text/html" id="styleDemo">
<if condition="$authArr['gift_card_delcover'] eq true">
<button class="layui-btn layui-btn-xs layui-btn-danger" lay-event="delStyle">删除</button>
</if>
</script>
</div>
<div class="goods_title" style="padding-bottom: 0;">
<div class="goods_title_inner">
金额
</div>
</div>
<script type="text/html" id="switchTpPrice">
<input type="checkbox" name="status" <if condition="$authArr['gift_card_updateprice'] neq true"> disabled</if> date-value="{{d.status}}" data-id="{{d.id}}" value="{{d.status}}"
lay-skin="switch" lay-text="上架|下架" lay-filter="statusPrice" {{ d.status== 1 ? 'checked' : '' }}>
</script>
<div class="goods_edit">
<table class="layui-hide" id="price" lay-filter="demo2"></table>
<script type="text/html" id="priceDemo">
<if condition="$authArr['gift_card_delprice'] eq true">
<button class="layui-btn layui-btn-xs layui-btn-danger" lay-event="delPrice">删除</button>
</if>
</script>
</div>
</div>
<input type="hidden" value="{$giftid}" id="giftid">
<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;
$('#addPrice').click(function () {
layer.open({
type: 2,
content: "{:U('gift_addprice')}?giftid=" + $('#giftid').val(),
title: "添加礼品卡金额",
area: ["500px", '350px'],
btnAlign: 'c',
end: function () {
table.reload('price', {});
}
});
});
$('#addStyle').click(function () {
layer.open({
type: 2,
content: "{:U('gift_addcover')}?giftid=" + $('#giftid').val(),
title: "添加礼品卡封面",
area: ["100%", '100%'],
btnAlign: 'c',
end: function () {
table.reload('style', {});
}
});
});
var giftid = $("#giftid").val();
//样式图
table.render({
elem: '#style',
url: "{:U('gift_cover_Date')}",
method:'post',
where:{giftid:giftid},
limit:3,
cols: [
[ //标题栏
{
field: 'id',
title: '序号',
width: 60
}, {
field: 'img_url',
title: '封面图',
style: 'height:100%;',
align: 'center',
templet: '<div><img src="{{ d.img_url}}" style="width: 80px;"></div>'
}, {
field: 'status',
title: '状态',
templet: '#switchTpStyle',
align: 'center'
}, {
field: 'right',
title: '操作',
align: 'center',
toolbar: '#styleDemo'
}]
],
page: {
layout: ['count', 'prev', 'page', 'next', 'skip'] //自定义分页布局
}, //是否开启分页
});
//金额
table.render({
elem: '#price',
url: "{:U('gift_price_Data')}",
method:'post',
where:{giftid:giftid},
limit:3,
cols: [
[{
field: 'id',
title: '序号',
width: 60
}, {
field: 'money',
title: '金额',
align: 'center'
}, {
field: 'price',
title: '售价',
align: 'center'
}, {
field: 'num',
title: '数量',
align: 'center'
}, {
field: 'less_num',
title: '剩余数量',
align: 'center'
},{
field: 'status',
title: '状态',
templet: '#switchTpPrice',
align: 'center'
}, {
field: 'right',
title: '操作',
align: 'center',
toolbar: '#priceDemo'
}]
],
page: {
layout: ['count', 'prev', 'page', 'next', 'skip'] //自定义分页布局
}, //是否开启分页
});
$('#Preservation').click(function () {
table.reload('test', {
page: {
curr: 1 //重新从第 1 页开始
}
, where: {
keyword: $('#keyword').val()
}
});
})
form.on('switch(statusStyle)', function (obj) {
// console.log($(this).attr('date-value'));
this.value = this.value == 1 ? 0 : 1;
var status = this.value;
var id = $(obj.elem).attr('data-id');
$.ajax({
url: "{:U('gift_card_upcover')}",
type: 'POST',
data: {
status: status,
id: id
},
success: function (res) {
if (res.status == 1) {
layer.msg('修改成功', {icon: 1, time: 500})
} else {
layer.msg('修改失败', {icon: 4, time: 500})
}
}
})
});
form.on('switch(statusPrice)', function(obj){
// console.log($(this).attr('date-value'));
this.value = this.value == 1 ? 0 : 1;
var status = this.value;
var id = $(obj.elem).attr('data-id');
$.ajax({
url: "{:U('gift_card_updateprice')}",
type: 'POST',
data: {
status: status,
id: id
},
success: function (res) {
if (res.status == 1) {
layer.msg('修改成功', {icon: 1, time: 500})
} else {
layer.msg('修改失败', {icon: 4, time: 500})
}
}
})
});
table.on('tool(demo1)', function (obj) {
var data = obj.data;
var layEvent = obj.event;
if (layEvent === 'delStyle') { //删除
layer.confirm('确定删除这个样式图吗?', function (index) {
layer.close(index);
//向服务端发送删除指令
$.ajax({
url: "{:U('gift_card_delcover')}",
data: {id: data.id},
type: 'post',
success: function (res) {
if (res.status == 1) {
obj.del();
} else {
layer.msg(res.msg, {icon: 4, time: 1000})
}
}
})
});
}
});
table.on('tool(demo2)', function (obj) {
var data = obj.data;
var layEvent = obj.event;
if(layEvent === 'delPrice'){
layer.confirm('确定删除这个金额吗?', function(index){
layer.close(index);
//向服务端发送删除指令
$.ajax({
url:"{:U('gift_card_delprice')}",
data:{id:data.id},
type:'post',
success:function (res) {
if(res.status==1){
obj.del();
}else{
layer.msg(res.msg,{icon:4,time:1000})
}
}
})
});
}
});
$("#previous").click(function () {
window.history.go(-1);
});
})
</script>
</body>
</html>