Authored by zhangxiaoru

购物车修改

... ... @@ -342,6 +342,30 @@ $yohoPage.on('touchstart', '.chose-panel', function(e) {
return false;
});
function chosedLength() {
var $chosedL = $('.block-list>ul>li.chosed'),
infoHtml;
$('.choosed-info').removeClass('hide');
if (!$('.not-choose').hasClass('hide')) {
$('.not-choose').addClass('hide');
}
if ($chosedL.length === 2) {
$chosedL.each(function(val) {
infoHtml = '已选:' + $chosedL.eq(0).html() + '、' + $chosedL.eq(1).html();
})
} else if ($chosedL.length === 1) {
infoHtml = '已选:' + $chosedL.eq(0).html();
} else {
$('.choosed-info').addClass('hide');
$('.not-choose').removeClass('hide');
}
$('.choosed-info').html(infoHtml);
}
$yohoPage.on('touchstart', '.color-list .block', function() {
var $this = $(this),
index = $this.index(),
... ... @@ -422,6 +446,7 @@ $yohoPage.on('touchstart', '.color-list .block', function() {
return false;
}
chosedLength();
}).on('touchstart', '.size-list .block', function() {
var $this = $(this),
... ... @@ -479,6 +504,8 @@ $yohoPage.on('touchstart', '.color-list .block', function() {
$('#good-num').val(1);
}
chosedLength();
// 设置按钮的样式和文字
updateConformButtonClassAndText();
});
... ...
{{#cartInfo}}
<div class="chose-panel">
<div class="main">
<div class="close">X</div>
<div class="infos {{#if ../tickets}}tickets-info{{/if}}">
<div class="basic-info" >
{{#thumbs}}
<img class="thumb {{#unless @first}}hide{{/if}}" src={{img}}>
{{/thumbs}}
<div class="text-info">
<p class="name">{{name}}</p>
<!-- <p class="name">{{name}}</p> -->
<p class="price">
<span class="sale-price{{^price}} no-price{{/price}}">{{salePrice}}</span>
{{#if price}}
<span class="market-price">{{price}}</span>
{{/if}}
</p>
<p class="not-choose">请选择颜色、尺码</p>
<p class="choosed-info hide"></p>
<p class="size-info hide"></p>
</div>
</div>
<div class="chose-items">
... ... @@ -34,7 +38,7 @@
{{# sizes}}
<ul class="size-row clearfix {{#unless @first}}hide{{/if}}">
{{# size}}
<li class="block {{#if chosed}}chosed{{/if}} {{#unless sizeNum}}zero-stock{{/unless}}" data-num="{{sizeNum}}" data-id="{{id}}" data-skuid="{{skuId}}">
<li class="block {{#if chosed}}chosed{{/if}} {{#unless sizeNum}}zero-stock{{/unless}}" data-num="{{sizeNum}}" data-id="{{id}}" data-skuid="{{skuId}}" data-info= "{{sizeInfo}}">
{{name}}
</li>
{{/ size}}
... ... @@ -78,6 +82,6 @@
</div>
</div>
</div>
{{/cartInfo}}
{{/cartInfo}}
<input id="promotionId" type="hidden" value="{{promotionId}}">
<input id="single" type="hidden" value="{{single}}">
\ No newline at end of file
... ...
... ... @@ -958,10 +958,11 @@ class CartModel
$oneSize['colorId'] = $val['color_id'];
$oneSize['name'] = $sizeName;
$oneSize['sizeNum'] = intval($one['storage_number']);
$oneSize['sizeInfo'] = $one['size_info'];
$sizeList[$val['product_skc']][] = $oneSize;
// 所有尺码列表,赋值用于前端展示默认尺码的时候 判断出没有库存则显示灰色
$allSizeList[$sizeName] = empty($allSizeList[$sizeName]['storage']) ? array('storage' => $one['storage_number'], 'id' => $one['size_id']) : $allSizeList[$sizeName];
$allSizeList[$sizeName] = empty($allSizeList[$sizeName]['storage']) ? array('storage' => $one['storage_number'], 'id' => $one['size_id'], 'sizeInfo' => $one['size_info']) : $allSizeList[$sizeName];
$colorNum += intval($one['storage_number']);
... ... @@ -980,7 +981,7 @@ class CartModel
// 缩略图
$thumbImageList[] = array(
'img' => Helpers::getImageUrl($val['color_image'], 60, 60)
'img' => Helpers::getImageUrl($val['color_image'], 300, 417)
);
// 商品库存总数
... ... @@ -995,6 +996,7 @@ class CartModel
'name' => $sizeName, // 尺码名称
'sizeNum' => empty($value['storage']) ? false : true, // 是否有库存 (false:表示没有库存,true:表示有库存)
'id' => $value['id'],
'sizeInfo' => $value['sizeInfo']
);
// 各个颜色的尺码, 每行显示一个尺码对应的颜色
... ...
... ... @@ -15,15 +15,15 @@ define('USE_INTER_FACE_SHUNT', false);//分流开关
#dev环境
//define('API_URL', 'http://dev-api.yohops.com:9999/');
//define('SERVICE_URL', 'http://dev-service.yohops.com:9999/');
//define('YOHOBUY_URL', 'http://www.yohobuy.com/');
//define('SERVICE_NOTIFY', 'http://dev-service.yohops.com:9999/');
define('API_URL', 'http://api-test2.yohops.com:9999/');
define('SERVICE_URL', 'http://service-test2.yohops.com:9999/');
define('API_URL', 'http://dev-api.yohops.com:9999/');
define('SERVICE_URL', 'http://dev-service.yohops.com:9999/');
define('YOHOBUY_URL', 'http://www.yohobuy.com/');
define('SERVICE_NOTIFY', 'http://service-test2.yohops.com:9999/');
define('SERVICE_NOTIFY', 'http://dev-service.yohops.com:9999/');
// define('API_URL', 'http://api-test2.yohops.com:9999/');
// define('SERVICE_URL', 'http://service-test2.yohops.com:9999/');
// define('YOHOBUY_URL', 'http://www.yohobuy.com/');
// define('SERVICE_NOTIFY', 'http://service-test2.yohops.com:9999/');
$application = new Application(APPLICATION_PATH . '/configs/application.developer.ini');
$application->bootstrap()->run();
... ...