Authored by yyq

Merge branch 'release/1.0' of git.yoho.cn:fe/yoho-blk into release/1.0

1 {{# classicBrands}} 1 {{# classicBrands}}
2 <div class="brand-img-box {{#if right}}right{{/if}} {{#if bottomSpace}}mb10{{/if}}"> 2 <div class="brand-img-box {{#if right}}right{{/if}} {{#if bottomSpace}}mb10{{/if}}">
3 - <a href="{{url}}"> 3 + <a href="{{url}}" target="_blank">
4 {{# big}} 4 {{# big}}
5 <img class="big-img lazy-img" data-original="{{image src 565 340}}" alt="big-img"> 5 <img class="big-img lazy-img" data-original="{{image src 565 340}}" alt="big-img">
6 {{/ big}} 6 {{/ big}}
@@ -43,6 +43,7 @@ const btnMap = { @@ -43,6 +43,7 @@ const btnMap = {
43 classStr: 'btn white cancel-btn mr' 43 classStr: 'btn white cancel-btn mr'
44 }, 44 },
45 { 45 {
  46 + isEditBtn: true,
46 name: '修改订单', 47 name: '修改订单',
47 classStr: 'btn white edit-btn' 48 classStr: 'btn white edit-btn'
48 } 49 }
@@ -518,6 +519,12 @@ const getOrderDetail = (uid, code) => { @@ -518,6 +519,12 @@ const getOrderDetail = (uid, code) => {
518 } 519 }
519 }); 520 });
520 521
  522 + if (detail.canUpdateDeliveryAddress === 'N') {
  523 + _.remove(detail.btns, btn => {
  524 + return btn.isEditBtn;
  525 + });
  526 + }
  527 +
521 if (parseInt(detail.paymentType, 10) === 2 && 528 if (parseInt(detail.paymentType, 10) === 2 &&
522 (statusMap[st].valueStr === '备货中' || 529 (statusMap[st].valueStr === '备货中' ||
523 detail.statusStr === '备货中')) { 530 detail.statusStr === '备货中')) {
@@ -87,15 +87,24 @@ const helpers = { @@ -87,15 +87,24 @@ const helpers = {
87 * 男女条件 87 * 男女条件
88 * @returns {*[]} 88 * @returns {*[]}
89 */ 89 */
90 - genders() {  
91 - return [  
92 - {  
93 - name: '男士',  
94 - value: '1,3'  
95 - }, {  
96 - name: '女士',  
97 - value: '2,3'  
98 - }]; 90 + genders(gender) {
  91 + if (gender) {
  92 + return Object.keys(gender).map(g => {
  93 + return {
  94 + name: gender[g],
  95 + value: g
  96 + };
  97 + });
  98 + } else {
  99 + return [
  100 + {
  101 + name: '男士',
  102 + value: '1,3'
  103 + }, {
  104 + name: '女士',
  105 + value: '2,3'
  106 + }];
  107 + }
99 }, 108 },
100 109
101 /** 110 /**
@@ -216,7 +225,7 @@ const helpers = { @@ -216,7 +225,7 @@ const helpers = {
216 filterHandle(filter, q) { 225 filterHandle(filter, q) {
217 let priceRange = filter.priceRange; 226 let priceRange = filter.priceRange;
218 let sizeInfo = filter.size; 227 let sizeInfo = filter.size;
219 - let genders = this.genders(); 228 + let genders = this.genders(filter.gender);
220 let brands = filter.brand; 229 let brands = filter.brand;
221 let colors = this.colorConvert(filter.color); 230 let colors = this.colorConvert(filter.color);
222 let sorts = filter.groupSort; 231 let sorts = filter.groupSort;
@@ -234,20 +243,20 @@ const helpers = { @@ -234,20 +243,20 @@ const helpers = {
234 }); 243 });
235 244
236 if (sorts) { 245 if (sorts) {
237 - // singleSort = true;  
238 - //  
239 - // if (sorts[0].sub && sorts[0].sub.length === 1) {  
240 - // sorts[0].sub[0].checked = true;  
241 - // }  
242 - //  
243 - // if (q.misort) {  
244 - // sorts[0].sub.forEach(s => {  
245 - // s.checked = s.categoryId === q.misort;  
246 - // });  
247 - // }  
248 - //  
249 - // sorts = sorts[0].sub;  
250 - // } else if (sorts && sorts.length > 1) { 246 + // singleSort = true;
  247 + //
  248 + // if (sorts[0].sub && sorts[0].sub.length === 1) {
  249 + // sorts[0].sub[0].checked = true;
  250 + // }
  251 + //
  252 + // if (q.misort) {
  253 + // sorts[0].sub.forEach(s => {
  254 + // s.checked = s.categoryId === q.misort;
  255 + // });
  256 + // }
  257 + //
  258 + // sorts = sorts[0].sub;
  259 + // } else if (sorts && sorts.length > 1) {
251 260
252 _.forEach(sorts, s => { 261 _.forEach(sorts, s => {
253 s.sub.unshift({ 262 s.sub.unshift({
@@ -74,7 +74,7 @@ @@ -74,7 +74,7 @@
74 <div class="brand-list nano"> 74 <div class="brand-list nano">
75 <div class="nano-content"> 75 <div class="nano-content">
76 {{#each brandData}} 76 {{#each brandData}}
77 - <div class="input-radio {{#if checked}}default-check{{/if}}" data-value="{{id}}"> 77 + <div class="input-radio {{#if checked}}default-check{{/if}}" data-value="{{id}}" data-word="{{brandAlif}}">
78 {{> icon/radio}} 78 {{> icon/radio}}
79 {{#if brandNameEn}} 79 {{#if brandNameEn}}
80 <label>{{brandNameEn}}</label> 80 <label>{{brandNameEn}}</label>
@@ -85,7 +85,7 @@ const callback = (req, res) => { @@ -85,7 +85,7 @@ const callback = (req, res) => {
85 cost: data.pay, 85 cost: data.pay,
86 orderNum: data.orderCode, 86 orderNum: data.orderCode,
87 onlineCost: data.pay, 87 onlineCost: data.pay,
88 - orderHref: helpers.urlFormat('/me/order/detail', {code: data.orderCode}), 88 + orderHref: helpers.urlFormat('/me/order/detail', {orderCode: data.orderCode}),
89 walkHref: helpers.urlFormat('/') 89 walkHref: helpers.urlFormat('/')
90 } 90 }
91 }); 91 });
@@ -338,16 +338,18 @@ var YohoListPage = { @@ -338,16 +338,18 @@ var YohoListPage = {
338 }, 338 },
339 filterBrand: function(letter) { 339 filterBrand: function(letter) {
340 $('.yoho-product-list .brand-list .input-radio').each(function() { 340 $('.yoho-product-list .brand-list .input-radio').each(function() {
341 - if (letter === '0-9') {  
342 - var first = $('label', this).text().toLowerCase().charAt(0); // eslint-disable-line 341 + var first = $(this).data('word').toString(); // eslint-disable-line
343 342
  343 + first = first.toLowerCase();
  344 + if (letter === '0-9') {
  345 + console.log(first);
344 if ((first >= 'a' && first <= 'z') || (first >= 'A' && first <= 'Z')) { 346 if ((first >= 'a' && first <= 'z') || (first >= 'A' && first <= 'Z')) {
345 $(this).hide(); 347 $(this).hide();
346 } else { 348 } else {
347 $(this).show(); 349 $(this).show();
348 } 350 }
349 } else { 351 } else {
350 - if ($('label', this).text().toLowerCase().indexOf(letter) === 0) { 352 + if (!letter || first === letter) {
351 $(this).show(); 353 $(this).show();
352 } else { 354 } else {
353 $(this).hide(); 355 $(this).hide();
@@ -22,7 +22,19 @@ var removedProsInfo = []; @@ -22,7 +22,19 @@ var removedProsInfo = [];
22 var removedGoodsTpl = require('../../../tpl/shopping/removed-goods.hbs'); 22 var removedGoodsTpl = require('../../../tpl/shopping/removed-goods.hbs');
23 var editTpl = require('../../../tpl/shopping/edit-color-size.hbs'); 23 var editTpl = require('../../../tpl/shopping/edit-color-size.hbs');
24 24
25 -var Cart = { 25 +var Cart;
  26 +
  27 +require('yoho-jquery-dotdotdot');
  28 +
  29 +function dotName() {
  30 +
  31 + // product name dotdotdot
  32 + $('.pro-name a').dotdotdot({
  33 + wrap: 'letter'
  34 + });
  35 +}
  36 +
  37 +Cart = {
26 /* 38 /*
27 * 添加到购物车 39 * 添加到购物车
28 * @function [addToCart] 40 * @function [addToCart]
@@ -111,6 +123,8 @@ var Cart = { @@ -111,6 +123,8 @@ var Cart = {
111 success: function(res) { 123 success: function(res) {
112 Util.refreshCart(res, function() { 124 Util.refreshCart(res, function() {
113 Stepper.init(); 125 Stepper.init();
  126 +
  127 + dotName();
114 if (callback) { 128 if (callback) {
115 return callback(); 129 return callback();
116 } 130 }
@@ -134,6 +148,7 @@ var Cart = { @@ -134,6 +148,7 @@ var Cart = {
134 if (res.code === 200) { 148 if (res.code === 200) {
135 Util.refreshCart(res, function() { 149 Util.refreshCart(res, function() {
136 Stepper.init(); 150 Stepper.init();
  151 + dotName();
137 }); 152 });
138 } else { 153 } else {
139 new _alert(res.message).show(); 154 new _alert(res.message).show();
@@ -204,6 +219,7 @@ var Cart = { @@ -204,6 +219,7 @@ var Cart = {
204 success: function(res) { 219 success: function(res) {
205 Util.refreshCart(res, function() { 220 Util.refreshCart(res, function() {
206 Stepper.init(); 221 Stepper.init();
  222 + dotName();
207 223
208 // 显示或者更新删除商品模块 224 // 显示或者更新删除商品模块
209 Cart.showRemovedProducts(products, extraInfos); 225 Cart.showRemovedProducts(products, extraInfos);
@@ -298,6 +314,8 @@ var Cart = { @@ -298,6 +314,8 @@ var Cart = {
298 success: function(res) { 314 success: function(res) {
299 Util.refreshCart(res, function() { 315 Util.refreshCart(res, function() {
300 Stepper.init(); 316 Stepper.init();
  317 + dotName();
  318 +
301 if (callback) { 319 if (callback) {
302 return callback(); 320 return callback();
303 } 321 }
@@ -316,6 +334,7 @@ var Cart = { @@ -316,6 +334,7 @@ var Cart = {
316 success: function(res) { 334 success: function(res) {
317 Util.refreshCart(res, function() { 335 Util.refreshCart(res, function() {
318 Stepper.init(); 336 Stepper.init();
  337 + dotName();
319 }); 338 });
320 } 339 }
321 }); 340 });
@@ -445,6 +464,9 @@ var Cart = { @@ -445,6 +464,9 @@ var Cart = {
445 }, 464 },
446 fail: function() { 465 fail: function() {
447 new _alert('此商品无法编辑颜色和尺寸').show(); 466 new _alert('此商品无法编辑颜色和尺寸').show();
  467 + },
  468 + complete: function() {
  469 + setEditable();
448 } 470 }
449 }); 471 });
450 472
@@ -471,11 +493,6 @@ var Cart = { @@ -471,11 +493,6 @@ var Cart = {
471 } 493 }
472 }; 494 };
473 495
474 -require('yoho-jquery-dotdotdot');  
475 -  
476 -// product name dotdotdot  
477 -$('.pro-name a').dotdotdot({  
478 - wrap: 'letter'  
479 -}); 496 +dotName();
480 497
481 module.exports = Cart; 498 module.exports = Cart;