|
|
'use strict';
|
|
|
var $ = require('jquery'),
|
|
|
common=require('../../common/common');
|
|
|
|
|
|
var ENUM={
|
|
|
//1待上架,2待审核,3驳回,4通过,1已上架,0已下架,5再上架待审核,6再上架驳回,7再上架通过。
|
|
|
//enum:{0:'已下架',
|
|
|
// 1:'待上架',
|
|
|
// 2:'待审核',
|
|
|
// 3:'驳回',
|
|
|
// 4:'通过',
|
|
|
// 5:'再上架待审核',
|
|
|
// 6:'再上架驳回',
|
|
|
// 7:'再上架通过'
|
|
|
//},
|
|
|
//tips:{"0":0,"1":0,"2":0,"3":0,"4":0,"all":0}
|
|
|
|
|
|
enum:{
|
|
|
2:'待审核',
|
|
|
3:'驳回',
|
|
|
4:'通过',
|
|
|
all:"全部商品"
|
|
|
},
|
|
|
tips:{"2":0,"3":0,"4":0,"all":0}
|
|
|
}
|
|
|
|
|
|
// 审核状态枚举
|
|
|
var AuditEnum = {
|
|
|
status:{
|
|
|
100:"待审核",
|
|
|
200:"审核通过",
|
|
|
300:"驳回",
|
|
|
"":"过期",
|
|
|
"1":"作废",
|
|
|
|
|
|
}
|
|
|
}
|
|
|
|
|
|
// 年龄层枚举
|
|
|
var AgeLevelEnum = {
|
|
|
level: {
|
|
|
1:"成人",
|
|
|
2:"大童",
|
|
|
3:"小童",
|
|
|
"":"未知年龄"
|
|
|
}
|
|
|
}
|
|
|
|
|
|
// 性别
|
|
|
var GenderEnum = {
|
|
|
gender: {
|
|
|
1: "男",
|
|
|
2: "女",
|
|
|
3: "通用"
|
|
|
}
|
|
|
}
|
|
|
|
|
|
// 商品类型
|
|
|
var GoodsTypeEnum = {
|
|
|
type: {
|
|
|
1:"普通商品",
|
|
|
2:"赠品",
|
|
|
3:"虚拟商品",
|
|
|
"":"未知类型"
|
|
|
}
|
|
|
}
|
|
|
|
|
|
/*下拉选择*/
|
|
|
new common.dropDown({el:"#shopId",ajax:"queryShop"});
|
|
|
new common.dropDown({el:"#brandId",ajax:"queryBrand"});
|
|
|
new common.dropDown({el:"#founder",ajax:"querySupplier"});
|
|
|
|
|
|
var tabTree=new common.tabTree("#sort");
|
|
|
tabTree.init();
|
|
|
|
|
|
|
|
|
|
|
|
var t = new common.tab({
|
|
|
el:"#basicTab",
|
|
|
click:function(){
|
|
|
g.reload(1);
|
|
|
|
|
|
},
|
|
|
columns:[
|
|
|
{name:"2",display:"待审核({2})"},
|
|
|
{name:"3",display:"驳回({3})"},
|
|
|
{name:"4",display:"通过({4})"},
|
|
|
{name:"all",display:"全部商品({all})"}
|
|
|
]
|
|
|
}).init(ENUM.tips);
|
|
|
|
|
|
|
|
|
var g = new common.grid({
|
|
|
el: '#basicTable',
|
|
|
parms:function(){
|
|
|
return {
|
|
|
productSkn:common.util.__input("productSkn"),
|
|
|
productSkc:common.util.__input("productSkc"),
|
|
|
productSku:common.util.__input("productSku"),
|
|
|
productName: common.util.__input("productName"),
|
|
|
shopId: common.util.__input("shopId"),
|
|
|
brandId:common.util.__input("brandId"),
|
|
|
isJit: common.util.__input("isJit"),
|
|
|
gender: common.util.__input("gender"),
|
|
|
maxSortId: tabTree.selected.length>0?tabTree.selected[0].id:"", // 一级类目
|
|
|
middleSortId: tabTree.selected.length>1?tabTree.selected[1].id:"", // 二级类目
|
|
|
smallSortId: tabTree.selected.length>2?tabTree.selected[2].id:"", // 三级类目
|
|
|
size: common.util.__input("size"),
|
|
|
|
|
|
};
|
|
|
},
|
|
|
columns:[
|
|
|
{
|
|
|
display: '',
|
|
|
type: 'checkbox'
|
|
|
}, {
|
|
|
display: 'SKN',
|
|
|
name: 'productSkn'
|
|
|
},{
|
|
|
display: '图片',
|
|
|
name: 'picImgUrl',
|
|
|
render: function(item) {
|
|
|
return '<img src="' + item.picImgUrl + '">';
|
|
|
}
|
|
|
},
|
|
|
|
|
|
{
|
|
|
display: '商品信息',
|
|
|
render: function(item) {
|
|
|
return '<p><strong>名称:</strong>' + item.productName + '</p>' +
|
|
|
'<p><strong>品牌:</strong>' + item.brandName + '</p>' +
|
|
|
'<p><strong>类目:</strong>' + item.maxSortName + '/' + item.middleSortName + '</p>';
|
|
|
}
|
|
|
},
|
|
|
|
|
|
{display:"售价",
|
|
|
render: function(item) {
|
|
|
return '<p><strong>吊牌价:</strong>' + item.retailPrice + '</p>' +
|
|
|
'<p><strong>销售价:</strong>' + item.salesPrice + '</p>' +
|
|
|
'<p><strong>是否VIP:</strong></p>' +
|
|
|
'<p style="color: #ccc;"><strong>yoho币:</strong>' + item.returnCoin + '</p>';
|
|
|
}
|
|
|
|
|
|
},
|
|
|
|
|
|
{
|
|
|
display: '库存',
|
|
|
name: 'stock'
|
|
|
},
|
|
|
|
|
|
{display:"年龄层/性别",render:function(item){
|
|
|
var html=[];
|
|
|
var ageLevel = AgeLevelEnum.level[item.ageLevel];
|
|
|
var gender = GenderEnum.gender[item.gender];
|
|
|
html.push("<p>"+ageLevel+" / "+gender+"</p>");
|
|
|
|
|
|
return html.join('');
|
|
|
}},
|
|
|
|
|
|
{display:"预售/奥莱",render:function(item){
|
|
|
|
|
|
var html=[];
|
|
|
//判断是否是预售商品
|
|
|
if (item.isAdvance === "Y") {
|
|
|
html.push("<p>预售</p>");
|
|
|
} else {
|
|
|
html.push("<p>否</p>");
|
|
|
}
|
|
|
|
|
|
if (item.isOutLets == "Y") {
|
|
|
html.push( "<p>/奥莱</p>");
|
|
|
} else {
|
|
|
html.push( "<p>/否</p>");
|
|
|
}
|
|
|
|
|
|
return html.join('');
|
|
|
}},
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
{display:"上架时间",render: function (item) {
|
|
|
return "<p>"+item.shelveTime+"</p>";
|
|
|
}},
|
|
|
{display:"商品类别", render: function(item) {
|
|
|
var type = GoodsTypeEnum.type[item.attribute] ? GoodsTypeEnum.type[item.attribute]:"未知类型";
|
|
|
return "<p>"+type+"</p>"
|
|
|
}},
|
|
|
|
|
|
{display:"操作信息",render:function(item){
|
|
|
var html=[];
|
|
|
html.push("<p>"+item.founderName+"</p>");
|
|
|
html.push("<p>"+item.editTime+"</p>");
|
|
|
|
|
|
return html.join('');
|
|
|
}},
|
|
|
|
|
|
{display:"操作",render:function(item){
|
|
|
var html=[];
|
|
|
html.push('<a data-index="'+ item.__index+ '" href="JavaScript:;" class="btn btn-info btn-xs edit-class-btn" id="btn-item-info">查看</a>');
|
|
|
html.push('<a data-index="'+ item.__index+ '" href="JavaScript:;" class="btn btn-info btn-xs edit-class-btn" id="btn-item-pass">通过</a>');
|
|
|
html.push('<a data-index="'+ item.__index+ '" href="JavaScript:;" class="btn btn-info btn-xs edit-class-btn" id="btn-item-reject">驳回</a>');
|
|
|
|
|
|
return html.join('');
|
|
|
}},
|
|
|
]
|
|
|
});
|
|
|
g.init('/goods/netsale/getList');
|
|
|
|
|
|
// tab初始化
|
|
|
var loadTab = function () {
|
|
|
t.active = undefined;
|
|
|
setTimeout(function () {
|
|
|
common.util.__ajax({
|
|
|
url:"/supplier/baseproduct/auditGoodsCount",
|
|
|
//data:g.options.parms()
|
|
|
}, function (res) {
|
|
|
var __dt=$.extend({},ENUM.tips,res.data);
|
|
|
t.init(__dt);
|
|
|
}, true);
|
|
|
}, 400);
|
|
|
}
|
|
|
|
|
|
loadTab();
|
|
|
// 筛选
|
|
|
$(document).on('click', "#filter-btn", function () {
|
|
|
|
|
|
g.reload();
|
|
|
});
|
|
|
|
|
|
var Bll={
|
|
|
toast:function(content,fn){
|
|
|
common.dialog.confirm("温馨提示",content,function(){
|
|
|
common.util.__ajax({
|
|
|
url:'/supplier/baseproduct/auditReject',
|
|
|
data:fn()
|
|
|
},function(){
|
|
|
g.reload();
|
|
|
});
|
|
|
});
|
|
|
}
|
|
|
}
|
|
|
|
|
|
|
|
|
//批量驳回
|
|
|
$(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
|
|
|
};
|
|
|
}
|
|
|
Bll.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),
|
|
|
targetStatus:4, // 通过
|
|
|
rejectReason: ""
|
|
|
};
|
|
|
}
|
|
|
Bll.toast("确定要通过该申请吗?",data);
|
|
|
});
|
|
|
|
|
|
// 单个驳回
|
|
|
$(document).on("click","#btn-item-reject",function(){
|
|
|
//auditOperation([],3,)
|
|
|
var item=g.rows[$(this).data("index")];
|
|
|
|
|
|
var data=function(){
|
|
|
|
|
|
var reason = $('#reason').val();
|
|
|
if (reason === '' || $.trim(reason) === '') {
|
|
|
return "请填写驳回原因";
|
|
|
}
|
|
|
|
|
|
return {
|
|
|
productSknList:JSON.stringify([item.productSkn]),
|
|
|
targetStatus:3, // 驳回
|
|
|
rejectReason:reason
|
|
|
};
|
|
|
}
|
|
|
Bll.toast($("#template").html(),data);
|
|
|
});
|
|
|
|
|
|
|
|
|
// 单个通过
|
|
|
$(document).on("click","#btn-item-pass",function(){
|
|
|
//auditOperation([],3,)
|
|
|
var item=g.rows[$(this).data("index")];
|
|
|
|
|
|
var data=function(){
|
|
|
|
|
|
return {
|
|
|
productSknList:JSON.stringify([item.productSkn]),
|
|
|
targetStatus:4, //通过
|
|
|
rejectReason:""
|
|
|
};
|
|
|
}
|
|
|
Bll.toast("确定要通过该申请吗?",data);
|
|
|
});
|
|
|
|
|
|
// 时间转化
|
|
|
Date.prototype.format = function(format) {
|
|
|
var date = {
|
|
|
"M+": this.getMonth() + 1,
|
|
|
"d+": this.getDate(),
|
|
|
"h+": this.getHours(),
|
|
|
"m+": this.getMinutes(),
|
|
|
"s+": this.getSeconds(),
|
|
|
"q+": Math.floor((this.getMonth() + 3) / 3),
|
|
|
"S+": this.getMilliseconds()
|
|
|
};
|
|
|
if (/(y+)/i.test(format)) {
|
|
|
format = format.replace(RegExp.$1, (this.getFullYear() + '').substr(4 - RegExp.$1.length));
|
|
|
}
|
|
|
for (var k in date) {
|
|
|
if (new RegExp("(" + k + ")").test(format)) {
|
|
|
format = format.replace(RegExp.$1, RegExp.$1.length == 1
|
|
|
? date[k] : ("00" + date[k]).substr(("" + date[k]).length));
|
|
|
}
|
|
|
}
|
|
|
return format;
|
|
|
}
|
|
|
|
|
|
|
|
|
|
...
|
...
|
|