...
|
...
|
@@ -11,12 +11,16 @@ var product = require('./index/product'); |
|
|
|
|
|
var $shopIntro = $('.shop-intro'),
|
|
|
$shopCollect = $('.shop-collect'),
|
|
|
$colloectIcon = $shopCollect.find('.shop-collect-ico'),
|
|
|
$colloectText = $shopCollect.find('.shop-collect-text'),
|
|
|
$searchForm = $('#shop-search-form'),
|
|
|
$sliderLeft = $('.slider-left'),
|
|
|
$allGoods = $('.all-goods'),
|
|
|
$fixedArea = $allGoods.find('.fixed-area'),
|
|
|
fixedAreaTop = $fixedArea.offset() ? $fixedArea.offset().top : 0;
|
|
|
|
|
|
var shopId = $shopCollect.data('id');
|
|
|
|
|
|
// Pjax
|
|
|
require('yoho-jquery-pjax');
|
|
|
|
...
|
...
|
@@ -36,6 +40,26 @@ if ($sliderLeft.length) { |
|
|
$sliderLeft.slider();
|
|
|
}
|
|
|
|
|
|
if ($shopCollect && $shopCollect.length) {
|
|
|
$.ajax({
|
|
|
type: 'POST',
|
|
|
url: '/product/index/isFavoriteShop',
|
|
|
data: {
|
|
|
shopId: shopId
|
|
|
}
|
|
|
}).then(function(data) {
|
|
|
if (data.code === 200 && data.data) {
|
|
|
// 已收藏
|
|
|
$colloectIcon.addClass('on');
|
|
|
$colloectText.html('已收藏');
|
|
|
return;
|
|
|
}
|
|
|
|
|
|
$colloectIcon.removeClass('on');
|
|
|
$colloectText.html('收藏');
|
|
|
});
|
|
|
}
|
|
|
|
|
|
$shopIntro.on('click', function() {
|
|
|
$('.pop-shop-intro').show();
|
|
|
$('.mask').show();
|
...
|
...
|
@@ -53,9 +77,7 @@ $('.shop-query-submit').on('click', function() { |
|
|
|
|
|
// 收藏店铺
|
|
|
function colloectAction() {
|
|
|
var $colloectIcon = $shopCollect.find('.shop-collect-ico'),
|
|
|
$colloectText = $shopCollect.find('.shop-collect-text'),
|
|
|
isFavorite = $colloectIcon.hasClass('on'),
|
|
|
var isFavorite = $colloectIcon.hasClass('on'),
|
|
|
needColloect = window.cookie('needColloect');
|
|
|
|
|
|
$.ajax({
|
...
|
...
|
@@ -64,7 +86,7 @@ function colloectAction() { |
|
|
data: {
|
|
|
isFavorite: isFavorite ? 0 : 1,
|
|
|
needColloect: needColloect,
|
|
|
shopId: $shopCollect.data('id')
|
|
|
shopId: shopId
|
|
|
},
|
|
|
success: function(res) {
|
|
|
if (res.code === 200) {
|
...
|
...
|
|