|
@@ -13,6 +13,8 @@ var $brandHeader = $('#brand-header'), |
|
@@ -13,6 +13,8 @@ var $brandHeader = $('#brand-header'), |
13
|
|
13
|
|
14
|
var filter = require('../plugin/filter');
|
14
|
var filter = require('../plugin/filter');
|
15
|
|
15
|
|
|
|
16
|
+var tip = require('../plugin/tip');
|
|
|
17
|
+
|
16
|
var $goodsContainer = $('#goods-container'),
|
18
|
var $goodsContainer = $('#goods-container'),
|
17
|
$ngc = $goodsContainer.children('.new-goods'),
|
19
|
$ngc = $goodsContainer.children('.new-goods'),
|
18
|
$pgc = $goodsContainer.children('.price-goods'),
|
20
|
$pgc = $goodsContainer.children('.price-goods'),
|
|
@@ -323,5 +325,33 @@ $('#brand-intro').tap(function(e) { |
|
@@ -323,5 +325,33 @@ $('#brand-intro').tap(function(e) { |
323
|
|
325
|
|
324
|
//品牌收藏
|
326
|
//品牌收藏
|
325
|
$brandHeader.children('.btn-col').bind('tap', function() {
|
327
|
$brandHeader.children('.btn-col').bind('tap', function() {
|
326
|
- $(this).toggleClass('coled');
|
328
|
+ var $this = $(this);
|
|
|
329
|
+
|
|
|
330
|
+ var id = $brandHeader.data('id'),
|
|
|
331
|
+ opt;
|
|
|
332
|
+
|
|
|
333
|
+ if ($this.hasClass('coled')) {
|
|
|
334
|
+ opt = 'cancel';
|
|
|
335
|
+ } else {
|
|
|
336
|
+ opt = 'ok';
|
|
|
337
|
+ }
|
|
|
338
|
+
|
|
|
339
|
+ $.ajax({
|
|
|
340
|
+ type: 'POST',
|
|
|
341
|
+ url: '/product/opt/favoriteBrand',
|
|
|
342
|
+ data: {
|
|
|
343
|
+ id: id,
|
|
|
344
|
+ opt: opt
|
|
|
345
|
+ },
|
|
|
346
|
+ success: function(data) {
|
|
|
347
|
+ if (data.code === 200) {
|
|
|
348
|
+ $this.toggleClass('coled');
|
|
|
349
|
+ } else if (data.code === 400) {
|
|
|
350
|
+ tip.show('未登录');
|
|
|
351
|
+ }
|
|
|
352
|
+ },
|
|
|
353
|
+ error: function() {
|
|
|
354
|
+ tip.show('网络断开连接了~');
|
|
|
355
|
+ }
|
|
|
356
|
+ });
|
327
|
}); |
357
|
}); |