...
|
...
|
@@ -4,22 +4,48 @@ |
|
|
*/
|
|
|
|
|
|
|
|
|
var $ = require('jquery');
|
|
|
var $ = require('jquery'),
|
|
|
common=require('../common/common');
|
|
|
var edit = require('../common/edit');
|
|
|
var grid=require('../common/grid');
|
|
|
var baseNum = 1;
|
|
|
|
|
|
var ENUM={
|
|
|
status:{0:'待审核',1:'审核通过',2:'驳回',3:'过期',4:'作废'},//全部
|
|
|
tips:{"salenum":0,"notsalenum":0,"hotnum":0,"nothotnum":0,"all":0}
|
|
|
}
|
|
|
var t = new common.tab({
|
|
|
el:"#basicTab",
|
|
|
click:function(){
|
|
|
tableGird.reload();
|
|
|
},
|
|
|
columns:[
|
|
|
{name:"salenum", key: "saleFlag", value: "1", display:"已发售({salenum})"},
|
|
|
{name:"notsalenum", key: "saleFlag", value: "0", display:"未发售({notsalenum})"},
|
|
|
{name:"hotnum", key: "hotFlag", value: "1", display:"热门({hotnum})"},
|
|
|
{name:"nothotnum", key: "hotFlag", value: "0", display:"非热门({nothotnum})"},
|
|
|
{name:"all",display:"全部({all})"}
|
|
|
]
|
|
|
}).init(ENUM.tips);
|
|
|
|
|
|
|
|
|
|
|
|
var tableGird = new grid({
|
|
|
|
|
|
el:"#limit-table-box",
|
|
|
parms:function(){
|
|
|
|
|
|
//todo
|
|
|
return {
|
|
|
//id: window.categoryId * baseNum
|
|
|
};
|
|
|
var obj = {
|
|
|
productName:common.util.__input("product-name"),
|
|
|
productSkn:common.util.__input("skn"),
|
|
|
hotFlag: $('input[name="hotFlag"]:checked').val(),
|
|
|
saleFlag: $('input[name="saleFlag"]:checked').val(),
|
|
|
showFlag: $('input[name="showFlag"]:checked').val()
|
|
|
}
|
|
|
if (t.key) {
|
|
|
obj[t.key] = t.value;
|
|
|
}
|
|
|
|
|
|
return obj;
|
|
|
},
|
|
|
columns:[
|
|
|
{
|
...
|
...
|
@@ -69,10 +95,10 @@ var tableGird = new grid({ |
|
|
name:"inventory"
|
|
|
}, {
|
|
|
display:"是否发售",
|
|
|
name:"isSale",
|
|
|
name:"saleFlag",
|
|
|
render:function(items){
|
|
|
|
|
|
if (items.isSale) {
|
|
|
if (items.saleFlag) {
|
|
|
return '是';
|
|
|
} else {
|
|
|
return '否';
|
...
|
...
|
@@ -80,10 +106,10 @@ var tableGird = new grid({ |
|
|
}
|
|
|
}, {
|
|
|
display:"是否热门",
|
|
|
name:"isHot",
|
|
|
name:"hotFlag",
|
|
|
render:function(items){
|
|
|
|
|
|
if (items.isHot) {
|
|
|
if (items.hotFlag) {
|
|
|
return '是';
|
|
|
} else {
|
|
|
return '否';
|
...
|
...
|
@@ -91,25 +117,133 @@ var tableGird = new grid({ |
|
|
}
|
|
|
}, {
|
|
|
display:"是否开启",
|
|
|
name:"isOpen",
|
|
|
name:"showFlag",
|
|
|
render:function(items){
|
|
|
|
|
|
if (items.isOpen) {
|
|
|
if (items.showFlag) {
|
|
|
return '是';
|
|
|
|
|
|
} else {
|
|
|
return '否';
|
|
|
}
|
|
|
}
|
|
|
}, {
|
|
|
display:"操作",
|
|
|
name:"skn",
|
|
|
render:function(items){
|
|
|
|
|
|
var HtmArr=[];
|
|
|
if (items.showFlag) {
|
|
|
HtmArr.push('<a href="javascript:;" data-id="' + items.id + '" class="btn btn-info btn-xs close-btn">关闭</a>');
|
|
|
} else {
|
|
|
HtmArr.push('<a href="javascript:;" data-id="' + items.id + '" class="btn btn-info btn-xs open-btn">开启</a>');
|
|
|
}
|
|
|
|
|
|
if (items.hotFlag) {
|
|
|
HtmArr.push('<a href="javascript:;" data-id="' + items.id + '" class="btn btn-warning btn-xs hot-cancel">取消热门</a>');
|
|
|
} else {
|
|
|
HtmArr.push('<a href="javascript:;" data-id="' + items.id + '" class="btn btn-warning btn-xs hot-btn">设为热门</a>');
|
|
|
}
|
|
|
HtmArr.push('<a href="/limit/edit/' + items.id + '" data-id="' + items.id + '" class="btn btn-info btn-xs">编辑</a>');
|
|
|
HtmArr.push('<a href="javascript:;" data-id="' + items.id + '" class="btn btn-danger btn-xs delete-btn">删除</a>');
|
|
|
return HtmArr.join('');
|
|
|
}
|
|
|
}
|
|
|
]
|
|
|
});
|
|
|
|
|
|
console.log('11');
|
|
|
tableGird.init('/limit/product/page');
|
|
|
|
|
|
var loadtab=function(){
|
|
|
t.active=undefined;
|
|
|
setTimeout(function(){
|
|
|
common.util.__ajax({
|
|
|
url:'/limit/ajax/getCodeCount',
|
|
|
data:tableGird.options.parms()
|
|
|
|
|
|
},function(res){
|
|
|
for(var key in res.data){
|
|
|
ENUM.tips[key]=res.data[key];
|
|
|
}
|
|
|
t.init(ENUM.tips);
|
|
|
},true);
|
|
|
},400);
|
|
|
}
|
|
|
loadtab();
|
|
|
$("#filter-btn").click(function(){
|
|
|
loadtab();
|
|
|
tableGird.reload();
|
|
|
});
|
|
|
|
|
|
|
|
|
//开启商品
|
|
|
$('#limit-table-box').on('click', '.open-btn', function() {
|
|
|
var param = {
|
|
|
id: $(this).data('id'),
|
|
|
showFlag: '1'
|
|
|
}
|
|
|
common.util.__ajax({
|
|
|
url:'/limit/audit',
|
|
|
data:param
|
|
|
|
|
|
},function(res){
|
|
|
tableGird.reload();
|
|
|
});
|
|
|
});
|
|
|
|
|
|
//关闭商品
|
|
|
$('#limit-table-box').on('click', '.close-btn', function() {
|
|
|
var param = {
|
|
|
id: $(this).data('id'),
|
|
|
showFlag: '0'
|
|
|
}
|
|
|
common.util.__ajax({
|
|
|
url:'/limit/audit',
|
|
|
data:param
|
|
|
|
|
|
},function(res){
|
|
|
tableGird.reload();
|
|
|
});
|
|
|
});
|
|
|
|
|
|
//设为热门
|
|
|
$('#limit-table-box').on('click', '.hot-btn', function() {
|
|
|
var param = {
|
|
|
id: $(this).data('id'),
|
|
|
hotFlag: 1
|
|
|
}
|
|
|
common.util.__ajax({
|
|
|
url:'/limit/audit',
|
|
|
data:param
|
|
|
|
|
|
},function(res){
|
|
|
tableGird.reload();
|
|
|
});
|
|
|
});
|
|
|
|
|
|
//取消热门
|
|
|
$('#limit-table-box').on('click', '.hot-cancel', function() {
|
|
|
var param = {
|
|
|
id: $(this).data('id'),
|
|
|
hotFlag: 0
|
|
|
}
|
|
|
common.util.__ajax({
|
|
|
url:'/limit/audit',
|
|
|
data:param
|
|
|
|
|
|
},function(res){
|
|
|
tableGird.reload();
|
|
|
});
|
|
|
});
|
|
|
|
|
|
//删除商品
|
|
|
$('#limit-table-box').on('click', '.delete-btn', function() {
|
|
|
var param = {
|
|
|
id: $(this).data('id')
|
|
|
}
|
|
|
common.util.__ajax({
|
|
|
url:'/limit/delete',
|
|
|
data:param
|
|
|
|
|
|
},function(res){
|
|
|
tableGird.reload();
|
|
|
});
|
|
|
});
|
|
|
|
|
|
tableGird.init('/limit/product/page'); |
|
|
\ No newline at end of file |
...
|
...
|
|