1.对接抽奖活动

yj-dev
杨杰 3 years ago
parent ebf63d96b3
commit ef16e210a2
  1. 16
      App.vue
  2. 24
      Utils/Api.js
  3. 65
      pages/pay/success/success.vue
  4. 6
      pages/tabBar/user/user.vue
  5. 343
      subPages/lottery/lottery.vue
  6. 1528
      uni_modules/almost-lottery/components/almost-lottery/almost-lottery.vue

@ -5,15 +5,15 @@
// brestUrl: 'http://192.168.3.4:9302/brest',
// imgUrl: 'https://192.168.3.4:9301/filesystem/',
//
url: 'https://hsg.dctpay.com/crest',
imgUrl: 'https://hsg.dctpay.com/filesystem/',
brestUrl : 'https://hsg.dctpay.com/brest',
imageWxImg:'https://hsg.dctpay.com/filesystem/wxApplets/',
// url: 'https://hsg.dctpay.com/crest',
// imgUrl: 'https://hsg.dctpay.com/filesystem/',
// brestUrl : 'https://hsg.dctpay.com/brest',
// imageWxImg:'https://hsg.dctpay.com/filesystem/wxApplets/',
//
// url: 'https://hsgcs.dctpay.com/crest',
// brestUrl : 'https://hsgcs.dctpay.com/brest',
// imgUrl: 'https://hsgcs.dctpay.com/filesystem/',
// imageWxImg:'https://hsgcs.dctpay.com/filesystem/wxApplets/',
url: 'https://hsgcs.dctpay.com/crest',
brestUrl : 'https://hsgcs.dctpay.com/brest',
imgUrl: 'https://hsgcs.dctpay.com/filesystem/',
imageWxImg:'https://hsgcs.dctpay.com/filesystem/wxApplets/',
userInfo: "",
brestUserInfo : '',
openId: '',

@ -195,6 +195,30 @@ export const bindHuiLianTongCard = params => {
* 工会卡
*/
/**
* 抽奖活动
*/
export const getActivityByCoupon = params => {
return POST('GET', `${base}/activity/getActivityByCoupon`, params).then(res => res.data);
}
/**
* 用户抽奖
*/
export const userLottery = params => {
return POST('POST', `${base}/activity/userLottery`, params).then(res => res.data);
}
/**
* 获取用户抽奖次数
*/
export const getUserLotteryNum = params => {
return POST('GET', `${base}/activity/getUserLotteryNum`, params).then(res => res.data);
}
/**
* 查询中奖列表只会提供最新的50条数据
*/
export const getWinLotteryList = params => {
return POST('GET', `${base}/activity/getWinLotteryList`, params).then(res => res.data);
}
/**
* 肯德基地址

@ -33,25 +33,6 @@
:show-back-btn="true"
></yy-video-player>
<image :src="imagewxUrl+imgadres2" mode="widthFix" class="mart10"></image>
<!-- <view class="mart20 width90 font18 fcor333 fontwig6">
使用流程
</view>
<view class="mart5 width80 font14 fcor999 fontwig6" style="list-style-type: decimal;">
<view style="width: 5%;" class="flleft">1:</view>
<view style="margin-left: 5%;">客户使用积分兑换或者工会卡购买</view>
</view>
<view class="mart5 width80 font14 fcor999 fontwig6" style="list-style-type: decimal;">
<view style="width: 5%;" class="flleft">2:</view>
<view style="margin-left: 5%;">兑换成功后中石化给客户发送一张同等面额的码商券保存在加油中石化APP中</view>
</view>
<view class="mart5 width80 font14 fcor999 fontwig6" style="list-style-type: decimal;">
<view style="width: 5%;" class="flleft">3:</view>
<view style="margin-left: 5%;">客户登录加油中石化APP查看码商券详情</view>
</view>
<view class="mart5 width80 font14 fcor999 fontwig6" style="list-style-type: decimal;">
<view style="width: 5%;" class="flleft">4:</view>
<view style="margin-left: 5%;">客户选择中石化任意加油站加油加完油后在加油中石化APP中查看订单选择支付支付时选择码商券抵用支付完成即可</view>
</view> -->
</view>
@ -82,21 +63,28 @@
</view>
</view>
</view>
<wybPopup ref="popup" type="center" height="850" width="600" radius="6" bgColor="" :showCloseIcon="true" >
<image class="popImg" :src="imagewxUrl+imgadres4" @click="jumpcjhuod"></image>
</wybPopup>
<view class="height60"></view>
<button class="coupne-btn width100" @click="toUser">个人中心</button>
</view>
</template>
<script>
import {
getUserNewCouponDetail,
getStoreListByCoupon
getStoreListByCoupon,
getActivityByCoupon
} from "../../../Utils/Api.js";
import xiaoVideoElement from '../../../components/yy-video-player/yy-video-player.nvue';
import wybPopup from '../../../components/wyb-popup/wyb-popup.vue';
let app = getApp()
export default {
components: {
xiaoVideoElement
xiaoVideoElement,
wybPopup
},
data() {
return {
@ -105,6 +93,7 @@
imagewxUrl: app.globalData.imageWxImg,
imgadres2: 'video.jpg',
imgadres3: 'playVideo.mp4',
imgadres4: 'activityimg.png',
imgadres1: 'dhl.png',
couponDesInfo: [],
storeList: [],
@ -119,6 +108,7 @@
onLoad(option) {
this.couDesId = option.id;
this.getUserNewCouponDetail();
this.getActivityByCoupon();
},
filters: {
//
@ -169,6 +159,33 @@
}
})
},
//
showPopup() {
this.$refs.popup.show();
},
//
closePopup() {
this.$refs.popup.hide();
},
//
getActivityByCoupon() {
let params = {
couponId: this.couDesId
}
getActivityByCoupon(params).then(res => {
if (res.return_code == '000000' && res.return_data) {
this.showPopup();
this.showTc = true;
}
});
},
//
jumpcjhuod(){
this.closePopup();
uni.reLaunch({
url:'../../../subPages/lottery/lottery?id='+this.couDesId
})
},
//
seeloaction(e) {
uni.openLocation({
@ -230,6 +247,11 @@
}
</script>
<style lang="scss">
.popImg {
width: 290px;
height: 490px;
}
.loading-text {
width: 100%;
display: flex;
@ -245,7 +267,6 @@
line-height: 35px;
}
.coupon-mes {
margin-right: 90px;
}

@ -200,12 +200,8 @@
url: '../../login/login?id=2',
text: '我的推广',
img: 'user/renw.png'
},
{
url: '../../../subPages/lottery/lottery',
text: '抽奖活动',
img: 'user/renw.png'
}
// ,
// {
// url: '/pages/user/Charge/Charge',

@ -4,16 +4,11 @@
<image src="../static/head.jpg" mode="widthFix" class="width100"></image>
<view class="almost-lottery__wheel">
<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"
@finish="handleDrawFinish" v-if="prizeList.length" />
</view>
<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">
<swiper class="_swiper tc" indicator-dots="false" autoplay="true" :interval="interval" circular="true"
display-multiple-items="2" :duration="duration">
@ -24,11 +19,11 @@
<view class="swiper-item uni-bg-red"></view>
</swiper-item>
<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>
</view>
<view class="font14 fotct mart10 marb10">拥有{{ LotteryNum }}次抽奖机会</view>
<view class="rule-head">
<view class="line"></view>
<text class="title">活动规则</text>
@ -36,42 +31,7 @@
</view>
<view class="rule-body">
<view class="item">
<view class="number">1.</view>
<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>
<rich-text class="text font14" :nodes="activityInfo"></rich-text>
</view>
</view>
</view>
@ -80,6 +40,13 @@
<script>
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 {
name: 'Home',
components: {
@ -87,6 +54,17 @@
},
data() {
return {
imageUrl: app.globalData.imgUrl,
//id
activityId : '',
//
userLotteryId:'',
//
LotteryNum:'',
//
activityInfo:'',
//id
couponId:'',
//
isDev: true,
background: ['color1', 'color2', 'color3'],
@ -138,7 +116,7 @@
freeNumDay: 3,
interval: 3000,
duration: 12000,
list: ['1分钟前,无夏购买了会员', '2分钟前,无夏购买了会员', '3分钟前,无夏购买了会员']
list: []
}
},
computed: {
@ -147,7 +125,6 @@
}
},
methods: {
changeIndicatorDots(e) {
this.indicatorDots = !this.indicatorDots
},
@ -163,179 +140,87 @@
//
handleInitCanvas() {
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({
title: '奖品准备中...'
})
//
// let res = await this.requestApiGetPrizeList()
// if (res.ok) {
// uni.hideLoading()
// let data = res.data
// if (data.length) {
this.prizeList = [{
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'
}
]
//
//
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'
}
]
let params = {
couponId: this.couponId
}
getActivityByCoupon(params).then(res => {
if (res.return_code == '000000') {
let prizeLists = res.return_data.activityAward;
this.activityId = res.return_data.activityInfo.id;
let prizesList = [];
prizeLists.map((r) => {
const pris = new prizeListNew();
pris.prizeId = r.id;
pris.prizeImage = this.imageUrl + r.img;
pris.prizeName = r.name;
prizesList.push(pris);
})
}, 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() {
console.log('触发抽奖按钮')
this.tryLotteryDraw()
},
//
tryLotteryDraw() {
console.log('旋转开始,获取中奖下标......')
this.remoteGetPrizeIndex()
if(this.LotteryNum <= 0){
uni.showToast({
title: '当前抽奖次数不足',
icon: 'none',
duration: 2000
})
return;
}
this.userLottery();
},
//
//
@ -347,7 +232,7 @@
stoTimer = null
let list = [...this.prizeList]
// prizeId prizeId
let prizeId = Math.floor(Math.random() * list.length + 1);
let prizeId = this.userLotteryId;
// prizeId
for (let i = 0; i < list.length; i++) {
let item = list[i]
@ -357,36 +242,22 @@
break
}
}
console.log('本次抽中奖品 =>', this.prizeList[this.prizeIndex].prizeName)
//
if (this.onStock) {
console.log('本次奖品库存 =>', this.prizeList[this.prizeIndex].prizeStock)
}
}, 200)
},
//
handleDrawEnd() {
console.log('旋转结束,执行拿到结果后到逻辑')
//
this.prizeing = false
let prizeName = this.prizeList[this.prizeIndex].prizeName
let tipContent = ''
if (prizeName === '谢谢参与') {
tipContent = '很遗憾,没有中奖,请再接再厉!'
} else {
//
if (this.onStock) {
let prizeStock = this.prizeList[this.prizeIndex].prizeStock
tipContent = prizeStock ? `恭喜您,获得 ${prizeName}` : `很抱歉,您来晚了,当前奖品 ${prizeName} 已无库存`
} else {
tipContent = `恭喜您,获得 ${prizeName}`
}
}
// if (prizeName === '') {
// tipContent = ''
// } else {
tipContent = `恭喜您,获得 "${prizeName} "!`
// }
this.getUserLotteryNum();
this.getWinLotteryList();
uni.showModal({
content: tipContent,
showCancel: false
@ -403,13 +274,19 @@
})
}
},
onLoad() {
onLoad(options) {
this.couponId = options.id
this.handleInitCanvas()
},
onUnload() {
uni.hideLoading()
}
}
export class prizeListNew {
prizeId = ''
prizeName = ''
prizeImage = ''
}
</script>
<style lang="scss" scoped>

Loading…
Cancel
Save