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
57d1fead29b598e3c7166bf5d4a21015ae6cf3a3
2 parents
5a8f26ea
e97ce007
购物车 bug 修复
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
33 additions
and
12 deletions
static/js/cart/order-ensure.js
static/js/cart/select-coupon.js
static/js/product/detail/detail.js
static/sass/product/_detail.scss
static/js/cart/order-ensure.js
View file @
57d1fea
...
...
@@ -84,6 +84,12 @@ function orderCompute() {
if
(
!
res
)
{
tip
.
show
(
'网络出错'
);
}
else
{
if
(
res
.
order_amount
)
{
res
.
order_amount
=
(
+
res
.
order_amount
).
toFixed
(
2
);
}
if
(
res
.
discount_amount
)
{
res
.
discount_amount
=
(
+
res
.
discount_amount
).
toFixed
(
2
);
}
if
(
res
.
last_order_amount
)
{
res
.
last_order_amount
=
(
+
res
.
last_order_amount
).
toFixed
(
2
);
}
...
...
static/js/cart/select-coupon.js
View file @
57d1fea
...
...
@@ -22,18 +22,24 @@ var conponTmpl = Handlebars.compile($('#tmpl-coupon').html()),
ellipsis
.
init
();
$newCoupon
.
on
(
'submit'
,
function
()
{
var
$this
=
$
(
this
);
if
(
!
$this
.
find
(
'[name="couponCode"]'
).
val
())
{
tip
.
show
(
'请输入优惠券码'
);
return
false
;
}
$
.
ajax
({
method
:
'POST'
,
url
:
'/cart/index/couponSearch'
,
data
:
$
(
this
)
.
serialize
()
data
:
$
this
.
serialize
()
}).
then
(
function
(
res
)
{
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
;
window
.
location
.
href
=
'/
cart/index/orderEnsure'
;
}
else
{
tip
.
show
(
res
.
message
);
tip
.
show
(
res
.
message
||
'网络错误'
);
}
}).
fail
(
function
()
{
tip
.
show
(
'网络错误'
);
...
...
static/js/product/detail/detail.js
View file @
57d1fea
...
...
@@ -78,8 +78,14 @@ $.ajax({
type
:
'GET'
,
url
:
'/cart/index/count'
,
success
:
function
(
data
)
{
var
count
;
if
(
data
.
code
===
200
)
{
$cart
.
find
(
'.num-tag'
).
html
(
data
.
data
.
cart_goods_count
).
removeClass
(
'hide'
);
count
=
data
.
data
.
cart_goods_count
||
0
;
if
(
count
>
99
)
{
count
=
'99+'
;
}
$cart
.
find
(
'.num-tag'
).
html
(
count
).
removeClass
(
'hide'
);
}
}
});
...
...
static/sass/product/_detail.scss
View file @
57d1fea
...
...
@@ -480,16 +480,19 @@ $basicBtnC:#eb0313;
}
}
.num-tag
{
position
:
absolute
;
left
:
pxToRem
(
66px
);
height
:
pxToRem
(
20px
);
display
:
block
;
width
:
pxToRem
(
36px
);
height
:
pxToRem
(
36px
);
background-color
:
$basicBtnC
;
border-radius
:
50%
;
position
:
absolute
;
top
:
0
;
left
:
pxToRem
(
48px
);
width
:
pxToRem
(
72px
);
height
:
pxToRem
(
72px
);
font-size
:
pxToRem
(
40px
);
line-height
:
pxToRem
(
72px
);
color
:
#fff
;
font-size
:
pxToRem
(
24px
);
background
:
$basicBtnC
;
text-align
:
center
;
border-radius
:
50%
;
@include
transform
(
scale
(
0
.5
));
&
.hide
{
display
:
none
;
}
...
...
Please
register
or
login
to post a comment