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
0e87f9dd36fd6742c9bef7e573e3cfc816d1d00c
2 parents
5a8470b0
5bb46c38
Merge branch 'develop' of
http://git.dev.yoho.cn/web/yohobuy
into feature/bindMobile
Hide whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
178 additions
and
67 deletions
docs/data-structure.md
library/LibModels/Wap/Passport/BindData.php
static/js/product/detail/like.js
static/js/shopping-cart/chose-panel.js
static/sass/shopping-cart/_chose-panel.scss
template/m.yohobuy.com/actions/product/detail/index.phtml
template/m.yohobuy.com/partials/shopping-cart/chose-panel.phtml
yohobuy/m.yohobuy.com/application/models/Index/Cart.php
yohobuy/m.yohobuy.com/application/modules/Passport/controllers/Bind.php
docs/data-structure.md
View file @
0e87f9d
...
...
@@ -1263,11 +1263,45 @@
'cartUrl':'购物车url',
'addToCartUrl':'添加购物车url',
'soldOut':'已售罄',
'notForSale':'非卖品'
'notForSale':'非卖品',
thumb: [
{
id:1,
url : ''
},
...
],
name: '',
price: '',
salePrice: '',
colors: [
{
id: 1,
chosed: true,
name: '黄色',
colorNum:10,
shortUrl:'',
},
...
],
sizes: [
{
id: 2,
chosed: true,
name: 'X',
sizeNum: 2
},
...
],
totalNum: 20
},
'introUrl' : '',
'id' : '',
'preferenceUrl' :''
'preferenceUrl' :''
,
}
### 评价列表页面
{
...
...
library/LibModels/Wap/Passport/BindData.php
View file @
0e87f9d
...
...
@@ -42,12 +42,13 @@ class BindData
* @param string $mobile 手机号
*
*/
public
static
function
sendBindMsg
(
$mobile
)
public
static
function
sendBindMsg
(
$
area
,
$
mobile
)
{
$param
=
Yohobuy
::
param
();
$param
[
'method'
]
=
'app.passport.smsbind'
;
$param
[
'mobile'
]
=
$mobile
;
$param
[
'area'
]
=
$area
;
$param
[
'client_secret'
]
=
Sign
::
getSign
(
$param
);
return
Yohobuy
::
get
(
Yohobuy
::
API_URL
,
$param
);
...
...
@@ -57,13 +58,14 @@ class BindData
* 验证验证码是否正确
*
*/
public
static
function
checkBindCode
(
$mobile
,
$code
)
public
static
function
checkBindCode
(
$
area
,
$
mobile
,
$code
)
{
$param
=
Yohobuy
::
param
();
$param
[
'method'
]
=
'app.register.validRegCode'
;
$param
[
'mobile'
]
=
$mobile
;
$param
[
'code'
]
=
$code
;
$param
[
'area'
]
=
$area
;
$param
[
'client_secret'
]
=
Sign
::
getSign
(
$param
);
return
Yohobuy
::
get
(
Yohobuy
::
API_URL
,
$param
);
...
...
static/js/product/detail/like.js
View file @
0e87f9d
...
...
@@ -7,7 +7,8 @@
var
$
=
require
(
'jquery'
),
Hammer
=
require
(
'yoho.hammer'
),
tip
=
require
(
'../../plugin/tip'
);
tip
=
require
(
'../../plugin/tip'
),
chosePanel
=
require
(
'../../shopping-cart/chose-panel'
);
var
likeEle
=
document
.
getElementById
(
'likeBtn'
),
likeHammer
=
likeEle
&&
new
Hammer
(
likeEle
);
...
...
@@ -70,14 +71,17 @@ if (likeHammer) {
if
(
addToCartHammer
)
{
addToCartHammer
.
on
(
'tap'
,
function
(
e
)
{
chosePanel
.
show
();
// 统计代码:用于统计用户加入购物车的动作
if
(
window
.
_yas
)
{
window
.
_yas
.
sendCustomInfo
({
pd
:
productId
,
by
:
1
},
false
);
}
// if (window._yas) {
// window._yas.sendCustomInfo({
// pd: productId,
// by: 1
// }, false);
// }
});
}
...
...
static/js/shopping-cart/chose-panel.js
View file @
0e87f9d
...
...
@@ -5,36 +5,45 @@
* @date: 2015/10/21
*/
var
$
=
require
(
'jquery'
),
Handlebars
=
require
(
'yoho.handlebars'
);
var
$
=
require
(
'jquery'
);
var
$page
=
$
(
'.yoho-page'
);
// Handlebars = require('yoho.handlebars');
// var $page = $('.yoho-page');
var
$num
;
var
tpl
;
//
var tpl;
//读取partials
$
.
ajax
({
type
:
'GET'
,
url
:
'/shoppingCart/tpl'
,
success
:
function
(
data
)
{
tpl
=
Handlebars
.
compile
(
data
);
}
});
// $.ajax({
// type: 'GET',
// url: '/shoppingCart/tpl',
// success: function(data) {
// tpl = Handlebars.compile(data);
// }
// });
//显示
function
show
(
data
)
{
var
html
=
tpl
(
data
);
$page
.
append
(
html
);
//显示
// function show(data) {
// // var html = tpl(data);
// $('.chose-panel').show();
// // $page.append(html);
// $('.chose-panel')
// $num = $('#good-num');
// }
function
show
()
{
$
(
'.chose-panel'
).
show
();
$
(
'body'
).
css
(
'overflow'
,
'hidden'
);
$num
=
$
(
'#good-num'
);
}
//移除当前Panel
function
remove
()
{
$
(
'.chose-panel'
).
remove
();
$
(
'.chose-panel'
).
hide
();
$
(
'body'
).
css
(
'overflow'
,
'auto'
);
}
$
(
'.yoho-page'
).
on
(
'touchstart'
,
'.chose-panel'
,
function
(
e
)
{
...
...
@@ -75,4 +84,5 @@ $('.yoho-page').on('touchstart', '.chose-panel', function(e) {
$num
.
val
(
num
+
1
);
});
exports
.
show
=
show
;
\ No newline at end of file
...
...
static/sass/shopping-cart/_chose-panel.scss
View file @
0e87f9d
.chose-panel
{
position
:
absolute
;
position
:
fixed
;
display
:
none
;
height
:
100%
;
top
:
0
;
bottom
:
0
;
left
:
0
;
right
:
0
;
background
:
rgba
(
0
,
0
,
0
,.
3
);
z-index
:
3
;
.main
{
position
:
absolute
;
height
:
610rem
/
$pxConvertRem
;
height
:
pxToRem
(
610px
)
;
bottom
:
0
;
left
:
0
;
right
:
0
;
...
...
@@ -18,7 +21,7 @@
.infos
{
height
:
460rem
/
$pxConvertRem
;
padding
:
0
22rem
/
$pxConvertRem
;
padding-top
:
30rem
/
$pxConvertRem
;
//
padding-top: 30rem / $pxConvertRem;
}
.chose-items
{
...
...
@@ -27,7 +30,10 @@
}
.basic-info
{
margin-bottom
:
30rem
/
$pxConvertRem
;
overflow
:
hidden
;
position
:
relative
;
margin-bottom
:
pxToRem
(
30px
);
margin-top
:
pxToRem
(
30px
);
}
.thumb
{
...
...
@@ -37,12 +43,18 @@
}
.text-info
{
margin-left
:
102rem
/
$pxConvertRem
;
position
:
absolute
;
height
:
auto
;
left
:
pxToRem
(
95px
);
top
:
50%
;
transform
:
translateY
(
-50%
);
.name
{
font-size
:
28rem
/
$pxConvertRem
;
}
.price
{
font-size
:
pxToRem
(
24px
);
}
.sale-price
{
color
:
#e10
;
...
...
template/m.yohobuy.com/actions/product/detail/index.phtml
View file @
0e87f9d
...
...
@@ -114,6 +114,7 @@
<div
id=
"productDesc"
>
</div>
{
{>
product/recommend-for-you
}
}
{
{>
shopping-cart/chose-panel
}
}
{
{#cartInfo
}
}
<div
class=
"cart-bar"
>
...
...
@@ -121,7 +122,8 @@
<a
href=
"{{cartUrl}}"
class=
"num-incart iconfont"
>
62
c;</a>
{
{#if
addToCartUrl
}
}
<a
id=
"addtoCart"
href=
"{{addToCartUrl}}"
class=
"addto-cart"
>加入购物车</a>
<!--
<a
id=
"addtoCart"
href=
"{{addToCartUrl}}"
class=
"addto-cart"
>加入购物车</a>
-->
<a
id=
"addtoCart"
href=
"javascript:;"
class=
"addto-cart"
>加入购物车</a>
{
{/if
}
}
{
{#if
soldOut
}
}
...
...
template/m.yohobuy.com/partials/shopping-cart/chose-panel.phtml
View file @
0e87f9d
{
{#cartInfo
}
}
<div
class=
"chose-panel"
>
<div
class=
"main"
>
<div
class=
"infos"
>
...
...
@@ -25,8 +26,8 @@
</ul>
</div>
<div
class=
"size-list"
>
<span>尺码</span>
<ul class="clearfix" data-type="size">
<span>尺码</span>
<ul
class=
"clearfix {{#if @first}}{{^}}hide{{/if}}"
data-type=
"size"
>
{
{#
sizes
}
}
<li
class=
"block {{#if chosed}}chosed{{/if}}"
data-id=
{
{id
}
}>
{
{name
}
}
...
...
@@ -49,7 +50,8 @@
</div>
</div>
<div
class=
"btn-wrap"
>
<button id="chose-btn-sure" class="btn btn-sure">
确定
</button>
<button
id=
"chose-btn-sure"
class=
"btn btn-sure"
>
加入购物车
</button>
</div>
</div>
</div>
\ No newline at end of file
</div>
{
{/cartInfo
}
}
\ No newline at end of file
...
...
yohobuy/m.yohobuy.com/application/models/Index/Cart.php
View file @
0e87f9d
...
...
@@ -306,7 +306,7 @@ class CartModel
// cookie保存的数据
if
(
!
empty
(
$cookieData
))
{
$orderInfo
=
json_decode
(
$cookieData
,
true
);
$orderCompute
=
self
::
orderCompute
(
$uid
,
$cartType
,
$orderInfo
[
'deliveryId'
],
$orderInfo
[
'paymentTypeId'
],
$orderInfo
[
'couponCode'
],
$orderInfo
[
'yohoCoin'
]);
//
$orderCompute = self::orderCompute($uid, $cartType, $orderInfo['deliveryId'], $orderInfo['paymentTypeId'], $orderInfo['couponCode'], $orderInfo['yohoCoin']);
}
// 根据地址id查询地址信息
...
...
@@ -326,32 +326,50 @@ class CartModel
// 配送方式
if
(
isset
(
$payReturn
[
'delivery_way'
]))
{
$idArr
=
array
();
$defaultKey
=
0
;
$oneDeliv
=
array
();
foreach
(
$payReturn
[
'delivery_way'
]
as
$val
)
{
foreach
(
$payReturn
[
'delivery_way'
]
as
$
key
=>
$
val
)
{
$oneDeliv
=
array
();
$oneDeliv
[
'id'
]
=
$val
[
'delivery_way_id'
];
$oneDeliv
[
'name'
]
=
$val
[
'delivery_way_name'
];
(
$val
[
'default'
]
===
'Y'
)
&&
$defaultKey
=
$key
;
isset
(
$orderInfo
[
'deliveryId'
])
&&
$orderInfo
[
'deliveryId'
]
===
$oneDeliv
[
'id'
]
&&
$oneDeliv
[
'isSelected'
]
=
true
;
$idArr
[
$key
]
=
$oneDeliv
[
'id'
]
;
!
isset
(
$oneDeliv
[
'isSelected'
])
&&
$oneDeliv
[
'isSelected'
]
=
(
$val
[
'default'
]
===
'Y'
);
$result
[
'dispatchMode'
][
$key
]
=
$oneDeliv
;
}
$result
[
'dispatchMode'
][]
=
$oneDeliv
;
if
(
isset
(
$orderInfo
[
'deliveryId'
]))
{
$flag
=
array_search
(
$orderInfo
[
'deliveryId'
],
$idArr
);
$flag
!==
false
&&
$result
[
'dispatchMode'
][
$flag
][
'isSelected'
]
=
true
;
}
else
{
$result
[
'dispatchMode'
][
$defaultKey
][
'isSelected'
]
=
true
;
}
}
// 配送时间
if
(
isset
(
$payReturn
[
'delivery_time'
]))
{
$idArr
=
array
();
$defaultKey
=
0
;
$oneDelivTime
=
array
();
foreach
(
$payReturn
[
'delivery_time'
]
as
$one
)
{
foreach
(
$payReturn
[
'delivery_time'
]
as
$
key
=>
$
one
)
{
$oneDelivTime
=
array
();
$oneDelivTime
[
'id'
]
=
$one
[
'delivery_time_id'
];
$oneDelivTime
[
'name'
]
=
$one
[
'delivery_time_string'
];
$oneDelivTime
[
'default'
]
=
(
$one
[
'default'
]
===
'Y'
);
isset
(
$orderInfo
[
'deliveryTimeId'
])
&&
$orderInfo
[
'deliveryTimeId'
]
===
$oneDelivTime
[
'id'
]
&&
$oneDeliv
[
'isSelected'
]
=
true
;
(
$one
[
'default'
]
===
'Y'
)
&&
$defaultKey
=
$key
;
$idArr
[
$key
]
=
$oneDelivTime
[
'id'
];
$result
[
'dispatchTime'
][]
=
$oneDelivTime
;
}
if
(
isset
(
$orderInfo
[
'deliveryTimeId'
]))
{
$flag
=
array_search
(
$orderInfo
[
'deliveryTimeId'
],
$idArr
);
$flag
!==
false
&&
$result
[
'dispatchTime'
][
$flag
][
'isSelected'
]
=
true
;
}
else
{
$result
[
'dispatchTime'
][
$defaultKey
][
'isSelected'
]
=
true
;
}
}
// 订单商品
...
...
yohobuy/m.yohobuy.com/application/modules/Passport/controllers/Bind.php
View file @
0e87f9d
...
...
@@ -2,6 +2,7 @@
use
Action\AbstractAction
;
use
LibModels\Wap\Passport\BindData
;
use
LibModels\Wap\Passport\RegData
;
use
Plugin\Helpers
;
/**
...
...
@@ -15,14 +16,28 @@ class BindController extends AbstractAction
*/
public
function
indexAction
()
{
$refer
=
$this
->
get
(
'refer'
);
if
(
!
empty
(
$refer
))
{
$this
->
setCookie
(
'refer'
,
$refer
);
}
$this
->
setTitle
(
'绑定手机号'
);
$openId
=
$this
->
get
(
'openId'
);
$sourceType
=
$this
->
get
(
'sourceType'
);
$nick
Name
=
$this
->
get
(
'nickN
ame'
);
$nick
name
=
$this
->
get
(
'nickn
ame'
);
$data
=
array
(
'bindIndex'
=>
true
,
//js标识
'backUrl'
=>
'/'
,
// 返回的URL链接
'showHeaderImg'
=>
true
,
// 控制显示头部图片
'isPassportPage'
=>
true
,
// 模板中模块标识
'sourceType'
=>
$sourceType
,
// 第三方登录来源
'platform'
=>
$sourceType
,
'openId'
=>
$openId
,
// openId
'nickname'
=>
$nickName
,
//昵称
'areaCode'
=>
'+86'
,
//默认区号
'countrys'
=>
RegData
::
getAreasData
(),
//国别码
'nickname'
=>
$nickname
,
//昵称
);
// 渲染模板
...
...
@@ -38,16 +53,22 @@ class BindController extends AbstractAction
$this
->
setTitle
(
'验证手机'
);
$openId
=
$this
->
get
(
'openId'
);
$sourceType
=
$this
->
get
(
'sourceType'
);
$nickName
=
$this
->
get
(
'nickName'
);
$area
=
$this
->
get
(
'areaCode'
,
'86'
);
$nickname
=
$this
->
get
(
'nickname'
);
$areaCode
=
$this
->
get
(
'areaCode'
,
'86'
);
$isReg
=
$this
->
get
(
'isReg'
);
$mobile
=
$this
->
get
(
'mobile'
);
$data
=
array
(
'bindIndex'
=>
true
,
//js标识
'backUrl'
=>
'/'
,
// 返回的URL链接
'showHeaderImg'
=>
true
,
// 控制显示头部图片
'isPassportPage'
=>
true
,
// 模板中模块标识
'sourceType'
=>
$sourceType
,
// 第三方登录来源
'openId'
=>
$openId
,
// openId
'nickname'
=>
$nick
N
ame
,
//昵称
'nickname'
=>
$nick
n
ame
,
//昵称
'isReg'
=>
$isReg
,
//是否是已注册过的手机号
'area'
=>
$area
//国别码
'areaCode'
=>
$areaCode
,
//国别码
'phoneNum'
=>
$mobile
,
//手机号码
);
// 渲染模板
...
...
@@ -63,13 +84,17 @@ class BindController extends AbstractAction
$this
->
setTitle
(
'重新设置登录密码'
);
$openId
=
$this
->
get
(
'openId'
);
$sourceType
=
$this
->
get
(
'sourceType'
);
$nickName
=
$this
->
get
(
'nickName'
);
$area
=
$this
->
get
(
'areaCode'
,
'86'
);
$nickname
=
$this
->
get
(
'nickname'
);
$areaCode
=
$this
->
get
(
'areaCode'
,
'86'
);
$data
=
array
(
'bindIndex'
=>
true
,
//js标识
'backUrl'
=>
'/'
,
// 返回的URL链接
'showHeaderImg'
=>
true
,
// 控制显示头部图片
'isPassportPage'
=>
true
,
// 模板中模块标识
'sourceType'
=>
$sourceType
,
// 第三方登录来源
'openId'
=>
$openId
,
// openId
'nickname'
=>
$nickName
,
//昵称
'area'
=>
$area
//国别码
'nickname'
=>
$nickname
,
//昵称
'areaCode'
=>
$areaCode
//国别码
);
// 渲染模板
...
...
@@ -91,12 +116,12 @@ class BindController extends AbstractAction
$mobile
=
$this
->
post
(
'mobile'
);
$openId
=
$this
->
post
(
'openId'
);
$area
=
$this
->
post
(
'areaCode'
,
'86'
);
$area
Code
=
$this
->
post
(
'areaCode'
,
'86'
);
$sourceType
=
$this
->
post
(
'sourceType'
);
$nick
Name
=
$this
->
post
(
'nickN
ame'
);
$nick
name
=
$this
->
post
(
'nickn
ame'
);
if
(
!
is_numeric
(
$mobile
)
||
!
$openId
||
!
$area
||
!
$sourceType
)
if
(
!
is_numeric
(
$mobile
)
||
!
$openId
||
!
$area
Code
||
!
$sourceType
)
{
break
;
}
...
...
@@ -108,7 +133,7 @@ class BindController extends AbstractAction
}
if
(
$res
[
'code'
]
==
200
)
{
$next
=
Helpers
::
url
(
'/passport/bind/code'
,
array
(
'isReg'
=>
$res
[
'data'
][
'is_register'
],
'openId'
=>
$openId
,
'sourceType'
=>
$sourceType
,
'nick
Name'
=>
$nickName
,
'areaCode'
=>
$area
,
'mobile'
=>
$mobile
));
$next
=
Helpers
::
url
(
'/passport/bind/code'
,
array
(
'isReg'
=>
$res
[
'data'
][
'is_register'
],
'openId'
=>
$openId
,
'sourceType'
=>
$sourceType
,
'nick
name'
=>
$nickname
,
'areaCode'
=>
$areaCode
,
'mobile'
=>
$mobile
));
$data
=
array
(
'code'
=>
$res
[
'code'
],
'message'
=>
$res
[
'message'
],
'data'
=>
array
(
'is_register'
=>
$res
[
'data'
][
'is_register'
],
'next'
=>
$next
));
}
else
...
...
@@ -135,13 +160,14 @@ class BindController extends AbstractAction
}
$mobile
=
$this
->
post
(
'mobile'
);
$areaCode
=
$this
->
post
(
'areaCode'
);
if
(
!
is_numeric
(
$mobile
))
{
break
;
}
$data
=
BindData
::
sendBindMsg
(
$mobile
);
$data
=
BindData
::
sendBindMsg
(
$
areaCode
,
$
mobile
);
if
(
!
isset
(
$data
[
'code'
]))
{
break
;
...
...
@@ -167,13 +193,14 @@ class BindController extends AbstractAction
$mobile
=
$this
->
post
(
'mobile'
);
$msgCode
=
$this
->
post
(
'msgCode'
);
$areaCode
=
$this
->
post
(
'areaCode'
);
if
(
!
is_numeric
(
$mobile
)
||
!
$msgCode
)
{
break
;
}
$data
=
BindData
::
checkBindCode
(
$mobile
,
$msgCode
);
$data
=
BindData
::
checkBindCode
(
$
areaCode
,
$
mobile
,
$msgCode
);
if
(
!
isset
(
$data
[
'code'
]))
{
break
;
...
...
@@ -199,17 +226,17 @@ class BindController extends AbstractAction
$mobile
=
$this
->
post
(
'mobile'
);
$openId
=
$this
->
post
(
'openId'
);
$area
=
$this
->
post
(
'areaCode'
,
'86'
);
$area
Code
=
$this
->
post
(
'areaCode'
,
'86'
);
$sourceType
=
$this
->
post
(
'sourceType'
);
$nick
Name
=
$this
->
post
(
'nickN
ame'
);
$nick
name
=
$this
->
post
(
'nickn
ame'
);
$password
=
$this
->
post
(
'password'
);
if
(
!
is_numeric
(
$mobile
)
||
!
$openId
||
!
$sourceType
||
!
$area
)
if
(
!
is_numeric
(
$mobile
)
||
!
$openId
||
!
$sourceType
||
!
$area
Code
)
{
break
;
}
$res
=
BindData
::
bindMobile
(
$openId
,
$nick
Name
,
$sourceType
,
$mobile
,
$area
,
$password
);
$res
=
BindData
::
bindMobile
(
$openId
,
$nick
name
,
$sourceType
,
$mobile
,
$areaCode
,
$password
);
if
(
!
isset
(
$res
[
'code'
]))
{
break
;
...
...
Please
register
or
login
to post a comment