Showing
8 changed files
with
73 additions
and
38 deletions
@@ -10,7 +10,7 @@ | @@ -10,7 +10,7 @@ | ||
10 | {{> icon/checkbox}} | 10 | {{> icon/checkbox}} |
11 | </div> | 11 | </div> |
12 | <div class="editorial-cover"> | 12 | <div class="editorial-cover"> |
13 | - <div class="editorial-cate">{{categoryName}}</div> | 13 | + <!--<div class="editorial-cate">{{categoryName}}</div>--> |
14 | <a href="/editorial/{{id}}.html" target="_blank"> | 14 | <a href="/editorial/{{id}}.html" target="_blank"> |
15 | <img src="{{image src 240 160 1}}" alt=""> | 15 | <img src="{{image src 240 160 1}}" alt=""> |
16 | </a> | 16 | </a> |
@@ -37,7 +37,7 @@ const Query = { | @@ -37,7 +37,7 @@ const Query = { | ||
37 | let nav = [DataHelper.getChannelNav(channel)]; | 37 | let nav = [DataHelper.getChannelNav(channel)]; |
38 | 38 | ||
39 | nav.push({ | 39 | nav.push({ |
40 | - name: query ? `"${query}" 共${data.total}个结果` : `共${data.total}个结果` | 40 | + name: query ? `"${query}" 共${data.total}个结果` : `共${data.total || 0}个结果` |
41 | }); | 41 | }); |
42 | 42 | ||
43 | if (data.filter) { | 43 | if (data.filter) { |
@@ -391,11 +391,10 @@ const helpers = { | @@ -391,11 +391,10 @@ const helpers = { | ||
391 | } | 391 | } |
392 | 392 | ||
393 | if (q.standard) { | 393 | if (q.standard) { |
394 | - let standardIds = q.standard.split(','); | ||
395 | 394 | ||
396 | - filter.standard.forEach(s => { | ||
397 | - s.sub.forEach(b => { | ||
398 | - if (b.standardId === parseInt(standardIds[1], 10)) { | 395 | + _.forEach(filter.standard, s => { |
396 | + _.forEach(s.sub, b => { | ||
397 | + if (q.standard.indexOf('_' + b.standardId) > 0) { | ||
399 | b.checked = true; | 398 | b.checked = true; |
400 | filters.push(this.newFilter('standard', q.standard, b.standardName)); | 399 | filters.push(this.newFilter('standard', q.standard, b.standardName)); |
401 | } | 400 | } |
@@ -32,8 +32,7 @@ function _paramHanlde(obj) { | @@ -32,8 +32,7 @@ function _paramHanlde(obj) { | ||
32 | // if (obj.standard) { | 32 | // if (obj.standard) { |
33 | // let standards = obj.standard.split(','); | 33 | // let standards = obj.standard.split(','); |
34 | // | 34 | // |
35 | - // obj.standard_id = standards[0]; | ||
36 | - // obj.standard_value_id = standards[1]; | 35 | + // obj.standard = JSON.stringify(standards); |
37 | // } | 36 | // } |
38 | 37 | ||
39 | let _gender; | 38 | let _gender; |
@@ -3,7 +3,8 @@ | @@ -3,7 +3,8 @@ | ||
3 | * @author: jiangfeng<jeff.jiang@yoho.cn> | 3 | * @author: jiangfeng<jeff.jiang@yoho.cn> |
4 | * @date: 16/7/20 | 4 | * @date: 16/7/20 |
5 | */ | 5 | */ |
6 | - | 6 | +var dialog = require('../plugins/dialog'); |
7 | +var _confirm = dialog.Confirm; | ||
7 | 8 | ||
8 | var FavoriteBrand = { | 9 | var FavoriteBrand = { |
9 | init: function() { | 10 | init: function() { |
@@ -66,6 +67,12 @@ var FavoriteBrand = { | @@ -66,6 +67,12 @@ var FavoriteBrand = { | ||
66 | FavoriteBrand.doCancelMulti(shopId.join(','), brandId.join(',')); | 67 | FavoriteBrand.doCancelMulti(shopId.join(','), brandId.join(',')); |
67 | }); | 68 | }); |
68 | }, | 69 | }, |
70 | + _showConfirm: function(cb) { | ||
71 | + new _confirm({ | ||
72 | + content: '<h1 class="title">确认删除</h1><p>您确定要删除该收藏么?</p>', | ||
73 | + cb: cb | ||
74 | + }).show(); | ||
75 | + }, | ||
69 | moveSlide: function(ele) { | 76 | moveSlide: function(ele) { |
70 | var wrap = $(ele).parent().next('.slide-wrap'); | 77 | var wrap = $(ele).parent().next('.slide-wrap'); |
71 | var currLi = $('ul li.show', wrap); | 78 | var currLi = $('ul li.show', wrap); |
@@ -79,23 +86,27 @@ var FavoriteBrand = { | @@ -79,23 +86,27 @@ var FavoriteBrand = { | ||
79 | } | 86 | } |
80 | }, | 87 | }, |
81 | doCancel: function(ids, type) { | 88 | doCancel: function(ids, type) { |
82 | - $.post('/me/collection/cancel', { | ||
83 | - type: type || 'brand', | ||
84 | - ids: ids | ||
85 | - }, function(data) { | ||
86 | - if (data.code === 200) { | ||
87 | - location.href = '/me/collection/brand'; | ||
88 | - } | 89 | + this._showConfirm(function() { |
90 | + $.post('/me/collection/cancel', { | ||
91 | + type: type || 'brand', | ||
92 | + ids: ids | ||
93 | + }, function(data) { | ||
94 | + if (data.code === 200) { | ||
95 | + location.href = '/me/collection/brand'; | ||
96 | + } | ||
97 | + }); | ||
89 | }); | 98 | }); |
90 | }, | 99 | }, |
91 | doCancelMulti: function(shops, brands) { | 100 | doCancelMulti: function(shops, brands) { |
92 | - $.post('/me/collection/cancel/multi', { | ||
93 | - shops: shops, | ||
94 | - brands: brands | ||
95 | - }, function(data) { | ||
96 | - if (data.code === 200) { | ||
97 | - location.href = '/me/collection/brand'; | ||
98 | - } | 101 | + this._showConfirm(function() { |
102 | + $.post('/me/collection/cancel/multi', { | ||
103 | + shops: shops, | ||
104 | + brands: brands | ||
105 | + }, function(data) { | ||
106 | + if (data.code === 200) { | ||
107 | + location.href = '/me/collection/brand'; | ||
108 | + } | ||
109 | + }); | ||
99 | }); | 110 | }); |
100 | } | 111 | } |
101 | }; | 112 | }; |
@@ -3,6 +3,8 @@ | @@ -3,6 +3,8 @@ | ||
3 | * @author: jiangfeng<jeff.jiang@yoho.cn> | 3 | * @author: jiangfeng<jeff.jiang@yoho.cn> |
4 | * @date: 16/7/20 | 4 | * @date: 16/7/20 |
5 | */ | 5 | */ |
6 | +var dialog = require('../plugins/dialog'); | ||
7 | +var _confirm = dialog.Confirm; | ||
6 | 8 | ||
7 | 9 | ||
8 | var FavoriteEditorial = { | 10 | var FavoriteEditorial = { |
@@ -50,13 +52,21 @@ var FavoriteEditorial = { | @@ -50,13 +52,21 @@ var FavoriteEditorial = { | ||
50 | FavoriteEditorial.doCancel(ids.join(',')); | 52 | FavoriteEditorial.doCancel(ids.join(',')); |
51 | }); | 53 | }); |
52 | }, | 54 | }, |
55 | + _showConfirm: function(cb) { | ||
56 | + new _confirm({ | ||
57 | + content: '<h1 class="title">确认删除</h1><p>您确定要删除该收藏么?</p>', | ||
58 | + cb: cb | ||
59 | + }).show(); | ||
60 | + }, | ||
53 | doCancel: function(ids) { | 61 | doCancel: function(ids) { |
54 | - $.post('/me/collection/editorial/cancel', { | ||
55 | - ids: ids | ||
56 | - }, function(data) { | ||
57 | - if (data.code === 200) { | ||
58 | - location.href = '/me/collection/editorial'; | ||
59 | - } | 62 | + this._showConfirm(function() { |
63 | + $.post('/me/collection/editorial/cancel', { | ||
64 | + ids: ids | ||
65 | + }, function(data) { | ||
66 | + if (data.code === 200) { | ||
67 | + location.href = '/me/collection/editorial'; | ||
68 | + } | ||
69 | + }); | ||
60 | }); | 70 | }); |
61 | } | 71 | } |
62 | }; | 72 | }; |
@@ -5,23 +5,34 @@ | @@ -5,23 +5,34 @@ | ||
5 | */ | 5 | */ |
6 | 6 | ||
7 | var lazyload = require('yoho-jquery-lazyload'); | 7 | var lazyload = require('yoho-jquery-lazyload'); |
8 | - | 8 | +var dialog = require('../plugins/dialog'); |
9 | +var _confirm = dialog.Confirm; | ||
9 | var $root = $('.favorite-products'); | 10 | var $root = $('.favorite-products'); |
10 | 11 | ||
11 | require('./me'); | 12 | require('./me'); |
12 | require('../plugins/check'); | 13 | require('../plugins/check'); |
13 | 14 | ||
15 | +function _showConfirm(cb) { | ||
16 | + new _confirm({ | ||
17 | + content: '<h1 class="title">确认删除</h1><p>您确定要删除该收藏么?</p>', | ||
18 | + cb: cb | ||
19 | + }).show(); | ||
20 | +} | ||
21 | + | ||
14 | function doCancel(ids) { | 22 | function doCancel(ids) { |
15 | - $.post('/me/collection/cancel', { | ||
16 | - type: 'product', | ||
17 | - ids: ids | ||
18 | - }, function(data) { | ||
19 | - if (data.code === 200) { | ||
20 | - location.href = '/me/collection'; | ||
21 | - } | 23 | + _showConfirm(function() { |
24 | + $.post('/me/collection/cancel', { | ||
25 | + type: 'product', | ||
26 | + ids: ids | ||
27 | + }, function(data) { | ||
28 | + if (data.code === 200) { | ||
29 | + location.href = '/me/collection'; | ||
30 | + } | ||
31 | + }); | ||
22 | }); | 32 | }); |
23 | } | 33 | } |
24 | 34 | ||
35 | + | ||
25 | function eventBind() { | 36 | function eventBind() { |
26 | $('.check-all', $root).check({ | 37 | $('.check-all', $root).check({ |
27 | type: 'checkbox', | 38 | type: 'checkbox', |
@@ -138,9 +138,14 @@ var YohoListPage = { | @@ -138,9 +138,14 @@ var YohoListPage = { | ||
138 | group: 'standard', | 138 | group: 'standard', |
139 | onChange: function(ele, checked, value) { | 139 | onChange: function(ele, checked, value) { |
140 | var parentId = $(ele).parents('.body').data('value'); | 140 | var parentId = $(ele).parents('.body').data('value'); |
141 | + var standard = query.standard || ''; | ||
142 | + | ||
143 | + if (standard) { | ||
144 | + standard = standard + ','; | ||
145 | + } | ||
141 | 146 | ||
142 | YohoListPage.go({ | 147 | YohoListPage.go({ |
143 | - standard: parentId + ',' + value | 148 | + standard: standard + parentId + '_' + value |
144 | }); | 149 | }); |
145 | } | 150 | } |
146 | }); | 151 | }); |
-
Please register or login to post a comment