...
|
...
|
@@ -167,6 +167,7 @@ class DetailModel |
|
|
$colorGroup = array();
|
|
|
$sizeGroup = array();
|
|
|
$goodsGroup = array();
|
|
|
$sizeName = '';
|
|
|
$colorList = array();
|
|
|
$sizeList = array();
|
|
|
$allSizeList = array(); // 所有尺码列表
|
...
|
...
|
@@ -195,6 +196,7 @@ class DetailModel |
|
|
// 商品的尺码列表
|
|
|
$colorStorageGroup[ $value['productSkc'] ] = array();
|
|
|
if (isset($value['goodsSizeBoList'])) {
|
|
|
$sizeName = '';
|
|
|
foreach ($value['goodsSizeBoList'] as $size) {
|
|
|
$sizeList[ $value['productSkc'] ][] = array(
|
|
|
'id' => $size['id'],
|
...
|
...
|
@@ -204,12 +206,14 @@ class DetailModel |
|
|
'name' => $size['sizeName'],
|
|
|
'sizeNum' => $size['goodsSizeStorageNum'],
|
|
|
);
|
|
|
$sizeName = $size['sizeName'];
|
|
|
|
|
|
// 所有尺码列表,赋值用于前端展示默认尺码的时候 判断出没有库存则显示灰色
|
|
|
$allSizeList[ $size['sizeName'] ] = empty($allSizeList[ $size['sizeName'] ]) ? $size['goodsSizeStorageNum'] : $allSizeList[ $size['sizeName'] ];
|
|
|
|
|
|
$allSizeList[$sizeName] = empty($allSizeList[$sizeName]['storage'])
|
|
|
? array('storage' => $size['goodsSizeStorageNum'], 'id' => $size['id'])
|
|
|
: $allSizeList[$sizeName];
|
|
|
$colorStorageNum += intval($size['goodsSizeStorageNum']);
|
|
|
$colorStorageGroup[$value['productSkc']][$size['sizeName']] = $size['goodsSizeStorageNum'];
|
|
|
$colorStorageGroup[ $value['productSkc'] ][$sizeName] = $size['goodsSizeStorageNum'];
|
|
|
}
|
|
|
|
|
|
// 颜色分组
|
...
|
...
|
@@ -235,7 +239,8 @@ class DetailModel |
|
|
// 默认尺码
|
|
|
$sizeGroup[0]['size'][] = array(
|
|
|
'name' => $sizeName, // 尺码名称
|
|
|
'sizeNum' => empty($value) ? false : true, // 是否有库存 (false:表示没有库存,true:表示有库存)
|
|
|
'sizeNum' => empty($value['storage']) ? false : true, // 是否有库存 (false:表示没有库存,true:表示有库存)
|
|
|
'id' => $value['id'],
|
|
|
);
|
|
|
|
|
|
// 各个颜色的尺码, 每行显示一个尺码对应的颜色
|
...
|
...
|
@@ -243,7 +248,7 @@ class DetailModel |
|
|
$colorArr['colorNum'] = isset($colorStorageGroup[ $colorArr['skcId'] ][$sizeName]) ? $colorStorageGroup[ $colorArr['skcId'] ][$sizeName] : 0;
|
|
|
$colorGroup[$i]['color'][] = $colorArr;
|
|
|
}
|
|
|
$colorGroup[$i]['sizeName'] = $sizeName;
|
|
|
$colorGroup[$i]['id'] = $value['id'];
|
|
|
|
|
|
++ $i;
|
|
|
}
|
...
|
...
|
|