Authored by htoooth

add limited 5.2

@@ -32,7 +32,7 @@ const HeaderModel = require('../../../doraemon/models/header'); @@ -32,7 +32,7 @@ const HeaderModel = require('../../../doraemon/models/header');
32 const BLANK_STR = ' '; 32 const BLANK_STR = ' ';
33 33
34 // 展览票 34 // 展览票
35 -const EXHIBITION_TICKET = 51335912; 35 +const YOHOOD_TICKET = 51335912;
36 36
37 const _getProductAdditionInfoAsync = (data) => { 37 const _getProductAdditionInfoAsync = (data) => {
38 return co(function * () { 38 return co(function * () {
@@ -1207,6 +1207,7 @@ const _detailDataPkg = (origin, uid, vipLevel, cookies) => { @@ -1207,6 +1207,7 @@ const _detailDataPkg = (origin, uid, vipLevel, cookies) => {
1207 result.openSoon = fashTopGoods.openSoon; // 即将开售 1207 result.openSoon = fashTopGoods.openSoon; // 即将开售
1208 result.dis = fashTopGoods.dis; // 是否失效 1208 result.dis = fashTopGoods.dis; // 是否失效
1209 result.buyNow = fashTopGoods.buyNow; // 是否立即购买 1209 result.buyNow = fashTopGoods.buyNow; // 是否立即购买
  1210 + result.buyNowBase = helpers.urlFormat('/limited', null, 'shopping'); // 购买链接
1210 } 1211 }
1211 } 1212 }
1212 1213
@@ -1215,14 +1216,12 @@ const _detailDataPkg = (origin, uid, vipLevel, cookies) => { @@ -1215,14 +1216,12 @@ const _detailDataPkg = (origin, uid, vipLevel, cookies) => {
1215 let notForSale = propOrigin('attribute') === 2; // 非卖品 1216 let notForSale = propOrigin('attribute') === 2; // 非卖品
1216 let virtualGoods = propOrigin('attribute') === 3; // 虚拟商品 1217 let virtualGoods = propOrigin('attribute') === 3; // 虚拟商品
1217 1218
  1219 +
1218 if (virtualGoods) { 1220 if (virtualGoods) {
1219 result.virtualGoods = virtualGoods; 1221 result.virtualGoods = virtualGoods;
1220 1222
1221 // 是否显示虚拟商品,立即购买按钮 1223 // 是否显示虚拟商品,立即购买按钮
1222 result.isVirtualBtn = soldOut ? false : true; 1224 result.isVirtualBtn = soldOut ? false : true;
1223 -  
1224 - // 是否展览票  
1225 - result.isTicket = propOrigin('product_skn') === EXHIBITION_TICKET;  
1226 } 1225 }
1227 1226
1228 if (!soldOut && !notForSale && !virtualGoods) { 1227 if (!soldOut && !notForSale && !virtualGoods) {
@@ -1239,10 +1238,14 @@ const _detailDataPkg = (origin, uid, vipLevel, cookies) => { @@ -1239,10 +1238,14 @@ const _detailDataPkg = (origin, uid, vipLevel, cookies) => {
1239 // 已售磬 1238 // 已售磬
1240 result.soldOut = true; 1239 result.soldOut = true;
1241 delete result.fashTopGoods; 1240 delete result.fashTopGoods;
1242 - } else if (virtualGoods) { 1241 + }
  1242 +
  1243 + // 电子票
  1244 + result.isTicket = propOrigin('product_skn') === YOHOOD_TICKET;
  1245 + if (virtualGoods && result.isTicket) {
1243 // 虚拟商品 1246 // 虚拟商品
1244 result.buyNow = true; // 是否立即购买 1247 result.buyNow = true; // 是否立即购买
1245 - result.buyNowBase = helpers.urlFormat('ticket', null, 'shopping'); 1248 + result.buyNowBase = helpers.urlFormat('/ticket', null, 'shopping');
1246 if (result.salePrice) { 1249 if (result.salePrice) {
1247 result.advancePrice = result.salePrice; // 先行价格 1250 result.advancePrice = result.salePrice; // 先行价格
1248 delete result.salePrice; 1251 delete result.salePrice;
@@ -41,6 +41,14 @@ var $saleReturn = $('#saleReturn'); @@ -41,6 +41,14 @@ var $saleReturn = $('#saleReturn');
41 41
42 var dialogTpl = require('hbs/product/coupon-dialog.hbs'); 42 var dialogTpl = require('hbs/product/coupon-dialog.hbs');
43 43
  44 +function productUrl(s) {
  45 + return window.location.href + '?openby:yohobuy={"action":"go.productDetail","params":{"product_skn":"' + s + '"}}';
  46 +}
  47 +
  48 +function isEmpty(el) {
  49 + return !$.trim(el.html());
  50 +}
  51 +
44 bindEvent.add(function() { 52 bindEvent.add(function() {
45 var $imgShow = $('#img-show'), 53 var $imgShow = $('#img-show'),
46 $thumbs = $('#thumbs > .thumb-wrap'); 54 $thumbs = $('#thumbs > .thumb-wrap');
@@ -60,6 +68,8 @@ bindEvent.add(function() { @@ -60,6 +68,8 @@ bindEvent.add(function() {
60 var $lcContainer = $('.lc-container'), 68 var $lcContainer = $('.lc-container'),
61 $itemBuy = $('.item-buy'); 69 $itemBuy = $('.item-buy');
62 70
  71 + var $qrcode = $('.qr-code');
  72 +
63 var $descColor = $('#desc-color'); 73 var $descColor = $('#desc-color');
64 74
65 var thumbsLoaded = {}; 75 var thumbsLoaded = {};
@@ -223,6 +233,7 @@ bindEvent.add(function() { @@ -223,6 +233,7 @@ bindEvent.add(function() {
223 }()); 233 }());
224 234
225 require('../plugins/share'); 235 require('../plugins/share');
  236 + require('yoho-jquery-qrcode');
226 237
227 // 颜色 238 // 颜色
228 $('.colors').on('click', 'li', function() { 239 $('.colors').on('click', 'li', function() {
@@ -379,6 +390,15 @@ bindEvent.add(function() { @@ -379,6 +390,15 @@ bindEvent.add(function() {
379 // 限购码 390 // 限购码
380 $('.get-lc:not(.dis)').hover(function() { 391 $('.get-lc:not(.dis)').hover(function() {
381 $lcContainer.removeClass('hide'); 392 $lcContainer.removeClass('hide');
  393 +
  394 + if (isEmpty($qrcode)) {
  395 + $qrcode.qrcode({
  396 + render: 'table',
  397 + size: 140,
  398 + text: productUrl(skn)
  399 + });
  400 + }
  401 +
382 }, function() { 402 }, function() {
383 $lcContainer.addClass('hide'); 403 $lcContainer.addClass('hide');
384 }); 404 });
@@ -510,9 +510,8 @@ @@ -510,9 +510,8 @@
510 padding: 40px 25px 0; 510 padding: 40px 25px 0;
511 511
512 .qr-code { 512 .qr-code {
513 - width: 137px;  
514 - height: 137px;  
515 - background: resolve("product/top-good-qr.png"); 513 + width: 140px;
  514 + height: 140px;
516 margin: 0 auto; 515 margin: 0 auto;
517 } 516 }
518 517