158 lines
5.2 KiB
Vue
158 lines
5.2 KiB
Vue
<template>
|
||
<view class="main">
|
||
<!-- 头部 -->
|
||
<status-nav></status-nav>
|
||
<!-- 消除碳足迹 -->
|
||
<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">
|
||
消除掉您的家庭碳足迹需要指数<text>{{treeNum.toFixed(2)}}</text>棵,您需要捐款<text>{{money.toFixed(2)}}</text>元人民币用于中国绿色碳汇基金会低碳旅游专项基金。
|
||
</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>
|
||
<view class="payment-btn payment-btn-other" @tap="ifShow=true">
|
||
<image src="/static/icon-tabbar-05.png" mode="heightFix"></image>
|
||
</view>
|
||
</view>
|
||
</view>
|
||
<!-- 导航 -->
|
||
<tabbar :current='2'></tabbar>
|
||
</view>
|
||
</view>
|
||
<!-- 轮播 -->
|
||
<view class="banner">
|
||
<swiper-pull></swiper-pull>
|
||
</view>
|
||
<!-- 底部 -->
|
||
<view class="footer">
|
||
<text>中国绿色碳汇基金会低碳旅游专项基金监制,北京凯来美气候技术咨询有限公司开发。</text>
|
||
</view>
|
||
<!-- 证书 -->
|
||
<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>
|
||
<view class="code">No.{{code}}</view>
|
||
</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>
|
||
</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">
|
||
<image src="/static/logo-02.png" mode="widthFix"></image>
|
||
<image src="/static/logo-03.png" mode="widthFix"></image>
|
||
</view>
|
||
</view>
|
||
</view>
|
||
</view>
|
||
</view>
|
||
</view>
|
||
</template>
|
||
|
||
<script>
|
||
import statusNav from '@/components/status-nav/status-nav.vue';
|
||
import tabbar from '@/components/tabbar/tabbar.vue';
|
||
import swiperPull from '@/components/swiper/swiper-pull.vue';
|
||
export default {
|
||
components: {
|
||
statusNav,
|
||
tabbar,
|
||
swiperPull
|
||
},
|
||
data() {
|
||
return {
|
||
statusHeight: uni.getSystemInfoSync().statusBarHeight, //状态栏高度
|
||
member: 0, //家庭成员
|
||
total: 0, //总计
|
||
average: 0, //平均值
|
||
treeNum: 0, //树数量
|
||
money: 0, //捐款额
|
||
ifShow:false, //是否显示证书
|
||
code:'', //证书编码
|
||
experients:0, //体验者编号
|
||
difference:0, //补齐位数
|
||
date:'', //报告时间
|
||
}
|
||
},
|
||
onLoad() {
|
||
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;
|
||
|
||
if (uni.getStorageSync('allTotal') && uni.getStorageSync('average')) {
|
||
this.total = uni.getStorageSync('allTotal');
|
||
this.average = uni.getStorageSync('average');
|
||
this.treeNum = this.average/440.00*1;
|
||
this.money = this.treeNum*67.6*1
|
||
}
|
||
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}日`;
|
||
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}`
|
||
},
|
||
methods: {
|
||
// 去捐款
|
||
toEliminate() {
|
||
uni.navigateTo({
|
||
url: `/pages/contribution/contribution?money=${this.money}`
|
||
})
|
||
},
|
||
}
|
||
}
|
||
</script>
|
||
|
||
<style>
|
||
|
||
</style>
|