mall-uniapp/pages/users/user_spread_money/index.vue

215 lines
5.8 KiB
Vue
Raw Normal View History

2020-08-13 08:12:57 +00:00
<template>
<view>
<view class='commission-details'>
<view class='promoterHeader bg-color'>
<view class='headerCon acea-row row-between-wrapper'>
<view>
<view class='name'>{{name}}</view>
2023-09-22 10:35:41 +00:00
<view class='money' v-if="type === 1"><text class='num'>{{ fen2yuan(spreadInfo.withdrawPrice, 0) }}</text></view>
2023-09-04 13:00:33 +00:00
<view class='money' v-else><text class='num'>{{ fen2yuan(spreadInfo.brokeragePrice, 0) }}</text></view>
2020-08-13 08:12:57 +00:00
</view>
<view class='iconfont icon-jinbi1'></view>
</view>
</view>
2023-09-04 13:00:33 +00:00
<!-- 情况一提现列表 -->
<view class='sign-record' v-if="type === 1">
<block v-for="(item,index) in recordList" :key="index" v-if="recordList.length > 0">
<view class='list'>
<view class='item'>
<view class='listn borRadius14'>
2023-09-04 13:00:33 +00:00
<block :key="index">
<view class='itemn acea-row row-between-wrapper'>
<view>
2023-09-04 13:00:33 +00:00
<view class='name line1'>{{ item.statusName }}</view>
<view>{{ formatDate(item.createTime) }}</view>
</view>
2023-09-04 13:00:33 +00:00
<view class='num font-color'>+{{ fen2yuan(item.price) }}</view>
</view>
</block>
</view>
</view>
</view>
</block>
2023-09-04 13:00:33 +00:00
<view v-if="recordList.length === 0">
<emptyPage title='暂无提现记录~'></emptyPage>
</view>
</view>
2023-09-04 13:00:33 +00:00
<!-- 情况二佣金列表 -->
<view class='sign-record' v-else>
<block v-for="(item,index) in recordList" :key="index" v-if="recordList.length > 0">
<view class='list'>
2020-08-13 08:12:57 +00:00
<view class='item'>
<view class='listn borRadius14'>
2023-09-04 13:00:33 +00:00
<block :key="index">
2020-08-13 08:12:57 +00:00
<view class='itemn acea-row row-between-wrapper'>
<view>
2023-09-04 13:00:33 +00:00
<view class='name line1'>{{ item.title }}</view>
<view>{{ formatDate(item.createTime) }}</view>
2020-08-13 08:12:57 +00:00
</view>
2023-09-04 13:00:33 +00:00
<view class='num font-color' v-if="item.price > 0">+{{item.price}}
</view>
2023-09-04 13:00:33 +00:00
<view class='num' v-else>{{item.price}}</view>
2020-08-13 08:12:57 +00:00
</view>
</block>
</view>
</view>
</view>
</block>
2023-09-04 13:00:33 +00:00
<view v-if="recordList.length === 0">
<emptyPage title='暂无佣金记录~'></emptyPage>
2020-08-13 08:12:57 +00:00
</view>
</view>
</view>
<home></home>
</view>
</template>
<script>
2023-09-04 13:00:33 +00:00
import { toLogin } from '@/libs/login.js';
import { mapGetters } from "vuex";
2020-08-13 08:12:57 +00:00
import emptyPage from '@/components/emptyPage.vue'
import home from '@/components/home';
2023-09-05 13:36:10 +00:00
import * as BrokerageAPI from '@/api/trade/brokerage.js'
2023-09-04 13:00:33 +00:00
import * as Util from '@/utils/util.js';
import dayjs from "@/plugin/dayjs/dayjs.min.js";
export default {
2020-08-13 08:12:57 +00:00
components: {
emptyPage,
home
},
data() {
return {
2023-09-04 13:00:33 +00:00
name: '', // 标题
type: 0, // 类型1 - 提现2 - 佣金
page: 1,
2023-09-22 10:35:41 +00:00
limit: 15,
2020-08-13 08:12:57 +00:00
recordList: [],
2023-09-04 13:00:33 +00:00
statuss: false, // 是否到达底部
spreadInfo: {},
};
2020-08-13 08:12:57 +00:00
},
computed: mapGetters(['isLogin']),
onLoad(options) {
2023-09-04 13:00:33 +00:00
if (!this.isLogin) {
toLogin();
return;
}
this.type = parseInt(options.type);
2020-08-13 08:12:57 +00:00
},
onShow: function() {
2023-09-04 13:00:33 +00:00
this.getSpreadInfo();
// 获得列表
2020-08-13 08:12:57 +00:00
let type = this.type;
2023-09-04 13:00:33 +00:00
if (type === 1) {
2020-08-13 08:12:57 +00:00
uni.setNavigationBarTitle({
title: "提现记录"
});
this.name = '提现总额';
this.getList();
2023-09-04 13:00:33 +00:00
} else if (type === 2) {
2020-08-13 08:12:57 +00:00
uni.setNavigationBarTitle({
title: "佣金记录"
});
this.name = '佣金明细';
this.getRecordList();
} else {
uni.showToast({
title: '参数错误',
icon: 'none',
duration: 1000,
mask: true,
success: function(res) {
setTimeout(function() {
// #ifndef H5
uni.navigateBack({
delta: 1,
});
// #endif
// #ifdef H5
history.back();
// #endif
}, 1200)
},
});
}
},
methods: {
2023-09-04 13:00:33 +00:00
/**
* 获得提现列表
*/
getList: function() {
2023-09-04 13:00:33 +00:00
if (this.statuss) {
return;
}
const recordList = this.recordList;
let recordListNew = [];
BrokerageAPI.getBrokerageWithdrawPage({
pageNo: this.page,
pageSize: this.limit
}).then(res => {
2023-09-04 13:00:33 +00:00
const len = res.data.list ? res.data.list.length : 0;
const recordListData = res.data.list || [];
recordListNew = recordList.concat(recordListData);
2023-09-04 13:00:33 +00:00
this.statuss = this.limit > len;
this.page = this.page + 1;
this.$set(this, 'recordList', recordListNew);
});
},
2023-09-04 13:00:33 +00:00
/**
* 获得佣金列表
*/
2020-08-13 08:12:57 +00:00
getRecordList: function() {
2023-09-04 13:00:33 +00:00
if (this.statuss) {
return;
}
let page = this.page;
let limit = this.limit;
let recordList = this.recordList;
let recordListNew = [];
BrokerageAPI.getBrokerageRecordPage({
pageNo: this.page,
pageSize: this.limit
2021-02-06 09:25:18 +00:00
}).then(res => {
2023-09-04 13:00:33 +00:00
if (!res.data.list) {
return;
}
2023-09-04 13:00:33 +00:00
const len = res.data.list ? res.data.list.length : 0;
const recordListData = res.data.list || [];
recordListNew = recordList.concat(recordListData);
this.statuss = limit > len;
this.page = page + 1;
this.$set(this, 'recordList', recordListNew);
2020-08-13 08:12:57 +00:00
});
2023-09-04 13:00:33 +00:00
},
/**
* 获取个人用户信息
*/
getSpreadInfo: function() {
BrokerageAPI.getBrokerageUserSummary().then(res => {
this.$set(this,'spreadInfo',res.data);
});
},
fen2yuan(price) {
return Util.fen2yuan(price)
},
formatDate: function(date) {
return dayjs(date).format("YYYY-MM-DD HH:mm:ss");
},
2020-08-13 08:12:57 +00:00
},
onReachBottom: function() {
this.getRecordList();
}
}
</script>
<style scoped lang="scss">
.commission-details .promoterHeader .headerCon .money {
font-size: 36rpx;
}
.commission-details .promoterHeader .headerCon .money .num {
font-family: 'Guildford Pro';
}
</style>