|
@@ -27,7 +27,10 @@
|
|
|
抽奖剩余次数:
|
|
|
<text>{{ reTimes }}</text>
|
|
|
</view>
|
|
|
- <view v-else @click="showPayWin('win_4')">
|
|
|
+ <view v-else-if="user.currentGold < luckDraw.purchaseTimesGold" @click="toTaskList()">
|
|
|
+ 做任务赚抽奖
|
|
|
+ </view>
|
|
|
+ <view v-else @click="showPayWin('win_1')">
|
|
|
支付{{luckDraw.purchaseTimesGold}}乐豆继续抽奖 >
|
|
|
</view>
|
|
|
</view>
|
|
@@ -93,12 +96,26 @@
|
|
|
继续抽奖
|
|
|
</view>
|
|
|
</view>
|
|
|
- <view class="lottery-content win_1" v-if="winTypes == 'win_1'">
|
|
|
+ <view class="lottery-content win_4" v-if="winTypes == 'win_1'">
|
|
|
+ <view class="lottery-title">
|
|
|
+ <view class="pay-info">
|
|
|
+ 您的抽奖次数已用完,是否消耗<text>{{luckDraw.purchaseTimesGold}}</text><image src="../../static/ledou.png"></image>兑换一次抽奖?
|
|
|
+ </view>
|
|
|
+ <view class="pay-info">当前乐豆余额:<text>{{user.currentGold||0}}</text><image src="../../static/ledou.png"></image></view>
|
|
|
+ </view>
|
|
|
+ <view @click="toPaySubmit" class="lottery-confrim-btn">
|
|
|
+ 消耗{{luckDraw.purchaseTimesGold}}乐豆继续抽奖
|
|
|
+ </view>
|
|
|
+ </view>
|
|
|
+ <view class="lottery-content win_4" v-if="winTypes == 'win_4'">
|
|
|
<view class="lottery-title">
|
|
|
- 抱歉,您的免费抽奖次数已用完!
|
|
|
+ <view class="pay-info">
|
|
|
+ 您的抽奖次数已用完且乐豆余额不足,是否去完成任务获得抽奖机会?
|
|
|
+ </view>
|
|
|
+ <view class="pay-info">当前乐豆余额:<text>{{user.currentGold||0}}</text><image src="../../static/ledou.png"></image></view>
|
|
|
</view>
|
|
|
- <view @click="toPay" class="lottery-confrim-btn">
|
|
|
- 支付{{luckDraw.purchaseTimesGold}}乐豆继续抽奖
|
|
|
+ <view class="lottery-confrim-btn" @click="toTaskList()">
|
|
|
+ 做任务赚抽奖
|
|
|
</view>
|
|
|
</view>
|
|
|
<view class="lottery-content win_2" v-if="winTypes == 'win_2'">
|
|
@@ -118,29 +135,7 @@
|
|
|
继续抽奖
|
|
|
</view>
|
|
|
</view>
|
|
|
- <view class="lottery-content win_4" v-if="winTypes == 'win_4'">
|
|
|
- <view class="lottery-title">
|
|
|
- <!-- <view>请输入支付密码</view>
|
|
|
- <view class="pay-info">支付<text>{{luckDraw.purchaseTimesGold}}</text><image src="../../static/ledou.png"></image></view>
|
|
|
- <view>
|
|
|
- <u-input v-model="payPws" :focus="focus" trim type="password" :border="true" :password-icon="true" placeholder="请输入支付密码"></u-input>
|
|
|
- </view> -->
|
|
|
- 确定支付乐豆,继续抽奖
|
|
|
- </view>
|
|
|
- <view class="lottery-confrim-btn" @click="toPaySubmit">
|
|
|
- 确定
|
|
|
- </view>
|
|
|
- </view>
|
|
|
</u-popup>
|
|
|
- <!-- 提示用户设置支付密码 -->
|
|
|
- <u-modal v-model="showSetPswModal"
|
|
|
- content="请先设置支付密码,才能使用乐豆"
|
|
|
- show-cancel-button
|
|
|
- confirm-text="去设置"
|
|
|
- cancel-text="暂时放弃"
|
|
|
- @confirm="toSetPwd"
|
|
|
- @cancel="showSetPswModal=false"
|
|
|
- ></u-modal>
|
|
|
</view>
|
|
|
</template>
|
|
|
|
|
@@ -148,13 +143,16 @@
|
|
|
import AlmostLottery from '@/components/almost-lottery/almost-lottery.vue';
|
|
|
import { clearCacheFile } from '@/almost-utils/almost-utils.js';
|
|
|
import { findCustomerTimes, buyDrawTimes, takeOut, queryWinRecord } from '@/api/luckyDraw.js'
|
|
|
-import { existPayPwd } from '@/api/order.js'
|
|
|
+import { checkLogin, getUserInfo } from '@/api/login.js'
|
|
|
export default {
|
|
|
name: 'Home',
|
|
|
components: {
|
|
|
AlmostLottery,
|
|
|
},
|
|
|
computed: {
|
|
|
+ user() {
|
|
|
+ return this.$store.state.vuex_userData
|
|
|
+ },
|
|
|
startDate(){
|
|
|
return this.luckDraw?this.luckDraw.activeStartTime.split(' ')[0]:'-'
|
|
|
},
|
|
@@ -173,8 +171,8 @@ export default {
|
|
|
},
|
|
|
data() {
|
|
|
return {
|
|
|
+ userData: {},
|
|
|
focus: false,
|
|
|
- showSetPswModal: false,
|
|
|
animateUp: false,
|
|
|
timer: null,
|
|
|
scrollTextHeight: 0,
|
|
@@ -297,22 +295,10 @@ export default {
|
|
|
},
|
|
|
// 抽奖次数用完了
|
|
|
showPayWin(winTypes){
|
|
|
- // 判断用户是否设置过支付密码
|
|
|
- existPayPwd().then(res=>{
|
|
|
- if(res.status == 200) {
|
|
|
- // 设置过支付密码,输入密码
|
|
|
- if(res.data) {
|
|
|
- this.payPws = ''
|
|
|
- this.showLottery = true
|
|
|
- this.winTypes = winTypes
|
|
|
- this.prizeIndex = -1
|
|
|
- clearCacheFile()
|
|
|
- } else {
|
|
|
- // 没设置过支付密码,提示设置密码
|
|
|
- this.showSetPswModal = true
|
|
|
- }
|
|
|
- }
|
|
|
- })
|
|
|
+ this.showLottery = true
|
|
|
+ this.winTypes = winTypes
|
|
|
+ this.prizeIndex = -1
|
|
|
+ clearCacheFile()
|
|
|
},
|
|
|
// 本次抽奖开始
|
|
|
handleDrawStart() {
|
|
@@ -320,7 +306,18 @@ export default {
|
|
|
this.targetPrize = null;
|
|
|
// 抽奖次数用完了
|
|
|
if(this.reTimes<=0){
|
|
|
- this.showPayWin('win_1')
|
|
|
+ // 获取用户信息
|
|
|
+ getUserInfo().then(res => {
|
|
|
+ console.log('getUserInfo',res.data)
|
|
|
+ if(res.status == 200){
|
|
|
+ this.$u.vuex("vuex_userData",res.data)
|
|
|
+ if(res.data.currentGold < this.luckDraw.purchaseTimesGold){
|
|
|
+ this.showPayWin('win_4')
|
|
|
+ }else{
|
|
|
+ this.showPayWin('win_1')
|
|
|
+ }
|
|
|
+ }
|
|
|
+ })
|
|
|
return
|
|
|
}
|
|
|
let list = [...this.prizeList];
|
|
@@ -383,33 +380,23 @@ export default {
|
|
|
icon: 'none'
|
|
|
});
|
|
|
},
|
|
|
- // 支付乐豆继续抽奖
|
|
|
- toPay(){
|
|
|
- this.payPws = ''
|
|
|
- this.winTypes = 'win_4'
|
|
|
- },
|
|
|
// 支付确定
|
|
|
toPaySubmit(){
|
|
|
- // if(this.payPws != ''){
|
|
|
- let params = {
|
|
|
- // "payPwd": this.payPws,
|
|
|
- "payGold": this.luckDraw.purchaseTimesGold,
|
|
|
- "luckyDrawNo": this.luckDraw.luckyDrawNo
|
|
|
+ let params = {
|
|
|
+ "payGold": this.luckDraw.purchaseTimesGold,
|
|
|
+ "luckyDrawNo": this.luckDraw.luckyDrawNo
|
|
|
+ }
|
|
|
+ buyDrawTimes(params).then(res => {
|
|
|
+ if(res.status == 200){
|
|
|
+ this.showLottery = false
|
|
|
+ uni.showToast({
|
|
|
+ icon: 'none',
|
|
|
+ title: '点击开始抽奖'
|
|
|
+ })
|
|
|
+ // 查询免费抽奖次数
|
|
|
+ this.getCustomerTimes()
|
|
|
}
|
|
|
- buyDrawTimes(params).then(res => {
|
|
|
- if(res.status == 200){
|
|
|
- this.showLottery = false
|
|
|
- uni.navigateTo({
|
|
|
- url: '/pagesA/luckDraw/paySuccess?gold='+this.luckDraw.purchaseTimesGold
|
|
|
- })
|
|
|
- }
|
|
|
- })
|
|
|
- // }else{
|
|
|
- // uni.showToast({
|
|
|
- // icon: 'none',
|
|
|
- // title: '请输入支付密码'
|
|
|
- // })
|
|
|
- // }
|
|
|
+ })
|
|
|
},
|
|
|
// 文字滚动
|
|
|
scrollAnimate() {
|
|
@@ -443,21 +430,6 @@ export default {
|
|
|
url: '/pagesA/taskList/taskList?id='+this.luckDraw.luckyDrawNo
|
|
|
})
|
|
|
},
|
|
|
- // 跳转到设置支付密码页
|
|
|
- toSetPwd () {
|
|
|
- uni.navigateTo({
|
|
|
- url:"/pages/userCenter/userInfo/smsVerification"
|
|
|
- })
|
|
|
- },
|
|
|
- // 设置密码成功, 打开输入密码弹窗
|
|
|
- setPsw (e) {
|
|
|
- if (e.success) {
|
|
|
- this.toPay()
|
|
|
- setTimeout(()=>{
|
|
|
- this.focus = true
|
|
|
- },300)
|
|
|
- }
|
|
|
- },
|
|
|
},
|
|
|
onShow() {
|
|
|
// 查询免费抽奖次数
|
|
@@ -480,9 +452,6 @@ export default {
|
|
|
withShareTicket: true,
|
|
|
menus: ['shareAppMessage', 'shareTimeline']
|
|
|
})
|
|
|
-
|
|
|
- // 监听设置密码是否成功
|
|
|
- uni.$once('setPswSuccess', this.setPsw)
|
|
|
},
|
|
|
onUnload() {
|
|
|
uni.hideLoading();
|
|
@@ -693,13 +662,9 @@ export default {
|
|
|
font-size: 34rpx;
|
|
|
flex-direction: column;
|
|
|
justify-content: center;
|
|
|
-
|
|
|
> view{
|
|
|
- display: flex;
|
|
|
- align-items: center;
|
|
|
padding: 12rpx 0;
|
|
|
}
|
|
|
-
|
|
|
.pay-info{
|
|
|
font-size: 30rpx;
|
|
|
color: #666;
|