Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
M
mayi-mp-shop
Overview
Overview
Details
Activity
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
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
程默
mayi-mp-shop
Commits
3993ffe8
Commit
3993ffe8
authored
Apr 13, 2021
by
程智春
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
修改优惠券格式化
parent
84fa9b90
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
39 additions
and
46 deletions
+39
-46
src/api/promote.js
+5
-0
src/components/activity/coupon.vue
+34
-46
No files found.
src/api/promote.js
View file @
3993ffe8
...
@@ -7,4 +7,8 @@ export default {
...
@@ -7,4 +7,8 @@ export default {
query_single_item_activity_list_by_ids
(
data
)
{
query_single_item_activity_list_by_ids
(
data
)
{
return
requestPOST
(
`
${
process
.
env
.
OLSHOP_URL
}
/promotion/query_single_item_activity_list_by_ids`
,
data
);
return
requestPOST
(
`
${
process
.
env
.
OLSHOP_URL
}
/promotion/query_single_item_activity_list_by_ids`
,
data
);
},
},
// 组件查询优惠券列表
queryCouponIdsList
(
data
)
{
return
requestPOST
(
`
${
process
.
env
.
OLSHOP_URL
}
/promotion/query_coupon_detail_by_ids`
,
data
)
},
};
};
\ No newline at end of file
src/components/activity/coupon.vue
View file @
3993ffe8
...
@@ -11,7 +11,7 @@
...
@@ -11,7 +11,7 @@
<template
v-if=
"datas.componentData.style==4 && datas.componentData.sort == 1"
>
<template
v-if=
"datas.componentData.style==4 && datas.componentData.sort == 1"
>
<div
<div
class=
"coupon-box coupon-box9 clearfix"
class=
"coupon-box coupon-box9 clearfix"
v-for=
"(item,index) in
datas.componentData.
couponList"
v-for=
"(item,index) in couponList"
:key=
"index"
:key=
"index"
>
>
<div
class=
"coupon-sort9"
<div
class=
"coupon-sort9"
...
@@ -75,7 +75,7 @@
...
@@ -75,7 +75,7 @@
<
template
v-if=
"datas.componentData.style==4 && datas.componentData.sort == 2"
>
<
template
v-if=
"datas.componentData.style==4 && datas.componentData.sort == 2"
>
<div
<div
class=
"coupon-box coupon-box8 clearfix"
class=
"coupon-box coupon-box8 clearfix"
v-for=
"(item,index) in
datas.componentData.
couponList"
v-for=
"(item,index) in couponList"
:key=
"index"
:key=
"index"
>
>
<div
class=
"coupon-sort8"
<div
class=
"coupon-sort8"
...
@@ -113,7 +113,7 @@
...
@@ -113,7 +113,7 @@
<
template
v-if=
"datas.componentData.style==4 && datas.componentData.sort == 3"
>
<
template
v-if=
"datas.componentData.style==4 && datas.componentData.sort == 3"
>
<div
<div
class=
"coupon-box coupon-box7 clearfix"
class=
"coupon-box coupon-box7 clearfix"
v-for=
"(item,index) in
datas.componentData.
couponList"
v-for=
"(item,index) in couponList"
:key=
"index"
:key=
"index"
>
>
<div
class=
"coupon-sort7"
<div
class=
"coupon-sort7"
...
@@ -147,7 +147,7 @@
...
@@ -147,7 +147,7 @@
<
template
v-if=
"datas.componentData.style==3 && datas.componentData.sort == 1"
>
<
template
v-if=
"datas.componentData.style==3 && datas.componentData.sort == 1"
>
<div
<div
class=
"coupon-box coupon-box6 clearfix"
class=
"coupon-box coupon-box6 clearfix"
v-for=
"(item,index) in
datas.componentData.
couponList"
v-for=
"(item,index) in couponList"
:key=
"index"
:key=
"index"
>
>
<div
class=
"coupon-sort6"
<div
class=
"coupon-sort6"
...
@@ -216,7 +216,7 @@
...
@@ -216,7 +216,7 @@
<
template
v-if=
"datas.componentData.style==3 && datas.componentData.sort == 2"
>
<
template
v-if=
"datas.componentData.style==3 && datas.componentData.sort == 2"
>
<div
<div
class=
"coupon-box coupon-box5 clearfix"
class=
"coupon-box coupon-box5 clearfix"
v-for=
"(item,index) in
datas.componentData.
couponList"
v-for=
"(item,index) in couponList"
:key=
"index"
:key=
"index"
>
>
<div
class=
"coupon-sort5"
<div
class=
"coupon-sort5"
...
@@ -255,7 +255,7 @@
...
@@ -255,7 +255,7 @@
<
template
v-if=
"datas.componentData.style==3 && datas.componentData.sort == 3"
>
<
template
v-if=
"datas.componentData.style==3 && datas.componentData.sort == 3"
>
<div
<div
class=
"coupon-box coupon-box4 clearfix"
class=
"coupon-box coupon-box4 clearfix"
v-for=
"(item,index) in
datas.componentData.
couponList"
v-for=
"(item,index) in couponList"
:key=
"index"
:key=
"index"
>
>
<div
class=
"coupon-sort4"
<div
class=
"coupon-sort4"
...
@@ -295,7 +295,7 @@
...
@@ -295,7 +295,7 @@
<
template
v-if=
"datas.componentData.style==1 && datas.componentData.sort == 3"
>
<
template
v-if=
"datas.componentData.style==1 && datas.componentData.sort == 3"
>
<div
<div
class=
"coupon-box coupon-box1 clearfix"
class=
"coupon-box coupon-box1 clearfix"
v-for=
"(item,index) in
datas.componentData.
couponList"
v-for=
"(item,index) in couponList"
:key=
"index"
:key=
"index"
>
>
<div
<div
...
@@ -332,7 +332,7 @@
...
@@ -332,7 +332,7 @@
<
template
v-if=
"datas.componentData.style==1 && datas.componentData.sort == 2"
>
<
template
v-if=
"datas.componentData.style==1 && datas.componentData.sort == 2"
>
<div
<div
class=
"coupon-box coupon-box2 clearfix"
class=
"coupon-box coupon-box2 clearfix"
v-for=
"(item,index) in
datas.componentData.
couponList"
v-for=
"(item,index) in couponList"
:key=
"index"
:key=
"index"
>
>
<div
<div
...
@@ -371,7 +371,7 @@
...
@@ -371,7 +371,7 @@
<
template
v-if=
"datas.componentData.style==1 && datas.componentData.sort == 1"
>
<
template
v-if=
"datas.componentData.style==1 && datas.componentData.sort == 1"
>
<div
<div
class=
"coupon-box coupon-box3 clearfix"
class=
"coupon-box coupon-box3 clearfix"
v-for=
"(item,index) in
datas.componentData.
couponList"
v-for=
"(item,index) in couponList"
:key=
"index"
:key=
"index"
>
>
<div
<div
...
@@ -437,6 +437,7 @@
...
@@ -437,6 +437,7 @@
<
script
>
<
script
>
import
coupon
from
'@/api/coupon'
import
coupon
from
'@/api/coupon'
const
app
=
getApp
();
export
default
{
export
default
{
name
:
"coupon"
,
name
:
"coupon"
,
props
:
{
props
:
{
...
@@ -460,63 +461,50 @@ export default {
...
@@ -460,63 +461,50 @@ export default {
couponCode
:
0
,
//优惠券code
couponCode
:
0
,
//优惠券code
couItem
:
""
,
//当前优惠券
couItem
:
""
,
//当前优惠券
showList
:
true
,
//展示优惠券组件
showList
:
true
,
//展示优惠券组件
couponList
:
[]
};
};
},
},
created
(){
onReady
(){
this
.
datas
.
componentData
.
couponList
.
forEach
((
item
,
index
)
=>
{
this
.
getList
();
if
((
item
.
preferentialMoney
-
0
)
%
1
==
0
){
this
.
$set
(
this
.
datas
.
componentData
.
couponList
[
index
],
'preferentialMoney'
,
parseInt
(
item
.
preferentialMoney
))
}
else
{
this
.
$set
(
this
.
datas
.
componentData
.
couponList
[
index
],
'preferentialMoney'
,
parseFloat
(
item
.
preferentialMoney
))
}
if
((
item
.
preferentialDiscount
-
0
)
%
1
==
0
){
this
.
$set
(
this
.
datas
.
componentData
.
couponList
[
index
],
'preferentialDiscount'
,
parseInt
(
item
.
preferentialDiscount
))
}
else
{
this
.
$set
(
this
.
datas
.
componentData
.
couponList
[
index
],
'preferentialDiscount'
,
parseFloat
(
item
.
preferentialDiscount
))
}
this
.
$set
(
this
.
datas
.
componentData
.
couponList
[
index
],
'meetMoneyUse'
,
parseFloat
(
item
.
meetMoneyUse
).
toFixed
(
2
))
})
console
.
log
(
this
.
datas
.
componentData
.
couponList
,
'datas.componentData.couponList1111'
)
},
},
mounted
()
{
mounted
()
{
if
(
this
.
render
)
{
try
{
this
.
$on
(
'getEnvInfo'
,([
val
])
=>
{
console
.
log
(
val
,
'ggggggggggggg'
,
typeof
val
)
this
.
api
=
val
;
this
.
getList
();
})
}
catch
(
error
)
{}
}
else
{
}
},
},
components
:
{},
components
:
{},
methods
:
{
methods
:
{
getList
()
{
getList
()
{
let
query
=
this
.
datas
.
componentData
.
selectionIds
;
let
query
=
this
.
datas
.
componentData
.
selectionIds
;
this
.
api
(
query
).
then
(
res
=>
{
app
.
promoteApi
.
queryCouponIdsList
(
query
).
then
(
res
=>
{
console
.
log
(
res
.
data
.
code
==
'200'
&&
res
.
data
.
data
.
length
!=
0
)
if
(
res
.
code
==
200
&&
res
.
data
.
length
!=
0
)
{
console
.
log
(
res
,
'res..................'
)
res
.
data
.
forEach
(
item
=>
{
if
(
res
.
data
.
code
==
'200'
&&
res
.
data
.
data
.
length
!=
0
)
{
res
.
data
.
data
.
forEach
(
item
=>
{
if
((
item
.
preferentialMoney
-
0
)
%
1
==
0
){
if
((
item
.
preferentialMoney
-
0
)
%
1
==
0
){
item
.
preferentialMoney
=
parseInt
(
item
.
preferentialMoney
)
item
.
preferentialMoney
=
parseInt
(
item
.
preferentialMoney
)
}
else
{
}
else
{
item
.
preferentialMoney
=
parseFloat
(
item
.
preferentialMoney
).
toFixed
(
2
)
item
.
preferentialMoney
=
parseFloat
(
item
.
preferentialMoney
).
toFixed
(
2
)
}
}
if
((
item
.
preferentialDiscount
-
0
)
%
1
==
0
){
item
.
preferentialDiscount
=
parseInt
(
item
.
preferentialDiscount
)
}
else
{
item
.
preferentialDiscount
=
parseFloat
(
item
.
preferentialDiscount
).
toFixed
(
2
)
}
item
.
meetMoneyUse
=
parseFloat
(
item
.
meetMoneyUse
).
toFixed
(
2
)
})
})
this
.
datas
.
componentData
.
couponList
=
res
.
data
.
filter
((
item
,
index
)
=>
{
return
item
.
publicFlag
!=
0
});
if
(
this
.
datas
.
componentData
.
couponList
.
length
==
0
){
console
.
log
(
res
.
data
.
data
,
'res.datada.'
)
this
.
couponList
=
res
.
data
.
data
.
filter
((
item
,
index
)
=>
{
return
item
.
publicFlag
!=
0
});
if
(
this
.
couponList
.
length
==
0
){
console
.
log
(
'hideCoupon'
)
this
.
showList
=
false
;
this
.
showList
=
false
;
}
}
}
else
{
}
else
{
console
.
log
(
'hideCoupon'
)
this
.
showList
=
false
;
this
.
showList
=
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