Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
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
fc538223
Commit
fc538223
authored
5 years ago
by
leiqingsong
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
修改轮盘&修改送券活动领取&优惠券创建bug
parent
69a1d0ce
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
431 additions
and
82 deletions
+431
-82
activeDetail.vue
wx_application/src/views/active/activeDetail.vue
+375
-51
createBigWheelActive.vue
wx_application/src/views/active/createBigWheelActive.vue
+54
-29
addCoupon.vue
wx_application/src/views/coupon/addCoupon.vue
+2
-2
No files found.
wx_application/src/views/active/activeDetail.vue
View file @
fc538223
...
@@ -30,10 +30,9 @@
...
@@ -30,10 +30,9 @@
<
template
v-if=
"active_type === 'wheel'"
>
<
template
v-if=
"active_type === 'wheel'"
>
<div
class=
"wheel-container"
>
<div
class=
"wheel-container"
>
<p
class=
"title"
>
{{
activityName
}}
</p>
<p
class=
"title"
>
{{
activityName
}}
</p>
<
div
class=
"wheel"
>
<
!--
<div
class=
"wheel"
<div
class=
"wheel-point"
@
click=
"Start_Game"
>
开始
</div>
<div
class=
"wheel-point"
@
click=
"Start_Game"
>
开始
</div>
<img
src=
"../../../public/img/wheel.png"
alt=
"wheel"
/>
<img
src=
"../../../public/img/wheel.png"
alt=
"wheel"
/>
<!--
<div
class=
"circle"
></div>
-->
<div
<div
class=
"wheel-bg"
class=
"wheel-bg"
:class=
"
{freeze: freeze}"
:class=
"
{freeze: freeze}"
...
@@ -46,14 +45,24 @@
...
@@ -46,14 +45,24 @@
:style=
"`transform: rotate($
{(360/ prizeList.length) * index }deg)`"
:style=
"`transform: rotate($
{(360/ prizeList.length) * index }deg)`"
>
>
<div
class=
"prize-name"
>
{{
item
.
prizeName
}}
</div>
<div
class=
"prize-name"
>
{{
item
.
prizeName
}}
</div>
<div
class=
"prize-icon"
>
<div
class=
"prize-icon"
></div>
<!--
<p>
一等奖
</p>
-->
<!--
<img
src=
"/img/counter.png"
/>
-->
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
-->
<!--
<div
class=
"wheel"
>
<img
src=
"../../../public/img/wheel.png"
alt=
"wheel"
/>
<div
class=
"xttblog_box"
>
<canvas
id=
"xttblog"
>
抱歉!浏览器不支持。
</canvas>
<canvas
id=
"xttblog01"
width=
"200px"
height=
"200px"
>
抱歉!浏览器不支持。
</canvas>
<canvas
id=
"xttblog03"
width=
"200px"
height=
"200px"
>
抱歉!浏览器不支持。
</canvas>
<canvas
id=
"xttblog02"
width=
"150px"
height=
"150px"
>
抱歉!浏览器不支持。
</canvas>
<button
id=
"tupBtn"
class=
"taoge_btn"
></button>
</div>
</div>
-->
<div
style=
"width:360px; margin:15px auto;"
>
<canvas
id=
"bg"
></canvas>
</div>
</div>
<div
class=
"awards"
>
<div
class=
"awards"
>
<van-field
<van-field
...
@@ -105,7 +114,7 @@
...
@@ -105,7 +114,7 @@
</div>
</div>
</div>
</div>
<div
v-else
class=
"wrapper"
>
<div
v-else
class=
"wrapper"
>
<div
class=
"block"
style=
"background: #000;color: #fff;"
>
<div
class=
"block"
style=
"background: #000;color: #fff;"
>
<p
style=
"font-size: 22px;"
>
谢谢惠顾!
</p>
<p
style=
"font-size: 22px;"
>
谢谢惠顾!
</p>
<p
style=
"font-size: 14px;"
>
很遗憾,此次未能中奖,再接再厉!
</p>
<p
style=
"font-size: 14px;"
>
很遗憾,此次未能中奖,再接再厉!
</p>
</div>
</div>
...
@@ -126,6 +135,33 @@ export default {
...
@@ -126,6 +135,33 @@ export default {
components
:
{
wxAuth
},
components
:
{
wxAuth
},
data
()
{
data
()
{
return
{
return
{
award_timer
:
null
,
fillStyle
:
[
"rgb(255,154,0)"
,
"rgb(210,92,4)"
,
"rgb(255,154,0)"
,
"rgb(210,92,4)"
,
"rgb(255,154,0)"
,
"rgb(210,92,4)"
,
"rgb(255,154,0)"
,
"rgb(210,92,4)"
],
fillText
:
[],
width
:
360
,
height
:
360
,
c_x
:
180
,
c_y
:
180
,
radius
:
180
,
// 圆盘半径
index
:
0
,
whell_timer
:
null
,
running
:
false
,
// 是否运行中
speed
:
300
,
// 速度
isBeginPrize
:
false
,
// 是否开始抽奖
stepping
:
0
,
// 步数,经过一个扇形为1步
basecircle
:
6
,
// 点击开始时,圆盘旋转的圈数,旋转玩指定圈数之后,再根据selected的值确定奖项
selected
:
1
,
// 最终选中第几个扇形,也就是确定几等奖
isStop
:
false
,
show_share
:
true
,
show_share
:
true
,
goOn
:
false
,
goOn
:
false
,
env
:
""
,
env
:
""
,
...
@@ -182,6 +218,16 @@ export default {
...
@@ -182,6 +218,16 @@ export default {
name
:
"奖5"
,
name
:
"奖5"
,
icon
:
icon
:
"http://wuhanshangcheng.oss-cn-beijing.aliyuncs.com/shangchengnormal/7E4C1866C2874AA5A788B5E59630A7ED.png"
"http://wuhanshangcheng.oss-cn-beijing.aliyuncs.com/shangchengnormal/7E4C1866C2874AA5A788B5E59630A7ED.png"
},
{
name
:
"奖6"
,
icon
:
"http://wuhanshangcheng.oss-cn-beijing.aliyuncs.com/shangchengnormal/7E4C1866C2874AA5A788B5E59630A7ED.png"
},
{
name
:
"奖7"
,
icon
:
"http://wuhanshangcheng.oss-cn-beijing.aliyuncs.com/shangchengnormal/7E4C1866C2874AA5A788B5E59630A7ED.png"
}
}
],
],
activityName
:
""
,
activityName
:
""
,
...
@@ -193,6 +239,7 @@ export default {
...
@@ -193,6 +239,7 @@ export default {
};
};
},
},
async
created
()
{
async
created
()
{
console
.
log
(
'部署好了'
);
this
.
currentUrl
=
location
.
href
;
this
.
currentUrl
=
location
.
href
;
this
.
active_id
=
this
.
$route
.
query
.
id
;
this
.
active_id
=
this
.
$route
.
query
.
id
;
this
.
active_type
=
this
.
$route
.
query
.
active_type
;
this
.
active_type
=
this
.
$route
.
query
.
active_type
;
...
@@ -200,7 +247,6 @@ export default {
...
@@ -200,7 +247,6 @@ export default {
?
decodeURIComponent
(
this
.
$route
.
query
.
headurl
)
?
decodeURIComponent
(
this
.
$route
.
query
.
headurl
)
:
""
;
:
""
;
this
.
env
=
window
.
navigator
.
userAgent
.
toLowerCase
();
this
.
env
=
window
.
navigator
.
userAgent
.
toLowerCase
();
console
.
log
(
"env"
,
this
.
env
);
if
(
if
(
this
.
env
.
match
(
/MicroMessenger/i
)
==
"micromessenger"
&&
this
.
env
.
match
(
/MicroMessenger/i
)
==
"micromessenger"
&&
this
.
env
.
match
(
/wxwork/i
)
==
"wxwork"
this
.
env
.
match
(
/wxwork/i
)
==
"wxwork"
...
@@ -208,13 +254,12 @@ export default {
...
@@ -208,13 +254,12 @@ export default {
this
.
show_share
=
true
;
this
.
show_share
=
true
;
}
else
if
(
this
.
env
.
match
(
/MicroMessenger/i
)
==
"micromessenger"
)
{
}
else
if
(
this
.
env
.
match
(
/MicroMessenger/i
)
==
"micromessenger"
)
{
this
.
show_share
=
false
;
this
.
show_share
=
false
;
console
.
log
(
"验证"
);
// 1.获取code
// 1.获取code
if
(
this
.
$route
.
query
.
unionid
===
undefined
)
{
if
(
this
.
$route
.
query
.
unionid
===
undefined
)
{
this
.
getUnionid
();
this
.
getUnionid
();
}
else
{
}
else
{
this
.
userBaseInfo
.
unionid
=
JSON
.
stringify
(
this
.
$route
.
query
.
unionid
)
;
this
.
userBaseInfo
.
unionid
=
this
.
$route
.
query
.
unionid
;
this
.
userBaseInfo
.
openid
=
JSON
.
stringify
(
this
.
$route
.
query
.
openid
)
;
this
.
userBaseInfo
.
openid
=
this
.
$route
.
query
.
openid
;
let
params
=
{
let
params
=
{
number
:
7
,
number
:
7
,
unionId
:
this
.
$route
.
query
.
unionid
unionId
:
this
.
$route
.
query
.
unionid
...
@@ -267,6 +312,242 @@ export default {
...
@@ -267,6 +312,242 @@ export default {
}
}
},
},
methods
:
{
methods
:
{
// 画圆盘
drawCircle
(
isRunning
)
{
let
deg
=
Math
.
PI
/
180
;
let
startAngle
=
0
;
let
endAngle
=
0
;
let
canvas
=
document
.
getElementById
(
"bg"
);
let
fillText
=
this
.
prizeListOrigin
;
canvas
.
height
=
this
.
height
;
canvas
.
width
=
this
.
width
;
let
ctx
=
canvas
.
getContext
(
"2d"
);
for
(
let
i
=
0
;
i
<
fillText
.
length
;
i
++
)
{
startAngle
=
Math
.
PI
*
(
i
/
(
fillText
.
length
/
2
)
-
2
/
fillText
.
length
);
endAngle
=
startAngle
+
Math
.
PI
*
(
1
/
(
fillText
.
length
/
2
));
ctx
.
beginPath
();
// 正在运行的时候,改变当前扇形的颜色
if
(
isRunning
&&
this
.
index
==
i
)
{
ctx
.
fillStyle
=
"rgb(255,248,51)"
;
}
else
{
ctx
.
fillStyle
=
this
.
fillStyle
[
i
];
}
// 绘制扇形
ctx
.
moveTo
(
this
.
c_x
,
this
.
c_y
);
ctx
.
arc
(
this
.
c_x
,
this
.
c_y
,
this
.
radius
,
startAngle
,
endAngle
,
false
);
ctx
.
fill
();
}
// 绘制扇形上的文字
let
step
=
(
2
*
Math
.
PI
)
/
fillText
.
length
;
let
off_step
=
this
.
setOffStep
(
fillText
.
length
);
for
(
let
i
=
0
;
i
<
fillText
.
length
;
i
++
)
{
ctx
.
save
();
ctx
.
beginPath
();
ctx
.
translate
(
180
,
180
);
ctx
.
rotate
(
i
*
step
+
off_step
);
ctx
.
font
=
" 20px Microsoft YaHei"
;
ctx
.
fillStyle
=
"#000"
;
ctx
.
fillText
(
fillText
[
i
].
prizeName
,
-
30
,
-
120
,
60
);
// 书写转盘文字
ctx
.
font
=
" 14px Microsoft YaHei"
;
ctx
.
closePath
();
ctx
.
restore
();
}
// 绘制中心圆
ctx
.
beginPath
();
ctx
.
arc
(
this
.
c_x
,
this
.
c_y
,
50
,
0
,
2
*
Math
.
PI
,
1
);
ctx
.
fillStyle
=
"rgb(255,255,255)"
;
ctx
.
fill
();
// 绘制中心圆
ctx
.
font
=
"30px Microsoft YaHei"
;
// 创建渐变
let
gradient
=
ctx
.
createLinearGradient
(
0
,
0
,
this
.
width
,
0
);
gradient
.
addColorStop
(
"0"
,
"magenta"
);
gradient
.
addColorStop
(
"0.2"
,
"blue"
);
gradient
.
addColorStop
(
"0.8"
,
"red"
);
// 用渐变填色
ctx
.
textAlign
=
"center"
;
ctx
.
fillStyle
=
gradient
;
ctx
.
fillText
(
"开始"
,
this
.
c_x
,
this
.
c_y
+
10
);
// 绘制中心园边框
ctx
.
strokeStyle
=
"rgb(148,28,27)"
;
ctx
.
lineWidth
=
6
;
ctx
.
stroke
();
canvas
.
addEventListener
(
"mousedown"
,
this
.
mouseDown_Start
,
false
);
},
// 奖项名称偏移量
setOffStep
(
len
)
{
let
offset
=
0
;
switch
(
len
)
{
case
4
:
offset
=
0.75
;
break
;
case
6
:
offset
=
1
;
break
;
case
8
:
offset
=
1.2
;
break
;
default
:
offset
=
1
;
break
;
}
return
offset
;
},
// 初始化 抽奖参数
init
()
{
this
.
basecircle
=
this
.
prizeListOrigin
.
length
;
this
.
running
=
false
;
this
.
isBeginPrize
=
false
;
this
.
index
=
0
;
this
.
stepping
=
0
;
this
.
speed
=
300
;
},
// 开始抽奖
async
mouseDown_Start
(
e
)
{
let
canvas
=
document
.
getElementById
(
"bg"
);
let
local
=
this
.
getPointOnCanvas
(
canvas
,
e
.
pageX
,
e
.
pageY
);
if
(
local
.
x
>
100
&&
local
.
x
<
300
&&
local
.
y
>
100
&&
local
.
y
<
300
)
{
// 点击开始
// 开始前 必要检测
if
(
!
this
.
before_Start
())
{
// 检测未通过
return
false
;
}
if
(
this
.
running
)
{
this
.
$toast
(
"游戏进行中,请勿多次点击!"
);
return
false
;
}
await
this
.
game_result
();
this
.
init
();
// 转起来
this
.
wheel_timer
=
setInterval
(
this
.
rotate
,
this
.
speed
);
}
},
// 游戏开始前的检测
before_Start
()
{
let
check_res
=
true
;
if
(
this
.
$route
.
query
.
unionid
===
undefined
)
{
this
.
$toast
(
"请在微信端参与抽奖活动"
);
check_res
=
false
;
return
false
;
}
if
(
!
this
.
isMember
)
{
Dialog
.
confirm
({
title
:
"提示"
,
message
:
"当前活动为会员才可参加,尚未找到您的会员信息,是否前往注册?"
})
.
then
(()
=>
{
// on confirm
let
url
=
"http://oysales.oywanhao.com/register"
;
window
.
location
.
href
=
url
;
})
.
catch
(()
=>
{
// on cancel
return
false
;
});
check_res
=
false
;
return
false
;
}
if
(
this
.
game_end
)
{
this
.
$toast
(
"活动已结束"
);
check_res
=
false
;
return
false
;
}
return
check_res
;
},
// 游戏后台结果
async
game_result
()
{
let
params
=
{
activityId
:
this
.
active_id
,
openId
:
this
.
userBaseInfo
.
openid
,
phone
:
this
.
userBaseInfo
.
phone
,
unionId
:
this
.
userBaseInfo
.
unionid
,
userName
:
this
.
userBaseInfo
.
name
};
let
res
=
await
APi_Active
.
play
(
params
);
if
(
!
res
.
data
.
prizeId
)
{
this
.
$toast
(
res
.
data
.
message
);
return
false
;
}
else
{
// 在奖项列表中找到抽奖结果奖项的下标
let
id
=
this
.
prizeListOrigin
.
map
(
item
=>
item
.
id
)
.
indexOf
(
res
.
data
.
prizeId
);
this
.
selected
=
id
+
1
;
this
.
isAward
=
res
.
data
.
prizeName
!==
"谢谢惠顾"
;
// 中奖后 设置中奖奖品信息
if
(
this
.
isAward
)
{
this
.
awardGood
=
this
.
prizeListOrigin
[
id
];
this
.
awardGood
.
coupon
=
JSON
.
parse
(
this
.
prizeListOrigin
[
id
].
coupon
);
}
}
},
// 开始旋转
rotate
()
{
this
.
running
=
true
;
if
(
this
.
stepping
==
4
)
{
// 4步之后开始加速
this
.
clearTimer
();
this
.
speed
=
100
;
this
.
wheel_timer
=
setInterval
(
this
.
rotate
,
this
.
speed
);
}
if
(
this
.
basecircle
>
0
&&
this
.
index
==
this
.
prizeListOrigin
.
length
)
{
// 基本圈数借宿以后,开始随机抽奖
this
.
index
=
0
;
this
.
basecircle
--
;
if
(
this
.
basecircle
==
0
)
{
// 开始随机抽奖
this
.
clearTimer
();
this
.
speed
=
300
;
this
.
wheel_timer
=
setInterval
(
this
.
rotate
,
this
.
speed
);
this
.
isBeginPrize
=
true
;
}
}
if
(
this
.
isBeginPrize
&&
this
.
selected
>
0
)
{
// 开始抽奖
if
(
--
this
.
selected
==
0
)
{
//到了选择的奖项之后
this
.
clearTimer
();
this
.
running
=
false
;
this
.
award_timer
=
setTimeout
(()
=>
{
this
.
drawCircle
(
false
);
this
.
showAward
=
true
;
},
1000
);
}
else
{
this
.
clearTimer
();
this
.
speed
+=
100
;
this
.
wheel_timer
=
setInterval
(
this
.
rotate
,
this
.
speed
);
}
}
this
.
drawCircle
(
true
);
this
.
index
++
;
this
.
stepping
++
;
},
// 清理计时器
clearTimer
()
{
clearInterval
(
this
.
wheel_timer
);
this
.
wheel_timer
=
null
;
},
// 获取canvas里面的坐标
getPointOnCanvas
(
canvas
,
x
,
y
)
{
let
bbox
=
canvas
.
getBoundingClientRect
();
return
{
x
:
x
-
bbox
.
left
*
(
canvas
.
width
/
bbox
.
width
),
y
:
y
-
bbox
.
top
*
(
canvas
.
height
/
bbox
.
height
)
};
},
closeAward
()
{
closeAward
()
{
this
.
showAward
=
false
;
this
.
showAward
=
false
;
},
},
...
@@ -274,10 +555,10 @@ export default {
...
@@ -274,10 +555,10 @@ export default {
handleGoOn
()
{
handleGoOn
()
{
this
.
goOn
=
true
;
this
.
goOn
=
true
;
this
.
closeAward
();
this
.
closeAward
();
this
.
handleGet
();
},
},
// 领取(
// 领取(
handleGet
()
{
handleGet
()
{
console
.
log
(
"env"
,
this
.
env
);
if
(
if
(
this
.
env
.
match
(
/MicroMessenger/i
)
===
"micromessenger"
&&
this
.
env
.
match
(
/MicroMessenger/i
)
===
"micromessenger"
&&
this
.
env
.
match
(
/wxwork/i
)
==
"wxwork"
this
.
env
.
match
(
/wxwork/i
)
==
"wxwork"
...
@@ -303,15 +584,17 @@ export default {
...
@@ -303,15 +584,17 @@ export default {
return
false
;
return
false
;
}
}
// 会员领取
// 会员领取
console
.
log
(
"优惠券id"
,
this
.
awardGood
.
coupon
?
this
.
awardGood
.
coupon
.
id
:
this
.
couponDetail
.
id
);
let
params
=
{
let
params
=
{
couponId
:
this
.
awardGood
.
coupon
couponId
:
this
.
awardGood
.
coupon
?
this
.
awardGood
.
coupon
.
id
:
this
.
couponDetail
.
id
,
?
this
.
awardGood
.
coupon
.
id
:
this
.
couponDetail
.
id
,
unionId
:
this
.
userBaseInfo
.
unionid
,
unionId
:
this
.
userBaseInfo
.
unionid
,
vipId
:
this
.
userBaseInfo
.
vipId
vipId
:
this
.
userBaseInfo
.
vipId
};
};
APi_Active
.
collectMyCoupon
(
params
).
then
(
res
=>
{
APi_Active
.
collectMyCoupon
(
params
).
then
(
res
=>
{
this
.
closeAward
()
this
.
closeAward
()
;
if
(
res
.
data
==
"领取失败"
)
{
if
(
res
.
data
==
"领取失败"
)
{
this
.
$toast
(
"领取失败"
);
this
.
$toast
(
"领取失败"
);
return
false
;
return
false
;
...
@@ -356,6 +639,7 @@ export default {
...
@@ -356,6 +639,7 @@ export default {
document
.
getElementById
(
"timer"
).
innerHTML
=
"已结束"
;
document
.
getElementById
(
"timer"
).
innerHTML
=
"已结束"
;
this
.
game_end
=
true
;
this
.
game_end
=
true
;
}
}
this
.
drawCircle
(
false
);
}
}
});
});
},
},
...
@@ -369,46 +653,19 @@ export default {
...
@@ -369,46 +653,19 @@ export default {
window
.
location
.
href
=
`http://wxsyls.oysd.cn/getwxuserinfo.aspx?jump=
${
redirect_uri
}
`
;
window
.
location
.
href
=
`http://wxsyls.oysd.cn/getwxuserinfo.aspx?jump=
${
redirect_uri
}
`
;
},
},
Start_Game
()
{
Start_Game
()
{
// 在微信端打开 会有身份验证 路径中会带上 unionid
if
(
this
.
$route
.
query
.
unionid
===
undefined
)
{
this
.
$toast
(
"请在微信端参与抽奖活动"
);
return
false
;
}
if
(
!
this
.
isMember
)
{
console
.
log
(
"非会员"
);
Dialog
.
confirm
({
title
:
"提示"
,
message
:
"当前活动为会员才可参加,尚未找到您的会员信息,是否前往注册?"
})
.
then
(()
=>
{
// on confirm
let
url
=
"http://oysales.oywanhao.com/register"
;
window
.
location
.
href
=
url
;
})
.
catch
(()
=>
{
// on cancel
return
false
;
});
return
false
;
}
if
(
this
.
game_end
)
{
this
.
$toast
(
"活动已结束"
);
return
false
;
}
if
(
this
.
rolling
)
{
if
(
this
.
rolling
)
{
this
.
$toast
(
"抽奖中,请勿多次点击!"
);
this
.
$toast
(
"抽奖中,请勿多次点击!"
);
return
false
;
return
false
;
}
}
let
params
=
{
let
params
=
{
activityId
:
this
.
active_id
,
activityId
:
this
.
active_id
,
openId
:
this
.
userBaseInfo
.
openid
||
"ofoA-xMYdB2XA1Ss-ycCeRy9HV4A"
,
openId
:
this
.
userBaseInfo
.
openid
,
phone
:
this
.
userBaseInfo
.
phone
,
phone
:
this
.
userBaseInfo
.
phone
,
unionId
:
this
.
userBaseInfo
.
unionid
||
"oCIMxuMlt5vxRZgl-pNIxOjyYQ20"
,
unionId
:
this
.
userBaseInfo
.
unionid
,
userName
:
this
.
userBaseInfo
.
name
userName
:
this
.
userBaseInfo
.
name
};
};
const
{
wheelDeg
,
prizeList
}
=
this
;
//
const { wheelDeg, prizeList } = this;
this
.
rolling
=
true
;
//
this.rolling = true;
APi_Active
.
play
(
params
)
APi_Active
.
play
(
params
)
.
then
(
res
=>
{
.
then
(
res
=>
{
if
(
!
res
.
data
.
prizeId
)
{
if
(
!
res
.
data
.
prizeId
)
{
...
@@ -416,6 +673,7 @@ export default {
...
@@ -416,6 +673,7 @@ export default {
this
.
$toast
(
res
.
data
.
message
);
this
.
$toast
(
res
.
data
.
message
);
return
false
;
return
false
;
}
}
// 中奖的奖项下标
const
random
=
prizeList
const
random
=
prizeList
.
map
(
item
=>
item
.
id
)
.
map
(
item
=>
item
.
id
)
.
indexOf
(
res
.
data
.
prizeId
);
.
indexOf
(
res
.
data
.
prizeId
);
...
@@ -429,10 +687,8 @@ export default {
...
@@ -429,10 +687,8 @@ export default {
this
.
rolling
=
false
;
this
.
rolling
=
false
;
this
.
showAward
=
true
;
this
.
showAward
=
true
;
if
(
!
this
.
isAward
)
{
if
(
!
this
.
isAward
)
{
console
.
log
(
'谢谢惠顾'
);
console
.
log
(
"谢谢惠顾"
);
// this.showAward = false;
}
else
{
}
else
{
// this.showAward = true;
this
.
awardGood
=
prizeList
[
random
];
this
.
awardGood
=
prizeList
[
random
];
this
.
awardGood
.
coupon
=
JSON
.
parse
(
prizeList
[
random
].
coupon
);
this
.
awardGood
.
coupon
=
JSON
.
parse
(
prizeList
[
random
].
coupon
);
console
.
log
(
this
.
awardGood
);
console
.
log
(
this
.
awardGood
);
...
@@ -503,6 +759,7 @@ export default {
...
@@ -503,6 +759,7 @@ export default {
},
},
destroyed
()
{
destroyed
()
{
clearInterval
(
this
.
timer
);
clearInterval
(
this
.
timer
);
clearTimeout
(
this
.
award_timer
);
}
}
};
};
</
script
>
</
script
>
...
@@ -615,8 +872,74 @@ export default {
...
@@ -615,8 +872,74 @@ export default {
}
}
.wheel
{
.wheel
{
position
:
relative
;
//
position: relative;
width
:
100%
;
width
:
100%
;
position
:
relative
;
margin
:
32px
auto
;
.xttblog_box
{
// width: 300px;
// height: 300px;
// margin: 100px auto;
// position: relative;
position
:
absolute
;
top
:
0
;
left
:
0
;
width
:
100%
;
height
:
100%
;
}
.xttblog_box
canvas
{
position
:
absolute
;
}
#xttblog
{
top
:
16%
;
left
:
15%
;
background-color
:
white
;
border-radius
:
100%
;
}
#xttblog01
,
#xttblog03
{
top
:
38%
;
left
:
38%
;
z-index
:
30
;
}
#xttblog02
{
top
:
41%
;
left
:
41%
;
z-index
:
20
;
}
#xttblog
{
-o-transform
:
transform
6s
;
-ms-transform
:
transform
6s
;
-moz-transform
:
transform
6s
;
-webkit-transform
:
transform
6s
;
transition
:
transform
6s
;
-o-transform-origin
:
50%
50%
;
-ms-transform-origin
:
50%
50%
;
-moz-transform-origin
:
50%
50%
;
-webkit-transform-origin
:
50%
50%
;
transform-origin
:
50%
50%
;
}
.taoge_btn
{
width
:
60px
;
height
:
60px
;
left
:
120px
;
top
:
120px
;
border-radius
:
100%
;
position
:
absolute
;
cursor
:
pointer
;
border
:
none
;
background
:
transparent
;
outline
:
none
;
z-index
:
40
;
}
img
{
img
{
width
:
100%
;
width
:
100%
;
}
}
...
@@ -724,6 +1047,7 @@ export default {
...
@@ -724,6 +1047,7 @@ export default {
width
:
100%
;
width
:
100%
;
padding
:
5px
1px
;
padding
:
5px
1px
;
background
:
#fff
;
background
:
#fff
;
margin
:
10px
0
;
.t
{
.t
{
position
:
relative
;
position
:
relative
;
font-size
:
16px
;
font-size
:
16px
;
...
...
This diff is collapsed.
Click to expand it.
wx_application/src/views/active/createBigWheelActive.vue
View file @
fc538223
...
@@ -615,10 +615,20 @@ export default {
...
@@ -615,10 +615,20 @@ export default {
this
.
$toast
(
"请完整填写表单!"
);
this
.
$toast
(
"请完整填写表单!"
);
return
false
;
return
false
;
}
}
if
(
Number
(
this
.
basicInfo
.
jointimes
)
>
Number
(
this
.
basicInfo
.
total_join
))
{
if
(
Number
(
this
.
basicInfo
.
jointimes
)
>
Number
(
this
.
basicInfo
.
total_join
)
)
{
this
.
$toast
(
"会员单日参与次数应小于等于会员总参与次数"
);
this
.
$toast
(
"会员单日参与次数应小于等于会员总参与次数"
);
return
false
;
return
false
;
}
}
if
(
this
.
prizeList
.
length
<
2
||
this
.
prizeList
.
length
%
2
!=
0
||
this
.
prizeList
.
length
>
8
)
{
this
.
$toast
(
"奖项必须大于2小于8,且为偶数个!"
);
return
false
;
}
let
validate
=
null
;
let
validate
=
null
;
for
(
let
i
in
this
.
prizeList
)
{
for
(
let
i
in
this
.
prizeList
)
{
if
(
this
.
prizeList
[
i
].
type
==
""
)
{
if
(
this
.
prizeList
[
i
].
type
==
""
)
{
...
@@ -640,14 +650,20 @@ export default {
...
@@ -640,14 +650,20 @@ export default {
break
;
break
;
}
}
if
(
Number
(
this
.
prizeList
[
i
].
total_limit
)
<
Number
(
this
.
prizeList
[
i
].
preLimit
))
{
if
(
Number
(
this
.
prizeList
[
i
].
total_limit
)
<
Number
(
this
.
prizeList
[
i
].
preLimit
)
)
{
console
.
log
(
this
.
prizeList
[
i
].
total_limit
);
console
.
log
(
this
.
prizeList
[
i
].
total_limit
);
console
.
log
(
this
.
prizeList
[
i
].
preLimit
);
console
.
log
(
this
.
prizeList
[
i
].
preLimit
);
this
.
$toast
(
`奖项
${
i
+
1
}
,总发放数量应大于等于每日发放数量`
);
this
.
$toast
(
`奖项
${
i
+
1
}
,总发放数量应大于等于每日发放数量`
);
validate
=
false
;
validate
=
false
;
break
;
break
;
}
}
if
(
Number
(
this
.
prizeList
[
i
].
total_limit
)
<
Number
(
this
.
prizeList
[
i
].
limit
))
{
if
(
Number
(
this
.
prizeList
[
i
].
total_limit
)
<
Number
(
this
.
prizeList
[
i
].
limit
)
)
{
this
.
$toast
(
`奖项
${
i
+
1
}
,总发放数量应大于每人限领数量`
);
this
.
$toast
(
`奖项
${
i
+
1
}
,总发放数量应大于每人限领数量`
);
validate
=
false
;
validate
=
false
;
break
;
break
;
...
@@ -716,28 +732,30 @@ export default {
...
@@ -716,28 +732,30 @@ export default {
},
},
activityPrizes
:
params_prizeList
activityPrizes
:
params_prizeList
};
};
API_Active
.
createActive
(
params
).
then
(
res
=>
{
API_Active
.
createActive
(
params
)
this
.
create_times
=
1
;
.
then
(
res
=>
{
if
(
res
.
result
===
"fail"
)
{
this
.
create_times
=
1
;
this
.
$toast
(
res
.
errorMsg
);
if
(
res
.
result
===
"fail"
)
{
return
false
;
this
.
$toast
(
res
.
errorMsg
);
}
return
false
;
Toast
.
success
(
"创建成功"
);
}
setTimeout
(()
=>
{
Toast
.
success
(
"创建成功"
);
this
.
$router
.
push
({
setTimeout
(()
=>
{
name
:
"createSuccess"
,
this
.
$router
.
push
({
params
:
{
name
:
"createSuccess"
,
activityId
:
res
.
data
.
activityInfo
.
id
,
params
:
{
activityType
:
"wheel"
,
activityId
:
res
.
data
.
activityInfo
.
id
,
logo
:
this
.
logo_imgs
[
0
].
url
,
activityType
:
"wheel"
,
des
:
this
.
message
logo
:
this
.
logo_imgs
[
0
].
url
,
}
des
:
this
.
message
});
}
},
200
);
});
}).
catch
(
error
=>
{
},
200
);
this
.
create_times
=
1
;
})
console
.
log
(
error
);
.
catch
(
error
=>
{
});
this
.
create_times
=
1
;
console
.
log
(
error
);
});
},
},
startTimeChange
(
e
)
{
startTimeChange
(
e
)
{
let
startTimeArr
=
e
.
getValues
();
let
startTimeArr
=
e
.
getValues
();
...
@@ -855,14 +873,21 @@ export default {
...
@@ -855,14 +873,21 @@ export default {
return
newString
;
return
newString
;
},
},
addPrice
()
{
addPrice
()
{
if
(
this
.
prizeList
.
length
>
5
)
{
if
(
this
.
prizeList
.
length
>
7
)
{
this
.
$toast
(
"最多设置
6
个奖项"
);
this
.
$toast
(
"最多设置
8
个奖项"
);
return
;
return
false
;
}
}
// 计算剩余 概率
// 计算剩余 概率
let
temp
=
100
;
let
temp
=
100
;
let
total
=
0
;
this
.
prizeList
.
forEach
(
p
=>
{
this
.
prizeList
.
forEach
(
p
=>
{
temp
-=
Number
(
p
.
probability
);
total
+=
Number
(
p
.
probability
);
if
(
total
===
100
)
{
this
.
prizeList
[
0
].
probability
-=
1
;
temp
=
1
;
}
else
{
temp
-=
Number
(
p
.
probability
);
}
});
});
// this.remain_probability -= Number(this.prizeList[this.prizeList.length-1].probability)
// this.remain_probability -= Number(this.prizeList[this.prizeList.length-1].probability)
this
.
prizeList
.
push
({
this
.
prizeList
.
push
({
...
...
This diff is collapsed.
Click to expand it.
wx_application/src/views/coupon/addCoupon.vue
View file @
fc538223
...
@@ -138,7 +138,7 @@
...
@@ -138,7 +138,7 @@
/>
/>
</
template
>
</
template
>
</van-cell>
</van-cell>
<van-cell
title=
"优惠券ID"
style=
"font-size:14px;"
>
<
!-- <
van-cell title="优惠券ID" style="font-size:14px;">
<template slot="default">
<template slot="default">
<div class="npbr">
<div class="npbr">
<van-field
<van-field
...
@@ -156,7 +156,7 @@
...
@@ -156,7 +156,7 @@
/>
/>
</div>
</div>
</template>
</template>
</van-cell>
</van-cell>
-->
<van-cell
title=
"总限制次数"
style=
"font-size:14px;"
class=
"js"
>
<van-cell
title=
"总限制次数"
style=
"font-size:14px;"
class=
"js"
>
<van-stepper
<van-stepper
v-model=
"addForm.limitOfUse"
v-model=
"addForm.limitOfUse"
...
...
This diff is collapsed.
Click to expand it.
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