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
Plain Diff
Browse Files
Authored by
xiaowei
9 years ago
Commit
4ff4c3ebfa47bd6ca541914e300ba8aa5d8115e7
2 parents
f890891e
d94ce54f
Merge branch 'develop' of
http://git.dev.yoho.cn/web/yohobuy
into develop
Hide whitespace changes
Inline
Side-by-side
Showing
12 changed files
with
411 additions
and
301 deletions
framework
library/LibModels/Wap/Home/HelpData.php
static/js/me/dialog.js
static/js/me/order-detail.js
static/js/shopping-cart/order-ensure.js
static/js/shopping-cart/select-coupon.js
static/sass/shopping-cart/_order-ensure.scss
template/m.yohobuy.com/actions/index/shoppingCart/order-ensure.phtml
yohobuy/m.yohobuy.com/application/controllers/Home.php
yohobuy/m.yohobuy.com/application/controllers/ShoppingCart.php
yohobuy/m.yohobuy.com/application/models/Home/Help.php
yohobuy/m.yohobuy.com/application/models/Product/Detail.php
framework
@
75bbc3b0
Subproject commit
e9d066dd88a8e7e37103021c427a205a5cfcdcec
Subproject commit
75bbc3b075de19f239532f60c5995d06c5f814e2
...
...
library/LibModels/Wap/Home/HelpData.php
View file @
4ff4c3e
...
...
@@ -22,7 +22,7 @@ class HelpData
$param
[
'method'
]
=
'app.help.li'
;
$param
[
'client_secret'
]
=
Sign
::
getSign
(
$param
);
return
Yohobuy
::
post
(
Yohobuy
::
API_URL
,
$param
,
$param
);
return
Yohobuy
::
post
(
Yohobuy
::
API_URL
,
$param
);
}
...
...
static/js/me/dialog.js
View file @
4ff4c3e
...
...
@@ -82,4 +82,3 @@ exports.showDialog = function(data, callback) {
}
});
};
...
...
static/js/me/order-detail.js
View file @
4ff4c3e
...
...
@@ -6,7 +6,9 @@
var
$
=
require
(
'jquery'
),
lazyLoad
=
require
(
'yoho.lazyload'
),
Hammer
=
require
(
'yoho.hammer'
);
Hammer
=
require
(
'yoho.hammer'
),
dialog
=
require
(
'./dialog'
),
tip
=
require
(
'../plugin/tip'
);
var
orderId
=
$
(
'#order-detail'
).
data
(
'id'
);
...
...
@@ -24,26 +26,64 @@ optHammer.on('tap', function(e) {
if
(
$cur
.
hasClass
(
'btn-del'
))
{
//删除订单
if
(
confirm
(
'确定删除订单吗?'
))
{
dialog
.
showDialog
({
dialogText
:
'确定删除订单吗?'
,
hasFooter
:
{
leftBtnText
:
'取消'
,
rightBtnText
:
'确定'
}
},
function
()
{
$
.
ajax
({
type
:
'GET'
,
url
:
'/home/delOrder'
,
data
:
{
id
:
orderId
}
}).
then
(
function
(
res
)
{
$
(
'#dialog-wrapper'
).
hide
();
if
(
!
res
)
{
tip
.
show
(
'网络错误'
);
}
if
(
res
.
code
===
200
)
{
tip
.
show
(
'删除成功'
);
}
else
{
tip
.
show
(
res
.
message
||
'网络错误'
);
}
window
.
location
.
href
=
'/home/orders'
;
}).
fail
(
function
()
{
tip
.
show
(
'网络错误'
);
});
}
}
);
}
else
if
(
$cur
.
hasClass
(
'btn-cancel'
))
{
//取消订单
if
(
confirm
(
'确定取消订单吗?'
))
{
dialog
.
showDialog
({
dialogText
:
'确定取消订单吗?'
,
hasFooter
:
{
leftBtnText
:
'取消'
,
rightBtnText
:
'确定'
}
},
function
()
{
$
.
ajax
({
type
:
'GET'
,
url
:
'/home/cancelOrder'
,
data
:
{
id
:
orderId
}
}).
then
(
function
(
res
)
{
$
(
'#dialog-wrapper'
).
hide
();
if
(
!
res
)
{
tip
.
show
(
'网络错误'
);
}
if
(
res
.
code
===
200
)
{
tip
.
show
(
'取消成功'
);
}
else
{
tip
.
show
(
res
.
message
||
'网络错误'
);
}
window
.
location
.
reload
();
}).
fail
(
function
()
{
tip
.
show
(
'网络错误'
);
});
}
}
);
}
});
\ No newline at end of file
});
...
...
static/js/shopping-cart/order-ensure.js
View file @
4ff4c3e
...
...
@@ -100,8 +100,8 @@ function submitOrder() {
data
:
{
addressId
:
orderInfo
(
'addressId'
),
cartType
:
orderInfo
(
'cartType'
),
deliveryId
:
orderInfo
(
'deliveryId'
)
||
1
,
deliveryTimeId
:
orderInfo
(
'deliveryTimeId'
)
||
2
,
deliveryId
:
orderInfo
(
'deliveryId'
),
deliveryTimeId
:
orderInfo
(
'deliveryTimeId'
),
invoiceText
:
$invoice
.
find
(
'[name="invoice-title"]'
).
val
()
||
orderInfo
(
'invoiceText'
),
invoiceType
:
$invoice
.
find
(
'.invoice-type'
).
val
()
||
orderInfo
(
'invoiceType'
),
msg
:
$
(
'#msg'
).
find
(
'input'
).
val
()
||
orderInfo
(
'msg'
),
...
...
static/js/shopping-cart/select-coupon.js
View file @
4ff4c3e
...
...
@@ -30,6 +30,7 @@ $newCoupon.on('submit', function() {
if
(
res
.
code
===
200
)
{
tip
.
show
(
'优惠券可用'
);
orderInfo
(
'couponCode'
,
res
.
data
.
coupon_code
);
orderInfo
(
'couponValue'
,
res
.
data
.
coupon_value
);
window
.
location
.
href
=
'/shoppingCart/orderEnsure?coupon_code='
+
res
.
data
.
coupon_code
;
}
else
{
tip
.
show
(
res
.
message
);
...
...
static/sass/shopping-cart/_order-ensure.scss
View file @
4ff4c3e
...
...
@@ -93,7 +93,7 @@
}
.coupon-count
{
padding
:
5rem
/
$pxConvertRem
;
padding
:
5rem
/
$pxConvertRem
15rem
/
$pxConvertRem
;
background
:
#f00
;
color
:
#fff
;
@include
border-radius
(
10px
);
...
...
@@ -104,6 +104,14 @@
.coin-check
{
float
:
right
;
color
:
#999
;
&
.used
{
color
:
#f00
;
}
.iconfont
{
color
:
#999
;
}
}
.coin-check
{
...
...
@@ -115,6 +123,10 @@
color
:
#000
;
}
em
{
color
:
#f00
;
}
}
.checkbox.icon-checkbox
{
...
...
@@ -187,6 +199,10 @@
}
}
.price-cal
{
font-family
:
monospace
;
}
.cost
{
border-top
:
1px
solid
#f7f7f7
;
line-height
:
100rem
/
$pxConvertRem
;
...
...
template/m.yohobuy.com/actions/index/shoppingCart/order-ensure.phtml
View file @
4ff4c3e
...
...
@@ -44,7 +44,6 @@
{
{#
coupon
}
}
<li
class=
"coupon"
>
<a
href=
"/shoppingCart/selectCoupon"
>
<!--
<a
href=
"{{url}}"
>
-->
<span
class=
"title"
>优惠券</span>
{
{#if
count
}
}
<span
class=
"coupon-count"
>
...
...
@@ -122,7 +121,7 @@
{
{/couponPrice
}
}
<li>
<span>YOHO币</span>
-
{
{yohoCoin
}
}
-
¥
{
{yohoCoin
}
}
</li>
<li
class=
"cost"
>
应付金额:
<em>¥
{
{price
}
}</em>
...
...
yohobuy/m.yohobuy.com/application/controllers/Home.php
View file @
4ff4c3e
...
...
@@ -845,7 +845,7 @@ class HomeController extends AbstractAction
$this
->
_view
->
display
(
'order-detail'
,
array
(
'orderDetailPage'
=>
true
,
'orderDetail'
=>
OrderModel
::
orderDetail
(
$orderCode
,
$this
->
_uid
,
$this
->
_session
),
'orderDetail'
=>
OrderModel
::
orderDetail
(
$orderCode
,
$this
->
_uid
,
$this
->
_
u
session
),
));
}
...
...
@@ -867,7 +867,8 @@ class HomeController extends AbstractAction
/**
* 帮助中心列表详细信息
*/
public
function
helpDetailAction
()
{
public
function
helpDetailAction
()
{
$caption
=
$this
->
get
(
'caption'
,
'帮助中心'
);
$code
=
$this
->
get
(
'code'
,
0
);
if
(
empty
(
$code
))
{
...
...
@@ -877,9 +878,8 @@ class HomeController extends AbstractAction
$this
->
setTitle
(
$caption
);
$this
->
setNavHeader
(
$caption
);
$service
=
Home\HelpModel
::
serviceDetail
(
$code
);
$this
->
_view
->
display
(
'helpDetail'
,
array
(
'iHelp'
=>
$service
,
'iHelp'
=>
Home\HelpModel
::
serviceDetail
(
$code
)
,
));
}
...
...
yohobuy/m.yohobuy.com/application/controllers/ShoppingCart.php
View file @
4ff4c3e
...
...
@@ -13,6 +13,7 @@ class ShoppingCartController extends AbstractAction
/*
* 购物车首页
*/
public
function
indexAction
()
{
$this
->
setTitle
(
'购物车'
);
...
...
@@ -29,239 +30,243 @@ class ShoppingCartController extends AbstractAction
// 渲染模板
$this
->
_view
->
display
(
'index'
,
$data
);
}
/*
* 异步获取购物车数据
*/
public
function
getCartDataAction
()
{
$result
=
array
();
$result
=
array
();
if
(
$this
->
isAjax
())
{
$shoppingKey
=
Helpers
::
getShoppingKeyByCookie
();
$uid
=
$this
->
getUid
(
true
);
$result
=
CartModel
::
getCartData
(
$uid
,
$shoppingKey
);
}
if
(
empty
(
$result
))
{
echo
' '
;
}
else
{
$this
->
echoJson
(
$result
);
}
}
/**
* 购物车商品选择与取消
*/
public
function
selectAction
()
{
$result
=
array
();
if
(
$this
->
isAjax
())
{
$productId
=
$this
->
post
(
'id'
,
0
);
$uid
=
$this
->
getUid
(
true
);
$shoppingKey
=
$this
->
getSession
(
'shoppingKey'
);
$result
=
CartModel
::
selectGoods
(
$uid
,
$productId
,
$shoppingKey
);
}
if
(
empty
(
$result
))
{
echo
' '
;
}
else
{
$this
->
echoJson
(
$result
);
}
}
/**
* 移出购物车
*/
public
function
delAction
()
{
$result
=
array
();
if
(
$this
->
isAjax
())
{
$productId
=
$this
->
post
(
'id'
,
0
);
$uid
=
$this
->
getUid
(
true
);
$shoppingKey
=
$this
->
getSession
(
'shoppingKey'
);
$result
=
CartModel
::
removeFromCart
(
$uid
,
$productId
,
$shoppingKey
);
}
if
(
empty
(
$result
))
{
echo
' '
;
}
else
{
$this
->
echoJson
(
$result
);
}
}
/**
* 移入收藏夹
*/
public
function
colAction
()
{
$result
=
array
();
if
(
$this
->
isAjax
())
{
$productId
=
$this
->
post
(
'id'
,
0
);
$uid
=
$this
->
getUid
(
true
);
$result
=
CartModel
::
addToFav
(
$uid
,
$productId
);
}
if
(
empty
(
$result
))
{
echo
' '
;
}
else
{
$this
->
echoJson
(
$result
);
}
}
/*
* 获取购物车商品数据
*/
public
function
goodinfoAction
()
{
$result
=
array
();
if
(
$this
->
isAjax
())
{
$num
=
$this
->
get
(
'buy_num'
,
1
);
$skn
=
$this
->
get
(
'id'
,
1
);
$uid
=
$this
->
getUid
(
true
);
$result
=
CartModel
::
cartProductData
(
$uid
,
$skn
,
$num
);
// 测试skn的ID为51172055
$result
[
'num'
]
=
$num
;
}
if
(
empty
(
$result
))
{
echo
' '
;
}
else
{
$this
->
echoJson
(
$result
);
}
}
if
(
$this
->
isAjax
())
{
$shoppingKey
=
Helpers
::
getShoppingKeyByCookie
();
$uid
=
$this
->
getUid
(
true
);
/*
* 获取购物车加价购商品数据
*/
$result
=
CartModel
::
getCartData
(
$uid
,
$shoppingKey
);
}
public
function
giftinfoAction
()
{
$result
=
array
();
if
(
$this
->
isAjax
())
{
$skn
=
$this
->
get
(
'skn'
,
null
);
$promotionId
=
$this
->
get
(
'promotionId'
,
null
);
$result
=
CartModel
::
giftProductData
(
$skn
,
$promotionId
);
}
if
(
empty
(
$result
))
{
echo
' '
;
}
else
{
$this
->
echoJson
(
$result
);
}
}
if
(
empty
(
$result
))
{
echo
' '
;
}
else
{
$this
->
echoJson
(
$result
);
}
/**
* 修改购物车商品数据
*/
public
function
modifyAction
()
{
$result
=
array
();
if
(
$this
->
isAjax
())
{
$shoppingKey
=
$this
->
getSession
(
'shoppingKey'
);
$uid
=
$this
->
getUid
(
true
);
$params
=
array
();
$params
[
'old_product_sku'
]
=
$this
->
post
(
'old_product_sku'
,
0
);
$params
[
'new_product_sku'
]
=
$this
->
post
(
'new_product_sku'
,
0
);
$params
[
'buy_number'
]
=
$this
->
post
(
'buy_number'
,
0
);
$params
[
'selected'
]
=
$this
->
post
(
'selected'
,
null
);
$result
=
CartModel
::
modifyCartProduct
(
$uid
,
$params
,
$shoppingKey
);
}
if
(
empty
(
$result
))
{
echo
' '
;
}
else
{
$this
->
echoJson
(
$result
);
}
}
/**
* 购物车商品选择与取消
*/
public
function
selectAction
()
{
$result
=
array
();
if
(
$this
->
isAjax
())
{
$productId
=
$this
->
post
(
'id'
,
0
);
$uid
=
$this
->
getUid
(
true
);
$shoppingKey
=
$this
->
getSession
(
'shoppingKey'
);
$result
=
CartModel
::
selectGoods
(
$uid
,
$productId
,
$shoppingKey
);
}
if
(
empty
(
$result
))
{
echo
' '
;
}
else
{
$this
->
echoJson
(
$result
);
}
}
/**
* 移出购物车
*/
public
function
delAction
()
{
$result
=
array
();
if
(
$this
->
isAjax
())
{
$productId
=
$this
->
post
(
'id'
,
0
);
$uid
=
$this
->
getUid
(
true
);
$shoppingKey
=
$this
->
getSession
(
'shoppingKey'
);
$result
=
CartModel
::
removeFromCart
(
$uid
,
$productId
,
$shoppingKey
);
}
if
(
empty
(
$result
))
{
echo
' '
;
}
else
{
$this
->
echoJson
(
$result
);
}
}
/**
* 移入收藏夹
*/
public
function
colAction
()
{
$result
=
array
();
if
(
$this
->
isAjax
())
{
$productId
=
$this
->
post
(
'id'
,
0
);
$uid
=
$this
->
getUid
(
true
);
$result
=
CartModel
::
addToFav
(
$uid
,
$productId
);
}
if
(
empty
(
$result
))
{
echo
' '
;
}
else
{
$this
->
echoJson
(
$result
);
}
}
/*
* 获取购物车商品数据
*/
public
function
goodinfoAction
()
{
$result
=
array
();
if
(
$this
->
isAjax
())
{
$num
=
$this
->
get
(
'buy_num'
,
1
);
$skn
=
$this
->
get
(
'id'
,
1
);
$uid
=
$this
->
getUid
(
true
);
$result
=
CartModel
::
cartProductData
(
$uid
,
$skn
,
$num
);
// 测试skn的ID为51172055
$result
[
'num'
]
=
$num
;
}
if
(
empty
(
$result
))
{
echo
' '
;
}
else
{
$this
->
echoJson
(
$result
);
}
}
/*
* 获取购物车加价购商品数据
*/
public
function
giftinfoAction
()
{
$result
=
array
();
if
(
$this
->
isAjax
())
{
$skn
=
$this
->
get
(
'skn'
,
null
);
$promotionId
=
$this
->
get
(
'promotionId'
,
null
);
$result
=
CartModel
::
giftProductData
(
$skn
,
$promotionId
);
}
if
(
empty
(
$result
))
{
echo
' '
;
}
else
{
$this
->
echoJson
(
$result
);
}
}
/**
* 修改购物车商品数据
*/
public
function
modifyAction
()
{
$result
=
array
();
if
(
$this
->
isAjax
())
{
$shoppingKey
=
$this
->
getSession
(
'shoppingKey'
);
$uid
=
$this
->
getUid
(
true
);
$params
=
array
();
$params
[
'old_product_sku'
]
=
$this
->
post
(
'old_product_sku'
,
0
);
$params
[
'new_product_sku'
]
=
$this
->
post
(
'new_product_sku'
,
0
);
$params
[
'buy_number'
]
=
$this
->
post
(
'buy_number'
,
0
);
$params
[
'selected'
]
=
$this
->
post
(
'selected'
,
null
);
$result
=
CartModel
::
modifyCartProduct
(
$uid
,
$params
,
$shoppingKey
);
}
if
(
empty
(
$result
))
{
echo
' '
;
}
else
{
$this
->
echoJson
(
$result
);
}
}
/**
* 购物车结算请求
*/
public
function
orderEnsureAction
()
{
$this
->
setTitle
(
'购物车'
);
$this
->
setNavHeader
(
'购物车'
);
$cartType
=
$this
->
post
(
'cartType'
,
'ordinary'
);
$cookieData
=
$this
->
getCookie
(
'order-info'
,
null
);
$uid
=
$this
->
getUid
(
true
);
$data
=
array
(
'orderEnsurePage'
=>
true
,
'orderEnsure'
=>
CartModel
::
cartPay
(
$uid
,
$cartType
,
$cookieData
)
);
/**
* 购物车结算请求
*/
public
function
orderEnsureAction
()
{
$this
->
setTitle
(
'购物车'
);
$this
->
setNavHeader
(
'购物车'
);
$cartType
=
$this
->
post
(
'cartType'
,
'ordinary'
);
$cookieData
=
$this
->
getCookie
(
'order-info'
,
null
);
$uid
=
$this
->
getUid
(
true
);
$data
=
array
(
'orderEnsurePage'
=>
true
,
'orderEnsure'
=>
CartModel
::
cartPay
(
$uid
,
$cartType
,
$cookieData
)
);
// var_dump($data);
$this
->
_view
->
display
(
'order-ensure'
,
$data
);
}
/**
* 购物车选择改变字段,重新运算订单数据
*/
public
function
orderComputeAction
()
{
$result
=
array
();
if
(
$this
->
isAjax
())
{
$cartType
=
$this
->
post
(
'cartType'
,
'ordinary'
);
$deliveryWay
=
$this
->
post
(
'deliveryId'
,
1
);
$paymentType
=
$this
->
post
(
'paymentTypeId'
,
1
);
$couponCode
=
$this
->
post
(
'couponCode'
,
null
);
$yohoCoin
=
$this
->
post
(
'yohoCoin'
,
null
);
$uid
=
$this
->
getUid
(
true
);
$result
=
CartModel
::
orderCompute
(
$uid
,
$cartType
,
$deliveryWay
,
$paymentType
,
$couponCode
,
$yohoCoin
);
}
if
(
empty
(
$result
))
{
echo
' '
;
}
else
{
$this
->
echoJson
(
$result
);
}
}
/**
* 购物车输入优惠券码使用优惠券
*/
public
function
couponSearchAction
()
{
$result
=
array
();
if
(
$this
->
isAjax
())
{
$couponCode
=
$this
->
get
(
'couponCode'
,
''
);
$uid
=
$this
->
getUid
(
true
);
$result
=
CartModel
::
searchCoupon
(
$uid
,
$couponCode
);
}
if
(
empty
(
$result
))
{
echo
' '
;
}
else
{
$this
->
echoJson
(
$result
);
}
}
/**
* 购物车结算--获取优惠券列表
*/
public
function
couponListAction
()
{
$result
=
array
();
if
(
$this
->
isAjax
())
{
$uid
=
$this
->
getUid
(
true
);
$page
=
$this
->
get
(
'page'
,
1
);
$result
=
CartModel
::
getCouponList
(
$uid
);
}
if
(
empty
(
$result
))
{
echo
' '
;
}
else
{
$this
->
echoJson
(
$result
);
}
}
$this
->
_view
->
display
(
'order-ensure'
,
$data
);
}
/**
* 购物车选择改变字段,重新运算订单数据
*/
public
function
orderComputeAction
()
{
$result
=
array
();
if
(
$this
->
isAjax
())
{
$cartType
=
$this
->
post
(
'cartType'
,
'ordinary'
);
$deliveryWay
=
$this
->
post
(
'deliveryId'
,
1
);
$paymentType
=
$this
->
post
(
'paymentTypeId'
,
1
);
$couponCode
=
$this
->
post
(
'couponCode'
,
null
);
$yohoCoin
=
$this
->
post
(
'yohoCoin'
,
null
);
$uid
=
$this
->
getUid
(
true
);
$result
=
CartModel
::
orderCompute
(
$uid
,
$cartType
,
$deliveryWay
,
$paymentType
,
$couponCode
,
$yohoCoin
);
}
if
(
empty
(
$result
))
{
echo
' '
;
}
else
{
$this
->
echoJson
(
$result
);
}
}
/**
* 购物车输入优惠券码使用优惠券
*/
public
function
couponSearchAction
()
{
$result
=
array
();
if
(
$this
->
isAjax
())
{
$couponCode
=
$this
->
get
(
'couponCode'
,
''
);
$uid
=
$this
->
getUid
(
true
);
$result
=
CartModel
::
searchCoupon
(
$uid
,
$couponCode
);
}
if
(
empty
(
$result
))
{
echo
' '
;
}
else
{
$this
->
echoJson
(
$result
);
}
}
/**
* 购物车结算--获取优惠券列表
*/
public
function
couponListAction
()
{
$result
=
array
();
if
(
$this
->
isAjax
())
{
$uid
=
$this
->
getUid
(
true
);
$page
=
$this
->
get
(
'page'
,
1
);
$result
=
CartModel
::
getCouponList
(
$uid
);
}
if
(
empty
(
$result
))
{
echo
' '
;
}
else
{
$this
->
echoJson
(
$result
);
}
}
/**
* 下单流程 选择地址
...
...
@@ -272,7 +277,7 @@ class ShoppingCartController extends AbstractAction
$this
->
setTitle
(
'选择地址'
);
$this
->
setNavHeader
(
'选择地址'
,
Helpers
::
url
(
'/shoppingCart/orderEnsure'
));
$uid
=
$this
->
getUid
(
true
);
$uid
=
$this
->
getUid
(
true
);
$address
=
UserModel
::
getAddressData
(
$uid
);
$this
->
_view
->
display
(
'select-address'
,
array
(
...
...
@@ -296,36 +301,72 @@ class ShoppingCartController extends AbstractAction
));
}
/**
* 确认结算订单
*/
public
function
orderSubAction
()
{
$result
=
array
();
if
(
$this
->
isAjax
())
{
$uid
=
$this
->
getUid
(
true
);
$addressId
=
$this
->
post
(
'addressId'
,
null
);
$cartType
=
$this
->
post
(
'cartType'
,
'ordinary'
);
// 默认普通购物车
$deliveryTime
=
$this
->
post
(
'deliveryTimeId'
,
1
);
// 默认只工作日配送
$deliveryWay
=
$this
->
post
(
'deliveryId'
,
1
);
// 默认普通快递
$invoiceTitle
=
$this
->
post
(
'invoiceText'
,
null
);
$invoiceId
=
$this
->
post
(
'invoiceType'
,
null
);
$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
,
$couponCode
,
$yohoCoin
);
}
if
(
empty
(
$result
))
{
echo
' '
;
}
else
{
// 提交成功清除Cookie
$this
->
setCookie
(
'order-info'
,
null
);
$this
->
echoJson
(
$result
);
}
}
/**
* 确认结算订单
*/
public
function
orderSubAction
()
{
$result
=
array
();
if
(
$this
->
isAjax
())
{
$uid
=
$this
->
getUid
(
true
);
$addressId
=
$this
->
post
(
'addressId'
,
null
);
$cartType
=
$this
->
post
(
'cartType'
,
'ordinary'
);
// 默认普通购物车
$deliveryTime
=
$this
->
post
(
'deliveryTimeId'
,
1
);
// 默认只工作日配送
$deliveryWay
=
$this
->
post
(
'deliveryId'
,
1
);
// 默认普通快递
$invoiceTitle
=
$this
->
post
(
'invoiceText'
,
null
);
$invoiceId
=
$this
->
post
(
'invoiceType'
,
null
);
$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
,
$couponCode
,
$yohoCoin
);
}
if
(
empty
(
$result
))
{
echo
' '
;
}
else
{
// 提交成功清除Cookie
$this
->
setCookie
(
'order-info'
,
null
);
$this
->
echoJson
(
$result
);
}
}
/**
* 加入购物车
*
* @param string productSku 商品的SKU
* @param int buyNumber 购买数量
* @param int promotionId 促销ID, 加价购有关
* @param int goodsType 商品类型,0表示普通商品,1表示加价购商品
* @param int isEdit 是否是编辑商品SKU,0表示不是编辑
* @return json
*/
public
function
addAction
()
{
$result
=
array
();
if
(
$this
->
isAjax
())
{
$shoppingKey
=
Helpers
::
getShoppingKeyByCookie
();
$productSku
=
$this
->
post
(
'productSku'
);
$buyNumber
=
$this
->
post
(
'buyNumber'
,
1
);
$goodsType
=
$this
->
post
(
'goodsType'
,
0
);
$promotionId
=
$this
->
post
(
'promotionId'
,
0
);
$isEdit
=
$this
->
post
(
'isEdit'
,
0
);
$uid
=
$this
->
getUid
(
true
);
// 执行加入购物车操作
$result
=
CartModel
::
addToCart
(
$productSku
,
$buyNumber
,
$goodsType
,
$isEdit
,
$promotionId
,
$uid
,
$shoppingKey
);
// 设置加入购物车凭证到客户端浏览器
if
(
isset
(
$result
[
'data'
][
'shopping_key'
]))
{
$this
->
setCookie
(
'_spk'
,
$shoppingKey
);
}
}
$this
->
echoJson
(
$result
);
}
}
...
...
yohobuy/m.yohobuy.com/application/models/Home/Help.php
View file @
4ff4c3e
...
...
@@ -8,36 +8,37 @@ use Plugin\Helpers;
/**
* 帮助中心相关数据处理
*/
class
HelpModel
{
class
HelpModel
{
/*
* 获取帮助中心列表
*/
public
static
function
serviceInfo
()
{
//调用接口获取数据
$res
=
json_decode
(
HelpData
::
serviceInfo
(),
TRUE
);
$cateInfo
=
$res
[
'data'
];
public
static
function
serviceInfo
()
{
$iHelp
=
array
();
$list
=
array
();
if
(
$cateInfo
)
{
foreach
(
$cateInfo
as
$key
=>
$value
)
{
$cateInfo
=
HelpData
::
serviceInfo
();
if
(
!
empty
(
$cateInfo
[
'data'
]))
{
foreach
(
$cateInfo
[
'data'
]
as
$key
=>
$value
)
{
$iHelp
[
$key
][
'name'
]
=
$value
[
'caption'
];
$iHelp
[
$key
][
'code'
]
=
$value
[
'code'
];
$iHelp
[
$key
][
'url'
]
=
Helpers
::
url
(
'/home/helpDetail'
,
array
(
'code'
=>
$value
[
'code'
],
'caption'
=>
$value
[
'caption'
])
);
$iHelp
[
$key
][
'url'
]
=
Helpers
::
url
(
'/home/helpDetail'
,
array
(
'code'
=>
$value
[
'code'
],
'caption'
=>
$value
[
'caption'
]));
}
}
return
$iHelp
;
}
/*
* 获取帮助中心详细内容
*/
public
static
function
serviceDetail
(
$code
)
{
public
static
function
serviceDetail
(
$code
)
{
$res
=
HelpData
::
serviceDetail
(
$code
);
if
(
!
empty
(
$res
))
{
if
(
false
!==
(
$part
=
strstr
(
$res
,
'<div class="deal_main">'
)))
{
$res
=
strstr
(
$part
,
'</body>'
,
TRUE
);
if
(
false
!==
(
$part
=
strstr
(
$res
,
'<body>'
)))
{
$res
=
strstr
(
$part
,
'</body>'
,
true
);
}
}
return
$res
;
...
...
yohobuy/m.yohobuy.com/application/models/Product/Detail.php
View file @
4ff4c3e
...
...
@@ -160,17 +160,15 @@ class DetailModel
$colorGroup
=
array
();
$sizeList
=
array
();
$goodsGroup
=
array
();
$coverImage
=
''
;
$colorStorageNum
=
0
;
// 颜色的库存总数
$thumbImageList
=
array
();
$colorStorageGroup
=
array
();
// 颜色分组的库存总数集合, 多个之间用/分隔
$sizeStorageStr
=
''
;
// 尺码库存总数集合, 多个之间用/分隔
$colorStorageNum
=
0
;
$totalStorageNum
=
0
;
// 总库存数
foreach
(
$baseInfo
[
'goodsList'
]
as
$
i
=>
$
value
)
{
foreach
(
$baseInfo
[
'goodsList'
]
as
$value
)
{
$sizeList
=
array
();
$colorStorageNum
=
0
;
// 获取默认的封面图
if
(
$i
===
0
)
{
$coverImage
=
Helpers
::
getImageUrl
(
$value
[
'colorImage'
],
60
,
60
);
}
$sizeStorageStr
=
''
;
// clear to empty
// 商品分组
if
(
isset
(
$value
[
'goodsImagesList'
]))
{
...
...
@@ -189,10 +187,13 @@ class DetailModel
'id'
=>
$size
[
'id'
],
'skuId'
=>
$size
[
'goodsSizeSkuId'
],
'goodsId'
=>
$size
[
'goodsId'
],
'colorId'
=>
$value
[
'colorId'
],
'name'
=>
$size
[
'sizeName'
],
'sizeNum'
=>
$size
[
'goodsSizeStorageNum'
],
);
$colorStorageNum
+=
intval
(
$size
[
'goodsSizeStorageNum'
]);
$sizeStorageStr
.=
$size
[
'goodsSizeStorageNum'
]
.
'/'
;
$colorStorageGroup
[
$size
[
'sizeName'
]
][
$value
[
'colorName'
]
]
=
$size
[
'goodsSizeStorageNum'
];
}
}
...
...
@@ -202,11 +203,19 @@ class DetailModel
'skcId'
=>
$value
[
'productSkc'
],
'name'
=>
$value
[
'colorName'
],
'goodsName'
=>
$value
[
'goodsName'
],
'shortUrl'
=>
Helpers
::
getImageUrl
(
$value
[
'colorImage'
],
60
,
60
),
'colorNum'
=>
$colorStorageNum
,
'size
s'
=>
$sizeList
,
'size
NumStr'
=>
rtrim
(
$sizeStorageStr
,
'/'
)
,
);
// 缩略图
$thumbImageList
[]
=
array
(
'img'
=>
Helpers
::
getImageUrl
(
$value
[
'colorImage'
],
60
,
60
)
);
// 统计每个尺码对应的各个颜色的库存量
foreach
(
$sizeList
as
&
$sizeArr
)
{
$sizeArr
[
'colorNumStr'
]
=
implode
(
'/'
,
array_values
(
$colorStorageGroup
[
$sizeArr
[
'name'
]
])
);
}
// 商品库存总数
$totalStorageNum
+=
$colorStorageNum
;
}
...
...
@@ -238,12 +247,13 @@ class DetailModel
if
(
!
$soldOut
&&
!
$notForSale
)
{
$result
[
'cartInfo'
][
'addToCartUrl'
]
=
Helpers
::
url
(
'/product/buy_'
.
$productId
.
'_'
.
$goodsId
.
'.html'
);
$result
[
'cartInfo'
][
'productId'
]
=
$productId
;
$result
[
'cartInfo'
][
'thumb
'
]
=
$coverImage
;
$result
[
'cartInfo'
][
'thumb
s'
]
=
$thumbImageList
;
$result
[
'cartInfo'
][
'name'
]
=
isset
(
$result
[
'goodsName'
])
?
$result
[
'goodsName'
]
:
''
;
$result
[
'cartInfo'
][
'price'
]
=
isset
(
$result
[
'goodsPrice'
][
'currentPrice'
])
?
$result
[
'goodsPrice'
][
'currentPrice'
]
:
''
;
$result
[
'cartInfo'
][
'salePrice'
]
=
isset
(
$result
[
'goodsPrice'
][
'previousPrice'
])
?
$result
[
'goodsPrice'
][
'previousPrice'
]
:
''
;
$result
[
'cartInfo'
][
'totalNum'
]
=
$totalStorageNum
;
$result
[
'cartInfo'
][
'colors'
]
=
$colorGroup
;
$result
[
'cartInfo'
][
'sizes'
]
=
$sizeList
;
}
// 非卖品
elseif
(
$notForSale
)
{
...
...
@@ -336,7 +346,7 @@ class DetailModel
$referenceList
=
array
();
// 判断是否显示参考尺码
$showReference
=
!
empty
(
$sizeInfo
[
'sizeInfoBo'
][
'sizeBoList'
][
0
][
'referenceSize'
])
&&
(
$sizeInfo
[
'sizeInfoBo'
][
'sizeBoList'
][
0
][
'referenceSize'
][
'gender'
]
==
$gender
||
$sizeInfo
[
'sizeInfoBo'
][
'sizeBoList'
][
0
][
'referenceSize'
][
'gender'
]
==
3
)
;
$showReference
=
!
empty
(
$sizeInfo
[
'sizeInfoBo'
][
'sizeBoList'
][
0
][
'referenceSize'
]);
if
(
$showReference
)
{
$referenceList
[
0
]
=
array
(
'param'
=>
$referenceName
);
}
...
...
@@ -351,7 +361,10 @@ class DetailModel
foreach
(
$sizeInfo
[
'sizeInfoBo'
][
'sizeBoList'
]
as
$value
)
{
$item
=
array
();
$sizeNameList
[]
=
array
(
'param'
=>
$value
[
'sizeName'
]);
if
(
!
empty
(
$value
[
'referenceSize'
][
'gender'
])
&&
(
$value
[
'referenceSize'
][
'gender'
]
==
$gender
||
$value
[
'referenceSize'
][
'gender'
]
==
3
))
{
if
(
!
empty
(
$value
[
'referenceSize'
][
'gender'
])
&&
$boyReference
&&
(
$value
[
'referenceSize'
][
'gender'
]
==
1
||
$value
[
'referenceSize'
][
'gender'
]
==
3
))
{
$referenceList
[]
=
array
(
'param'
=>
empty
(
$value
[
'referenceSize'
][
'referenceName'
])
?
' '
:
$value
[
'referenceSize'
][
'referenceName'
]);
}
elseif
(
!
empty
(
$value
[
'referenceSize'
][
'gender'
])
&&
$girlReference
&&
(
$value
[
'referenceSize'
][
'gender'
]
==
2
||
$value
[
'referenceSize'
][
'gender'
]
==
3
))
{
$referenceList
[]
=
array
(
'param'
=>
empty
(
$value
[
'referenceSize'
][
'referenceName'
])
?
' '
:
$value
[
'referenceSize'
][
'referenceName'
]);
}
foreach
(
$value
[
'sortAttributes'
]
as
$attr
)
{
...
...
Please
register
or
login
to post a comment