Authored by Lynnic

购物车逻辑修改

... ... @@ -14,7 +14,20 @@ var $ = require('jquery');
var $num,
$chosed,
re = /\d+/,
leftNum;
leftNum,
$colorList = $('.color-list ul>li'),
$sizeList = $('.size-list ul>li'),
firstColorId = $colorList.eq(0).data('id');
//初始化购物车面板显示
$sizeList.each(function() {
var id = $(this).data('colorid');
if (id === firstColorId) {
$(this).removeClass('hide');
}
});
// confirm;
... ... @@ -39,6 +52,8 @@ var $num,
// $num = $('#good-num');
// }
function show() {
$('.chose-panel').show();
... ... @@ -63,12 +78,11 @@ $('.yoho-page').on('touchstart', '.chose-panel', function(e) {
remove();
}).on('touchstart', '#chose-btn-sure', function() {
// var
// // goodId,
// // skuId,
// skcId = $('.color-list li.chosed').data('skcid'),
// colorIndex = $('.color-list li.chosed').index(),
// skuArray = $('.size-list').data('skustr').split('/');
// var productSku,
// buyNumber = $('#good-num') - 0;
// promotionId,
// goodsType,
// isEdit;
// //确定
// $chosed = $('.block-list>ul>li.chosed');
... ... @@ -83,7 +97,7 @@ $('.yoho-page').on('touchstart', '.chose-panel', function(e) {
// loading.showLoadingMask();
// $.ajax({
// method: 'POST',
// url: '/product/detail/xxxx',
// url: '/cart/index/add',
// data: {
// product_id: productId,
// content: content
... ...
... ... @@ -9,6 +9,7 @@
background: rgba(0,0,0,.3);
z-index:3;
.main {
position: absolute;
height: pxToRem(610px);
... ... @@ -86,6 +87,10 @@
}
}
.size-list li.hide {
display: none;
}
.block {
float: left;
display: block;
... ...
{{#cartInfo}}
<div class="chose-panel">
<div class="main">
<div class="infos">
... ... @@ -36,7 +36,7 @@
<ul class="clearfix" data-type="size" >
{{# sizes}}
<li class="block {{#if chosed}}chosed{{/if}} {{#unless sizeNum}}zero-stock{{/unless}}" data-id={{id}} data-colorid="{{colorId}}" data-num="{{sizeNum}}" data-numstr="{{colorNumStr}}" data-skuid="{{skuId}}" data-goodid="{{goodsId}}">
<li class="block hide {{#if chosed}}chosed{{/if}} {{#unless sizeNum}}zero-stock{{/unless}}" data-id={{id}} data-colorid="{{colorId}}" data-num="{{sizeNum}}" data-numstr="{{colorNumStr}}" data-skuid="{{skuId}}" data-goodid="{{goodsId}}">
{{name}}
</li>
{{/ sizes}}
... ... @@ -62,3 +62,4 @@
</div>
</div>
</div>
{{/cartInfo}}
\ No newline at end of file
... ...