Authored by 梁志锋

限购商品详情 跳转APP

@@ -82,20 +82,41 @@ if (goodsDiscountHammer && $discountFolder.children().length > 0) { @@ -82,20 +82,41 @@ if (goodsDiscountHammer && $discountFolder.children().length > 0) {
82 }); 82 });
83 } 83 }
84 84
85 -limitSaleHammer && limitSaleHammer.on('tap', function(e) {  
86 - var loginUrl = $('#loginUrl').val(); 85 +$('#limit-sale').on('touchend', function(e) {
  86 + var loginUrl = $('#loginUrl').val(),
  87 + u = navigator.userAgent,
  88 + ifr;
  89 +
  90 + var isAndroid = u.indexOf('Android') > -1 || u.indexOf('Linux') > -1,
  91 + isIPhone = u.indexOf('iPhone') > -1,
  92 + isIPad = u.indexOf('iPad') > -1;
  93 +
  94 + e.stopPropagation();
87 95
88 - e.srcEvent.stopPropagation();  
89 if(loginUrl) { 96 if(loginUrl) {
90 window.location = loginUrl; 97 window.location = loginUrl;
91 } else { 98 } else {
92 dialog.showDialog({ 99 dialog.showDialog({
93 - dialogText: '打开有货APP限定发售频道\n获取限购码', 100 + dialogText: '进入有货APP,获取限购码',
94 hasFooter: { 101 hasFooter: {
95 rightBtnText: '打开Yoho!Buy有货APP' 102 rightBtnText: '打开Yoho!Buy有货APP'
96 } 103 }
97 }, function() { 104 }, function() {
98 - window.location.href = appUrl; 105 +
  106 + ifr = document.createElement('iframe');
  107 + ifr.src = appUrl;
  108 + ifr.style.display = 'none';
  109 + document.body.appendChild(ifr);
  110 + window.location.href = appUrl;
  111 + window.setTimeout(function(){
  112 + document.body.removeChild(ifr);
  113 + if (isAndroid) {
  114 + window.location.href = 'http://yoho-apps.qiniudn.com/YohoBuy_YOHO.apk';
  115 + } else if (isIPhone || isIPad) {
  116 + window.location.href = 'https://itunes.apple.com/cn/app/yoho!-you-huo/id490655927?mt=8';
  117 + }
  118 + },3000)
  119 +
99 }, undefined, true); 120 }, undefined, true);
100 121
101 $('.dialog-wrapper').off('touchstart').on('touchstart', function(e) { 122 $('.dialog-wrapper').off('touchstart').on('touchstart', function(e) {