OfficeApp/subpkg/blockTransaction/blockTransaction.vue

314 lines
8.0 KiB
Vue
Raw Normal View History

2023-08-05 11:11:27 +08:00
<template>
<view class="">
<view class="card">
<view class="item">
2023-08-30 11:19:26 +08:00
<view>当日完成金额</view>
2023-08-05 11:11:27 +08:00
<!-- <view class="price" v-if="company.deposit">{{cCount(company.deposit)}}</view>
<view class="price" v-else>0.00</view> -->
2023-08-26 18:41:06 +08:00
<view class="price">{{c_money(card.total_price)}}</view>
2023-08-05 11:11:27 +08:00
</view>
<view class="item">
2023-08-30 11:19:26 +08:00
<view>目标完成金额</view>
2023-08-05 11:11:27 +08:00
<!-- <view class="price" v-if="company.company_money">{{cCount(company.company_money)}}</view>
<view class="price" v-else>0.00</view> -->
2023-08-26 18:41:06 +08:00
<view class="price">{{c_money(card.day_money)}}</view>
2023-08-05 11:11:27 +08:00
</view>
2023-08-30 11:19:26 +08:00
<view class="item">
<view>交易金额剩余池</view>
<view class="price">{{c_money(card.transaction_pool)}}</view>
</view>
2023-08-05 11:11:27 +08:00
</view>
2023-08-22 16:02:32 +08:00
<!-- <view class="nav">
2023-08-05 11:11:27 +08:00
<view class="title">账单流水</view>
<view class="right">
2023-08-22 16:02:32 +08:00
<view class="btn" :class="current==0?'active':''" @click="current=0;initLoad()">日账单</view>
<view class="btn" :class="current==1?'active':''" @click="current=1;initLoad()">月账单</view>
2023-08-10 14:13:35 +08:00
<view class="btn" @click="navTo('/subpkg/companyFinance/companyFinance')">历史账单</view>
2023-08-05 11:11:27 +08:00
</view>
2023-08-22 16:02:32 +08:00
</view> -->
2023-08-05 11:11:27 +08:00
<view class="list">
2023-08-22 16:02:32 +08:00
<!-- <view class="item" v-for="(item, index) in 10" :key="index">
2023-08-05 11:11:27 +08:00
<view class="top">
交易时间2023-06-16 18:07:59
</view>
<view class="bottom">
<view class="text">
<view class="t_item">
<view>购买用户</view>
<view class="tips">**</view>
</view>
<view class="t_item">
<view>交易商户</view>
<view class="tips">通滩镇日杂百货里海云仓</view>
</view>
<view class="t_item">
<view>交易金额</view>
<view class="tips">40.00()</view>
</view>
</view>
</view>
2023-08-22 16:02:32 +08:00
</view> -->
<view class="item" v-for="(item, index) in list" :key="item.id">
<view class="top">
账单日期{{item.create_time}}
</view>
<view class="t_bottom">
<view class="order">订单编号{{item.order_sn}}</view>
<view class="price">交易额: {{item.total_price}}</view>
</view>
2023-08-05 11:11:27 +08:00
</view>
2023-08-22 16:02:32 +08:00
<u-loadmore :status="loadConfig.status" :loading-text="loadConfig.loadingText"
:loadmore-text="loadConfig.loadmoreText" :nomore-text="loadConfig.nomoreText" />
2023-08-05 11:11:27 +08:00
</view>
</view>
</template>
<script>
import { Toast } from '../../libs/uniApi'
2023-08-22 16:02:32 +08:00
import { taskOrderDetail } from "@/api/task.js"
2023-08-05 11:11:27 +08:00
export default {
data() {
return {
2023-08-22 16:02:32 +08:00
card: {
total_price: "0.00",
2023-08-22 16:02:32 +08:00
status: 1,
2023-08-30 11:19:26 +08:00
day_money: "0.00",
transaction_pool: "0.00"
2023-08-22 16:02:32 +08:00
},
list: [],
task_id: '',
loadConfig: {
2023-08-05 11:11:27 +08:00
page: 1,
limit: 15,
lastpage: '',
loadingText: '努力加载中',
loadmoreText: '轻轻上拉',
nomoreText: '我也是有底线的~~',
status: 'loadmore'
},
}
},
2023-08-22 16:02:32 +08:00
onLoad(options) {
options.task_id ? this.task_id = options.task_id : null;
this.initLoad();
},
2023-08-05 11:11:27 +08:00
onShow() {},
2023-08-22 16:02:32 +08:00
onReachBottom() {
this.loadList();
},
2023-08-05 11:11:27 +08:00
methods: {
2023-08-10 14:13:35 +08:00
navTo(url) {
2023-08-05 11:11:27 +08:00
url ?
uni.navigateTo({
url: url,
}) : Toast('暂未开放')
},
2023-08-22 16:02:32 +08:00
async initLoad() {
this.loadConfig.page = 1;
this.loadConfig.status = "loadmore";
this.list = [];
await this.loadList();
},
async loadList() {
try {
let that = this;
if (this.loadConfig.status == "nomore") return;
this.loadConfig.status = "loading"
let res = await taskOrderDetail({
page: this.loadConfig.page,
limit: this.loadConfig.limit,
id: this.task_id,
// company_id: this.$store.state.app.userInfo.company_id
})
2023-08-26 18:41:06 +08:00
this.loadConfig.status = "loadmore";
if (res.data?.list?.length == 0 || res.data?.list?.length < 25) {
2023-08-22 16:02:32 +08:00
this.loadConfig.status = "nomore"
} else {
this.loadConfig.page++;
}
let extend = res.data?.extend;
2023-08-22 16:02:32 +08:00
Object.keys(this.card).forEach((key)=>{
if(extend?.transaction?.arr[key]!=null&&extend?.transaction?.arr[key]!=undefined)this.card[key] = extend?.transaction?.arr[key];
2023-08-22 16:02:32 +08:00
})
2023-09-11 14:03:39 +08:00
// this.card.transaction_pool = extend?.transaction.transaction_pool;
2023-08-22 16:02:32 +08:00
this.list = [...this.list, ...res.data?.list]
} catch (e) {
this.loadConfig.status = "nomore"
}
},
2023-08-26 18:41:06 +08:00
c_money(str){
try{
if(!isNaN(str)){
typeof str != 'string' ? str = str.toFixed(2) : str = parseFloat(str).toFixed(2);
}else str = '0.00'
}catch(e){
str = '0.00'
}
2023-08-30 11:19:26 +08:00
return '¥'+str;
2023-08-26 18:41:06 +08:00
}
2023-08-05 11:11:27 +08:00
},
onPullDownRefresh() {
2023-08-22 16:02:32 +08:00
this.initLoad().then(()=>{
uni.stopPullDownRefresh()
})
2023-08-05 11:11:27 +08:00
}
}
</script>
<style lang="scss">
.card {
margin: 28rpx auto;
width: 694rpx;
height: 158rpx;
2023-08-22 16:02:32 +08:00
background: #0122c7;
2023-08-05 11:11:27 +08:00
border-radius: 18rpx 18rpx 18rpx 18rpx;
opacity: 1;
2023-08-30 11:19:26 +08:00
padding: 28rpx 12rpx;
2023-08-05 11:11:27 +08:00
display: flex;
justify-content: space-around;
color: #fff;
text-align: center;
.item {
display: flex;
flex-direction: column;
justify-content: space-between;
font-size: 28rpx;
flex: 1;
2023-08-30 11:19:26 +08:00
border-right: 1px solid #fff;
2023-08-05 11:11:27 +08:00
2023-08-30 11:19:26 +08:00
&:last-child {
border-right: none;
2023-08-05 11:11:27 +08:00
}
.price {
2023-08-30 11:19:26 +08:00
font-size: 42rpx;
2023-08-05 11:11:27 +08:00
font-weight: 500;
}
}
}
.nav {
margin: 28rpx;
display: flex;
justify-content: space-between;
align-items: flex-end;
.title {
font-size: 32rpx;
font-weight: 500;
color: #333333;
display: flex;
align-items: center;
&:before {
content: "";
width: 6rpx;
height: 26rpx;
border-radius: 10rpx;
margin-right: 10rpx;
display: inline-block;
2023-08-22 16:02:32 +08:00
background-color: #0122c7;
2023-08-05 11:11:27 +08:00
}
}
.right {
display: flex;
.btn {
margin-left: 28rpx;
}
.active {
2023-08-22 16:02:32 +08:00
color: #0122c7;
2023-08-05 11:11:27 +08:00
}
}
}
2023-08-22 16:02:32 +08:00
2023-08-05 11:11:27 +08:00
.list {
.item {
margin: 0 auto;
margin-bottom: 28rpx;
width: 694rpx;
// height: 238rpx;
background: #FFFFFF;
border-radius: 14rpx 14rpx 14rpx 14rpx;
opacity: 1;
padding: 28rpx;
2023-08-22 16:02:32 +08:00
2023-08-05 11:11:27 +08:00
.top {
margin-bottom: 28rpx;
font-size: 25rpx;
font-family: PingFang SC-Regular, PingFang SC;
font-weight: 400;
color: #333333;
2023-08-22 16:02:32 +08:00
2023-08-05 11:11:27 +08:00
&:before {
display: inline-block;
2023-08-22 16:02:32 +08:00
content: '交易明细';
2023-08-05 11:11:27 +08:00
width: 137rpx;
height: 49rpx;
line-height: 49rpx;
text-align: center;
2023-08-22 16:02:32 +08:00
background: #FF7C32;
2023-08-05 11:11:27 +08:00
border-radius: 26rpx 26rpx 26rpx 26rpx;
color: #fff;
margin-right: 28rpx;
}
}
2023-08-22 16:02:32 +08:00
2023-08-05 11:11:27 +08:00
.bottom {
display: flex;
justify-content: space-between;
2023-08-22 16:02:32 +08:00
2023-08-05 11:11:27 +08:00
.text {
font-size: 25rpx;
font-weight: 400;
color: #999999;
line-height: 39rpx;
2023-08-22 16:02:32 +08:00
.t_item {
2023-08-05 11:11:27 +08:00
display: flex;
2023-08-22 16:02:32 +08:00
&:nth-child(1) {
2023-08-05 11:11:27 +08:00
margin-bottom: 16rpx;
}
2023-08-22 16:02:32 +08:00
.tips {
2023-08-05 11:11:27 +08:00
font-size: 28rpx;
font-weight: 400;
color: #333333;
}
}
}
2023-08-22 16:02:32 +08:00
.price {
2023-08-05 11:11:27 +08:00
display: flex;
align-items: center;
font-size: 32rpx;
font-weight: 500;
color: #F02828;
}
}
2023-08-22 16:02:32 +08:00
.t_bottom {
font-size: 25rpx;
font-family: PingFang SC-Regular, PingFang SC;
font-weight: 400;
color: #333333;
display: flex;
justify-content: space-between;
flex-wrap: wrap;
.price {
color: #FF7C32;
flex-shrink: 0;
}
}
2023-08-05 11:11:27 +08:00
}
}
</style>