Toggle navigation
Toggle navigation
This project
Loading...
Sign in
fe
/
yohobuywap-node
·
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
郭成尧
8 years ago
Commit
0664df31f3b5c878fe1a3134cf736e55ab214c9d
1 parent
83d12b38
yoho-coin
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
6 additions
and
42 deletions
apps/cart/models/cart.js
utils/payment-process.js
apps/cart/models/cart.js
View file @
0664df3
...
...
@@ -29,42 +29,6 @@ const transPrice = (price, isSepcialZero) => {
};
/**
*有货币使用前端方案显示及是否可单击判断
*/
const
_yohoCoinCompute
=
(
orderCompute
)
=>
{
let
yohoCoinData
=
{
totalYohoCoinNum
:
0
,
yohoCoin
:
0
,
useYohoCoin
:
0
,
yohoCoinClick
:
0
,
yohoCoinMsg
:
''
,
yoho_coin_pay_rule
:
[]
};
if
(
!
orderCompute
||
!
orderCompute
.
yoho_coin_pay_rule
)
{
return
yohoCoinData
;
}
_
.
assign
(
yohoCoinData
,
{
totalYohoCoinNum
:
orderCompute
.
total_yoho_coin_num
?
parseInt
(
orderCompute
.
total_yoho_coin_num
,
10
)
:
0
,
yohoCoin
:
orderCompute
.
yoho_coin
?
transPrice
(
orderCompute
.
yoho_coin
)
:
0
,
useYohoCoin
:
orderCompute
.
use_yoho_coin
?
transPrice
(
orderCompute
.
use_yoho_coin
)
:
0
,
yoho_coin_pay_rule
:
orderCompute
.
yoho_coin_pay_rule
});
if
(
yohoCoinData
.
totalYohoCoinNum
<
100
)
{
yohoCoinData
.
yohoCoinMsg
=
`共
$
{
yohoCoinData
.
totalYohoCoinNum
}
有货币,满
$
{
orderCompute
.
yoho_coin_pay_rule
.
num_limit
}
可用`
;
}
else
if
(
yohoCoinData
.
useYohoCoin
>
0
||
yohoCoinData
.
yohoCoin
>
0
)
{
yohoCoinData
.
yohoCoinMsg
=
'可抵¥'
+
(
yohoCoinData
.
useYohoCoin
>
0
?
yohoCoinData
.
useYohoCoin
:
yohoCoinData
.
yohoCoin
);
yohoCoinData
.
yohoCoinClick
=
1
;
}
else
{
yohoCoinData
.
yohoCoinMsg
=
'不满足有货币使用条件'
;
}
return
yohoCoinData
;
};
/**
* 调用购物车结算接口返回的数据处理
*
*
...
...
@@ -168,7 +132,7 @@ exports.orderCompute = (uid, cartType, deliveryWay, paymentType, couponCode, yoh
return
shoppingAPI
.
orderComputeAPI
(
uid
,
cartType
,
deliveryWay
,
paymentType
,
couponCode
,
yohoCoin
,
skuList
,
activityInfo
).
then
(
result
=>
{
if
(
result
&&
result
.
data
)
{
result
.
data
.
use_yoho_coin
=
transPrice
(
result
.
data
.
use_yoho_coin
);
result
.
data
.
yohoCoinCompute
=
_
yohoCoinCompute
(
result
.
data
);
result
.
data
.
yohoCoinCompute
=
paymentProcess
.
yohoCoinCompute
(
result
.
data
);
return
result
.
data
;
}
else
{
return
{};
...
...
@@ -181,7 +145,7 @@ exports.ticketsOrderCompute = (uid, productSku, buyNumber, yohoCoin) => {
return
shoppingAPI
.
checkTickets
(
uid
,
productSku
,
buyNumber
,
yohoCoin
).
then
(
result
=>
{
if
(
result
&&
result
.
data
)
{
result
.
data
.
shopping_cart_data
.
use_yoho_coin
=
transPrice
(
result
.
data
.
shopping_cart_data
.
use_yoho_coin
);
result
.
data
.
yohoCoinCompute
=
_
.
yohoCoinCompute
(
result
.
data
.
shopping_cart_data
);
result
.
data
.
yohoCoinCompute
=
paymentProcess
.
yohoCoinCompute
(
result
.
data
.
shopping_cart_data
);
return
result
.
data
;
}
else
{
...
...
utils/payment-process.js
View file @
0664df3
...
...
@@ -31,7 +31,7 @@ function yohoCoinCompute(orderCompute) {
}
if
(
yohoCoinData
.
totalYohoCoinNum
<
100
)
{
yohoCoinData
.
yohoCoinMsg
=
`共
$
{
yohoCoinData
.
totalYohoCoinNum
}
有货币,满
$
{
_
.
get
(
orderCompute
,
'yoho_coin_pay_rule.num_limit'
,
''
)}
可用`
;
yohoCoinData
.
yohoCoinMsg
=
`共
$
{
yohoCoinData
.
totalYohoCoinNum
}
有货币,满
$
{
_
.
get
(
orderCompute
,
'yoho_coin_pay_rule.num_limit'
,
'
100
'
)}
可用`
;
}
else
if
(
yohoCoinData
.
useYohoCoin
>
0
||
yohoCoinData
.
yohoCoin
>
0
)
{
yohoCoinData
.
yohoCoinMsg
=
'可抵¥'
+
(
yohoCoinData
.
useYohoCoin
>
0
?
yohoCoinData
.
useYohoCoin
:
yohoCoinData
.
yohoCoin
);
yohoCoinData
.
yohoCoinClick
=
1
;
...
...
@@ -247,7 +247,7 @@ function tranformPayment(data, orderInfo, cartType, skuList, orderComputeData) {
// 判断 是否为jit商品
if
(
cartData
.
is_multi_package
===
'Y'
)
{
result
.
isJit
=
true
;
let
jitInfo
=
{};
if
(
orderInfo
)
{
...
...
@@ -302,13 +302,13 @@ function coupon(count, orderInfo, orderComputeData) {
};
if
(
orderComputeData
.
coupon_amount
||
orderComputeData
.
coupon_amount
||
(
orderComputeData
.
coupon_amount
===
0
&&
orderComputeData
.
shipping_cost
===
0
)
)
{
coupons
.
couponName
=
orderInfo
.
couponName
;
}
//选中已使用的优惠劵,则剩余多少张优惠劵,不提示
//
选中已使用的优惠劵,则剩余多少张优惠劵,不提示
if
(
!
coupons
.
couponName
||
coupons
.
count
)
{
coupons
.
isCoupon
=
true
;
}
...
...
Please
register
or
login
to post a comment