|
@@ -5,20 +5,21 @@
|
|
<view class="spinning-title">
|
|
<view class="spinning-title">
|
|
<text>{{drawInfo.draw_template.name?drawInfo.draw_template.name:"幸运大轮盘"}}</text>
|
|
<text>{{drawInfo.draw_template.name?drawInfo.draw_template.name:"幸运大轮盘"}}</text>
|
|
</view>
|
|
</view>
|
|
- <q-turntable ref="turntable" :areaNumber='9' @start="turntableStart" @success="turntableSuccess">
|
|
|
|
- </q-turntable>
|
|
|
|
|
|
+<!-- <q-turntable isRenderImage ref="turntable" :areaNumber='9' @start="turntableStart" @success="turntableSuccess">
|
|
|
|
+ </q-turntable> -->
|
|
|
|
+ <q-turntable ref="turntable" @start="turntableStart"/>
|
|
</view>
|
|
</view>
|
|
|
|
|
|
<view style="background-color: #f9f9f9; padding-bottom: 136rpx;">
|
|
<view style="background-color: #f9f9f9; padding-bottom: 136rpx;">
|
|
<!-- 产品信息 -->
|
|
<!-- 产品信息 -->
|
|
<view class="produce">
|
|
<view class="produce">
|
|
<view class="produce-title">产品信息</view>
|
|
<view class="produce-title">产品信息</view>
|
|
- <view class="produce-main" v-for="item in 6">
|
|
|
|
- <image style="width: 132rpx;height: 132rpx;border-radius: 10rpx;" src="/static/icon/banner02.png"
|
|
|
|
|
|
+ <view class="produce-main" v-for="(item,index) in drawInfo.draw_template.draw_config" :key="item.id">
|
|
|
|
+ <image style="width: 132rpx;height: 132rpx;border-radius: 10rpx;" :src="item.prize_img"
|
|
mode=""></image>
|
|
mode=""></image>
|
|
<view class="produce-main-text">
|
|
<view class="produce-main-text">
|
|
- <text class="produce-main-text-top">一等奖</text>
|
|
|
|
- <text class="produce-main-text-bom">HUAWEI MateBook X Pro</text>
|
|
|
|
|
|
+ <text class="produce-main-text-top">{{item.name}}</text>
|
|
|
|
+ <text class="produce-main-text-bom">{{item.product.name ? item.product.name : (item.integral?item.integral+"积分":"")}}</text>
|
|
</view>
|
|
</view>
|
|
</view>
|
|
</view>
|
|
</view>
|
|
</view>
|
|
@@ -50,7 +51,7 @@
|
|
<text class="prize-main-left-top">{{item.remark}}</text>
|
|
<text class="prize-main-left-top">{{item.remark}}</text>
|
|
<text class="prize-main-left-bom">{{item.created_at}}</text>
|
|
<text class="prize-main-left-bom">{{item.created_at}}</text>
|
|
</view>
|
|
</view>
|
|
- <view :class="item.status==1 ? 'prize-main-rightSelect' : 'prize-main-right' ">
|
|
|
|
|
|
+ <view v-if="!item.integral" :class="item.status==1 ? 'prize-main-rightSelect' : 'prize-main-right' ">
|
|
<text v-if="item.status==1">立即兑换</text>
|
|
<text v-if="item.status==1">立即兑换</text>
|
|
<text v-if="item.status==2">已兑换</text>
|
|
<text v-if="item.status==2">已兑换</text>
|
|
</view>
|
|
</view>
|
|
@@ -65,8 +66,9 @@
|
|
<view class="img">
|
|
<view class="img">
|
|
<image style="width: 80rpx;height: 82rpx" src="/static/icon/gift01.png"></image>
|
|
<image style="width: 80rpx;height: 82rpx" src="/static/icon/gift01.png"></image>
|
|
<view class="text">
|
|
<view class="text">
|
|
- <text>恭喜您抽中了<text>{{drawResult.name}}</text></text>
|
|
|
|
- <text>请尽快去奖品中心兑奖</text>
|
|
|
|
|
|
+ <text>恭喜您抽中了<text>{{drawResultProduct.name}}</text></text>
|
|
|
|
+ <text>{{drawResult.name?drawResult.name:drawResultProduct.integral+'积分'}}</text>
|
|
|
|
+ <text v-if="drawResult.name">请尽快去奖品中心兑奖</text>
|
|
</view>
|
|
</view>
|
|
</view>
|
|
</view>
|
|
<view class="btn">
|
|
<view class="btn">
|
|
@@ -97,7 +99,7 @@
|
|
</template>
|
|
</template>
|
|
|
|
|
|
<script>
|
|
<script>
|
|
- import QTurntable from '@/components/q-turntable/q-turntable.vue'
|
|
|
|
|
|
+ import QTurntable from '@/components/q-turntable'
|
|
export default {
|
|
export default {
|
|
components: {
|
|
components: {
|
|
QTurntable
|
|
QTurntable
|
|
@@ -141,13 +143,13 @@
|
|
draw_no: ''
|
|
draw_no: ''
|
|
},
|
|
},
|
|
drawRecord:[],
|
|
drawRecord:[],
|
|
- drawResult:{}
|
|
|
|
|
|
+ drawResult:{},
|
|
|
|
+ drawResultProduct: {}
|
|
}
|
|
}
|
|
},
|
|
},
|
|
onLoad(params){
|
|
onLoad(params){
|
|
const {draw_no} = params
|
|
const {draw_no} = params
|
|
this.drawInfo.draw_no = draw_no;
|
|
this.drawInfo.draw_no = draw_no;
|
|
-
|
|
|
|
},
|
|
},
|
|
onReady(){
|
|
onReady(){
|
|
// this.judageIsDraw(); //判断是否有权限访问
|
|
// this.judageIsDraw(); //判断是否有权限访问
|
|
@@ -175,12 +177,19 @@
|
|
}
|
|
}
|
|
},
|
|
},
|
|
getDrawInfo(){
|
|
getDrawInfo(){
|
|
- this.drawInfo.draw_no = "9HzqlNVBMRZo";
|
|
|
|
|
|
+ if(!this.drawInfo.draw_no){
|
|
|
|
+ uni.showToast({
|
|
|
|
+ icon: 'error',
|
|
|
|
+ title: "暂无权限"
|
|
|
|
+ })
|
|
|
|
+ return;
|
|
|
|
+ }
|
|
this.$api.draw.drawInfo({
|
|
this.$api.draw.drawInfo({
|
|
draw_no: this.drawInfo.draw_no
|
|
draw_no: this.drawInfo.draw_no
|
|
}).then(res=>{
|
|
}).then(res=>{
|
|
if(res.code == 0){
|
|
if(res.code == 0){
|
|
this.drawInfo = res.data;
|
|
this.drawInfo = res.data;
|
|
|
|
+ this.$refs.turntable.init(this.drawInfo.draw_template.draw_config);
|
|
}else{
|
|
}else{
|
|
uni.showToast({
|
|
uni.showToast({
|
|
icon: 'error',
|
|
icon: 'error',
|
|
@@ -203,7 +212,7 @@
|
|
}).then(res=>{
|
|
}).then(res=>{
|
|
if(res.code == 0){
|
|
if(res.code == 0){
|
|
res.data.data.forEach(item => {
|
|
res.data.data.forEach(item => {
|
|
- if(item.source == 2){
|
|
|
|
|
|
+ if(item.source == 2 && (item.integral>0 || item.product_id>0)){
|
|
this.drawRecord.push(item);
|
|
this.drawRecord.push(item);
|
|
}
|
|
}
|
|
})
|
|
})
|
|
@@ -224,31 +233,53 @@
|
|
dialogClose() {
|
|
dialogClose() {
|
|
this.drawResult = {};
|
|
this.drawResult = {};
|
|
this.$refs.codePurchaseNone.close();
|
|
this.$refs.codePurchaseNone.close();
|
|
- this.$refs.codePurchase.close();
|
|
|
|
|
|
+ this.$refs.codePurchase.close();
|
|
|
|
+ setTimeout(()=>{
|
|
|
|
+ this.drawResult = {};
|
|
|
|
+ this.drawResultProduct = {};
|
|
|
|
+ this.$refs.turntable.reset();
|
|
|
|
+ }, 500)
|
|
},
|
|
},
|
|
|
|
|
|
// 用户点击开始抽奖
|
|
// 用户点击开始抽奖
|
|
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);
|
|
|
|
|
|
+ // 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.$api.draw.luckyDraw({
|
|
this.$api.draw.luckyDraw({
|
|
draw_no: this.drawInfo.draw_no,
|
|
draw_no: this.drawInfo.draw_no,
|
|
}).then(res => {
|
|
}).then(res => {
|
|
- if(res.data.code != 0){
|
|
|
|
|
|
+ if(res.code != 0 || !res.data){
|
|
uni.showToast({
|
|
uni.showToast({
|
|
icon: 'error',
|
|
icon: 'error',
|
|
title: res.msg?res.msg:"网络繁忙",
|
|
title: res.msg?res.msg:"网络繁忙",
|
|
})
|
|
})
|
|
|
|
+ this.$refs.turntable.end(0).then(_=>{
|
|
|
|
+ this.$refs.turntable.reset();
|
|
|
|
+ });
|
|
return;
|
|
return;
|
|
}
|
|
}
|
|
this.drawResult = res.data;
|
|
this.drawResult = res.data;
|
|
- setTimeout(()=>{
|
|
|
|
- this.isDrawing = false
|
|
|
|
- }, 1000)
|
|
|
|
|
|
+ const draw_config = this.drawInfo.draw_template.draw_config;
|
|
|
|
+ for(let i=0;i<draw_config.length;i++){
|
|
|
|
+ if(draw_config[i].id == this.drawResult.draw_config_id){
|
|
|
|
+ this.drawResultProduct = draw_config[i];
|
|
|
|
+ setTimeout(()=>{
|
|
|
|
+ console.log(i)
|
|
|
|
+ this.$refs.turntable.end(i).then(_=>{
|
|
|
|
+ if(this.drawResultProduct.integral<=0 && !this.drawResultProduct.product){
|
|
|
|
+ this.$refs.codePurchaseNone.open()
|
|
|
|
+ }else{
|
|
|
|
+ this.$refs.codePurchase.open()
|
|
|
|
+ }
|
|
|
|
+ });
|
|
|
|
+ }, 5000)
|
|
|
|
+ break;
|
|
|
|
+ }
|
|
|
|
+ }
|
|
});
|
|
});
|
|
},
|
|
},
|
|
|
|
|