Authored by 姜枫

fix bug 1739

... ... @@ -10,7 +10,7 @@
{{> icon/checkbox}}
</div>
<div class="editorial-cover">
<div class="editorial-cate">{{categoryName}}</div>
<!--<div class="editorial-cate">{{categoryName}}</div>-->
<a href="/editorial/{{id}}.html" target="_blank">
<img src="{{image src 240 160 1}}" alt="">
</a>
... ...
... ... @@ -37,7 +37,7 @@ const Query = {
let nav = [DataHelper.getChannelNav(channel)];
nav.push({
name: query ? `"${query}" ${data.total}个结果` : `共${data.total}个结果`
name: query ? `"${query}" ${data.total}个结果` : `共${data.total || 0}个结果`
});
if (data.filter) {
... ...
... ... @@ -391,11 +391,10 @@ const helpers = {
}
if (q.standard) {
let standardIds = q.standard.split(',');
filter.standard.forEach(s => {
s.sub.forEach(b => {
if (b.standardId === parseInt(standardIds[1], 10)) {
_.forEach(filter.standard, s => {
_.forEach(s.sub, b => {
if (q.standard.indexOf('_' + b.standardId) > 0) {
b.checked = true;
filters.push(this.newFilter('standard', q.standard, b.standardName));
}
... ...
... ... @@ -32,8 +32,7 @@ function _paramHanlde(obj) {
// if (obj.standard) {
// let standards = obj.standard.split(',');
//
// obj.standard_id = standards[0];
// obj.standard_value_id = standards[1];
// obj.standard = JSON.stringify(standards);
// }
let _gender;
... ...
... ... @@ -3,7 +3,8 @@
* @author: jiangfeng<jeff.jiang@yoho.cn>
* @date: 16/7/20
*/
var dialog = require('../plugins/dialog');
var _confirm = dialog.Confirm;
var FavoriteBrand = {
init: function() {
... ... @@ -66,6 +67,12 @@ var FavoriteBrand = {
FavoriteBrand.doCancelMulti(shopId.join(','), brandId.join(','));
});
},
_showConfirm: function(cb) {
new _confirm({
content: '<h1 class="title">确认删除</h1><p>您确定要删除该收藏么?</p>',
cb: cb
}).show();
},
moveSlide: function(ele) {
var wrap = $(ele).parent().next('.slide-wrap');
var currLi = $('ul li.show', wrap);
... ... @@ -79,23 +86,27 @@ var FavoriteBrand = {
}
},
doCancel: function(ids, type) {
$.post('/me/collection/cancel', {
type: type || 'brand',
ids: ids
}, function(data) {
if (data.code === 200) {
location.href = '/me/collection/brand';
}
this._showConfirm(function() {
$.post('/me/collection/cancel', {
type: type || 'brand',
ids: ids
}, function(data) {
if (data.code === 200) {
location.href = '/me/collection/brand';
}
});
});
},
doCancelMulti: function(shops, brands) {
$.post('/me/collection/cancel/multi', {
shops: shops,
brands: brands
}, function(data) {
if (data.code === 200) {
location.href = '/me/collection/brand';
}
this._showConfirm(function() {
$.post('/me/collection/cancel/multi', {
shops: shops,
brands: brands
}, function(data) {
if (data.code === 200) {
location.href = '/me/collection/brand';
}
});
});
}
};
... ...
... ... @@ -3,6 +3,8 @@
* @author: jiangfeng<jeff.jiang@yoho.cn>
* @date: 16/7/20
*/
var dialog = require('../plugins/dialog');
var _confirm = dialog.Confirm;
var FavoriteEditorial = {
... ... @@ -50,13 +52,21 @@ var FavoriteEditorial = {
FavoriteEditorial.doCancel(ids.join(','));
});
},
_showConfirm: function(cb) {
new _confirm({
content: '<h1 class="title">确认删除</h1><p>您确定要删除该收藏么?</p>',
cb: cb
}).show();
},
doCancel: function(ids) {
$.post('/me/collection/editorial/cancel', {
ids: ids
}, function(data) {
if (data.code === 200) {
location.href = '/me/collection/editorial';
}
this._showConfirm(function() {
$.post('/me/collection/editorial/cancel', {
ids: ids
}, function(data) {
if (data.code === 200) {
location.href = '/me/collection/editorial';
}
});
});
}
};
... ...
... ... @@ -5,23 +5,34 @@
*/
var lazyload = require('yoho-jquery-lazyload');
var dialog = require('../plugins/dialog');
var _confirm = dialog.Confirm;
var $root = $('.favorite-products');
require('./me');
require('../plugins/check');
function _showConfirm(cb) {
new _confirm({
content: '<h1 class="title">确认删除</h1><p>您确定要删除该收藏么?</p>',
cb: cb
}).show();
}
function doCancel(ids) {
$.post('/me/collection/cancel', {
type: 'product',
ids: ids
}, function(data) {
if (data.code === 200) {
location.href = '/me/collection';
}
_showConfirm(function() {
$.post('/me/collection/cancel', {
type: 'product',
ids: ids
}, function(data) {
if (data.code === 200) {
location.href = '/me/collection';
}
});
});
}
function eventBind() {
$('.check-all', $root).check({
type: 'checkbox',
... ...
... ... @@ -138,9 +138,14 @@ var YohoListPage = {
group: 'standard',
onChange: function(ele, checked, value) {
var parentId = $(ele).parents('.body').data('value');
var standard = query.standard || '';
if (standard) {
standard = standard + ',';
}
YohoListPage.go({
standard: parentId + ',' + value
standard: standard + parentId + '_' + value
});
}
});
... ...