Toggle navigation
Toggle navigation
This project
Loading...
Sign in
fe
/
YOHOBUYPC
·
Commits
Go to a project
GitLab
Go to group
Project
Activity
Files
Commits
Pipelines
0
Builds
0
Graphs
Milestones
Issues
0
Merge Requests
2
Members
Labels
Wiki
Forks
Network
Create a new issue
Download as
Email Patches
Plain Diff
Browse Files
Authored by
Rock Zhang
9 years ago
Commit
914486b3ed9adff7197192e1a7f8e6000c3962f9
1 parent
adfb5e4c
修复加价购商品详情的bug
Code Review By Rock Zhang
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
52 additions
and
19 deletions
framework
static/js/cart/chose-panel.js
yohobuy/m.yohobuy.com/application/models/Index/Cart.php
yohobuy/m.yohobuy.com/application/modules/Cart/controllers/Index.php
framework
@
e9d066dd
Subproject commit
75bbc3b075de19f239532f60c5995d06c5f814e2
Subproject commit
e9d066dd88a8e7e37103021c427a205a5cfcdcec
...
...
static/js/cart/chose-panel.js
View file @
914486b
...
...
@@ -69,7 +69,7 @@ $('.yoho-page').on('touchstart', '.chose-panel', function(e) {
i
;
var
$siblingBlock
=
$this
.
closest
(
'.block-list'
).
siblings
(
':first'
),
currentNumArray
=
$this
.
data
(
'numstr
'
).
split
(
'/'
);
currentNumArray
=
(
$this
.
data
(
'numstr'
)
+
'
'
).
split
(
'/'
);
$this
.
siblings
(
'.chosed'
).
removeClass
(
'chosed'
);
$this
.
toggleClass
(
'chosed'
);
...
...
@@ -96,7 +96,7 @@ $('.yoho-page').on('touchstart', '.chose-panel', function(e) {
}
});
}
else
if
(
$chosed
.
length
===
1
&&
$this
.
hasClass
(
'chosed'
))
{
numArray
=
$chosed
.
data
(
'numstr
'
).
split
(
'/'
);
numArray
=
(
$chosed
.
data
(
'numstr'
)
+
'
'
).
split
(
'/'
);
$siblingBlock
.
find
(
'.block'
).
removeClass
(
'zero-stock'
);
for
(
i
=
0
;
i
<
numArray
.
length
;
i
++
)
{
if
(
0
===
numArray
[
i
]
-
0
)
{
...
...
yohobuy/m.yohobuy.com/application/models/Index/Cart.php
View file @
914486b
...
...
@@ -582,18 +582,14 @@ class CartModel
{
$data
=
array
();
// 品牌信息
if
(
isset
(
$productData
[
'brand_info'
])
&&
!
empty
(
$productData
[
'brand_info'
]))
{
$data
[
'thumb'
]
=
Helpers
::
getImageUrl
(
$productData
[
'brand_info'
][
'brand_ico'
],
120
,
120
);
}
$data
[
'name'
]
=
$productData
[
'product_name'
];
$data
[
'price'
]
=
$productData
[
'market_price'
];
$data
[
'salePrice'
]
=
$productData
[
'sales_price'
];
$data
[
'price'
]
=
Helpers
::
transPrice
(
$productData
[
'market_price'
]);
$data
[
'salePrice'
]
=
Helpers
::
transPrice
(
$productData
[
'sales_price'
]);
if
(
isset
(
$productData
[
'storage_sum'
]))
{
$data
[
'storage'
]
=
$productData
[
'storage_sum'
];
}
$data
[
'num'
]
=
1
;
if
(
$num
!==
null
)
{
$data
[
'num'
]
=
$num
;
}
...
...
@@ -606,25 +602,62 @@ class CartModel
$oneColor
=
array
();
$sizes
=
array
();
$oneSize
=
array
();
$thumbImageList
=
array
();
$colorNum
=
0
;
$totalStorageNum
=
0
;
// 总库存数
$colorStorageGroup
=
array
();
// 颜色分组的库存总数集合, 多个之间用/分隔
foreach
(
$goodsList
as
$val
)
{
// 颜色
$oneColor
=
array
();
$oneColor
[
'id'
]
=
$val
[
'color_id'
];
$oneColor
[
'name'
]
=
$val
[
'color_name'
];
$colorNum
=
0
;
$sizeStorageStr
=
''
;
// 尺码
foreach
(
$val
[
'size_list'
]
as
$one
)
{
$oneSize
=
array
();
$oneSize
[
'id'
]
=
$one
[
'size_id'
];
$oneSize
[
'skuId'
]
=
$one
[
'product_sku'
];
$oneSize
[
'goodsId'
]
=
$val
[
'goods_id'
];
$oneSize
[
'colorId'
]
=
$val
[
'color_id'
];
$oneSize
[
'name'
]
=
$one
[
'size_name'
];
$oneSize
[
'sizeNum'
]
=
$one
[
'storage_number'
];
$colorNum
+=
$one
[
'storage_number'
];
$sizeStorageStr
.=
$one
[
'storage_number'
]
.
'/'
;
$sizes
[]
=
$oneSize
;
$colorStorageGroup
[
$one
[
'size_name'
]][
$val
[
'color_name'
]]
=
$one
[
'storage_number'
];
}
$sizes
[]
=
$oneSize
;
$oneColor
[
'sizes'
]
=
$sizes
;
// 统计尺码对应的各个颜色的库存量
foreach
(
$sizes
as
&
$sizeArr
)
{
$sizeArr
[
'colorNumStr'
]
=
implode
(
'/'
,
array_values
(
$colorStorageGroup
[
$sizeArr
[
'name'
]
])
);
}
// 颜色
$oneColor
=
array
();
$oneColor
[
'id'
]
=
$val
[
'color_id'
];
$oneColor
[
'skcId'
]
=
$val
[
'product_skc'
];
$oneColor
[
'name'
]
=
$val
[
'color_name'
];
$oneColor
[
'goodsName'
]
=
$productData
[
'product_name'
];
$oneColor
[
'colorNum'
]
=
$colorNum
;
$oneColor
[
'sizeNumStr'
]
=
rtrim
(
$sizeStorageStr
,
'/'
);
$colors
[]
=
$oneColor
;
// 缩略图
foreach
(
$val
[
'images_list'
]
as
$image
)
{
$thumbImageList
[]
=
array
(
'img'
=>
Helpers
::
getImageUrl
(
$image
[
'image_url'
],
60
,
60
)
);
}
// 商品库存总数
$totalStorageNum
+=
$colorNum
;
}
$data
[
'thumbs'
]
=
$thumbImageList
;
$data
[
'colors'
]
=
$colors
;
$data
[
'sizes'
]
=
$sizes
;
$data
[
'totalNum'
]
=
$totalStorageNum
;
}
return
$data
;
...
...
@@ -668,7 +701,7 @@ class CartModel
// 失效商品列表
$notValidGoods
=
Helpers
::
formatCartGoods
(
$data
[
'sold_out_goods_list'
]);
if
(
!
empty
(
$notValidGoods
))
{
$result
[
'
$
notValidGoods'
]
=
$notValidGoods
;
$result
[
'notValidGoods'
]
=
$notValidGoods
;
}
// 赠品和加价购商品
...
...
yohobuy/m.yohobuy.com/application/modules/Cart/controllers/Index.php
View file @
914486b
...
...
@@ -207,11 +207,11 @@ class IndexController extends AbstractAction
{
$result
=
array
();
if
(
$this
->
isAjax
())
{
//
if ($this->isAjax()) {
$skn
=
$this
->
get
(
'skn'
,
null
);
$promotionId
=
$this
->
get
(
'promotionId'
,
null
);
$result
=
CartModel
::
giftProductData
(
$skn
,
$promotionId
);
}
//
}
if
(
empty
(
$result
))
{
echo
' '
;
...
...
Please
register
or
login
to post a comment