Files
dou_fire/pages/index/free.vue
唐明明 8d8c14ec66 同步
2023-02-13 11:58:29 +08:00

116 lines
3.0 KiB
Vue

<template>
<view class="introduce" v-if='loaded'>
<image class="richTxt" :src="base.cover" mode="widthFix" />
<view class="nowbuy" @click="nowBuy" v-if="!is_recharge">
<view class="btn">{{base.price}}立即购买</view>
</view>
<view class="nowbuy nonebuy" v-else>
<view class="btn">已购买</view>
</view>
</view>
</template>
<script>
import { recharge } from '@/apis/interfaces/index.js'
import { umsFree } from '@/apis/interfaces/pay.js'
export default {
data() {
return {
identity : false,
loaded : false,
base : '',
is_recharge : true,
parent : false,
}
},
onLoad(e) {
this.getInfo()
},
methods:{
getInfo(){
recharge().then(res => {
this.parent = res.parent
this.identity = res.identity
this.base = res.base
this.is_recharge = res.is_recharge
this.loaded = true
}).catch(err => {
uni.showToast({
title: err.message,
icon: 'none',
mask: true,
duration: 2000
})
})
},
nowBuy(){
if(!this.parent){
uni.showModal({
title : '提示',
content : '暂无推荐人无法购买自由服务包',
cancelText : '取消',
confirmText : '确定',
showCancel : false,
})
return
}
if(!this.identity){
uni.showModal({
title : '提示',
content : '当前身份暂时无法购买自由服务包,请开通业务员后重试',
cancelText : '取消',
confirmText : '去开通',
success : res => {
if(res.confirm){
this.$Router.pushTab({name: 'Work'})
}
}
})
return
}
this.$Router.replace({
name : 'Pay',
params : {
paytype : 'free',
serviceId : this.base.service_id,
}
})
}
}
}
</script>
<style lang="scss" scoped>
.introduce{
padding-bottom: 120rpx;
.nowbuy{
position: fixed;
bottom: 0;
height: 120rpx;
padding-bottom: 20rpx;
text-align: center;
width: 100%;
color: #fff;
font-size: 32rpx;
font-weight: bold;
background-color: #fff;
.btn{
height: 90rpx;
line-height: 90rpx;
margin: 20rpx $margin*2 0 $margin*2;
border-radius: 80rpx;
background: linear-gradient( to right, #e5584c,#ee7b46);
}
}
.nonebuy{
color: #333;
font-weight: none;
.btn{
background: linear-gradient( to right, #ececec,#ececec);
}
}
.richTxt{
width: 100%;
}
}
</style>