Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in / Register
Toggle navigation
Y
ybf
Project
Project
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
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
xulili
ybf
Commits
920c80e0
Commit
920c80e0
authored
Apr 14, 2020
by
leiqingsong
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
活动模板接口
parent
1309cfee
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
507 additions
and
241 deletions
+507
-241
active.js
wx_application/src/api/active.js
+33
-0
activeList.vue
wx_application/src/views/active/activeList.vue
+72
-57
createActive.vue
wx_application/src/views/active/createActive.vue
+124
-34
createBigWheelActive.vue
wx_application/src/views/active/createBigWheelActive.vue
+115
-18
createSuccess.vue
wx_application/src/views/active/createSuccess.vue
+19
-2
more.vue
wx_application/src/views/active/more.vue
+0
-20
index.vue
wx_application/src/views/mainSale/active/template/index.vue
+144
-110
No files found.
wx_application/src/api/active.js
View file @
920c80e0
...
...
@@ -88,4 +88,37 @@ export function collectMyCoupon(params) {
method
:
`get`
,
params
})
}
/**
* 保存模板
*/
export
function
saveTemplate
(
params
)
{
return
request
({
url
:
'template/save'
,
method
:
'post'
,
data
:
params
})
}
/**
* 获取模板
* @param {*} params
*/
export
function
getTemplate
(
params
)
{
return
request
({
url
:
`template/list`
,
method
:
'post'
,
params
})
}
/**
* 获取模板详情
*/
export
function
getTemplateData
(
id
)
{
return
request
({
url
:
`template/getTemplate?templateId=
${
id
}
`
,
method
:
'post'
})
}
\ No newline at end of file
wx_application/src/views/active/activeList.vue
View file @
920c80e0
<
template
>
<div
class=
"container"
>
<div
class=
"title"
>
<div
v-if=
"wheelList.length > 0"
class=
"title"
>
<span>
大转盘抽奖
</span>
</div>
<div
class=
"active"
>
<template
v-for=
"(item, index) in
active
List"
>
<template
v-for=
"(item, index) in
wheel
List"
>
<div
v-if=
"index
<
wheelActive
_limit
"
class=
"list"
...
...
@@ -22,8 +22,8 @@
</
template
>
<span
class=
"more"
v-if=
"
activeList.length && !active
List_finished"
@
click=
"handle
WheelActiveMore
"
v-if=
"
wheelList.length && !wheel
List_finished"
@
click=
"handle
ActiveMore('wheel')
"
>
查看更多
<span
class=
"icon"
>
>
</span>
...
...
@@ -31,18 +31,25 @@
</div>
<div
v-if=
"couponList.length > 0"
class=
"fg"
>
送券活动
</div>
<div
class=
"active"
>
<div
class=
"list"
v-for=
"item in couponList"
:key=
"item.id"
@
click=
"toDetail(item.id, item.activityType)"
>
<div
class=
"left"
></div>
<div
class=
"right"
>
<h3>
{{ item.activityName }}
</h3>
<p>
{{ item.des }}
</p>
<
template
v-for=
"(item, index) in couponList"
>
<div
v-if=
"index
<
couponActive
_limit
"
class=
"list"
:key=
"item.id"
@
click=
"toDetail(item.id, item.activityType)"
>
<div
class=
"left"
>
<img
:src=
"item.logo"
alt=
"logo"
style=
"width:100%;height:100%;"
/>
</div>
<div
class=
"right"
>
<h3>
{{
item
.
activityName
}}
</h3>
<p>
{{
item
.
des
}}
</p>
</div>
</div>
</div>
</
template
>
<span
class=
"more"
v-if=
"couponList.length && !couponList_finished"
@
click=
"handleActiveMore('coupon')"
>
查看更多
<span
class=
"icon"
>
>
</span>
</span>
</div>
</div>
</template>
...
...
@@ -53,58 +60,66 @@ export default {
data
()
{
return
{
wheelActive_limit
:
3
,
activeList_finished
:
false
,
activeList
:
[
{
id
:
1
,
activityType
:
"coupon"
,
activityName
:
"砍价"
,
des
:
"由各种物质组成的巨型球状天体,叫做星球。星球有一定的形状。"
},
{
id
:
2
,
activityType
:
"wheel"
,
activityName
:
"集赞"
,
des
:
"由各种物质组成的巨型球状天体,叫做星球。星球有一定的形状。"
}
],
couponList
:
[
{
id
:
1
,
activityType
:
"coupon"
,
activityName
:
"砍价"
,
des
:
"由各种物质组成的巨型球状天体,叫做星球。星球有一定的形状。"
},
{
id
:
2
,
activityType
:
"wheel"
,
activityName
:
"集赞"
,
des
:
"由各种物质组成的巨型球状天体,叫做星球。星球有一定的形状。"
}
],
params
:
{
wheelList_finished
:
false
,
couponActive_limit
:
3
,
couponList_finished
:
false
,
wheelList
:
[],
couponList
:
[],
wheel_params
:
{
pageNo
:
1
,
pageSize
:
3
},
coupon_params
:
{
pageNo
:
1
,
pageSize
:
10
pageSize
:
3
}
};
},
mounted
()
{
this
.
getActiveList
(
this
.
params
);
this
.
getWheelActive
();
this
.
getCouponActive
();
},
methods
:
{
handleWheelActiveMore
()
{
this
.
wheelActive_limit
+=
3
;
if
(
this
.
wheelActive_limit
===
this
.
activeList
.
length
-
3
)
{
this
.
activeList_finished
=
true
;
return
;
async
getCouponActive
()
{
let
res
=
await
this
.
getActiveList
(
"coupon"
);
this
.
couponList
.
push
.
apply
(
this
.
couponList
,
res
.
data
.
list
);
if
(
res
.
data
.
list
===
[])
{
this
.
couponList_finished
=
true
}
},
async
getWheelActive
()
{
let
res
=
await
this
.
getActiveList
(
"wheel"
);
this
.
wheelList
.
push
.
apply
(
this
.
wheelList
,
res
.
data
.
list
);
if
(
res
.
data
.
list
===
[])
{
this
.
wheelList_finished
=
true
}
},
handleActiveMore
(
type
)
{
if
(
type
===
"wheel"
)
{
this
.
wheelActive_limit
+=
3
;
this
.
wheel_params
.
pageNo
+=
1
;
this
.
getWheelActive
();
}
else
if
(
type
===
"coupon"
)
{
this
.
couponActive_limit
+=
3
;
this
.
coupon_params
.
pageNo
+=
1
;
this
.
getCouponActive
()
}
},
// 获取 活动列表
getActiveList
(
params
)
{
API_Active
.
getActiveList
(
params
).
then
(
res
=>
{
console
.
log
(
"获取到数据"
);
this
.
activeList
=
res
.
data
.
list
;
});
async
getActiveList
(
type
)
{
let
page_params
=
{};
if
(
type
===
'wheel'
)
{
page_params
=
this
.
wheel_params
;
}
else
if
(
type
===
'coupon'
)
{
page_params
=
this
.
coupon_params
;
}
let
params
=
{
activityType
:
type
,
...
page_params
};
let
res
=
await
API_Active
.
getActiveList
(
params
);
return
res
;
},
// 跳转到 活动详情
toDetail
(
active_id
,
type
)
{
...
...
wx_application/src/views/active/createActive.vue
View file @
920c80e0
...
...
@@ -2,12 +2,12 @@
<div
class=
"container"
>
<div
class=
"title"
>
活动设置
</div>
<van-cell-group
class=
"all"
>
<van-cell
title=
"活动标题"
style=
"font-size:14px;"
>
<van-cell
:required=
"true"
title=
"活动标题"
style=
"font-size:14px;"
>
<template
slot=
"default"
>
<van-field
v-model=
"title"
placeholder=
"请输入活动标题"
class=
"right"
style=
"font-size:14px;"
/>
</
template
>
</van-cell>
<van-cell
title=
"活动开始时间"
style=
"font-size:14px;"
>
<van-cell
:required=
"true"
title=
"活动开始时间"
style=
"font-size:14px;"
>
<
template
slot=
"default"
>
<div
class=
"nobr"
>
<van-field
...
...
@@ -20,7 +20,7 @@
<van-popup
v-model=
"startShow"
position=
"bottom"
:overlay=
"true"
>
<van-datetime-picker
v-model=
"startTime"
type=
"date"
type=
"date
time
"
@
cancel=
"startShow = false"
@
confirm=
"handleStartTime"
@
change=
"startTimeChange"
...
...
@@ -29,7 +29,7 @@
</div>
</
template
>
</van-cell>
<van-cell
title=
"活动结束时间"
style=
"font-size:14px;"
>
<van-cell
:required=
"true"
title=
"活动结束时间"
style=
"font-size:14px;"
>
<
template
slot=
"default"
>
<div
class=
"jpsl"
>
<van-field
...
...
@@ -42,7 +42,7 @@
<van-popup
v-model=
"endShow"
position=
"bottom"
:overlay=
"true"
>
<van-datetime-picker
v-model=
"endTime"
type=
"date"
type=
"date
time
"
@
cancel=
"endShow = false"
@
confirm=
"handleEndTime"
@
change=
"endTimeChange"
...
...
@@ -54,10 +54,10 @@
<van-cell
title=
"背景图片"
style=
"font-size: 14px"
>
<van-uploader
v-model=
"bg_imgs"
:max-count=
"1"
:after-read=
"afterBGRead"
/>
</van-cell>
<van-cell
title=
"活动Logo"
style=
"font-size: 14px"
>
<van-cell
:required=
"true"
title=
"活动Logo"
style=
"font-size: 14px"
>
<van-uploader
:max-count=
"1"
v-model=
"logo_imgs"
:after-read=
"afterLogoRead"
></van-uploader>
</van-cell>
<van-cell
title=
"单日最大发放数量"
>
<van-cell
:required=
"true"
title=
"单日最大发放数量"
>
<
template
slot=
"default"
>
<div
class=
"jpsl"
>
<van-field
...
...
@@ -77,7 +77,7 @@
</div>
</
template
>
</van-cell>
<van-cell
title=
"总发放数量"
>
<van-cell
:required=
"true"
title=
"总发放数量"
>
<
template
slot=
"default"
>
<div
class=
"jpsl"
>
<van-field
...
...
@@ -97,7 +97,14 @@
</div>
</
template
>
</van-cell>
<van-cell
title=
"选择优惠券"
value=
"1"
is-link
@
click=
"showCoupon = true"
center
/>
<van-cell
:required=
"true"
title=
"选择优惠券"
:value=
"checked_coupon.name"
is-link
@
click=
"showCoupon = true"
center
/>
</van-cell-group>
<!-- 活动描述 -->
<div
class=
"detail"
>
...
...
@@ -117,18 +124,20 @@
<!-- 活动图片 -->
<div
class=
"detail"
style=
"margin-top:0;"
>
<div
class=
"des"
>
活动图片
</div>
<van-uploader
v-model=
"fileList
"
multiple
:max-count=
"9
"
/>
<van-uploader
v-model=
"fileList
_show"
multiple
:max-count=
"9"
:after-read=
"afterImgRead
"
/>
</div>
<div
class=
"creat"
@
click=
"handleCreate"
>
创建活动
</div>
<van-action-sheet
v-model=
"showCoupon"
:actions=
"coupons"
cancel-text=
"取消"
/>
<van-action-sheet
v-model=
"showCoupon"
:actions=
"coupons"
cancel-text=
"取消"
@
select=
"onSelect"
/>
</div>
</template>
<
script
>
import
axios
from
"axios"
;
import
*
as
API_Active
from
"@/api/active"
;
export
default
{
data
()
{
return
{
checked_coupon
:
{},
logo_imgs
:
[],
bg_imgs
:
[],
title
:
"送券"
,
...
...
@@ -149,6 +158,7 @@ export default {
endShow
:
false
,
message
:
"123"
,
fileList
:
[],
fileList_show
:
[],
showCoupon
:
false
,
coupons
:
[
{
name
:
"选项"
},
...
...
@@ -162,6 +172,62 @@ export default {
};
},
methods
:
{
getTemplateDate
(
id
)
{
API_Active
.
getTemplateData
(
id
).
then
(
res
=>
{
this
.
title
=
res
.
data
.
activityInfo
.
activityName
;
let
time1
=
res
.
data
.
activityInfo
.
startTime
;
this
.
startTime1
=
`
${
time1
.
substring
(
0
,
4
)}
-
${
time1
.
substring
(
4
,
6
)}
-
${
time1
.
substring
(
6
,
8
)}
`
+
time1
.
substring
(
8
);
let
time2
=
res
.
data
.
activityInfo
.
endTime
;
this
.
endTime1
=
`
${
time2
.
substring
(
0
,
4
)}
-
${
time2
.
substring
(
4
,
6
)}
-
${
time2
.
substring
(
6
,
8
)}
`
+
time2
.
substring
(
8
);
this
.
bg_imgs
[
0
]
=
{
url
:
res
.
data
.
activityInfo
.
backImage
};
this
.
logo_imgs
[
0
]
=
{
url
:
res
.
data
.
activityInfo
.
logo
};
this
.
maxNumber
=
res
.
data
.
activityInfo
.
joinLimit
?.
toString
();
this
.
totalLimit
=
res
.
data
.
activityInfo
.
totalLimit
?.
toString
();
this
.
couponId
=
res
.
data
.
activityInfo
.
couponId
;
this
.
message
=
res
.
activityInfo
.
des
;
let
imgs
=
JSON
.
parse
(
res
.
data
.
activityInfo
.
image
);
let
img_list
=
[];
imgs
.
forEach
(
i
=>
{
let
item
=
{};
item
.
url
=
i
;
img_list
.
push
(
item
);
});
this
.
fileList
=
img_list
;
});
},
onSelect
(
val
)
{
this
.
checked_coupon
=
val
;
this
.
showCoupon
=
false
;
},
afterImgRead
(
file
)
{
console
.
log
(
"image"
);
if
(
file
.
length
)
{
file
.
forEach
(
e
=>
{
let
params
=
new
FormData
();
params
.
append
(
"file"
,
e
.
file
);
let
url
=
"http://139.155.48.151:8084/admin/auth/util/saveImg"
;
axios
.
post
(
url
,
params
).
then
(
res
=>
{
let
img_url
=
JSON
.
parse
(
JSON
.
stringify
(
res
.
data
.
data
.
imgPath
));
this
.
fileList
.
push
(
img_url
);
});
});
}
else
{
let
params
=
new
FormData
();
params
.
append
(
"file"
,
file
.
file
);
let
url
=
"http://139.155.48.151:8084/admin/auth/util/saveImg"
;
axios
.
post
(
url
,
params
).
then
(
res
=>
{
this
.
fileList
.
push
(
JSON
.
parse
(
JSON
.
stringify
(
res
.
data
.
data
.
imgPath
)));
});
}
},
getCoupons
()
{
let
id
=
sessionStorage
.
getItem
(
"oyStallCode"
)
||
1
;
API_Active
.
getAllCouponsByOyStallCode
(
id
).
then
(
res
=>
{
...
...
@@ -170,57 +236,74 @@ export default {
},
async
afterLogoRead
(
file
)
{
let
logo_img
=
await
this
.
getImgUrl
(
file
.
file
);
if
(
logo_img
.
result
===
"success"
)
{
let
item
=
{
url
:
bg_img
.
data
.
imgPath
,
status
:
"done"
,
message
:
"上传成功"
};
this
.
logo_imgs
.
push
(
item
);
}
let
item
=
{
url
:
logo_img
,
status
:
"done"
,
message
:
"上传成功"
};
this
.
logo_imgs
[
0
]
=
item
;
},
async
afterBGRead
(
file
)
{
let
bg_img
=
await
this
.
getImgUrl
(
file
.
file
);
if
(
bg_img
.
result
===
"success"
)
{
let
item
=
{
url
:
bg_img
.
data
.
imgPath
,
status
:
"done"
,
message
:
"上传成功"
};
this
.
bg_imgs
.
push
(
item
);
}
let
item
=
{
url
:
bg_img
,
status
:
"done"
,
message
:
"上传成功"
};
this
.
bg_imgs
[
0
]
=
item
;
},
// 上传图片
async
getImgUrl
(
file
)
{
let
params
=
new
FormData
();
params
.
append
(
"file"
,
file
);
let
url
=
"http://139.155.48.151:8084/admin/auth/util/saveImg"
;
const
res
=
await
axios
.
post
(
url
,
params
);
return
res
;
const
img
=
await
axios
.
post
(
url
,
params
);
let
urls
=
img
.
data
.
data
.
imgPath
;
return
urls
;
},
handleCreate
()
{
if
(
new
Date
(
this
.
startTime1
)
>=
new
Date
(
this
.
endTime1
))
{
this
.
$toast
(
"活动开始时间应小于活动开始时间"
);
return
;
}
let
params
=
{
activityInfo
:
{
id
:
0
,
activityName
:
this
.
title
,
activityType
:
"coupon"
,
startTime
:
this
.
startTime1
,
endTime
:
this
.
endTime1
,
backImage
:
this
.
bg_imgs
[
0
]
?
this
.
bg_imgs
[
0
].
url
:
""
,
logo
:
this
.
logo_imgs
[
0
]
?
this
.
logo_imgs
[
0
].
url
:
""
,
joinLimit
:
this
.
maxNumber
,
totalLimit
:
this
.
totalLimit
,
// 单日最大发放数量
joinLimit
:
Number
(
this
.
maxNumber
),
// 总发放数量
totalLimit
:
Number
(
this
.
totalLimit
),
couponId
:
this
.
checked_coupon
.
couponId
,
des
:
this
.
message
,
image
:
JSON
.
stringify
(
this
.
fileList
)
}
};
console
.
log
(
"params"
,
params
);
API_Active
.
createActive
(
params
).
then
(
res
=>
{
if
(
res
.
result
===
"fail"
)
{
this
.
$toast
(
res
.
errorMsg
);
return
;
}
T
oast
.
success
(
"创建成功"
);
this
.
$t
oast
.
success
(
"创建成功"
);
setTimeout
(()
=>
{
this
.
$router
.
push
(
"/createSuccess"
);
this
.
$router
.
push
({
name
:
"createSuccess"
,
params
:
{
id
:
0
,
activityId
:
res
.
data
.
activityInfo
.
id
,
activityType
:
"coupon"
,
logo
:
this
.
logo_imgs
[
0
].
url
,
des
:
this
.
message
}
});
},
200
);
});
},
...
...
@@ -260,7 +343,14 @@ export default {
this
.
endTime1
=
`
${
endTimeArr
[
0
]}
-
${
endTimeArr
[
1
]}
-
${
endTimeArr
[
2
]}
`
;
}
},
mounted
()
{}
mounted
()
{
if
(
this
.
$route
.
query
.
activityId
)
{
console
.
log
(
"有模板数据"
);
let
template_id
=
this
.
$route
.
query
.
templateId
;
this
.
getTemplateDate
(
template_id
);
}
this
.
getCoupons
();
}
};
</
script
>
<
style
></
style
>
...
...
wx_application/src/views/active/createBigWheelActive.vue
View file @
920c80e0
...
...
@@ -2,7 +2,7 @@
<div
class=
"container"
>
<div
class=
"title"
>
活动设置
</div>
<van-cell-group
class=
"all"
>
<van-cell
title=
"活动标题"
style=
"font-size:14px;"
>
<van-cell
:required=
"true"
title=
"活动标题"
style=
"font-size:14px;"
>
<template
slot=
"default"
>
<van-field
v-model=
"basicInfo.title"
...
...
@@ -12,7 +12,7 @@
/>
</
template
>
</van-cell>
<van-cell
title=
"活动开始时间"
style=
"font-size:14px;"
>
<van-cell
:required=
"true"
title=
"活动开始时间"
style=
"font-size:14px;"
>
<
template
slot=
"default"
>
<div
class=
"nobr"
>
<van-field
...
...
@@ -34,7 +34,7 @@
</div>
</
template
>
</van-cell>
<van-cell
title=
"活动结束时间"
style=
"font-size:14px;"
>
<van-cell
:required=
"true"
title=
"活动结束时间"
style=
"font-size:14px;"
>
<
template
slot=
"default"
>
<div
class=
"jpsl"
>
<van-field
...
...
@@ -59,10 +59,10 @@
<van-cell
title=
"背景图片"
style=
"font-size: 14px"
>
<van-uploader
v-model=
"bg_imgs"
:max-count=
"1"
:after-read=
"afterBGRead"
/>
</van-cell>
<van-cell
title=
"活动Logo"
style=
"font-size: 14px"
>
<van-cell
:required=
"true"
title=
"活动Logo"
style=
"font-size: 14px"
>
<van-uploader
:max-count=
"1"
v-model=
"logo_imgs"
:after-read=
"afterLogoRead"
></van-uploader>
</van-cell>
<van-cell
title=
"会员单日参与次数"
style=
"font-size: 14px"
>
<van-cell
:required=
"true"
title=
"会员单日参与次数"
style=
"font-size: 14px"
>
<
template
slot=
"default"
>
<div
class=
"jpsl"
>
<van-field
...
...
@@ -82,7 +82,7 @@
</div>
</
template
>
</van-cell>
<van-cell
title=
"会员总参与次数"
style=
"font-size: 14px"
>
<van-cell
:required=
"true"
title=
"会员总参与次数"
style=
"font-size: 14px"
>
<
template
slot=
"default"
>
<div
class=
"jpsl"
>
<van-field
...
...
@@ -112,14 +112,14 @@
class=
"close"
@
click=
"removePrice(index)"
/>
<van-cell
title=
"奖项设置"
>
<van-cell
:required=
"true"
title=
"奖项设置"
>
<van-radio-group
v-model=
"prizeList[index].type"
class=
"right"
>
<van-radio
name=
"1"
style=
"float:left;margin-right:10px;"
>
优惠券
</van-radio>
<van-radio
name=
"2"
style=
"float:right;"
>
谢谢参与
</van-radio>
</van-radio-group>
</van-cell>
<
template
v-if=
"prizeList[index].type == 1"
>
<van-cell
center
>
<van-cell
:required=
"true"
center
>
<template
slot=
"title"
>
<span
class=
"custom-title"
>
奖项名称
</span>
</
template
>
...
...
@@ -128,13 +128,14 @@
</
template
>
</van-cell>
<van-cell
:required=
"true"
title=
"选择优惠券"
:value=
"prizeList[index].checked_coupon.name"
is-link
@
click=
"handleCheckCoupon(index)"
center
/>
<van-cell
title=
"总发放数量限制"
style=
"font-size:14px;"
>
<van-cell
:required=
"true"
title=
"总发放数量限制"
style=
"font-size:14px;"
>
<
template
slot=
"default"
>
<div
class=
"jpsl"
>
<van-field
...
...
@@ -154,7 +155,7 @@
</div>
</
template
>
</van-cell>
<van-cell
title=
"每日发放数量限制"
style=
"font-size:14px;"
>
<van-cell
:required=
"true"
title=
"每日发放数量限制"
style=
"font-size:14px;"
>
<
template
slot=
"default"
>
<div
class=
"jpsl"
>
<van-field
...
...
@@ -174,7 +175,7 @@
</div>
</
template
>
</van-cell>
<van-cell
title=
"每人限领数量"
style=
"font-size:14px;"
>
<van-cell
:required=
"true"
title=
"每人限领数量"
style=
"font-size:14px;"
>
<
template
slot=
"default"
>
<div
class=
"jpsl"
>
<van-field
...
...
@@ -195,7 +196,7 @@
</
template
>
</van-cell>
</template>
<van-cell
style=
"font-size:14px;"
class=
"cs gl"
>
<van-cell
:required=
"true"
style=
"font-size:14px;"
class=
"cs gl"
>
<
template
slot=
"title"
>
<span
class=
"custom-title"
>
中奖概率
</span>
</
template
>
...
...
@@ -220,7 +221,7 @@
<div
class=
"add"
@
click=
"addPrice"
>
添加奖项
</div>
</van-cell-group>
<!-- 活动描述 -->
<
div
class=
"detail"
>
<
van-cell
:required=
"true"
class=
"detail"
>
<div
class=
"border"
>
<div
class=
"des"
>
活动描述
</div>
<van-field
...
...
@@ -233,14 +234,14 @@
show-word-limit
/>
</div>
</
div
>
</
van-cell
>
<!-- 活动图片 -->
<div
class=
"detail"
style=
"margin-top:0;"
>
<div
class=
"des"
>
活动图片
</div>
<van-uploader
v-model=
"fileList_show"
multiple
:max-count=
"9"
:after-read=
"afterImgRead"
/>
</div>
<!-- 奖品介绍 -->
<
div
class=
"detail"
>
<
van-cell
:required=
"true"
class=
"detail"
>
<div
class=
"border"
>
<div
class=
"des"
>
奖品介绍
</div>
<van-field
...
...
@@ -253,7 +254,7 @@
show-word-limit
/>
</div>
</
div
>
</
van-cell
>
<div
class=
"creat"
@
click=
"handleCreate"
>
创建活动
</div>
<van-action-sheet
v-model=
"show"
:actions=
"coupons"
cancel-text=
"取消"
@
select=
"onSelect"
/>
...
...
@@ -346,6 +347,84 @@ export default {
};
},
methods
:
{
// 获取模板数据
getTemplateDate
(
id
)
{
API_Active
.
getTemplateData
(
id
).
then
(
res
=>
{
// 构造数据
// res.activityInfo
this
.
basicInfo
.
title
=
res
.
data
.
activityInfo
.
activityName
;
let
start_time
=
res
.
data
.
activityInfo
.
startTime
;
this
.
basicInfo
.
startTime1
=
`
${
start_time
.
substring
(
0
,
4
)}
-
${
start_time
.
substring
(
4
,
6
)}
-
${
start_time
.
substring
(
6
,
8
)}
`
+
start_time
.
substring
(
8
);
let
end_time
=
res
.
data
.
activityInfo
.
endTime
;
this
.
basicInfo
.
endTime1
=
`
${
end_time
.
substring
(
0
,
4
)}
-
${
end_time
.
substring
(
4
,
6
)}
-
${
end_time
.
substring
(
6
,
8
)}
`
+
end_time
.
substring
(
8
);
this
.
bg_imgs
[
0
]
=
{
url
:
res
.
data
.
activityInfo
.
backImage
};
this
.
logo_imgs
[
0
]
=
{
url
:
res
.
data
.
activityInfo
.
logo
};
this
.
basicInfo
.
jointimes
=
res
.
data
.
activityInfo
.
joinLimit
.
toString
();
this
.
basicInfo
.
total_join
=
res
.
data
.
activityInfo
.
totalLimit
.
toString
();
this
.
message
=
res
.
data
.
activityInfo
.
des
;
let
imgs
=
JSON
.
parse
(
res
.
data
.
activityInfo
.
image
);
let
img_list
=
[];
imgs
.
forEach
(
i
=>
{
let
item
=
{};
item
.
url
=
i
;
img_list
.
push
(
item
);
});
this
.
fileList
=
img_list
;
this
.
prize_produce
=
res
.
data
.
activityInfo
.
prizeDesc
;
// this.prizeList = res.data.activityPrizes;
let
prizes
=
[];
res
.
data
.
activityPrizes
.
forEach
((
p
,
index
)
=>
{
let
item
=
{
name
:
""
,
timeLine_type
:
""
,
type
:
""
,
discountsMoney
:
""
,
discountsShow
:
false
,
full
:
""
,
fullMoney
:
""
,
fullShow
:
false
,
validity
:
""
,
startTime
:
new
Date
(),
startTime1
:
""
,
startShow
:
false
,
endTime
:
new
Date
(),
endTime1
:
""
,
endShow
:
false
,
total_limit
:
""
,
total_limit_show
:
false
,
preLimit
:
""
,
preLimit_show
:
false
,
limit
:
""
,
limit_show
:
false
,
probability
:
""
,
probability_show
:
false
,
checked_coupon
:
{}
};
if
(
p
.
prizeType
===
2
)
{
item
.
type
=
"1"
;
}
else
if
(
p
.
prizeType
===
1
)
{
item
.
type
=
"2"
;
}
item
.
name
=
p
.
prizeName
;
item
.
id
=
index
;
item
.
total_limit
=
p
.
quantity
?.
toString
();
item
.
limit
=
p
.
personLimit
?.
toString
();
item
.
probability
=
p
.
probability
?.
toString
();
item
.
preLimit
=
p
.
limitReceive
?.
toString
();
item
.
checked_coupon
.
couponId
=
p
.
coupon_id
;
prizes
.
push
(
item
);
});
this
.
prizeList
=
prizes
;
});
},
handleCheckCoupon
(
index
)
{
this
.
show
=
true
;
this
.
current_index
=
index
;
...
...
@@ -414,6 +493,10 @@ export default {
// console.log(val);
},
handleCreate
()
{
if
(
new
Date
(
this
.
basicInfo
.
startTime1
)
>=
new
Date
(
this
.
basicInfo
.
endTime1
))
{
this
.
$toast
(
"活动开始时间应小于活动开始时间"
);
return
;
}
let
params_prizeList
=
[];
let
total_probability
=
0
;
this
.
prizeList
.
forEach
((
p
,
index
)
=>
{
...
...
@@ -435,7 +518,7 @@ export default {
params_prizeList
.
push
(
temp
);
});
if
(
total_probability
!=
100
)
{
this
.
$toast
(
'所有奖项概率之和必须为100%'
);
this
.
$toast
(
"所有奖项概率之和必须为100%"
);
return
;
}
let
params
=
{
...
...
@@ -463,7 +546,15 @@ export default {
}
Toast
.
success
(
"创建成功"
);
setTimeout
(()
=>
{
this
.
$router
.
push
(
"/createSuccess"
);
this
.
$router
.
push
({
name
:
"createSuccess"
,
params
:
{
activityId
:
res
.
data
.
activityInfo
.
id
,
activityType
:
"wheel"
,
logo
:
this
.
logo_imgs
[
0
].
url
,
des
:
this
.
message
}
});
},
200
);
});
},
...
...
@@ -623,6 +714,12 @@ export default {
}
},
mounted
()
{
if
(
this
.
$route
.
query
.
activityId
)
{
// 有模板数据
console
.
log
(
"有模板数据"
);
let
template_id
=
this
.
$route
.
query
.
templateId
;
this
.
getTemplateDate
(
template_id
);
}
this
.
pTime
=
this
.
timeFormat
(
this
.
pTime
);
console
.
log
(
this
.
pTime
,
"time"
);
this
.
getCoupons
();
...
...
wx_application/src/views/active/createSuccess.vue
View file @
920c80e0
...
...
@@ -15,11 +15,11 @@
<div
class=
"btn-group"
>
<template
v-if=
"step === 1"
>
<van-button
type=
"info"
@
click=
"saveNewTemplate"
>
保存为新的模板
</van-button>
<van-button
type=
"info"
@
click=
"$router.push('/
ActTemplate
')"
>
完成
</van-button>
<van-button
type=
"info"
@
click=
"$router.push('/')"
>
完成
</van-button>
</
template
>
<
template
v-if=
"step === 2"
>
<van-button
type=
"info"
@
click=
"$router.push('/ActTemplate')"
>
取消
</van-button>
<van-button
type=
"info"
>
完成
</van-button>
<van-button
type=
"info"
@
click=
"save"
>
完成
</van-button>
</
template
>
</div>
</div>
...
...
@@ -27,6 +27,7 @@
</template>
<
script
>
import
*
as
API_Active
from
'@/api/active'
;
export
default
{
name
:
"createSuccess"
,
components
:
{},
...
...
@@ -37,6 +38,22 @@ export default {
};
},
methods
:
{
save
()
{
let
params
=
{
id
:
0
,
activityId
:
this
.
$route
.
params
.
activityId
,
logo
:
this
.
$route
.
params
.
logo
,
des
:
this
.
$route
.
params
.
des
,
activityType
:
this
.
$route
.
params
.
activityType
,
templateName
:
this
.
newTemplateName
}
API_Active
.
saveTemplate
(
params
).
then
(
res
=>
{
this
.
$toast
(
'模板保存成功'
);
setTimeout
(()
=>
{
this
.
$router
.
push
(
'/ActTemplate'
)
},
2000
)
})
},
saveNewTemplate
()
{
this
.
step
=
2
;
}
...
...
wx_application/src/views/active/more.vue
deleted
100644 → 0
View file @
1309cfee
<
template
>
<div
id=
"more"
>
</div>
</
template
>
<
script
>
export
default
{
name
:
'more'
,
components
:
{},
data
()
{
return
{
}
}
}
</
script
>
<
style
lang=
"scss"
>
</
style
>
wx_application/src/views/mainSale/active/template/index.vue
View file @
920c80e0
<
template
>
<div
class=
"lists"
>
<div
v-for=
"(item, index) of list.active"
:key=
"index"
>
<div
class=
"list"
@
click=
"listClick(index)"
>
<div
class=
"list-logos"
>
<img
class=
"list-logo"
:src=
"item.logoUrl"
>
</div>
<div
class=
"list-infos"
>
<div
class=
"list-title"
>
{{
item
.
name
}}
</div>
<div
class=
"list-dsc"
>
{{
item
.
dsc
}}
</div>
</div>
</div>
<div
class=
"lists"
>
<div
v-for=
"(item, index) of active"
:key=
"index"
>
<div
class=
"list"
@
click=
"listClick(index, item)"
>
<div
class=
"list-logos"
>
<img
class=
"list-logo"
:src=
"item.logo"
/>
</div>
<div
class=
"list-infos"
>
<div
class=
"list-title"
>
{{
item
.
templateName
}}
</div>
<div
class=
"list-dsc"
>
{{
item
.
des
}}
</div>
</div>
</div>
</div>
<span
class=
"more"
v-if=
"active.length && !list_finished"
@
click=
"handleMore"
>
查看更多
<span
class=
"icon"
>
>
</span>
</span>
</div>
</
template
>
<
script
>
// ZKit
// const log = console.log.bind(console)
export
default
{
name
:
"discountIndex"
,
data
()
{
return
{
list
:
{
active
:
[
{
name
:
"大转盘活动"
,
logoUrl
:
"/mainSale/icon-active-1.png"
,
dsc
:
"有各种物质组成的举行球状天体,叫做星球。星球有一定的形状。"
,
reDirect
:
"turntableDetail"
},
{
name
:
"送券活动"
,
logoUrl
:
"/mainSale/icon-active-2.png"
,
dsc
:
"有各种物质组成的举行球状天体,叫做星球。星球有一定的形状。"
,
reDirect
:
"couponDetail"
}
],
},
};
// ZKit
// const log = console.log.bind(console)
import
*
as
API_Active
from
"@/api/active"
;
export
default
{
name
:
"discountIndex"
,
data
()
{
return
{
list_finished
:
false
,
active
:
[
{
templateName
:
"大转盘活动"
,
activityType
:
"wheel"
,
logo
:
"/mainSale/icon-active-1.png"
,
des
:
"有各种物质组成的举行球状天体,叫做星球。星球有一定的形状。"
,
reDirect
:
"turntableDetail"
},
created
()
{
},
methods
:
{
listClick
(
inIndex
){
// log('--->click: inIndex =', inIndex)
// log('--->click: reDirect =', this.list.active[inIndex].reDirect)
this
.
$router
.
push
(
this
.
list
.
active
[
inIndex
].
reDirect
)
},
{
templateName
:
"送券活动"
,
activityType
:
"coupon"
,
logo
:
"/mainSale/icon-active-2.png"
,
des
:
"有各种物质组成的举行球状天体,叫做星球。星球有一定的形状。"
,
reDirect
:
"couponDetail"
}
],
params
:
{
pageNo
:
1
,
pageSize
:
10
}
};
},
created
()
{
this
.
getTemplate
(
this
.
params
);
},
methods
:
{
handleMore
()
{
this
.
params
.
pageNo
+=
1
;
this
.
getTemplate
(
this
.
params
);
},
// 获取模板
getTemplate
(
params
)
{
API_Active
.
getTemplate
(
params
).
then
(
res
=>
{
this
.
active
.
push
(...
res
.
data
.
list
);
if
(
res
.
data
.
list
===
[])
{
this
.
list_finished
=
true
;
}
});
},
listClick
(
inIndex
,
item
)
{
// log('--->click: inIndex =', inIndex)
// log('--->click: reDirect =', this.list.active[inIndex].reDirect)
if
(
inIndex
<
2
)
{
this
.
$router
.
push
(
this
.
active
[
inIndex
].
reDirect
);
}
else
{
this
.
$router
.
push
({
path
:
`/createBigWheelActive`
,
query
:
{
activityId
:
item
.
activityId
,
activityType
:
item
.
activityType
,
templateId
:
item
.
id
}
});
}
}
}
};
</
script
>
<
style
scoped
>
.lists
{
padding
:
4px
16px
20px
16px
;
}
.list
{
padding
:
12px
0px
;
display
:
flex
;
flex-direction
:
row
;
justify-content
:
start
;
align-items
:
center
;
border-bottom
:
1px
solid
#EEEEEE
;
}
.list-logos
{
width
:
80px
;
height
:
80px
;
background-color
:
#F8F8F8
;
display
:
flex
;
flex-direction
:
row
;
justify-content
:
center
;
align-items
:
center
;
}
.list-logo
{
width
:
56px
;
height
:
56px
;
}
.list-infos
{
width
:
251px
;
height
:
80px
;
display
:
flex
;
flex-direction
:
column
;
justify-content
:
center
;
align-items
:
start
;
margin-left
:
12px
;
}
.list-title
{
font-size
:
14px
;
height
:
16px
;
line-height
:
16px
;
font-weight
:
bold
;
color
:
#2D476A
;
width
:
100%
;
text-align
:
left
;
margin-bottom
:
8px
;
}
.list-dsc
{
font-size
:
12px
;
height
:
14px
;
line-height
:
14px
;
font-weight
:
normal
;
color
:
#2D476A
;
width
:
100%
;
text-align
:
left
;
overflow
:
auto
;
}
.more
{
font-size
:
12px
;
float
:
right
;
}
.lists
{
padding
:
4px
16px
20px
16px
;
}
.list
{
padding
:
12px
0px
;
display
:
flex
;
flex-direction
:
row
;
justify-content
:
start
;
align-items
:
center
;
border-bottom
:
1px
solid
#eeeeee
;
}
.list-logos
{
width
:
80px
;
height
:
80px
;
background-color
:
#f8f8f8
;
display
:
flex
;
flex-direction
:
row
;
justify-content
:
center
;
align-items
:
center
;
}
.list-logo
{
width
:
56px
;
height
:
56px
;
}
.list-infos
{
width
:
251px
;
height
:
80px
;
display
:
flex
;
flex-direction
:
column
;
justify-content
:
center
;
align-items
:
start
;
margin-left
:
12px
;
}
.list-title
{
font-size
:
14px
;
height
:
16px
;
line-height
:
16px
;
font-weight
:
bold
;
color
:
#2d476a
;
width
:
100%
;
text-align
:
left
;
margin-bottom
:
8px
;
}
.list-dsc
{
font-size
:
12px
;
height
:
14px
;
line-height
:
14px
;
font-weight
:
normal
;
color
:
#2d476a
;
width
:
100%
;
text-align
:
left
;
overflow
:
auto
;
}
</
style
>
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