Authored by 王钱钧

基础商品列表功能

... ... @@ -3,16 +3,17 @@ var $ = require('jquery'),
common=require('../common/common');
var ENUM={
status:{0:'待审核',1:'审核通过',2:'驳回',3:'过期',4:'作废'},//全部
tips:{"0":0,"1":0,"2":0,"3":0,"4":0,"all":0}
status:{toAuditNum:'待审核',failAuditNum:'驳回',passAuditNum:'通过',all:'全部'},//全部
tips:{"toAuditNum":0,"failAuditNum":0,"passAuditNum":0,"all":""}
}
// 审核状态枚举
var AuditEnum = {
status:{
100:"未审核",
200:"审核通过",
300:"审核不通过"
toAuditNum:100,
passAuditNum:200,
failAuditNum:300,
}
}
... ... @@ -22,7 +23,6 @@ var AgeLevelEnum = {
1:"成人",
2:"大童",
3:"小童",
"":"未知年龄"
}
}
... ... @@ -35,6 +35,16 @@ var GenderEnum = {
}
}
// 性别
//1可补货,2不可补货 3部分可补货
var ReplenishEnum = {
enum: {
1: "可补货",
2: "不可补货",
3: "部分可补货"
}
}
// 商品类型
var GoodsTypeEnum = {
type: {
... ... @@ -67,12 +77,10 @@ var t = new common.tab({
g.reload(1);
},
columns:[
{name:"0",display:"待审核({0})"},
{name:"1",display:"审核通过({1})"},
{name:"2",display:"驳回({2})"},
{name:"3",display:"过期({3})"},
{name:"4",display:"作废({4})"},
{name:"all",display:"全部({all})"}
{name:"toAuditNum",display:"待审核({toAuditNum})"},
{name:"failAuditNum",display:"驳回({failAuditNum})"},
{name:"passAuditNum",display:"通过({passAuditNum})"},
{name:"all",display:"全部{all}"}
]
}).init(ENUM.tips);
... ... @@ -80,16 +88,25 @@ var t = new common.tab({
var g = new common.grid({
el: '#basicTable',
parms:function(){
console.log(t.active);
return {
productSkn:common.util.__input("productSkn"),
productName: common.util.__input("productName"),
shopId: common.util.__input("shopId"),
brandId:common.util.__input("brandId"),
name:common.util.__input("filter-name"),
reqDepartment:common.util.__input("filter-dep"),
status: t.active,
isJit: common.util.__input("isJit"),
isOutLets: common.util.__input("isOutLets"),
isAdvance: common.util.__input("isAdvance"),
isAuditing: AuditEnum.status[t.active],
sortId: tabTree.selected.length>0?tabTree.selected[tabTree.selected.length-1].id:""
};
},
columns:[
{
display: '',
type: 'checkbox'
},
{display:"SKN",render:function(item){
var html=[];
html.push('<a data-index="'+ item.__index+ '" href="/base/goods/info/'+ item.productSkn +'" class="btn btn-info btn-xs edit-class-btn">'+item.productSkn+'</a>');
... ... @@ -101,6 +118,18 @@ var g = new common.grid({
var catgory = item.maxSortName;
if(item.middleSortName) {
catgory += "/"+item.middleSortName;
}
if (item.smallSortName) {
catgory += "/"+item.smallSortName;
}
if (item.sortName) {
catgory += "/"+item.sortName;
}
html.push("<p>名称:"+item.productName+"</p>");
html.push("<p>品牌:"+item.brandName+"</p>");
html.push("<p>品类:"+catgory+"</p>");
... ... @@ -115,7 +144,7 @@ var g = new common.grid({
//待审核和驳回列表中只显示吊牌价和销售价,通过的列表中显示四种
if (item.isAuditing === 200) {
html.push("<p>是否VIP:"+YNEnum.enum(item.isVip)+"</p>");
html.push("<p>是否VIP:"+YNEnum.enum[item.isVip]+"</p>");
html.push("<p>yoho币:"+item.yohoCoin+"</p>");
}
... ... @@ -169,7 +198,7 @@ var g = new common.grid({
var grade = (item.grade == 1) ? "重点款" : "非重点款";
var limited = (item.isLimited == "Y")? "限量款" : "非限量款";
var limitedPurchase = (item.isLimitbuy == "Y")? "限购" : "非限购";
var replenishment = "暂无此字段";
var replenishment = ReplenishEnum.enum[item.isSupplied];
var gender = GenderEnum.gender[item.gender];
html.push("<p>"+grade+"</p>");
... ... @@ -191,6 +220,12 @@ var g = new common.grid({
{display:"操作",render:function(item){
var html=[];
if (item.isAuditing) { // 200 审核通过
} else {
}
html.push('<a data-index="'+ item.__index+ '" href="JavaScript:;" class="btn btn-info btn-xs edit-class-btn">修改</a>');
html.push('<a data-index="'+ item.__index+ '" href="JavaScript:;" class="btn btn-info btn-xs edit-class-btn">通过</a>');
html.push('<a data-index="'+ item.__index+ '" href="JavaScript:;" class="btn btn-info btn-xs edit-class-btn">驳回</a>');
... ... @@ -205,14 +240,16 @@ g.init('/base/goods/ajax/index');
$(document).on('click', "#filter-btn", function () {
g.reload();
loadTab();
});
var Bll={
// 通过
var BllPass={
toast:function(content,fn){
common.dialog.confirm("温馨提示",content,function(){
common.util.__ajax({
url:'/supplier/index/status',
url:'/base/goods/pass',
data:fn()
},function(){
g.reload();
... ... @@ -220,28 +257,127 @@ var Bll={
});
}
}
//通过
// 驳回
var BllReject={
toast:function(content,fn){
common.dialog.confirm("温馨提示",content,function(){
common.util.__ajax({
url:'/base/goods/reject',
data:fn()
},function(){
g.reload();
});
});
}
}
// tab初始化
var loadTab = function () {
t.active = undefined;
setTimeout(function () {
common.util.__ajax({
url:"/base/goods/ajax/auditCount",
data:g.options.parms()
}, function (res) {
var __dt=$.extend({},ENUM.tips,res.data);
t.init(__dt);
}, true);
}, 400);
}
loadTab();
//单个通过
$(document).on("click",".apply-success",function(){
var item=g.rows[$(this).data("index")];
var data=function(){
return {
id:item.id
productSknList:JSON.stringify([item.productSku]),
};
}
Bll.toast("你确定审核通过吗?",data);
BllPass.toast("你确定审核通过吗?",data);
});
//驳回
//单个驳回
$(document).on("click",".apply-back",function(){
var item=g.rows[$(this).data("index")];
var data=function(){
var reason = $('#reason').val();
if (reason === '' || $.trim(reason) === '') {
return "请填写驳回原因";
}
return {
id:item.id
productSknList:JSON.stringify([item.productSku]),
rejectReason:reason
};
}
Bll.toast($("#template").html(),data);
BllReject.toast($("#template").html(),data);
});
//批量驳回
$(document).on("click","#reject-btn",function(){
var selectedArr = g.selected,
len = selectedArr.length,
sknList = [];
if (len <= 0) {
common.util.__tip('请选择要驳回的商品', 'warning');
return;
}
var data=function(){
var reason = $('#reason').val();
if (reason === '' || $.trim(reason) === '') {
return "请填写驳回原因";
}
$.each(selectedArr, function(i, value) {
sknList.push(value['productSkn']);
});
console.log(sknList);
return {
productSknList:JSON.stringify(sknList),
targetStatus:3, // 驳回
rejectReason: reason
};
}
BllReject.toast($("#template").html(),data);
});
//批量通过
$(document).on("click","#pass-btn",function(){
var selectedArr = g.selected,
len = selectedArr.length,
sknList = [];
if (len <= 0) {
common.util.__tip('请选择审核通过的商品', 'warning');
return;
}
var data=function(){
$.each(selectedArr, function(i, value) {
sknList.push(value['productSkn']);
});
console.log(sknList);
return {
productSknList:JSON.stringify(sknList),
};
}
BllPass.toast("确定要通过该申请吗?",data);
});
// 时间转化
Date.prototype.format = function(format) {
var date = {
... ...
... ... @@ -10,15 +10,45 @@ exports.res = [
iscreate:true
}
},
{
// 列表头部各个审核状态的数量
route:'/base/goods/ajax/auditCount',
method:'POST',
url:'/product/getbaseProductCountByStatus',
params:[
{name: 'supplierId',type:'Number'},
{name: 'productSkn',type: 'Number'},
{name: 'productName',type: 'String'},
{name: 'founder',type:'Number'},
{name: 'shopId',type: 'Number'},
{name: 'brandId',type: 'Number'},
{name: 'isOutLets',type:'String'},
{name: 'isAdvance',type:'String'},
{name: 'gender',type:'String'},
{name: 'isJit',type:'String'},
{name: 'maxSortId',type:'Number'},
{name: 'middleSortId',type: 'Number'},
{name: 'smallSortId',type: 'Number'},
{name: 'sortId',type: 'Number'},
{name: 'page',type: 'Number'},
{name: 'size',type: 'Number'},
{name: 'supplierId',type:'Number'},
{name: 'isAuditing',type:'Number'},
]
},
{//ajax列表数据
route:'/base/goods/ajax/index',
method:'POST',
url:'/product/getBaseProductList',
params:[
{name: 'page',type: 'Number'},
{name: 'size',type: 'Number'},
{name: 'supplierId',type:'Number'},
{name: 'supplierId',type:'Number'},
{name: 'productSkn',type: 'Number'},
{name: 'productName',type: 'String'},
{name: 'founder',type:'Number'},
... ... @@ -39,6 +69,8 @@ exports.res = [
{name: 'page',type: 'Number'},
{name: 'size',type: 'Number'},
{name: 'supplierId',type:'Number'},
{name: 'isAuditing',type:'Number'},
]
},
{//添加页面
... ... @@ -105,5 +137,22 @@ exports.res = [
params:[
{name:'productSkn',type:'Number'},
]
} ,
{
// 通过
route:'/base/goods/pass',
method:'POST',
url:'/product/batchAuditPassBaseProduct',
params:[
{name:'productSknList',type:'Number'},
]
},{
// 驳回
route:'/base/goods/reject',
method:'POST',
url:'/product/auditRejectBaseProduct',
params:[
{name:'productSknList',type:'Number'},
]
}
];
\ No newline at end of file
... ...
... ... @@ -28,74 +28,80 @@
{{/ iscreate}}
<div class="panel-body">
<div class="row">
<div class="panel-col">
<input type="text" id="productSkn" value="" class="form-control" placeholder="SKN" style="height: 39px;" />
</div>
<div class="panel-col">
<input type="text" id="productName" class="form-control" placeholder="商品名称" style="height: 39px;"/>
</div>
<div class="panel-col">
<select id="founder" class="form-control">
<option value="-1">创建人</option>
</select>
</div>
<div class="panel-col">
<select id="shopId" class="form-control">
<option value="-1">请选择店铺</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="isOutLets" class="form-control">
<option value="-1">是否奥莱</option>
<option value="Y"></option>
<option value="N"></option>
<div class="panel-col">
<input type="text" id="productSkn" value="" class="form-control" placeholder="SKN"
style="height: 39px;"/>
</div>
<div class="panel-col">
<input type="text" id="productName" class="form-control" placeholder="商品名称" style="height: 39px;"/>
</div>
<div class="panel-col">
<select id="founder" class="form-control">
<option value="-1">创建人</option>
</select>
</div>
<div class="panel-col">
<select id="shopId" class="form-control">
<option value="-1">请选择店铺</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="isOutLets" class="form-control">
<option value="-1">是否奥莱</option>
<option value="Y"></option>
<option value="N"></option>
</select>
</div>
<div class="panel-col">
<select id="isAdvance" class="form-control">
<option value="-1">是否预售</option>
<option value="Y"></option>
<option value="N"></option>
</select>
</div>
<div class="panel-col">
<select id="isAdvance" class="form-control">
<option value="-1">是否预售</option>
<option value="Y"></option>
<option value="N"></option>
</select>
</div>
<div class="panel-col">
<select id="gender" class="form-control">
<option value="-1">请选择性别</option>
<option value="1"></option>
<option value="2"></option>
<option value="3">通用</option>
</select>
</div>
<div class="panel-col">
<select id="gender" class="form-control">
<option value="-1">请选择性别</option>
<option value="1"></option>
<option value="2"></option>
<option value="3">通用</option>
</select>
</div>
</select>
</div>
<div class="panel-col" style="width:300px">
<div id="sort"></div>
</div>
<div class="panel-col">
<select id="isJit" class="form-control">
<option value="-1">是否JIT商品</option>
<option value="Y">是JIT</option>
<option value="N">非JIT</option>
<div class="panel-col" style="width:300px">
<div id="sort"></div>
</div>
<div class="panel-col">
<select id="isJit" class="form-control">
<option value="-1">是否JIT商品</option>
<option value="Y">是JIT</option>
<option value="N">非JIT</option>
</select>
</div>
<div class="panel-col">
<a id="filter-btn" href="javascript:;" class="btn btn-info">筛选</a>
<a id="all-btn" href="" class="btn btn-info">全部</a>
</div>
</select>
</div>
<div class="panel-col">
<a id="filter-btn" href="javascript:;" class="btn btn-info">筛选</a>
<a id="all-btn" href="" class="btn btn-info">全部</a>
</div>
<div class="panel-col">
<a id="pass-btn" href="javascript:;" class="btn btn-info">通过</a>
<a id="reject-btn" href="javascript:;" class="btn btn-info">驳回</a>
</div>
</div>
</div>
</div>
<div class="panel panel-primary-head">
<div class="dataTab_wrapper" id="basicTab"></div>
<div class="dataTab_wrapper" id="basicTable" ></div>
<div class="dataTab_wrapper" id="basicTable"></div>
</div>
</div>
... ... @@ -103,14 +109,15 @@
<input type="hidden" id="gridurl" value="{{gridurl}}">
<script type="text/template" id="template">
<div class="rows" style="height: 100px;">
<div class="form-group">
<span class="col-sm-2 control-label">驳回原因:</span>
<div class="col-sm-8">
<textarea id="bohui" class="form-control" rows="3" ></textarea>
<div class="rows" style="height: 100px;">
<div class="form-group">
<span class="col-sm-2 control-label">驳回原因:</span>
<div class="col-sm-8">
<textarea id="bohui" class="form-control" rows="3"></textarea>
</div>
</div>
</div>
</div>
</div>
</div>
</script>
... ...