|
|
@ -4,16 +4,11 @@ |
|
|
|
<image src="../static/head.jpg" mode="widthFix" class="width100"></image> |
|
|
|
<image src="../static/head.jpg" mode="widthFix" class="width100"></image> |
|
|
|
<view class="almost-lottery__wheel"> |
|
|
|
<view class="almost-lottery__wheel"> |
|
|
|
<AlmostLottery :lottery-size="lotteryConfig.lotterySize" :action-size="lotteryConfig.actionSize" |
|
|
|
<AlmostLottery :lottery-size="lotteryConfig.lotterySize" :action-size="lotteryConfig.actionSize" |
|
|
|
:ring-count="2" :duration="3" :prize-list="prizeList" :prize-index="prizeIndex" |
|
|
|
:ring-count="2" :duration="5" :prize-list="prizeList" :prize-index="prizeIndex" |
|
|
|
@reset-index="prizeIndex = -1" @draw-start="handleDrawStart" @draw-end="handleDrawEnd" |
|
|
|
@reset-index="prizeIndex = -1" @draw-start="handleDrawStart" @draw-end="handleDrawEnd" |
|
|
|
@finish="handleDrawFinish" v-if="prizeList.length" /> |
|
|
|
@finish="handleDrawFinish" v-if="prizeList.length" /> |
|
|
|
</view> |
|
|
|
</view> |
|
|
|
<view class="almost-lottery__rule"> |
|
|
|
<view class="almost-lottery__rule"> |
|
|
|
<!-- <view class="rule-head"> |
|
|
|
|
|
|
|
<view class="line"></view> |
|
|
|
|
|
|
|
<text class="title">中奖名单</text> |
|
|
|
|
|
|
|
<view class="line"></view> |
|
|
|
|
|
|
|
</view> --> |
|
|
|
|
|
|
|
<view class="_notice"> |
|
|
|
<view class="_notice"> |
|
|
|
<swiper class="_swiper tc" indicator-dots="false" autoplay="true" :interval="interval" circular="true" |
|
|
|
<swiper class="_swiper tc" indicator-dots="false" autoplay="true" :interval="interval" circular="true" |
|
|
|
display-multiple-items="2" :duration="duration"> |
|
|
|
display-multiple-items="2" :duration="duration"> |
|
|
@ -24,11 +19,11 @@ |
|
|
|
<view class="swiper-item uni-bg-red"></view> |
|
|
|
<view class="swiper-item uni-bg-red"></view> |
|
|
|
</swiper-item> |
|
|
|
</swiper-item> |
|
|
|
<swiper-item v-for="(item,index) in list" :key="index"> |
|
|
|
<swiper-item v-for="(item,index) in list" :key="index"> |
|
|
|
<view class="swiper-item uni-bg-red">{{item}}</view> |
|
|
|
<view class="swiper-item uni-bg-red">恭喜{{item.phone}}获得{{item.awardName}}</view> |
|
|
|
</swiper-item> |
|
|
|
</swiper-item> |
|
|
|
</swiper> |
|
|
|
</swiper> |
|
|
|
</view> |
|
|
|
</view> |
|
|
|
|
|
|
|
<view class="font14 fotct mart10 marb10">拥有{{ LotteryNum }}次抽奖机会</view> |
|
|
|
<view class="rule-head"> |
|
|
|
<view class="rule-head"> |
|
|
|
<view class="line"></view> |
|
|
|
<view class="line"></view> |
|
|
|
<text class="title">活动规则</text> |
|
|
|
<text class="title">活动规则</text> |
|
|
@ -36,42 +31,7 @@ |
|
|
|
</view> |
|
|
|
</view> |
|
|
|
<view class="rule-body"> |
|
|
|
<view class="rule-body"> |
|
|
|
<view class="item"> |
|
|
|
<view class="item"> |
|
|
|
<view class="number">1.</view> |
|
|
|
<rich-text class="text font14" :nodes="activityInfo"></rich-text> |
|
|
|
<view class="text"> |
|
|
|
|
|
|
|
<text>活动时间:</text> |
|
|
|
|
|
|
|
<text>10.1-10.31</text> |
|
|
|
|
|
|
|
</view> |
|
|
|
|
|
|
|
</view> |
|
|
|
|
|
|
|
<view class="item"> |
|
|
|
|
|
|
|
<view class="number">2.</view> |
|
|
|
|
|
|
|
<view class="text"> |
|
|
|
|
|
|
|
<text>参与对象:</text> |
|
|
|
|
|
|
|
<text>重庆地区使用中石化码商加油的客户。</text> |
|
|
|
|
|
|
|
</view> |
|
|
|
|
|
|
|
</view> |
|
|
|
|
|
|
|
<view class="item"> |
|
|
|
|
|
|
|
<view class="number">3.</view> |
|
|
|
|
|
|
|
<view class="text"> |
|
|
|
|
|
|
|
<text>参与规则:</text> |
|
|
|
|
|
|
|
<text>使用码商加油券的用户,活动期间内每使用一次就可以获得一次抽奖机会。</text> |
|
|
|
|
|
|
|
</view> |
|
|
|
|
|
|
|
</view> |
|
|
|
|
|
|
|
<view class="item item-rule"> |
|
|
|
|
|
|
|
<view class="number">4.</view> |
|
|
|
|
|
|
|
<view class="text"> |
|
|
|
|
|
|
|
<text>奖励说明:</text> |
|
|
|
|
|
|
|
<text style="margin-top: 1px;">1.一等奖1000元加油券(4名)</text> |
|
|
|
|
|
|
|
<text style="margin-top: 1px;">2.二等奖500元加油券(12名)</text> |
|
|
|
|
|
|
|
<text style="margin-top: 1px;">3.三等奖300元加油券(20名)</text> |
|
|
|
|
|
|
|
<text style="margin-top: 1px;">4.参与奖20元(200-20)抵扣券(2000名)</text> |
|
|
|
|
|
|
|
</view> |
|
|
|
|
|
|
|
</view> |
|
|
|
|
|
|
|
<view class="item"> |
|
|
|
|
|
|
|
<view class="number">5.</view> |
|
|
|
|
|
|
|
<view class="text"> |
|
|
|
|
|
|
|
<text>奖品兑换:</text> |
|
|
|
|
|
|
|
<text>中奖产品自动放入系统卡包,在我的-我的优惠券中查看,90天内有效。</text> |
|
|
|
|
|
|
|
</view> |
|
|
|
|
|
|
|
</view> |
|
|
|
</view> |
|
|
|
</view> |
|
|
|
</view> |
|
|
|
</view> |
|
|
|
</view> |
|
|
@ -80,6 +40,13 @@ |
|
|
|
|
|
|
|
|
|
|
|
<script> |
|
|
|
<script> |
|
|
|
import AlmostLottery from '../../uni_modules/almost-lottery/components/almost-lottery/almost-lottery.vue' |
|
|
|
import AlmostLottery from '../../uni_modules/almost-lottery/components/almost-lottery/almost-lottery.vue' |
|
|
|
|
|
|
|
import { |
|
|
|
|
|
|
|
getActivityByCoupon, |
|
|
|
|
|
|
|
userLottery, |
|
|
|
|
|
|
|
getUserLotteryNum, |
|
|
|
|
|
|
|
getWinLotteryList |
|
|
|
|
|
|
|
} from '../../Utils/Api.js'; |
|
|
|
|
|
|
|
let app = getApp(); |
|
|
|
export default { |
|
|
|
export default { |
|
|
|
name: 'Home', |
|
|
|
name: 'Home', |
|
|
|
components: { |
|
|
|
components: { |
|
|
@ -87,6 +54,17 @@ |
|
|
|
}, |
|
|
|
}, |
|
|
|
data() { |
|
|
|
data() { |
|
|
|
return { |
|
|
|
return { |
|
|
|
|
|
|
|
imageUrl: app.globalData.imgUrl, |
|
|
|
|
|
|
|
//活动id |
|
|
|
|
|
|
|
activityId : '', |
|
|
|
|
|
|
|
//获取中间参数 |
|
|
|
|
|
|
|
userLotteryId:'', |
|
|
|
|
|
|
|
//抽奖次数 |
|
|
|
|
|
|
|
LotteryNum:'', |
|
|
|
|
|
|
|
//活动描述 |
|
|
|
|
|
|
|
activityInfo:'', |
|
|
|
|
|
|
|
//卡券id |
|
|
|
|
|
|
|
couponId:'', |
|
|
|
// 开启调试模式 |
|
|
|
// 开启调试模式 |
|
|
|
isDev: true, |
|
|
|
isDev: true, |
|
|
|
background: ['color1', 'color2', 'color3'], |
|
|
|
background: ['color1', 'color2', 'color3'], |
|
|
@ -138,7 +116,7 @@ |
|
|
|
freeNumDay: 3, |
|
|
|
freeNumDay: 3, |
|
|
|
interval: 3000, |
|
|
|
interval: 3000, |
|
|
|
duration: 12000, |
|
|
|
duration: 12000, |
|
|
|
list: ['1分钟前,无夏购买了会员', '2分钟前,无夏购买了会员', '3分钟前,无夏购买了会员'] |
|
|
|
list: [] |
|
|
|
} |
|
|
|
} |
|
|
|
}, |
|
|
|
}, |
|
|
|
computed: { |
|
|
|
computed: { |
|
|
@ -147,7 +125,6 @@ |
|
|
|
} |
|
|
|
} |
|
|
|
}, |
|
|
|
}, |
|
|
|
methods: { |
|
|
|
methods: { |
|
|
|
|
|
|
|
|
|
|
|
changeIndicatorDots(e) { |
|
|
|
changeIndicatorDots(e) { |
|
|
|
this.indicatorDots = !this.indicatorDots |
|
|
|
this.indicatorDots = !this.indicatorDots |
|
|
|
}, |
|
|
|
}, |
|
|
@ -163,179 +140,87 @@ |
|
|
|
// 重新生成 |
|
|
|
// 重新生成 |
|
|
|
handleInitCanvas() { |
|
|
|
handleInitCanvas() { |
|
|
|
this.prizeList = [] |
|
|
|
this.prizeList = [] |
|
|
|
this.getPrizeList() |
|
|
|
this.getActivityByCoupon() |
|
|
|
|
|
|
|
}, |
|
|
|
|
|
|
|
// 获取中奖奖品 |
|
|
|
|
|
|
|
userLottery() { |
|
|
|
|
|
|
|
let params = { |
|
|
|
|
|
|
|
activityId: this.activityId |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
userLottery(params).then(res => { |
|
|
|
|
|
|
|
if (res.return_code == '000000') { |
|
|
|
|
|
|
|
this.userLotteryId = res.return_data.activityAwardId; |
|
|
|
|
|
|
|
this.remoteGetPrizeIndex(); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
}); |
|
|
|
|
|
|
|
}, |
|
|
|
|
|
|
|
//中奖次数 |
|
|
|
|
|
|
|
getUserLotteryNum(){ |
|
|
|
|
|
|
|
let params = { |
|
|
|
|
|
|
|
activityId: this.activityId |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
getUserLotteryNum(params).then(res => { |
|
|
|
|
|
|
|
if (res.return_code == '000000') { |
|
|
|
|
|
|
|
this.LotteryNum = res.return_data; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
}); |
|
|
|
|
|
|
|
}, |
|
|
|
|
|
|
|
//中奖名单 |
|
|
|
|
|
|
|
getWinLotteryList(){ |
|
|
|
|
|
|
|
let params = { |
|
|
|
|
|
|
|
activityId: this.activityId |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
getWinLotteryList(params).then(res => { |
|
|
|
|
|
|
|
if (res.return_code == '000000') { |
|
|
|
|
|
|
|
this.list = res.return_data; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
}); |
|
|
|
}, |
|
|
|
}, |
|
|
|
// 获取奖品列表 |
|
|
|
// 获取奖品列表 |
|
|
|
getPrizeList() { |
|
|
|
getActivityByCoupon() { |
|
|
|
uni.showLoading({ |
|
|
|
uni.showLoading({ |
|
|
|
title: '奖品准备中...' |
|
|
|
title: '奖品准备中...' |
|
|
|
}) |
|
|
|
}) |
|
|
|
// 等待接口返回的数据进一步处理 |
|
|
|
let params = { |
|
|
|
// let res = await this.requestApiGetPrizeList() |
|
|
|
couponId: this.couponId |
|
|
|
// if (res.ok) { |
|
|
|
} |
|
|
|
// uni.hideLoading() |
|
|
|
getActivityByCoupon(params).then(res => { |
|
|
|
// let data = res.data |
|
|
|
if (res.return_code == '000000') { |
|
|
|
// if (data.length) { |
|
|
|
let prizeLists = res.return_data.activityAward; |
|
|
|
this.prizeList = [{ |
|
|
|
this.activityId = res.return_data.activityInfo.id; |
|
|
|
prizeId: 1, |
|
|
|
let prizesList = []; |
|
|
|
prizeName: '0.1元现金', |
|
|
|
|
|
|
|
prizeStock: 10, |
|
|
|
prizeLists.map((r) => { |
|
|
|
prizeWeight: 200, |
|
|
|
const pris = new prizeListNew(); |
|
|
|
prizeImage: '/static/img/order3.png' |
|
|
|
pris.prizeId = r.id; |
|
|
|
}, |
|
|
|
pris.prizeImage = this.imageUrl + r.img; |
|
|
|
{ |
|
|
|
pris.prizeName = r.name; |
|
|
|
prizeId: 2, |
|
|
|
prizesList.push(pris); |
|
|
|
prizeName: '10元现金', |
|
|
|
|
|
|
|
prizeStock: 0, |
|
|
|
|
|
|
|
prizeWeight: 50, |
|
|
|
|
|
|
|
prizeImage: 'https://vkceyugu.cdn.bspapp.com/VKCEYUGU-dc-site/56f085e0-bcfe-11ea-b244-a9f5e5565f30.png' |
|
|
|
|
|
|
|
}, |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
prizeId: 3, |
|
|
|
|
|
|
|
prizeName: '5元话费', |
|
|
|
|
|
|
|
prizeStock: 1, |
|
|
|
|
|
|
|
prizeWeight: 80, |
|
|
|
|
|
|
|
prizeImage: 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADIAAAAyCAYAAAAeP4ixAAABCElEQVRoge3YMa4BURSH8Y8o7UAp0WgkotBZwluAfhqlZSgUGr23ENUUCpppJnTswAIUSCaTiziZJ8d9/193zdzrfMltABF5plb+oLscDoAV0Pn8OC/lwDhL0k35QT3wstcIuM61Cj0IhXiNuAvOFwr5SgrxRiHeKMSbhnHfAVgU1i1gajhnBpwK6wnQtgxkDTlmSTq/L7rLYQ9byG+WpLvCOT8YQ6K5WgrxRiHeKMQbhXijEG8U4o1CvIkmxPrDquwMrI37KlFJSJake2BUxVlW0VytaEKsV6t5+8Ohak3rRmtIH9hav/QvRHO1FOKNQrwJheQfn+I9wflCIeNHLzuQc51PRP6rC1ZeIm1I8cC5AAAAAElFTkSuQmCC' |
|
|
|
|
|
|
|
}, |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
prizeId: 4, |
|
|
|
|
|
|
|
prizeName: '50元现金', |
|
|
|
|
|
|
|
prizeStock: 0, |
|
|
|
|
|
|
|
prizeWeight: 10, |
|
|
|
|
|
|
|
prizeImage: 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABkAAAAZCAYAAADE6YVjAAAB2klEQVRIia3Wv09TURjG8U+u2kQZcNENh2ok0cnJ0R+L0RB2g/EvwITEwRgnV0Zx0fAHYBh0khBD4sBAmAgDiwQNg4qwmSBDAYf7Fi+n97al9UlObnvO836f3tO355b2GsAYZrCBPRzGdSPmx8J3YtXwDDsB7TR2wl/rNmAYK13C07ES9W11E9s9BjTHdnBKVf8PAcWgehpwCssF0w/5FzqLgw7AA7zDQ/wqzC8H90jjSeFMYW0Yr8PzALfjOh7z1wve2YTzpLlQw2ay+KZ1N7vS24SziVqGexhKzB07pEJXk/dDwTetdZ9HewwZLWFNw2oyudZjQFNrCW8109pqS32GpPX1TOu586fPkLR+IEMjmbzYZ0ha34Atx/fwW58hXxPeFixo7Yg7PQbcKmEtZFgsMb/C4AkDBuUnQKpFuFZI3cZuvP6C+8g6wDP572O95C4Og49/W/YJl/G5YPqO9yV3dh4f8LMCfhjcI93Afix8xAX5SVx2YBY10yagEdxjmiwY7uISXuIFrlSEPG0TMllWcAbzYViXd0rzeXC6ImSiImA+eKU6h7mCeV/eCBMnCJkLzpHSztnFCJ7L//ZkOFv1iRLtRd1IcLpSHVP4jccVnkexPqXkmd7UX15b7tiz29ReAAAAAElFTkSuQmCC' |
|
|
|
|
|
|
|
}, |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
prizeId: 5, |
|
|
|
|
|
|
|
prizeName: '1卷抽纸', |
|
|
|
|
|
|
|
prizeStock: 3, |
|
|
|
|
|
|
|
prizeWeight: 3000, |
|
|
|
|
|
|
|
prizeImage: 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADIAAAAyCAYAAAAeP4ixAAABCElEQVRoge3YMa4BURSH8Y8o7UAp0WgkotBZwluAfhqlZSgUGr23ENUUCpppJnTswAIUSCaTiziZJ8d9/193zdzrfMltABF5plb+oLscDoAV0Pn8OC/lwDhL0k35QT3wstcIuM61Cj0IhXiNuAvOFwr5SgrxRiHeKMSbhnHfAVgU1i1gajhnBpwK6wnQtgxkDTlmSTq/L7rLYQ9byG+WpLvCOT8YQ6K5WgrxRiHeKMQbhXijEG8U4o1CvIkmxPrDquwMrI37KlFJSJake2BUxVlW0VytaEKsV6t5+8Ohak3rRmtIH9hav/QvRHO1FOKNQrwJheQfn+I9wflCIeNHLzuQc51PRP6rC1ZeIm1I8cC5AAAAAElFTkSuQmCC' |
|
|
|
|
|
|
|
}, |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
prizeId: 6, |
|
|
|
|
|
|
|
prizeName: '0.2元现金', |
|
|
|
|
|
|
|
prizeStock: 8, |
|
|
|
|
|
|
|
prizeWeight: 120, |
|
|
|
|
|
|
|
prizeImage: 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADIAAAAyCAYAAAAeP4ixAAABCElEQVRoge3YMa4BURSH8Y8o7UAp0WgkotBZwluAfhqlZSgUGr23ENUUCpppJnTswAIUSCaTiziZJ8d9/193zdzrfMltABF5plb+oLscDoAV0Pn8OC/lwDhL0k35QT3wstcIuM61Cj0IhXiNuAvOFwr5SgrxRiHeKMSbhnHfAVgU1i1gajhnBpwK6wnQtgxkDTlmSTq/L7rLYQ9byG+WpLvCOT8YQ6K5WgrxRiHeKMQbhXijEG8U4o1CvIkmxPrDquwMrI37KlFJSJake2BUxVlW0VytaEKsV6t5+8Ohak3rRmtIH9hav/QvRHO1FOKNQrwJheQfn+I9wflCIeNHLzuQc51PRP6rC1ZeIm1I8cC5AAAAAElFTkSuQmCC' |
|
|
|
|
|
|
|
}, |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
prizeId: 7, |
|
|
|
|
|
|
|
prizeName: '谢谢参与', |
|
|
|
|
|
|
|
prizeStock: 100, |
|
|
|
|
|
|
|
prizeWeight: 10000, |
|
|
|
|
|
|
|
prizeImage: 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADIAAAAyCAYAAAAeP4ixAAABCElEQVRoge3YMa4BURSH8Y8o7UAp0WgkotBZwluAfhqlZSgUGr23ENUUCpppJnTswAIUSCaTiziZJ8d9/193zdzrfMltABF5plb+oLscDoAV0Pn8OC/lwDhL0k35QT3wstcIuM61Cj0IhXiNuAvOFwr5SgrxRiHeKMSbhnHfAVgU1i1gajhnBpwK6wnQtgxkDTlmSTq/L7rLYQ9byG+WpLvCOT8YQ6K5WgrxRiHeKMQbhXijEG8U4o1CvIkmxPrDquwMrI37KlFJSJake2BUxVlW0VytaEKsV6t5+8Ohak3rRmtIH9hav/QvRHO1FOKNQrwJheQfn+I9wflCIeNHLzuQc51PRP6rC1ZeIm1I8cC5AAAAAElFTkSuQmCC' |
|
|
|
|
|
|
|
}, |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
prizeId: 8, |
|
|
|
|
|
|
|
prizeName: '100金币', |
|
|
|
|
|
|
|
prizeStock: 100, |
|
|
|
|
|
|
|
prizeWeight: 3000, |
|
|
|
|
|
|
|
prizeImage: 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADIAAAAyCAYAAAAeP4ixAAABCElEQVRoge3YMa4BURSH8Y8o7UAp0WgkotBZwluAfhqlZSgUGr23ENUUCpppJnTswAIUSCaTiziZJ8d9/193zdzrfMltABF5plb+oLscDoAV0Pn8OC/lwDhL0k35QT3wstcIuM61Cj0IhXiNuAvOFwr5SgrxRiHeKMSbhnHfAVgU1i1gajhnBpwK6wnQtgxkDTlmSTq/L7rLYQ9byG+WpLvCOT8YQ6K5WgrxRiHeKMQbhXijEG8U4o1CvIkmxPrDquwMrI37KlFJSJake2BUxVlW0VytaEKsV6t5+8Ohak3rRmtIH9hav/QvRHO1FOKNQrwJheQfn+I9wflCIeNHLzuQc51PRP6rC1ZeIm1I8cC5AAAAAElFTkSuQmCC' |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
] |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// 如果开启了前端控制概率 |
|
|
|
|
|
|
|
// 得出权重的最大值并生成权重数组 |
|
|
|
|
|
|
|
if (this.onFrontend) { |
|
|
|
|
|
|
|
// 生成权重数组并排序取得最大值 |
|
|
|
|
|
|
|
this.prizeWeightArr = this.prizeList.map((item) => item.prizeWeight) |
|
|
|
|
|
|
|
let prizeWeightArrSort = [...this.prizeWeightArr] |
|
|
|
|
|
|
|
prizeWeightArrSort.sort((a, b) => b - a) |
|
|
|
|
|
|
|
this.prizeWeightMax = prizeWeightArrSort[0] |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
// } |
|
|
|
|
|
|
|
// } else { |
|
|
|
|
|
|
|
// uni.hideLoading() |
|
|
|
|
|
|
|
// uni.showToast({ |
|
|
|
|
|
|
|
// title: '获取奖品失败', |
|
|
|
|
|
|
|
// mask: true, |
|
|
|
|
|
|
|
// icon: 'none' |
|
|
|
|
|
|
|
// }) |
|
|
|
|
|
|
|
// } |
|
|
|
|
|
|
|
}, |
|
|
|
|
|
|
|
// 模拟请求 获取奖品列表 接口, |
|
|
|
|
|
|
|
// 注意这里返回的是一个 Promise |
|
|
|
|
|
|
|
// 大哥,这里只是模拟,别告诉我你不会对接自己的接口 |
|
|
|
|
|
|
|
requestApiGetPrizeList() { |
|
|
|
|
|
|
|
return new Promise((resolve, reject) => { |
|
|
|
|
|
|
|
let requestTimer = setTimeout(() => { |
|
|
|
|
|
|
|
clearTimeout(requestTimer) |
|
|
|
|
|
|
|
requestTimer = null |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// prizeStock 奖品库存 |
|
|
|
|
|
|
|
// prizeWeight 中奖概率,数值越大中奖概率越高,权重一样时随机中奖 |
|
|
|
|
|
|
|
resolve({ |
|
|
|
|
|
|
|
ok: true, |
|
|
|
|
|
|
|
data: [{ |
|
|
|
|
|
|
|
prizeId: 1, |
|
|
|
|
|
|
|
prizeName: '0.1元现金', |
|
|
|
|
|
|
|
prizeStock: 10, |
|
|
|
|
|
|
|
prizeWeight: 200, |
|
|
|
|
|
|
|
prizeImage: '/static/img/order3.png' |
|
|
|
|
|
|
|
}, |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
prizeId: 2, |
|
|
|
|
|
|
|
prizeName: '10元现金', |
|
|
|
|
|
|
|
prizeStock: 0, |
|
|
|
|
|
|
|
prizeWeight: 50, |
|
|
|
|
|
|
|
prizeImage: 'https://vkceyugu.cdn.bspapp.com/VKCEYUGU-dc-site/56f085e0-bcfe-11ea-b244-a9f5e5565f30.png' |
|
|
|
|
|
|
|
}, |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
prizeId: 3, |
|
|
|
|
|
|
|
prizeName: '5元话费', |
|
|
|
|
|
|
|
prizeStock: 1, |
|
|
|
|
|
|
|
prizeWeight: 80, |
|
|
|
|
|
|
|
prizeImage: 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADIAAAAyCAYAAAAeP4ixAAABCElEQVRoge3YMa4BURSH8Y8o7UAp0WgkotBZwluAfhqlZSgUGr23ENUUCpppJnTswAIUSCaTiziZJ8d9/193zdzrfMltABF5plb+oLscDoAV0Pn8OC/lwDhL0k35QT3wstcIuM61Cj0IhXiNuAvOFwr5SgrxRiHeKMSbhnHfAVgU1i1gajhnBpwK6wnQtgxkDTlmSTq/L7rLYQ9byG+WpLvCOT8YQ6K5WgrxRiHeKMQbhXijEG8U4o1CvIkmxPrDquwMrI37KlFJSJake2BUxVlW0VytaEKsV6t5+8Ohak3rRmtIH9hav/QvRHO1FOKNQrwJheQfn+I9wflCIeNHLzuQc51PRP6rC1ZeIm1I8cC5AAAAAElFTkSuQmCC' |
|
|
|
|
|
|
|
}, |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
prizeId: 4, |
|
|
|
|
|
|
|
prizeName: '50元现金', |
|
|
|
|
|
|
|
prizeStock: 0, |
|
|
|
|
|
|
|
prizeWeight: 10, |
|
|
|
|
|
|
|
prizeImage: 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABkAAAAZCAYAAADE6YVjAAAB2klEQVRIia3Wv09TURjG8U+u2kQZcNENh2ok0cnJ0R+L0RB2g/EvwITEwRgnV0Zx0fAHYBh0khBD4sBAmAgDiwQNg4qwmSBDAYf7Fi+n97al9UlObnvO836f3tO355b2GsAYZrCBPRzGdSPmx8J3YtXwDDsB7TR2wl/rNmAYK13C07ES9W11E9s9BjTHdnBKVf8PAcWgehpwCssF0w/5FzqLgw7AA7zDQ/wqzC8H90jjSeFMYW0Yr8PzALfjOh7z1wve2YTzpLlQw2ay+KZ1N7vS24SziVqGexhKzB07pEJXk/dDwTetdZ9HewwZLWFNw2oyudZjQFNrCW8109pqS32GpPX1TOu586fPkLR+IEMjmbzYZ0ha34Atx/fwW58hXxPeFixo7Yg7PQbcKmEtZFgsMb/C4AkDBuUnQKpFuFZI3cZuvP6C+8g6wDP572O95C4Og49/W/YJl/G5YPqO9yV3dh4f8LMCfhjcI93Afix8xAX5SVx2YBY10yagEdxjmiwY7uISXuIFrlSEPG0TMllWcAbzYViXd0rzeXC6ImSiImA+eKU6h7mCeV/eCBMnCJkLzpHSztnFCJ7L//ZkOFv1iRLtRd1IcLpSHVP4jccVnkexPqXkmd7UX15b7tiz29ReAAAAAElFTkSuQmCC' |
|
|
|
|
|
|
|
}, |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
prizeId: 5, |
|
|
|
|
|
|
|
prizeName: '1卷抽纸', |
|
|
|
|
|
|
|
prizeStock: 3, |
|
|
|
|
|
|
|
prizeWeight: 3000, |
|
|
|
|
|
|
|
prizeImage: 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADIAAAAyCAYAAAAeP4ixAAABCElEQVRoge3YMa4BURSH8Y8o7UAp0WgkotBZwluAfhqlZSgUGr23ENUUCpppJnTswAIUSCaTiziZJ8d9/193zdzrfMltABF5plb+oLscDoAV0Pn8OC/lwDhL0k35QT3wstcIuM61Cj0IhXiNuAvOFwr5SgrxRiHeKMSbhnHfAVgU1i1gajhnBpwK6wnQtgxkDTlmSTq/L7rLYQ9byG+WpLvCOT8YQ6K5WgrxRiHeKMQbhXijEG8U4o1CvIkmxPrDquwMrI37KlFJSJake2BUxVlW0VytaEKsV6t5+8Ohak3rRmtIH9hav/QvRHO1FOKNQrwJheQfn+I9wflCIeNHLzuQc51PRP6rC1ZeIm1I8cC5AAAAAElFTkSuQmCC' |
|
|
|
|
|
|
|
}, |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
prizeId: 6, |
|
|
|
|
|
|
|
prizeName: '0.2元现金', |
|
|
|
|
|
|
|
prizeStock: 8, |
|
|
|
|
|
|
|
prizeWeight: 120, |
|
|
|
|
|
|
|
prizeImage: 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADIAAAAyCAYAAAAeP4ixAAABCElEQVRoge3YMa4BURSH8Y8o7UAp0WgkotBZwluAfhqlZSgUGr23ENUUCpppJnTswAIUSCaTiziZJ8d9/193zdzrfMltABF5plb+oLscDoAV0Pn8OC/lwDhL0k35QT3wstcIuM61Cj0IhXiNuAvOFwr5SgrxRiHeKMSbhnHfAVgU1i1gajhnBpwK6wnQtgxkDTlmSTq/L7rLYQ9byG+WpLvCOT8YQ6K5WgrxRiHeKMQbhXijEG8U4o1CvIkmxPrDquwMrI37KlFJSJake2BUxVlW0VytaEKsV6t5+8Ohak3rRmtIH9hav/QvRHO1FOKNQrwJheQfn+I9wflCIeNHLzuQc51PRP6rC1ZeIm1I8cC5AAAAAElFTkSuQmCC' |
|
|
|
|
|
|
|
}, |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
prizeId: 7, |
|
|
|
|
|
|
|
prizeName: '谢谢参与', |
|
|
|
|
|
|
|
prizeStock: 100, |
|
|
|
|
|
|
|
prizeWeight: 10000, |
|
|
|
|
|
|
|
prizeImage: 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADIAAAAyCAYAAAAeP4ixAAABCElEQVRoge3YMa4BURSH8Y8o7UAp0WgkotBZwluAfhqlZSgUGr23ENUUCpppJnTswAIUSCaTiziZJ8d9/193zdzrfMltABF5plb+oLscDoAV0Pn8OC/lwDhL0k35QT3wstcIuM61Cj0IhXiNuAvOFwr5SgrxRiHeKMSbhnHfAVgU1i1gajhnBpwK6wnQtgxkDTlmSTq/L7rLYQ9byG+WpLvCOT8YQ6K5WgrxRiHeKMQbhXijEG8U4o1CvIkmxPrDquwMrI37KlFJSJake2BUxVlW0VytaEKsV6t5+8Ohak3rRmtIH9hav/QvRHO1FOKNQrwJheQfn+I9wflCIeNHLzuQc51PRP6rC1ZeIm1I8cC5AAAAAElFTkSuQmCC' |
|
|
|
|
|
|
|
}, |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
prizeId: 8, |
|
|
|
|
|
|
|
prizeName: '100金币', |
|
|
|
|
|
|
|
prizeStock: 100, |
|
|
|
|
|
|
|
prizeWeight: 3000, |
|
|
|
|
|
|
|
prizeImage: 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADIAAAAyCAYAAAAeP4ixAAABCElEQVRoge3YMa4BURSH8Y8o7UAp0WgkotBZwluAfhqlZSgUGr23ENUUCpppJnTswAIUSCaTiziZJ8d9/193zdzrfMltABF5plb+oLscDoAV0Pn8OC/lwDhL0k35QT3wstcIuM61Cj0IhXiNuAvOFwr5SgrxRiHeKMSbhnHfAVgU1i1gajhnBpwK6wnQtgxkDTlmSTq/L7rLYQ9byG+WpLvCOT8YQ6K5WgrxRiHeKMQbhXijEG8U4o1CvIkmxPrDquwMrI37KlFJSJake2BUxVlW0VytaEKsV6t5+8Ohak3rRmtIH9hav/QvRHO1FOKNQrwJheQfn+I9wflCIeNHLzuQc51PRP6rC1ZeIm1I8cC5AAAAAElFTkSuQmCC' |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
] |
|
|
|
|
|
|
|
}) |
|
|
|
}) |
|
|
|
}, 2000) |
|
|
|
this.activityInfo = this.transform(res.return_data.activityInfo.content); |
|
|
|
}) |
|
|
|
this.prizeList = prizesList; |
|
|
|
|
|
|
|
this.getUserLotteryNum(); |
|
|
|
|
|
|
|
this.getWinLotteryList(); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
}); |
|
|
|
|
|
|
|
}, |
|
|
|
|
|
|
|
//换行 |
|
|
|
|
|
|
|
transform(value){ |
|
|
|
|
|
|
|
value = value.replace(/\r\n/g, '<br/>'); |
|
|
|
|
|
|
|
value = value.replace(/\n/g, '<br/>'); |
|
|
|
|
|
|
|
return value; |
|
|
|
}, |
|
|
|
}, |
|
|
|
// 本次抽奖开始 |
|
|
|
// 本次抽奖开始 |
|
|
|
handleDrawStart() { |
|
|
|
handleDrawStart() { |
|
|
|
console.log('触发抽奖按钮') |
|
|
|
if(this.LotteryNum <= 0){ |
|
|
|
this.tryLotteryDraw() |
|
|
|
uni.showToast({ |
|
|
|
}, |
|
|
|
title: '当前抽奖次数不足', |
|
|
|
// 尝试发起抽奖 |
|
|
|
icon: 'none', |
|
|
|
tryLotteryDraw() { |
|
|
|
duration: 2000 |
|
|
|
console.log('旋转开始,获取中奖下标......') |
|
|
|
}) |
|
|
|
this.remoteGetPrizeIndex() |
|
|
|
return; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
this.userLottery(); |
|
|
|
}, |
|
|
|
}, |
|
|
|
// 远程请求接口获取中奖下标 |
|
|
|
// 远程请求接口获取中奖下标 |
|
|
|
// 大哥,这里只是模拟,别告诉我你不会对接自己的接口 |
|
|
|
// 大哥,这里只是模拟,别告诉我你不会对接自己的接口 |
|
|
@ -347,7 +232,7 @@ |
|
|
|
stoTimer = null |
|
|
|
stoTimer = null |
|
|
|
let list = [...this.prizeList] |
|
|
|
let list = [...this.prizeList] |
|
|
|
// 这里随机产生的 prizeId 是模拟后端返回的 prizeId |
|
|
|
// 这里随机产生的 prizeId 是模拟后端返回的 prizeId |
|
|
|
let prizeId = Math.floor(Math.random() * list.length + 1); |
|
|
|
let prizeId = this.userLotteryId; |
|
|
|
// 拿到后端返回的 prizeId 后,开始循环比对得出那个中奖的数据 |
|
|
|
// 拿到后端返回的 prizeId 后,开始循环比对得出那个中奖的数据 |
|
|
|
for (let i = 0; i < list.length; i++) { |
|
|
|
for (let i = 0; i < list.length; i++) { |
|
|
|
let item = list[i] |
|
|
|
let item = list[i] |
|
|
@ -357,36 +242,22 @@ |
|
|
|
break |
|
|
|
break |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
console.log('本次抽中奖品 =>', this.prizeList[this.prizeIndex].prizeName) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// 如果奖品设有库存 |
|
|
|
|
|
|
|
if (this.onStock) { |
|
|
|
|
|
|
|
console.log('本次奖品库存 =>', this.prizeList[this.prizeIndex].prizeStock) |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
}, 200) |
|
|
|
}, 200) |
|
|
|
}, |
|
|
|
}, |
|
|
|
// 本次抽奖结束 |
|
|
|
// 本次抽奖结束 |
|
|
|
handleDrawEnd() { |
|
|
|
handleDrawEnd() { |
|
|
|
console.log('旋转结束,执行拿到结果后到逻辑') |
|
|
|
console.log('旋转结束,执行拿到结果后到逻辑') |
|
|
|
|
|
|
|
|
|
|
|
// 旋转结束后,开始处理拿到结果后的逻辑 |
|
|
|
// 旋转结束后,开始处理拿到结果后的逻辑 |
|
|
|
this.prizeing = false |
|
|
|
this.prizeing = false |
|
|
|
let prizeName = this.prizeList[this.prizeIndex].prizeName |
|
|
|
let prizeName = this.prizeList[this.prizeIndex].prizeName |
|
|
|
let tipContent = '' |
|
|
|
let tipContent = '' |
|
|
|
|
|
|
|
// if (prizeName === '参与奖') { |
|
|
|
if (prizeName === '谢谢参与') { |
|
|
|
// tipContent = '很遗憾,没有中奖,请再接再厉!' |
|
|
|
tipContent = '很遗憾,没有中奖,请再接再厉!' |
|
|
|
// } else { |
|
|
|
} else { |
|
|
|
tipContent = `恭喜您,获得 "${prizeName} "!` |
|
|
|
// 如果奖品设有库存 |
|
|
|
// } |
|
|
|
if (this.onStock) { |
|
|
|
this.getUserLotteryNum(); |
|
|
|
let prizeStock = this.prizeList[this.prizeIndex].prizeStock |
|
|
|
this.getWinLotteryList(); |
|
|
|
tipContent = prizeStock ? `恭喜您,获得 ${prizeName}` : `很抱歉,您来晚了,当前奖品 ${prizeName} 已无库存` |
|
|
|
|
|
|
|
} else { |
|
|
|
|
|
|
|
tipContent = `恭喜您,获得 ${prizeName} !` |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
uni.showModal({ |
|
|
|
uni.showModal({ |
|
|
|
content: tipContent, |
|
|
|
content: tipContent, |
|
|
|
showCancel: false |
|
|
|
showCancel: false |
|
|
@ -403,13 +274,19 @@ |
|
|
|
}) |
|
|
|
}) |
|
|
|
} |
|
|
|
} |
|
|
|
}, |
|
|
|
}, |
|
|
|
onLoad() { |
|
|
|
onLoad(options) { |
|
|
|
|
|
|
|
this.couponId = options.id |
|
|
|
this.handleInitCanvas() |
|
|
|
this.handleInitCanvas() |
|
|
|
}, |
|
|
|
}, |
|
|
|
onUnload() { |
|
|
|
onUnload() { |
|
|
|
uni.hideLoading() |
|
|
|
uni.hideLoading() |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
export class prizeListNew { |
|
|
|
|
|
|
|
prizeId = '' |
|
|
|
|
|
|
|
prizeName = '' |
|
|
|
|
|
|
|
prizeImage = '' |
|
|
|
|
|
|
|
} |
|
|
|
</script> |
|
|
|
</script> |
|
|
|
|
|
|
|
|
|
|
|
<style lang="scss" scoped> |
|
|
|
<style lang="scss" scoped> |
|
|
|