Commit f92a566c authored by zhangjianguo's avatar zhangjianguo

余额

parent 29d5b80b
<template>
<view class="balanceStyle" :style="{'height':contentHeight}" >
<view :style="{'backgroundImage':'url('+(g.setting.bj_pic_url.url?g.setting.bj_pic_url.url:'')+')',backgroundSize: 'cover'}" class="balance_top" >
<Text style='margin-top:50rpx ;color: #fff;;font-size: 24rpx;'>账户余额(元)</Text>
<Text style='margin-top:50rpx ;color: #fff;;font-size: 36px;'>{{g.balance}}</Text>
<view class="recharge">
<Text style='color: #fff;;font-size: 28rpx;'>充值</Text>
</view>
<!-- TODO 暂无余额说明 -->
<u-icon name="question-o" color="#fff" class='explain' size="36"></u-icon>
</view>
<view class="timechoice">
<view style="width: 50%;display: flex;flex-direction: row;align-items: center;justify-content: space-between;">
<u-icon name="arrow-left" color="#909399" size="36" @click='fun_date(-1)'></u-icon>
<Text>{{date}}</Text>
<u-icon name="arrow" color="#909399" size="36" @click='fun_date(1)'></u-icon>
</view>
</view>
<view>
<!-- TODO logs列表 -->
</view>
<!-- <auth v-if="showAuth" @changeuserinfo="reloadUserinfo"></auth> -->
<view class="loading" v-if="load">
<u-loading mode="flower" size="48"></u-loading>
<Text style='color: #fff;margin-top: 10rpx;'>加载中...</Text>
</view>
</view>
</template>
<script>
import auth from "../../components/auth/index.vue";
export default {
data() {
return {
pageTitle:"余额记录",
load:false,
showAuth:false,
contentHeight:0,
mainColor: "",
u:{},
g:{},
date:'',
date2:'',
logsList:[],
}
},
components:{
auth
},
mounted() {
let currentPages = getCurrentPages();
let u = "/" + currentPages[currentPages.length-1].route;
let pages = uni.getStorageSync("basedata")
? uni.getStorageSync("basedata").bar_title
: [];
pages.forEach((x) => {
if (x.value == u) {
this.pageTitle = x.new_name ? x.new_name : x.name;
}
});
uni.setNavigationBarTitle({
title: this.pageTitle,
});
},
onLoad(){
this.u = uni.getStorageSync("userinfo");
if (!this.u) {
this.u = {
nickName: "未登录",
avatarUrl: ""
};
this.showAuth = true;
}
},
created(){
this.contentHeight = this.$utils.calcContentHeight(-40)+'px';
this.mainColor = this.$uiConfig.mainColor;
let date1 = new Date();
let time1 = date1.getFullYear() + "年" + (date1.getMonth() + 1) +'月'
let time2 = date1.getFullYear() + "-" + (date1.getMonth() + 1)
this.date = time1
this.date2 = time2
this.balancedata()
this.getlogs()
},
methods: {
reloadUserinfo() {
this.u = uni.getStorageSync("userinfo");
this.showAuth=false
},
balancedata(){
uni.showNavigationBarLoading();
let h=this.apiheader()
this.request(
{
url: "",
header:h,
data: {
r: "api/balance/index",
}
},
res => {
uni.hideNavigationBarLoading()
this.g = res.data;
}
);
},
getlogs(){
this.load=true
uni.showNavigationBarLoading();
let h=this.apiheader()
this.request(
{
url: "",
header:h,
data: {
r: "api/balance/logs",
date:this.date2,
}
},
res => {
this.load=false
}
);
},
fun_date(num){
let date = this.date;
let date2 = this.date2;
let currentDate = new Date(date2);
if(num==-1){
let lastDate = currentDate.setMonth(currentDate.getMonth() - 1); // 输出日期格式为毫秒形式1551398400000
lastDate = new Date(lastDate);
let lastYear = lastDate.getFullYear();
let lastMonth = this.checkMonth(lastDate.getMonth() + 1); // 因日期中的月份表示为0-11,所以要显示正确的月份,需要 + 1
lastDate = lastYear + '年' + lastMonth +'月';
let lastDate2 = lastYear + '-' + lastMonth;
this.date = lastDate;
this.date2 = lastDate2;
this.getlogs()
}else if(num==1){
let nextDate = currentDate.setMonth(currentDate.getMonth() + 1); // 输出日期格式为毫秒形式1556668800000
nextDate = new Date(nextDate);
let nextYear = nextDate.getFullYear();
let nextMonth = this.checkMonth(nextDate.getMonth() + 1); // 因日期中的月份表示为0-11,所以要显示正确的月份,需要 + 1
nextDate = nextYear + '年' + nextMonth+'月';
let nextDate2 = nextYear + '-' + nextMonth;
this.date = nextDate;
this.date2 = nextDate2;
this.getlogs()
}
},
checkMonth (i) {
if (i<10){
i="0" + i;
}
return i;
}
}
}
</script>
<style>
.balanceStyle{
background: #f3f4f6;
width: 100%;
}
.balanceStyle .balance_top{
width: 100%;
height: 215px;
display: flex;
flex-direction: column;
align-items: center;
position: relative;
}
.balanceStyle .recharge{
width: 90px;
height: 30px;
text-align: center;
line-height: 30px;
border-radius: 15px;
border: 1px solid #FFFFFF;
margin-top: 60rpx;
}
.balanceStyle .explain{
position: absolute;
right: 20rpx;
top:20rpx
}
.balanceStyle .timechoice{
width: 100%;
height: 50px;
background: #FFFFFF;
display: flex;
align-items: center;
justify-content: center;
}
.balanceStyle .loading{
width: 200rpx;
height: 200rpx;
background: #000000;
opacity: 0.7;
border-radius: 10rpx;
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
position: fixed;
left: 50%;
top:30%;
margin-left: -100rpx;
z-index: 999;
}
</style>
...@@ -74,7 +74,7 @@ ...@@ -74,7 +74,7 @@
</view> </view>
<!-- <auth v-if="showAuth" @changeuserinfo="reloadUserinfo"></auth> --> <!-- <auth v-if="showAuth" @changeuserinfo="reloadUserinfo"></auth> -->
<view class="loading" v-show="loading"> <view class="loading" v-show="loading">
<u-loading mode="flower" size="48">></u-loading> <u-loading mode="flower" size="48"></u-loading>
<Text style='color: #fff;margin-top: 10rpx;'>加载中...</Text> <Text style='color: #fff;margin-top: 10rpx;'>加载中...</Text>
</view> </view>
<w-picker <w-picker
...@@ -156,7 +156,8 @@ ...@@ -156,7 +156,8 @@
goodId:'', goodId:'',
showModal:false, showModal:false,
index:0, index:0,
ci:0 ci:0,
u:{},
} }
}, },
components:{ components:{
...@@ -172,8 +173,8 @@ ...@@ -172,8 +173,8 @@
mounted() { mounted() {
let currentPages = getCurrentPages(); let currentPages = getCurrentPages();
let u = "/" + currentPages[currentPages.length-1].route; let u = "/" + currentPages[currentPages.length-1].route;
let pages = wx.getStorageSync("basedata") let pages = uni.getStorageSync("basedata")
? wx.getStorageSync("basedata").bar_title ? uni.getStorageSync("basedata").bar_title
: []; : [];
pages.forEach((x) => { pages.forEach((x) => {
if (x.value == u) { if (x.value == u) {
......
...@@ -34,34 +34,34 @@ ...@@ -34,34 +34,34 @@
</view> </view>
<view class="account_bar" v-if="meueData.user_center.is_account_status==1"> <view class="account_bar" v-if="meueData.user_center.is_account_status==1">
<view class="account_bar_item"> <view class="account_bar_item" v-if="meueData.user_center.account_bar.integral.status==1" >
<Text :style="{'color':secondary}">{{user_info.integral}}</Text> <Text :style="{'color':secondary}">{{user_info.integral}}</Text>
<view class="footprint_item_bottom"> <view class="footprint_item_bottom">
<image :src='meueData.user_center.account_bar.integral.icon' style="width: 26rpx;height: 26rpx;"></image> <image :src='meueData.user_center.account_bar.integral.icon' style="width: 26rpx;height: 26rpx;"></image>
<Text style='margin-left: 10rpx;'>{{meueData.user_center.account_bar.integral.text}}</Text> <Text style='margin-left: 10rpx;'>{{meueData.user_center.account_bar.integral.text}}</Text>
</view> </view>
</view> </view>
<view style="width: 1px;height: 60rpx;background: #f5f5f5;"></view> <view style="width: 1px;height: 60rpx;background: #f5f5f5;" v-if="meueData.user_center.account_bar.integral.status==1"></view>
<view class="account_bar_item"> <view class="account_bar_item" v-if="meueData.user_center.account_bar.balance.status==1" @click="goUrl('/pages/balance/balance')">
<Text :style="{'color':secondary}">{{user_info.balance}}</Text> <Text :style="{'color':secondary}">{{user_info.balance}}</Text>
<view class="footprint_item_bottom"> <view class="footprint_item_bottom">
<image :src='meueData.user_center.account_bar.balance.icon' style="width: 26rpx;height: 26rpx;"></image> <image :src='meueData.user_center.account_bar.balance.icon' style="width: 26rpx;height: 26rpx;"></image>
<Text style='margin-left: 10rpx;'>{{meueData.user_center.account_bar.balance.text}}</Text> <Text style='margin-left: 10rpx;'>{{meueData.user_center.account_bar.balance.text}}</Text>
</view> </view>
</view> </view>
<view style="width: 1px;height: 60rpx;background: #f5f5f5;"></view> <view style="width: 1px;height: 60rpx;background: #f5f5f5;" v-if="meueData.user_center.account_bar.balance.status==1"></view>
<view class="account_bar_item"> <view class="account_bar_item" v-if="meueData.user_center.account_bar.coupon.status==1">
<Text :style="{'color':secondary}">{{user_info.coupon}}</Text> <Text :style="{'color':secondary}">{{user_info.coupon}}</Text>
<view class="footprint_item_bottom"> <view class="footprint_item_bottom">
<image :src='meueData.user_center.account_bar.coupon.icon' style="width: 26rpx;height: 26rpx;"></image> <image :src='meueData.user_center.account_bar.coupon.icon' style="width: 26rpx;height: 26rpx;"></image>
<Text style='margin-left: 10rpx;'>{{meueData.user_center.account_bar.coupon.text}}</Text> <Text style='margin-left: 10rpx;'>{{meueData.user_center.account_bar.coupon.text}}</Text>
</view> </view>
</view> </view>
<view style="width: 1px;height: 60rpx;background: #f5f5f5;"></view> <view style="width: 1px;height: 60rpx;background: #f5f5f5;" v-if="meueData.user_center.account_bar.coupon.status==1"></view>
<view class="account_bar_item"> <view class="account_bar_item" v-if="meueData.user_center.account_bar.card.status==1">
<Text :style="{'color':secondary}">{{user_info.card}}</Text> <Text :style="{'color':secondary}">{{user_info.card}}</Text>
<view class="footprint_item_bottom"> <view class="footprint_item_bottom">
<image :src='meueData.user_center.account_bar.card.icon' style="width: 26rpx;height: 26rpx;"></image> <image :src='meueData.user_center.account_bar.card.icon' style="width: 26rpx;height: 26rpx;"></image>
...@@ -333,7 +333,7 @@ ...@@ -333,7 +333,7 @@
position: absolute; position: absolute;
right: -10rpx; right: -10rpx;
top: -10rpx; top: -10rpx;
padding:0 7rpx; padding:0 12rpx;
display: flex; display: flex;
align-items: center; align-items: center;
justify-content: center; justify-content: center;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment