Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
J
jz_Travel
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
zhengke
jz_Travel
Commits
77a9e36b
Commit
77a9e36b
authored
Feb 21, 2025
by
youjie
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
叠加券优化
parent
b0a96eb9
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
58 additions
and
16 deletions
+58
-16
index.vue
components/coupon/index.vue
+34
-1
visa_Reserve.vue
pages/visa/visa_Reserve.vue
+24
-15
No files found.
components/coupon/index.vue
View file @
77a9e36b
...
...
@@ -69,6 +69,8 @@
value
:
''
,
ts
:
[],
stacking
:
0
,
TotalDiscounts
:
0
,
money
:
0
,
};
},
mounted
()
{
...
...
@@ -95,6 +97,7 @@
}
})
this
.
OverlayCalculation
()
this
.
checkOrderCoupon
()
},
methods
:
{
...
...
@@ -129,7 +132,7 @@
}
else
{
this
.
$emit
(
'close'
,
-
1
)
}
console
.
log
(
this
.
currentChosen
,
'-----'
)
//
console.log(this.currentChosen,'-----')
},
// 不可叠加使用优惠券
radioChange
(
e
){
...
...
@@ -147,6 +150,7 @@
this
.
currentChosen
=
[];
this
.
value
=
0
}
this
.
OverlayCalculation
()
},
// 叠加使用优惠券
multipleChoice
(
e
,
i
){
...
...
@@ -165,6 +169,35 @@
let
list
=
this
.
currentChosen
.
findIndex
(
x
=>
x
==
this
.
ts
[
i
].
id
)
if
(
list
==-
1
)
this
.
currentChosen
.
push
(
e
)
}
this
.
OverlayCalculation
()
},
OverlayCalculation
(){
if
(
this
.
currentChosen
.
length
==
0
){
this
.
TotalDiscounts
=
0
this
.
money
=
0
this
.
ts
.
forEach
(
x
=>
{
if
(
x
.
overlapUse
&&
x
.
err
){
x
.
err
=
null
}
})
return
}
let
alreadyStacked
=
this
.
ts
.
filter
(
x
=>
{
return
x
.
check
})
alreadyStacked
.
forEach
(
x
=>
{
this
.
TotalDiscounts
+=
x
.
denomination
this
.
money
=
this
.
price
-
this
.
TotalDiscounts
})
this
.
ts
.
forEach
(
x
=>
{
if
(
x
.
overlapUse
){
if
(
!
x
.
check
&&
x
.
denomination
>
this
.
money
){
x
.
err
=
'订单金额不满足'
}
else
{
x
.
err
=
null
}
}
})
}
},
};
...
...
pages/visa/visa_Reserve.vue
View file @
77a9e36b
...
...
@@ -653,7 +653,7 @@
<view
style=
"font-size: 12px;width:1px;flex:1"
>
请选择优惠券
</view>
<view
style=
"display: flex;align-items: center;"
>
<text
style=
"color:#F20707;font-size: 12px;"
@
click=
"showCouponHandler"
>
<text
style=
"flex: 1;"
v-if=
"useCouponId == 0 &&couponList.length>0"
>
{{
couponList
.
length
}}
张可用优惠券
</text>
<text
style=
"flex: 1;"
v-if=
"useCouponId
s
== 0 &&couponList.length>0"
>
{{
couponList
.
length
}}
张可用优惠券
</text>
<text
class=
"content"
style=
"color:grey"
v-else-if=
"couponList.length==0"
>
暂无优惠券
</text>
<text
class=
"content"
v-else
:style=
"
{ color: mainColor }">已优惠
{{
currentCoupon
.
discountMoney
}}
元
</text>
<!--
<u-icon
name=
"ellipsis"
size=
"36"
v-if=
"couponList.length > 0"
></u-icon>
-->
...
...
@@ -667,7 +667,7 @@
<view
class=
"empty-block"
></view>
</
template
>
<coupon
v-if=
"couponList.length > 0 && showCoupon"
:
list=
"couponList"
:current=
"useCouponId
"
@
close=
"closeCouponHandler"
:current-price=
"realCurrentPriceInfo"
:order=
"orderMsg"
></coupon>
<coupon
v-if=
"couponList.length > 0 && showCoupon"
:
price=
"price"
:list=
"couponList"
:current=
"useCouponIds
"
@
close=
"closeCouponHandler"
:current-price=
"realCurrentPriceInfo"
:order=
"orderMsg"
></coupon>
<view
style=
"padding: 50rpx 40rpx"
v-if=
"tips != ''"
>
<view
class=
"big-title"
>
<text>
重要提示
</text>
...
...
@@ -780,7 +780,7 @@
GuestList
:
[],
couponList
:
[],
showCoupon
:
false
,
useCouponId
:
0
,
useCouponId
s
:
[]
,
currentCoupon
:
{
discountMoney
:
0
},
...
...
@@ -973,18 +973,27 @@
},
closeCouponHandler
(
e
)
{
if
(
e
!=
-
1
)
{
this
.
useCouponId
=
e
;
if
(
this
.
useCouponId
){
this
.
currentCoupon
=
this
.
couponList
.
find
(
x
=>
x
.
id
==
this
.
useCouponId
)
if
(
this
.
currentCoupon
.
couponsType
==
1
)
{
this
.
currentCoupon
.
discountMoney
=
this
.
currentCoupon
.
denomination
}
else
{
this
.
currentCoupon
.
discountMoney
=
(
parseFloat
(
this
.
price
)
*
(
1
-
parseFloat
(
this
.
currentCoupon
.
denomination
/
10
)))
.
toFixed
(
2
)
}
}
else
{
this
.
currentCoupon
.
discountMoney
=
0
}
this
.
useCouponIds
=
e
;
//叠加使用优惠券
let
TotalDiscountAmount
=
0
this
.
couponList
.
forEach
(
x
=>
{
let
findIndex
=
this
.
useCouponIds
.
findIndex
(
y
=>
x
.
id
==
y
)
if
(
findIndex
!=-
1
){
let
discountMoney
=
0
if
(
x
.
couponsType
==
1
){
discountMoney
=
x
.
denomination
}
else
{
discountMoney
=
(
parseFloat
(
this
.
price
)
*
(
1
-
parseFloat
(
x
.
denomination
/
10
)))
.
toFixed
(
2
)
}
TotalDiscountAmount
+=
discountMoney
}
})
if
(
TotalDiscountAmount
)
this
.
currentCoupon
.
discountMoney
=
TotalDiscountAmount
else
this
.
currentCoupon
.
discountMoney
=
0
}
else
{
this
.
currentCoupon
.
discountMoney
=
0
this
.
useCouponIds
=
[]
}
this
.
showCoupon
=
false
;
},
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment