提现增加观看广告
This commit is contained in:
parent
39a6a720e7
commit
6cdb3c5840
|
|
@ -48,9 +48,9 @@
|
|||
</view>
|
||||
</view> -->
|
||||
</view>
|
||||
<view @click="getOut"
|
||||
<view @click="withdraw"
|
||||
style="margin: 32upx;font-size: 18px;background: #ff7581;color: white;border-radius: 10px;height: 40px;line-height: 40px;">
|
||||
提现
|
||||
{{!isWithdraw?'观看广告提现':'立即提现'}}
|
||||
</view>
|
||||
|
||||
<view style="display: flex;width: 100%;justify-content: center;">
|
||||
|
|
@ -114,6 +114,12 @@
|
|||
</view>
|
||||
|
||||
</u-modal>
|
||||
|
||||
<!-- 激励视频广告 -->
|
||||
<ad-rewarded-video v-if="adRewardedVideo" ref="adRewardedVideo" adpid="1531580352" :loadnext="true" v-slot:default="{loading, error}"
|
||||
:url-callback="urlCallback" @load="onadload" @close="onadclose" @error="onaderror">
|
||||
<view class="ad-error" v-if="error">{{error}}</view>
|
||||
</ad-rewarded-video>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
|
|
@ -173,6 +179,10 @@
|
|||
limit: 10,
|
||||
totalCount: 0,
|
||||
cashMoney: 0,
|
||||
urlCallback: null,
|
||||
adRewardedVideo: true,
|
||||
adRewardedVideoloadNum: 0,
|
||||
isWithdraw: false,
|
||||
};
|
||||
},
|
||||
onLoad() {
|
||||
|
|
@ -202,8 +212,84 @@
|
|||
onNavigationBarButtonTap() {
|
||||
// this.list();
|
||||
},
|
||||
onReady() {
|
||||
this.$nextTick(()=>{
|
||||
this.adRewardedVideoloadNum = 0
|
||||
this.$refs.adRewardedVideo.load();
|
||||
})
|
||||
this.getCanCash()
|
||||
},
|
||||
methods: {
|
||||
//规则弹窗
|
||||
/**
|
||||
* 获取看广告状态
|
||||
*/
|
||||
getCanCash() {
|
||||
this.$Request.getT('app/cash/canCash').then(res => {
|
||||
console.log(res)
|
||||
if (res.code == 0) {
|
||||
this.isWithdraw = res.data;
|
||||
} else {
|
||||
this.isWithdraw = false;
|
||||
}
|
||||
})
|
||||
},
|
||||
/**
|
||||
* 广告数据加载成功回调
|
||||
* @param {Object} e
|
||||
*/
|
||||
onadload(e) {
|
||||
this.adRewardedVideo = true;
|
||||
console.log('广告数据加载成功');
|
||||
},
|
||||
|
||||
/**
|
||||
* 广告加载失败回调
|
||||
* @param {Object} e
|
||||
*/
|
||||
onaderror(e) {
|
||||
if ( this.adRewardedVideoloadNum >=3 ) {
|
||||
this.adRewardedVideo = false;
|
||||
return
|
||||
}
|
||||
this.adRewardedVideoloadNum++
|
||||
setTimeout(() => {
|
||||
this.$refs.adRewardedVideo.load();
|
||||
}, 1000); // 10
|
||||
console.log("广告加载失败")
|
||||
},
|
||||
|
||||
/**
|
||||
* 广告播放成功回调
|
||||
* @param {Object} e
|
||||
*/
|
||||
async onadclose(e) {
|
||||
const detail = e.detail
|
||||
if (detail && detail.isEnded) {
|
||||
// 正常播放结束
|
||||
let res = await this.$Request.getT('app/ad/state', {
|
||||
extraKey: this.urlCallback.extra
|
||||
})
|
||||
this.getCanCash()
|
||||
} else {
|
||||
// 播放中途退出
|
||||
}
|
||||
},
|
||||
withdraw() {
|
||||
|
||||
if ( !this.isWithdraw ) {
|
||||
this.urlCallback = {
|
||||
userId: uni.getStorageSync('userId'),
|
||||
extra: 'cash:'+uni.getStorageSync('userId') + "" + new Date().getTime(),
|
||||
}
|
||||
this.$refs.adRewardedVideo.show();
|
||||
} else {
|
||||
this.getOut()
|
||||
}
|
||||
|
||||
},
|
||||
/**
|
||||
* 规则弹窗打开
|
||||
*/
|
||||
showRule(){
|
||||
this.ruleShow=true
|
||||
},
|
||||
|
|
@ -223,6 +309,10 @@
|
|||
setAllMoney() {
|
||||
this.money = Math.floor(this.mayMoney * 100) / 100
|
||||
},
|
||||
|
||||
/**
|
||||
* 获取提现记录
|
||||
*/
|
||||
getMoneyDetail() {
|
||||
let that = this;
|
||||
let token = uni.getStorageSync('token')
|
||||
|
|
@ -260,46 +350,50 @@
|
|||
});
|
||||
|
||||
},
|
||||
// 可提现金额
|
||||
|
||||
/**
|
||||
* 可提现金额
|
||||
*/
|
||||
getcashMoney() {
|
||||
let data = {
|
||||
page: this.page,
|
||||
limit: this.limit
|
||||
}
|
||||
// this.$u.api.myPurseDet(data).then(res => {
|
||||
// if (res.code == 0) {
|
||||
// this.mayMoney = res.data.inviteMoney.money
|
||||
// } else {
|
||||
// uni.showToast({
|
||||
// title: res.msg,
|
||||
// duration: 1000,
|
||||
// icon: 'none'
|
||||
// });
|
||||
// }
|
||||
// })
|
||||
|
||||
this.$Request.getT('app/moneyDetails/selectUserMoney').then(res => {
|
||||
if (res.code == 0) {
|
||||
this.mayMoney = res.data.amount || 0
|
||||
}
|
||||
})
|
||||
},
|
||||
// 提现记录
|
||||
|
||||
/**
|
||||
* 提现记录
|
||||
*/
|
||||
gojilu() {
|
||||
uni.navigateTo({
|
||||
url: '/me/invite/cashList'
|
||||
});
|
||||
},
|
||||
//钱包明细
|
||||
|
||||
/**
|
||||
* 红包明细
|
||||
*/
|
||||
goqianbao() {
|
||||
uni.navigateTo({
|
||||
url: '/me/invite/moneyList?moneyType=1&viewType=2'
|
||||
});
|
||||
},
|
||||
|
||||
/**
|
||||
* 绑定支付宝
|
||||
*/
|
||||
goZhifuBao() {
|
||||
uni.navigateTo({
|
||||
url: '/me/invite/zhifubao'
|
||||
});
|
||||
},
|
||||
|
||||
getMoney() {
|
||||
let that = this;
|
||||
let token = that.token
|
||||
|
|
@ -345,10 +439,7 @@
|
|||
})
|
||||
}
|
||||
},
|
||||
//校验用户输入金额
|
||||
checkMobile(money) {
|
||||
return RegExp(/^1[34578]\d{9}$/).test(money);
|
||||
},
|
||||
|
||||
getOut() {
|
||||
let that = this;
|
||||
let token = that.token
|
||||
|
|
|
|||
Loading…
Reference in New Issue