Authored by ccbikai

Merge branch 'develop' of git.yoho.cn:fe/yohoblk-wap into develop

1 <div class="my-page"> 1 <div class="my-page">
2 <div class="my-header"> 2 <div class="my-header">
3 <span class="setting icon icon-setting" id="setting"></span> 3 <span class="setting icon icon-setting" id="setting"></span>
4 - <a class="user-info no-intercept" id="user-info" href='/home/mydetails'> 4 + <a class="user-info" id="user-info" href='/home/mydetails'>
5 <span class="user-avatar" {{#if head_ico}} style="background-image: url('{{head_ico}}');" {{/if}}></span> 5 <span class="user-avatar" {{#if head_ico}} style="background-image: url('{{head_ico}}');" {{/if}}></span>
6 <br><span class="username">{{nickname}}</span> 6 <br><span class="username">{{nickname}}</span>
7 </a> 7 </a>
8 </div> 8 </div>
9 <div class="my-order"> 9 <div class="my-order">
10 - <a class="order-title no-intercept" href="/home/orders?type=1"> 10 + <a class="order-title" href="/home/orders?type=1">
11 我的订单 11 我的订单
12 <span class="read-order"> 12 <span class="read-order">
13 查看全部订单 <span class="icon icon-right"></span> 13 查看全部订单 <span class="icon icon-right"></span>
14 </span> 14 </span>
15 </a> 15 </a>
16 <div class="order-type clearfix"> 16 <div class="order-type clearfix">
17 - <a class="type-item no-intercept" href="/home/orders?type=2"> 17 + <a class="type-item" href="/home/orders?type=2">
18 <span class="icon icon-wait-pay"></span> 18 <span class="icon icon-wait-pay"></span>
19 <br>待付款 19 <br>待付款
20 {{#if wait_pay_num}} 20 {{#if wait_pay_num}}
21 <span class="num">{{wait_pay_num}}</span> 21 <span class="num">{{wait_pay_num}}</span>
22 {{/if}} 22 {{/if}}
23 </a> 23 </a>
24 - <a class="type-item no-intercept" href="/home/orders?type=3"> 24 + <a class="type-item" href="/home/orders?type=3">
25 <span class="icon icon-wait-cargo"></span> 25 <span class="icon icon-wait-cargo"></span>
26 <br>待发货 26 <br>待发货
27 {{#if wait_cargo_num}} 27 {{#if wait_cargo_num}}
28 <span class="num">{{wait_cargo_num}}</span> 28 <span class="num">{{wait_cargo_num}}</span>
29 {{/if}} 29 {{/if}}
30 </a> 30 </a>
31 - <a class="type-item no-intercept" href="/home/orders?type=4"> 31 + <a class="type-item" href="/home/orders?type=4">
32 <span class="icon icon-send-cargo"></span> 32 <span class="icon icon-send-cargo"></span>
33 <br>待收货 33 <br>待收货
34 {{#if send_cargo_num}} 34 {{#if send_cargo_num}}
35 <span class="num">{{send_cargo_num}}</span> 35 <span class="num">{{send_cargo_num}}</span>
36 {{/if}} 36 {{/if}}
37 </a> 37 </a>
38 - <a class="type-item no-intercept" href="/home/refund/orders"> 38 + <a class="type-item" href="/home/refund/orders">
39 <span class="icon icon-refund-exchange"></span> 39 <span class="icon icon-refund-exchange"></span>
40 <br>退换货 40 <br>退换货
41 {{#if refund_exchange_num}} 41 {{#if refund_exchange_num}}
@@ -45,7 +45,7 @@ @@ -45,7 +45,7 @@
45 </div> 45 </div>
46 </div> 46 </div>
47 <div class="group-list"> 47 <div class="group-list">
48 - <a class="list-item no-intercept" id="address"> 48 + <a class="list-item" id="address">
49 地址管理 49 地址管理
50 <span class="num">{{address_num}} <span class="icon icon-right"></span></span> 50 <span class="num">{{address_num}} <span class="icon icon-right"></span></span>
51 </a> 51 </a>
@@ -61,17 +61,17 @@ @@ -61,17 +61,17 @@
61 </a> 61 </a>
62 </div> 62 </div>
63 <div class="group-list"> 63 <div class="group-list">
64 - <a class="list-item no-intercept" href="/home/mycurrency"> 64 + <a class="list-item" href="/home/mycurrency">
65 YOHO 币 65 YOHO 币
66 <span class="num">{{yoho_coin_num}} <span class="icon icon-right"></span></span> 66 <span class="num">{{yoho_coin_num}} <span class="icon icon-right"></span></span>
67 </a> 67 </a>
68 </div> 68 </div>
69 <div class="group-list"> 69 <div class="group-list">
70 - <a class="list-item no-intercept" href="/home/help"> 70 + <a class="list-item" href="/home/help">
71 帮助中心 71 帮助中心
72 <span class="num"><span class="icon icon-right"></span></span> 72 <span class="num"><span class="icon icon-right"></span></span>
73 </a> 73 </a>
74 - <a class="list-item no-intercept" href="/home/service"> 74 + <a class="list-item" href="/home/service">
75 在线客服 75 在线客服
76 <span class="num"><span class="icon icon-right"></span></span> 76 <span class="num"><span class="icon icon-right"></span></span>
77 </a> 77 </a>
1 var yoho = require('yoho'); 1 var yoho = require('yoho');
2 var $ = require('yoho-jquery'); 2 var $ = require('yoho-jquery');
3 -var interceptClick = require('common/intercept-click');  
4 3
5 -// 地址管理  
6 -$('#address').on('click', function() {  
7 - yoho.goAddress({  
8 - 'type': '2' 4 +if (!yoho.isLogin) {
  5 + $('a').addClass('no-intercept');
  6 + $('a').on('click', function(){
  7 + yoho.goLogin();
  8 + return false;
  9 + })
  10 +} else {
  11 + // 地址管理
  12 + $('#address').on('click', function() {
  13 + yoho.goAddress({
  14 + 'type': '2'
  15 + });
  16 + return false;
9 }); 17 });
10 - return false;  
11 -}); 18 +}
12 19
13 // 系统设置 20 // 系统设置
14 $('#setting').on('click', function() { 21 $('#setting').on('click', function() {
15 yoho.goSetting(); 22 yoho.goSetting();
16 return false; 23 return false;
17 }); 24 });
18 -  
19 -$('.my-page').on('click', 'a', function() {  
20 - // 未登录时跳转至登录页  
21 - if (!yoho.isLogin) {  
22 - yoho.goLogin();  
23 - return false;  
24 - }  
25 -  
26 - // 拦截跳转  
27 - var href = $(this).attr('href');  
28 - if (href) {  
29 - interceptClick(href);  
30 - return false;  
31 - }  
32 -});  
@@ -65,14 +65,15 @@ @@ -65,14 +65,15 @@
65 tab: 'brand' 65 tab: 'brand'
66 } 66 }
67 }).then(data => { 67 }).then(data => {
68 - if (_this.page === data.pageTotal) { 68 + if (data.pageTotal && _this.page === data.pageTotal) {
69 _this.busy = true; 69 _this.busy = true;
70 } else { 70 } else {
71 _this.busy = false; 71 _this.busy = false;
72 } 72 }
73 73
74 - data.brandList.forEach(function(o){  
75 - if (!_this.keys[o.brandId]) { 74 + if (data.brandList) {
  75 + data.brandList.forEach(function(o){
  76 + if (!_this.keys[o.brandId]) {
76 _this.keys[o.brandId] = true; 77 _this.keys[o.brandId] = true;
77 78
78 _this.brandData.push({ 79 _this.brandData.push({
@@ -83,7 +84,8 @@ @@ -83,7 +84,8 @@
83 down: o.status === 0 84 down: o.status === 0
84 }); 85 });
85 } 86 }
86 - }) 87 + });
  88 + }
87 89
88 _this.nullbox = _this.brandData.length ? 'hide' : ''; 90 _this.nullbox = _this.brandData.length ? 'hide' : '';
89 }).fail(() => { 91 }).fail(() => {
@@ -69,38 +69,40 @@ @@ -69,38 +69,40 @@
69 page: ++_this.page 69 page: ++_this.page
70 } 70 }
71 }).then(data => { 71 }).then(data => {
72 - if (_this.page === data.pageTotal) { 72 + if (data.pageTotal && _this.page === data.pageTotal) {
73 _this.busy = true; 73 _this.busy = true;
74 } else { 74 } else {
75 _this.busy = false; 75 _this.busy = false;
76 } 76 }
77 77
78 - data.productList.forEach(function(o){  
79 - if (!o.productSkn) {  
80 - return;  
81 - }  
82 -  
83 - if (!_this.keys[o.productId]) {  
84 - _this.keys[o.productId] = true;  
85 -  
86 - let discountPrice = false;  
87 -  
88 - if (Number(o.marketPrice) - Number(o.salesPrice) > 0) {  
89 - discountPrice = '¥' + Number(Math.max(o.salesPrice, 0)).toFixed(2); 78 + if (data.productList) {
  79 + data.productList.forEach(function(o){
  80 + if (!o.productSkn) {
  81 + return;
90 } 82 }
91 83
92 - _this.productData.push({  
93 - fav_id: o.productId,  
94 - link: o.goodsId && o.cnAlphabet ? o.productId : '',  
95 - imgUrl: o.image,  
96 - title: o.productName,  
97 - price: '¥' + Number(Math.max(o.marketPrice, 0)).toFixed(2),  
98 - discountPrice: discountPrice,  
99 - sellOut: o.storage <= 0,  
100 - invalidGoods: o.status === 0  
101 - });  
102 - }  
103 - }) 84 + if (!_this.keys[o.productId]) {
  85 + _this.keys[o.productId] = true;
  86 +
  87 + let discountPrice = false;
  88 +
  89 + if (Number(o.marketPrice) - Number(o.salesPrice) > 0) {
  90 + discountPrice = '¥' + Number(Math.max(o.salesPrice, 0)).toFixed(2);
  91 + }
  92 +
  93 + _this.productData.push({
  94 + fav_id: o.productId,
  95 + link: o.goodsId && o.cnAlphabet ? o.productId : '',
  96 + imgUrl: o.image,
  97 + title: o.productName,
  98 + price: '¥' + Number(Math.max(o.marketPrice, 0)).toFixed(2),
  99 + discountPrice: discountPrice,
  100 + sellOut: o.storage <= 0,
  101 + invalidGoods: o.status === 0
  102 + });
  103 + }
  104 + });
  105 + }
104 106
105 _this.nullbox = _this.productData.length ? 'hide' : ''; 107 _this.nullbox = _this.productData.length ? 'hide' : '';
106 }).fail(() => { 108 }).fail(() => {