| xqd
@@ -3,7 +3,7 @@
|
|
|
<!-- 转盘 -->
|
|
|
<view class="spinning" :style="{backgroundImage:'url('+backImageUrl+')'}">
|
|
|
<view class="spinning-title">
|
|
|
- <text>幸运大转盘</text>
|
|
|
+ <text>{{drawInfo.draw_template.name?drawInfo.draw_template.name:"幸运大轮盘"}}</text>
|
|
|
</view>
|
|
|
<q-turntable ref="turntable" :areaNumber='9' @start="turntableStart" @success="turntableSuccess">
|
|
|
</q-turntable>
|
| xqd
@@ -35,7 +35,7 @@
|
|
|
<text class="introduce-top-rule2"></text>
|
|
|
</view>
|
|
|
<view class="introduce-text">
|
|
|
- <text>活动奖品分为线上和线下两种类型活动奖品分为线上和线下两种类型奖品活动奖品分为线上和线下两种类型奖品奖品,线上活动奖品分为线上和线下两种类型奖品,线上活动奖品分为线上和线下两种类型奖品,线上</text>
|
|
|
+ <text>{{drawInfo.draw_template.rule}}</text>
|
|
|
</view>
|
|
|
</view>
|
|
|
</view>
|
| xqd
@@ -45,14 +45,14 @@
|
|
|
<view class="prize-title">
|
|
|
我的奖品
|
|
|
</view>
|
|
|
- <view class="prize-main" v-for="item in 3">
|
|
|
+ <view class="prize-main" v-for="item in drawRecord" :key="item.id">
|
|
|
<view class="prize-main-left">
|
|
|
- <text class="prize-main-left-top">HUAWEI MateBook X Pro</text>
|
|
|
- <text class="prize-main-left-bom">2022-02-10</text>
|
|
|
+ <text class="prize-main-left-top">{{item.remark}}</text>
|
|
|
+ <text class="prize-main-left-bom">{{item.created_at}}</text>
|
|
|
</view>
|
|
|
- <view :class="isexchange ? 'prize-main-rightSelect' : 'prize-main-right' ">
|
|
|
- <text v-if="isexchange">立即兑换</text>
|
|
|
- <text v-if="!isexchange">已兑换</text>
|
|
|
+ <view :class="item.status==1 ? 'prize-main-rightSelect' : 'prize-main-right' ">
|
|
|
+ <text v-if="item.status==1">立即兑换</text>
|
|
|
+ <text v-if="item.status==2">已兑换</text>
|
|
|
</view>
|
|
|
</view>
|
|
|
</view>
|
| xqd
@@ -65,7 +65,7 @@
|
|
|
<view class="img">
|
|
|
<image style="width: 80rpx;height: 82rpx" src="/static/icon/gift01.png"></image>
|
|
|
<view class="text">
|
|
|
- <text>恭喜您抽中了<text>{{prizeLevel}}</text></text>
|
|
|
+ <text>恭喜您抽中了<text>{{drawResult.name}}</text></text>
|
|
|
<text>请尽快去奖品中心兑奖</text>
|
|
|
</view>
|
|
|
</view>
|
| xqd
@@ -136,30 +136,138 @@
|
|
|
{
|
|
|
title: '一等奖'
|
|
|
}
|
|
|
- ] // 顺时针对应每个奖项
|
|
|
+ ], // 顺时针对应每个奖项
|
|
|
+ drawInfo:{
|
|
|
+ draw_no: ''
|
|
|
+ },
|
|
|
+ drawRecord:[],
|
|
|
+ drawResult:{}
|
|
|
}
|
|
|
+ },
|
|
|
+ onLoad(params){
|
|
|
+ const {draw_no} = params
|
|
|
+ this.drawInfo.draw_no = draw_no;
|
|
|
+
|
|
|
+ },
|
|
|
+ onReady(){
|
|
|
+ // this.judageIsDraw(); //判断是否有权限访问
|
|
|
+ this.getDrawInfo(); //获取抽奖信息
|
|
|
+ this.getDrawRecord(); //获取获奖记录
|
|
|
+ },
|
|
|
+ computed:{
|
|
|
+ recordMsg:(status)=>{
|
|
|
+ const di = ['未中奖','未兑换','已兑换'];
|
|
|
+ return di[status];
|
|
|
+ }
|
|
|
},
|
|
|
- methods: {
|
|
|
-
|
|
|
+ methods: {
|
|
|
+ judageIsDraw(){
|
|
|
+ if(!this.drawInfo.draw_no){
|
|
|
+ uni.showToast({
|
|
|
+ icon: 'error',
|
|
|
+ title: "暂无权限",
|
|
|
+ success:()=>{
|
|
|
+ uni.reLaunch({
|
|
|
+ url:'/pages/index/index'
|
|
|
+ })
|
|
|
+ }
|
|
|
+ })
|
|
|
+ }
|
|
|
+ },
|
|
|
+ getDrawInfo(){
|
|
|
+ this.drawInfo.draw_no = "9HzqlNVBMRZo";
|
|
|
+ this.$api.draw.drawInfo({
|
|
|
+ draw_no: this.drawInfo.draw_no
|
|
|
+ }).then(res=>{
|
|
|
+ if(res.code == 0){
|
|
|
+ this.drawInfo = res.data;
|
|
|
+ }else{
|
|
|
+ uni.showToast({
|
|
|
+ icon: 'error',
|
|
|
+ title: res.msg ? res.msg : "暂无权限"
|
|
|
+ })
|
|
|
+ }
|
|
|
+ }).catch(err=>{
|
|
|
+ uni.showToast({
|
|
|
+ icon: 'error',
|
|
|
+ title: "网络繁忙"
|
|
|
+ })
|
|
|
+ })
|
|
|
+ },
|
|
|
+ getDrawRecord(page = 1){
|
|
|
+ if(page == 1){
|
|
|
+ this.drawRecord = []
|
|
|
+ }
|
|
|
+ this.$api.draw.drawRecord({
|
|
|
+ page:page
|
|
|
+ }).then(res=>{
|
|
|
+ if(res.code == 0){
|
|
|
+ res.data.data.forEach(item => {
|
|
|
+ if(item.source == 2){
|
|
|
+ this.drawRecord.push(item);
|
|
|
+ }
|
|
|
+ })
|
|
|
+ if(res.data.length >= 15){
|
|
|
+ this.getDrawRecord(page + 1);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ })
|
|
|
+ },
|
|
|
//中奖去兑换按钮
|
|
|
dialogConfirm() {
|
|
|
- console.log('确认');
|
|
|
+ this.$utils.jump({
|
|
|
+ jump_type: 4,
|
|
|
+ jump_config: '/pages/my/prize/prize'
|
|
|
+ })
|
|
|
},
|
|
|
//中奖待会按钮
|
|
|
- dialogClose() {
|
|
|
- console.log('取消');
|
|
|
+ dialogClose() {
|
|
|
+ this.drawResult = {};
|
|
|
+ this.$refs.codePurchaseNone.close();
|
|
|
+ this.$refs.codePurchase.close();
|
|
|
},
|
|
|
|
|
|
// 用户点击开始抽奖
|
|
|
- turntableStart() {
|
|
|
+ turntableStart() {
|
|
|
+ if(this.isDrawing) return;
|
|
|
+ this.isDrawing = true
|
|
|
let index = Math.floor(Math.random() * 6 + 1) //前端随机数,这里应该后台返回中奖结果
|
|
|
// this.award = index
|
|
|
this.award = 2
|
|
|
- this.$refs.turntable.begin(this.award);
|
|
|
+ this.$refs.turntable.begin(this.award);
|
|
|
+ this.$api.draw.luckyDraw({
|
|
|
+ draw_no: this.drawInfo.draw_no,
|
|
|
+ }).then(res => {
|
|
|
+ if(res.data.code != 0){
|
|
|
+ uni.showToast({
|
|
|
+ icon: 'error',
|
|
|
+ title: res.msg?res.msg:"网络繁忙",
|
|
|
+ })
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ this.drawResult = res.data;
|
|
|
+ setTimeout(()=>{
|
|
|
+ this.isDrawing = false
|
|
|
+ }, 1000)
|
|
|
+ });
|
|
|
},
|
|
|
|
|
|
// 抽奖完成后操作
|
|
|
- turntableSuccess() {
|
|
|
+ turntableSuccess() {
|
|
|
+ let timer = setInterval(()=>{
|
|
|
+ if(this.isDrawing){
|
|
|
+ return;
|
|
|
+ }
|
|
|
+
|
|
|
+ if(this.drawResult.status == 1){
|
|
|
+ this.$refs.codePurchase.open()
|
|
|
+ }else{
|
|
|
+ this.$refs.codePurchaseNone.open()
|
|
|
+ }
|
|
|
+ clearInterval(timer);
|
|
|
+ }, 50)
|
|
|
+ return;
|
|
|
+
|
|
|
const index = this.award - 1;
|
|
|
console.log('bind:success', this.awardList[index]);
|
|
|
if(this.awardList[index].title == '谢谢参与'){
|