|
|
require('product/shop/shop.page.css');
|
|
|
let ProductListWithFilter = require('product/list/product-list-with-filter');
|
|
|
const $ = require('yoho-jquery');
|
|
|
const tip = require('plugin/tip');
|
|
|
const ProductListWithFilter = require('product/list/product-list-with-filter');
|
|
|
|
|
|
const $shopIntroBtn = $('#shopIntroBtn');
|
|
|
const $introBox = $('#introBox');
|
|
|
const $closeIntroBtn = $('#closeIntroBtn');
|
|
|
const $collectShopIcon = $('#collectShop');
|
|
|
|
|
|
const shopId = $('#shopId').val();
|
|
|
|
|
|
let productListWithFilterModel =
|
|
|
const productListWithFilterModel =
|
|
|
new ProductListWithFilter({
|
|
|
shop_id: shopId,
|
|
|
page: 2, // 首页服务端已经渲染
|
...
|
...
|
@@ -11,3 +18,66 @@ let productListWithFilterModel = |
|
|
}, 'product/search/shop/goods');
|
|
|
|
|
|
productListWithFilterModel.getFilter();
|
|
|
|
|
|
/**
|
|
|
* 添加或者取消收藏处理
|
|
|
* @param {*} opt
|
|
|
*/
|
|
|
function collectOrNotShop(opt) {
|
|
|
$.ajax({
|
|
|
type: 'GET',
|
|
|
url: location.protocol + '//m.yohobuy.com/product/opt/favoriteBrand',
|
|
|
data: {
|
|
|
id: shopId,
|
|
|
opt: opt,
|
|
|
type: 'shop'
|
|
|
},
|
|
|
xhrFields: {
|
|
|
withCredentials: true
|
|
|
},
|
|
|
success: function(data) {
|
|
|
if (data.code === 200) {
|
|
|
$collectShopIcon.toggleClass('coled');
|
|
|
|
|
|
// 提示
|
|
|
if (opt === 'ok') {
|
|
|
tip.show('添加收藏成功');
|
|
|
} else {
|
|
|
tip.show('取消收藏成功');
|
|
|
}
|
|
|
} else if (data.code === 400) {
|
|
|
location.href = data.data;// 未登录跳转登录页
|
|
|
} else {
|
|
|
tip.show(data.message);
|
|
|
}
|
|
|
},
|
|
|
error: function() {
|
|
|
tip.show('网络断开连接了~');
|
|
|
}
|
|
|
});
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* 打开店铺介绍
|
|
|
*/
|
|
|
$shopIntroBtn.on('click', () => {
|
|
|
$introBox.removeClass('hide');
|
|
|
});
|
|
|
|
|
|
/**
|
|
|
* 关闭店铺介绍
|
|
|
*/
|
|
|
$closeIntroBtn.on('click', () => {
|
|
|
$introBox.addClass('hide');
|
|
|
});
|
|
|
|
|
|
/**
|
|
|
* 添加或者取消收藏操作
|
|
|
*/
|
|
|
$collectShopIcon.on('click', () => {
|
|
|
if ($collectShopIcon.hasClass('coled')) {
|
|
|
collectOrNotShop();
|
|
|
} else {
|
|
|
collectOrNotShop('ok');
|
|
|
}
|
|
|
}); |
...
|
...
|
|