Authored by 沈志敏

fix bug

... ... @@ -958,7 +958,7 @@ let _getPromotionInfo = (skn) => {
*/
let _getFavorite = (productId, uid) => {
if (!uid) {
return Promise.resolve({});
return Promise.resolve(false);
}
return singleAPI.get('favorite', {
method: 'app.favorite.isFavoriteNew',
... ... @@ -969,7 +969,7 @@ let _getFavorite = (productId, uid) => {
return result.data;
}
return {};
return false;
});
};
... ... @@ -1489,7 +1489,7 @@ const _cartCount = (uid, shoppingKey) => {
}
return count;
}
return Promise.resolve(0);
return 0;
});
};
... ...
{{# cartInfo}}
<div class="chose-panel">
<div class="main">
<div class="infos">
<div class="infos {{#if @root.tickets}} tickets-info {{/if}}">
<div class="basic-info" >
{{#each thumbs}}
{{#if @first}}
<img class="thumb" src="{{img}}">
{{/if}}
<img class="thumb {{#unless @first}}hide{{/unless}}" src="{{img}}">
{{/each}}
<div class="text-info">
<p class="name">{{name}}</p>
<p class="price">
<span class="sale-price">{{salePrice}}</span>
<span class="market-price data-bind"></span>
{{#if price}}
<span class="sale-price">{{salePrice}}</span>
<span class="market-price">{{price}}</span>
{{else}}
{{# isY isSecKill}}
<span class="sale-price">{{salePrice}}</span>
<span class="market-price">{{salePrice}}</span>
{{else}}
<span class="sale-price no-price">{{salePrice}}</span>
{{/ isY}}
{{/if}}
</p>
</div>
</div>
<div class="chose-items">
<div class="color-list block-list">
<span class="name">颜色</span>
<ul id="" data-index="" class="size-row clearfix ">
<li class="block" data-num="">
</li>
</ul>
<span class="name">{{#if @root.tickets}}日期{{else}}颜色{{/if}}</span>
{{#each colors}}
<ul id="{{id}}" data-index="{{@index}}" class="size-row clearfix {{#unless @first}}hide{{/unless}}">
{{#each color}}
<li class="block {{#if chosed}} chosed{{/if}} {{#unless colorNum}} zero-stock{{/unless}}" data-num="{{colorNum}}">{{name}}</li>
{{/each}}
</ul>
{{/each}}
</div>
<div class="size-list block-list">
<span class="name">尺码</span>
<ul class="size-row clearfix">
<li class="block " data-num="" data-id="" data-skuid="">
</li>
</ul>
<div class="size-list block-list {{#if @root.single}} hide{{/if}}">
<span class="name">{{#if @root.tickets}}区域{{else}}尺码{{/if}}</span>
{{#each sizes}}
<ul class="size-row clearfix {{#unless @first}}hide{{/unless}}">
{{#each size}}
<li class="block {{#if chosed}} chosed{{/if}} {{#unless sizeNum}} zero-stock {{/unless}}" data-num="{{sizeNum}}" data-id="{{id}}" data-skuid="{{skuId}}">{{name}}</li>
{{/each}}
</ul>
{{/each}}
</div>
<div class="num">
<span class="name">数量</span>
<div class="clearfix">
<a class="btn btn-minus" href="javascript:void(0);">
<span class="iconfont ">&#xe625;</span>
<span class="iconfont {{#if promotionId}}disabled{{/if}}">&#xe625;</span>
</a>
<input id="good-num" class="good-num disabled" type="text" value="1" disabled="true">
<a class="btn btn-plus" href="javascript:void(0);">
<span class="iconfont ">&#xe624;</span>
<span class="iconfont {{#if promotionId}}disabled{{/if}}">&#xe624;</span>
</a>
</div>
<span class="left-num"></span>
<input id="left-num" type="hidden" value="0">
<input id="limitNum" type="hidden" value="">
<input id="limitNum" type="hidden" value="{{limit}}">
</div>
</div>
</div>
<div class="btn-wrap">
<button id="chose-btn-sure" class="btn btn-sure"></button>
<button id="chose-btn-sure" class="btn btn-sure">{{#if @root.tickets}}立即购买{{else}}加入购物车{{/if}}</button>
</div>
</div>
<input id="promotionId" type="hidden" value="">
<input id="single" type="hidden" value="">
<input id="promotionId" type="hidden" value="{{promotionId}}">
<input id="single" type="hidden" value="{{@root.single}}">
</div>
<div class="cart-bar">
{{#unless @root.wap.common.removeCartCount}}
... ...
... ... @@ -178,12 +178,13 @@ function checkColorSizeNum() {
function show(html, cb) {
if (html) {
$chosePanel.html(html);
if ($('#promotionId').val() !== '') {
disableNumEdit();
}
init();
}
if ($('#promotionId').val() !== '') {
disableNumEdit();
}
$('.chose-panel').show();
$num = $('#good-num');
cbFn = cb;
... ... @@ -558,7 +559,7 @@ $yohoPage.on('touchstart', '.btn-minus', function() {
$chosed = $('.block-list>ul>li.chosed');
if ($chosed.length === 2 && $chosed.closest('.zero-stock').length === 0) {
isSecKills = $('.seckill-time').length;// 秒杀标记
isSecKills = $('.seckill-time').length; // 秒杀标记
productSku = $curSizeBlock.data('skuid');
promotionId = $('#promotionId').val();
... ... @@ -591,12 +592,12 @@ $yohoPage.on('touchstart', '.btn-minus', function() {
url = '/cart/index/modify';
} else if (limitProductCode) {
isSecKills = $('.seckill-time').length;// 秒杀标记
isSecKills = $('.seckill-time').length; // 秒杀标记
$(this).css('background-color', '#ccc').removeAttr('id');
// 当前面板选择的是限购商品
url = $('#limitProductPay').val() + '?limitproductcode=' + limitProductCode + '&sku=' +
productSku + '&skn=' + skn + '&buy_number=' + buyNumber;
productSku + '&skn=' + skn + '&buy_number=' + buyNumber;
removePannel();
... ...
/**
* 判断是否是Y,应对接口经常返回Y/N做boolean
* @param string value
*/
module.exports = function(value, options) {
if (value === 'Y') {
return options.fn(this);
} else {
return options.inverse(this);
}
};
... ...
var $ = require('yoho-jquery'),
Swiper = require('yoho-swiper'),
tip = require('../plugin/tip'),
chosePanel = require('../common/chose-panel'),
dialog = require('../plugin/dialog'),
dbClass = 'data-bind';
dialog = require('../plugin/dialog');
var dbClass = 'data-bind';
require('../common');
... ... @@ -31,7 +31,9 @@ var infoDataHbs = require('product/detail/infodata.hbs');
var priceDataHbs = require('product/detail/pricedata.hbs');
var renderInfo = function(data) {
if (!data) { return; }
if (!data) {
return;
}
// 商品价格
if (data.goodsPrice) {
... ... @@ -63,8 +65,6 @@ var renderInfo = function(data) {
return false;
});
}, 200);
} else {
chosePanel(data);
}
};
... ... @@ -73,6 +73,7 @@ var getInfoData = function() {
var productId = $('#productId').val();
var goodsId = $('#goodsId').val();
var productSkn = $('#productSkn').val();
if (productId && (goodsId || productSkn)) {
$.ajax({
type: 'POST',
... ... @@ -91,6 +92,7 @@ var getInfoData = function() {
// var regProSeckill = /\/product\/seckill\/pro_([\d]+)_([\d]+)/;
var thisHref = window.location.href;
var thisRefer = document.referrer;
if (!regSeckill.test(thisRefer)) {
if (data.isSecKill === 'Y' && (reg.test(thisHref) || regPro.test(thisHref))) {
window.location.replace('/product/seckill/show_' + $('#productSkn').val() + '.html');
... ... @@ -136,6 +138,8 @@ var getInfoData = function() {
rightBtnText: '打开Yoho!Buy有货APP'
}
}, function() {
var appUrl = $('input[name="limitCodeUrl"]').val();
ifr = document.createElement('iframe');
ifr.src = appUrl;
ifr.style.display = 'none';
... ...