记得上下班打卡 | git大法好,push需谨慎

Commit 776c5728 authored by dongchun's avatar dongchun

提交商品分类功能

parent aecd6143
...@@ -65,6 +65,7 @@ public class GoblinSelfCategoryAdminController extends BaseController { ...@@ -65,6 +65,7 @@ public class GoblinSelfCategoryAdminController extends BaseController {
return AjaxResult.warn("请指定商品分类"); return AjaxResult.warn("请指定商品分类");
} }
queryWrapper.eq(GoblinSelfGoodsCategory::getCatePid, cateId); queryWrapper.eq(GoblinSelfGoodsCategory::getCatePid, cateId);
break;
default: default:
logger.warn("店铺管理:商品分类:筛选:无效参数[grade={},cateId={}]", grade, cateId); logger.warn("店铺管理:商品分类:筛选:无效参数[grade={},cateId={}]", grade, cateId);
return AjaxResult.warn("无效参数"); return AjaxResult.warn("无效参数");
......
...@@ -2,6 +2,83 @@ ...@@ -2,6 +2,83 @@
<html lang="zh" xmlns:th="http://www.thymeleaf.org" xmlns:shiro="http://www.pollix.at/thymeleaf/shiro"> <html lang="zh" xmlns:th="http://www.thymeleaf.org" xmlns:shiro="http://www.pollix.at/thymeleaf/shiro">
<head> <head>
<th:block th:include="include :: header('商品分类列表')"/> <th:block th:include="include :: header('商品分类列表')"/>
<th:block th:include="include :: bootstrap-fileinput-css" />
<style>
.layui-layer-btn0, .layui-layer-btn1 {
font-size: 12px;
font-weight: normal;
margin: 0 3px;
margin-right: 7px;
margin-left: 7px;
padding: 0 15px;
color: #fff;
border: 1px solid #0064b6;
background: #0071ce;
border-radius: 3px;
display: inline-block;
height: 30px;
line-height: 30px;
text-align: center;
vertical-align: middle;
background-repeat: no-repeat;
text-decoration: none;
outline: none;
-moz-box-sizing: content-box;
-webkit-box-sizing: content-box;
box-sizing: content-box;
}
.layui-layer-btn1 {
color: #404a58;
border: 1px solid #c0c4cd;
background: #fff;
border-radius: 3px;
margin-left: 0;
}
.layui-layer-btn0:hover {
color: #fff;
}
#addClassify {
display: none;
width: 540px;
padding-top: 20px;
}
#addClassify .selectClassify {
display: flex;
align-items: center;
padding: 0 20px;
}
#addClassify .selectClassify label {
display: flex;
margin-right: 20px;
align-items: center;
}
#addClassify .selectClassify label input {
margin: 0;
margin-right: 2px;
}
.shadeCss,.layui-layer-shade {
background-color: rgb(0, 0, 0, 0.5) !important;
}
.selectClassifyOne {
display: flex;
align-items: center;
margin-top: 12px;
padding: 0 20px;
}
.selectClassifyOne span {
width: 90px;
}
.bottomBtn {
margin-top: 20px;
text-align: right;
padding: 10px 15px 12px;
background: #f0f4f7;
border-top: 1px #c7c7c7 solid;
}
.kv-hidden {
display: none !important;
}
</style>
</head> </head>
<body class="gray-bg"> <body class="gray-bg">
<div class="container-div"> <div class="container-div">
...@@ -32,7 +109,7 @@ ...@@ -32,7 +109,7 @@
</div> </div>
<div class="btn-group-sm" id="toolbar" role="group"> <div class="btn-group-sm" id="toolbar" role="group">
<a class="btn btn-success" onclick="" shiro:hasPermission="goblin:extag:add"> <a class="btn btn-success" id="button-open-10" shiro:hasPermission="goblin:extag:add">
<i class="fa fa-plus"></i> 新增 <i class="fa fa-plus"></i> 新增
</a> </a>
<!-- <a class="btn btn-danger multiple disabled" onclick="$.operate.removeAll()" shiro:hasPermission="goblin:extag:rmv">--> <!-- <a class="btn btn-danger multiple disabled" onclick="$.operate.removeAll()" shiro:hasPermission="goblin:extag:rmv">-->
...@@ -43,20 +120,90 @@ ...@@ -43,20 +120,90 @@
<div class="col-sm-12 select-table table-striped"> <div class="col-sm-12 select-table table-striped">
<table id="bootstrap-table"></table> <table id="bootstrap-table"></table>
</div> </div>
<div id="addClassify">
<div class="selectClassify">
<span>分类选择:</span>
<label>
<input type="radio" checked value="1" id="optionsRadios1" name="optionsRadios"><span>一级</span></label>
<label>
<input type="radio" value="2" id="optionsRadios1" name="optionsRadios"><span>二级</span></label>
<label>
<input type="radio" value="3" id="optionsRadios1" name="optionsRadios"><span>三级</span></label>
</div>
<input type="hidden" id="typeValue" value="1">
<div class="selectClassifyOne">
<span>一级分类:</span>
<input class="form-control" id="firstTypeIpt" type="text">
<select class="form-control" name="tagType" id="firstTypeSelect" style="display: none;">
</select>
</div>
<div class="selectClassifyOne selectClassifyOne2" style="display: none;">
<span>二级分类:</span>
<input class="form-control" id="secondTypeIpt" type="text">
<select class="form-control" name="tagType" id="secondTypeSelect">
<option value="">全部</option>
</select>
</div>
<div class="selectClassifyOne selectClassifyOne3" style="display: none;">
<span>三级分类:</span>
<input class="form-control" id="threeIpt" type="text">
</div>
<div class="gitPic">
<img id="viewImg" src="" alt="" style="max-height:150px;margin-top: 12px;margin-left: 12px;">
<div class="ibox-content" style="border: none;padding-bottom: 0;">
<div class="form-group">
<div class="file-loading">
<input id="fileinput" type="file" name="file" data-browse-on-zone-click="true" data-theme="fas">
</div>
</div>
</div>
</div>
<div class="bottomBtn">
<a src="javascript:;" class="layui-layer-btn0 paddings" onclick="yes(1,2)">确定</a>
<a class="layui-layer-btn1 layui-layer-btn1" onclick="closeModal()">取消</a>
</div>
</div>
</div> </div>
</div> </div>
<th:block th:include="include :: footer"/> <th:block th:include="include :: footer"/>
<th:block th:include="include :: bootstrap-fileinput-js" />
<script th:inline="javascript"> <script th:inline="javascript">
var rmvFlg = [[${@permission.hasPermi('goblin:category:rmv')}]]; var rmvFlg = [[${@permission.hasPermi('goblin:category:rmv')}]];
var prefix = ctx + "goblin/category"; var prefix = ctx + "goblin/category";
let rowId = '';
$(function () { $(function () {
$("#fileinput").fileinput({
'theme': 'explorer-fas',
'uploadUrl': 'https://devplatform.zhengzai.tv/platform/basicServices/alOss/upload',
"uploadExtraData": {
"pathName" : "banner",
"buckType" : 1
},
autoReplace: true,
showCaption: false,
showPreview: false,
showRemove: false,
showUpload: false,
showCancel: false,
showClose: false,
autoReplace: true,
dropZoneTitle: "请上传文件",
maxFileCount: 1
}).on("filebatchselected", function (event, files) { //默认上传
$(this).fileinput("upload");
})
.on("fileuploaded", function (event, data) { //上传回调事件
showPicture = 'https://img.zhengzai.tv/' + data.response.data.ossPath;
$("#viewImg").attr('src', showPicture)
})
var options = { var options = {
url: prefix + "/list", url: prefix + "/list",
removeUrl: prefix + "/rmv/{id}", removeUrl: prefix + "/rmv/{id}",
sortName: "mid", sortName: "mid",
modalName: "商品分类", modalName: "商品分类",
// onCheck: onCheck,
columns: [{ columns: [{
checkbox: true radio: true
}, },
{ {
field: 'fname', field: 'fname',
...@@ -73,19 +220,138 @@ ...@@ -73,19 +220,138 @@
{ {
field: 'fcounts', field: 'fcounts',
title: '关联商品数量' title: '关联商品数量'
},
{
title: '操作',
align: 'center',
formatter: function (value, row, index) {
var actions = [];
// actions.push('<a class="btn btn-danger btn-xs ' + rmvFlg + '" href="javascript:void(0)" onclick="$.operate.remove(\'' + row.fcateId + '\')"><i class="fa fa-trash"></i>删除</a>');
return actions.join('');
}
}] }]
}; };
$.table.init(options); $.table.init(options);
}); });
$("#button-open-10").click(function(){
layer.open({
type: 1,
shade: true,
title: '创建分类', //不显示标题
content: $('#addClassify'), //捕获的元素,注意:最好该指定的元素要存放在body最外层,否则可能被其它的相对元素所影响
cancel: function(res){
console.log(res, '111')
$("#addClassify").empty()
// layer.msg('捕获就是从页面已经存在的元素上,包裹layer的结构', {time: 5000, icon:6});
}
});
})
$("#firstTypeSelect").on('change', function (e) {
console.log(e)
filterSelect (e.target.value, 3)
})
// function onCheck (row, $element) {
// console.log(row, $element)
// rowId = row.fcateId;
// }
function yes() {
let name = ''
let type = $("#typeValue").val();
let catePid = '';
if (type == 1) {
name = $("#firstTypeIpt").val();
} else if (type == 2) {
name = $("#secondTypeIpt").val();
catePid = $("#firstTypeSelect").val();
} else {
name = $("#threeIpt").val();
catePid = $("#secondTypeSelect").val();
}
let data = {
catePid,
grade: type,
icon: $("#viewImg").attr('src'),
name,
neIsbn: 0
}
$.ajax({
type: 'post',
url: '/goblin/category/addSave',
data,
success: function (res) {
console.log(res, 'res')
$("pull-right button[type=refresh]").click();
closeModal ()
}
})
}
function closeModal () {
$("#addClassify").empty()
$(".layui-layer-close1").click();
}
$("input[name=optionsRadios]").on('change', function (e) {
console.log(e.target.value)
let num = e.target.value;
$("#typeValue").val(num);
if (num == 1) {
$(".selectClassifyOne2").hide();
$(".selectClassifyOne3").hide();
$(".selectClassifyOne").show();
$("#firstTypeSelect").hide();
$("#firstTypeIpt").show();
} else if (num == 2) {
$(".selectClassifyOne2").show();
$("#secondTypeSelect").hide();
$("#secondTypeIpt").show();
$(".selectClassifyOne").show();
$("#firstTypeSelect").show();
$("#firstTypeIpt").hide();
$(".selectClassifyOne3").hide();
filterSelect ('', 2)
} else {
$(".selectClassifyOne").show();
$("#firstTypeSelect").show();
$("#firstTypeIpt").hide();
$(".selectClassifyOne2").show();
$("#secondTypeSelect").show();
$("#secondTypeIpt").hide();
$(".selectClassifyOne3").show();
filterSelect ('', 2)
}
})
function filterSelect (parentsId, num) {
let data = {
cateId: parentsId,
grade: num - 1
}
$.ajax({
type: 'post',
url: '/goblin/category/filter',
data,
success: function(res) {
console.log(res, 'res')
const { data } = res;
let str = '';
data.forEach(item => {
console.log(item)
str += `<option value="${item.cateId}">${item.name}</option>`
})
if (!parentsId) {
$("#firstTypeSelect").html(str);
} else {
$("#secondTypeSelect").html(str);
}
}
})
}
function del(id, status, notice) {
$.modal.confirm(notice, function() {
$.ajax({
type: 'put',
url: '/stone/item/change/status',
data: {
itemId: id,
status
},
success:function(e) {
layer.msg("操作成功!")
$("button[name=refresh]").click()
}
})
});
}
</script> </script>
</body> </body>
</html> </html>
\ No newline at end of file
...@@ -248,7 +248,7 @@ ...@@ -248,7 +248,7 @@
url: prefix + "/audit/reject", url: prefix + "/audit/reject",
data: { "storeId": storeIds, "reason": value }, data: { "storeId": storeIds, "reason": value },
success:function(res) { success:function(res) {
closeModal () refreshItem()
} }
}) })
} }
......
...@@ -59,9 +59,7 @@ ...@@ -59,9 +59,7 @@
border-style: none; border-style: none;
padding: 0; padding: 0;
} }
.kv-hidden {
display: none !important;
}
.layui-layer-btn0, .layui-layer-btn1 { .layui-layer-btn0, .layui-layer-btn1 {
font-size: 12px; font-size: 12px;
font-weight: normal; font-weight: normal;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment