282 行
10 KiB
HTML
可执行文件
282 行
10 KiB
HTML
可执行文件
<!DOCTYPE html>
|
|
<html>
|
|
<!--[1.1.54]-->
|
|
<head>
|
|
<meta charset="UTF-8">
|
|
<title>销售毛利润</title>
|
|
<link rel="stylesheet" type="text/css" href="__PUBLIC__/layui-v2.4.3/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>
|
|
.goods_repertory {
|
|
display: flex;
|
|
padding: 20px;
|
|
}
|
|
.layui-col-md {
|
|
width: 16%;
|
|
}
|
|
.layui-card {
|
|
border: 1px solid #c2ccd1;
|
|
}
|
|
.goods_edit {
|
|
box-sizing: border-box;
|
|
padding: 3px 0px 8px 47px;
|
|
display: flex;
|
|
align-items: center;
|
|
}
|
|
</style>
|
|
</head>
|
|
<body>
|
|
<div class="goodsBox">
|
|
<blockquote class="layui-elem-quote">注:成本利润率等于总销售金额减去总成本除以总销售金额的百分比</blockquote>
|
|
<form id="select_serach" class="layui-form" style="margin-top: 15px;">
|
|
<div class="goods_edit">
|
|
<div class="goods_edit_input">
|
|
<input type="text" name="text" id="keyword" value="" placeholder="商品名称"/>
|
|
</div>
|
|
<div class="layui-input-inline">
|
|
<select name="supplier" id="supplier">
|
|
<option value="">选择供货商</option>
|
|
<volist name="supplier" id="vo">
|
|
<option value="{$vo['id']}">{$vo['supplier_name']}</option>
|
|
</volist>
|
|
</select>
|
|
</div>
|
|
<div class="layui-input-inline" style="margin-left: 18px;">
|
|
<select name="goods_brand" id="goods_brand">
|
|
<option value="">选择品牌</option>
|
|
<volist name="goods_brand" id="vo">
|
|
<option value="{$vo['id']}">{$vo['name']}</option>
|
|
</volist>
|
|
</select>
|
|
</div>
|
|
<div class="goods_edit_input" style="margin-left: 20px;">
|
|
<input type="text" class="layui-input" id="start_time" placeholder="起始日期">
|
|
</div>
|
|
<div class="goods_edit_input">
|
|
<input type="text" class="layui-input" id="end_time" placeholder="截止日期">
|
|
</div>
|
|
</div>
|
|
<div class="goods_edit">
|
|
<div class="sale_screen_hr">
|
|
<div class="layui-input-inline">
|
|
<select name="person1" id="person1" lay-filter="person1">
|
|
<option value="">选择一级分类</option>
|
|
<volist name="goods_class" id="vo">
|
|
<option value="{$vo['id']}">{$vo['class_name']}</option>
|
|
</volist>
|
|
</select>
|
|
</div>
|
|
<div class="layui-input-inline class2" style="display: none;">
|
|
<select name="person2" id="person2" lay-filter="person2">
|
|
<option value="">选择二级分类</option>
|
|
</select>
|
|
</div>
|
|
<div class="layui-input-inline class3" style="display: none;">
|
|
<select name="person3" id="person3" lay-filter="person3">
|
|
<option value="">选择三级分类</option>
|
|
</select>
|
|
</div>
|
|
</div>
|
|
<div class="goods_edit_add" id="serach">搜索</div>
|
|
</div>
|
|
</form>
|
|
<div class="goods_table">
|
|
<table class="layui-hide" id="test" lay-filter="demo"></table>
|
|
</div>
|
|
</div>
|
|
</body>
|
|
<script src="__PUBLIC__/jquery/js/jquery.min.js"></script>
|
|
<script type="text/javascript" src="__PUBLIC__/layui-v2.4.3/layui/layui.js"></script>
|
|
<script type="text/javascript">
|
|
function renderForm() { // 刷新表单
|
|
layui.use('form', function () {
|
|
var form = layui.form; // 高版本建议把括号去掉,有的低版本,需要加()
|
|
form.render();
|
|
});
|
|
}
|
|
var storeid = {:I('get.storeid')};
|
|
layui.use(['table', 'form', 'upload','laydate'], function () {
|
|
var table = layui.table;
|
|
var form = layui.form;
|
|
var laydate = layui.laydate;
|
|
|
|
laydate.render({
|
|
elem: '#start_time'
|
|
,theme: 'grid'
|
|
});
|
|
|
|
laydate.render({
|
|
elem: '#end_time'
|
|
,theme: 'grid'
|
|
});
|
|
|
|
//展示已知数据
|
|
table.render({
|
|
elem: '#test',
|
|
url: "{:U('get_sell_list')}",
|
|
where: {storeid:storeid},
|
|
toolbar: true,
|
|
loading: true,
|
|
cols: [
|
|
[{
|
|
field: 'index',
|
|
title: '序号',
|
|
align: 'center',
|
|
width: 60,
|
|
}, {
|
|
field: 'goods_name',
|
|
title: '商品名',
|
|
align: 'center',
|
|
}, {
|
|
field: 'class',
|
|
title: '分类',
|
|
align: 'center',
|
|
}, {
|
|
field: 'sku_name',
|
|
title: '规格',
|
|
align: 'center',
|
|
}, {
|
|
field: 'supplier',
|
|
title: '供货商',
|
|
align: 'center',
|
|
width: 80,
|
|
}, {
|
|
field: 'brand',
|
|
title: '品牌',
|
|
align: 'center',
|
|
}, {
|
|
field: 'addtime',
|
|
title: '支付时间',
|
|
align: 'center',
|
|
}, {
|
|
field: 'pay_type',
|
|
title: '支付方式',
|
|
align: 'center',
|
|
}, {
|
|
field: 'allmoney',
|
|
title: '支付金额',
|
|
align: 'center',
|
|
}, {
|
|
field: 'purch_price',
|
|
title: '成本',
|
|
align: 'center',
|
|
}, {
|
|
field: 'yuan_price',
|
|
title: '单件售价',
|
|
align: 'center',
|
|
}, {
|
|
field: 'discount',
|
|
title: '折扣',
|
|
align: 'center',
|
|
width: 60,
|
|
}, {
|
|
field: 'num',
|
|
title: '数量',
|
|
align: 'center',
|
|
}, {
|
|
field: 'profit',
|
|
title: '利润',
|
|
align: 'center',
|
|
}, {
|
|
field: 'profit_margin',
|
|
title: '销售利润率',
|
|
align: 'center',
|
|
}, {
|
|
field: 'sell_type',
|
|
title: '店内/商城',
|
|
align: 'center',
|
|
}, {
|
|
field: 'sell_status',
|
|
title: '类型',
|
|
align: 'center',
|
|
width: 60,
|
|
}]
|
|
],
|
|
page: true,
|
|
id: 'goods_margin',
|
|
});
|
|
var class1_val = '';
|
|
var class2_val = '';
|
|
form.on('select(person1)', function (data) { // 选择一级分类
|
|
if (class1_val == data.value) {
|
|
return;
|
|
}
|
|
class1_val = data.value;
|
|
if (data.value == '') { // 隐藏分类2 3
|
|
$('.class2').hide();
|
|
$('.class3').hide();
|
|
renderForm();
|
|
} else {
|
|
$('.class3').hide();
|
|
$('#person2').html("<option value=''>选择二级分类</option>");
|
|
$.post("{:U('Sale/getChildClass')}", {
|
|
id: data.value,
|
|
type: 2
|
|
}, function (res) {
|
|
if (res.status == 1) {
|
|
for (var i = 0; i < res.data.length; i++) {
|
|
var child = `<option value="${res.data[i].id}">${res.data[i].class_name}</option>`;
|
|
$('#person2').append(child);
|
|
}
|
|
$('.class2').fadeIn();
|
|
$('#person3').html("<option value=''>选择三级分类</option>");
|
|
renderForm();
|
|
} else {
|
|
$('.class2').hide();
|
|
renderForm();
|
|
}
|
|
})
|
|
}
|
|
});
|
|
form.on('select(person2)', function (data) { // 选择二级分类
|
|
if (class2_val == data.value) {
|
|
return;
|
|
}
|
|
class2_val = data.value;
|
|
if (data.value == '') {
|
|
$('.class3').hide();
|
|
$('#person3>option').remove();
|
|
$('#person3').append("<option value=''>选择三级分类</option>");
|
|
renderForm();
|
|
} else {
|
|
$('#person3').html("<option value=''>选择三级分类</option>");
|
|
$.post("{:U('Sale/getChildClass')}", {
|
|
id: data.value,
|
|
type: 3
|
|
}, function (res) {
|
|
if (res.status == 1) {
|
|
for (var i = 0; i < res.data.length; i++) {
|
|
var child = `<option value="${res.data[i].id}">${res.data[i].class_name}</option>`;
|
|
$('#person3').append(child);
|
|
}
|
|
$('.class3').fadeIn();
|
|
renderForm();
|
|
} else {
|
|
$('.class3').hide();
|
|
renderForm();
|
|
}
|
|
})
|
|
}
|
|
});
|
|
// 商品搜索
|
|
$("#serach").click(function () {
|
|
//执行重载
|
|
table.reload('goods_margin', {
|
|
page: {
|
|
curr: 1 // 重新从第 1 页开始
|
|
}, where: {
|
|
keyword: $('#keyword').val(),
|
|
supplier_id: $('#supplier').val(),
|
|
goods_brand_id: $('#goods_brand').val(),
|
|
start_time: $('#start_time').val(),
|
|
end_time: $('#end_time').val(),
|
|
person1: $('#person1').val(),
|
|
person2: $('#person2').val(),
|
|
person3: $('#person3').val()
|
|
}
|
|
});
|
|
});
|
|
});
|
|
</script>
|
|
</html> |