...
|
...
|
@@ -2,7 +2,8 @@ var $ = require('jquery'), |
|
|
common = require('../../common/common');
|
|
|
|
|
|
|
|
|
var e = new common.edit('#brandWrap');
|
|
|
var e = new common.edit('#brandWrap'),
|
|
|
brandSelectArr = [];
|
|
|
common.util.__ajax({
|
|
|
url: '/goods/brands/queryBrandsByStatus'
|
|
|
}, function(res) {
|
...
|
...
|
@@ -30,19 +31,22 @@ common.util.__ajax({ |
|
|
|
|
|
if (NETSALEDATA.brandRelationList) {
|
|
|
$('#brandWrap').html(common.util.__template2($('#brandWrap').html(), {
|
|
|
brandRelation: NETSALEDATA.brandRelationList.join('|')
|
|
|
brandRelationList: NETSALEDATA.brandRelationList,
|
|
|
brandRelation: brandSelectArr.join('|')
|
|
|
}));
|
|
|
};
|
|
|
e.init();
|
|
|
}, true);
|
|
|
|
|
|
|
|
|
var brandSelectArr = [];
|
|
|
|
|
|
$.each(NETSALEDATA.brandRelationList, function(index, value) {
|
|
|
brandSelectArr.push(value.brandId);
|
|
|
});
|
|
|
|
|
|
$('#brandWrap').on('change', 'input[name="brandRelationList"]', function() {
|
|
|
var $val = $(this).val(),
|
|
|
var $val = parseInt($(this).val()),
|
|
|
position = brandSelectArr.indexOf($val);
|
|
|
|
|
|
console.log($val, position);
|
|
|
if (position == -1) {
|
|
|
brandSelectArr.push($val);
|
|
|
$('<div class="col-sm-2" data-id="' + $val + '">' + $(this).data('name') + '</div>').appendTo($('.selected-brand'));
|
...
|
...
|
@@ -60,9 +64,9 @@ $('#saveBrandRelation').on('click', function() { |
|
|
option.success = function(res) {
|
|
|
res = res.data;
|
|
|
if (res.code == '200') {
|
|
|
NETSALEEDIT.$tip(res.message, function() {}, 'growl-success');
|
|
|
e.$tip(res.message, function() {}, 'growl-success');
|
|
|
} else {
|
|
|
NETSALEEDIT.$tip(res.message);
|
|
|
e.$tip(res.message);
|
|
|
}
|
|
|
return false;
|
|
|
}
|
...
|
...
|
|