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
5b533e160acc33d892bbc616098eef295f2c4a54
2 parents
837d1b4f
21f407a0
Merge branch 'develop' of
http://git.dev.yoho.cn/web/yohobuy
into fix/issue
Hide whitespace changes
Inline
Side-by-side
Showing
19 changed files
with
96 additions
and
63 deletions
library/Api/Yohobuy.php
library/LibModels/Wap/Home/HelpData.php
library/Plugin/Helpers.php
static/js/cart/cart.js
static/js/cart/chose-panel.js
static/js/cart/order-ensure.js
static/js/cart/select-coupon.js
static/sass/cart/_gift-advance-good.scss
static/sass/cart/_good.scss
static/sass/cart/_index.scss
static/sass/cart/_order-ensure.scss
static/sass/cart/_select-coupon.scss
template/m.yohobuy.com/actions/index/home/helpDetail.phtml → template/m.yohobuy.com/actions/index/home/help-detail.phtml
template/m.yohobuy.com/partials/cart/good.phtml
yohobuy/m.yohobuy.com/application/controllers/Home.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/Cart/controllers/Index.php
yohobuy/m.yohobuy.com/application/modules/Passport/controllers/Login.php
library/Api/Yohobuy.php
View file @
5b533e1
...
...
@@ -23,15 +23,17 @@ class Yohobuy
// const SERVICE_URL = 'http://service.api.yohobuy.com/';
// const YOHOBUY_URL = 'http://www.yohobuy.com/';
//
const API_URL = 'http://apih5.yoho.cn/';
//
const API_URL = 'http://apih5.yoho.cn/';
// const API_URL2 = 'http://apih5.yoho.cn/';
// const SERVICE_URL = 'http://serviceh5.yoho.cn/';
// const YOHOBUY_URL = 'http://www.yohobuy.com/';
// const API_OLD = 'http://api2.open.yohobuy.com/';
/* 测试环境 */
const
API_URL
=
'http://testapi.yoho.cn:28078/'
;
const
SERVICE_URL
=
'http://testservice.yoho.cn:28077/'
;
const
YOHOBUY_URL
=
'http://www.yohobuy.com/'
;
const
API_OLD
=
'http://test2.open.yohobuy.com/'
;
/**
...
...
library/LibModels/Wap/Home/HelpData.php
View file @
5b533e1
...
...
@@ -38,7 +38,7 @@ class HelpData
$param
[
'code'
]
=
$code
;
$param
[
'return_type'
]
=
'html'
;
$param
[
'client_secret'
]
=
Sign
::
getSign
(
$param
);
return
Yohobuy
::
post
(
Yohobuy
::
API_
URL
,
$param
,
true
);
return
Yohobuy
::
post
(
Yohobuy
::
API_
OLD
,
$param
,
true
);
}
...
...
library/Plugin/Helpers.php
View file @
5b533e1
...
...
@@ -129,7 +129,7 @@ class Helpers
*/
public
static
function
getShoppingKeyByCookie
()
{
$cookie
=
isset
(
$_COOKIE
[
'_S
pk'
])
?
$_COOKIE
[
'_Spk
'
]
:
''
;
$cookie
=
isset
(
$_COOKIE
[
'_S
PK'
])
?
$_COOKIE
[
'_SPK
'
]
:
''
;
return
$cookie
;
}
...
...
@@ -595,9 +595,13 @@ class Helpers
$oneGoods
[
'inValid'
]
=
true
;
}
elseif
(
$value
[
'goods_type'
]
==
'gift'
&&
!
isset
(
$value
[
'isAdvanceBuy'
]))
{
$oneGoods
[
'isGift'
]
=
true
;
$oneGoods
[
'salesPrice'
]
=
self
::
transPrice
(
$value
[
'sales_price'
]);
$oneGoods
[
'price'
]
=
self
::
transPrice
(
$value
[
'sale_price'
]);
}
elseif
(
$value
[
'goods_type'
]
==
'price_gift'
)
{
$oneGoods
[
'showCheckbox'
]
=
true
;
$oneGoods
[
'isAdvanceBuy'
]
=
true
;
$oneGoods
[
'salesPrice'
]
=
self
::
transPrice
(
$value
[
'sales_price'
]);
$oneGoods
[
'price'
]
=
self
::
transPrice
(
$value
[
'sale_price'
]);
}
else
{
$oneGoods
[
'showCheckbox'
]
=
true
;
}
...
...
@@ -634,6 +638,7 @@ class Helpers
$gift
[
'promotionTitle'
]
=
$value
[
'promotion_title'
];
foreach
(
$value
[
'goods_list'
]
as
$single
)
{
$oneGoods
=
array
();
$oneGoods
[
'id'
]
=
$single
[
'product_skn'
];
$oneGoods
[
'name'
]
=
$single
[
'product_name'
];
$oneGoods
[
'thumb'
]
=
!
empty
(
$single
[
'goods_images'
])
?
Images
::
getImageUrl
(
$single
[
'goods_images'
],
120
,
160
)
:
''
;
...
...
static/js/cart/cart.js
View file @
5b533e1
...
...
@@ -15,6 +15,8 @@ var chosePanel = require('./chose-panel'),
var
$cartContent
=
$
(
'.cart-content'
);
var
navHammer
,
advanceBuyHammer
,
freebieHammer
,
cartType
=
$
(
'#cartType'
).
val
();
var
hasChecked
=
$
(
'.cart-content:not(.hide) .icon-cb-checked'
).
length
>
0
?
true
:
false
;
//是否有选中商品
...
...
@@ -90,6 +92,8 @@ if ($('.cart-nav').length > 0) {
//切换普通商品和预售商品购物车显示
$cartContent
.
toggleClass
(
'hide'
);
hasChecked
=
$
(
'.cart-content:not(.hide) .icon-cb-checked'
).
length
>
0
?
true
:
false
;
//trigger lazyload
$
(
window
).
trigger
(
'scroll'
);
});
...
...
@@ -99,13 +103,27 @@ if ($('.cart-nav').length > 0) {
},
3000
);
}
$
(
'.advance-buy'
).
on
(
'touchend'
,
function
()
{
window
.
location
.
href
=
'/cart/index/advanceBuy?cartType='
+
cartType
;
});
if
(
$
(
'.advance-buy'
).
length
>
0
)
{
advanceBuyHammer
=
new
Hammer
(
document
.
getElementsByClassName
(
'advance-buy'
)[
0
]);
advanceBuyHammer
.
on
(
'tap'
,
function
(
e
)
{
window
.
location
.
href
=
'/cart/index/advanceBuy?cartType='
+
cartType
;
});
}
$
(
'.freebie'
).
on
(
'touchend'
,
function
()
{
window
.
location
.
href
=
'/cart/index/gift?cartType='
+
cartType
;
});
if
(
$
(
'.freebie'
).
length
>
0
)
{
freebieHammer
=
new
Hammer
(
document
.
getElementsByClassName
(
'freebie'
)[
0
]);
freebieHammer
.
on
(
'tap'
,
function
(
e
)
{
window
.
location
.
href
=
'/cart/index/gift?cartType='
+
cartType
;
});
}
//$('.advance-buy').on('touchend', function() {
// window.location.href = '/cart/index/advanceBuy?cartType=' + cartType;
//});
//
//$('.freebie').on('touchend', function() {
// window.location.href = '/cart/index/gift?cartType=' + cartType;
//});
$
(
'.btn-balance'
).
on
(
'touchend'
,
function
()
{
if
(
shouldSelectGift
())
{
...
...
@@ -125,8 +143,6 @@ $('.btn-balance').on('touchend', function() {
});
$
(
'.chose'
).
on
(
'touchend'
,
function
()
{
//var id = $(this).closest('.gift-advance-good').data('id');
chosePanel
.
show
();
});
...
...
static/js/cart/chose-panel.js
View file @
5b533e1
...
...
@@ -70,7 +70,6 @@ function show(html, cb) {
init
();
}
$
(
'.chose-panel'
).
show
();
$
(
'body'
).
css
(
'overflow'
,
'hidden'
);
$num
=
$
(
'#good-num'
);
cbFn
=
cb
;
}
...
...
@@ -78,7 +77,6 @@ function show(html, cb) {
//隐藏当前Panel
function
hide
()
{
$
(
'.chose-panel'
).
hide
();
$
(
'body'
).
css
(
'overflow'
,
'auto'
);
}
//修改加入购物车的文字和背景
...
...
@@ -208,11 +206,11 @@ $yohoPage.on('touchstart', '.color-list .block', function() {
curColorIndex
=
index
;
$
(
'#good-num'
).
val
(
1
);
// 设置按钮的样式和文字
updateConformButtonClassAndText
();
// 修改颜色时修改商品图片
changeGoodImgWhenClickColor
();
// 设置按钮的样式和文字
updateConformButtonClassAndText
();
}).
on
(
'touchstart'
,
'.size-list .block'
,
function
()
{
var
$this
=
$
(
this
),
index
,
...
...
@@ -232,11 +230,12 @@ $yohoPage.on('touchstart', '.color-list .block', function() {
$allChoseItems
.
find
(
'.num .left-num'
).
html
(
''
);
$
(
'#left-num'
).
val
(
0
);
hasChooseSize
=
false
;
curSizeIndex
=
null
;
$curSizeBlock
=
null
;
// 当前尺码不是选中状态,选中时
}
else
{
hasChooseSize
=
true
;
curGoodNum
=
$this
.
data
(
'num'
);
// 之前选中的尺码去掉勾选样式
...
...
@@ -253,18 +252,21 @@ $yohoPage.on('touchstart', '.color-list .block', function() {
$
(
'#left-num'
).
val
(
0
);
}
if
(
curGoodNum
===
0
&&
hasChooseColor
)
{
$this
.
addClass
(
'zero-stock'
);
}
curSizeIndex
=
index
;
$curSizeBlock
=
$this
;
}
$this
.
toggleClass
(
'chosed'
);
curSizeIndex
=
index
;
$curSizeBlock
=
$this
;
$
(
'#good-num'
).
val
(
1
);
// 设置按钮的样式和文字
updateConformButtonClassAndText
();
// 重置颜色块的样式
resetColorZeroStock
(
$siblingBlock
);
// 设置按钮的样式和文字
updateConformButtonClassAndText
();
});
$yohoPage
.
on
(
'touchstart'
,
'.btn-minus'
,
function
()
{
...
...
@@ -281,7 +283,7 @@ $yohoPage.on('touchstart', '.btn-minus', function() {
return
;
}
if
(
num
<
0
)
{
tip
.
show
(
'您选择的数量不能为
零
~'
);
tip
.
show
(
'您选择的数量不能为
负数
~'
);
return
;
}
...
...
@@ -295,7 +297,6 @@ $yohoPage.on('touchstart', '.btn-minus', function() {
return
;
}
if
(
num
-
0
===
leftNum
||
0
===
leftNum
)
{
return
;
}
...
...
static/js/cart/order-ensure.js
View file @
5b533e1
...
...
@@ -23,7 +23,8 @@ var dispatchModeHammer,
payType
,
priceTmpl
=
Handlebars
.
compile
(
$
(
'#tmpl-price'
).
html
()),
queryString
=
$
.
queryString
(),
orderInfo
=
order
.
orderInfo
;
orderInfo
=
order
.
orderInfo
,
isSubmiting
;
lazyLoad
();
...
...
@@ -127,6 +128,9 @@ function submitOrder() {
var
invoiceText
=
$invoice
.
find
(
'[name="invoice-title"]'
).
val
()
||
orderInfo
(
'invoiceText'
),
msg
=
$
(
'#msg'
).
find
(
'input'
).
val
()
||
orderInfo
(
'msg'
);
if
(
isSubmiting
)
{
return
false
;
}
if
(
orderInfo
(
'invoice'
))
{
if
(
!
invoiceText
)
{
tip
.
show
(
'请输入发票抬头'
);
...
...
@@ -144,6 +148,7 @@ function submitOrder() {
}
}
loading
.
showLoadingMask
();
isSubmiting
=
true
;
$
.
ajax
({
method
:
'POST'
,
url
:
'/cart/index/orderSub'
,
...
...
@@ -184,6 +189,7 @@ function submitOrder() {
}).
fail
(
function
()
{
tip
.
show
(
'网络出错'
);
}).
always
(
function
()
{
isSubmiting
=
false
;
loading
.
hideLoadingMask
();
});
}
...
...
@@ -250,3 +256,7 @@ $('.pay-mode').on('click', 'li', function() {
payType
=
$this
.
data
(
'pay-type'
);
submitOrder
();
});
$
(
'form'
).
on
(
'submit'
,
function
()
{
return
false
;
});
...
...
static/js/cart/select-coupon.js
View file @
5b533e1
...
...
@@ -191,8 +191,8 @@ function getCouponDate() {
getCouponDate
();
$
(
window
).
scroll
(
function
()
{
if
(
$
(
window
).
scrollTop
()
+
$
(
window
).
height
()
>
$
(
'body'
).
height
()
*
0.9
)
{
getCouponDate
();
}
});
// $(window).scroll(function() {
// if ($(window).scrollTop() + $(window).height() > $('body').height() * 0.9) {
// getCouponDate();
// }
// });
...
...
static/sass/cart/_gift-advance-good.scss
View file @
5b533e1
...
...
@@ -5,15 +5,6 @@
margin-left
:
34rem
/
$pxConvertRem
;
height
:
160rem
/
$pxConvertRem
;
border-bottom
:
1px
solid
#e0e0e0
;
&
:last-child
{
border-bottom
:
none
;
}
}
.advance-block
.gift-advance-good
:last-child
{
border-bottom
:
none
;
}
.advance-block
:last-child
.gift-advance-good
:last-child
{
...
...
static/sass/cart/_good.scss
View file @
5b533e1
...
...
@@ -111,6 +111,11 @@
.price
{
font-size
:
0
.6rem
;
color
:
$cartRed
;
display
:
inline
;
.sale-price
{
color
:
#b0b0b0
;
text-decoration
:
line-through
;
}
}
.count
{
...
...
static/sass/cart/_index.scss
View file @
5b533e1
...
...
@@ -140,10 +140,11 @@
>
li
{
box-sizing
:
border-box
;
height
:
90rem
/
$pxConvertRem
;
line-height
:
90rem
/
$pxConvertRem
;
height
:
80rem
/
$pxConvertRem
;
line-height
:
80rem
/
$pxConvertRem
;
margin-bottom
:
10rem
/
$pxConvertRem
;
padding
:
0
20rem
/
$pxConvertRem
;
background
:
#f1f1f1
;
&
:last-child
{
margin-bottom
:
0
;
...
...
static/sass/cart/_order-ensure.scss
View file @
5b533e1
...
...
@@ -185,7 +185,7 @@
height
:
pxToRem
(
60px
);
color
:
#444
;
background
:
#efefef
;
font-size
:
pxToRem
(
16
px
);
font-size
:
pxToRem
(
24
px
);
line-height
:
1
;
outline
:
0
;
border
:
0
;
...
...
static/sass/cart/_select-coupon.scss
View file @
5b533e1
...
...
@@ -49,7 +49,7 @@
.not-use
{
display
:
block
;
width
:
pxToRem
(
560px
);
margin
:
pxToRem
(
30px
)
auto
;
margin
:
pxToRem
(
30px
)
auto
0
;
text-align
:
center
;
font-size
:
pxToRem
(
32px
);
line-height
:
2
.5
;
...
...
@@ -61,7 +61,7 @@
position
:
relative
;
margin-top
:
pxToRem
(
30px
);
margin-bottom
:
pxToRem
(
30px
);
font-size
:
pxToRem
(
14
px
);
font-size
:
pxToRem
(
28
px
);
line-height
:
2
;
color
:
#b0b0b0
;
text-align
:
center
;
...
...
template/m.yohobuy.com/actions/index/home/help
D
etail.phtml → template/m.yohobuy.com/actions/index/home/help
-d
etail.phtml
View file @
5b533e1
template/m.yohobuy.com/partials/cart/good.phtml
View file @
5b533e1
...
...
@@ -41,10 +41,12 @@
</p>
</div>
<p class="row">
<span class="price">
¥{{price}}
</span>
<p class="price">
<span class="market-price">¥{{price}}</span>
{{#if isAdvanceBuy}}
<span class="sale-price">¥{{salesPrice}}</span>
{{/if}}
</p>
{{#if isVipPrice}}
<span class="vip">
VIP
...
...
yohobuy/m.yohobuy.com/application/controllers/Home.php
View file @
5b533e1
...
...
@@ -640,16 +640,13 @@ class HomeController extends AbstractAction
* 我的订单页面,获得nav导航条焦点。并且异步请求订单详情列表页(getOrders)
*
*/
public
function
ordersAction
()
{
// 审判跳转登录页
$this
->
auditJumpLogin
();
$backUrl
=
Helpers
::
url
(
'/home'
);
$this
->
setTitle
(
'我的订单'
);
$this
->
setNavHeader
(
'我的订单'
,
$backUrl
);
$this
->
setNavHeader
(
'我的订单'
,
Helpers
::
url
(
'/home'
)
);
$order
=
array
();
//获得type值,type:1=>全部,2=>待付款,3=>待发货,4=>待收货,5=>待评论
...
...
@@ -887,7 +884,7 @@ class HomeController extends AbstractAction
$this
->
setTitle
(
$caption
);
$this
->
setNavHeader
(
$caption
);
$this
->
_view
->
display
(
'help
D
etail'
,
array
(
$this
->
_view
->
display
(
'help
-d
etail'
,
array
(
'iHelp'
=>
Home\HelpModel
::
serviceDetail
(
$code
),
));
}
...
...
yohobuy/m.yohobuy.com/application/models/Index/Cart.php
View file @
5b533e1
...
...
@@ -555,8 +555,8 @@ class CartModel
$notAvailableRes
=
self
::
searchCoupon
(
$uid
,
$val
[
'couponCode'
]);
// 处理可用的优惠券
if
(
$val
[
'isValidity'
]
===
'N'
||
(
isset
(
$notAvailableRes
[
'code'
])
&&
$notAvailableRes
[
'code'
]
!==
200
))
{
// $val['notAvailable'] = true;
continue
;
$val
[
'notAvailable'
]
=
true
;
// continue;
}
$result
[]
=
$val
;
}
...
...
yohobuy/m.yohobuy.com/application/models/Index/Home.php
View file @
5b533e1
...
...
@@ -71,7 +71,7 @@ class HomeModel
/**
* 设置选择的频道保存到浏览器COOKIE
* (已废弃,改成
JS
设置)
* (已废弃,改成
JS
设置)
*
* @param string $cookie
* @return void
...
...
yohobuy/m.yohobuy.com/application/modules/Cart/controllers/Index.php
View file @
5b533e1
...
...
@@ -289,7 +289,6 @@ class IndexController extends AbstractAction
$this
->
go
(
Helpers
::
url
(
'/cart/index/index'
));
}
$cookieData
=
$this
->
getCookie
(
'order-info'
,
null
);
$uid
=
$this
->
getUid
(
true
);
$data
=
array
(
...
...
@@ -457,8 +456,8 @@ class IndexController extends AbstractAction
$result
=
CartModel
::
addToCart
(
$productSku
,
$buyNumber
,
$goodsType
,
$isEdit
,
$promotionId
,
$uid
,
$shoppingKey
);
// 设置加入购物车凭证到客户端浏览器
if
(
!
$shoppingKey
&&
isset
(
$result
[
'data'
][
'shopping_key'
]))
{
$this
->
setCookie
(
'_Spk'
,
$result
[
'data'
][
'shopping_key'
]);
if
(
empty
(
$shoppingKey
)
&&
isset
(
$result
[
'data'
][
'shopping_key'
]))
{
$this
->
setCookie
(
'_SPK'
,
$result
[
'data'
][
'shopping_key'
],
time
()
+
86400
*
360
);
}
}
...
...
yohobuy/m.yohobuy.com/application/modules/Passport/controllers/Login.php
View file @
5b533e1
...
...
@@ -17,6 +17,10 @@ class LoginController extends AbstractAction
*/
public
function
indexAction
()
{
// 清除客户端
$this
->
setCookie
(
'_UID'
,
''
);
$this
->
setCookie
(
'_TOKEN'
,
''
);
$refer
=
$this
->
get
(
'refer'
);
if
(
!
empty
(
$refer
))
{
$this
->
setCookie
(
'refer'
,
$refer
);
...
...
@@ -61,7 +65,6 @@ class LoginController extends AbstractAction
$data
[
'isPassportPage'
]
=
true
;
// 模板中模块标识
$data
[
'areaCode'
]
=
'+86'
;
// 默认区号
$data
[
'countrys'
]
=
RegData
::
getAreasData
();
// 地区信息列表
// 渲染模板
$this
->
_view
->
display
(
'international'
,
$data
);
}
...
...
@@ -74,6 +77,7 @@ class LoginController extends AbstractAction
// 清除客户端
$this
->
setCookie
(
'_UID'
,
''
);
$this
->
setCookie
(
'_TOKEN'
,
''
);
$this
->
setCookie
(
'_SPK'
,
''
);
// 清除服务端会话
$this
->
setSession
(
'_TOKEN'
,
''
);
...
...
@@ -148,7 +152,7 @@ class LoginController extends AbstractAction
public
function
alipayAction
()
{
$this
->
setSession
(
'_TOKEN'
,
''
);
Factory
::
create
(
'alipay'
)
->
getAuthorizeUrl
();
exit
();
...
...
@@ -160,7 +164,7 @@ class LoginController extends AbstractAction
public
function
qqAction
()
{
$this
->
setSession
(
'_TOKEN'
,
''
);
Factory
::
create
(
'qqconnect'
)
->
getAuthorizeUrl
();
exit
();
...
...
@@ -172,7 +176,7 @@ class LoginController extends AbstractAction
public
function
sinaAction
()
{
$this
->
setSession
(
'_TOKEN'
,
''
);
$this
->
go
(
Factory
::
create
(
'sinaweibo'
)
->
getAuthorizeUrl
());
}
...
...
Please
register
or
login
to post a comment