...
|
...
|
@@ -5,37 +5,66 @@ |
|
|
|
|
|
|
|
|
var $ = require('jquery'),
|
|
|
common=require('../common/common');
|
|
|
common = require('../common/common');
|
|
|
|
|
|
var baseNum = 1;
|
|
|
|
|
|
var ENUM={
|
|
|
status:{0:'待审核',1:'审核通过',2:'驳回',3:'过期',4:'作废'},//全部
|
|
|
tips:{"salenum":0,"notsalenum":0,"hotnum":0,"nothotnum":0,"all":0}
|
|
|
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(){
|
|
|
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})"}
|
|
|
]
|
|
|
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 common.grid({
|
|
|
|
|
|
el:"#limit-table-box",
|
|
|
parms:function(){
|
|
|
el: "#limit-table-box",
|
|
|
parms: function() {
|
|
|
var obj = {
|
|
|
productName:common.util.__input("product-name"),
|
|
|
productSkn:common.util.__input("skn"),
|
|
|
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()
|
...
|
...
|
@@ -46,42 +75,41 @@ var tableGird = new common.grid({ |
|
|
|
|
|
return obj;
|
|
|
},
|
|
|
columns:[
|
|
|
{
|
|
|
columns: [{
|
|
|
display: "名称",
|
|
|
name: "productName"
|
|
|
}, {
|
|
|
display: "热门排序",
|
|
|
name: "hotSort",
|
|
|
render: function (item) {
|
|
|
render: function(item) {
|
|
|
if (item.hotFlag) {
|
|
|
return ('<input class="order-input width50" data-id="' + item.id + '" data-type="orderBy" type="text" value="'+ item.orderBy +'"/>');
|
|
|
return ('<input class="order-input width50" data-id="' + item.id + '" data-type="orderBy" type="text" value="' + item.orderBy + '"/>');
|
|
|
} else {
|
|
|
return '-';
|
|
|
}
|
|
|
}
|
|
|
}, {
|
|
|
display: "未发售排序",
|
|
|
name:"notSaleSort",
|
|
|
render: function (item) {
|
|
|
name: "notSaleSort",
|
|
|
render: function(item) {
|
|
|
if (item.saleFlag == 1) {
|
|
|
return '-';
|
|
|
} else {
|
|
|
return ('<input class="order-input width50" data-id="' + item.id + '" data-type="notSaleOrderBy" type="text" value="'+ item.notSaleOrderBy +'"/>');
|
|
|
return ('<input class="order-input width50" data-id="' + item.id + '" data-type="notSaleOrderBy" type="text" value="' + item.notSaleOrderBy + '"/>');
|
|
|
}
|
|
|
}
|
|
|
}, {
|
|
|
display: "封面图",
|
|
|
render: function(item){
|
|
|
render: function(item) {
|
|
|
|
|
|
return ('<img class="cover-img" src="'+item.attachUrl+'" />');
|
|
|
return ('<img class="cover-img" src="' + item.attachUrl + '" />');
|
|
|
}
|
|
|
}, {
|
|
|
display:"SKN",
|
|
|
name:"productSkn"
|
|
|
display: "SKN",
|
|
|
name: "productSkn"
|
|
|
}, {
|
|
|
display:"发售日期",
|
|
|
name:"saleTime",
|
|
|
display: "发售日期",
|
|
|
name: "saleTime",
|
|
|
render: function(item) {
|
|
|
var date = new Date(item.saleTime * 1000),
|
|
|
showDate = date.getFullYear() + '-' + (date.getMonth() + 1);
|
...
|
...
|
@@ -92,9 +120,9 @@ var tableGird = new common.grid({ |
|
|
return showDate;
|
|
|
}
|
|
|
}, {
|
|
|
display:"是否发售",
|
|
|
name:"saleFlag",
|
|
|
render:function(item){
|
|
|
display: "是否发售",
|
|
|
name: "saleFlag",
|
|
|
render: function(item) {
|
|
|
if (item.saleFlag == 1) {
|
|
|
return '是';
|
|
|
} else {
|
...
|
...
|
@@ -102,9 +130,9 @@ var tableGird = new common.grid({ |
|
|
}
|
|
|
}
|
|
|
}, {
|
|
|
display:"是否热门",
|
|
|
name:"hotFlag",
|
|
|
render:function(items){
|
|
|
display: "是否热门",
|
|
|
name: "hotFlag",
|
|
|
render: function(items) {
|
|
|
|
|
|
if (items.hotFlag) {
|
|
|
return '是';
|
...
|
...
|
@@ -113,9 +141,9 @@ var tableGird = new common.grid({ |
|
|
}
|
|
|
}
|
|
|
}, {
|
|
|
display:"是否开启",
|
|
|
name:"showFlag",
|
|
|
render:function(items){
|
|
|
display: "是否开启",
|
|
|
name: "showFlag",
|
|
|
render: function(items) {
|
|
|
if (items.showFlag) {
|
|
|
return '是';
|
|
|
|
...
|
...
|
@@ -124,9 +152,9 @@ var tableGird = new common.grid({ |
|
|
}
|
|
|
}
|
|
|
}, {
|
|
|
display:"操作",
|
|
|
render:function(items){
|
|
|
var HtmArr=[];
|
|
|
display: "操作",
|
|
|
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 {
|
...
|
...
|
@@ -142,30 +170,29 @@ var tableGird = new common.grid({ |
|
|
HtmArr.push('<a href="javascript:;" data-id="' + items.id + '" class="btn btn-danger btn-xs delete-btn">删除</a>');
|
|
|
return HtmArr.join('');
|
|
|
}
|
|
|
}
|
|
|
]
|
|
|
}]
|
|
|
});
|
|
|
|
|
|
tableGird.init('/limit/product/page');
|
|
|
|
|
|
var loadtab=function(){
|
|
|
t.active=undefined;
|
|
|
setTimeout(function(){
|
|
|
var loadtab = function() {
|
|
|
t.active = undefined;
|
|
|
setTimeout(function() {
|
|
|
common.util.__ajax({
|
|
|
url:'/limit/ajax/getCodeCount',
|
|
|
data:tableGird.options.parms()
|
|
|
url: '/limit/ajax/getCodeCount',
|
|
|
data: tableGird.options.parms()
|
|
|
|
|
|
},function(res){
|
|
|
for(var key in res.data){
|
|
|
ENUM.tips[key]=res.data[key];
|
|
|
}, function(res) {
|
|
|
for (var key in res.data) {
|
|
|
ENUM.tips[key] = res.data[key];
|
|
|
}
|
|
|
t.init(ENUM.tips);
|
|
|
},true);
|
|
|
},400);
|
|
|
}, true);
|
|
|
}, 400);
|
|
|
}
|
|
|
|
|
|
loadtab();
|
|
|
$("#filter-btn").click(function(){
|
|
|
$("#filter-btn").click(function() {
|
|
|
loadtab();
|
|
|
tableGird.reload();
|
|
|
});
|
...
|
...
|
@@ -178,10 +205,10 @@ $('#limit-table-box').on('click', '.open-btn', function() { |
|
|
showFlag: '1'
|
|
|
}
|
|
|
common.util.__ajax({
|
|
|
url:'/limit/audit',
|
|
|
data:param
|
|
|
url: '/limit/audit',
|
|
|
data: param
|
|
|
|
|
|
},function(res){
|
|
|
}, function(res) {
|
|
|
tableGird.reload();
|
|
|
});
|
|
|
});
|
...
|
...
|
@@ -193,10 +220,10 @@ $('#limit-table-box').on('click', '.close-btn', function() { |
|
|
showFlag: '0'
|
|
|
}
|
|
|
common.util.__ajax({
|
|
|
url:'/limit/audit',
|
|
|
data:param
|
|
|
url: '/limit/audit',
|
|
|
data: param
|
|
|
|
|
|
},function(res){
|
|
|
}, function(res) {
|
|
|
tableGird.reload();
|
|
|
});
|
|
|
});
|
...
|
...
|
@@ -208,10 +235,10 @@ $('#limit-table-box').on('click', '.hot-btn', function() { |
|
|
hotFlag: 1
|
|
|
}
|
|
|
common.util.__ajax({
|
|
|
url:'/limit/audit',
|
|
|
data:param
|
|
|
url: '/limit/audit',
|
|
|
data: param
|
|
|
|
|
|
},function(res){
|
|
|
}, function(res) {
|
|
|
tableGird.reload();
|
|
|
});
|
|
|
});
|
...
|
...
|
@@ -223,10 +250,10 @@ $('#limit-table-box').on('click', '.hot-cancel', function() { |
|
|
hotFlag: 0
|
|
|
}
|
|
|
common.util.__ajax({
|
|
|
url:'/limit/audit',
|
|
|
data:param
|
|
|
url: '/limit/audit',
|
|
|
data: param
|
|
|
|
|
|
},function(res){
|
|
|
}, function(res) {
|
|
|
tableGird.reload();
|
|
|
});
|
|
|
});
|
...
|
...
|
@@ -244,11 +271,11 @@ $('#limit-table-box').on('click', '.delete-btn', function() { |
|
|
tableGird.reload();
|
|
|
});*/
|
|
|
|
|
|
common.dialog.confirm("温馨提示","你确定要删除吗?",function(){
|
|
|
common.dialog.confirm("温馨提示", "你确定要删除吗?", function() {
|
|
|
common.util.__ajax({
|
|
|
url:'/limit/delete',
|
|
|
url: '/limit/delete',
|
|
|
data: param
|
|
|
}, function(){
|
|
|
}, function() {
|
|
|
tableGird.reload();
|
|
|
});
|
|
|
});
|
...
|
...
|
@@ -262,14 +289,20 @@ $('#limit-table-box').on('change', '.order-input', function() { |
|
|
id: goodsId
|
|
|
};
|
|
|
|
|
|
if ($(this).val() < 0) {
|
|
|
common.util.__tip('排序不能为负', 'warning');
|
|
|
return;
|
|
|
} else {
|
|
|
param[type] = $(this).val();
|
|
|
}
|
|
|
|
|
|
|
|
|
common.util.__ajax({
|
|
|
url:'/limit/audit',
|
|
|
url: '/limit/audit',
|
|
|
data: param
|
|
|
},function(res){
|
|
|
}, function(res) {
|
|
|
console.log(res);
|
|
|
});
|
|
|
}).on('keyup', '.order-input', function() {
|
|
|
$(this).val() = $(this).val().replace(/\D/gi, '')
|
|
|
}); |
|
|
\ No newline at end of file |
|
|
|
|
|
|
...
|
...
|
|