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
Rock Zhang
9 years ago
Commit
1a18af4f759c11b5272bc5e62d7c58e8f94bcb6e
1 parent
d2f86567
修复选择优惠券的bug(每次点击才请求搜索接口,判定优惠券是否存在)
Code Review By Rock Zhang
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
23 additions
and
6 deletions
static/js/cart/select-coupon.js
template/m.yohobuy.com/actions/cart/index/order-ensure.phtml
template/m.yohobuy.com/actions/cart/index/select-coupon.phtml
yohobuy/m.yohobuy.com/application/models/Index/Cart.php
static/js/cart/select-coupon.js
View file @
1a18af4
...
...
@@ -67,9 +67,26 @@ $newCoupon.on('submit', function() {
$
(
'#coupon-list'
).
on
(
'touchend'
,
'.employ-main'
,
function
()
{
var
$this
=
$
(
this
);
var
couponCode
=
$this
.
data
(
'coupon-code'
);
orderInfo
(
'couponCode'
,
$this
.
data
(
'coupon-code'
));
orderInfo
(
'couponName'
,
$this
.
data
(
'coupon-name'
));
$
.
ajax
({
method
:
'POST'
,
url
:
'/cart/index/couponSearch'
,
data
:
{
couponCode
:
couponCode
}
}).
then
(
function
(
res
)
{
if
(
res
.
code
===
200
)
{
//tip.show('优惠券可用');
orderInfo
(
'couponCode'
,
res
.
data
.
coupon_code
);
orderInfo
(
'couponName'
,
res
.
data
.
coupon_title
);
window
.
location
.
href
=
'/cart/index/orderEnsure'
;
}
else
{
tip
.
show
(
res
.
message
||
'网络错误'
);
}
}).
fail
(
function
()
{
tip
.
show
(
'网络错误'
);
});
}).
on
(
'touchstart'
,
'.employ-main'
,
function
()
{
var
$this
=
$
(
this
);
...
...
template/m.yohobuy.com/actions/cart/index/order-ensure.phtml
View file @
1a18af4
...
...
@@ -46,9 +46,9 @@
<a
href=
"/cart/index/selectCoupon"
>
<span
class=
"title"
>优惠券</span>
{
{#
coupon
}
}
<span
class=
"coupon-count"
>
{
{!--<span
class=
"coupon-count"
>}}
{
{count
}
}张可用
</span>
</span>
--}}
{
{#if
couponName
}
}
<span
class=
"used coupon-use"
data-name=
"{{couponName}}"
>
...
...
template/m.yohobuy.com/actions/cart/index/select-coupon.phtml
View file @
1a18af4
...
...
@@ -13,7 +13,7 @@
<script
id=
"tmpl-coupon"
type=
"text/tmpl"
>
\
{
{#coupons
}
}
\
{
{^
notAvailable
}
}
<a
class=
"employ-main"
data-coupon-code=
"\{{ couponCode}}"
data-coupon-name=
"\{{ couponDetailInfomation}}"
href=
"
/cart/index/orderEnsure
"
>
<a
class=
"employ-main"
data-coupon-code=
"\{{ couponCode}}"
data-coupon-name=
"\{{ couponDetailInfomation}}"
href=
"
javascript:void(0);
"
>
<span>\
{
{
couponValue
}
}</span>
<p
class=
"coupon-name"
>\
{
{
couponDetailInfomation
}
}</p>
<p>有效期:\
{
{
couponValidity
}
}</p>
...
...
yohobuy/m.yohobuy.com/application/models/Index/Cart.php
View file @
1a18af4
...
...
@@ -485,7 +485,7 @@ class CartModel
// 优惠券数据
$coupons
=
array
(
'couponName'
=>
''
);
if
(
!
empty
(
$orderCompute
[
'coupon_amount'
]))
{
$coupons
[
'couponName'
]
=
$order
Compute
[
'coupon_amount
'
];
$coupons
[
'couponName'
]
=
$order
Info
[
'couponName
'
];
}
$result
[
'coupon'
]
=
$coupons
;
}
...
...
Please
register
or
login
to post a comment