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
Plain Diff
Browse Files
Authored by
biao
9 years ago
Commit
5bdf43c38cdfc45197354903354c549b0059e9ae
2 parents
b00d2e4d
90baa97a
Merge branch 'develop' of
http://git.dev.yoho.cn/web/yohobuy
into feature/bindMobile
Hide whitespace changes
Inline
Side-by-side
Showing
13 changed files
with
199 additions
and
74 deletions
docs/data-structure.md
library/LibModels/Wap/Home/CartData.php
library/LibModels/Wap/Home/IndexData.php
static/js/product/recommend-for-you-product-desc.js
static/js/shopping-cart/order-ensure.js
static/sass/index/_index.scss
template/m.yohobuy.com/actions/index/index/index.phtml
template/m.yohobuy.com/actions/index/shoppingCart/order-ensure.phtml
yohobuy/m.yohobuy.com/application/controllers/Index.php
yohobuy/m.yohobuy.com/application/controllers/ShoppingCart.php
yohobuy/m.yohobuy.com/application/models/Index/Cart.php
yohobuy/m.yohobuy.com/application/models/Index/Home.php
yohobuy/m.yohobuy.com/application/modules/Passport/controllers/Bind.php
docs/data-structure.md
View file @
5bdf43c
...
...
@@ -1283,7 +1283,7 @@
name: '黄色',
colorNum:10,
sizeNumStr:'10/20/30' //对应的商品尺码数目,用斜杠分割
},
...
],
...
...
@@ -1396,5 +1396,7 @@
'entitle' : 'LIFESTYLE',
}
],
'showYohood' : true/false
'showYohood' : true/false,
'yohoodHref' : '/yohood'
}
...
...
library/LibModels/Wap/Home/CartData.php
View file @
5bdf43c
...
...
@@ -303,14 +303,15 @@ class CartData
* @param int $paymentId 支付方式ID
* @param int $paymentType 支付类型ID
* @param string $remark 留言
* @param string $couponCode 优惠券码
* @param mixed $yohoCoin 使用的YOHO币数量或为空
* @return array 接口返回的数据
*/
public
static
function
orderSub
(
$uid
,
$addressId
,
$cartType
,
$deliveryTime
,
$deliveryWay
,
$invoiceTitle
,
$invoiceId
,
$paymentId
,
$paymentType
,
$remark
,
$yohoCoin
)
public
static
function
orderSub
(
$uid
,
$addressId
,
$cartType
,
$deliveryTime
,
$deliveryWay
,
$invoiceTitle
,
$invoiceId
,
$paymentId
,
$paymentType
,
$remark
,
$
couponCode
,
$
yohoCoin
)
{
$param
=
Yohobuy
::
param
();
$param
[
'method'
]
=
'app.Shopping.submit'
;
$param
[
'address
I
d'
]
=
$addressId
;
$param
[
'address
_i
d'
]
=
$addressId
;
$param
[
'cart_type'
]
=
$cartType
;
$param
[
'delivery_time'
]
=
$deliveryTime
;
$param
[
'delivery_way'
]
=
$deliveryWay
;
...
...
@@ -324,6 +325,9 @@ class CartData
$param
[
'payment_id'
]
=
$paymentId
;
$param
[
'payment_type'
]
=
$paymentType
;
$param
[
'remark'
]
=
$remark
;
if
(
!
empty
(
$couponCode
))
{
$param
[
'coupon_code'
]
=
$couponCode
;
}
if
(
!
empty
(
$yohoCoin
))
{
$param
[
'use_yoho_coin'
]
=
$yohoCoin
;
}
...
...
library/LibModels/Wap/Home/IndexData.php
View file @
5bdf43c
...
...
@@ -67,5 +67,17 @@ class IndexData
return
Yohobuy
::
get
(
Yohobuy
::
SERVICE_URL
.
'operations/api/v5/resource/home'
,
$param
);
}
/**
* 获取频道选择页数据
*
* @return array
*/
public
static
function
channelData
()
{
$param
=
Yohobuy
::
param
();
$param
[
'client_secret'
]
=
Sign
::
getSign
(
$param
);
return
Yohobuy
::
get
(
Yohobuy
::
SERVICE_URL
.
'operations/api/v5/entrance/getEntrance'
,
$param
,
3600
);
}
}
...
...
static/js/product/recommend-for-you-product-desc.js
View file @
5bdf43c
...
...
@@ -10,28 +10,51 @@ var Swiper = require('yoho.iswiper'),
var
recommendSwiper
,
$recommendForYou
=
$
(
'.recommend-for-you'
),
preferenceUrl
=
$
(
'#preferenceUrl'
).
val
();
if
(
preferenceUrl
)
{
$
.
get
(
preferenceUrl
).
then
(
function
(
html
)
{
if
(
html
.
length
<
5
)
{
$recommendForYou
.
css
(
'display'
,
'none'
);
}
else
{
$recommendForYou
.
html
(
html
).
show
();
if
(
$
(
'#swiper-recommend'
).
length
)
{
recommendSwiper
=
new
Swiper
(
'#swiper-recommend'
,
{
slidesPerView
:
'auto'
,
grabCursor
:
true
,
slideElement
:
'a'
,
lazyLoading
:
true
,
watchSlidesVisibility
:
true
});
preferenceUrl
=
$
(
'#preferenceUrl'
).
val
(),
winH
=
$
(
window
).
height
(),
end
=
false
,
requesting
=
false
;
function
request
()
{
if
(
requesting
||
end
)
{
return
;
}
requesting
=
true
;
if
(
preferenceUrl
)
{
$
.
get
(
preferenceUrl
).
then
(
function
(
html
)
{
if
(
html
.
length
<
5
)
{
$recommendForYou
.
css
(
'display'
,
'none'
);
}
else
{
$recommendForYou
.
html
(
html
).
show
();
if
(
$
(
'#swiper-recommend'
).
length
)
{
recommendSwiper
=
new
Swiper
(
'#swiper-recommend'
,
{
slidesPerView
:
'auto'
,
grabCursor
:
true
,
slideElement
:
'a'
,
lazyLoading
:
true
,
watchSlidesVisibility
:
true
});
}
}
}
window
.
rePosFooter
();
requesting
=
false
;
end
=
true
;
}).
fail
(
function
()
{
$recommendForYou
.
hide
();
});
}).
fail
(
function
()
{
$recommendForYou
.
hide
();
});
}
}
function
scrollHandler
()
{
if
(
!
end
||
$
(
window
).
scrollTop
()
+
winH
>=
$
(
document
).
height
()
-
50
)
{
request
();
}
}
$
(
window
).
scroll
(
function
()
{
window
.
requestAnimationFrame
(
scrollHandler
);
});
...
...
static/js/shopping-cart/order-ensure.js
View file @
5bdf43c
...
...
@@ -15,6 +15,7 @@ var dispatchModeHammer,
dispatchTimeHammer
,
$invoice
=
$
(
'.invoice'
),
$price
=
$
(
'.price-cal'
),
payType
,
priceTmpl
=
Handlebars
.
compile
(
$
(
'#tmpl-price'
).
html
());
lazyLoad
();
...
...
@@ -99,23 +100,33 @@ function submitOrder() {
addressId
:
orderInfo
(
'addressId'
),
cartType
:
orderInfo
(
'cartType'
),
deliveryId
:
orderInfo
(
'deliveryId'
)
||
1
,
deliveryTimeId
:
orderInfo
(
'deliveryTimeId'
)
||
1
,
invoiceText
:
orderInfo
(
'invoiceText'
),
invoiceType
:
orderInfo
(
'invoiceType'
),
msg
:
orderInfo
(
'msg'
),
deliveryTimeId
:
orderInfo
(
'deliveryTimeId'
)
||
2
,
invoiceText
:
$invoice
.
find
(
'[name="invoice-title"]'
).
val
()
||
orderInfo
(
'invoiceText'
),
invoiceType
:
$invoice
.
find
(
'.invoice-type'
).
val
()
||
orderInfo
(
'invoiceType'
),
msg
:
$
(
'#msg'
).
find
(
'input'
).
val
()
||
orderInfo
(
'msg'
),
paymentTypeId
:
orderInfo
(
'paymentTypeId'
),
paymentType
:
orderInfo
(
'paymentType'
),
//支付方式
couponCode
:
orderInfo
(
'couponCode'
),
yohoCoin
:
orderInfo
(
'yohoCoin'
)
}
}).
then
(
function
(
res
)
{
var
url
;
if
(
!
res
)
{
tip
.
show
(
'网络出错'
);
return
;
}
if
(
res
.
code
!==
200
)
{
tip
.
show
(
res
.
message
||
'网络出错'
);
if
(
res
.
code
===
200
)
{
if
(
payType
===
2
)
{
// 货到付款的进入订单页面
url
=
'/home/orderDetail?order_code='
+
res
.
data
.
order_code
;
}
else
{
url
=
'/home/pay?order_code='
+
res
.
data
.
order_code
;
}
window
.
location
.
href
=
url
;
}
else
{
console
.
log
(
1
);
tip
.
show
(
res
.
messege
||
'网络出错'
);
}
}).
fail
(
function
()
{
tip
.
show
(
'网络出错'
);
...
...
@@ -124,7 +135,7 @@ function submitOrder() {
// 界面点击,状态存 cookie
if
(
!
orderInfo
(
'addressId'
))
{
orderInfo
(
'addressId'
,
$
(
'.address-wrap'
).
data
(
'
address-
id'
));
orderInfo
(
'addressId'
,
$
(
'.address-wrap'
).
data
(
'id'
));
}
$
(
'.dispatch-mode'
).
on
(
'touchend'
,
'li'
,
function
()
{
...
...
@@ -166,7 +177,10 @@ $('#msg').find('input').on('blur', function() {
});
$
(
'.pay-mode'
).
on
(
'click'
,
'li'
,
function
()
{
orderInfo
(
'paymentTypeId'
,
$
(
this
).
data
(
'pay-id'
));
orderInfo
(
'paymentType'
,
$
(
this
).
data
(
'pay-type'
));
var
$this
=
$
(
this
);
orderInfo
(
'paymentTypeId'
,
$this
.
data
(
'pay-id'
));
orderInfo
(
'paymentType'
,
$this
.
data
(
'pay-type'
));
payType
=
$this
.
data
(
'pay-type'
);
submitOrder
();
});
...
...
static/sass/index/_index.scss
View file @
5bdf43c
...
...
@@ -2,6 +2,16 @@
width
:
100%
;
overflow
:
hidden
;
margin
:
0
auto
;
#yohood
{
background-color
:
transparent
;
background-image
:
image-url
(
'yohood.png'
);
background-size
:
40%
;
background-repeat
:
no-repeat
;
background-position-x
:
26%
;
background-position-y
:
36%
;
border
:
none
;
border-bottom
:
4px
solid
#fff
;
}
.index-header
{
box-sizing
:
border-box
;
padding
:
0
20rem
/
$pxConvertRem
;
...
...
template/m.yohobuy.com/actions/index/index/index.phtml
View file @
5bdf43c
...
...
@@ -23,7 +23,7 @@
<a
href=
"{{href}}"
class=
"list-item"
>
{
{title
}
}
<span
class=
"lighter"
>
{
{entitle
}
}</span>
<span
class=
"iconfont right-icon"
>
614
;</span></a>
{
{/channelList
}
}
{
{#showYohood
}
}
<a
href=
"
/yohood
"
id=
"yohood"
class=
"list-item"
>
<span
class=
"iconfont right-icon"
>
614
;</span></a>
<a
href=
"
{{yohoodHref}}
"
id=
"yohood"
class=
"list-item"
>
<span
class=
"iconfont right-icon"
>
614
;</span></a>
{
{/showYohood
}
}
</div>
</div>
...
...
template/m.yohobuy.com/actions/index/shoppingCart/order-ensure.phtml
View file @
5bdf43c
{
{>
layout/header
}
}
<div
class=
"order-ensure-page yoho-page"
>
{
{#
orderEnsure
}
}
<a
class=
"address-wrap block"
href=
"/shoppingCart/selectAddress"
data-address-id=
"{{addressId}}
"
>
<a
class=
"address-wrap block"
data-id=
"{{addressId}}"
href=
"/shoppingCart/selectAddress
"
>
<p
class=
"infos"
>
收货地址
<span
class=
"per-info"
>
{
{name
}
}
{
{phoneNum
}
}</span>
...
...
@@ -67,16 +67,14 @@
</li>
{
{/if
}
}
{
{#
yohoCoin
}
}
<li
class=
"coin"
data-yoho-coin=
"{{.}}"
>
<span
class=
"title"
>YOHO币</span>
<span
class=
"desc"
>可抵用¥
{
{.
}
}</span>
<span
class=
"coin-check"
>
<em>-
¥
{
{.
}
}</em>
<i
class=
"iconfont checkbox icon-cb-checked"
></i>
</span>
</li>
{
{/
yohoCoin
}
}
<li
class=
"coin"
data-yoho-coin=
"{{yohoCoin}}"
>
<span
class=
"title"
>YOHO币</span>
<span
class=
"desc"
>可抵用¥
{
{yohoCoin
}
}</span>
<span
class=
"coin-check"
>
<em>-
¥
{
{yohoCoin
}
}</em>
<i
class=
"iconfont checkbox icon-cb-checked"
></i>
</span>
</li>
{
{#if
invoice
}
}
<li
class=
"invoice {{#if needInvoice}}focus{{/if}}"
>
...
...
yohobuy/m.yohobuy.com/application/controllers/Index.php
View file @
5bdf43c
...
...
@@ -23,16 +23,16 @@ class IndexController extends AbstractAction
// 设置浏览器缓存5分钟
$this
->
setExpires
(
300
);
}
$result
=
Index\HomeModel
::
getChannel
();
$result
[
'background'
]
=
Index\HomeModel
::
getBgImage
();
$result
[
'channelPage'
]
=
true
;
$result
[
'showDownloadApp'
]
=
true
;
$result
[
'searchUrl'
]
=
Helpers
::
url
(
''
,
null
,
'search'
);
$result
[
'pageFooter'
]
=
true
;
// 渲染模板
$this
->
_view
->
display
(
'index'
,
array
(
'background'
=>
Index\HomeModel
::
getBgImage
(),
'channelPage'
=>
true
,
'showDownloadApp'
=>
true
,
'searchUrl'
=>
Helpers
::
url
(
''
,
null
,
'search'
),
'pageFooter'
=>
true
,
));
$this
->
_view
->
display
(
'index'
,
$result
);
}
/**
* 设置升级公告路由
*
...
...
yohobuy/m.yohobuy.com/application/controllers/ShoppingCart.php
View file @
5bdf43c
...
...
@@ -314,8 +314,9 @@ class ShoppingCartController extends AbstractAction
$paymentId
=
$this
->
post
(
'paymentTypeId'
,
15
);
$paymentType
=
$this
->
post
(
'paymentType'
,
1
);
// 默认在线支付
$remark
=
$this
->
post
(
'msg'
,
null
);
$couponCode
=
$this
->
post
(
'couponCode'
,
null
);
$yohoCoin
=
$this
->
post
(
'yohoCoin'
,
1
);
$result
=
CartModel
::
orderSub
(
$uid
,
$addressId
,
$cartType
,
$deliveryTime
,
$deliveryWay
,
$invoiceTitle
,
$invoiceId
,
$paymentId
,
$paymentType
,
$remark
,
$yohoCoin
);
$result
=
CartModel
::
orderSub
(
$uid
,
$addressId
,
$cartType
,
$deliveryTime
,
$deliveryWay
,
$invoiceTitle
,
$invoiceId
,
$paymentId
,
$paymentType
,
$remark
,
$
couponCode
,
$
yohoCoin
);
}
if
(
empty
(
$result
))
{
...
...
yohobuy/m.yohobuy.com/application/models/Index/Cart.php
View file @
5bdf43c
...
...
@@ -567,16 +567,28 @@ class CartModel
* @param int $paymentId 支付方式ID
* @param int $paymentType 支付类型ID
* @param string $remark 留言
* @param string $couponCode 优惠券码
* @param mixed $yohoCoin 使用的YOHO币数量或为空
* @return array 接口返回的数据
*/
public
static
function
orderSub
(
$uid
,
$addressId
,
$cartType
,
$deliveryTime
,
$deliveryWay
,
$invoiceTitle
,
$invoiceId
,
$paymentId
,
$paymentType
,
$remark
,
$yohoCoin
)
public
static
function
orderSub
(
$uid
,
$addressId
,
$cartType
,
$deliveryTime
,
$deliveryWay
,
$invoiceTitle
,
$invoiceId
,
$paymentId
,
$paymentType
,
$remark
,
$
couponCode
,
$
yohoCoin
)
{
$result
=
array
();
$orderSubRes
=
CartData
::
orderSub
(
$uid
,
$addressId
,
$cartType
,
$deliveryTime
,
$deliveryWay
,
$invoiceTitle
,
$invoiceId
,
$paymentId
,
$paymentType
,
$remark
,
$yohoCoin
);
if
(
$orderSubRes
&&
isset
(
$orderSubRes
[
'code'
]))
{
$result
=
$orderSubRes
;
$result
=
array
(
'code'
=>
400
,
'message'
=>
'出错啦'
);
if
(
empty
(
$addressId
))
{
$result
[
'code'
]
=
401
;
$result
[
'message'
]
=
'配送地址不能为空'
;
}
elseif
(
empty
(
$deliveryTime
))
{
$result
[
'code'
]
=
402
;
$result
[
'message'
]
=
'请选择配送时间'
;
}
elseif
(
empty
(
$deliveryWay
))
{
$result
[
'code'
]
=
403
;
$result
[
'message'
]
=
'请选择配送方式'
;
}
else
{
$orderSubRes
=
CartData
::
orderSub
(
$uid
,
$addressId
,
$cartType
,
$deliveryTime
,
$deliveryWay
,
$invoiceTitle
,
$invoiceId
,
$paymentId
,
$paymentType
,
$remark
,
$couponCode
,
$yohoCoin
);
if
(
$orderSubRes
&&
isset
(
$orderSubRes
[
'code'
]))
{
$result
=
$orderSubRes
;
}
}
return
$result
;
...
...
yohobuy/m.yohobuy.com/application/models/Index/Home.php
View file @
5bdf43c
...
...
@@ -10,7 +10,7 @@ use Configs\CacheConfig;
/**
* 首页相关的模板数据模型
*
*
* @name HomeModel
* @package models
* @copyright yoho.inc
...
...
@@ -52,7 +52,7 @@ class HomeModel
/**
* 选择频道
*
*
* @return void
*/
public
static
function
goSwitchChannel
()
...
...
@@ -70,7 +70,7 @@ class HomeModel
/**
* 设置选择的频道保存到浏览器COOKIE
*
*
* @param string $cookie
* @return void
*/
...
...
@@ -81,7 +81,7 @@ class HomeModel
/**
* 获取频道选择页的背景图片
*
*
* @return string | false
*/
public
static
function
getBgImage
()
...
...
@@ -122,7 +122,7 @@ class HomeModel
/**
* 获取男生,女生底部banner
*
*
* @return string | false
*/
public
static
function
getBottomBanner
(
$channel
)
...
...
@@ -164,7 +164,7 @@ class HomeModel
}
// 接口调用正常,数据封装完成, 则设置一级(master)和二级(slave)数据缓存
else
{
Cache
::
set
(
$cache
,
$result
);
Cache
::
set
(
$cache
,
$result
);
}
}
...
...
@@ -173,7 +173,7 @@ class HomeModel
/**
* 获取男生首页的楼层数据
*
*
* @return array | false
*/
public
static
function
getBoysFloor
()
...
...
@@ -204,13 +204,13 @@ class HomeModel
Cache
::
set
(
CacheConfig
::
KEY_ACTION_BOYS_INDEX
,
$result
);
}
}
return
$result
;
}
/**
* 获取女生首页的楼层数据
*
*
* @return array | false
*/
public
static
function
getGirlsFloor
()
...
...
@@ -247,7 +247,7 @@ class HomeModel
/**
* 获取潮童首页的楼层数据
*
*
* @return array | false
*/
public
static
function
getKidsFloor
()
...
...
@@ -284,7 +284,7 @@ class HomeModel
/**
* 获取创意生活首页的楼层数据
*
*
* @return array | false
*/
public
static
function
getLifestyleFloor
()
...
...
@@ -319,4 +319,53 @@ class HomeModel
return
$result
;
}
/**
* 获取频道选择页数据
*
* @return array
*/
public
static
function
getChannel
(){
$result
=
array
();
$result
[
'showYohood'
]
=
false
;
$data
=
IndexData
::
channelData
();
$channelList
=
array
();
if
(
isset
(
$data
[
'data'
][
'list'
])){
foreach
(
$data
[
'data'
][
'list'
]
as
$key
=>
$value
){
switch
(
$value
[
'channel_id'
])
{
case
5
:
$result
[
'showYohood'
]
=
true
;
$result
[
'yohoodHref'
]
=
'/yohood'
;
break
;
case
1
:
$channelList
[
$key
][
'href'
]
=
'/boys'
;
$channelList
[
$key
][
'title'
]
=
'男生'
;
$channelList
[
$key
][
'entitle'
]
=
'BOYS'
;
break
;
case
2
:
$channelList
[
$key
][
'href'
]
=
'/girls'
;
$channelList
[
$key
][
'title'
]
=
'女生'
;
$channelList
[
$key
][
'entitle'
]
=
'GIRLS'
;
break
;
case
3
:
$channelList
[
$key
][
'href'
]
=
'/kids'
;
$channelList
[
$key
][
'title'
]
=
'潮童'
;
$channelList
[
$key
][
'entitle'
]
=
'KIDS'
;
break
;
case
4
:
$channelList
[
$key
][
'href'
]
=
'/lifestyle'
;
$channelList
[
$key
][
'title'
]
=
'创意生活'
;
$channelList
[
$key
][
'entitle'
]
=
'LIFESTYLE'
;
break
;
default
:
break
;
}
}
$result
[
'channelList'
]
=
$channelList
;
}
return
$result
;
}
}
...
...
yohobuy/m.yohobuy.com/application/modules/Passport/controllers/Bind.php
View file @
5bdf43c
...
...
@@ -138,7 +138,7 @@ class BindController extends AbstractAction
}
else
{
$data
=
array
(
'code'
=>
$res
[
'code'
],
'message'
=>
$res
[
'message'
],
'data'
=>
$res
[
'data'
]
);
$data
=
array
(
'code'
=>
$res
[
'code'
],
'message'
=>
$res
[
'message'
],
'data'
=>
isset
(
$res
[
'data'
])
?
$res
[
'data'
]
:
''
);
}
}
while
(
false
);
...
...
Please
register
or
login
to post a comment