Toggle navigation
Toggle navigation
This project
Loading...
Sign in
fe
/
YOHOBUYWAP
·
Commits
Go to a project
GitLab
Go to group
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
Plain Diff
Browse Files
Authored by
毕凯
9 years ago
Commit
c4f9960ca5a179b67e8ee8c8108ec25890002ac0
2 parents
3508f026
655112d3
Merge branch 'develop/wap' of git.dev.yoho.cn:web/yohobuy into develop/wap
Hide whitespace changes
Inline
Side-by-side
Showing
20 changed files
with
343 additions
and
159 deletions
library/LibModels/Wap/Product/DetailData.php
library/Plugin/Helpers.php
static/js/cart/chose-panel.js
static/js/cart/order-ensure.js
static/js/cart/select-address.js
static/js/product/detail/like.js
static/sass-new/product/_limit.css
static/sass-new/product/_limit.scss
static/sass/product/_detail.scss
static/sass/product/_limit.scss
template/m.yohobuy.com/actions/cart/index/order-ensure.phtml
template/m.yohobuy.com/actions/product/detail/index.phtml
template/m.yohobuy.com/actions/product/index/limit-help.phtml → template/m.yohobuy.com/actions/product/detail/limit-help.phtml
template/m.yohobuy.com/actions/product/index/limit.phtml → template/m.yohobuy.com/actions/product/detail/limit.phtml
yohobuy/m.yohobuy.com/application/controllers/Home.php
yohobuy/m.yohobuy.com/application/models/Index/Cart.php
yohobuy/m.yohobuy.com/application/models/Product/Detail.php
yohobuy/m.yohobuy.com/application/modules/Cart/controllers/Index.php
yohobuy/m.yohobuy.com/application/modules/Product/controllers/Detail.php
yohobuy/m.yohobuy.com/application/modules/Product/controllers/Index.php
library/LibModels/Wap/Product/DetailData.php
View file @
c4f9960
...
...
@@ -133,8 +133,10 @@ class DetailData
/**
* 为你优选的商品列表
*
*
* @param int $productSkn 商品SKN号
* @param int $channel
* @param int $brandId
* @return array
*/
public
static
function
preference
(
$productSkn
,
$channel
,
$brandId
)
...
...
@@ -220,4 +222,26 @@ class DetailData
return
Yohobuy
::
get
(
Yohobuy
::
API_URL
,
$param
);
}
/**
* 获取限购商品详情
*
* @param int $uid 用户UID
* @param string $productCode 限购商品商品码
* @return mixed
*/
public
static
function
limitProductData
(
$uid
,
$productCode
)
{
$param
=
Yohobuy
::
param
();
$param
[
'method'
]
=
'app.limitProduct.limitProductDetail'
;
$param
[
'limitProductCode'
]
=
$productCode
;
if
(
!
empty
(
$uid
))
{
$param
[
'uid'
]
=
$uid
;
}
$param
[
'client_secret'
]
=
Sign
::
getSign
(
$param
);
return
Yohobuy
::
get
(
Yohobuy
::
API_URL
,
$param
);
}
}
...
...
library/Plugin/Helpers.php
View file @
c4f9960
...
...
@@ -895,4 +895,21 @@ class Helpers
}
return
$area
.
'-'
.
$mobile
;
}
/**
* 按照数组中指定字段排序二维数组
*
* @param array &$array 需要排序的数组
* @param string $field 字段名称
* @param boolean $desc 时候降序排列,默认为false
*/
public
static
function
sortArrByField
(
&
$array
,
$field
,
$desc
=
false
)
{
$fieldArr
=
array
();
foreach
(
$array
as
$k
=>
$v
)
{
$fieldArr
[
$k
]
=
isset
(
$v
[
$field
])
?
$v
[
$field
]
:
''
;
}
$sort
=
$desc
==
false
?
SORT_ASC
:
SORT_DESC
;
array_multisort
(
$fieldArr
,
$sort
,
$array
);
}
}
...
...
static/js/cart/chose-panel.js
View file @
c4f9960
...
...
@@ -49,6 +49,16 @@ var limitProductCode,
// 限购商品的skn。只有限购商品时才会设置。
skn
;
//禁用数字编辑
function
disableNumEdit
()
{
var
$numBtn
=
$
(
'.chose-panel'
).
find
(
'.num .btn>.iconfont'
);
//添加disabled样式
$numBtn
.
hasClass
(
'disabled'
)
?
null
:
$numBtn
.
addClass
(
'disabled'
);
$yohoPage
.
off
(
'touchstart'
,
'.btn-minus'
);
$yohoPage
.
off
(
'touchstart'
,
'.btn-plus'
);
}
// 初始化购物车面板显示
function
init
()
{
...
...
@@ -94,7 +104,8 @@ function setEditModeWithSknId(sknId, isThisGoodSelected) {
* @return {undefined}
*/
function
setLimitGoodModeWithSknId
(
code
,
sknId
)
{
$
(
'#chose-btn-sure'
).
html
(
'结算'
);
disableNumEdit
();
$
(
'#chose-btn-sure'
).
html
(
'立即购买'
);
limitProductCode
=
code
;
skn
=
sknId
;
}
...
...
@@ -127,16 +138,6 @@ function checkColorSizeNum() {
return
true
;
}
//禁用数字编辑
function
disableNumEdit
()
{
var
$numBtn
=
$
(
'.chose-panel'
).
find
(
'.num .btn>.iconfont'
);
//添加disabled样式
$numBtn
.
hasClass
(
'disabled'
)
?
null
:
$numBtn
.
addClass
(
'disabled'
);
$yohoPage
.
off
(
'touchstart'
,
'.btn-minus'
);
$yohoPage
.
off
(
'touchstart'
,
'.btn-plus'
);
}
function
show
(
html
,
cb
)
{
...
...
@@ -172,7 +173,7 @@ function updateConformButtonClassAndText() {
if
(
2
===
$chosed
.
closest
(
'.zero-stock'
).
length
)
{
$
(
'#chose-btn-sure'
).
css
(
'background-color'
,
'#c0c0c0'
).
html
(
'已售罄'
);
}
else
if
(
limitProductCode
)
{
$
(
'#chose-btn-sure'
).
css
(
'background-color'
,
'#eb0313'
).
html
(
'
结算
'
);
$
(
'#chose-btn-sure'
).
css
(
'background-color'
,
'#eb0313'
).
html
(
'
立即购买
'
);
}
else
{
$
(
'#chose-btn-sure'
).
css
(
'background-color'
,
'#eb0313'
).
html
(
isEdit
?
'确认'
:
'加入购物车'
);
}
...
...
@@ -473,8 +474,8 @@ $yohoPage.on('touchstart', '.btn-minus', function() {
}
else
if
(
limitProductCode
)
{
// 当前面板选择的是限购商品
url
=
'http://m.yohobuy.com/cart/index/orderEnsure?code='
+
limitProductCode
+
'&&sku='
+
productSku
+
'&&skn='
+
skn
+
'&&buy_num='
+
buyNumber
;
url
=
$
(
'#limitProductPay'
).
val
()
+
'?limitproductcode='
+
limitProductCode
+
'&sku='
+
productSku
+
'&skn='
+
skn
+
'&buy_number='
+
buyNumber
;
//打开结算页面,结束函数执行。
window
.
location
.
href
=
url
;
...
...
static/js/cart/order-ensure.js
View file @
c4f9960
...
...
@@ -30,6 +30,26 @@ require('../common');
lazyLoad
();
function
getQueryParam
()
{
var
queryArray
=
location
.
search
.
substr
(
1
).
split
(
'&'
),
i
,
subArr
=
[],
obj
=
{};
for
(
i
=
0
;
i
<
queryArray
.
length
;
i
++
)
{
subArr
=
queryArray
[
i
].
split
(
'='
);
obj
[
subArr
[
0
]]
=
subArr
[
1
];
subArr
=
[];
}
return
obj
;
}
function
isLimitGood
()
{
return
getQueryParam
().
limitproductcode
;
}
if
(
window
.
getUid
()
!==
orderInfo
(
'uid'
))
{
order
.
init
();
window
.
location
.
reload
();
...
...
@@ -46,6 +66,18 @@ if (document.referrer && document.referrer.indexOf('/cart/index/index') !== -1)
orderInfo
(
'couponName'
,
null
);
}
isLimitGood
()
&&
(
function
()
{
var
a
=
[];
var
data
=
getQueryParam
();
data
[
'type'
]
=
'limitcode'
;
a
.
push
(
data
);
orderInfo
(
'skuList'
,
JSON
.
stringify
(
a
));
orderInfo
(
'limitUrlSufix'
,
location
.
search
);
})();
if
(
queryString
.
cartType
||
queryString
.
carttype
||
!
orderInfo
(
'cartType'
))
{
orderInfo
(
'cartType'
,
queryString
.
cartType
||
queryString
.
carttype
||
'ordinary'
);
}
...
...
@@ -102,7 +134,8 @@ function orderCompute() {
deliveryId
:
orderInfo
(
'deliveryId'
),
paymentTypeId
:
orderInfo
(
'paymentTypeId'
),
couponCode
:
orderInfo
(
'couponCode'
),
yohoCoin
:
yohoCoin
yohoCoin
:
yohoCoin
,
skuList
:
isLimitGood
()
?
orderInfo
(
'skuList'
)
:
undefined
}
}).
then
(
function
(
res
)
{
var
priceHtml
;
...
...
@@ -177,7 +210,9 @@ function submitOrder() {
paymentTypeId
:
orderInfo
(
'paymentTypeId'
),
paymentType
:
orderInfo
(
'paymentType'
),
//支付方式
couponCode
:
orderInfo
(
'couponCode'
),
yohoCoin
:
orderInfo
(
'yohoCoin'
)
yohoCoin
:
orderInfo
(
'yohoCoin'
),
skuList
:
isLimitGood
()
?
orderInfo
(
'skuList'
)
:
undefined
}
}).
then
(
function
(
res
)
{
var
url
;
...
...
static/js/cart/select-address.js
View file @
c4f9960
...
...
@@ -26,7 +26,7 @@ $('.address-item').on('touchend', function() {
orderInfo
(
'addressId'
,
addressId
);
orderInfo
(
'address'
,
address
);
window
.
location
.
href
=
$this
.
data
(
'href'
);
window
.
location
.
href
=
$this
.
data
(
'href'
)
+
(
orderInfo
(
'limitUrlSufix'
)
||
''
)
;
}).
on
(
'touchend'
,
'.edit'
,
function
()
{
window
.
location
.
href
=
$
(
this
).
data
(
'href'
);
return
false
;
...
...
static/js/product/detail/like.js
View file @
c4f9960
...
...
@@ -68,7 +68,7 @@ $('#likeBtn').on('touchstart', function() {
$
(
'#addtoCart'
).
on
(
'touchstart'
,
function
()
{
$
(
'.cart-bar'
).
hide
();
chosePanel
.
setLimitGoodModeWithSknId
(
productCode
,
skn
);
productCode
&&
chosePanel
.
setLimitGoodModeWithSknId
(
productCode
,
skn
);
chosePanel
.
show
();
//统计代码:用于统计用户加入购物车的动作
...
...
static/sass-new/product/_limit.css
View file @
c4f9960
...
...
@@ -8,17 +8,15 @@
line-height
:
2.2rem
;
margin-bottom
:
0.1rem
;
background-color
:
#fff
;
padding
:
0.2rem
0
;
padding
:
0.2rem
0
0.2rem
0.5rem
;
div
{
width
:
2
0%
;
width
:
0%
;
display
:
inline-block
;
float
:
left
;
img
{
width
:
1.5rem
;
border
:
1px
solid
#ccc
;
border-radius
:
100%
;
position
:
relative
;
top
:
0.25rem
;
}
...
...
static/sass-new/product/_limit.scss
View file @
c4f9960
...
...
@@ -8,7 +8,7 @@
line-height
:
2
.2rem
;
margin-bottom
:
0
.1rem
;
background-color
:
#fff
;
padding
:
0
.2rem
0
;
padding
:
0
.2rem
0
0
.2rem
0
.5rem
;
div
{
...
...
@@ -63,6 +63,15 @@
.goodDesc
{
margin-top
:
1rem
;
p
{
font-size
:
0
.6rem
;
line-height
:
1rem
;
}
img
{
margin
:
0
.3rem
0
;
}
}
.bottom
{
...
...
@@ -70,8 +79,6 @@
border-top
:
1px
solid
#e6e6e6
;
padding
:
0
.5rem
2rem
2rem
2rem
;
height
:
3rem
;
position
:
absolute
;
bottom
:
0
;
width
:
12rem
;
margin
:
0
auto
;
...
...
static/sass/product/_detail.scss
View file @
c4f9960
...
...
@@ -299,7 +299,7 @@ $basicBtnC:#eb0313;
font-weight
:
bold
;
}
.limit-sale
:active
{
.limit-sale
:
not
(
.got-limit-sale
)
:
active
{
background-color
:
#f0f0f0
;
}
...
...
@@ -510,6 +510,9 @@ $basicBtnC:#eb0313;
&
.sold-out
{
background-color
:
#f58189
;
}
&
.sold-out.limit
{
background-color
:
#ccc
;
}
}
.num-tag
{
display
:
block
;
...
...
static/sass/product/_limit.scss
View file @
c4f9960
...
...
@@ -8,7 +8,7 @@
line-height
:
2
.2rem
;
margin-bottom
:
0
.1rem
;
background-color
:
#fff
;
padding
:
0
.2rem
0
;
padding
:
0
.2rem
0
0
.2rem
0
.5rem
;
div
{
...
...
@@ -63,6 +63,18 @@
.goodDesc
{
margin-top
:
1rem
;
padding
:
0
.5rem
;
border-top
:
1px
solid
#e6e6e6
;
background-color
:
#fff
;
p
{
font-size
:
0
.6rem
;
line-height
:
1rem
;
}
img
{
margin
:
0
.3rem
0
;
}
}
.bottom
{
...
...
@@ -70,8 +82,6 @@
border-top
:
1px
solid
#e6e6e6
;
padding
:
0
.5rem
2rem
2rem
2rem
;
height
:
3rem
;
position
:
absolute
;
bottom
:
0
;
width
:
12rem
;
margin
:
0
auto
;
...
...
template/m.yohobuy.com/actions/cart/index/order-ensure.phtml
View file @
c4f9960
...
...
@@ -43,7 +43,7 @@
<ul
class=
"sale-invoice"
>
{
{#if
isOrdinaryCart
}
}
<li
class=
"coupon"
>
<a
href=
"
/cart/index/selectCoupon
"
>
<a
href=
"
{{#if isLimit}}javascript:void(0);{{else}}/cart/index/selectCoupon{{/if}}
"
>
<span
class=
"title"
>优惠券</span>
{
{#
coupon
}
}
<!--<span
class=
"coupon-count"
>
...
...
@@ -57,7 +57,7 @@
</span>
{
{^
}
}
<span
class=
"not-used coupon-use"
>
未使用
{
{#if
isLimit
}
}该商品不可使用优惠券
{
{else
}
}未使用
{
{/if
}
}
<i
class=
"iconfont"
>
614
;</i>
</span>
{
{/if
}
}
...
...
template/m.yohobuy.com/actions/product/detail/index.phtml
View file @
c4f9960
...
...
@@ -53,7 +53,7 @@
{
{/if
}
}
{
{#if
gotCode
}
}
<button
class=
"got-limit-sale"
>已获限购码</button>
<button
class=
"got-limit-sale"
>已获
取
限购码</button>
{
{/if
}
}
{
{/noLimitGoodsBtn
}
}
...
...
@@ -136,7 +136,7 @@
{
{#if
addToCartUrl
}
}
<!--
<a
id=
"addtoCart"
href=
"{{addToCartUrl}}"
class=
"addto-cart"
>加入购物车</a>
-->
<a
id=
"addtoCart"
href=
"javascript:;"
class=
"addto-cart"
>加入购物车</a>
<a
id=
"addtoCart"
href=
"javascript:;"
class=
"addto-cart"
>加入购物车</a>
{
{/if
}
}
{
{#if
soldOut
}
}
...
...
@@ -148,19 +148,20 @@
{
{/if
}
}
{
{#if
limitNotForSale
}
}
<a
href=
"javascript:;"
class=
"sold-out
"
>即将开
售</a>
<a
href=
"javascript:;"
class=
"sold-out
limit"
>即将发
售</a>
{
{/if
}
}
{
{#if
canBuyLimit
}
}
<a
href=
"javascript:;"
class=
"addto-cart"
>立即购买</a>
<a
href=
"javascript:;"
id=
"addtoCart"
class=
"addto-cart"
>立即购买</a>
{
{/if
}
}
{
{#if
noLimitCode
}
}
<a
href=
"javascript:;"
class=
"sold-out"
>立即购买</a>
<a
href=
"javascript:;"
class=
"sold-out
limit
"
>立即购买</a>
{
{/if
}
}
<input
type=
"hidden"
name=
"limitCodeUrl"
value=
"{{limitCodeUrl}}"
>
<input
type=
"hidden"
id=
"limitCodeUrl"
name=
"limitCodeUrl"
value=
"{{limitCodeUrl}}"
>
<input
type=
"hidden"
id=
"limitProductPay"
name=
"limitProductPay"
value=
"{{limitProductPay}}"
>
{
{#limitProductCode
}
}
<input
type=
"hidden"
name=
"limitProductCode"
value=
"{{.}}"
>
<input
type=
"hidden"
id=
"limitProductCode"
name=
"limitProductCode"
value=
"{{.}}"
>
{
{/limitProductCode
}
}
<a
href=
"javascript:;"
id=
"likeBtn"
class=
"favorite iconfont {{#isCollect}}liked{{/isCollect}}"
>
605
;</a>
...
...
template/m.yohobuy.com/actions/product/
index
/limit-help.phtml → template/m.yohobuy.com/actions/product/
detail
/limit-help.phtml
View file @
c4f9960
template/m.yohobuy.com/actions/product/
index
/limit.phtml → template/m.yohobuy.com/actions/product/
detail
/limit.phtml
View file @
c4f9960
{
{>
layout/header
}
}
<div
class=
"limit-good-page yoho-page"
>
<div
class=
"top clearfix"
>
<div>
<img
src=
"{{profile}}"
alt=
""
>
</div>
<p>我在Yoho!Buy有货发现了一个限定发售商品</p>
</div>
<div
class=
"banner"
>
<a
href=
"{{bannerSrc}}"
>
<img
src=
"{{banner}}"
alt=
""
>
</a>
<img
src=
"{{banner}}"
alt=
""
>
</div>
<div
class=
"detail clearfix"
>
<p
class=
"name"
>
{
{name
}
}</p>
<div
class=
"sale-info"
>
<span
class=
"price"
>
¥
{
{price
}
}</span>
<span
class=
"price"
>
{
{price
}
}</span>
<span
class=
"date"
>
<span
class=
"iconfont"
>
603
;</span>
<span
class=
"text"
>
{
{releaseDate
}
}</span>
...
...
@@ -22,28 +17,26 @@
</div>
</div>
{
{#if
attaches
}
}
<div
class=
"goodDesc"
>
{
{#mainImg
}
}
<img
class=
"lazy"
src=
"{{mainImg}}"
alt=
""
>
{
{/mainImg
}
}
{
{#goodDescription
}
}
<p
class=
"desc"
>
{
{goodDescription
}
}</p>
{
{/goodDescription
}
}
{
{#
attaches
}
}
{
{#img
}
}
<img
src=
"{{attachUrl}}"
alt=
"{{attachName}}"
>
{
{/img
}
}
{
{#imgList
}
}
<img
class=
"lazy"
src=
"{{img}}"
alt=
""
>
{
{/imgList
}
}
{
{#text
}
}
<p
class=
"desc"
>
{
{intro
}
}</p>
{
{/text
}
}
{
{#vedio
}
}
<video
poster=
"{{img}}"
controls=
"controls"
controls=
"controls"
preload=
"metadata"
loop=
"loop"
width=
"100%"
name=
"media"
>
{
{#list
}
}
<source
src=
"{{src}}"
type=
"video/ogg;codecs="
theora,vorbis
""
media=
"screen"
/>
<source
src=
"{{src}}"
/>
{
{/list
}
}
</video>
{
{/vedio
}
}
{
{#video
}
}
<video
poster=
"{{img}}"
controls=
"controls"
controls=
"controls"
preload=
"metadata"
loop=
"loop"
width=
"100%"
name=
"media"
>
<source
src=
"{{attachUrl}}"
type=
"video/ogg;codecs="
theora,vorbis
""
media=
"screen"
/>
<source
src=
"{{attachUrl}}"
/>
</video>
{
{/video
}
}
{
{/attaches
}
}
</div>
{
{/if
}
}
<div
class=
"bottom"
>
<div
class=
"logo"
></div>
...
...
yohobuy/m.yohobuy.com/application/controllers/Home.php
View file @
c4f9960
...
...
@@ -34,7 +34,7 @@ class HomeController extends AbstractAction
{
$uid
=
$this
->
getUid
(
$useSession
);
if
(
!
$uid
)
{
$this
->
go
(
Helpers
::
url
(
'/signin.html'
,
array
(
'refer'
=>
$this
->
server
(
'HTTP_REFERER'
,
SITE_MAIN
))));
$this
->
go
(
Helpers
::
url
(
'/signin.html'
,
array
(
'refer'
=>
Helpers
::
url
(
$this
->
server
(
'REQUEST_URI'
,
'/home'
)
))));
}
}
...
...
yohobuy/m.yohobuy.com/application/models/Index/Cart.php
View file @
c4f9960
...
...
@@ -325,7 +325,8 @@ class CartModel
$result
=
array
();
$skuList
=
''
;
if
(
!
empty
(
$sku
)
&&
!
empty
(
$skn
)
&&
!
empty
(
$buyNumber
))
{
// 存在sku,skn和buyNumber时
$isLimitGoods
=
!
empty
(
$sku
)
&&
!
empty
(
$skn
)
&&
!
empty
(
$buyNumber
);
if
(
$isLimitGoods
)
{
// 存在sku,skn和buyNumber时为限购商品
$skuList
=
json_encode
(
array
(
array
(
'type'
=>
'limitcode'
,
...
...
@@ -335,17 +336,22 @@ class CartModel
'buy_number'
=>
$buyNumber
)
));
$result
[
'isLimit'
]
=
true
;
}
$pay
=
CartData
::
cartPay
(
$uid
,
$cartType
,
0
,
$skuList
);
// 商品为空返回
if
(
!
$pay
||
empty
(
$pay
[
'data'
][
'goods_list'
]))
{
$result
[
'cartUrl'
]
=
Helpers
::
url
(
'/cart/index/index'
);
return
$result
;
}
do
{
if
(
!
$pay
||
$pay
[
'code'
]
!=
200
||
empty
(
$pay
[
'data'
][
'goods_list'
]))
{
if
(
$isLimitGoods
)
{
$result
[
'error'
]
=
true
;
}
else
{
$result
[
'cartUrl'
]
=
Helpers
::
url
(
'/cart/index/index'
);
}
break
;
}
if
(
$pay
&&
isset
(
$pay
[
'code'
])
&&
$pay
[
'code'
]
===
200
)
{
$payReturn
=
$pay
[
'data'
];
$address
=
array
();
$orderCompute
=
array
();
...
...
@@ -506,7 +512,8 @@ class CartModel
$coupons
[
'couponName'
]
=
$orderInfo
[
'couponName'
];
}
$result
[
'coupon'
]
=
$coupons
;
}
}
while
(
false
);
return
$result
;
}
...
...
yohobuy/m.yohobuy.com/application/models/Product/Detail.php
View file @
c4f9960
...
...
@@ -44,6 +44,7 @@ class DetailModel
if
(
empty
(
$baseInfo
[
'productName'
]))
{
return
$result
;
}
$result
[
'goodsName'
]
=
$baseInfo
[
'productName'
];
// 商品促销短语
...
...
@@ -290,16 +291,10 @@ class DetailModel
$soldOut
=
(
$baseInfo
[
'storage'
]
==
0
)
||
(
$baseInfo
[
'status'
]
==
0
||
$totalStorageNum
===
0
);
$notForSale
=
$baseInfo
[
'attribute'
]
==
2
;
// 是否为限购商品
$isLimited
=
(
$baseInfo
[
'isLimitBuy'
]
===
'Y'
);
// 显示加入购物车链接
if
(
!
$soldOut
&&
!
$notForSale
&&
!
$isLimited
)
{
if
(
!
$soldOut
&&
!
$notForSale
)
{
ksort
(
$colorGroup
,
SORT_NUMERIC
);
$result
[
'cartInfo'
][
'addToCartUrl'
]
=
Helpers
::
url
(
'/product/buy_'
.
$productId
.
'_'
.
$goodsId
.
'.html'
);
$result
[
'cartInfo'
][
'productId'
]
=
$productId
;
$result
[
'cartInfo'
][
'thumbs'
]
=
$thumbImageList
;
$result
[
'cartInfo'
][
'name'
]
=
isset
(
$result
[
'goodsName'
])
?
$result
[
'goodsName'
]
:
''
;
...
...
@@ -308,6 +303,26 @@ class DetailModel
$result
[
'cartInfo'
][
'totalNum'
]
=
$totalStorageNum
;
$result
[
'cartInfo'
][
'colors'
]
=
$colorGroup
;
$result
[
'cartInfo'
][
'sizes'
]
=
$sizeGroup
;
// 限购商品
if
(
$baseInfo
[
'isLimitBuy'
]
===
'Y'
)
{
// 是否开售
$isBeginSale
=
(
isset
(
$baseInfo
[
'saleStatus'
])
&&
$baseInfo
[
'saleStatus'
]
==
1
);
// 限购商品有关的展示状态
$showStatus
=
1
;
if
(
isset
(
$baseInfo
[
'showStatus'
]))
{
$showStatus
=
intval
(
$baseInfo
[
'showStatus'
]);
}
// 处理限购商品有关的按钮状态
self
::
procShowStatus
(
$result
,
$showStatus
,
$isBeginSale
);
$result
[
'cartInfo'
][
'limitProductCode'
]
=
$baseInfo
[
'limitProductCode'
];
$result
[
'cartInfo'
][
'limitCodeUrl'
]
=
self
::
getLimitCodeUrl
(
$baseInfo
[
'erpProductId'
]);
$result
[
'cartInfo'
][
'limitProductPay'
]
=
Helpers
::
url
(
'/cart/index/orderEnsure'
);
}
else
{
$result
[
'cartInfo'
][
'addToCartUrl'
]
=
Helpers
::
url
(
'/product/buy_'
.
$productId
.
'_'
.
$goodsId
.
'.html'
);
}
}
// 非卖品
elseif
(
$notForSale
)
{
...
...
@@ -317,22 +332,6 @@ class DetailModel
elseif
(
$soldOut
)
{
$result
[
'cartInfo'
][
'soldOut'
]
=
true
;
}
// 限购商品
elseif
(
$isLimited
)
{
// 是否开售
$isBeginSale
=
(
isset
(
$baseInfo
[
'saleStatus'
])
&&
$baseInfo
[
'saleStatus'
]
==
1
);
// 限购商品有关的展示状态
$showStatus
=
1
;
if
(
isset
(
$baseInfo
[
'showStatus'
]))
{
$showStatus
=
intval
(
$baseInfo
[
'showStatus'
]);
}
// 处理限购商品有关的按钮状态
self
::
procShowStatus
(
$result
,
$showStatus
,
$isBeginSale
);
$result
[
'cartInfo'
][
'limitProductCode'
]
=
$baseInfo
[
'limitProductCode'
];
$result
[
'cartInfo'
][
'limitCodeUrl'
]
=
'yohobuy://'
.
Helpers
::
url
(
'/product'
,
array
(
'skn'
=>
$baseInfo
[
'erpProductId'
]));
}
// 是否收藏
$result
[
'isCollect'
]
=
false
;
...
...
@@ -717,6 +716,8 @@ class DetailModel
* 获取为你优选的商品
*
* @param int $productSkn 商品SKN
* @param int $channel
* @param int $brandId
* @return array
*/
public
static
function
getPreference
(
$productSkn
,
$channel
,
$brandId
)
...
...
@@ -738,6 +739,89 @@ class DetailModel
return
$result
;
}
/**
* 获取限购商品详情
*
* @param int $uid 用户UID
* @param string $productCode
* @return array
*/
public
static
function
getLimitProductData
(
$uid
,
$productCode
)
{
$result
=
array
();
do
{
$productData
=
DetailData
::
limitProductData
(
$uid
,
$productCode
);
if
(
empty
(
$productData
)
||
empty
(
$productData
[
'data'
]))
{
break
;
}
$product
=
$productData
[
'data'
];
$result
[
'price'
]
=
$product
[
'price'
];
$result
[
'name'
]
=
$product
[
'productName'
];
// 发售日期
$result
[
'releaseDate'
]
=
$product
[
'saleTime'
]
.
'发售'
;
// baner
$result
[
'banner'
]
=
$product
[
'defaultUrl'
];
$result
[
'description'
]
=
$product
[
'description'
];
// 附件
if
(
isset
(
$product
[
'attachment'
]))
{
foreach
(
$product
[
'attachment'
]
as
$item
)
{
$result
[
'attaches'
][]
=
self
::
procLimitProductAttach
(
$item
);
}
}
}
while
(
false
);
return
$result
;
}
/**
* 处理限购商品附件数据
*
* @param array $attachment 附件数据
* @return array
*/
private
static
function
procLimitProductAttach
(
$attachment
)
{
$result
=
array
();
switch
(
intval
(
$attachment
[
'attachType'
]))
{
case
1
:
// 大图文字
$result
[
'img'
]
=
array
(
'attachUrl'
=>
Helpers
::
getImageUrl
(
$attachment
[
'attachUrl'
],
290
,
200
),
'attachName'
=>
$attachment
[
'attachName'
],
'intro'
=>
$attachment
[
'intro'
],
'orderBy'
=>
$attachment
[
'orderBy'
]
);
break
;
case
2
:
// 视频
$result
[
'video'
]
=
array
(
'attachUrl'
=>
$attachment
[
'attachUrl'
],
'orderBy'
=>
$attachment
[
'orderBy'
],
'img'
=>
Helpers
::
getImageUrl
(
$attachment
[
'intro'
],
290
,
200
)
);
break
;
case
3
:
// 文本类型
$result
[
'text'
]
=
array
(
'intro'
=>
$attachment
[
'intro'
],
'orderBy'
=>
$attachment
[
'orderBy'
]
);
break
;
default
:
break
;
}
if
(
count
(
$result
)
>
1
)
{
Helpers
::
sortArrByField
(
$result
,
'orderBy'
);
}
return
$result
;
}
/**
* 处理限购商品的有关按钮状态(或取现购买以及底部商品购买按钮)
*
...
...
@@ -783,4 +867,22 @@ class DetailModel
}
}
/**
* 根据设备类型获得限购商品跳转app的url
*
* @param string $skn 商品skn
* @return string 限购商品跳转url
*/
private
static
function
getLimitCodeUrl
(
$skn
)
{
$url
=
'yohoapp://yoho.app/openwith?product_skn='
.
$skn
;
// 苹果设备或者苹果IPAD
if
(
strstr
(
$_SERVER
[
'HTTP_USER_AGENT'
],
'iPhone'
)
||
strstr
(
$_SERVER
[
'HTTP_USER_AGENT'
],
'iPad'
))
{
$url
=
'yohobuy://'
.
Helpers
::
url
(
'/product'
,
array
(
'skn'
=>
$skn
));
}
return
$url
;
}
}
...
...
yohobuy/m.yohobuy.com/application/modules/Cart/controllers/Index.php
View file @
c4f9960
...
...
@@ -295,17 +295,20 @@ class IndexController extends AbstractAction
}
// 如果传递了code, sku,skn,buy_number就代表是限购商品
$limitProductCode
=
$this
->
get
(
'code'
,
''
);
$limitProductCode
=
$this
->
get
(
'
limitproduct
code'
,
''
);
$sku
=
$this
->
get
(
'sku'
,
''
);
$skn
=
$this
->
get
(
'skn'
,
''
);
$buyNumber
=
$this
->
get
(
'buy_number'
,
''
);
$buyNumber
=
$this
->
get
(
'buy_number'
,
1
);
// 购物车商品为空跳转到购物车页面
$uid
=
$this
->
getUid
(
true
);
$order
=
CartModel
::
cartPay
(
$uid
,
$cartType
,
$orderInfo
,
$limitProductCode
,
$sku
,
$skn
,
$buyNumber
);
if
(
isset
(
$order
[
'cartUrl'
]))
{
if
(
isset
(
$order
[
'cartUrl'
]))
{
// 普通或者预售商品为空时
$this
->
go
(
$order
[
'cartUrl'
]);
}
if
(
isset
(
$order
[
'error'
]))
{
// 限购商品支付接口返回为空或错误时
$this
->
error
();
}
$data
=
array
(
'orderEnsurePage'
=>
true
,
...
...
yohobuy/m.yohobuy.com/application/modules/Product/controllers/Detail.php
View file @
c4f9960
...
...
@@ -3,6 +3,7 @@
use
Action\AbstractAction
;
use
Plugin\Helpers
;
use
LibModels\Wap\Product\DetailData
;
use
Product\DetailModel
;
/**
* 商品详情的控制器
...
...
@@ -33,10 +34,11 @@ class DetailController extends AbstractAction
$vipLevel
=
Helpers
::
getVipLevel
(
$this
->
_vip
);
}
$data
=
\Product\
DetailModel
::
getBaseInfo
(
$productId
,
$goodsId
,
$uid
,
$vipLevel
);
$data
=
DetailModel
::
getBaseInfo
(
$productId
,
$goodsId
,
$uid
,
$vipLevel
);
if
(
array
()
===
$data
)
{
$this
->
error
();
}
$data
[
'goodsDetailPage'
]
=
true
;
$data
[
'pageFooter'
]
=
true
;
...
...
@@ -66,7 +68,7 @@ class DetailController extends AbstractAction
$vipLevel
=
Helpers
::
getVipLevel
(
$this
->
_vip
);
}
$data
=
\Product\
DetailModel
::
getBaseInfo
(
null
,
null
,
$uid
,
$vipLevel
,
$productSkn
);
$data
=
DetailModel
::
getBaseInfo
(
null
,
null
,
$uid
,
$vipLevel
,
$productSkn
);
if
(
array
()
===
$data
)
{
$this
->
error
();
}
...
...
@@ -94,7 +96,7 @@ class DetailController extends AbstractAction
// 加入uid和udid参数,为了实现记录浏览记录的功能
$uid
=
$this
->
getUid
();
$udid
=
$this
->
getUdid
();
$data
=
\Product\
DetailModel
::
getSizeInfo
(
$productSkn
,
$uid
,
$udid
);
$data
=
DetailModel
::
getSizeInfo
(
$productSkn
,
$uid
,
$udid
);
if
(
array
()
===
$data
)
{
echo
' '
;
exit
();
...
...
@@ -126,7 +128,7 @@ class DetailController extends AbstractAction
'goodsCommentsPage'
=>
true
,
'pageFooter'
=>
true
,
'comments'
=>
array
(
'list'
=>
\Product\
DetailModel
::
getComments
(
$productId
),
'list'
=>
DetailModel
::
getComments
(
$productId
),
),
);
...
...
@@ -155,14 +157,14 @@ class DetailController extends AbstractAction
$this
->
setTitle
(
'购买咨询'
);
$uid
=
$this
->
getUid
();
$consults
=
\Product\
DetailModel
::
getConsults
(
$uid
,
$productId
);
$consults
=
DetailModel
::
getConsults
(
$uid
,
$productId
);
$data
=
array
(
'goodsConsultsPage'
=>
true
,
'pageFooter'
=>
true
,
'consults'
=>
array
(
'list'
=>
$consults
),
'faq'
=>
\Product\
DetailModel
::
getCommonConsults
(),
'faq'
=>
DetailModel
::
getCommonConsults
(),
'showReadMore'
=>
count
(
$consults
)
>
2
,
'link'
=>
Helpers
::
url
(
'/product/detail/consultform'
,
array
(
'product_id'
=>
$productId
)),
);
...
...
@@ -184,7 +186,7 @@ class DetailController extends AbstractAction
$total
=
$this
->
post
(
'total'
,
0
);
$uid
=
$this
->
getUid
();
$id
=
$this
->
post
(
'id'
);
$result
=
\Product\
DetailModel
::
upvoteConsult
(
$uid
,
$id
,
$productId
,
$total
);
$result
=
DetailModel
::
upvoteConsult
(
$uid
,
$id
,
$productId
,
$total
);
}
$this
->
echoJson
(
$result
);
...
...
@@ -202,7 +204,7 @@ class DetailController extends AbstractAction
$total
=
$this
->
post
(
'total'
,
0
);
$uid
=
$this
->
getUid
();
$id
=
$this
->
post
(
'id'
);
$result
=
\Product\
DetailModel
::
usefulConsult
(
$uid
,
$id
,
$productId
,
$total
);
$result
=
DetailModel
::
usefulConsult
(
$uid
,
$id
,
$productId
,
$total
);
}
$this
->
echoJson
(
$result
);
...
...
@@ -266,7 +268,7 @@ class DetailController extends AbstractAction
$productSkn
=
$this
->
get
(
'productSkn'
);
$brandId
=
$this
->
get
(
'brandId'
);
$channel
=
Helpers
::
getChannelByCookie
();
$result
=
\Product\
DetailModel
::
getPreference
(
$productSkn
,
$channel
,
$brandId
);
$result
=
DetailModel
::
getPreference
(
$productSkn
,
$channel
,
$brandId
);
}
if
(
empty
(
$result
))
{
...
...
@@ -276,4 +278,35 @@ class DetailController extends AbstractAction
}
}
/**
* 限购商品说明页面
*/
public
function
limitHelpAction
()
{
$data
=
array
();
$this
->
_view
->
display
(
'limit-help'
,
$data
);
}
/**
* 限购商品详情页
*/
public
function
limitAction
()
{
$productCode
=
$this
->
get
(
'code'
,
''
);
if
(
empty
(
$productCode
))
{
$this
->
error
();
}
$uid
=
$this
->
getUid
();
$data
=
DetailModel
::
getLimitProductData
(
$uid
,
$productCode
);
if
(
empty
(
$data
))
{
$this
->
error
();
}
// APP下载链接地址
$data
[
'appSrc'
]
=
'http://a.app.qq.com/o/simple.jsp?pkgname=com.yoho'
;
$this
->
_view
->
display
(
'limit'
,
$data
);
}
}
...
...
yohobuy/m.yohobuy.com/application/modules/Product/controllers/Index.php
View file @
c4f9960
...
...
@@ -228,54 +228,4 @@ class IndexController extends AbstractAction
$this
->
_view
->
display
(
'index'
,
$data
);
}
public
function
limitHelpAction
()
{
$data
=
array
();
$this
->
_view
->
display
(
'limit-help'
,
$data
);
}
public
function
limitAction
()
{
$data
=
array
(
'profile'
=>
'http://cdn.yoho.cn/myohobuy/assets/img/me/index/user-avatar.png?1455719653'
,
'banner'
=>
'http://img11.static.yhbimg.com/yhb-img01/2016/02/25/02/016ed5a17fb9d9bc7542174c22dccb4acf.jpg?imageView/2/w/640/h/240'
,
'bannerSrc'
=>
'./'
,
'name'
=>
'潮流尖端商品啊啊啊啊'
,
'price'
=>
'1999'
,
'releaseDate'
=>
'2016年12月发售'
,
'appSrc'
=>
'./'
,
'mainImg'
=>
'http://img11.static.yhbimg.com/yhb-img01/2016/02/25/02/016ed5a17fb9d9bc7542174c22dccb4acf.jpg?imageView/2/w/640/h/240'
,
'goodDescription'
=>
'独独家发售快乐的肌肤立刻就是大老骥伏枥开始的肌肤独家发售快乐的肌肤立刻就是大老骥伏枥开始的肌肤独家发售快乐的肌肤立刻就是大老骥伏枥开始的肌肤独家发售快乐的肌肤立刻就是大老骥伏枥开始的肌肤独家发售快乐的肌肤立刻就是大老骥伏枥开始的肌肤独家发售快乐的肌肤立刻就是大老骥伏枥开始的肌肤独家发售快乐的肌肤立刻就是大老骥伏枥开始的肌肤独家发售快乐的肌肤立刻就是大老骥伏枥开始的肌肤独家发售快乐的肌肤立刻就是大老骥伏枥开始的肌肤独家发售快乐的肌肤立刻就是大老骥伏枥开始的肌肤独家发售快乐的肌肤立刻就是大老骥伏枥开始的肌肤独家发售快乐的肌肤立刻就是大老骥伏枥开始的肌肤家发售快乐的肌肤立刻就是大老骥伏枥开始的肌肤'
,
'imgList'
=>
array
(
array
(
'img'
=>
'http://img11.static.yhbimg.com/yhb-img01/2016/02/25/02/016ed5a17fb9d9bc7542174c22dccb4acf.jpg?imageView/2/w/640/h/240'
),
array
(
'img'
=>
'http://img11.static.yhbimg.com/yhb-img01/2016/02/25/02/016ed5a17fb9d9bc7542174c22dccb4acf.jpg?imageView/2/w/640/h/240'
),
array
(
'img'
=>
'http://img11.static.yhbimg.com/yhb-img01/2016/02/25/02/016ed5a17fb9d9bc7542174c22dccb4acf.jpg?imageView/2/w/640/h/240'
)
),
'vedio'
=>
array
(
'img'
=>
'./'
,
'list'
=>
array
(
array
(
'src'
=>
'http://video.yohoboys.com/xuanchuan/wuyifan_mobile.mp4'
),
array
(
'src'
=>
'http://video.yohoboys.com/xuanchuan/wuyifan_mobile.webm'
),
array
(
'src'
=>
'http://video.yohoboys.com/xuanchuan/wuyifan_mobile.ogv'
)
)
)
);
$this
->
_view
->
display
(
'limit'
,
$data
);
}
}
...
...
Please
register
or
login
to post a comment