Authored by Rock Zhang

未登录用户点击限购商品详情页的获取限购商品时会跳转到登录页

Code Review By Rock Zhang
@@ -83,22 +83,28 @@ if (goodsDiscountHammer && $discountFolder.children().length > 0) { @@ -83,22 +83,28 @@ if (goodsDiscountHammer && $discountFolder.children().length > 0) {
83 } 83 }
84 84
85 limitSaleHammer && limitSaleHammer.on('tap', function(e) { 85 limitSaleHammer && limitSaleHammer.on('tap', function(e) {
  86 + var loginUrl = $('#loginUrl').val();
  87 +
86 e.srcEvent.stopPropagation(); 88 e.srcEvent.stopPropagation();
87 - dialog.showDialog({  
88 - dialogText: '打开有货APP限定发售频道\n获取限购码',  
89 - hasFooter: {  
90 - rightBtnText: '打开Yoho!Buy有货APP'  
91 - }  
92 - }, function() {  
93 - window.location.href = appUrl;  
94 - }, undefined, true);  
95 -  
96 - $('.dialog-wrapper').off('touchstart').on('touchstart', function(e) {  
97 - e.stopPropagation();  
98 - if ($(e.target).hasClass('dialog-wrapper')) {  
99 - dialog.hideDialog();  
100 - }  
101 - }); 89 + if(loginUrl) {
  90 + window.location = loginUrl;
  91 + } else {
  92 + dialog.showDialog({
  93 + dialogText: '打开有货APP限定发售频道\n获取限购码',
  94 + hasFooter: {
  95 + rightBtnText: '打开Yoho!Buy有货APP'
  96 + }
  97 + }, function() {
  98 + window.location.href = appUrl;
  99 + }, undefined, true);
  100 +
  101 + $('.dialog-wrapper').off('touchstart').on('touchstart', function(e) {
  102 + e.stopPropagation();
  103 + if ($(e.target).hasClass('dialog-wrapper')) {
  104 + dialog.hideDialog();
  105 + }
  106 + });
  107 + }
102 }); 108 });
103 109
104 require('./desc'); 110 require('./desc');
@@ -177,5 +177,9 @@ @@ -177,5 +177,9 @@
177 <input id="preferenceUrl" type="hidden" value="{{preferenceUrl}}"> 177 <input id="preferenceUrl" type="hidden" value="{{preferenceUrl}}">
178 {{/if}} 178 {{/if}}
179 179
  180 + {{#loginUrl}}
  181 + <input type="hidden" name="loginUrl" id="loginUrl" value="{{.}}">
  182 + {{/loginUrl}}
  183 +
180 </div> 184 </div>
181 {{> layout/footer}} 185 {{> layout/footer}}
@@ -47,6 +47,11 @@ class DetailModel @@ -47,6 +47,11 @@ class DetailModel
47 47
48 $result['goodsName'] = $baseInfo['productName']; 48 $result['goodsName'] = $baseInfo['productName'];
49 49
  50 + // 用户未登录时
  51 + if (empty($uid)) {
  52 + $result['loginUrl'] = Helpers::url('/signin.html', array('refer' => Helpers::url('/product/show_' . $baseInfo['erpProductId']. '.html')));
  53 + }
  54 +
50 // 商品促销短语 55 // 商品促销短语
51 if (!empty($baseInfo['salesPhrase'])) { 56 if (!empty($baseInfo['salesPhrase'])) {
52 $result['goodsSubtitle'] = $baseInfo['salesPhrase']; 57 $result['goodsSubtitle'] = $baseInfo['salesPhrase'];