Skip to content
Toggle navigation
Projects
Groups
Snippets
Help
saas_plus
/
dj-car-life-h5-ailipay
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Settings
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit f6c2130b
authored
Feb 23, 2022
by
李伟康
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
commit
1 parent
ea1a1f19
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
92 additions
and
63 deletions
src/assets/css/gift-detail.scss
src/views/gift/create.vue
src/views/gift/detail.vue
src/assets/css/gift-detail.scss
View file @
f6c2130
...
...
@@ -48,7 +48,6 @@
.detail
{
border-bottom
:
1px
solid
rgba
(
195
,
195
,
195
,
0
.3
);
position
:
relative
;
&
:last-of-type
{
border-bottom
:
none
;
}
...
...
@@ -60,13 +59,14 @@
font-size
:
12px
;
color
:
#333333
;
padding
:
12px
5px
;
position
:
relative
;
&
:last-of-type
{
border-bottom
:
none
;
}
.name
{
font-size
:
14px
;
&
-tips
{
margin-left
:
8px
;
width
:
46px
;
...
...
@@ -98,22 +98,20 @@
padding
:
0
12px
;
display
:
inline-flex
;
}
.del
{
.del
{
position
:
absolute
;
top
:
8
px
;
right
:
0
;
top
:
14
px
;
right
:
2px
;
}
.coupon-disabled
{
.detail-list
{
color
:
#999999
;
color
:
#999999
;
.num
{
color
:
#999999
;
}
.num
{
color
:
#999999
;
}
.price
{
color
:
#999999
;
}
.price
{
color
:
#999999
;
}
}
}
...
...
@@ -225,7 +223,8 @@
box-sizing
:
border-box
;
height
:
100px
;
}
.van-field--min-height
.van-field__control
{
.van-field--min-height
.van-field__control
{
height
:
82px
;
}
}
...
...
src/views/gift/create.vue
View file @
f6c2130
...
...
@@ -37,32 +37,37 @@
</div>
<template
v-if=
"obj.couponList && obj.couponList.length"
>
<div
class=
"detail-box"
>
<template
v-for=
"(i,index) in obj.couponList"
>
<template
v-for=
"(i,index) in obj.couponList
View
"
>
<div
:class=
"['detail',
{'coupon-disabled':i.status != 2}]
"
class=
"detail
"
:key=
"index"
>
<!-- status 优惠券状态(1:未生效,2:生效中,3:已失效) -->
<!-- 优惠券类型 1:满减券,2:折扣券,3:代金券,4:兑换券 5:购车代金券 6:商品折扣券,7:会员服务 -->
<span
class=
"detail-title text-center"
>
{{
discountEnum
[
i
.
discountType
]
}}
</span>
<div
class=
"detail-list"
>
<div
class=
"name flex"
>
{{
i
.
couponName
}}
<template
v-if=
"i.status != 2"
>
<div
class=
"name-tips text-center"
>
{{
{
1
:
'未生效'
,
3
:
'已失效'
}
[
i
.
status
]
}}
<
/div
>
<template
v-for=
"(e,ind) in i.list"
>
<div
:class=
"['detail-list',
{'coupon-disabled':e.status != 2
&&
obj.receivedFlag != 2}]"
:key="ind"
>
<div
class=
"name flex"
>
{{
e
.
couponName
}}
<template
v-if=
"e.status != 2 && obj.receivedFlag != 2"
>
<div
class=
"name-tips text-center"
>
{{
{
1
:
'未生效'
,
3
:
'已失效'
}
[
e
.
status
]
}}
<
/div
>
<
/template
>
<
/div
>
<
div
class
=
"num flex"
>
数量:
x
{{
i
.
couponAmount
}}
<
div
class
=
"price"
>
¥
{{
centsToyuan
(
i
.
couponAnticipatedCost
*
i
.
couponAmount
)
}}
<
/div
>
数量:
x
{{
e
.
couponAmount
}}
<
div
class
=
"price"
>
¥
{{
centsToyuan
(
e
.
couponAnticipatedCost
*
e
.
couponAmount
)
}}
<
/div
>
<
/div
>
<
div
class
=
"del sprite-icon icon-gift-del"
@
click
=
"delCoupon(e)"
><
/div
>
<
/div
>
<
div
class
=
"del sprite-icon icon-gift-del"
@
click
=
"delCoupon(index)"
><
/div
>
<
/template>
<
/div
>
<
/template
>
<
/div
>
<
/template
>
<
div
:
class
=
"
[
'add-box text-center'
,{
'add-line'
:
obj
.
couponList
.
length
>
0
}
]
">
<
div
:
class
=
"
[
'add-box text-center'
,{
'add-line'
:
obj
.
couponList
.
length
}
]
">
<div
class="
add
-
btn
text
-
center
"
@click="
showGiftModal
"
...
...
@@ -162,20 +167,33 @@ export default {
if
(
i
&&
i
.
key
==
'vin'
)
this
.
obj
[
i
.
key
]
=
e
.
replace
(
/
[^
0-9a-zA-Z
]
/g
,
''
)
this
.
checkData
()
}
,
getDetail
(
id
)
{
setCouponData
(
res
)
{
let
total
=
0
let
discountTypeList
=
Array
.
from
(
new
Set
([...
res
.
couponList
.
map
(
e
=>
e
.
discountType
)]))
res
.
couponListView
=
discountTypeList
.
map
(
i
=>
{
let
list
=
[]
res
.
couponList
.
map
(
e
=>
{
if
(
e
.
status
==
2
)
total
+=
e
.
couponAnticipatedCost
*
e
.
couponAmount
if
(
i
==
e
.
discountType
)
list
.
push
(
e
)
}
)
return
{
discountType
:
i
,
list
}
}
)
this
.
total
=
total
return
res
}
,
getDetail
(
id
)
{
let
{
radioObj
}
=
this
giftApi
.
getGiftDetail
(
id
).
then
(
res
=>
{
this
.
hideLoading
()
res
.
couponList
.
length
&&
res
.
couponList
.
map
(
e
=>
{
if
(
e
.
status
==
2
)
total
+=
e
.
couponAnticipatedCost
*
e
.
couponAmount
}
)
res
=
this
.
setCouponData
(
res
)
this
.
flag
=
true
radioObj
.
map
(
e
=>
e
.
active
=
false
)
if
(
res
.
receiveWay
==
1
)
res
.
phone
=
res
.
receiveDetails
else
res
.
vin
=
res
.
receiveDetails
this
.
obj
=
res
this
.
total
=
total
this
.
checkData
()
}
)
}
,
...
...
@@ -190,12 +208,8 @@ export default {
this
.
$refs
.
GiftModal
.
toggle
()
}
,
couponConfirm
({
chooseItems
}
)
{
let
total
=
0
chooseItems
.
map
(
i
=>
{
if
(
i
.
status
==
2
)
total
+=
i
.
couponAnticipatedCost
*
i
.
couponAmount
}
)
this
.
obj
.
couponList
=
JSON
.
parse
(
JSON
.
stringify
(
chooseItems
))
this
.
total
=
total
this
.
obj
=
this
.
setCouponData
(
this
.
obj
)
this
.
checkData
()
}
,
checkData
()
{
...
...
@@ -222,15 +236,15 @@ export default {
}
this
.
disabled
=
false
}
,
delCoupon
(
index
)
{
delCoupon
(
e
)
{
let
{
obj
:
{
couponList
}
}
=
this
let
total
=
0
let
index
=
null
couponList
.
map
((
i
,
ind
)
=>
{
if
(
i
.
discountType
==
e
.
discountType
&&
i
.
couponId
==
e
.
couponId
)
index
=
ind
}
)
couponList
.
splice
(
index
,
1
)
this
.
obj
.
couponList
=
couponList
couponList
.
map
(
i
=>
{
if
(
i
.
status
==
2
)
total
+=
i
.
couponAnticipatedCost
*
i
.
couponAmount
}
)
this
.
total
=
total
this
.
obj
=
this
.
setCouponData
(
this
.
obj
)
this
.
checkData
()
}
,
submit
()
{
...
...
src/views/gift/detail.vue
View file @
f6c2130
...
...
@@ -44,35 +44,38 @@
<div
class=
"label"
>
礼包明细
</div>
<div
class=
"value"
>
预估成本:
<span>
¥{{centsToyuan(total)}}
</span></div>
</div>
<
template
v-if=
"obj.couponList && obj.couponList.length"
>
<div
class=
"detail-box"
>
<template
v-for=
"(i,index) in obj.couponList"
>
<div
:class=
"['detail',
{'coupon-disabled':i.status != 2
&&
obj.receivedFlag != 2}]"
:key="index"
>
<!-- status 优惠券状态(1:未生效,2:生效中,3:已失效) -->
<!-- 优惠券类型 1:满减券,2:折扣券,3:代金券,4:兑换券 5:购车代金券 6:商品折扣券,7:会员服务 -->
<span
class=
"detail-title text-center"
>
{{
discountEnum
[
i
.
discountType
]
}}
</span>
<div
class=
"detail-list"
>
<div
class=
"detail-box"
>
<
template
v-for=
"(i,index) in obj.couponListView"
>
<div
class=
"detail"
:key=
"index"
>
<!-- status 优惠券状态(1:未生效,2:生效中,3:已失效) -->
<!-- 优惠券类型 1:满减券,2:折扣券,3:代金券,4:兑换券 5:购车代金券 6:商品折扣券,7:会员服务 -->
<span
class=
"detail-title text-center"
>
{{
discountEnum
[
i
.
discountType
]
}}
</span>
<template
v-for=
"(e,ind) in i.list"
>
<div
:class=
"['detail-list',
{'coupon-disabled':e.status != 2
&&
obj.receivedFlag != 2}]"
:key="ind"
>
<div
class=
"name flex"
>
{{
i
.
couponName
}}
<template
v-if=
"
i
.status != 2 && obj.receivedFlag != 2"
>
<div
class=
"name-tips text-center"
>
{{
{
1
:
'未生效'
,
3
:
'已失效'
}
[
i
.
status
]
}}
<
/div
>
{{
e
.
couponName
}}
<template
v-if=
"
e
.status != 2 && obj.receivedFlag != 2"
>
<div
class=
"name-tips text-center"
>
{{
{
1
:
'未生效'
,
3
:
'已失效'
}
[
e
.
status
]
}}
<
/div
>
<
/template
>
<
/div
>
<
div
class
=
"num flex"
>
数量:
x
{{
i
.
couponAmount
}}
<
div
class
=
"price"
>
¥
{{
centsToyuan
(
i
.
couponAnticipatedCost
*
i
.
couponAmount
)
}}
<
/div
>
数量:
x
{{
e
.
couponAmount
}}
<
div
class
=
"price"
>
¥
{{
centsToyuan
(
e
.
couponAnticipatedCost
*
e
.
couponAmount
)
}}
<
/div
>
<
/div
>
<
/div
>
<
/template>
<!--
<
template
v
-
if
=
"i.status != 2 && obj.receivedFlag != 2"
>
<
div
class
=
"del sprite-icon icon-gift-del"
@
click
=
"changeGift"
><
/div
>
<
/template> --
>
<
/div
>
<
/template
>
<
/div
>
<
/template
>
<
/div
>
<
div
class
=
"box readonly-box"
>
<
div
class
=
"title"
>
领取条件
<
/div
>
...
...
@@ -115,17 +118,30 @@ export default {
this
.
getDetail
()
}
,
methods
:
{
setCouponData
(
res
)
{
let
total
=
0
let
discountTypeList
=
Array
.
from
(
new
Set
([...
res
.
couponList
.
map
(
e
=>
e
.
discountType
)]))
res
.
couponListView
=
discountTypeList
.
map
(
i
=>
{
let
list
=
[]
res
.
couponList
.
map
(
e
=>
{
if
(
e
.
status
==
2
)
total
+=
e
.
couponAnticipatedCost
*
e
.
couponAmount
if
(
i
==
e
.
discountType
)
list
.
push
(
e
)
}
)
return
{
discountType
:
i
,
list
}
}
)
this
.
total
=
total
return
res
}
,
getDetail
()
{
let
{
id
}
=
this
.
getQuery
()
let
total
=
0
giftApi
.
getGiftDetail
(
id
).
then
(
res
=>
{
this
.
hideLoading
()
res
.
couponList
.
length
&&
res
.
couponList
.
map
(
e
=>
{
if
(
e
.
status
==
2
)
total
+=
e
.
couponAnticipatedCost
*
e
.
couponAmount
}
)
res
=
this
.
setCouponData
(
res
)
this
.
flag
=
true
this
.
obj
=
res
this
.
total
=
total
}
)
}
,
changeGift
()
{
...
...
Write
Preview
Markdown
is supported
Attach a file
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 post a comment