123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236 |
- <template>
- <view class="content">
- <view class="bg">
- <image src="../../static/user/bg.png" mode=""></image>
- </view>
- <view class="header">
- <view class="header-left" @click="toBack()">
- <image class="goback" src="../../static/user/fanhui.png" mode=""></image>
- </view>
- <view class="header-title">
- 电费
- </view>
- </view>
- <view class="box-title">
- <view class="yue">
- 电费余额
- </view>
- <view class="yuan">
- {{yue}}元
- </view>
- </view>
- <view class="box-content">
- <view class="content-title">
- <view class="left">
- 电费明细
- </view>
- <view class="right" @click="navTo()">
- 立即充值
- </view>
- </view>
- <view class="box">
- <view class="content-content" v-for="item in list">
- <view class="money">
- {{item.pm>0?'+':'-'}}{{item.number}}
- </view>
- <view class="time">
- {{item.add_time}}
- </view>
- </view>
- </view>
- </view>
- </view>
- </template>
- <script>
- import { mapMutations } from 'vuex';
- import { getUserInfo } from '@/api/user.js';
- import {
- charge
- } from '../../api/user.js'
- import {
- mapState
- } from 'vuex';
- export default {
- data() {
- return {
- pm: 1, //收入
- yue: 0, //电费余额
- list: [] //电费订单列表
- };
- },
- computed: {
- ...mapState('user', ['userInfo'])
-
- },
- onLoad() {
- this.loadData()
- },
- onShow() {
-
- this.loadData()
- getUserInfo().then(res=>{
- this.setUserInfo(res.data);
- })
-
- },
- methods: {
- ...mapMutations('user', ['setUserInfo', 'login']),
- toBack() {
- uni.switchTab({
- url: "/pages/user/user"
- })
- },
- navTo() {
- uni.navigateTo({
- url: "recharge"
- })
- },
- loadData() {
- let obj = this
- charge().then(res => {
- obj.list = res.data
- console.log(res, '2222');
- obj.yue = obj.userInfo.electric_fee
- console.log(obj.yue);
- console.log(obj.userInfo, '2222');
- })
- }
- }
- }
- </script>
- <style lang="scss">
- page,
- .content {
- margin: 0;
- padding: 0;
- height: 100%;
- }
- .bg {
- width: 750rpx;
- height: 357rpx;
- image {
- height: 100%;
- width: 100%;
- }
- }
- .header {
- width: 100%;
- z-index: 99;
- position: absolute;
- left: 0;
- top: 0;
- z-index: 99;
- margin: 30rpx auto;
- display: flex;
- justify-content: center;
- .header-left {
- position: absolute;
- left: 25rpx;
- top: 0;
- height: 60rpx;
- display: flex;
- align-items: center;
- }
- .goback {
- z-index: 100;
- width: 34rpx;
- height: 34rpx;
- }
- .header-title {
- font-size: 36rpx;
- font-weight: bold;
- color: #FFFFFF;
- }
- }
- .box-title {
- position: absolute;
- margin-top: -200rpx;
- // margin: 0 auto;
- display: flex;
- margin: -200rpx auto;
- left: 72.5rpx;
- justify-content: center;
- flex-direction: column;
- align-items: center;
- width: 605rpx;
- height: 225rpx;
- background: #FFFFFF;
- border-radius: 20rpx 20rpx 0 0;
- .yue {
- font-size: 38rpx;
- font-weight: 500;
- color: #333333;
- line-height: 54rpx;
- }
- .yuan {
- margin-top: 15rpx;
- font-size: 38rpx;
- font-weight: bold;
- color: #FF6600;
- line-height: 54rpx;
- }
- }
- .box-content {
- margin: 0 25rpx;
- .content-title {
- margin-top: 100rpx;
- justify-content: space-between;
- display: flex;
- .left {
- font-size: 32rpx;
- font-weight: 500;
- color: #141E47;
- }
- .right {
- font-size: 26rpx;
- text-align: center;
- line-height: 48rpx;
- font-weight: 500;
- color: #141E47;
- width: 138rpx;
- height: 48rpx;
- background: #F7F6FB;
- border: 2rpx solid #141E47;
- border-radius: 10rpx;
- }
- }
- }
- .box {}
- .content-content {
- padding: 0 20rpx;
- display: flex;
- justify-content: space-between;
- border-bottom: 1rpx solid #E1E1E1;
- line-height: 100rpx;
- .money {}
- .time {}
- }
- </style>
|