Toggle navigation
Toggle navigation
This project
Loading...
Sign in
wangshusheng
/
YOHOBUYPC
·
Commits
Go to a project
GitLab
Go to dashboard
Project
Activity
Files
Commits
Pipelines
0
Builds
0
Graphs
Milestones
Issues
0
Merge Requests
0
Members
Labels
Wiki
Forks
Network
Create a new issue
Download as
Email Patches
Plain Diff
Browse Files
Authored by
郭成尧
9 years ago
Commit
c693acb4fc0480ff86bf81faea7bfc5406892e8f
1 parent
732462e6
'购物车为你优选'
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
80 additions
and
14 deletions
web-static/js/cart/cart.js
yohobuy/www.yohobuy.com/application/models/Shopping/Cart.php
yohobuy/www.yohobuy.com/application/modules/Cart/controllers/Index.php
web-static/js/cart/cart.js
View file @
c693acb
...
...
@@ -191,8 +191,8 @@ function getTogetherProduct($obj, url, page) {
});
}
// 最近浏览
getTogetherProduct
(
$histroy
,
'/cart/index/getHistroyProduct'
);
// 为你优选
getTogetherProduct
(
$histroy
,
'/cart/index/getRecommendProduct'
);
// 凑单商品
getTogetherProduct
(
$together
,
'/cart/index/getTogetherProduct'
);
...
...
@@ -205,7 +205,7 @@ $together.on('click', '.pagenext, .pageprev', function() {
});
//凑单商品,
历史
商品商品折叠
//凑单商品,
为你优选
商品商品折叠
$shopCart
.
on
(
'click'
,
'.icon-minus, .icon-add'
,
function
()
{
if
(
$
(
this
).
hasClass
(
'icon-minus'
))
{
$
(
this
).
parents
(
'.title'
).
next
(
'.main'
).
hide
();
...
...
@@ -226,7 +226,7 @@ $histroy.on('click', '.pagenext, .pageprev', function() {
}
else
{
--
pageNum
>
0
||
(
pageNum
=
1
);
}
getTogetherProduct
(
$histroy
,
'/cart/index/get
Histroy
Product'
,
{
getTogetherProduct
(
$histroy
,
'/cart/index/get
Recommend
Product'
,
{
page
:
pageNum
});
...
...
@@ -271,15 +271,16 @@ function productInfo(data) {
$
(
'.detail-bigpic:not(.none) .bigpic:gt(0)'
).
hide
();
$
(
'.showSizeBox:not(.none)'
).
find
(
'span'
).
each
(
function
()
{
if
(
$
(
this
).
hasClass
(
'null-atcivec'
))
{
$
(
'.addcart'
).
addClass
(
'none'
);
$
(
'.btn_sellout'
).
removeClass
(
'none'
);
}
else
{
$
(
'.addcart'
).
removeClass
(
'none'
);
$
(
'.btn_sellout'
).
addClass
(
'none'
);
return
false
;
}
});
if
(
$
(
this
).
hasClass
(
'null-atcivec'
))
{
$
(
'.addcart'
).
addClass
(
'none'
);
$
(
'.btn_sellout'
).
removeClass
(
'none'
);
}
else
{
$
(
'.addcart'
).
removeClass
(
'none'
);
$
(
'.btn_sellout'
).
addClass
(
'none'
);
return
false
;
}
});
});
}
...
...
@@ -304,7 +305,7 @@ $payWapper.on('click', '.cart-add-btn', function() {
});
});
//凑单商品,
历史
商品商品记录
//凑单商品,
为你优选
商品商品记录
$
(
'.clearfix'
).
on
(
'click'
,
'.btn_view_s'
,
function
()
{
productId
=
$
(
this
).
data
(
'id'
);
promotionId
=
$
(
this
).
parents
(
'table'
).
data
(
'promotion'
);
...
...
yohobuy/www.yohobuy.com/application/models/Shopping/Cart.php
View file @
c693acb
...
...
@@ -420,6 +420,56 @@ class CartModel
}
/**
* 获取为你优选商品 待处理
*
* @param int $page 分页页码
* @return array
*/
public
static
function
getRecommendProduct
(
$page
)
{
$result
=
array
(
'code'
=>
200
,
'message'
=>
''
,
'data'
=>
array
(
'header'
=>
'为你优选'
,
'hasPrev'
=>
false
,
'hasNext'
=>
false
,
'item'
=>
array
()));
do
{
if
(
!
is_numeric
(
$page
))
{
break
;
}
$together
=
CartData
::
togetherProduct
(
$page
);
if
(
empty
(
$together
[
'data'
][
'goods'
]))
{
break
;
}
$result
[
'data'
][
'hasNext'
]
=
true
;
$result
[
'data'
][
'hasPrev'
]
=
true
;
$build
=
array
();
foreach
(
$together
[
'data'
][
'goods'
]
as
$value
)
{
$build
=
array
();
$build
[
'id'
]
=
$value
[
'id'
];
$build
[
'skn'
]
=
$value
[
'product_skn'
];
$build
[
'href'
]
=
$value
[
'url'
];
$build
[
'title'
]
=
$value
[
'product_name'
];
$build
[
'img'
]
=
Helpers
::
getImageUrl
(
$value
[
'default_pic'
],
100
,
100
);
$build
[
'alt'
]
=
$value
[
'product_name'
];
$build
[
'price'
]
=
$value
[
'price'
][
'sales_price'
];
if
(
$value
[
'price'
][
'sales_price'
]
!==
$value
[
'price'
][
'market_price'
])
{
$build
[
'marketPrice'
]
=
$value
[
'price'
][
'market_price'
];
}
$result
[
'data'
][
'item'
][]
=
$build
;
}
// 当数据量不足6个时,判定为没有下一页
if
(
$page
==
1
&&
!
isset
(
$result
[
'data'
][
'item'
][
5
]))
{
$result
[
'data'
][
'hasPrev'
]
=
false
;
$result
[
'data'
][
'hasNext'
]
=
false
;
}
}
while
(
false
);
return
$result
;
}
/**
* 获取最近浏览商品
*
* @param int $page 分页页码
...
...
yohobuy/www.yohobuy.com/application/modules/Cart/controllers/Index.php
View file @
c693acb
...
...
@@ -176,6 +176,21 @@ class IndexController extends WebAction
}
/**
* 为你优选商品异步请求 待处理
*/
public
function
getRecommendProductAction
()
{
$result
=
array
(
'code'
=>
200
,
'data'
=>
array
(),
'message'
=>
'为你优选'
);
if
(
$this
->
isAjax
())
{
$page
=
$this
->
get
(
'page'
,
1
);
$result
=
CartModel
::
getRecommendProduct
(
$page
);
}
$this
->
echoJson
(
$result
);
}
/**
* 最近浏览的商品异步请求
*/
public
function
getHistroyProductAction
()
...
...
Please
register
or
login
to post a comment