Files
h5-uniapp/pages/my/butiranKadar/butiranKadar.vue
T

201 lines
5.6 KiB
Vue
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
<template>
<view :style="'background-color: '+theme.bg+';color: '+theme.text" style="height: 100vh;">
<!-- 头部 -->
<myNav :title="i18n.newWord.mytitle4"></myNav>
<!-- 身体 -->
<view class="width-750">
<view class="feilvbox">
<text class="font-30 color-white medium-font">{{i18n.newWord.allfree}}</text>
<text class="font-46 color-white medium-font">{{my_fl}}</text>
</view>
<view class="padding-w-30">
<!-- apt手续费 -->
<view class="listBox">
<text class="font-30">{{i18n.mine.safety.apt}}({{apt_free}}%)</text>
<view class="flex align-center">
<u-switch @change="changeApy_pay" v-model="checked" :loading="loading"></u-switch>
</view>
</view>
<!-- 分割 -->
<view class="height-2" :style="'background-color: '+theme.fu_bg"></view>
<view class="padding-c-24">
<view class="font-30 medium-font">{{i18n.newWord.freetil1}}</view>
<view class="padding-t-8 line-height-32" v-html="">
<text class="font-24 medium-font">{{i18n.newWord.freetxt}}</text>
</view>
<view class="margin-t-20">
<view class="flex">
<view class="huibox flex-1">
<text class="medium-font">{{i18n.newWord.freetime}}</text>
</view>
<view v-for="(item,index) in year_feilv" :key="index" class="huibox flex-1">
<text class="medium-font">{{item.title}}</text>
</view>
</view>
<view class="flex">
<view class="huibox flex-1">
<text class="medium-font">{{i18n.newWord.discount}}</text>
</view>
<view v-for="(item,index) in year_feilv" :key="index" class="baibox flex-1" :style="'background-color: '+theme.fu_bg+';color: '+theme.fu_text">
<text class="nummedium-font">{{item.price}}</text>
</view>
</view>
</view>
</view>
</view>
<view class="margin-t-12 padding-c-24 padding-w-30">
<view class="font-30 medium-font">{{i18n.newWord.freetil2}}</view>
<view class="margin-t-20 flex">
<view class="flex-1 flex direction-column">
<view class="huibox">
<text class="medium-font">{{i18n.newWord.freeprice}}</text>
</view>
<view v-for="(item,index) in zy_feilv" :key="index" class="baibox" :style="'background-color: '+theme.fu_bg+';color: '+theme.fu_text">
<text class="nummedium-font">{{item.num}}</text>
</view>
</view>
<view class="flex-1 flex direction-column">
<view class="huibox">
<text class="medium-font">{{i18n.newWord.deductible}}</text>
</view>
<view v-for="(item,index) in zy_feilv" :key="index" class="baibox" :style="'background-color: '+theme.fu_bg+';color: '+theme.fu_text">
<text class="nummedium-font">{{item.price}}</text>
</view>
</view>
</view>
</view>
</view>
</view>
</template>
<script>
export default {
data() {
return {
apy_pay: 0, //是否开启apt 0否 1是
apt_free: 0,
checked: false,
loading: false,
// 中间变量,避免在watch中多次回调,造成无限循环
controlStatus: false,
my_fl: '',
year_feilv: [],
zy_feilv: [],
theme: '',
}
},
computed: {
i18n() {
return this.$t('message');
}
},
onShow() {
if (uni.getStorageSync("theme") == "dark") {
this.theme = this.$store.state.darkTheme
} else {
this.theme = this.$store.state.lightTheme
}
this.getInfo()
this.getfeilv_con()
},
methods: {
changeApy_pay(e) {
// 等于false,意味着用户手动关闭了switch
if (this.controlStatus == true) return
this.controlStatus = true
// 重新打开switch,并让它处于加载中的状态
this.loading = true;
// 模拟向后端发起请求
this.getRestultFromServer();
},
getRestultFromServer() {
this.post('/my/set_apt').then(res => {
console.log('开启关闭apt手续费交易', res)
this.loading = false;
if (res.code == 1) {
// 后端允许用户关闭switch,改变checked状态,结束loading状态
} else {
// 后端出问题 不允许用户关闭switch,设置checked为true,结束loading状态
this.checked = !this.checked;
}
setTimeout(() => {
this.controlStatus = false
}, 1000)
})
},
getInfo() {
this.post('/my/security').then(res => {
// console.log('安全中心', res)
if (res.code == 1) {
this.apt_free = res.data.apt_free
if (res.data.apy_pay == 1) {
this.checked = true
} else {
this.checked = false
}
}
})
},
getfeilv_con() {
this.post('/my/feilv_con').then(res => {
console.log('费率详情', res)
if (res.code == 1) {
this.my_fl = res.data.my_fl
this.year_feilv = res.data.year_feilv
this.zy_feilv = res.data.zy_feilv
}
})
}
}
}
</script>
<style lang="scss">
.feilvbox {
width: 750rpx;
height: 110rpx;
background: linear-gradient(276deg, #34AEFF 0%, #4B8DFF 100%);
display: flex;
align-items: center;
justify-content: space-between;
padding: 0 30rpx;
}
.listBox {
width: 100%;
height: 96rpx;
// background-color: #FFFFFF;
display: flex;
align-items: center;
justify-content: space-between;
}
.huibox {
// width: 115rpx;
height: 72rpx;
// background: rgba(241, 244, 248, 0.5);
border: 1rpx solid #ECECEC;
display: flex;
align-items: center;
justify-content: center;
font-size: 24rpx;
// color: #333333;
}
.baibox {
// width: 115rpx;
height: 72rpx;
// background: rgb(255, 255, 255);
border: 1rpx solid #ECECEC;
display: flex;
align-items: center;
justify-content: center;
font-size: 28rpx;
// color: #333333;
}
</style>