同步数据

This commit is contained in:
2022-06-11 16:25:24 +08:00
parent 83e82ed31e
commit f9b81ba51e
6 changed files with 202 additions and 164 deletions

View File

@@ -9,9 +9,11 @@
import { request } from '../index' import { request } from '../index'
// dt账户 // dt账户
const dt = () =>{ const dt = (data) =>{
console.log(data)
return request({ return request({
url: "user/account/dt_logs" url: "user/account/dt_logs",
data
}) })
} }

View File

@@ -252,11 +252,13 @@
}, { }, {
"path": "pages/account/dt", "path": "pages/account/dt",
"name": "AccountDt", "name": "AccountDt",
"style": { "style": {
"navigationBarTitleText": "DT积分", "navigationBarTitleText": "DT积分",
"navigationBarBackgroundColor": "#34CE98", "navigationBarBackgroundColor": "#34CE98",
"backgroundColorTop": "#34CE98", "backgroundColorTop": "#34CE98",
"navigationBarTextStyle": "white", "navigationBarTextStyle": "white",
"enablePullDownRefresh":true,
"app-plus": { "app-plus": {
"titleNView": { "titleNView": {
"buttons": [{ "buttons": [{

View File

@@ -1,157 +1,190 @@
<template> <template>
<view class="content"> <view class="content">
<view class="dt-header"> <view class="dt-header">
<view class="dt-header-number"> <view class="dt-header-number">
<view class="title">DT积分余额</view> <view class="title">DT积分余额</view>
<view class="num">{{score}}</view> <view class="num">{{score}}</view>
</view> </view>
<button class="transfer" size="mini" @click="onTransfer('AccountCode')">收款</button> <button class="transfer" size="mini" @click="onTransfer('AccountCode')">收款</button>
<button class="transfer" size="mini" @click="onTransfer('AccountTransfer')">转账</button> <button class="transfer" size="mini" @click="onTransfer('AccountTransfer')">转账</button>
</view> </view>
<block v-if="logs.length > 0"> <block v-if="logs.length > 0">
<view class="logs-title">账户记录</view> <view class="logs-title">账户记录</view>
<view class="logs-item" v-for="(item,index) in logs" :key="index"> <view class="logs-item" v-for="(item,index) in logs" :key="index">
<view class="logs-item-title">{{item.remark}}</view> <view class="logs-item-title">{{item.remark}}</view>
<view class="logs-item-time">{{item.created_at}}</view> <view class="logs-item-time">{{item.created_at}}</view>
<view class="logs-item-price" :class="item.amount > 0 ? 'add': 'remove'">{{item.amount}}</view> <view class="logs-item-price" :class="item.amount > 0 ? 'add': 'remove'">{{item.amount}}</view>
</view> </view>
</block> </block>
<block v-else> <block v-else>
<view class="vertical pages-empty"> <view class="vertical pages-empty">
<u-empty <u-empty icon="http://cdn.uviewui.com/uview/empty/list.png" textColor="#999" text="暂无账户记录">
icon="http://cdn.uviewui.com/uview/empty/list.png" </u-empty>
textColor="#999" </view>
text="暂无账户记录" </block>
> </view>
</u-empty>
</view>
</block>
</view>
</template> </template>
<script> <script>
import { dt } from '@/apis/interfaces/account.js' import {
export default { dt
data() { } from '@/apis/interfaces/account.js'
return { export default {
score: '0.00', data() {
logs : [], return {
pages: {} score: '0.00',
}; logs: [],
}, page: 1,
onShow() { has_more: true,
this.getDt() };
}, },
methods: { onShow() {
getDt(){ this.getDt()
dt().then(res => { },
this.score = res.score onReachBottom() {
this.logs = res.lists.data if (this.has_more) {
this.page = res.lists.page this.page = this.page + 1;
}).catch(err => { this.getDt()
uni.showToast({ }
title: err.message, },
icon : 'none' onPullDownRefresh() {
}) this.page = 1;
}) this.getDt();
}, },
// 转账 methods: {
onTransfer(name){ getDt() {
this.$Router.push({name}) dt({
} page: this.page
}, }).then(res => {
onNavigationBarButtonTap() { if (this.page == 1) {
this.$Router.push({name: 'AccountRecharge'}) this.logs = [];
} }
} this.score = res.score;
this.logs = this.logs.concat(res.lists.data);
this.has_more = res.lists.page.has_more;
uni.stopPullDownRefresh();
}).catch(err => {
uni.showToast({
title: err.message,
icon: 'none'
})
})
},
// 转账
onTransfer(name) {
this.$Router.push({
name
})
}
},
onNavigationBarButtonTap() {
this.$Router.push({
name: 'AccountRecharge'
})
}
}
</script> </script>
<style lang="scss"> <style lang="scss">
.pages-empty{ .pages-empty {
height: 50vh; height: 50vh;
} }
.content{
background: $window-color; .content {
min-height: 100vh; background: $window-color;
.dt-header{ min-height: 100vh;
display: flex;
justify-content: space-between; .dt-header {
flex-direction: row; display: flex;
background: $main-color; justify-content: space-between;
padding: $padding*3 $padding $padding*2; flex-direction: row;
align-items: center; background: $main-color;
.dt-header-number{ padding: $padding*3 $padding $padding*2;
width: calc(100% - 330rpx); align-items: center;
.title{
color: rgba(255, 255, 255, .9); .dt-header-number {
font-size: 28rpx; width: calc(100% - 330rpx);
@extend .nowrap;
} .title {
.num{ color: rgba(255, 255, 255, .9);
font-weight: bold; font-size: 28rpx;
font-size: 60rpx; @extend .nowrap;
padding-top: 10rpx; }
color: white;
@extend .nowrap; .num {
} font-weight: bold;
} font-size: 60rpx;
.transfer[size="mini"]{ padding-top: 10rpx;
width: 150rpx; color: white;
height: 80rpx; @extend .nowrap;
border-radius: 40rpx; }
line-height: 80rpx; }
background: white;
font-size: 30rpx; .transfer[size="mini"] {
color: $main-color; width: 150rpx;
margin: 0; height: 80rpx;
font-weight: bold; border-radius: 40rpx;
&::after{ line-height: 80rpx;
display: none; background: white;
} font-size: 30rpx;
} color: $main-color;
} margin: 0;
// 账户记录 font-weight: bold;
.logs-title{
padding: 0 $padding; &::after {
font-weight: bold; display: none;
line-height: 90rpx; }
color: #333; }
font-size: 30rpx; }
}
.logs-item{ // 账户记录
position: relative; .logs-title {
background: white; padding: 0 $padding;
border-radius: $radius; font-weight: bold;
padding: $padding - 10 $padding; line-height: 90rpx;
padding-right: 240rpx; color: #333;
box-sizing: border-box; font-size: 30rpx;
margin: 0 $margin ($margin - 10); }
.logs-item-title{
font-weight: bold; .logs-item {
font-size: 30rpx; position: relative;
line-height: 50rpx; background: white;
} border-radius: $radius;
.logs-item-time{ padding: $padding - 10 $padding;
font-size: 28rpx; padding-right: 240rpx;
line-height: 40rpx; box-sizing: border-box;
color: gray; margin: 0 $margin ($margin - 10);
}
.logs-item-price{ .logs-item-title {
position: absolute; font-weight: bold;
right: $padding; font-size: 30rpx;
top: $padding - 10; line-height: 50rpx;
line-height: 90rpx; }
width: 180rpx;
text-align: right; .logs-item-time {
font-weight: bold; font-size: 28rpx;
@extend .nowrap; line-height: 40rpx;
&.add{ color: gray;
color: $main-color; }
}
&.remove{ .logs-item-price {
color: $text-price; position: absolute;
} right: $padding;
} top: $padding - 10;
} line-height: 90rpx;
} width: 180rpx;
text-align: right;
font-weight: bold;
@extend .nowrap;
&.add {
color: $main-color;
}
&.remove {
color: $text-price;
}
}
}
}
</style> </style>

View File

@@ -159,6 +159,7 @@
getInfo() { getInfo() {
if (this.$store.state.token === '') return; if (this.$store.state.token === '') return;
info().then(res => { info().then(res => {
console.log(res);
uni.setNavigationBarTitle({ uni.setNavigationBarTitle({
title: res.nickname title: res.nickname
}); });

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long