com.kailaimei.carbon/pages/eliminate/eliminate.vue

159 lines
5.3 KiB
Vue
Raw Normal View History

2023-02-03 10:05:19 +08:00
<template>
<view class="main">
<!-- 头部 -->
2023-02-03 14:19:23 +08:00
<status-nav></status-nav>
2023-02-03 10:05:19 +08:00
<!-- 消除碳足迹 -->
<view class="calculator-bg">
<view class="bg-img">
<image src="/static/count-bg.png" mode="widthFix"></image>
</view>
<view class="calculator calculator-other">
<view class="eliminate">
<view class="eliminate-title">
<image src="/static/icon-title-03.png" mode="heightFix"></image>
</view>
<view class="tips">
<view class="item">
您全家一年的碳足迹碳排放<text>{{total}}</text>kg人均碳足迹为<text>{{average}}</text>kg
</view>
<view class="item">
2023-02-06 16:56:58 +08:00
消除掉您的家庭碳足迹需要指数<text>{{treeNum.toFixed(2)}}</text>您需要捐款<text>{{money.toFixed(2)}}</text>元人民币用于中国绿色碳汇基金会低碳旅游专项基金
2023-02-03 10:05:19 +08:00
</view>
<view class="item">
谢谢您在应对气候变化方面所做的贡献您是一位有责任的的人
</view>
</view>
<view class="eliminate-img">
<image src="/static/eliminate.png" mode="heightFix"></image>
<view class="payment-btn" @tap="toEliminate">
<image src="/static/icon-tabbar-04.png" mode="heightFix"></image>
</view>
2023-02-16 10:18:20 +08:00
<view class="payment-btn payment-btn-other" @tap="ifShow=true">
<image src="/static/icon-tabbar-05.png" mode="heightFix"></image>
</view>
2023-02-03 10:05:19 +08:00
</view>
</view>
2023-02-03 14:19:23 +08:00
<!-- 导航 -->
<tabbar :current='2'></tabbar>
2023-02-03 10:05:19 +08:00
</view>
</view>
<!-- 轮播 -->
<view class="banner">
<swiper-pull></swiper-pull>
</view>
<!-- 底部 -->
<view class="footer">
2023-02-20 14:53:06 +08:00
<text>中国绿色碳汇基金会低碳旅游专项基金监制北京凯来美气候科技有限公司开发</text>
2023-02-03 10:05:19 +08:00
</view>
2023-02-16 10:18:20 +08:00
<!-- 证书 -->
<view class="certificate-bg" v-if="ifShow" @tap="ifShow=false">
<view class="certificate">
<image src="/static/certificate-bg.jpg" mode="widthFix"></image>
<view class="content">
<view class="logo">
<image src="/static/logo-01.png" mode="heightFix"></image>
</view>
<view class="txt">
<image src="/static/code-title.png" mode="heightFix"></image>
2023-02-20 14:53:06 +08:00
<view class="code">NO.{{code}}</view>
2023-02-16 10:18:20 +08:00
</view>
<view class="msg">
<view class="item">
您是第
<view class="number">
<text v-for="(item,index) in difference">0</text>
<text>{{experients}}</text>
</view>
位体验者
</view>
<view class="item">感谢您参与爱绿行碳普惠平台互动计算碳排放量学习节能降碳等知识践行低碳旅游和生活新风尚用行动守护景区美丽环境</view>
<view class="time">{{date}}</view>
2023-02-16 10:18:20 +08:00
</view>
<view class="foot">
<view class="qr">
<image src="/static/qr-alx.png" mode="widthFix"></image>
<view class="tips">扫码关注<text>爱绿行</text></view>
</view>
<view class="foot-logo">
2023-02-20 14:53:06 +08:00
<!-- <image src="/static/logo-02.png" mode="widthFix"></image> -->
2023-02-16 10:18:20 +08:00
<image src="/static/logo-03.png" mode="widthFix"></image>
</view>
2023-02-20 14:53:06 +08:00
<view class="support">技术支持北京零碳创意科技有限公司</view>
2023-02-16 10:18:20 +08:00
</view>
</view>
</view>
</view>
2023-02-03 10:05:19 +08:00
</view>
</template>
<script>
2023-02-03 14:19:23 +08:00
import statusNav from '@/components/status-nav/status-nav.vue';
import tabbar from '@/components/tabbar/tabbar.vue';
2023-02-03 10:05:19 +08:00
import swiperPull from '@/components/swiper/swiper-pull.vue';
export default {
components: {
2023-02-03 14:19:23 +08:00
statusNav,
tabbar,
2023-02-03 10:05:19 +08:00
swiperPull
},
data() {
return {
statusHeight: uni.getSystemInfoSync().statusBarHeight, //状态栏高度
member: 0, //家庭成员
total: 0, //总计
average: 0, //平均值
treeNum: 0, //树数量
money: 0, //捐款额
2023-02-16 10:18:20 +08:00
ifShow:false, //是否显示证书
code:'', //证书编码
experients:0, //体验者编号
difference:0, //补齐位数
date:'', //报告时间
2023-02-03 10:05:19 +08:00
}
},
2023-02-03 14:19:23 +08:00
onLoad() {
2023-02-16 10:18:20 +08:00
if(uni.getStorageSync('newUser')!=='newUser'){
if(uni.getStorageSync('experients')){
this.experients = uni.getStorageSync('experients')+1;
}else{
this.experients = 1;
}
uni.setStorageSync('experients',this.experients);
uni.setStorageSync('newUser','newUser');
}else{
this.experients = uni.getStorageSync('experients');
}
this.difference = 6-this.experients.toString().length;
2023-02-06 16:56:58 +08:00
if (uni.getStorageSync('allTotal') && uni.getStorageSync('average')) {
2023-02-03 14:19:23 +08:00
this.total = uni.getStorageSync('allTotal');
2023-02-03 10:05:19 +08:00
this.average = uni.getStorageSync('average');
2023-02-16 10:18:20 +08:00
this.treeNum = this.average/440.00*1;
this.money = this.treeNum*67.6*1
2023-02-03 10:05:19 +08:00
}
2023-02-16 10:18:20 +08:00
const date = new Date();
let year = date.getFullYear();
let month = date.getMonth() + 1;
let day = date.getDate();
let hour = date.getHours();
let minute = date.getMinutes();
let second = date.getSeconds();
let random = Math.ceil(Math.random() * 99 + 1);
this.date = `${year}${month<10?'0'+month:month}${day<10?'0'+day:day}`;
2023-02-16 10:18:20 +08:00
this.code = `${year.toString().substr(2)}${month<10?'0'+month:month}${day<10?'0'+day:day}${hour<10?'0'+hour:hour}${minute<10?'0'+minute:minute}${second<10?'0'+second:second}${random<10?'0'+random:random}`
2023-02-03 10:05:19 +08:00
},
methods: {
// 去捐款
toEliminate() {
uni.navigateTo({
2023-02-03 14:19:23 +08:00
url: `/pages/contribution/contribution?money=${this.money}`
2023-02-03 10:05:19 +08:00
})
},
}
}
</script>
<style>
</style>