Authored by liuyue

品牌提示语、品牌合作模式品牌筛选

... ... @@ -7,53 +7,72 @@ var $ = require('jquery'),
require('../util/datepicker');
//下拉框
new common.dropDown({el: "#status"});
new common.dropDown({el: "#brand-level"});
new common.dropDown({
el:'#brand-id',
ajax:'brand'
});
//下拉框
new common.dropDown({
el: "#status"
});
new common.dropDown({
el: "#brand-level"
});
new common.dropDown({
el: '#brand-id',
ajax: 'brand'
});
//日期插件
$('.hasDatepicker').fdatepicker({
//日期插件
$('.hasDatepicker').fdatepicker({
format: 'yyyy-mm-dd'
});
});
var btnAuthority=JSON.parse($("#btnAuthority").val());
var btnAuthority = JSON.parse($("#btnAuthority").val());
var g = new common.grid({
var g = new common.grid({
el: '#basicTable',
size: 10,
parms: function() {
return {
brandId:common.util.__input('brand-id'),// $.trim($('#brand-id').val()) || '',
status: common.util.__input('status'),//$.trim($('#status').val()) || '',
brandLevel: common.util.__input('brand-level'),//$.trim($('#brand-level').val()) || '',
startTime: common.util.__input('starttime'),//$.trim($('#starttime').val()) || '',
endTime: common.util.__input('endtime')//$.trim($('#endtime').val()) || ''
brandId: common.util.__input('brand-id'), // $.trim($('#brand-id').val()) || '',
status: common.util.__input('status'), //$.trim($('#status').val()) || '',
brandLevel: common.util.__input('brand-level'), //$.trim($('#brand-level').val()) || '',
startTime: common.util.__input('starttime'), //$.trim($('#starttime').val()) || '',
endTime: common.util.__input('endtime') //$.trim($('#endtime').val()) || ''
};
},
columns: [
{display: "LOGO", name: "brandIco",render:function(item){
return '<img src="'+item.brandIco+'" width="100" height="60"/>'
}},
{display: '品牌名称', name: "brandName"},
{display: '英文名称', name: "brandNameEn"},
{display: '品牌级别', name: "brandLevel"},
{display: '调性分', name: "brandTonality"},
{display: '创建时间', name: "createTime", render: function(item) {
columns: [{
display: "LOGO",
name: "brandIco",
render: function(item) {
return '<img src="' + item.brandIco + '" width="100" height="60"/>'
}
}, {
display: '品牌名称',
name: "brandName"
}, {
display: '英文名称',
name: "brandNameEn"
}, {
display: '品牌级别',
name: "brandLevel"
}, {
display: '调性分',
name: "brandTonality"
}, {
display: '创建时间',
name: "createTime",
render: function(item) {
var date = new Date(item.createTime * 1000);
return date.getFullYear() + '-' + (date.getMonth() + 1) + '-' + date.getDate() + ' '
+ date.getHours() + ':' + date.getMinutes() + ':' + date.getSeconds();
}},
{display: '操作', name:"status", render: function(items) {
return date.getFullYear() + '-' + (date.getMonth() + 1) + '-' + date.getDate() + ' ' + date.getHours() + ':' + date.getMinutes() + ':' + date.getSeconds();
}
}, {
display: '操作',
name: "status",
render: function(items) {
var HtmArr = [];
if (btnAuthority.edit) {
HtmArr.push('<a href="/erpproduct/brands/edit/'+ items.id+'"" class="btn btn-info btn-xs">编辑</a>');
HtmArr.push('<a href="/erpproduct/brands/edit/' + items.id + '"" class="btn btn-info btn-xs">编辑</a>');
}
if (items.status === 0) {
HtmArr.push('<a data-index="' + items.__index + '" href="JavaScript:;" class="btn btn-warning btn-xs open-brand">开启品牌</a>');
... ... @@ -62,37 +81,51 @@ require('../util/datepicker');
HtmArr.push('<a data-index="' + items.__index + '" href="JavaScript:;" class="btn btn-danger btn-xs close-brand">关闭品牌</a>');
}
return HtmArr.join('');
}}
]
})
}
}]
})
g.init($("#gridurl").val());
g.init($("#gridurl").val());
$("#filter-btn").click(function(){
$("#filter-btn").click(function() {
g.reload(1);
});
});
//关闭品牌操作
$('tbody').on('click', '.close-brand', function() {
var item=g.rows[$(this).data("index")];
//关闭品牌操作
$('tbody').on('click', '.close-brand', function() {
var item = g.rows[$(this).data("index")];
console.log(11);
common.util.__ajax({
url:'/brand/edit',
data:{id:item.id,status:0}
},function(){
url: '/brand/edit',
data: {
id: item.id,
status: 0
}
}, function(res) {
if (res.code == 200) {
common.util.__tip('关闭品牌成功', 'success');
g.reload();
});
});
//开启品牌操作
$('tbody').on('click', '.open-brand', function() {
var item=g.rows[$(this).data("index")];
} else {
common.util.__tip(res.message);
}
}, true);
});
//开启品牌操作
$('tbody').on('click', '.open-brand', function() {
var item = g.rows[$(this).data("index")];
common.util.__ajax({
url:'/brand/edit',
data:{id:item.id,status:1}
},function(){
url: '/brand/edit',
data: {
id: item.id,
status: 1
}
}, function(res) {
if (res.code == 200) {
common.util.__tip('开启品牌成功', 'success');
g.reload();
});
});
} else {
common.util.__tip(res.message);
}
}, true);
});
\ No newline at end of file
... ...
... ... @@ -18,6 +18,10 @@ new common.dropDown({
var brandSet = new common.dropDown({
el: '#brandCooperationSet'
});
new common.dropDown({
el: '#brand',
ajax: 'brand'
});
var g = new common.grid({
... ... @@ -25,7 +29,7 @@ var g = new common.grid({
parms: function() {
return {
brandName: common.util.__input("brand"),
brandId: common.util.__input("brand"),
cooperateTypeId: common.util.__input("brandCooperation"),
setFlag: common.util.__input("brandCooperationSet")
};
... ...
... ... @@ -632,7 +632,7 @@ exports.res = [
secondTitle: '价格管理',
pageTitle: '品牌合作模式设置',
filter: {
brandInput: true,
brand: true,
brandCooperation: true,
brandCooperationSet: true
},
... ... @@ -651,8 +651,8 @@ exports.res = [
name: 'cooperateTypeId',
type: 'Number'
}, {
name: 'brandName',
type: 'String'
name: 'brandId',
type: 'number'
}, {
name: 'setFlag',
type: 'Number'
... ...