Authored by biao

优化skn获取代码

... ... @@ -11,7 +11,7 @@ var $ = require('jquery'),
var productId = $('#productId').val();
var skn = $('#preferenceUrl').val().split('?')[1].split('&')[0].split('=')[1],
var skn = $('#productSkn').val(),
productCode = $('#limitProductCode').val();
$('#likeBtn').on('touchstart', function() {
... ...
... ... @@ -177,6 +177,8 @@
<input id="preferenceUrl" type="hidden" value="{{preferenceUrl}}">
{{/if}}
<input id="productSkn" type="hidden" value="{{productSkn}}">
{{#loginUrl}}
<input type="hidden" name="loginUrl" id="loginUrl" value="{{.}}">
{{/loginUrl}}
... ...
... ... @@ -169,6 +169,8 @@ class DetailModel
$result['preferenceUrl'] = Helpers::url('/product/detail/preference', array('productSkn' => $baseInfo['erpProductId'], 'brandId' => $baseInfo['brand']['id']), '');
}
$result['productSkn'] = $baseInfo['erpProductId'];
// 商品信息
if (!empty($baseInfo['goodsList'])) {
$colorGroup = array();
... ... @@ -214,10 +216,10 @@ class DetailModel
'sizeNum' => $size['goodsSizeStorageNum'],
);
$sizeName = $size['sizeName'];
// 所有尺码列表,赋值用于前端展示默认尺码的时候 判断出没有库存则显示灰色
$allSizeList[$sizeName] = empty($allSizeList[$sizeName]['storage'])
? array('storage' => $size['goodsSizeStorageNum'], 'id' => $size['id'])
$allSizeList[$sizeName] = empty($allSizeList[$sizeName]['storage'])
? array('storage' => $size['goodsSizeStorageNum'], 'id' => $size['id'])
: $allSizeList[$sizeName];
$colorStorageNum += intval($size['goodsSizeStorageNum']);
$colorStorageGroup[ $value['productSkc'] ][$sizeName] = intval($size['goodsSizeStorageNum']);
... ... @@ -239,7 +241,7 @@ class DetailModel
// 商品库存总数
$totalStorageNum += $colorStorageNum;
}
// 遍历所有尺码,构建颜色显示数据
$i = 1;
foreach ($allSizeList as $sizeName => $value) {
... ... @@ -256,7 +258,7 @@ class DetailModel
$colorGroup[$i]['color'][] = $colorArr;
}
$colorGroup[$i]['id'] = $value['id'];
++ $i;
}
// 遍历所有颜色, 构建尺码显示数据
... ... @@ -267,7 +269,7 @@ class DetailModel
$sizeGroup[$i]['colorId'] = $value['skcId'];
// 默认颜色
$colorGroup[0]['color'][] = $value;
++ $i;
}
... ... @@ -673,7 +675,7 @@ class DetailModel
$result['data'] = Helpers::url('/signin.html', array('refer' => Helpers::url('/product/detail/consults', array('product_id' => $productId, 'total' => $total))));
break;
}
// 处理数据
$record = DetailData::upvoteConsult($uid, $id);
if (!empty($record['code'])) {
... ... @@ -705,7 +707,7 @@ class DetailModel
$result['data'] = Helpers::url('/signin.html', array('refer' => Helpers::url('/product/detail/consults', array('product_id' => $productId, 'total' => $total))));
break;
}
// 处理数据
$record = DetailData::usefulConsult($uid, $id);
if (!empty($record['code'])) {
... ...