Toggle navigation
Toggle navigation
This project
Loading...
Sign in
fe
/
YOHOBUYPC
·
Commits
Go to a project
GitLab
Go to group
Project
Activity
Files
Commits
Pipelines
0
Builds
0
Graphs
Milestones
Issues
0
Merge Requests
2
Members
Labels
Wiki
Forks
Network
Create a new issue
Download as
Email Patches
Plain Diff
Browse Files
Authored by
毕凯
9 years ago
Commit
e452f7fe6469400282a3c908036beaa30d5b819e
1 parent
d6d83987
订单确认增加价格价格计算
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
73 additions
and
10 deletions
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
static/js/shopping-cart/order-ensure.js
View file @
e452f7f
...
...
@@ -7,11 +7,15 @@
var
$
=
require
(
'jquery'
),
lazyLoad
=
require
(
'yoho.lazyload'
),
Hammer
=
require
(
'yoho.hammer'
),
Handlebars
=
require
(
'yoho.handlebars'
),
tip
=
require
(
'../plugin/tip'
),
orderInfo
=
require
(
'./order-info'
).
orderInfo
;
var
dispatchModeHammer
,
dispatchTimeHammer
,
$invoice
=
$
(
'.invoice'
);
$invoice
=
$
(
'.invoice'
),
$price
=
$
(
'.price-cal'
),
priceTmpl
=
Handlebars
.
compile
(
$
(
'#tmpl-price'
).
html
());
lazyLoad
();
...
...
@@ -26,6 +30,38 @@ function dispacthTapEvt(e) {
$cur
.
addClass
(
'chosed'
);
}
function
orderCompute
()
{
$
.
ajax
({
method
:
'POST'
,
url
:
'/shoppingCart/orderCompute'
,
data
:
{
cartType
:
orderInfo
(
'cartType'
),
deliveryId
:
orderInfo
(
'deliveryId'
),
paymentTypeId
:
orderInfo
(
'paymentTypeId'
),
couponCode
:
orderInfo
(
'couponCode'
),
yohoCoin
:
orderInfo
(
'yohoCoin'
)
}
}).
then
(
function
(
res
)
{
var
priceHtml
;
if
(
!
res
)
{
tip
.
show
(
'网络出错'
);
}
else
{
priceHtml
=
priceTmpl
({
sumPrice
:
res
.
order_amount
,
salePrice
:
res
.
discount_amount
,
freight
:
res
.
promotion_formula_list
[
1
].
promotion_amount
,
yohoCoin
:
res
.
use_yoho_coin
,
price
:
res
.
last_order_amount
});
$price
.
html
(
priceHtml
);
}
}).
fail
(
function
()
{
tip
.
show
(
'网络出错'
);
});
}
dispatchModeHammer
=
new
Hammer
(
document
.
getElementsByClassName
(
'dispatch-mode'
)[
0
]);
dispatchModeHammer
.
on
(
'tap'
,
dispacthTapEvt
);
...
...
@@ -58,6 +94,7 @@ $('.invoice').on('touchend', '.checkbox', function() {
// 界面点击,状态存 cookie
$
(
'.dispatch-mode'
).
on
(
'touchend'
,
'li'
,
function
()
{
orderInfo
(
'deliveryId'
,
$
(
this
).
data
(
'id'
));
orderCompute
();
});
$
(
'.dispatch-time'
).
on
(
'touchend'
,
'li'
,
function
()
{
...
...
@@ -69,9 +106,12 @@ $('.coin').on('touchend', function() {
if
(
$this
.
find
(
'.checkbox'
).
hasClass
(
'icon-cb-checked'
))
{
orderInfo
(
'yohoCoin'
,
$this
.
data
(
'yoho-coin'
));
$this
.
find
(
'.coin-check em'
).
show
();
}
else
{
orderInfo
(
'yohoCoin'
,
0
);
$this
.
find
(
'.coin-check em'
).
hide
();
}
orderCompute
();
});
$invoice
.
on
(
'touchend'
,
function
()
{
...
...
template/m.yohobuy.com/actions/index/shoppingCart/order-ensure.phtml
View file @
e452f7f
...
...
@@ -102,23 +102,23 @@
</form>
</section>
<section
class=
"block"
>
<section
class=
"
price-cal
block"
>
<ul
class=
"total"
>
<li>
<span>总价</span>
¥
{
{sumPrice
}
}
¥
{
{sumPrice
}
}
</li>
<li>
<span>活动价</span>
-
¥
{
{salePrice
}
}
-
¥
{
{salePrice
}
}
</li>
<li>
<span>运费</span>
+
¥
{
{freight
}
}
+
¥
{
{freight
}
}
</li>
<li>
<span>YOHO币</span>
-
¥
{
{yohoCoin
}
}
-
¥
{
{yohoCoin
}
}
</li>
<li
class=
"cost"
>
应付金额:
<em>¥
{
{price
}
}</em>
...
...
@@ -142,4 +142,27 @@
</ul>
{
{/
orderEnsure
}
}
</div>
<script
id=
"tmpl-price"
type=
"text/tmpl"
>
<ul
class=
"total"
>
<li>
<span>总价</span>
¥\
{
{sumPrice
}
}
</li>
<li>
<span>活动价</span>
-
¥\
{
{salePrice
}
}
</li>
<li>
<span>运费</span>
+
\
{
{freight
}
}
</li>
<li>
<span>YOHO币</span>
-
¥\
{
{yohoCoin
}
}
</li>
<li
class=
"cost"
>
应付金额:
<em>¥\
{
{price
}
}</em>
</li>
</ul>
</script>
{
{>
layout/footer
}
}
...
...
yohobuy/m.yohobuy.com/application/controllers/ShoppingCart.php
View file @
e452f7f
...
...
@@ -169,10 +169,10 @@ class ShoppingCartController extends AbstractAction
if
(
$this
->
isAjax
())
{
$cartType
=
$this
->
post
(
'cartType'
,
'ordinary'
);
$deliveryWay
=
$this
->
post
(
'deliveryWay'
,
1
);
$paymentType
=
$this
->
post
(
'paymentType'
,
1
);
$couponCode
=
$this
->
post
(
'paymentType'
,
null
);
$yohoCoin
=
$this
->
post
(
'paymentType'
,
null
);
$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
);
}
...
...
Please
register
or
login
to post a comment