123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177 |
- <template>
- <view>
- <navbar :config="config" backColor="#999999"></navbar>
- <view class="balance-top">
- <text class="balance-title">余额(元)</text>
- <text class="balance-nums">{{ $addDecimals(balance , 2) }}</text>
- <view class="balance-btns">
- <view class="balance-btn" @click.stop="goBalancePay()">
- 去充值
- </view>
- <!-- <view class="balance-btn exchange-btn" @click.stop="goBalanceExchange()">
- 余额转赠
- </view> -->
- </view>
- </view>
- <consume-list title="余额明细" :status="status" :list="pointsList" :keys="{title:'remark',time:'formatCreateTimeMillis',val:'entryValue',type:'billType'}"></consume-list>
-
- </view>
- </template>
- <script>
- import {
- refillCardInfo
- } from "@/api/personal-center.js"
- import {
- getAccountInfo
- } from "@/api/login.js"
- export default {
- data() {
- return {
- balance: 0,
- config: {
- back: true, //false是tolbar页面 是则不写
- title: '我的余额',
- color: '#1A1A1A',
- // autoBack:true,
- //背景颜色;参数一:透明度(0-1);参数二:背景颜色(array则为线性渐变,string为单色背景)
- backgroundColor: [1, "#fff"],
- statusBarFontColor: '#1A1A1A'
- },
- params: {
- page: 1,
- limit: 10
- },
- pointsList:[],
- status: 'loading', //more|loading|noMore
- };
- },
- onShow() {
- this.getUserInfo()
- this.params.page = 1;
- this.pointsList = [];
- this.getList();
- },
- onReachBottom() {
- if ( this.status !== 'loading' && this.status !== 'noMore') {
- this.params.page++
- this.getList()
- }
- },
- onPullDownRefresh() {
- this.params.page = 1
- this.pointsList = []
- this.getList()
- },
- methods: {
- getList(){
- this.status = 'loading';
- this.$http.get(refillCardInfo, this.params).then((res) => {
- if (res && res.code == 200) {
- uni.stopPullDownRefresh()
- this.pointsList = this.pointsList.concat(res.page.list);
- if (res.page.totalPage <= res.page.currPage) {
- this.status = 'noMore'
- } else {
- this.status = 'more'
- }
- }
- });
- },
- //获取个人信息
- getUserInfo() {
- this.$http.get(getAccountInfo).then(res => {
- if (res && res.code == 200) {
- this.balance = res.data.balance;
- uni.setStorageSync("personal", res.data)
- } else {
- this.isLogin = false
- }
- })
- },
- // 余额充值
- goBalancePay() {
- uni.navigateTo({
- url: "/pages/user/Pay",
- fail: err => {
- console.log('goBalanceExchange = ', err)
- }
- })
- },
- // 余额转赠
- goBalanceExchange() {
- uni.navigateTo({
- url: "/pages/user/balance-exchange",
- fail: err => {
- console.log('goBalanceExchange = ', err)
- }
- })
- },
- }
- }
- </script>
- <style lang="scss" scoped>
- .balance-top {
- width: 100%;
- min-height: 365rpx;
- background-color: #FA6138;
- display: flex;
- flex-direction: column;
- align-items: center;
- justify-content: center;
- padding: 50rpx 60rpx 113rpx;
- font-family: PingFang SC, PingFang SC-Regular;
- font-weight: 400;
- color: #ffffff;
- .balance-title {
- font-size: 28rpx;
- }
- .balance-nums {
- font-size: 50rpx;
- }
- .balance-btns {
- width: 100%;
- display: flex;
- justify-content: space-between;
- align-items: center;
- padding: 30rpx 0 50rpx;
- .balance-btn {
- width: 270rpx;
- height: 70rpx;
- background: #FA6138;
- border: 1rpx solid #ffffff;
- border-radius: 36rpx;
- text-align: center;
- line-height: 68rpx;
- font-size: 26rpx;
- }
- .exchange-btn {
- background-color: #fff;
- color: #FA6138;
- }
- }
- // <view class="balance-top">
- // <text class="balance-title">余额(元)</text>
- // <text class="balance-nums">4974.00</text>
- // <view class="balance-btns">
- // <view class="balance-btn">
- // 去充值
- // </view>
- // <view class="balance-btn">
- // 余额转赠
- // </view>
- // </view>
- // </view>
- }
- </style>
|