Authored by 张丽霞

商品详情模板

  1 +/**
  2 + * 购物车Logic
  3 + * @author: xuqi<qi.xu@yoho.cn>
  4 + * @date: 2015/10/20
  5 + */
  6 +var $ = require('jquery'),
  7 + ellipsis = require('mlellipsis'),
  8 + Hammer = require('yoho.hammer');
  9 +
  10 +var chosePanel = require('./chose-panel'),
  11 + dialog = require('../me/dialog'),
  12 + loading = require('../plugin/loading'),
  13 + tip = require('../plugin/tip');
  14 +
  15 +var $cartContent = $('.cart-content'),
  16 + cartType = $('#cartType').val(),
  17 + $cartNav = $('.cart-nav'),
  18 + $cartPage = $('.shopping-cart-page'),
  19 + hasShowCartPresellTip = false;
  20 +
  21 +var navHammer,
  22 + advanceBuyHammer,
  23 + freebieHammer,
  24 + switchChose = false;
  25 +
  26 +var isRefreshByDelete = window.cookie('_yoho-cart-refreshByDelete') === 'true' ? true : false;
  27 +
  28 +var lowStockCount = 0;
  29 +
  30 +
  31 +loading.showLoadingMask();
  32 +
  33 +function needLoadRecommandForYou() {
  34 + return window.isCookiesEnabled() ?
  35 + $('.cart-goods').length <= 0 && !isRefreshByDelete :
  36 + $('.cart-goods').length <= 0;
  37 +}
  38 +
  39 +
  40 +if (needLoadRecommandForYou()) {
  41 + require('../product/recommend-for-you');
  42 +} else {
  43 + if (isRefreshByDelete) {
  44 + $('body').css('background-color', '#f0f0f0');
  45 + }
  46 + require('./good');
  47 +}
  48 +
  49 +$cartPage.css('display', 'block');
  50 +loading.hideLoadingMask();
  51 +
  52 +window.setCookie('_yoho-cart-refreshByDelete', false);
  53 +
  54 +ellipsis.init();
  55 +
  56 +function cartContentShow() {
  57 + return $cartContent.not('.hide');
  58 +}
  59 +
  60 +function mlellipsisHiddenNames() {
  61 + cartContentShow().find('.shopping-cart-good .name').each(function() {
  62 + this.mlellipsis(2);
  63 + });
  64 + switchChose = true;
  65 +}
  66 +
  67 +function hasChecked() {
  68 + return cartContentShow().find('.cart-goods .icon-cb-checked').length > 0 ? true : false;
  69 +}
  70 +
  71 +function shouldSelectGift() {
  72 + var $freebie = cartContentShow().find('.freebie');
  73 +
  74 + if ($freebie.length <= 0) {
  75 + return false;
  76 + }
  77 +
  78 + return true;
  79 +}
  80 +
  81 +function shouldLowStocks() {
  82 + var $lowStocks,
  83 + result = false;
  84 +
  85 + if (cartType === 'ordinary') {
  86 + $lowStocks = $('.common .low-stocks');
  87 + } else if (cartType === 'advance') {
  88 + $lowStocks = $('.presell .low-stocks');
  89 + }
  90 +
  91 + if ($lowStocks.length <= 0) {
  92 + return result;
  93 + }
  94 +
  95 + $lowStocks.each(function(idx, item) {
  96 + if ($(item).parent().parent().parent().siblings('.checkbox').hasClass('icon-cb-checked')) {
  97 + lowStockCount += 1;
  98 + result = true;
  99 + }
  100 + });
  101 +
  102 + return result;
  103 +}
  104 +
  105 +function showChooseGifDialog() {
  106 + dialog.showDialog({
  107 + dialogText: '您还未选择赠品,是否去选择赠品',
  108 + hasFooter: {
  109 + leftBtnText: '我不要赠品',
  110 + rightBtnText: '去选择'
  111 + }
  112 + }, function() {
  113 + window.location.href = cartContentShow().find('.freebie > a').attr('href');
  114 + }, function() {
  115 + var info = window.cookie('order-info');
  116 +
  117 + if (info) {
  118 + window.setCookie('order-info', '');
  119 + }
  120 + window.location.href = '/cart/index/orderEnsure?cartType=' + cartType;
  121 + });
  122 +}
  123 +
  124 +if (typeof window.cookie === 'function' && window.cookie('_hasShowCartPresellTip') === 'y') {
  125 + $('#presell-tip').removeClass('show').addClass('hide');
  126 + hasShowCartPresellTip = true;
  127 +} else {
  128 + $('#presell-tip').removeClass('hide').addClass('show');
  129 +}
  130 +
  131 +if (cartType === 'advance') {
  132 + $cartContent.toggleClass('hide');
  133 + $('#common-cart-nav').removeClass('active');
  134 + $('#presell-cart-nav').addClass('active');
  135 +
  136 + mlellipsisHiddenNames();
  137 + $(window).trigger('scroll');
  138 +}
  139 +
  140 +if ($cartNav.length > 0) {
  141 + navHammer = new Hammer(document.getElementsByClassName('cart-nav')[0]);
  142 + navHammer.on('tap', function(e) {
  143 + var $this = $(e.target).closest('li');
  144 +
  145 + if ($this.hasClass('active')) {
  146 + return;
  147 + }
  148 +
  149 + if (cartType === 'ordinary') {
  150 + cartType = 'advance';
  151 + $('#cartType').val('advance');
  152 + } else {
  153 + cartType = 'ordinary';
  154 + $('#cartType').val('ordinary');
  155 + }
  156 +
  157 + $this.siblings('.active').removeClass('active');
  158 + $this.addClass('active');
  159 +
  160 + // 切换普通商品和预售商品购物车显示
  161 + $cartContent.toggleClass('hide');
  162 +
  163 + if (switchChose === false) {
  164 + mlellipsisHiddenNames();
  165 + }
  166 +
  167 + // trigger lazyload
  168 + $(window).trigger('scroll');
  169 + });
  170 +
  171 + if (!hasShowCartPresellTip) {
  172 + setTimeout(function() {
  173 + $('#presell-tip').removeClass('show').addClass('hide');
  174 + window.setCookie('_hasShowCartPresellTip', 'y');
  175 + }, 3000);
  176 + }
  177 +}
  178 +
  179 +if ($('.advance-buy').length > 0) {
  180 + advanceBuyHammer = new Hammer(document.getElementsByClassName('advance-buy')[0]);
  181 + advanceBuyHammer.on('tap', function() {
  182 + window.location.href = '/cart/index/advanceBuy?cartType=' + cartType;
  183 + });
  184 +}
  185 +
  186 +if ($('.freebie').length > 0) {
  187 + freebieHammer = new Hammer(document.getElementsByClassName('freebie')[0]);
  188 + freebieHammer.on('tap', function() {
  189 + window.location.href = '/cart/index/gift?cartType=' + cartType;
  190 + });
  191 +}
  192 +
  193 +$('.btn-balance').on('touchend', function() {
  194 + var info = window.cookie('order-info');
  195 +
  196 + lowStockCount = 0;
  197 +
  198 + if (shouldLowStocks()) {
  199 + tip.show('所选商品中有' + lowStockCount + '种库存不足的商品');
  200 + return false;
  201 + }
  202 +
  203 + if (shouldSelectGift()) {
  204 + showChooseGifDialog();
  205 + return false;
  206 + }
  207 +
  208 + if (hasChecked()) {
  209 + if (info) {
  210 + window.setCookie('order-info', '');
  211 + }
  212 + window.location.href = '/cart/index/orderEnsure?cartType=' + cartType;
  213 + } else {
  214 + tip.show('请先勾选商品');
  215 + }
  216 +});
  217 +
  218 +$('.off-shell-goods').on('touchstart touchend', function(e) {
  219 + var $this = $(e.target).closest('span');
  220 +
  221 + if ($this.hasClass('icon-del')) {
  222 + return;
  223 + }
  224 +
  225 + tip.show('商品已下架');
  226 + return false;
  227 +});
  228 +
  229 +$('.chose').on('touchend', function() {
  230 + chosePanel.show();
  231 +});
  232 +
  233 +$cartNav.on('touchstart', 'li', function() {
  234 + $(this).addClass('bytouch');
  235 +}).on('touchend touchcancel', function() {
  236 + $cartNav.find('li').removeClass('bytouch');
  237 +});
  238 +
  239 +// 提前触发lazyload
  240 +$(window).scrollTop(1).scrollTop(0);
  1 +/**
  2 + * 赠品/加价购
  3 + * @author: xuqi<qi.xu@yoho.cn>
  4 + * @date: 2015/10/23
  5 + */
  6 +
  7 +var $ = require('jquery'),
  8 + ellipsis = require('mlellipsis'),
  9 + lazyLoad = require('yoho.lazyload'),
  10 + Hammer = require('yoho.hammer'),
  11 + tip = require('../plugin/tip'),
  12 + loading = require('../plugin/loading'),
  13 + chosePanel = require('./chose-panel');
  14 +
  15 +var $page = $('.gift-advance-page'),
  16 + queryString = $.queryString();
  17 +
  18 +require('../common');
  19 +
  20 +lazyLoad($('.lazy'));
  21 +ellipsis.init();
  22 +
  23 +function getProductInfo(skn, promotionId) {
  24 + loading.showLoadingMask();
  25 + $.get('/cart/index/giftinfo', {
  26 + skn: skn,
  27 + promotionId: promotionId
  28 + }).then(function(html) {
  29 + if (!html) {
  30 + tip.show('网络错误');
  31 + return;
  32 + }
  33 + chosePanel.show(html, function() {
  34 + window.location.href = '/cart/index/index?cartType=' + queryString.cartType;
  35 + });
  36 + }, function() {
  37 + tip.show('网络错误');
  38 + }).always(function() {
  39 + loading.hideLoadingMask();
  40 + });
  41 +}
  42 +
  43 +$page.find('.chose').each(function(i, elem) {
  44 + var choseHammer = new Hammer(elem);
  45 +
  46 + choseHammer.on('tap', function(e) {
  47 + var $this = $(e.target),
  48 + id = $this.closest('.gift-advance-good').data('id'),
  49 + promotionId = $this.closest('.advance-block').data('promotion-id');
  50 +
  51 + getProductInfo(id, promotionId);
  52 + });
  53 +});
  54 +
  55 +setTimeout(function() {
  56 + $('.gift-advance-good .name').each(function() {
  57 + this.mlellipsis(2);
  58 + });
  59 +}, 0);
  1 +/**
  2 + * 购物车商品
  3 + * @author: xuqi<qi.xu@yoho.cn>
  4 + * @date: 2015/10/20
  5 + */
  6 +
  7 +var $ = require('jquery'),
  8 + ellipsis = require('mlellipsis'),
  9 + chosePanel = require('../cart/chose-panel'),
  10 + loading = require('../plugin/loading'),
  11 + lazyLoad = require('yoho.lazyload');
  12 +
  13 +var dialog = require('../me/dialog'),
  14 + tip = require('../plugin/tip');
  15 +
  16 +var $selectAllBtn = $('.balance .checkbox'),
  17 + requesting = false;
  18 +
  19 +// 上次编辑的商品skn
  20 +var previousEditSkn;
  21 +
  22 +ellipsis.init();
  23 +
  24 +lazyLoad({
  25 + try_again_css: 'order-failure'
  26 +});
  27 +
  28 +setTimeout(function() {
  29 + $('.shopping-cart-good .name').each(function() {
  30 + this.mlellipsis(2);
  31 + });
  32 +}, 0);
  33 +
  34 +function GoodInfo(properties) {
  35 + this.goods_type = properties.goods_type;
  36 + this.buy_number = properties.buy_number;
  37 + this.product_sku = properties.product_sku;
  38 + this.selected = properties.selected;
  39 +}
  40 +
  41 +// TIP:事件委托在.cart-goods,商品列表的容器统一需要有.cart-goods
  42 +$('.cart-goods').on('touchstart', '.checkbox', function() {
  43 + var $this = $(this),
  44 + $good = $this.closest('.shopping-cart-good'),
  45 + id = $good.data('id');
  46 +
  47 + var goodsList = [],
  48 + goodInfo = {};
  49 +
  50 + if (!$this.hasClass('icon-cb-checked') && $this.siblings('.info').find('.low-stocks').length > 0) {
  51 + tip.show('库存不足,无法购买');
  52 + return false;
  53 + }
  54 +
  55 + goodInfo.goods_type = $('#cartType').val();
  56 + goodInfo.selected = $this.hasClass('icon-cb-checked') ? 'N' : 'Y';
  57 + goodInfo.product_sku = id;
  58 + goodInfo.buy_number = $good.find('.count').eq(0).text().trim().replace('×', '');
  59 + goodsList.push(new GoodInfo(goodInfo));
  60 +
  61 + $.ajax({
  62 + type: 'post',
  63 + url: 'select',
  64 + data: {
  65 + skuList: JSON.stringify(goodsList)
  66 + }
  67 + }).then(function(data) {
  68 + if (data.code === 200) {
  69 + if ($this.hasClass('icon-cb-checked')) {
  70 + $this.removeClass('icon-cb-checked').addClass('icon-checkbox');
  71 + } else {
  72 + $this.removeClass('icon-checkbox').addClass('icon-cb-checked');
  73 + }
  74 + window.location.href = '/cart/index/index?cartType=' + $('#cartType').val();
  75 + } else if (data.code === 400) {
  76 + tip.show('网络异常');
  77 + }
  78 + }, function() {
  79 + tip.show('网络异常');
  80 + });
  81 +});
  82 +
  83 +/*
  84 + * 显示购物车编辑面板。
  85 + *
  86 + * @param {String} html. chose-pannel模板,由服务端返回
  87 + *
  88 + * @param {String} id. 商品skuid
  89 + *
  90 + * @param {Bool} isSelected. 所要编辑的商品是否被选中
  91 + *
  92 + * @param {Bool} isEditNum. 所要编辑的商品是否被选中
  93 + *
  94 + * @return false or undefined
  95 + *
  96 + */
  97 +function showEditPannelWithSku(html, id, isSelected, isEditNum) {
  98 + if (html.length < 2) {
  99 + tip.show('出错啦!');
  100 + return false;
  101 + }
  102 +
  103 + // 删掉页面上原有的pannel
  104 + chosePanel.remove();
  105 +
  106 + $(html).appendTo('#mainCart');
  107 +
  108 +
  109 + chosePanel.init();
  110 + chosePanel.setEditModeWithSknId(id, isSelected);
  111 +
  112 + if (!isEditNum) {
  113 + chosePanel.disableNumEdit();
  114 + }
  115 +
  116 + chosePanel.show();
  117 +}
  118 +
  119 +
  120 +$('.icon-edit').on('touchstart', function(e) {
  121 + var $this = $(this),
  122 + skn = $this.closest('.shopping-cart-good').data('skn');
  123 +
  124 + var $checkBox,
  125 + $tag;
  126 +
  127 + var id,
  128 + count,
  129 + canEditNum;
  130 +
  131 + if ($this.parents('.off-shell-goods').length) {
  132 + tip.show('商品已下架');
  133 + return false;
  134 + }
  135 +
  136 + // 如果点击的是上次编辑的商品,直接显示chose-pannel
  137 + if (skn === previousEditSkn) {
  138 + chosePanel.show();
  139 + return;
  140 + }
  141 +
  142 + previousEditSkn = skn;
  143 +
  144 +
  145 + $checkBox = $this.closest('.info').siblings('.checkbox');
  146 + $tag = $this.closest('.deps').siblings('.few-tag');
  147 +
  148 + id = $this.closest('.shopping-cart-good').data('id');
  149 + count = $this.data('count');
  150 +
  151 + // 加价购或者赠品不能编辑数量
  152 + canEditNum = $tag.hasClass('gift-tag') || $tag.hasClass('plus-tag') ? false : true;
  153 +
  154 + e.stopPropagation();
  155 +
  156 + loading.showLoadingMask();
  157 +
  158 +
  159 + $.ajax({
  160 + url: '/cart/index/goodinfo',
  161 + data: {
  162 + skn: skn,
  163 + buy_num: count
  164 + },
  165 + success: function(res) {
  166 + showEditPannelWithSku(res, id, $checkBox.hasClass('icon-cb-checked'), canEditNum);
  167 + },
  168 + error: function() {
  169 + tip.show('网络异常');
  170 + window.location.reload();
  171 + },
  172 + complete: function() {
  173 + loading.hideLoadingMask();
  174 + }
  175 + });
  176 +});
  177 +
  178 +$('.icon-del').on('touchstart', function(e) {
  179 + var $this = $(this);
  180 +
  181 + e.stopPropagation();
  182 +
  183 + dialog.showDialog({
  184 + dialogText: '您确定要从购物车中删除吗?',
  185 + hasFooter: {
  186 + leftBtnText: '取消',
  187 + rightBtnText: '确定'
  188 + }
  189 + }, function() {
  190 + var $shoppingCartGood = $this.closest('.shopping-cart-good'),
  191 + count = $this.data('count');
  192 +
  193 + $.ajax({
  194 + method: 'post',
  195 + url: '/cart/index/del',
  196 + data: {
  197 + sku: $shoppingCartGood.data('id'),
  198 + count: count,
  199 + promotionId: $shoppingCartGood.data('promotion')
  200 + }
  201 + }).then(function(data) {
  202 + if (data.code === 200) {
  203 + dialog.showDialog({
  204 + dialogText: '删除成功',
  205 + autoHide: true,
  206 + fast: true
  207 + });
  208 + window.setCookie('_yoho-cart-refreshByDelete', true);
  209 + window.location.href = '/cart/index/index?cartType=' + $('#cartType').val();
  210 + } else {
  211 + tip.show(data.message);
  212 + }
  213 + }, function() {
  214 + tip.show('网络异常');
  215 + window.location.reload();
  216 + });
  217 + });
  218 +});
  219 +
  220 +function requestUpdateAllGoodsCheckStatus(theGoods, successHandeler) {
  221 + if (requesting) {
  222 + return;
  223 + }
  224 + requesting = true;
  225 + $.ajax({
  226 + url: 'select',
  227 + type: 'post',
  228 + data: {
  229 + skuList: JSON.stringify(theGoods)
  230 + },
  231 + success: function(res) {
  232 + if (res.code === 200) {
  233 + successHandeler();
  234 + } else {
  235 + tip.show(res.message);
  236 + }
  237 + },
  238 + error: function() {
  239 + tip.show('网络异常');
  240 + },
  241 + complete: function() {
  242 + requesting = false;
  243 + }
  244 + });
  245 +}
  246 +
  247 +function didUpdateAllGoodsCheckStatus() {
  248 + var $checkedBoxs = $('.shopping-cart-good .icon-cb-checked'),
  249 + $uncheckedBoxs = $('.shopping-cart-good .icon-checkbox');
  250 +
  251 + var shouldSelectAll;
  252 +
  253 + if ($selectAllBtn.hasClass('icon-cb-checked')) {
  254 + $selectAllBtn.removeClass('icon-cb-checked').addClass('icon-checkbox');
  255 + shouldSelectAll = true;
  256 + } else {
  257 + $selectAllBtn.removeClass('icon-checkbox').addClass('icon-cb-checked');
  258 + shouldSelectAll = false;
  259 + }
  260 +
  261 + if (!shouldSelectAll) {
  262 + $uncheckedBoxs.each(function(idx, uncheckedBox) {
  263 + $(uncheckedBox).removeClass('icon-checkbox').addClass('icon-cb-checked');
  264 + });
  265 + } else {
  266 + $checkedBoxs.each(function(idx, checkedBox) {
  267 + $(checkedBox).removeClass('icon-cb-checked').addClass('icon-checkbox');
  268 + });
  269 + }
  270 + window.location.href = '/cart/index/index?cartType=' + $('#cartType').val();
  271 +}
  272 +
  273 +function bottomCheckBoxHandeler(isSelected, type, handlerAfterTouch) {
  274 + var goodInfo = {},
  275 + $goods = $('.cart-content:not(.hide) .shopping-cart-good'),
  276 + $good = null,
  277 + goodsList = [];
  278 +
  279 + goodInfo.goods_type = type;
  280 + goodInfo.selected = isSelected ? 'N' : 'Y';
  281 +
  282 + $goods.each(function(idx, good) {
  283 + $good = $(good);
  284 +
  285 + goodInfo.product_sku = $(good).data('id');
  286 + goodInfo.hasPromotion = $(good).data('promotion');
  287 + goodInfo.buy_number = $good.find('.count').eq(0).text().trim().replace('×', '');
  288 +
  289 + goodsList.push(new GoodInfo(goodInfo));
  290 + });
  291 +
  292 + requestUpdateAllGoodsCheckStatus(goodsList, handlerAfterTouch);
  293 +}
  294 +
  295 +// 全选按钮点击事件
  296 +$selectAllBtn.on('touchend', function() {
  297 + var cartType = $('#cartType').val(),
  298 + isSelect = $(this).hasClass('icon-cb-checked');
  299 +
  300 + if (cartType === 'ordinary') {
  301 + if (!isSelect && $('.common .low-stocks').length > 0) {
  302 + tip.show('所选商品中含有库存不足的商品');
  303 + return false;
  304 + }
  305 + } else if (cartType === 'advance') {
  306 + if (!isSelect && $('.presell .low-stocks').length > 0) {
  307 + tip.show('所选商品中含有库存不足的商品');
  308 + return false;
  309 + }
  310 + }
  311 +
  312 + bottomCheckBoxHandeler(isSelect, cartType, didUpdateAllGoodsCheckStatus);
  313 +});
  314 +
  315 +$('.down').on('touchend', function() {
  316 + chosePanel.show();
  317 +});
@@ -6,7 +6,8 @@ @@ -6,7 +6,8 @@
6 var $ = require('yoho-jquery'), 6 var $ = require('yoho-jquery'),
7 Swiper = require('yoho-swiper'), 7 Swiper = require('yoho-swiper'),
8 Hammer = require('yoho-hammer'), 8 Hammer = require('yoho-hammer'),
9 - lazyLoad = require('yoho-jquery-lazyload'); 9 + lazyLoad = require('yoho-jquery-lazyload'),
  10 + commonJS = require('../common');
10 11
11 var goodsSwiper, 12 var goodsSwiper,
12 $discountFolder = $('.goodsDiscount .discount-folder'), 13 $discountFolder = $('.goodsDiscount .discount-folder'),
@@ -60,14 +61,14 @@ goodsSwiper = new Swiper('.banner-swiper', { @@ -60,14 +61,14 @@ goodsSwiper = new Swiper('.banner-swiper', {
60 61
61 62
62 // 初始化goods-discount 63 // 初始化goods-discount
63 -if (0 === $discountFolder.children().length) { 64 +if ($discountFolder.children().length === 0) {
64 $discountFolder.css('display', 'none'); 65 $discountFolder.css('display', 'none');
65 $discountArrow.html(''); 66 $discountArrow.html('');
66 } 67 }
67 68
68 // goods-discount下拉按钮点击事件 69 // goods-discount下拉按钮点击事件
69 if (goodsDiscountHammer && $discountFolder.children().length > 0) { 70 if (goodsDiscountHammer && $discountFolder.children().length > 0) {
70 - goodsDiscountHammer.on('tap', function(e) { 71 + goodsDiscountHammer.on('tap', function() {
71 if ($discountFolder.is(':hidden')) { 72 if ($discountFolder.is(':hidden')) {
72 $discountFirstItem.removeClass('short-text'); 73 $discountFirstItem.removeClass('short-text');
73 $discountArrow.removeClass('icon-down').addClass('icon-up').html('&#xe608;'); 74 $discountArrow.removeClass('icon-down').addClass('icon-up').html('&#xe608;');
  1 +.chose-panel {
  2 + position: fixed;
  3 + display: none;
  4 + height: 100%;
  5 + top: 0;
  6 + bottom: 0;
  7 + left: 0;
  8 + right: 0;
  9 + background: rgba(0, 0, 0, 0.3);
  10 + z-index: 3;
  11 +
  12 + .main {
  13 + position: absolute;
  14 + height: 610px;
  15 + bottom: 0;
  16 + left: 0;
  17 + right: 0;
  18 + background: #fff;
  19 + }
  20 +
  21 + .infos {
  22 + height: 460px;
  23 + padding: 0 22px;
  24 + }
  25 +
  26 + .chose-items {
  27 + height: 325px;
  28 + overflow: auto;
  29 + }
  30 +
  31 + .basic-info {
  32 + overflow: hidden;
  33 + position: relative;
  34 + margin-bottom: 30px;
  35 + margin-top: 30px;
  36 + }
  37 +
  38 + .thumb {
  39 + float: left;
  40 + width: 100px;
  41 + margin-right: 20px;
  42 + }
  43 +
  44 + .text-info {
  45 + height: auto;
  46 + .name {
  47 + font-size: 28px;
  48 + height: 74px;
  49 + overflow: hidden;
  50 + display: -webkit-box;
  51 + -webkit-line-clamp: 2;
  52 + -webkit-box-orient: vertical;
  53 + }
  54 +
  55 + .price {
  56 + font-size: 24px;
  57 + display: inline;
  58 + }
  59 + .sale-price {
  60 + color: #e10;
  61 + margin-right: 15px;
  62 +
  63 + &.no-price {
  64 + color: #000;
  65 + }
  66 + }
  67 +
  68 + .market-price {
  69 + color: #b0b0b0;
  70 + text-decoration: line-through;
  71 + }
  72 + }
  73 +
  74 + .color-list,
  75 + .size-list,
  76 + .num {
  77 + position: relative;
  78 + font-size: 28px;
  79 + padding-left: 80px;
  80 +
  81 + input.disabled {
  82 + background-color: #fff;
  83 + color: #000;
  84 + opacity: 1;
  85 + border-radius: 0;
  86 + -webkit-appearance: none;
  87 + }
  88 +
  89 + > span {
  90 + position: absolute;
  91 + left: 0;
  92 + top: 20px;
  93 + }
  94 +
  95 + > span.left-num {
  96 + position: absolute;
  97 + left: 380px;
  98 + top: 20px;
  99 + }
  100 +
  101 + span.disabled {
  102 + color: #e6e6e6;
  103 + }
  104 + }
  105 +
  106 + .size-list li.hide {
  107 + display: none;
  108 + }
  109 +
  110 + .block {
  111 + float: left;
  112 + display: block;
  113 + box-sizing: border-box;
  114 + padding: 0 20px;
  115 + min-width: 80px;
  116 + height: 80px;
  117 + border: 1px solid #000;
  118 + margin-right: 30px;
  119 + margin-bottom: 30px;
  120 + line-height: 80px;
  121 + text-align: center;
  122 +
  123 + &.chosed {
  124 + border-color: #e10;
  125 + background: resolve('shopping-cart/right.png') no-repeat;
  126 + background-size: 38px;
  127 + background-position: bottom right;
  128 + color: #e10;
  129 + }
  130 +
  131 + &.zero-stock {
  132 + color: #e0e0e0;
  133 + border-color: #e0e0e0;
  134 + }
  135 +
  136 + &.zero-stock.chosed {
  137 + border-color: #e0e0e0;
  138 + background: none;
  139 + color: #e0e0e0;
  140 + background-color: #c0c0c0;
  141 + }
  142 + }
  143 +
  144 + .num {
  145 + margin-bottom: 20px;
  146 + }
  147 +
  148 + .num .btn {
  149 + float: left;
  150 + display: block;
  151 + height: 80px;
  152 + width: 80px;
  153 + text-align: center;
  154 + line-height: 80px;
  155 + border: 1px solid #e6e6e6;
  156 +
  157 + &.disable {
  158 + color: #e6e6e6;
  159 + }
  160 + }
  161 +
  162 + .good-num {
  163 + float: left;
  164 + width: 106px;
  165 + height: 80px;
  166 + line-height: 80px;
  167 + padding: 0;
  168 + border: 1px solid #e6e6e6;
  169 + text-align: center;
  170 + margin-left: -1px;
  171 + }
  172 +
  173 + .btn-plus {
  174 + margin-left: -1px;
  175 + }
  176 +
  177 + .btn-wrap {
  178 + position: relative;
  179 + height: 120px;
  180 + border-top: 1px solid #e6e6e6;
  181 + padding: 20px;
  182 + text-align: center;
  183 + background: #fff;
  184 + box-sizing: border-box;
  185 +
  186 + .btn-sure {
  187 + width: 260px;
  188 + height: 80px;
  189 + background: #e10;
  190 + color: #fff;
  191 + font-size: 32px;
  192 + border: none;
  193 + }
  194 + }
  195 +}
@@ -9,3 +9,5 @@ @@ -9,3 +9,5 @@
9 @import "product/detail"; 9 @import "product/detail";
10 @import "product/comments-consults"; 10 @import "product/comments-consults";
11 @import "product/product-description"; 11 @import "product/product-description";
  12 +@import "product/recommend-for-you";
  13 +@import "cart/chose-panel";
  1 +.recommend-for-you {
  2 + padding: 30px 0;
  3 + border-top: 1px solid #e0e0e0;
  4 + border-bottom: 1px solid #e0e0e0;
  5 + background: #fff;
  6 +
  7 + .title {
  8 + font-size: 32px;
  9 + line-height: 88px;
  10 + text-align: center;
  11 + color: #444;
  12 + }
  13 +
  14 + .swiper-container {
  15 + padding: 30px 0 20px;
  16 + width: 100%;
  17 +
  18 + .swiper-slide {
  19 + padding: 0 10px;
  20 + float: left;
  21 + width: 156px;
  22 +
  23 + &:first-child {
  24 + padding-left: 30px;
  25 + }
  26 +
  27 + &:last-child {
  28 + padding-right: 30px;
  29 + }
  30 +
  31 + img {
  32 + width: 100%;
  33 + height: 208px;
  34 + }
  35 + }
  36 + }
  37 + .sale-name {
  38 + overflow: hidden;
  39 + text-overflow: ellipsis;
  40 + width: 100%;
  41 + white-space: nowrap;
  42 + margin-top: 20px;
  43 + color: #444;
  44 + }
  45 +
  46 + .price {
  47 + position: relative;
  48 + margin-top: 8px;
  49 + font-size: 24px;
  50 + line-height: 1;
  51 +
  52 + .sale-price {
  53 + display: block;
  54 + color: #d9134f;
  55 + margin-right: 8px;
  56 + }
  57 +
  58 + .old-price {
  59 + display: block;
  60 + color: #b0b0b0;
  61 + text-decoration: line-through;
  62 + }
  63 +
  64 + .no-price {
  65 + color: #444;
  66 + }
  67 + }
  68 +}