Authored by 姜敏

品类限制和特殊商品

... ... @@ -46,4 +46,7 @@ module.exports=function(app) {
app.post("/sale/product/queryPSNotTreeWhenLevelAndStatus","select_queryPSNotTreeWhenLevelAndStatus");
app.post("/sale/product/queryPSListByParentIdWhenStatus","select_queryPSListByParentIdWhenStatus");
app.post("/refundExchangeAttribute/queryRefundExchangeProductSkn","select_queryRefundExchangeProductSkn");
app.post("/product/fuzzySearchProductSortIds","select_fuzzySearchProductSortIds");
app.post("/product/searchAllSortLevel","select_searchAllSortLevel");
}
\ No newline at end of file
... ...
... ... @@ -169,6 +169,25 @@ module.exports={
params: [
{name: 'param',type: 'number'}
]
},
queryRefundExchangeProductSkn:{
title:'查询所有ProductSkn和模糊匹配查询ProductSkn',
url: '/refundExchangeAttribute/queryRefundExchangeProductSkn',
params: [
{name: 'idName',type: 'String'}
]
},
fuzzySearchProductSortIds:{
title:'品类ID',
url: '/product/fuzzySearchProductSortIds',
params: [
{name: 'idName',type: 'String'}
]
},
searchAllSortLevel:{
title:'所属分类',
url: '/product/searchAllSortLevel',
params: []
}
}
}
\ No newline at end of file
};
\ No newline at end of file
... ...
module.exports=function(app) {
/*品牌货到付款限制页面路由*/
app.get("/goods/limitcategory/index","goods.limitcategory.Index",function(){
this.$extend={
moduleName:"商品管理",
pageName:"品类限制"
}
});
/*列表数据*/
app.post("/product/queryProductSortRefundAllReferdSortInfo","limitcategory_queryProductSortRefundAllReferdSortInfo");
/*开启*/
app.post("/product/openProductSortRefundExchange","limitcategory_openProductSortRefundExchange");
/*关闭*/
app.post("/product/closeProductSortRefundExchange","limitcategory_closeProductSortRefundExchange");
};
\ No newline at end of file
... ...
module.exports=function(app) {
/*品牌货到付款限制页面路由*/
app.get("/goods/special/index","goods.specialgoods.Index",function(){
this.$extend={
moduleName:"商品管理",
pageName:"特殊商品"
}
});
/*列表数据*/
app.post("/refundExchangeAttribute/queryRefundExchangeList","specialgoods_queryRefundExchangeList");
/*编辑*/
app.post("/refundExchangeAttribute/modifyRefundExchangeStatus","specialgoods_modifyRefundExchangeStatus");
};
\ No newline at end of file
... ...
module.exports = {
namespace: "limitcategory",
apis: {
queryProductSortRefundAllReferdSortInfo: {
title: '品类限制列表数据',
url: '/product/queryProductSortRefundAllReferdSortInfo',
params: [
{name: 'sortId', type: 'Number'},
{name: 'sortNameId', type: 'String'},
{name: 'sortLevel', type: 'Number'}
]
},
openProductSortRefundExchange: {
title: '开启品类限制',
url: "/product/openProductSortRefundExchange",
params: [
{name: 'param', type: 'Number'}
]
},
closeProductSortRefundExchange: {
title: '关闭品类限制',
url: '/product/closeProductSortRefundExchange',
params: [
{name: 'param', type: 'String'}
]
}
}
};
\ No newline at end of file
... ...
module.exports = {
namespace: "specialgoods",
apis: {
queryRefundExchangeList: {
title: '特殊商品列表数据',
url: '/refundExchangeAttribute/queryRefundExchangeList',
params: [
{name: 'productSkn', type: 'Number'},
{name: 'brandId', type: 'Number'},
{name: 'isRefundExchange', type: 'Number'},
{name: 'page', type: 'Number'},
{name: 'size', type: 'Number'}
]
},
modifyRefundExchangeStatus: {
title: '修改商品',
url: '/refundExchangeAttribute/modifyRefundExchangeStatus',
params: [
{name: 'productSkn', type: 'Number'},
{name: 'isRefundExchange', type: 'Number'}
]
}
}
};
\ No newline at end of file
... ...
<%include '../../../common/views/__ui/header'%>
<%include '../../../common/views/__partail/ListHeader'%>
<div class="contentpanel">
<div>
<ul class="nav nav-pills">
<li>
<a class="hand active" href="javascript:void(0)" style="font-size: 14px;padding:20px;color: #428bca">货到付款</a>
</li>
<li>
<a class="tag" href="/goods/special/index" style="font-size: 14px;padding:20px;color: black">特殊商品</a>
</li>
</ul>
</div>
<div class="panel panel-default" style="margin-bottom:10px;">
<div class="panel-body">
<div class="row">
... ... @@ -19,7 +29,7 @@
<div class="panel-col">
<select id="isPayDelivery" class="form-control">
<option value="-1">状态</option>
<option value="-1">货到付款状态</option>
<option value="1">开启</option>
<option value="0">关闭</option>
... ...
... ... @@ -8,9 +8,6 @@
<td rowspan="2">单品设置</td>
<td>上传EXCEL:</td>
<td style="position: relative;"><input id="sort-file" name="file" data-type="searchSort" type="file" style="cursor: pointer; height: 37px; top: 8px;">
<!--<p style="background: darkgray; text-align: center;">选择文件</p>-->
</td>
</tr>
<tr>
... ... @@ -31,5 +28,32 @@
</div>
</div>
<div class="panel panel-default" style="margin-bottom:10px;">
<div class="panel-body">
<table class="table table-bordered">
<tr>
<td rowspan="2">特殊商品限制</td>
<td>上传EXCEL:</td>
<td style="position: relative;"><input id="sort-file1" name="file" data-type="searchSort" type="file" style="cursor: pointer; height: 37px; top: 8px;">
</td>
</tr>
<tr>
<td>说明:</td>
<td colspan="2">
1、上传文件必须是<span style="color:red;">.xlsx</span>文件<br>
2、Excel表头为:<span style="color: #67D267;">SKN、是否特殊商品(是:0;否:1)</span><br>
3、第一行为表头内容,第二行开始为正式内容<br>
4、每个文件控制在2500行以内<br>
5、<a href="/ajax/link/refundExchange">下载样例</a>
</td>
</tr>
</table>
<div class="result1">
</div>
</div>
</div>
</div>
<%include '../../../common/views/__ui/footer'%>
\ No newline at end of file
... ...
<%include '../../../common/views/__ui/header'%>
<%include '../../../common/views/__partail/ListHeader'%>
<div class="contentpanel">
<div class="panel panel-default">
<div class="panel-body">
<div class="row">
<div class="panel-col">
<select id="SortId" class="form-control">
<option value="">请选择品类ID</option>
</select>
</div>
<div class="panel-col2">
<div id="sort"></div>
</div>
<div class="panel-col">
<select id="SortLevel" class="form-control">
<option value="">请选择所属分类</option>
</select>
</div>
<div class="panel-col">
<input type="text" class="btn btn-info col-sm-5" id="filter-btn" value="筛选">
<input type="text" class="btn btn-info col-sm-5 col-sm-offset-1" id="export-btn" value="导出">
</div>
</div>
</div>
</div>
<div class="panel">
<div class="panel-body nopadding">
<div class="sale-category-table dataTables_wrapper no-footer" id="basicTable"></div>
</div>
</div>
</div>
<script type="text/template" id="tableHdTemp">
<div class="level-hd clearfix">
<span class="folder"></span>
<span style="width: 5%">品类ID</span>
<span style="width: 20%">品类名称</span>
<span>所属分类</span>
<span class="status">是否特殊品类</span>
<span class="operate">操作</span>
</div>
</script>
<script type="text/template" id="tableTemp2">
<span class="folder"></span>
<span style="width: 5%">[[id]]</span>
<span style="width: 20%">[[sortName]]</span>
<span>[[sortLevel]]级分类</span>
<span class="status">
[[if isRefundExchange=="1"]]
<b style="color: #449d44"></b>
[[/if]]
[[if isRefundExchange=="0"]]
<b style="color: #d9534f"></b>
[[/if]]
</span>
<span class="operate" data-id="[[id]]" data-name="[[sortName]]">
[[if isok]]
[[else]]
[[if isRefundExchange=="1"]]
<a class="btn btn-danger btn-sm close-category " style="width:50px" href="javascript:;"></a>
[[/if]]
[[if isRefundExchange=="0"]]
<a class="btn btn-warning btn-sm open-category " style="width:50px" href="javascript:;"></a>
[[/if]]
[[/if]]
</span>
</script>
<%include '../../../common/views/__ui/footer'%>
\ No newline at end of file
... ...
<%include '../../../common/views/__ui/header'%>
<%include '../../../common/views/__partail/ListHeader'%>
<div class="contentpanel">
<div>
<ul class="nav nav-pills">
<li>
<a class="hand " href="/goods/cod/goods/index" style="font-size: 14px;padding:20px;color: black">货到付款</a>
</li>
<li>
<a class="tag active" href="javascript:void(0)" style="font-size: 14px;padding:20px;color: #428bca">特殊商品</a>
</li>
</ul>
</div>
<div class="panel panel-default" style="margin-bottom:10px;">
<div class="panel-body">
<div class="row">
<div class="panel-col">
<select id="productSkn" class="form-control">
<option value="-1">SKN</option>
</select>
</div>
<div class="panel-col">
<select id="brandId" class="form-control">
<option value="-1">请选择品牌</option>
</select>
</div>
<div class="panel-col">
<select id="isRefundExchange" class="form-control">
<option value="-1">是否特殊商品</option>
<option value="1"></option>
<option value="0"></option>
</select>
</div>
<div class="panel-col-3">
<a id="filter-btn" href="javascript:;" class="btn btn-info">筛选</a>
<a id="export-btn" href="" class="btn btn-info">导出</a>
<a id="btn-input" href="/goods/cod/upload" class="btn btn-info">批量导入</a>
</div>
</div>
</div>
</div>
<div class="panel panel-primary-head">
<div class="dataTab_wrapper" id="basicTable" ></div>
</div>
</div>
<%include '../../../common/views/__ui/footer'%>
\ No newline at end of file
... ...
... ... @@ -48,7 +48,11 @@ var urlObj = {
//发券
'couponID':'/coupon/queryList',//优惠券ID
//获取所有APP版本号列表
'appVersions':'/suggest/suggest/getAllAppVersions'
'appVersions':'/suggest/suggest/getAllAppVersions',
'fuzzySearchProductSortIds':"/product/fuzzySearchProductSortIds",
'searchAllSortLevel':"/product/searchAllSortLevel",
'queryRefundExchangeProductSkn':"/refundExchangeAttribute/queryRefundExchangeProductSkn"
};
var minimumResultsForSearch = ["sortbybrand", "getjitSup", "sortsize2", "querySupplier"];
... ...
... ... @@ -78,7 +78,7 @@ var g = new common.grid({
},
// 审核状态(全部商品是显示) 2
{
display: "状态",
display: "货到付款状态",
render: function (item) {
var html = [];
html.push("<p>" + ENUM.status[item.isPayDelivery] + "</p>");
... ...
... ... @@ -51,3 +51,51 @@ function batchExport(el, type) {
}
common.edit.ajaxfileupload('#sort-file', batchExport('#sort-file', 'payDeliveryModify'));
function batchExport1(el, type) {
var loadModal = null;
return {
params: {
type: type,
__type: "batch-import"
},
onStart: function () {
loadModal = common.dialog.load();
$(el).parents('td').find('.file-name').text($(el).val().replace("C:\\fakepath\\", ""));
},
onComplete: function (response) {
console.log("response", response);
if (loadModal) {
loadModal.close();
}
if (response.code == 200) {
var failFileReason = response.data['failFileReason'];
var repeatFileReason = response.data['repeatFileReason'];
// 有数据导入失败
if (failFileReason.length || repeatFileReason.length) {
var htmlStr = [];
htmlStr[0] = htmlStr[1] = "";
for (var i = 0; i < failFileReason.length; i++) {
htmlStr[0] += '<p style="color:red;">"' + failFileReason[i] + '"</p>';
}
for (var i = 0; i < repeatFileReason.length; i++) {
htmlStr[1] += '<p style="color:red;">"' + repeatFileReason[i] + '"</p>';
}
htmlStr[2] = '<h2 style="color:red;">请修改后重新上传</h2>';
console.log(htmlStr);
$('.result1').html(htmlStr.join(""));
} else {
$('.result1').html("");
common.util.__tip(response.message, 'success');
}
} else {
common.util.__tip(response.message, 'warning');
}
}
}
}
common.edit.ajaxfileupload('#sort-file1', batchExport1('#sort-file1', 'refundExchangeModify'));
... ...
/**
* Created by yoho on 2016/6/28.
*/
'use strict';
var $ = require('jquery'),
common = require('../../../common/common');
var renderHd = false;//加载表格头部
var tabTree = new common.tabTree("#sort");
tabTree.init();
//分类Id
new common.dropDown({
el: "#SortId", ajax: "fuzzySearchProductSortIds"
});
//分类级别
new common.dropDown({
el: "#SortLevel", ajax: "searchAllSortLevel"
});
var Bll = {
dataList: [],
searchList: {},
selectSort: function () {
var select = tabTree.getAddress();
if (select[0].id) {
Bll.searchList.sortNameId = select[select.length - 1].id;
}
},
getDataList: function () {
Bll.selectSort();
common.util.__ajax({
url: "/product/queryProductSortRefundAllReferdSortInfo",
async: false,
data: Bll.searchList
}, function (res) {
Bll.dataList = res.data;
}, true);
},
reload: function () {
renderHd = false;
Bll.getDataList();
g.init(Bll.dataList);
}
};
/**
* 获取数据
*/
var g = new common.grid({
el: "#basicTable",
columns: [
{
display: '',
name: 'foler',
render: function (item) {
var html = "", top = true, isRefundExchange = 1;
if (!renderHd) {
html += $('#tableHdTemp').html();
init(item);
renderHd = true;
} else {
init(item)
}
return html;
function init(item) {
if (top) {
html += "<div id='category_id_" + item.id + "' class='level-wrap clearfix'>";
if (item.isRefundExchange == 0) {
isRefundExchange = 0;
}
top = false;
} else {
html += "<div id='category_id_" + item.id + "' class='level-wrap clearfix level_" + item.sortLevel + "' style='display: none'>";
if (item.isRefundExchange == 0) {
isRefundExchange = 0;
}
}
html += common.util.__template2($('#tableTemp2').html(), item);
if (item.subList) {
for (var i = 0; i < item.subList.length; i++) {
if (isRefundExchange == 0) {
item.subList[i].isok = true;
}
init(item.subList[i]);
}
}
html += "</div>";
}
}
}
]
});
Bll.getDataList();
g.init(Bll.dataList);
//打开层级类目
$(document).on('click', '.folder', function () {
var $wrap = $(this).parent();
if (!$(this).hasClass('open')) {
if ($wrap.find('> .level-wrap').size() > 0) {
var position = $(this).css("background-position");
var a = position.substring(0, position.indexOf("px"));
$wrap.find('> .level-wrap').show().find(".folder").css("background-position", (parseInt(a) + 36) + "px");
$(this).addClass('open');
}
} else {
$(this).removeClass('open');
if ($wrap.find('.level-wrap').size() > 0) {
$wrap.find('.level-wrap').hide().find(".folder").removeClass('open').css("background-position", "12px center");
}
}
});
//切换状态重载列表
$('input[name="state"]').on('change', function () {
$(this).parent().addClass('current').siblings().removeClass('current');
g.reload();
});
$(document).on('change', '#categoryName', function () {
$(this).removeClass("error")
});
/**
* 监控筛选项
*/
$(document).on('change', '#SortId', function () {
if ($(this).val() == -1) {
Bll.searchList.sortId = ""
} else {
Bll.searchList.sortId = $(this).val() ? $(this).val() : "";
}
});
$(document).on('change', '#SortLevel', function () {
if ($(this).val() == -1) {
Bll.searchList.sortLevel = ""
} else {
Bll.searchList.sortLevel = $(this).val() ? $(this).val() : "";
}
});
/**
* 筛选按钮
*/
$(document).on('click', "#filter-btn", function () {
Bll.reload();
});
//导出
$(document).on('click', '#export-btn', function () {
Bll.selectSort();
var queryConf = JSON.stringify(Bll.searchList);
window.open("/ajax/down?queryConf=" + queryConf + "&type=productSortRefundExchangeExport");
});
/**
* 开启
*/
$(document).on('click', ".close-category", function () {
var id = $(this).parent().data('id');
common.dialog.confirm("警告",
"确认开启?",
function () {
common.util.__ajax({
url: '/product/closeProductSortRefundExchange',
data: {
param: id
}
}, function () {
Bll.reload();
}, true);
});
});
/**
* 关闭
*/
$(document).on('click', ".open-category", function () {
var id = $(this).parent().data('id');
common.dialog.confirm("警告",
"确认关闭?",
function () {
common.util.__ajax({
url: '/product/openProductSortRefundExchange',
data: {
param: id
}
}, function () {
Bll.reload();
}, true);
});
});
\ No newline at end of file
... ...
/**
* Created by yoho on 2016/6/28.
*/
/**
* Created by wangqianjun on 16/4/12.
*/
'use strict';
var $ = require('jquery');
var common = require('../../../common/common');
var Bll = {
Status: ["是", "否"],
toast: function (hint, url, data) {
common.dialog.confirm("警告",
hint,
function () {
common.util.__ajax({
url: url,
data: data
}, function () {
g.reload();
}, true);
});
}
};
/*下拉选择*/
new common.dropDown({
el: "#brandId",
ajax: "codGetBrandList"
});
new common.dropDown({
el: "#productSkn",
ajax: "queryRefundExchangeProductSkn"
});
new common.dropDown({
el: "#isPayDelivery"
});
var g = new common.grid({
el: '#basicTable',
parms: function () {
return {
brandId: common.util.__input("brandId"),
isRefundExchange: common.util.__input("isRefundExchange"),
productSkn: common.util.__input("productSkn")
};
},
columns: [
{
display: 'SKN',
name: 'productSkn'
}, {
display: '品牌',
name: 'brandName'
},
{
display: "是否特殊商品",
render: function (item) {
var html = [];
html.push("<p>" + Bll.Status[item.isRefundExchange] + "</p>");
return html.join('');
}
},
{
display: "操作",
render: function (item) {
var html = [];
if (item.sortIsRefundExchange == -1) {
if (item.isRefundExchange == 0) {//普通商品
html.push('<a data-index="' + item.__index + '" href="JavaScript:;" class="btn operation btn-danger btn-xs edit-class-btn" id="btn-item-close" data-type="close">关闭</a>');
} else {//特殊商品
html.push('<a data-index="' + item.__index + '" href="JavaScript:;" class="btn operation btn-success btn-xs edit-class-btn" id="btn-item-open" data-type="open">开启</a>');
}
} else {
if (item.isRefundExchange == 0) {//普通商品
html.push('<a data-index="' + item.__index + '" disabled href="JavaScript:;" class="btn operation btn-danger btn-xs edit-class-btn" id="btn-item-close" data-type="close">关闭</a>');
} else {//特殊商品
html.push('<a data-index="' + item.__index + '" disabled href="JavaScript:;" class="btn operation btn-success btn-xs edit-class-btn" id="btn-item-open" data-type="open">开启</a>');
}
}
return html.join('');
}
}
]
});
g.init('/refundExchangeAttribute/queryRefundExchangeList');
// 筛选
$(document).on('click', "#filter-btn", function () {
g.reload();
});
//开启
$(document).on('click', "#btn-item-open", function () {
var item = g.rows[$(this).data("index")];
item = {
productSkn: item.productSkn,
isRefundExchange: 0
};
Bll.toast("确认开启吗?", "/refundExchangeAttribute/modifyRefundExchangeStatus", item);
});
//关闭
$(document).on('click', "#btn-item-close", function () {
var item = g.rows[$(this).data("index")];
item = {
productSkn: item.productSkn,
isRefundExchange: 1
};
Bll.toast("确认关闭吗?", "/refundExchangeAttribute/modifyRefundExchangeStatus", item);
});
$('#export-btn').on('click', function () {
window.open("/ajax/down?queryConf=" + JSON.stringify(g.options.parms()) + "&type=productRefundExchangeExport");
});
\ No newline at end of file
... ...
... ... @@ -87,14 +87,14 @@
.level-wrap {
.folder {
background-image: url(../assets/images/folder2.png);
background-image: url(assets/images/folder2.png);
background-repeat: no-repeat;
background-position: 12px center;
}
.folder.open {
background-image: url(../assets/images/folder.png);
background-image: url(assets/images/folder.png);
}
}
... ...