123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436 |
- <template>
- <view class="content">
- <view class="user-top">
- <view class="select-time">
- <picker mode="date" @change="bindDateChange" fields="month">
- <view class="uni-input">{{showdate}}</view>
- </picker>
- <image src="../../static/img/downjian.png" mode="widthFix"></image>
- </view>
- <view class="top-val">
- {{yg_detail.reward || '0'}}
- </view>
- <view class="top-tit">
- 当前提成
- </view>
- <view class="top-btn">
- <view class="left" @click="goPage('/pagesS/yg/txxq')">
- 提现记录
- </view>
- <view class="center">
-
- </view>
- <view class="right" @click="goPage('/pagesS/yg/gztq?id=' + id)">
- 提成提现
- </view>
- </view>
- </view>
-
- <view class="sz-wrap">
- <view class="sz-item">
- <view class="sz-tit">
- 累计收入
- </view>
- <view class="sz-val">
- {{sr|| '0'}}
- </view>
- </view>
- <view class="jg">
- </view>
- <view class="sz-item">
- <view class="sz-tit">
- 累计支出
- </view>
- <view class="sz-val">
- {{zc || '0'}}
- </view>
- </view>
- </view>
- <view class="navbar">
- <view v-for="(item, index) in navlist" :key="index" class="nav-item"
- :class="{ current: tabCurrentIndex === index }" @click="tabClick(index)">{{ item.title }}</view>
- </view>
- <swiper :current="tabCurrentIndex" :style="{ height: height }" class="swiper-box" duration="300" disable-touch>
- <swiper-item class="tab-content" v-for="(tabItem, tabIndex) in navlist" :key="tabIndex">
- <scroll-view scroll-y="true" class="list-scroll-content" @scrolltolower="loadData"
- :style="{ height: height }">
- <!-- 空白页 -->
- <u-empty text="暂无数据" mode="list" v-if="tabItem.loaded && tabItem.list.length == 0"></u-empty>
- <!-- 订单列表 -->
- <view class="order-item" v-for="(item, index) in tabItem.list" :key="index">
- <view class="title-box">
- <view class="title">
- <!-- <text>{{ item.mark }}</text> -->
- {{item.title}}
- </view>
- <view class="time">
- <!-- <text>{{ item.create_time }}</text> -->
- {{$utils.formatDate(item.createTime)}}
- </view>
- </view>
- <view class="money">
- <!-- <view>{{ (item.pm == 0 ? '-' : '+') + item.number }}</view> -->
- {{tabCurrentIndex == 0? '+': '-'}}{{item.amount || '0'}}
- </view>
- </view>
- <u-loadmore :status="tabItem.loadingType" v-if="tabItem.loaded && tabItem.list.length > 0"/>
- </scroll-view>
- </swiper-item>
- </swiper>
- </view>
- </template>
- <script>
- export default {
- data() {
- return {
- showdate: '',
- tabCurrentIndex: 0,
- height: '',
- id: '',
- navlist: [{
- status: 5,
- title: '收入',
- list: [],
- page: 1,
- pageSize: 10,
- loaded: false,
- loadingType: 'loadmore'
- },
- {
- status: 4,
- title: '扣除',
- list: [],
- page: 1,
- pageSize: 10,
- loaded: false,
- loadingType: 'loadmore'
- }
- ],
- star: '',
- end: '',
- sr: '',
- zc: '',
- yg_detail: {}
- }
- },
- onLoad(opt) {
- if (opt.id) {
- this.id = opt.id
- }else {
- this.id = this.$store.state.userInfo.staffId
- }
-
- },
- onShow() {
- this.getTime()
- this.getYgdetail()
- },
- onReachBottom() {
- },
- onReady() {
- var _this = this;
- uni.getSystemInfo({
- success: resu => {
- const query = uni.createSelectorQuery();
- query.select('.swiper-box').boundingClientRect();
- query.exec(function(res) {
- _this.height = resu.windowHeight - res[0].top + 'px';
- console.log('打印页面的剩余高度', _this.height);
- });
- },
- fail: res => {}
- });
- },
- methods: {
- //顶部tab点击
- tabClick(index) {
- this.tabCurrentIndex = index;
- this.loadData('tab')
- },
- // 选择年月
- bindDateChange(e) {
- let time = e.detail.value.split('-')
- this.showdate = time[0] + '年' + time[1] + '月'
- this.star = this.getFirstDayOfMonth(time[0],time[1])
- this.end = this.getLastDayOfMonth(time[0],time[1])
- this.loadData('reload')
- },
- // 获取当前年月
- getTime() {
- let date = new Date()
- this.showdate = date.getFullYear() + '年' + (date.getMonth() + 1) + '月'
- // console.log(this.getFirstDayOfMonth(date.getFullYear(),date.getMonth() + 1),'开始时间')
- // console.log(this.getLastDayOfMonth(date.getFullYear(),date.getMonth() + 1))
- this.star = this.getFirstDayOfMonth(date.getFullYear(),date.getMonth() + 1)
- this.end = this.getLastDayOfMonth(date.getFullYear(),date.getMonth() + 1)
- this.loadData('reload')
- },
- // 获取数据
- loadData(type) {
- let that = this
- let index = that.tabCurrentIndex
- let item = that.navlist[index]
- if (type == 'reload' || type == 'tab') {
- item.loaded = false
- item.loadingType = 'loadmore'
- item.page = 1
- item.list = []
- }
- if (item.loadingType == 'loading' || item.loadingType == 'nomore') {
- return
- }
- item.loadingType = 'loading'
- that.$u.api.getYgTc({
- staffId: that.id,
- type: item.status,
- page: item.page,
- pageSize: item.pageSize,
- star: that.star,
- end: that.end //搜索结束时间
- }).then(res => {
- item.list = item.list.concat(res.data)
- item.page++
- that.sr = res.sr
- that.zc = res.zc
- if (item.pageSize == res.data.length) {
- item.loadingType = 'loadmore'
- } else {
- item.loadingType = 'nomore'
- }
- item.loaded = true
- })
- },
- getFirstDayOfMonth(year, month) {
- // return new Date(year, month-1, 1);
- let data = new Date(year, month - 1, 1);
- return data.getTime()/1000
- // return (
- // data.getFullYear() +
- // "-" +
- // (data.getMonth() + 1 > 9 ?
- // data.getMonth() + 1 :
- // "0" + (data.getMonth() + 1)) +
- // "-" +
- // (data.getDate() > 9 ? data.getDate() : "0" + data.getDate())
- // );
- },
- //结束日期
- getLastDayOfMonth(year, month) {
- let data = new Date(year, month, 0);
- console.log('结束',data.getTime())
- return data.getTime()/1000
- // return (
- // data.getFullYear() +
- // "-" +
- // (data.getMonth() + 1 > 9 ?
- // data.getMonth() + 1 :
- // "0" + (data.getMonth() + 1)) +
- // "-" +
- // (data.getDate() > 9 ? data.getDate() : "0" + data.getDate())
- // );
- },
- getYgdetail() {
- this.$u.api.getYgdetail({
- request_id: this.id
- }).then(({data})=> {
- this.yg_detail = data
- uni.setNavigationBarTitle({
- title: this.yg_detail.staffName + '的提成'
- })
- })
- }
- }
- }
- </script>
- <style lang="scss">
- .user-top {
- width: 100%;
- height: 400rpx;
- background-color: #4075d6;
- display: flex;
- flex-direction: column;
- justify-content: center;
- align-items: center;
- padding-bottom: 60rpx;
- // position: relative;
- .top-tit {
- font-size: 30rpx;
- font-weight: bold;
- color: #FFFFFF;
- }
- .top-val {
- font-size: 72rpx;
- font-weight: 500;
- color: #FFFFFF;
- }
- .select-time {
- position: absolute;
- top: 30rpx;
- right: 30rpx;
- font-size: 26rpx;
- font-weight: 500;
- color: #fff;
- display: flex;
- align-items: center;
- image {
- width: 17rpx;
- margin-left: 10rpx;
- }
- }
- }
- .sz-wrap {
- width: 670rpx;
- height: 186rpx;
- background: #FFFFFF;
- box-shadow: 0px 0px 20rpx 0px rgba(50, 50, 52, 0.06);
- border-radius: 20rpx;
- margin: -90rpx auto 20rpx;
- display: flex;
- justify-content: center;
- align-items: center;
- .jg {
- width: 2rpx;
- height: 74rpx;
- background: #DCDFE6;
- }
- .sz-item {
- width: 330rpx;
- height: 100%;
- display: flex;
- flex-direction: column;
- align-items: center;
- justify-content: center;
- font-size: 30rpx;
- font-weight: bold;
- .sz-tit {
- color: #999999;
- }
- .sz-val {
- margin-top: 30rpx;
- color: #181818;
- }
- }
- }
- .navbar {
- margin-top: 20rpx;
- display: flex;
- height: 88rpx;
- padding: 0 5px;
- background: #fff;
- box-shadow: 0 1px 5px rgba(0, 0, 0, 0.06);
- position: relative;
- z-index: 10;
- .nav-item {
- flex: 1;
- display: flex;
- justify-content: center;
- align-items: center;
- height: 100%;
- font-size: 15px;
- color: #999999;
- position: relative;
- &.current {
- color: #000;
- &:after {
- content: '';
- position: absolute;
- left: 50%;
- bottom: 0;
- transform: translateX(-50%);
- width: 44px;
- height: 0;
- border-bottom: 2px solid #fe5b38;
- }
- }
- }
- }
- //列表
- .swiper-box {
- .order-item:last-child {
- margin-bottom: 60rpx;
- }
- .order-item {
- width: 100%;
- // background-color: red;
- padding: 20rpx 30rpx;
- line-height: 1.5;
- display: flex;
- align-items: center;
- .title-box {
- flex-grow: 1;
- padding-right: 50rpx;
- .title {
- font-size: 30rpx;
- color: #333333;
- }
- .time {
- font-size: 26rpx;
- color: #AEAEAE;
- }
- }
- .money {
- color: #fd5b23;
- font-size: 26rpx;
- text-align: right;
- .status {
- color: #AEAEAE;
- }
- }
- }
- }
- .list-scroll-content {
- background: #ffffff;
- height: 100%;
- }
- .top-btn {
- margin-top: 20rpx;
- width: 100%;
- display: flex;
- justify-content: space-between;
- padding: 0 50rpx;
- font-size: 30rpx;
- font-weight: bold;
- color: #FFFFFF;
- .right {
- text-align: right;
- }
- .left {
- text-align: left;
- }
- .center {
- text-align: center;
- }
- view {
- width: 33.3%;
- }
- }
- </style>
|