同步数据

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

@@ -251,12 +251,14 @@
} }
}, { }, {
"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> </template>
</view>
</block> <script>
</view> import {
</template> dt
} from '@/apis/interfaces/account.js'
<script> export default {
import { dt } from '@/apis/interfaces/account.js' data() {
export default { return {
data() { score: '0.00',
return { logs: [],
score: '0.00', page: 1,
logs : [], has_more: true,
pages: {} };
}; },
}, onShow() {
onShow() { this.getDt()
this.getDt() },
}, onReachBottom() {
methods: { if (this.has_more) {
getDt(){ this.page = this.page + 1;
dt().then(res => { this.getDt()
this.score = res.score }
this.logs = res.lists.data },
this.page = res.lists.page onPullDownRefresh() {
}).catch(err => { this.page = 1;
uni.showToast({ this.getDt();
title: err.message, },
icon : 'none' methods: {
}) getDt() {
}) dt({
}, page: this.page
// 转账 }).then(res => {
onTransfer(name){ if (this.page == 1) {
this.$Router.push({name}) this.logs = [];
} }
}, this.score = res.score;
onNavigationBarButtonTap() { this.logs = this.logs.concat(res.lists.data);
this.$Router.push({name: 'AccountRecharge'}) this.has_more = res.lists.page.has_more;
} uni.stopPullDownRefresh();
} }).catch(err => {
</script> uni.showToast({
title: err.message,
<style lang="scss"> icon: 'none'
.pages-empty{ })
height: 50vh; })
} },
.content{ // 转账
background: $window-color; onTransfer(name) {
min-height: 100vh; this.$Router.push({
.dt-header{ name
display: flex; })
justify-content: space-between; }
flex-direction: row; },
background: $main-color; onNavigationBarButtonTap() {
padding: $padding*3 $padding $padding*2; this.$Router.push({
align-items: center; name: 'AccountRecharge'
.dt-header-number{ })
width: calc(100% - 330rpx); }
.title{ }
color: rgba(255, 255, 255, .9); </script>
font-size: 28rpx;
@extend .nowrap; <style lang="scss">
} .pages-empty {
.num{ height: 50vh;
font-weight: bold; }
font-size: 60rpx;
padding-top: 10rpx; .content {
color: white; background: $window-color;
@extend .nowrap; min-height: 100vh;
}
} .dt-header {
.transfer[size="mini"]{ display: flex;
width: 150rpx; justify-content: space-between;
height: 80rpx; flex-direction: row;
border-radius: 40rpx; background: $main-color;
line-height: 80rpx; padding: $padding*3 $padding $padding*2;
background: white; align-items: center;
font-size: 30rpx;
color: $main-color; .dt-header-number {
margin: 0; width: calc(100% - 330rpx);
font-weight: bold;
&::after{ .title {
display: none; color: rgba(255, 255, 255, .9);
} font-size: 28rpx;
} @extend .nowrap;
} }
// 账户记录
.logs-title{ .num {
padding: 0 $padding; font-weight: bold;
font-weight: bold; font-size: 60rpx;
line-height: 90rpx; padding-top: 10rpx;
color: #333; color: white;
font-size: 30rpx; @extend .nowrap;
} }
.logs-item{ }
position: relative;
background: white; .transfer[size="mini"] {
border-radius: $radius; width: 150rpx;
padding: $padding - 10 $padding; height: 80rpx;
padding-right: 240rpx; border-radius: 40rpx;
box-sizing: border-box; line-height: 80rpx;
margin: 0 $margin ($margin - 10); background: white;
.logs-item-title{ font-size: 30rpx;
font-weight: bold; color: $main-color;
font-size: 30rpx; margin: 0;
line-height: 50rpx; font-weight: bold;
}
.logs-item-time{ &::after {
font-size: 28rpx; display: none;
line-height: 40rpx; }
color: gray; }
} }
.logs-item-price{
position: absolute; // 账户记录
right: $padding; .logs-title {
top: $padding - 10; padding: 0 $padding;
line-height: 90rpx; font-weight: bold;
width: 180rpx; line-height: 90rpx;
text-align: right; color: #333;
font-weight: bold; font-size: 30rpx;
@extend .nowrap; }
&.add{
color: $main-color; .logs-item {
} position: relative;
&.remove{ background: white;
color: $text-price; border-radius: $radius;
} padding: $padding - 10 $padding;
} padding-right: 240rpx;
} box-sizing: border-box;
} margin: 0 $margin ($margin - 10);
.logs-item-title {
font-weight: bold;
font-size: 30rpx;
line-height: 50rpx;
}
.logs-item-time {
font-size: 28rpx;
line-height: 40rpx;
color: gray;
}
.logs-item-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