|
@@ -2,30 +2,15 @@ |
|
@@ -2,30 +2,15 @@ |
2
|
* @Author: Targaryen
|
2
|
* @Author: Targaryen
|
3
|
* @Date: 2017-03-23 11:31:51
|
3
|
* @Date: 2017-03-23 11:31:51
|
4
|
* @Last Modified by: Targaryen
|
4
|
* @Last Modified by: Targaryen
|
5
|
- * @Last Modified time: 2017-03-28 17:14:11
|
5
|
+ * @Last Modified time: 2017-03-30 14:51:41
|
6
|
*/
|
6
|
*/
|
7
|
/* 红人店铺首页 */
|
7
|
/* 红人店铺首页 */
|
8
|
const Swiper2 = require('yoho-swiper2');
|
8
|
const Swiper2 = require('yoho-swiper2');
|
9
|
-
|
|
|
10
|
-let $shopIntroFolder = $('.shop-intro-folder');
|
|
|
11
|
-let $shortIntro = $('#shortIntro');
|
|
|
12
|
-let $shopIntro = $('#shopIntro');
|
|
|
13
|
-let $shopIntrArrw = $('#shopIntrArrw');
|
9
|
+let tip = require('../../plugin/tip');
|
14
|
let $goodsContainer = $('.index-goods-container');
|
10
|
let $goodsContainer = $('.index-goods-container');
|
|
|
11
|
+let $collect = $('#collect');
|
15
|
|
12
|
|
16
|
-/**
|
|
|
17
|
- * 店铺介绍展开收起
|
|
|
18
|
- */
|
|
|
19
|
-$shopIntroFolder.on('click', function() {
|
|
|
20
|
- $shortIntro.toggleClass('hide');
|
|
|
21
|
- $shopIntro.toggleClass('active');
|
|
|
22
|
-
|
|
|
23
|
- if ($shopIntro.hasClass('active')) {
|
|
|
24
|
- $shopIntrArrw.html('');
|
|
|
25
|
- } else {
|
|
|
26
|
- $shopIntrArrw.html('');
|
|
|
27
|
- }
|
|
|
28
|
-});
|
13
|
+const shopId = $('#shopId').val();
|
29
|
|
14
|
|
30
|
/**
|
15
|
/**
|
31
|
* 异步加载人气单品
|
16
|
* 异步加载人气单品
|
|
@@ -64,3 +49,44 @@ if ($('.shop-swiper')) { |
|
@@ -64,3 +49,44 @@ if ($('.shop-swiper')) { |
64
|
});
|
49
|
});
|
65
|
}
|
50
|
}
|
66
|
}
|
51
|
}
|
|
|
52
|
+
|
|
|
53
|
+/**
|
|
|
54
|
+ * 店铺收藏取消收藏操作
|
|
|
55
|
+ */
|
|
|
56
|
+$collect.on('click', function() {
|
|
|
57
|
+ let options = {
|
|
|
58
|
+ id: shopId,
|
|
|
59
|
+ opt: 'ok'
|
|
|
60
|
+ };
|
|
|
61
|
+
|
|
|
62
|
+ if ($collect.hasClass('already-collect')) {
|
|
|
63
|
+ options.opt = 'cancel';
|
|
|
64
|
+ }
|
|
|
65
|
+
|
|
|
66
|
+ $.ajax({
|
|
|
67
|
+ method: 'get',
|
|
|
68
|
+ url: location.protocol + '//m.yohobuy.com/product/opt/favoriteBrand',
|
|
|
69
|
+ xhrFields: {
|
|
|
70
|
+ withCredentials: true
|
|
|
71
|
+ },
|
|
|
72
|
+ data: options,
|
|
|
73
|
+ success: function(result) {
|
|
|
74
|
+ if (result.code === 200) {
|
|
|
75
|
+ if ($collect.hasClass('already-collect')) {
|
|
|
76
|
+ $collect.attr('class', 'not-collect pull-left');
|
|
|
77
|
+ tip.show('店铺取消收藏成功');
|
|
|
78
|
+ } else {
|
|
|
79
|
+ $collect.attr('class', 'already-collect pull-left');
|
|
|
80
|
+ tip.show('店铺收藏成功');
|
|
|
81
|
+ }
|
|
|
82
|
+ }
|
|
|
83
|
+
|
|
|
84
|
+ if (result.code === 400) {
|
|
|
85
|
+ if ($('#jump-login').length <= 0) {
|
|
|
86
|
+ $('body').append('<a href=\'' + result.data + '\'><span id="jump-login"><span></a>');
|
|
|
87
|
+ }
|
|
|
88
|
+ $('#jump-login').click();
|
|
|
89
|
+ }
|
|
|
90
|
+ }
|
|
|
91
|
+ });
|
|
|
92
|
+}); |