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
Email Patches
Plain Diff
Browse Files
Authored by
周少峰
9 years ago
Commit
dc9980f0aba6888c8f887cc1d373882e2df42d1a
1 parent
d4d18b95
use yohocoin
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
80 additions
and
31 deletions
library/LibModels/Wap/Home/CartData.php
static/js/cart/chose-panel.js
static/js/cart/order-ensure.js
yohobuy/m.yohobuy.com/application/models/Index/Cart.php
yohobuy/m.yohobuy.com/application/modules/Cart/controllers/Index.php
library/LibModels/Wap/Home/CartData.php
View file @
dc9980f
...
...
@@ -474,19 +474,23 @@ class CartData
* @param int $productSku
* @param int $buyNumber
* @param int $useYohoCoin
* @param int $yohoCoinMode 1:使用yoho币;0:不使用yoho币
* @author sefon 2016-7-2 18:12:30
* @return array
*/
public
static
function
check
ickets
(
$uid
,
$productSku
,
$buyNumber
,
$useYohoCoin
=
0
)
public
static
function
check
Tickets
(
$uid
,
$productSku
,
$buyNumber
,
$useYohoCoin
=
0
,
$yohoCoinMode
=
true
)
{
$param
=
Yohobuy
::
param
();
$param
[
'method'
]
=
'app.shopping.ticket'
;
$param
[
'uid'
]
=
$uid
;
$param
[
'product_sku'
]
=
$productSku
;
$param
[
'buy_number'
]
=
$buyNumber
;
if
(
!
$yohoCoinMode
)
{
$param
[
'yoho_coin_mode'
]
=
0
;
}
$param
[
'use_yoho_coin'
]
=
$useYohoCoin
;
$param
[
'client_secret'
]
=
Sign
::
getSign
(
$param
);
return
Yohobuy
::
get
(
API_URL
,
$param
);
return
Yohobuy
::
get
(
API_URL
,
$param
);
}
/**
...
...
static/js/cart/chose-panel.js
View file @
dc9980f
...
...
@@ -275,7 +275,14 @@ function addTickets(productSku, buyNumber) {
type
:
'post'
,
success
:
function
(
addRestult
)
{
if
(
addRestult
.
code
!=
200
)
{
tip
.
show
(
addRestult
.
masseage
);
if
(
addRestult
.
code
==
401
)
{
var
refer
=
window
.
location
.
href
;
window
.
location
.
href
=
'//m.yohobuy.com/signin.html?refer='
+
refer
;
}
tip
.
show
(
addRestult
.
message
);
setTimeout
(
function
()
{
location
.
reload
();
},
1000
);
}
else
{
$productSku
.
val
(
productSku
);
$buyNumber
.
val
(
buyNumber
);
...
...
static/js/cart/order-ensure.js
View file @
dc9980f
...
...
@@ -137,20 +137,30 @@ function updateDeliverId(id) {
function
orderCompute
()
{
var
yohoCoin
=
orderInfo
(
'yohoCoin'
),
deliverId
=
orderInfo
(
'deliveryId'
);
loading
.
showLoadingMask
();
$
.
ajax
({
method
:
'POST'
,
url
:
'/cart/index/orderCompute'
,
data
:
{
deliverId
=
orderInfo
(
'deliveryId'
),
data
=
{
cartType
:
orderInfo
(
'cartType'
)
||
'ordinary'
,
deliveryId
:
orderInfo
(
'deliveryId'
),
paymentTypeId
:
orderInfo
(
'paymentTypeId'
),
couponCode
:
orderInfo
(
'couponCode'
),
yohoCoin
:
yohoCoin
,
skuList
:
isLimitGood
()
?
orderInfo
(
'skuList'
)
:
undefined
};
//门票
if
(
isTickets
)
{
data
=
{
type
:
'tickets'
,
productSku
:
productSku
,
buyNumber
:
buyNumber
,
yohoCoin
:
yohoCoin
}
};
loading
.
showLoadingMask
();
$
.
ajax
({
method
:
'POST'
,
url
:
'/cart/index/orderCompute'
,
data
:
data
}).
then
(
function
(
res
)
{
if
(
$
.
type
(
res
)
!==
'object'
)
{
window
.
location
.
reload
();
...
...
@@ -278,7 +288,7 @@ $('.dispatch-time').on('touchend', 'li', function() {
$
(
'.coin'
).
on
(
'touchend'
,
function
()
{
var
$this
=
$
(
this
);
if
(
$this
.
find
(
'.checkbox'
).
hasClass
(
'icon-cb-radio'
))
{
orderInfo
(
'yohoCoin'
,
$this
.
data
(
'yoho-coin'
));
$this
.
find
(
'.can-use'
).
hide
();
...
...
@@ -387,7 +397,7 @@ function ticketsConfirm () {
productSku
:
productSku
,
buyNumber
:
buyNumber
,
mobile
:
$ticketsMobile
.
val
(),
useYohoCoin
:
''
useYohoCoin
:
orderInfo
(
'yohoCoin'
)
};
$
.
ajax
({
...
...
yohobuy/m.yohobuy.com/application/models/Index/Cart.php
View file @
dc9980f
...
...
@@ -1119,7 +1119,7 @@ class CartModel
{
$result
=
array
();
$data
=
CartData
::
checkickets
(
$uid
,
$productSku
,
$buyNumber
,
$useYohoCoin
);
$data
=
CartData
::
check
T
ickets
(
$uid
,
$productSku
,
$buyNumber
,
$useYohoCoin
);
if
(
!
isset
(
$data
[
'code'
])
||
$data
[
'code'
]
!==
200
)
{
return
$result
;
}
...
...
@@ -1147,12 +1147,24 @@ class CartModel
$result
[
'price'
]
=
Helpers
::
transPrice
(
$price
,
true
);
// 有货币
$result
[
'yohoCoin'
]
=
Helpers
::
transPrice
(
$data
[
'data'
][
'yoho_coin'
]);
/*
* 默认使用有货币
* $result['useYohoCoin'] = isset($orderCompute['use_yoho_coin']) ? $orderCompute['use_yoho_coin'] : $payReturn['use_yoho_coin'];
*/
$result
[
'useYohoCoin'
]
=
isset
(
$orderCompute
[
'use_yoho_coin'
])
?
$orderCompute
[
'use_yoho_coin'
]
:
false
;
// print_r($data);
$result
[
'useYohoCoin'
]
=
isset
(
$data
[
'data'
][
'shopping_cart_data'
][
'use_yoho_coin'
])
?
$data
[
'data'
][
'shopping_cart_data'
][
'use_yoho_coin'
]
:
false
;
return
$result
;
}
public
static
function
ticketsOrderCompute
(
$uid
,
$productSku
,
$buyNumber
,
$yohoCoin
)
{
$result
=
array
();
$compute
=
CartData
::
checkTickets
(
$uid
,
$productSku
,
$buyNumber
,
$yohoCoin
);
if
(
$compute
&&
isset
(
$compute
[
'code'
])
&&
$compute
[
'code'
]
===
200
)
{
// 有货币添加.00后缀
$compute
[
'data'
][
'shopping_cart_data'
][
'use_yoho_coin'
]
=
Helpers
::
transPrice
(
$compute
[
'data'
][
'shopping_cart_data'
][
'use_yoho_coin'
]);
$result
=
$compute
[
'data'
][
'shopping_cart_data'
];
}
// print_r($compute);
return
$result
;
}
}
...
...
yohobuy/m.yohobuy.com/application/modules/Cart/controllers/Index.php
View file @
dc9980f
...
...
@@ -360,9 +360,19 @@ class IndexController extends AbstractAction
$paymentType
=
$this
->
post
(
'paymentTypeId'
,
1
);
$couponCode
=
$this
->
post
(
'couponCode'
,
null
);
$yohoCoin
=
$this
->
post
(
'yohoCoin'
,
null
);
$productSku
=
$this
->
post
(
'productSku'
,
null
);
$buyNumber
=
$this
->
post
(
'buyNumber'
,
null
);
$uid
=
$this
->
getUid
(
true
);
$skuList
=
$this
->
post
(
'skuList'
,
''
);
$result
=
CartModel
::
orderCompute
(
$uid
,
$cartType
,
$deliveryWay
,
$paymentType
,
$couponCode
,
$yohoCoin
,
$skuList
);
$type
=
$this
->
post
(
'type'
,
null
);
//type : tickets 门票
if
(
$type
!==
'tickets'
)
{
$result
=
CartModel
::
orderCompute
(
$uid
,
$cartType
,
$deliveryWay
,
$paymentType
,
$couponCode
,
$yohoCoin
,
$skuList
);
}
//非门票
else
{
$result
=
CartModel
::
ticketsOrderCompute
(
$uid
,
$productSku
,
$buyNumber
,
$yohoCoin
);
}
}
$this
->
echoJson
(
$result
);
...
...
@@ -580,17 +590,24 @@ class IndexController extends AbstractAction
*/
public
function
checkTicketsAction
()
{
// $uid = $this->getUid();
// if (!$this->isAjax() || !$uid) {
// exit;
// }
// $productSku = $this->post('$productSku');
// $buyNumber = $this->post('$buyNumber');
// $data = CartData::checkTickets($uid, $productSku, $buyNumber);
$data
=
array
(
'code'
=>
200
,
'data'
=>
array
()
);
if
(
!
$this
->
isAjax
())
{
exit
;
}
$data
=
array
();
$uid
=
$this
->
getUid
();
do
{
//判断用户登陆
if
(
!
$uid
)
{
$data
=
array
(
'code'
=>
401
,
);
break
;
}
$productSku
=
$this
->
post
(
'productSku'
);
$buyNumber
=
$this
->
post
(
'buyNumber'
);
$useYohoCoin
=
$this
->
post
(
'useYohoCoin'
,
0
);
$data
=
CartData
::
checkTickets
(
$uid
,
$productSku
,
$buyNumber
,
$useYohoCoin
);
}
while
(
false
);
$this
->
echoJson
(
$data
);
}
...
...
@@ -606,7 +623,6 @@ class IndexController extends AbstractAction
$this
->
error
();
}
$tickets
=
CartModel
::
getTickets
(
$uid
,
$productSku
,
$buyNumber
);
// print_r($tickets); exit;
$this
->
setTitle
(
'确认订单'
);
$this
->
setNavHeader
(
'确认订单'
,
''
,
false
);
// 不显示右上角home按钮
...
...
Please
register
or
login
to post a comment