文件

341 行
13 KiB
HTML
可执行文件

此文件含有模棱两可的 Unicode 字符

此文件含有可能会与其他字符混淆的 Unicode 字符。 如果您是想特意这样的,可以安全地忽略该警告。 使用 Escape 按钮显示他们。

<!doctype html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport"
content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<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;
}
body {
padding: 10px 15px;
}
.Promotion, blockquote {
box-sizing: border-box;
/*margin: 0;*/
padding: 0;
padding-left: 15px;
border-left: 2px solid #3D4357;
font-size: 14px;
}
table {
border: 1px solid #f1f1f1;
margin-top: 40px;
}
.glyphicon-plus {
color: #289FDE;
width: 25px;
display: inline-block;
}
.glyphicon-minus {
color: #E77062;
width: 25px;
display: inline-block;
}
.PromotionForm {
position: relative;
}
.Preservation {
background: #3E4C72;
color: #fff;
position: absolute;
right: 50px;
top: 0;
}
.goods :nth-child(1) {
border: none;
outline: none;
}
/*.tableBox tr:hover input {*/
/*background: #F5F5F5;*/
/*}*/
.goods :nth-child(2) {
border: none;
vertical-align: middle;
}
.specialOffer input {
/*border: none;*/
outline: none;
}
.table {
background-color: white;
}
.goods {
text-align: center;
}
.layui-table-box tr th .layui-form-checkbox{
display: none;!important;
}
#myform .form-group{
margin-bottom: 20px;
}
</style>
</head>
<body style="background-color:#fff7f8;">
<div class="goodsBox">
<div class="goods_title">
<div class="goods_title_inner">
添加套餐 <span style="color:orangered">(注意:套餐商品不参加会员的打折)</span>
</div>
</div>
</div>
<form class="form-inline PromotionForm" id="myform" action="{:U('retail/discount/savediscountmsg')}" method="post">
<div class="form-group" style="width: 90%;">
<div class="col-md-3 col-sm-4 ">
<div class="form-group">
<label for="">套餐名称:</label>
<input type="text" class="form-control" placeholder="" name="combo_name">
</div>
<div class="form-group">
<label for="">套餐数量:</label>
<input type="text" class="form-control" placeholder="" name="combo_num">
</div>
</div>
<div class="col-md-3 col-sm-4 ">
<div class="form-group">
<label for="">店内售价:</label>
<input type="text" class="form-control" placeholder="" name="price">
</div>
<div class="form-group">
<label for="">商城售价:</label>
<input type="text" class="form-control" placeholder="" name="online_price">
</div>
</div>
<div class="col-md-3 col-sm-4 ">
<div class="form-group">
<label for="">商城出售:</label>
<select name="type" class="form-control" style="width: 165px;">
<option value="1">店内及商城</option>
<option value="0">仅店内</option>
</select>
</div>
</div>
</div>
<button type="button" class="btn btn-default Preservation" id="savemsg">保存</button>
<table class="table tableBox layui-table" style="min-width: 1000px;">
<tr style="background: #F2F1F1">
<th colspan="9" ><h3 style="text-align: center;font-size: 16px;">套餐详情</h3></th>
</tr>
<tr style="background: #F2F1F1">
<th width="80">序号</th>
<th>货号</th>
<th style="width:50px;">选择</th>
<th>品名</th>
<th>进货价</th>
<th>零售价</th>
<th>商城价</th>
<th>数量</th>
<th>操作</th>
</tr>
<tr>
<td>1</td>
<td width="200" class="goods">
<input type="text" value="" placeholder="货号" readonly>
<input type="hidden" name="goodsid[]" class="mygoodsid">
</td>
<td class="goods">
<span class="glyphicon glyphicon-option-horizontal" data-toggle="modal" data-target=".myModal"></span>
</td>
<td></td>
<td></td>
<td></td>
<td></td>
<td><input type="text" name="num[]" value="1"></td>
<td>
<!--data-target 对应的是模态框 (弹出层)的class -->
<span class="glyphicon glyphicon-plus"></span>
<span class="glyphicon glyphicon-minus"></span>
</td>
</tr>
</table>
</form>
<!--弹出层-->
<div class="myModal" style="display: none">
<div class="modal-body" style="height:300px;overflow:auto; ">
<form action="" class="form-inline">
<div class="form-group">
<label for="" class=" control-label">过滤</label>
<input type="text" class="form-control" placeholder="货号/品名" id="mykeyword">
<button type="button" class="btn btn-default" id="mysearch">查询</button>
</div>
</form>
<table class="layui-hide" id="test" lay-filter="demo"></table>
</div>
</div>
<input type="hidden" value="" id="cleckids">
</body>
<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;
var table = layui.table;
var serial_nmu = 1;
//jia
$('.tableBox').on('click',".glyphicon-plus",function () {
serial_nmu++
$(".tableBox").append(`<tr>
<td>${serial_nmu}</td>
<td width="200" class="goods">
<input type="text" value="" placeholder="货号" readonly>
<input type="hidden" name="goodsid[]" class="mygoodsid">
</td>
<td class="goods">
<span class="glyphicon glyphicon-option-horizontal" data-toggle="modal" data-target=".myModal"></span>
</td>
<td></td>
<td></td>
<td></td>
<td></td>
<td><input type="text" name="num[]" value="1"></td>
<td>
<span class="glyphicon glyphicon-plus"></span>
<span class="glyphicon glyphicon-minus"></span>
</td>
</tr>`);
})
var candel = true;
// 删除
$(".tableBox").on("click", '.glyphicon-minus', function () {
if (serial_nmu > 1) {
candel = true;
serial_nmu--;
}
else if (serial_nmu == 1) {
candel = false;
}
if(candel){
$(this).parents('tr').parent().children().last().remove();
}
})
$(".tableBox").on('click', '.glyphicon-option-horizontal', function (e) {
// console.log($(e.target)[0]);
var tar = e.target;
var data = '';
layer.open({
type: 1,
content: $('.myModal'),
title: "选择商品",
area: "900px",
btn: ['确定', '取消'],
btnAlign: 'c',
success: function () {
//展示已知数据
table.render({
elem: '#test',
url: "{:U('Discount/goodsList')}",
cols: [
[ //标题栏
{
type: 'checkbox'
},
{
field: 'good_number',
title: '货号'
}, {
field: 'goods_name',
title: '品名'
}, {
field: 'goods_code',
title: '商品条码'
},{
field: 'retail_price',
title: '零售价(元)',
width:90
}, {
field: 'online_price',
title: '商城价(元)',
width:90
}]
],
page: {
layout: [ 'count', 'prev', 'page', 'next', 'skip'] //自定义分页布局
}, //是否开启分页
});
//监听表格复选框选择
table.on('checkbox(demo)', function (obj) {
// console.log(obj.data.id)
data = obj.data;
});
$('#mysearch').click(function () {
var keyword = $('#mykeyword').val()
table.reload('test', {
page: {
curr: 1 //重新从第 1 页开始
}
,where: {
keyword:keyword
}
});
})
},
yes: function (index) {
var cleckidsarr = [];
$('#myform input.mygoodsid').each(function () {
cleckidsarr.push($(this).val())
})
var bol = false;
for(var i=0;i<cleckidsarr.length;i++){
if(data.id==cleckidsarr[i]){
bol = true;
break;
}
}
if(bol){
top.layer.msg('该商品已添加进套餐');
}else{
$(tar).parents('tr').children().eq(1).children().eq(0).val(data.good_number);
$(tar).parents('tr').children().eq(1).children().eq(1).val(data.id);
$(tar).parents('tr').children().eq(3).text(data.goods_name);
$(tar).parents('tr').children().eq(4).text(data.retail_price);
$(tar).parents('tr').children().eq(5).text(data.retail_price);
$(tar).parents('tr').children().eq(6).text(data.online_price);
$('#cleckids').val($('#cleckids').val()+data.id+',');
layer.close(index);
}
}
})
})
$('#savemsg').click(function () {
top.layer.confirm('确定保存',function () {
$.ajax({
url:"{:U('retail/combo/savecombo')}",
type:'post',
data:$("#myform").serialize(),
success:function (res) {
if(res.status==1){
top.layer.alert(res.msg,function () {
window.location.reload();
});
}else{
top.layer.alert(res.msg);
}
}
})
})
})
});
</script>
</html>