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
3a710b9e
Commit
3a710b9e
authored
Apr 22, 2020
by
leiqingsong
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
抽奖功能完善
parent
46ea4c0b
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
114 additions
and
88 deletions
+114
-88
activeDetail.vue
wx_application/src/views/active/activeDetail.vue
+33
-25
createActive.vue
wx_application/src/views/active/createActive.vue
+35
-31
createBigWheelActive.vue
wx_application/src/views/active/createBigWheelActive.vue
+25
-18
addCoupon.vue
wx_application/src/views/coupon/addCoupon.vue
+21
-14
No files found.
wx_application/src/views/active/activeDetail.vue
View file @
3a710b9e
...
...
@@ -82,19 +82,19 @@
:style=
"active_type === 'coupon'? 'bottom: 0': ''"
@
click=
"handleShare"
>
立即分享
</div>
<van-overlay
:show=
"showAward"
@
click=
"
showAward = false
"
>
<div
class=
"wrapper"
>
<div
v-if=
"isAward"
class=
"block"
>
<van-overlay
:show=
"showAward"
@
click=
"
closeAward
"
>
<div
v-if=
"isAward"
class=
"wrapper"
@
click
.
stop
>
<div
class=
"block"
>
<div
class=
"award-coupon"
>
<img
class=
"bg_img"
src=
"/img/coupon.png"
alt=
"coupon"
/>
<div
class=
"other"
>
<
p>
{{ awardGood.coupon.type }}
</p
>
<
!-- <p>代金券</p> --
>
<
!-- <p>{{ awardGood.coupon.type }}</p> --
>
<
p>
代金券
</p
>
<div
class=
"split"
>
<img
src=
"../../../public/img/split.png"
alt=
"split"
/>
</div>
<
p>
{{ awardGood.coupon.unit }}元
</p
>
<
!-- <p>2000元</p> --
>
<
!-- <p>{{ awardGood.coupon.unit }}元</p> --
>
<
p>
2000元
</p
>
</div>
</div>
<p
style=
"font-size: 20px;font-weight: bold;"
>
OLAY全场通用抵扣券
</p>
...
...
@@ -103,7 +103,9 @@
<van-button
style=
"background: #f00;color: #fff;"
@
click=
"handleGet"
>
领取奖品
</van-button>
<van-button
style=
"border-color: #7f7777;"
@
click=
"handleGoOn"
>
继续抽奖
</van-button>
</div>
<div
v-else
class=
"block"
style=
"background: #413d3de0;color: #fff;"
>
</div>
<div
v-else
class=
"wrapper"
>
<div
class=
"block"
style=
"background: #000;color: #fff;"
>
<p
style=
"font-size: 22px;"
>
谢谢惠顾!
</p>
<p
style=
"font-size: 14px;"
>
很遗憾,此次未能中奖,再接再厉!
</p>
</div>
...
...
@@ -133,7 +135,7 @@ export default {
timer
:
null
,
timeLine
:
""
,
isAward
:
false
,
showAward
:
fals
e
,
showAward
:
tru
e
,
userBaseInfo
:
{},
isMember
:
false
,
openid
:
""
,
...
...
@@ -265,10 +267,13 @@ export default {
}
},
methods
:
{
closeAward
()
{
this
.
showAward
=
false
;
},
// 继续抽奖
handleGoOn
()
{
this
.
goOn
=
true
;
this
.
showAward
=
false
;
this
.
closeAward
()
;
},
// 领取(
handleGet
()
{
...
...
@@ -280,7 +285,6 @@ export default {
return
false
;
}
if
(
!
this
.
isMember
)
{
console
.
log
(
"非会员"
);
Dialog
.
confirm
({
title
:
"提示"
,
message
:
...
...
@@ -306,7 +310,7 @@ export default {
vipId
:
this
.
userBaseInfo
.
vipId
};
APi_Active
.
collectMyCoupon
(
params
).
then
(
res
=>
{
this
.
showAward
=
false
;
this
.
closeAward
()
if
(
res
.
data
==
"领取失败"
)
{
this
.
$toast
(
"领取失败"
);
return
false
;
...
...
@@ -387,7 +391,6 @@ export default {
});
return
false
;
}
// console.log('111');
if
(
this
.
game_end
)
{
this
.
$toast
(
"活动已结束"
);
return
false
;
...
...
@@ -398,11 +401,13 @@ export default {
}
let
params
=
{
activityId
:
this
.
active_id
,
openId
:
this
.
userBaseInfo
.
openid
,
openId
:
this
.
userBaseInfo
.
openid
||
"ofoA-xMYdB2XA1Ss-ycCeRy9HV4A"
,
phone
:
this
.
userBaseInfo
.
phone
,
unionId
:
this
.
userBaseInfo
.
unionid
,
unionId
:
this
.
userBaseInfo
.
unionid
||
"oCIMxuMlt5vxRZgl-pNIxOjyYQ20"
,
userName
:
this
.
userBaseInfo
.
name
};
const
{
wheelDeg
,
prizeList
}
=
this
;
this
.
rolling
=
true
;
APi_Active
.
play
(
params
)
.
then
(
res
=>
{
if
(
!
res
.
data
.
prizeId
)
{
...
...
@@ -410,8 +415,6 @@ export default {
this
.
$toast
(
res
.
data
.
message
);
return
false
;
}
const
{
wheelDeg
,
prizeList
}
=
this
;
this
.
rolling
=
true
;
const
random
=
prizeList
.
map
(
item
=>
item
.
id
)
.
indexOf
(
res
.
data
.
prizeId
);
...
...
@@ -421,18 +424,22 @@ export default {
6
*
360
-
(
360
/
prizeList
.
length
)
*
random
;
setTimeout
(()
=>
{
this
.
awardGood
=
prizeList
[
random
];
this
.
awardGood
.
coupon
=
JSON
.
parse
(
this
.
awardGood
.
coupon
);
this
.
isAward
=
res
.
data
.
prizeName
!==
"谢谢惠顾"
;
this
.
rolling
=
false
;
this
.
showAward
=
true
;
this
.
isAward
=
res
.
data
.
prizeName
!==
"谢谢惠顾"
;
if
(
!
this
.
isAward
)
{
this
.
$toast
(
""
);
console
.
log
(
'谢谢惠顾'
);
// this.showAward = false;
}
else
{
// this.showAward = true;
this
.
awardGood
=
prizeList
[
random
];
this
.
awardGood
.
coupon
=
JSON
.
parse
(
prizeList
[
random
].
coupon
);
console
.
log
(
this
.
awardGood
);
}
},
4500
);
})
.
catch
(
err
=>
{
console
.
log
(
"err"
,
err
)
;
.
catch
(
err
or
=>
{
this
.
rolling
=
false
;
});
},
getUrlParams
(
name
)
{
...
...
@@ -785,10 +792,11 @@ export default {
bottom
:
0
;
left
:
0
;
width
:
90%
;
height
:
60
%
;
height
:
60
px
;
margin
:
auto
;
text-align
:
center
;
font-size
:
32px
;
font-size
:
26px
;
line-height
:
60px
;
color
:
#f00
;
p
{
width
:
50%
;
...
...
wx_application/src/views/active/createActive.vue
View file @
3a710b9e
...
...
@@ -192,9 +192,7 @@ export default {
totalLimit_show
:
false
};
},
created
()
{
},
created
()
{},
methods
:
{
openStartTime
()
{
this
.
startShow
=
true
;
...
...
@@ -261,7 +259,7 @@ export default {
}
},
getCoupons
()
{
let
id
=
sessionStorage
.
getItem
(
"oyStallCode"
);
let
id
=
sessionStorage
.
getItem
(
"oyStallCode"
)
||
1
;
API_Active
.
getAllCouponsByOyStallCode
(
id
).
then
(
res
=>
{
if
(
res
.
data
.
length
===
0
||
!
res
.
data
.
length
)
{
this
.
$toast
(
"您所在店铺没有优惠券,请先去创建"
);
...
...
@@ -307,11 +305,6 @@ export default {
return
urls
;
},
handleCreate
()
{
if
(
--
this
.
create_times
<
0
)
{
this
.
$toast
(
"已经过提交申请了,请等待处理!"
);
return
false
;
}
if
(
this
.
title
===
""
||
this
.
startTime1
==
""
||
...
...
@@ -329,7 +322,7 @@ export default {
this
.
$toast
(
"活动开始时间应小于活动开始时间"
);
return
false
;
}
if
(
this
.
maxNumber
>
this
.
totalLimit
)
{
if
(
Number
(
this
.
maxNumber
)
>
Number
(
this
.
totalLimit
)
)
{
this
.
$toast
(
"单日最大发放数量应不大于总发放数量"
);
return
false
;
}
...
...
@@ -354,7 +347,12 @@ export default {
}
};
console
.
log
(
"params"
,
params
);
API_Active
.
createActive
(
params
).
then
(
res
=>
{
if
(
--
this
.
create_times
<
0
)
{
this
.
$toast
(
"已经过提交申请了,请等待处理!"
);
return
false
;
}
API_Active
.
createActive
(
params
)
.
then
(
res
=>
{
this
.
create_times
=
1
;
if
(
res
.
result
===
"fail"
)
{
this
.
$toast
(
res
.
errorMsg
);
...
...
@@ -373,6 +371,10 @@ export default {
}
});
},
200
);
})
.
catch
(
error
=>
{
this
.
create_times
=
1
;
console
.
log
(
error
);
});
},
timeFormat
(
time
)
{
...
...
@@ -412,12 +414,14 @@ export default {
}
},
mounted
()
{
this
.
create_times
=
1
;
console
.
log
(
"create_times"
,
this
.
create_times
);
if
(
this
.
$route
.
query
.
activityId
)
{
console
.
log
(
"有模板数据"
);
let
template_id
=
this
.
$route
.
query
.
templateId
;
this
.
getTemplateDate
(
template_id
);
}
//
this.getCoupons();
this
.
getCoupons
();
}
};
</
script
>
...
...
wx_application/src/views/active/createBigWheelActive.vue
View file @
3a710b9e
...
...
@@ -422,7 +422,7 @@ export default {
};
},
created
()
{
//
this.prizeList[0].probability = this.remain_probability;
this
.
prizeList
[
0
].
probability
=
this
.
remain_probability
;
},
methods
:
{
// 限制 vant stepper 输入长度
...
...
@@ -526,12 +526,11 @@ export default {
},
// 选择优惠券
onSelect
(
val
)
{
console
.
log
(
val
);
this
.
prizeList
[
this
.
current_index
].
checked_coupon
=
val
;
this
.
show
=
false
;
},
getCoupons
()
{
let
id
=
sessionStorage
.
getItem
(
"oyStallCode"
);
let
id
=
sessionStorage
.
getItem
(
"oyStallCode"
)
||
1
;
API_Active
.
getAllCouponsByOyStallCode
(
id
).
then
(
res
=>
{
if
(
res
.
data
.
length
===
0
||
!
res
.
data
.
length
)
{
this
.
$toast
(
"您所在店铺没有优惠券,请先去创建"
);
...
...
@@ -603,10 +602,6 @@ export default {
// console.log(val);
},
handleCreate
()
{
if
(
--
this
.
create_times
<
0
)
{
this
.
$toast
(
"已经过提交申请了,请等待处理!"
);
return
false
;
}
if
(
this
.
basicInfo
.
title
==
""
||
this
.
basicInfo
.
startTime1
==
""
||
...
...
@@ -620,7 +615,7 @@ export default {
this
.
$toast
(
"请完整填写表单!"
);
return
false
;
}
if
(
this
.
basicInfo
.
jointimes
>
this
.
basicInfo
.
total_join
)
{
if
(
Number
(
this
.
basicInfo
.
jointimes
)
>
Number
(
this
.
basicInfo
.
total_join
)
)
{
this
.
$toast
(
"会员单日参与次数应小于等于会员总参与次数"
);
return
false
;
}
...
...
@@ -645,19 +640,21 @@ export default {
break
;
}
if
(
this
.
prizeList
[
i
].
total_limit
<
this
.
prizeList
[
i
].
preLimit
)
{
this
.
$toast
(
"总发放数量应大于等于每日发放数量"
);
if
(
Number
(
this
.
prizeList
[
i
].
total_limit
)
<
Number
(
this
.
prizeList
[
i
].
preLimit
))
{
console
.
log
(
this
.
prizeList
[
i
].
total_limit
);
console
.
log
(
this
.
prizeList
[
i
].
preLimit
);
this
.
$toast
(
`奖项
${
i
+
1
}
,总发放数量应大于等于每日发放数量`
);
validate
=
false
;
break
;
}
if
(
this
.
prizeList
[
i
].
total_limit
<
this
.
prizeList
[
i
].
limit
)
{
this
.
$toast
(
"总发放数量应大于每人限领数量"
);
if
(
Number
(
this
.
prizeList
[
i
].
total_limit
)
<
Number
(
this
.
prizeList
[
i
].
limit
)
)
{
this
.
$toast
(
`奖项
${
i
+
1
}
,总发放数量应大于每人限领数量`
);
validate
=
false
;
break
;
}
}
else
{
if
(
this
.
prizeList
[
i
].
probability
===
""
)
{
this
.
$toast
(
"奖项概率不允许为空"
);
this
.
$toast
(
`奖项
${
i
+
1
}
概率不允许为空`
);
validate
=
false
;
break
;
}
...
...
@@ -697,6 +694,10 @@ export default {
this
.
$toast
(
"所有奖项概率之和必须为100%"
);
return
false
;
}
if
(
--
this
.
create_times
<
0
)
{
this
.
$toast
(
"已经过提交申请了,请等待处理!"
);
return
false
;
}
let
params
=
{
activityInfo
:
{
id
:
0
,
...
...
@@ -733,6 +734,9 @@ export default {
}
});
},
200
);
}).
catch
(
error
=>
{
this
.
create_times
=
1
;
console
.
log
(
error
);
});
},
startTimeChange
(
e
)
{
...
...
@@ -856,9 +860,11 @@ export default {
return
;
}
// 计算剩余 概率
// this.prizeList.forEach(p => {
// this.remain_probability -= Number(p.probability)
// })
let
temp
=
100
;
this
.
prizeList
.
forEach
(
p
=>
{
temp
-=
Number
(
p
.
probability
);
});
// this.remain_probability -= Number(this.prizeList[this.prizeList.length-1].probability)
this
.
prizeList
.
push
({
name
:
""
,
timeLine_type
:
""
,
...
...
@@ -881,7 +887,7 @@ export default {
preLimit_show
:
false
,
limit
:
""
,
limit_show
:
false
,
probability
:
""
,
probability
:
temp
,
probability_show
:
false
,
checked_coupon
:
{}
});
...
...
@@ -895,9 +901,10 @@ export default {
}
},
mounted
()
{
this
.
create_times
=
1
;
console
.
log
(
"create_times"
,
this
.
create_times
);
if
(
this
.
$route
.
query
.
activityId
)
{
// 有模板数据
console
.
log
(
"有模板数据"
);
let
template_id
=
this
.
$route
.
query
.
templateId
;
this
.
getTemplateDate
(
template_id
);
}
...
...
wx_application/src/views/coupon/addCoupon.vue
View file @
3a710b9e
...
...
@@ -236,7 +236,7 @@ export default {
codeShow
:
false
,
//
addForm
:
{
cxcode
:
""
,
cxcode
:
Date
.
parse
(
new
Date
()).
toString
()
,
cxsh
:
""
,
name
:
""
,
begin_date
:
""
,
...
...
@@ -265,6 +265,8 @@ export default {
this
.
addForm
.
deptId
=
sessionStorage
.
getItem
(
"oyStallCode"
);
this
.
minStartDate
=
new
Date
((
new
Date
()
/
1000
+
3600
)
*
1000
);
this
.
minEndDate
=
new
Date
((
new
Date
()
/
1000
+
86400
)
*
1000
);
this
.
create_times
=
1
;
console
.
log
(
"create_times"
,
this
.
create_times
);
},
methods
:
{
timeFormat
(
time
)
{
...
...
@@ -319,10 +321,6 @@ export default {
this
.
$router
.
push
(
"coupon"
);
},
handleSave
()
{
if
(
--
this
.
create_times
<
0
)
{
this
.
$toast
(
"已经过提交申请了,请等待处理!"
);
return
false
;
}
if
(
!
this
.
addForm
.
cxcode
)
{
this
.
$toast
(
"请输入欧亚活动编码"
);
return
false
;
...
...
@@ -376,7 +374,12 @@ export default {
this
.
$toast
(
"请输入用券金额"
);
return
false
;
}
addCoupon
(
this
.
addForm
).
then
(
res
=>
{
if
(
--
this
.
create_times
<
0
)
{
this
.
$toast
(
"已经过提交申请了,请等待处理!"
);
return
false
;
}
addCoupon
(
this
.
addForm
)
.
then
(
res
=>
{
this
.
create_times
=
1
;
console
.
log
(
res
,
"res"
);
if
(
res
.
errorCode
==
"fail"
)
{
...
...
@@ -384,6 +387,10 @@ export default {
}
else
{
this
.
$router
.
push
(
"coupon"
);
}
})
.
catch
(
error
=>
{
this
.
create_times
=
1
;
console
.
log
(
error
);
});
}
}
...
...
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