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
68f22e39
Commit
68f22e39
authored
Feb 21, 2025
by
youjie
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
修复 叠加优惠券
parent
96a4d94f
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
57 additions
and
55 deletions
+57
-55
index.vue
components/coupon/index.vue
+33
-25
jz_Reserve.vue
pages/jiuzhai/jz_Reserve.vue
+24
-30
No files found.
components/coupon/index.vue
View file @
68f22e39
...
@@ -60,35 +60,36 @@
...
@@ -60,35 +60,36 @@
<
script
>
<
script
>
export
default
{
export
default
{
props
:
[
"list"
,
"current"
,
"currentPrice"
,
"order"
,
"multiple"
],
props
:
[
"list"
,
"current"
,
"currentPrice"
,
"order"
],
data
()
{
data
()
{
return
{
return
{
mc
:
""
,
mc
:
""
,
show
:
true
,
show
:
true
,
currentChosen
:
""
,
currentChosen
:
[]
,
value
:
''
,
value
:
''
,
ts
:
[],
ts
:
[],
stacking
:
0
,
stacking
:
0
,
multipleChosen
:
[],
};
};
},
},
mounted
()
{
mounted
()
{
this
.
mc
=
this
.
$uiConfig
.
mainColor
;
this
.
mc
=
this
.
$uiConfig
.
mainColor
;
if
(
this
.
current
)
{
this
.
currentChosen
=
this
.
current
;
this
.
currentChosen
=
this
.
current
;
// this.value = this.current[0]
this
.
value
=
this
.
current
;
}
if
(
this
.
multiple
)
this
.
multipleChosen
=
this
.
multiple
this
.
ts
=
this
.
list
this
.
ts
=
this
.
list
this
.
ts
.
forEach
(
x
=>
{
this
.
ts
.
forEach
(
x
=>
{
x
.
start_time
=
x
.
effectDate
.
split
(
' '
)[
0
].
replace
(
/-/g
,
'.'
)
x
.
start_time
=
x
.
effectDate
.
split
(
' '
)[
0
].
replace
(
/-/g
,
'.'
)
x
.
end_time
=
x
.
expirationDate
.
split
(
' '
)[
0
].
replace
(
/-/g
,
'.'
)
x
.
end_time
=
x
.
expirationDate
.
split
(
' '
)[
0
].
replace
(
/-/g
,
'.'
)
if
(
this
.
multipleChosen
&&
this
.
multiple
Chosen
.
length
>
0
){
if
(
this
.
currentChosen
&&
this
.
current
Chosen
.
length
>
0
){
this
.
multiple
Chosen
.
forEach
(
y
=>
{
this
.
current
Chosen
.
forEach
(
y
=>
{
if
(
x
.
id
==
y
)
{
if
(
x
.
id
==
y
)
{
console
.
log
(
y
,
'===='
)
x
.
checkId
=
y
x
.
checkId
=
y
x
.
check
=
true
x
.
check
=
true
if
(
!
x
.
overlapUse
){
this
.
value
=
y
}
else
{
this
.
value
=
0
this
.
stacking
=
1
}
}
}
})
})
}
}
...
@@ -119,50 +120,57 @@
...
@@ -119,50 +120,57 @@
},
},
popupClose
()
{
popupClose
()
{
if
(
this
.
stacking
==
0
){
if
(
this
.
stacking
==
0
){
if
(
this
.
currentChosen
!=
this
.
current
)
{
if
(
this
.
currentChosen
.
length
>
0
&&
this
.
currentChosen
[
0
]
!=
this
.
current
[
0
])
{
this
.
$emit
(
'close'
,
this
.
currentChosen
)
this
.
$emit
(
'close'
,
this
.
currentChosen
)
}
else
{
}
else
{
this
.
$emit
(
'close'
,
-
1
)
this
.
$emit
(
'close'
,
-
1
)
}
}
}
else
{
}
else
{
if
(
this
.
multiple
Chosen
.
length
>
0
){
if
(
this
.
current
Chosen
.
length
>
0
){
this
.
$emit
(
'close'
,
this
.
multiple
Chosen
)
this
.
$emit
(
'close'
,
this
.
current
Chosen
)
}
else
{
}
else
{
this
.
$emit
(
'close'
,
-
1
)
this
.
$emit
(
'close'
,
-
1
)
}
}
}
}
},
},
// 不可叠加使用优惠券
radioChange
(
e
){
radioChange
(
e
){
this
.
stacking
=
0
if
(
this
.
stacking
)
{
this
.
multipleChosen
=
[]
this
.
currentChosen
=
[]
this
.
stacking
=
0
}
this
.
ts
.
forEach
(
x
=>
{
this
.
ts
.
forEach
(
x
=>
{
x
.
checkId
=
0
x
.
checkId
=
0
x
.
check
=
false
x
.
check
=
false
})
})
if
(
this
.
currentChosen
!=
e
){
if
(
this
.
currentChosen
.
length
==
0
||
(
this
.
currentChosen
.
length
==
1
&&
this
.
currentChosen
[
0
]
!=
e
)
){
this
.
currentChosen
=
e
this
.
currentChosen
=
[
e
]
}
else
{
}
else
{
this
.
currentChosen
=
0
;
this
.
currentChosen
=
0
;
this
.
value
=
0
this
.
value
=
0
}
}
// console.log('---单选',this.currentChosen)
},
},
// 叠加使用优惠券
// 叠加使用优惠券
multipleChoice
(
e
,
i
){
multipleChoice
(
e
,
i
){
this
.
stacking
=
1
this
.
value
=
0
if
(
!
this
.
ts
[
i
].
check
)
this
.
ts
[
i
].
check
=
true
if
(
!
this
.
ts
[
i
].
check
)
this
.
ts
[
i
].
check
=
true
else
this
.
ts
[
i
].
check
=
false
else
this
.
ts
[
i
].
check
=
false
if
(
!
this
.
stacking
)
{
this
.
currentChosen
=
[]
this
.
stacking
=
1
this
.
value
=
0
}
if
(
!
this
.
ts
[
i
].
check
)
{
if
(
!
this
.
ts
[
i
].
check
)
{
this
.
ts
[
i
].
checkId
=
0
this
.
ts
[
i
].
checkId
=
0
this
.
multipleChosen
=
this
.
multiple
Chosen
.
filter
(
x
=>
{
return
x
!=
e
})
this
.
currentChosen
=
this
.
current
Chosen
.
filter
(
x
=>
{
return
x
!=
e
})
}
else
{
}
else
{
this
.
ts
[
i
].
checkId
=
e
this
.
ts
[
i
].
checkId
=
e
let
list
=
this
.
multiple
Chosen
.
findIndex
(
x
=>
x
==
this
.
ts
[
i
].
id
)
let
list
=
this
.
current
Chosen
.
findIndex
(
x
=>
x
==
this
.
ts
[
i
].
id
)
if
(
list
==-
1
)
this
.
multiple
Chosen
.
push
(
e
)
if
(
list
==-
1
)
this
.
current
Chosen
.
push
(
e
)
}
}
console
.
log
(
e
,
'---'
,
this
.
multiple
Chosen
)
// console.log(e,'---多选',this.current
Chosen)
}
}
},
},
};
};
...
...
pages/jiuzhai/jz_Reserve.vue
View file @
68f22e39
...
@@ -314,7 +314,7 @@
...
@@ -314,7 +314,7 @@
<view
style=
"font-size: 12px;width:1px;flex:1"
>
请选择优惠券
</view>
<view
style=
"font-size: 12px;width:1px;flex:1"
>
请选择优惠券
</view>
<view
style=
"display: flex;align-items: center;"
>
<view
style=
"display: flex;align-items: center;"
>
<text
style=
"color:#F20707;font-size: 12px;"
@
click=
"showCouponHandler"
>
<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.length
== 0 &&couponList.length>0"
>
{{
couponList
.
length
}}
张可用优惠券
</text>
<text
class=
"content"
style=
"color:grey"
v-else-if=
"couponList.length==0"
>
暂无优惠券
</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>
<text
class=
"content"
v-else
:style=
"
{ color: mainColor }">已优惠
{{
currentCoupon
.
discountMoney
}}
元
</text>
<!--
<u-icon
name=
"ellipsis"
size=
"36"
v-if=
"couponList.length > 0"
></u-icon>
-->
<!--
<u-icon
name=
"ellipsis"
size=
"36"
v-if=
"couponList.length > 0"
></u-icon>
-->
...
@@ -402,7 +402,7 @@
...
@@ -402,7 +402,7 @@
<view
style=
"text-align: right"
>
{{
orderMsg
.
ManNum
+
orderMsg
.
ChirdNum
,
}}
人 × ¥
{{
currentPriceInfo
.
visaPrice
}}
</view>
<view
style=
"text-align: right"
>
{{
orderMsg
.
ManNum
+
orderMsg
.
ChirdNum
,
}}
人 × ¥
{{
currentPriceInfo
.
visaPrice
}}
</view>
</view>
</view>
<view
class=
"flex f12 grey"
style=
"margin-bottom: 40rpx"
:style=
"
{'color':mainColor+' !important'}" v-if="useCouponId>0">
<view
class=
"flex f12 grey"
style=
"margin-bottom: 40rpx"
:style=
"
{'color':mainColor+' !important'}" v-if="useCouponId
s.length
>0">
<view
style=
"flex: 1"
>
<view
style=
"flex: 1"
>
<text
style=
"margin-right: 30rpx"
>
优惠券
</text>
<text
style=
"margin-right: 30rpx"
>
优惠券
</text>
</view>
</view>
...
@@ -424,8 +424,7 @@
...
@@ -424,8 +424,7 @@
<view
class=
"empty-block"
></view>
<view
class=
"empty-block"
></view>
<coupon
v-if=
"couponList.length > 0 && showCoupon"
<coupon
v-if=
"couponList.length > 0 && showCoupon"
:list=
"couponList"
:list=
"couponList"
:current=
"useCouponId"
:current=
"useCouponIds"
:multiple=
"multipleChosenIds"
@
close=
"closeCouponHandler"
@
close=
"closeCouponHandler"
:current-price=
"realCurrentPriceInfo"
:order=
"orderMsg"
></coupon>
:current-price=
"realCurrentPriceInfo"
:order=
"orderMsg"
></coupon>
<view
style=
"padding: 50rpx 40rpx"
v-if=
"tips != ''"
>
<view
style=
"padding: 50rpx 40rpx"
v-if=
"tips != ''"
>
...
@@ -525,7 +524,7 @@
...
@@ -525,7 +524,7 @@
GuestList
:
[],
GuestList
:
[],
couponList
:
[],
couponList
:
[],
showCoupon
:
false
,
showCoupon
:
false
,
useCouponId
:
0
,
useCouponId
s
:
[]
,
currentCoupon
:
{
currentCoupon
:
{
discountMoney
:
0
discountMoney
:
0
},
},
...
@@ -535,7 +534,6 @@
...
@@ -535,7 +534,6 @@
CreateBy
:
0
,
CreateBy
:
0
,
showPz
:
false
,
showPz
:
false
,
pzCoupon
:
null
,
pzCoupon
:
null
,
multipleChosenIds
:
[],
};
};
},
},
created
()
{
created
()
{
...
@@ -578,12 +576,12 @@
...
@@ -578,12 +576,12 @@
},
},
closeCouponHandler
(
e
)
{
closeCouponHandler
(
e
)
{
if
(
e
!=
-
1
)
{
if
(
e
!=
-
1
)
{
if
(
e
instanceof
Array
){
//叠加使用优惠券
this
.
useCouponIds
=
e
;
this
.
multipleChosenIds
=
e
console
.
log
(
this
.
useCouponIds
,
'=========='
)
//叠加使用优惠券
let
TotalDiscountAmount
=
0
let
TotalDiscountAmount
=
0
this
.
useCouponId
=
1
this
.
couponList
.
forEach
(
x
=>
{
this
.
couponList
.
forEach
(
x
=>
{
let
findIndex
=
this
.
multipleChose
nIds
.
findIndex
(
y
=>
x
.
id
==
y
)
let
findIndex
=
this
.
useCoupo
nIds
.
findIndex
(
y
=>
x
.
id
==
y
)
if
(
findIndex
!=-
1
){
if
(
findIndex
!=-
1
){
let
discountMoney
=
0
let
discountMoney
=
0
if
(
x
.
couponsType
==
1
){
if
(
x
.
couponsType
==
1
){
...
@@ -597,24 +595,22 @@
...
@@ -597,24 +595,22 @@
})
})
if
(
TotalDiscountAmount
)
this
.
currentCoupon
.
discountMoney
=
TotalDiscountAmount
if
(
TotalDiscountAmount
)
this
.
currentCoupon
.
discountMoney
=
TotalDiscountAmount
else
this
.
currentCoupon
.
discountMoney
=
0
else
this
.
currentCoupon
.
discountMoney
=
0
}
else
{
this
.
useCouponId
=
e
;
// if(this.useCouponIds.length==0){
if
(
this
.
useCouponId
){
// this.currentCoupon = this.couponList.find(x => x.id == this.useCouponIds)
this
.
currentCoupon
=
this
.
couponList
.
find
(
x
=>
x
.
id
==
this
.
useCouponId
)
// if (this.currentCoupon.couponsType == 1) {
if
(
this
.
currentCoupon
.
couponsType
==
1
)
{
// this.currentCoupon.discountMoney = this.currentCoupon.denomination
this
.
currentCoupon
.
discountMoney
=
this
.
currentCoupon
.
denomination
// } else {
}
else
{
// this.currentCoupon.discountMoney = (parseFloat(this.price) * (1 - parseFloat(this.currentCoupon.denomination / 10)))
this
.
currentCoupon
.
discountMoney
=
(
parseFloat
(
this
.
price
)
*
(
1
-
parseFloat
(
this
.
currentCoupon
.
denomination
/
10
)))
// .toFixed(2)
.
toFixed
(
2
)
// }
}
// }else{
}
else
{
// this.currentCoupon.discountMoney = 0
this
.
currentCoupon
.
discountMoney
=
0
// }
}
}
}
else
{
}
else
{
this
.
multipleChosenIds
=
[]
this
.
currentCoupon
.
discountMoney
=
0
this
.
currentCoupon
.
discountMoney
=
0
this
.
useCouponId
=
0
this
.
useCouponId
s
=
[]
}
}
this
.
showCoupon
=
false
;
this
.
showCoupon
=
false
;
},
},
...
@@ -885,10 +881,8 @@
...
@@ -885,10 +881,8 @@
price
=
this
.
currentPriceInfo
.
b2CPrice
;
price
=
this
.
currentPriceInfo
.
b2CPrice
;
}
}
let
CouponAllotIds
=
''
let
CouponAllotIds
=
''
if
(
this
.
multipleChosenIds
.
length
>
0
){
if
(
this
.
useCouponIds
.
length
>
0
){
CouponAllotIds
=
this
.
multipleChosenIds
.
join
(
','
)
CouponAllotIds
=
this
.
useCouponIds
.
join
(
','
)
}
else
{
CouponAllotIds
=
this
.
useCouponId
>
0
?
this
.
currentCoupon
.
id
.
toString
()
:
''
}
}
let
msg
=
{
let
msg
=
{
OrderId
:
0
,
OrderId
:
0
,
...
...
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