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
Plain Diff
Browse Files
Authored by
毕凯
9 years ago
Commit
32f9c9681b9b66232349488ccf65d0b82dae6d1d
2 parents
d2cf27f2
004e0fa9
合并代码
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
59 additions
and
30 deletions
library/LibModels/Wap/Home/CartData.php
static/js/shopping-cart/order-ensure.js
template/m.yohobuy.com/actions/index/shoppingCart/order-ensure.phtml
yohobuy/m.yohobuy.com/application/controllers/ShoppingCart.php
yohobuy/m.yohobuy.com/application/models/Index/Cart.php
library/LibModels/Wap/Home/CartData.php
View file @
32f9c96
...
...
@@ -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
;
}
...
...
static/js/shopping-cart/order-ensure.js
View file @
32f9c96
...
...
@@ -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
();
});
...
...
template/m.yohobuy.com/actions/index/shoppingCart/order-ensure.phtml
View file @
32f9c96
{
{>
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/ShoppingCart.php
View file @
32f9c96
...
...
@@ -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 @
32f9c96
...
...
@@ -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
;
...
...
Please
register
or
login
to post a comment