sadjv3_jishi/my/commission/index.vue

655 lines
19 KiB
Vue

<template>
<view>
<view class="ciycle">
<view id="IntegralStatisticsTop" ref="IntegralStatisticsTop">
<view class="innerTop">
<view class="innerTopLeft">
<view v-for="item in rangeSelect" :key="item.id"
:class="activeRange == item.id ? 'activeTab' : 'defaultTab'" @click="selectedRange(item)">
{{item.title}}
</view>
</view>
<view class="innerTopRightImport">
<view class="innerTopRight" @tap="showAndHiddenDatePicker">查看更多
</view>
</view>
</view>
<view class="innerBottom" style="height: 140px;">
<view class="innerBottomOfTop">
<view class="innerTimer">
{{this.homePageDataNum.fundRange}}
</view>
</view>
<view class="middleTop">
<view class="IntegralImport">
<view class="IntegralClassifyta">
<view class="middele-icon-back"><image class="middele-img"src="../../static/purse.png" mode=""></image></view>
<view class="middele-title">
<view class="middele-color">{{this.homePageDataNum.totalRevenue ? this.homePageDataNum.totalRevenue : 0 }}</view>
<view class="IntegralClassifyInnerBottom" style="color: #FF6000;">
本期收益(元)
</view>
</view>
</view>
</view>
<view class="innerBottomOfBottom">
<view class="IntegralClassify">
<view class="middele-wold">
{{this.homePageDataNum.projectBenefits ? this.homePageDataNum.projectBenefits : 0 }}
</view>
<view class="IntegralClassifyInnerBottom">
项目收益
</view>
</view>
<view class="IntegralClassify">
<view class="middele-wold">
{{this.homePageDataNum.vehicleFareAmount ? this.homePageDataNum.vehicleFareAmount : 0 }}
</view>
<view class="IntegralClassifyInnerBottom">
车费收益
</view>
</view>
<!-- <view class="IntegralClassify">
<view class="">
{{this.homePageDataNum.valueStorageDeduction ? this.homePageDataNum.valueStorageDeduction : 0 }}
</view>
<view class="IntegralClassifyInnerBottom">
储值扣款
</view>
</view>
<view class="IntegralClassify">
<view class="">
{{this.homePageDataNum.channelDeduction ? this.homePageDataNum.channelDeduction : 0 }}
</view>
<view class="IntegralClassifyInnerBottom">
渠道扣款
</view>
</view> -->
</view>
</view>
</view>
<uni-datetime-picker type="date" ref="dataPicker" :clear-icon="true" return-type="string"
@change="confirmSelectedDate" v-model="selectedDate" @maskClick="maskClick" />
</view>
<view id="IntegralStatisticsBottom" :style="{height:domNeedHeight == 0? 420 + 'px' : domNeedHeight + 'px',top:0}">
<!-- <view class="optionsDetail">
<cc-nodata title="暂无数据" v-if="noDataScrollStatus"
:style="{width:100+'%',height:domNeedHeight == 0? 420 + 'px' : domNeedHeight + 'px'}"></cc-nodata>
<view v-if="!noDataScrollStatus" class="mian-view" v-for="(item,index) in commissionDetail" :key="index" @click="goOder(item)">
<view class="mian-head">
<view class="mian-head-biao">{{item.status=='3'?'待评价':'已完成'}}</view>
<view class="mian-head-time">
<span class="shouyi-text">预约时间: </span>
<span>{{item.serveTime}}</span>
</view>
</view>
<view class="mian-foot">
<view class="mian-foot-img">
<image :src="item.massageImg?item.massageImg: '../../../static/logo.png'" mode=""></image>
</view>
<view class="mian-foot-list">
<view class="mian-foot-view">
<view class="mian-title">{{item.entryName}}</view>
<view class="mian-dingwei">
<image src="../../static/index/dangqian2.png" mode=""></image>
<span class="shouyi-text">{{item.km}}km</span>
</view>
</view>
<view class="mian-foot-dan od-number">
订单编号 : {{item.ordersNo}}
</view>
<view class="mian-foot-adder shouyi-text add-text">
服务地址 : {{item.address}}
</view>
<view class="mian-bottom">
<view class="mian-bottom-xiang shouyi-text">
项目金额 :
<span style="color: #FF6000;font-weight: bold;">
¥{{item.priceTotal}}
</span>
</view>
<view class="mian-bottom-shou">
<span class="shouyi-text">本单收益: </span>
<span class="shouyi-text">¥{{item.artificerMoneyTotal}}</span>
</view>
</view>
</view>
</view>
</view>
<uniLoadMore color="#999" :iconType="iconType" :status="loadingStatus" :marginBottom="20"
:marginTop="20" v-if="isShowLoadMore" />
</view> -->
<view class="optionsDetail">
<t-refresh class="mian" ref="refresh" v-if="commissionDetail.length>0" @refresh="refresh" @loadMore="loadMore" :loadingType="loadingType" :tPadding="0" >
<template slot="content" >
<view class="optionsDetailImport" v-for="(item,index) in commissionDetail" :key="index">
<view class="mian-head">
<view class="mian-head-biao">{{item.status=='3'?'待评价':'已完成'}}</view>
<view class="mian-head-time">
<span class="shouyi-text">预约时间: </span>
<span>{{item.serveTime}}</span>
</view>
</view>
<view class="mian-foot">
<view class="mian-foot-img">
<image :src="item.massageImg?item.massageImg: '../../../static/logo.png'" mode=""></image>
</view>
<view class="mian-foot-list">
<view class="mian-foot-view">
<view class="mian-title">{{item.entryName}}</view>
<view class="mian-dingwei">
<image src="../../static/index/dangqian2.png" mode=""></image>
<span class="shouyi-text">{{item.km}}km</span>
</view>
</view>
<view class="mian-foot-dan od-number">
订单编号 : {{item.ordersNo}}
</view>
<view class="mian-foot-adder shouyi-text add-text">
服务地址 : {{item.address}}
</view>
<view class="mian-bottom">
<view class="mian-bottom-xiang shouyi-text">
项目金额 :
<span style="color: #FF6000;font-weight: bold;">
{{item.priceTotal}}
</span>
</view>
<view class="mian-bottom-shou">
<span class="shouyi-text">本单收益: </span>
<span class="shouyi-text">{{item.artificerMoneyTotal}}</span>
</view>
</view>
</view>
</view>
</view>
</template>
</t-refresh>
<empty v-if="commissionDetail.length==0"></empty>
</view>
</view>
</view>
</view>
</template>
<script>
import empty from '@/components/empty.vue'
import tRefresh from "@/components/t-refresh/t-refresh.vue"
import * as websocketUtils from 'utils/websocketUtils.js';
import uniLoadMore from "@/uview-ui/components/u-loadmore/u-loadmore.vue";
import navBar from "@/components/navBar/navBar.vue";
import {
watch
} from "vue";
export default {
components: {
uniLoadMore,
navBar,
},
onUnload() {
this.selectedDate = null;
this.activeRange = null;
this.loadingStatus = null;
this.currentPage = null;
this.commissionDetail = null;
this.intervalDatesUltimately = null;
this.pageSize = null;
this.recordLastTimeRange = null;
this.noDataScrollStatus = null;
this.noDataMenuStatus = null;
this.isIntegralHasData = null;
this.iconType = null;
this.rangeSelect = null;
this.bottomOptionsInfo = null;
},
onLaunch() {},
onShow() {},
onLoad() {
this.selectedDate = this.getCurrentTimeStamp();
this.artificerId = uni.getStorageSync("artificerId");
this.getHomePageNum({
artificerId: this.artificerId,
fundData: this.selectedDate,
fundType: 1,
});
//获取下方积分明细(列表)
this.getCommissionDataList({
artificerId: this.artificerId,
fundData: this.selectedDate,
fundType: 1,
limit: this.pageSize,
page: this.currentPage,
});
},
onReady() {
//自适应改变列表高度
// this.selfAdaptionChangeElemtHeight();
},
//上拉触底
onReachBottom(e) {
this.currentPage += 1;
this.isScroll = true;
if (this.loadingStatus == "nomore") {
return;
} else {
this.getCommissionDataList({
artificerId: this.artificerId,
fundData: this.selectedDate,
fundType: this.activeRange,
limit: this.pageSize,
page: this.currentPage,
}, true);
}
},
//下拉刷新
onPullDownRefresh(e) {
this.commissionDetail = [];
this.currentPage = 1;
this.selectedDate = this.getCurrentTimeStamp();
this.getHomePageNum({
artificerId: this.artificerId,
fundData: this.selectedDate,
fundType: this.activeRange,
});
this.getCommissionDataList({
artificerId: this.artificerId,
fundData: this.selectedDate,
fundType: this.activeRange,
limit: this.pageSize,
page: this.currentPage,
});
},
watch: {
// 监听数据源改变下拉刷新的状态
commissionDetail(newData, oldData) {
if (newData.length >= 1) {
uni.stopPullDownRefresh();
}
},
},
data() {
return {
loadingType:0,
domNeedHeight: 0, //元素的所需高度
selectedDate: this.currentDate,
statusBarHeight: 20,
activeRange: 1,
loadingStatus: "loadmore",
currentPage: 1,
pageSize: 6,
intervalDatesUltimately: null,
recordLastTimeRange: null,
noDataScrollStatus: false,
noDataMenuStatus: false,
isIntegralHasData: null,
iconType: "circle",
title: "分成明细",
isShowLoadMore: null,
backgroundcolor: "linear-gradient(to bottom, #294856, #1a615b)",
artificerld: null,
parentData: {},
homePageDataNum: {
totalRevenue: null,
projectBenefits: null,
vehicleFareAmount: null,
channelDeduction: null,
valueStorageDeduction: null,
fundRange: null,
},
rangeSelect: [{
id: 1,
title: "本期",
}, {
id: 2,
title: "上期",
}, {
id: 3,
title: "本月",
}, {
id: 4,
title: "上月",
}],
commissionDetail: [],
}
},
methods: {
goOder(item){
uni.navigateTo({
url:'/my/order/revenueDetails?ordersId='+item.ordersId
})
},
//自适应改变列表高度
selfAdaptionChangeElemtHeight() {
let _this = this;
try {
uni.getSystemInfo({
success: res => {
if (res && res.windowHeight) {
let query = uni.createSelectorQuery().in(this);
query
.select(".optionsDetail")
.boundingClientRect((data) => {
_this.domNeedHeight = res.windowHeight - data.top - 20;
})
.exec();
}
}
});
} catch (e) {
//TODO handle the exception
}
},
// 加载更多
loadMore: async function() {
//loadingType: 0.数据未加载完 1.数据全部加载完了 2.数据加载中
if(this.loadingType==0){
this.loadingType=2
//模拟数据请求
setTimeout(()=>{
this.currentPage++;
this.loadingType=0;
this.getCommissionDataList({
artificerId: this.artificerId,
fundData: this.selectedDate,
fundType: this.activeRange,
limit: this.pageSize,
page: this.currentPage,
})
},1000)
}
},
//获取下方积分明细(列表)
getCommissionDataList(params, isScroll) {
this.loadingStatus = "loading";
let {
artificerId,
fundData,
fundType,
limit,
page,
} = params;
this.$Request.postXZX("/app/dividedIntoDetails/selectDividedIntoDetails", params).then((
res) => {
//日期在返回数据userMoneyDetailsList.records的外面,需要单独赋值
this.fundTopDate = res.data?.startFundData + "---" + res.data?.endFundData;
if (res && res.data && res.data.records.length > 0) {
//有数据时
let obj = {};
// res.data.records.forEach((item) => {
// obj = {
// artificerMoneyTotal: item.artificerMoneyTotal,
// serveTime: item.serveTime,
// payTime: item.payTime,
// ordersNo: item.ordersNo,
// ordersId: item.ordersId,
// }
// this.commissionDetail.push(obj);
// })
// this.commissionDetail=res.data.records||{};
for (let i = 0; i < res.data?.records.length; i++) {
this.commissionDetail.push(res.data?.records[i]);
}
this.noDataScrollStatus = false;
this.isShowLoadMore = true;
if (this.commissionDetail.length < res.data.total) {
this.loadingStatus = "loadmore";
} else if (this.commissionDetail.length > res.data.total) {
this.loadingStatus = "nomore";
} else {
this.loadingStatus = "nomore";
}
} else {
//无数据时
if (!isScroll) {
//如果isScroll为null时说明不在滚动
this.noDataScrollStatus = true;
this.isShowLoadMore = false;
} else {
this.noDataScrollStatus = false;
}
this.loadingStatus = "nomore";
// this.noDataScrollStatus = true;
}
uni.stopPullDownRefresh();
})
},
//查询分成明细各个数量
getHomePageNum(params) {
let {
artificerId,
fundData,
fundType,
} = params;
this.$Request.postXZX("/app/dividedIntoDetails/selectDividedIntoDetail", params).then((res) => {
if (res && res.data) {
this.homePageDataNum.totalRevenue = res.data?.totalRevenue;
this.homePageDataNum.projectBenefits = res.data?.projectBenefits;
this.homePageDataNum.vehicleFareAmount = res.data?.vehicleFareAmount;
this.homePageDataNum.channelDeduction = res.data?.channelDeduction;
this.homePageDataNum.valueStorageDeduction = res.data?.valueStorageDeduction;
this.homePageDataNum.fundRange = res.data?.startFundData + "---" + res.data
?.endFundData;
}
})
uni.stopPullDownRefresh();
},
//异步展开日期选择Picker
showAndHiddenDatePicker() {
this.$refs.dataPicker.show();
},
//日期选择确认事件
confirmSelectedDate(e) {
this.selectedDate = e;
this.commissionDetail = [];
this.currentPage = 1;
this.getHomePageNum({
artificerId: this.artificerId,
fundData: this.selectedDate,
fundType: this.activeRange,
});
this.getCommissionDataList({
artificerId: this.artificerId,
fundData: this.selectedDate,
fundType: this.activeRange,
limit: this.pageSize,
page: this.currentPage,
});
},
//点击日期选择框遮罩层事件
maskClick() {},
//选择区间类型(本期/上期/本月/上月)
selectedRange(item) {
if (item && item.id) {
if (item.id == this.activeRange) return;
this.activeRange = item.id;
this.currentPage = 1;
this.isScroll = false;
this.commissionDetail = [];
this.currentIncome = "";
this.selectedDate = this.getCurrentTimeStamp();
this.getHomePageNum({
artificerId: this.artificerId,
fundData: this.selectedDate,
fundType: this.activeRange,
});
this.getCommissionDataList({
artificerId: this.artificerId,
fundData: this.selectedDate,
fundType: this.activeRange,
limit: this.pageSize,
page: this.currentPage,
});
}
},
//获取当前时间及转换方法
getCurrentTimeStamp() {
let realDateTimeStamp = new Date();
let year = realDateTimeStamp.getFullYear();
let month = realDateTimeStamp.getMonth() + 1;
let day = realDateTimeStamp.getDate();
let currentDate = year + '-' + (month < 10 ? '0' + month : month) + '-' + (day < 10 ? '0' + day : day);
return currentDate;
},
//跳转订单分成明细页面
jumpOrdersDetail(ordersId) {
if (this.commissionDetail.length <= 0) {
uni.navigateTo({
url: "/my/orderRevenueDetails/index?ordersId=" + ordersId,
})
uni.showToast({
title: '接口异常,请联系管理员',
duration: 2000,
})
return;
};
this.parentData = this.commissionDetail.filter((item) => item.ordersId == ordersId);
let parentData = this.parentData[0];
uni.navigateTo({
url: "/my/orderRevenueDetails/index?ordersId=" + ordersId,
success(res) {
console.log(res);
res.eventChannel.emit('parentData', parentData);
},
})
}
}
}
</script>
<style scoped>
@import "./index.css";
.od-number{
font-size: 24rpx;
color: #7ea866;
}
.mian-bottom{
width: 100%;
display: flex;
flex-direction: row;
align-items: center;
justify-content: space-between;
margin-top: 8rpx;
}
.mian-foot-adder{
margin: 3px 0px;
}
.mian-dingwei image{
width: 18.75rpx;
height:21.53rpx;
margin-right: 5px;
}
.mian-dingwei,.mian-bottom-shou{
display: flex;
flex-direction: row;
align-items: center;
}
.mian-title{
font-weight: bold;
font-size: 31rpx;
color: #333333;
}
.mian-foot-view{
width: 100%;
display: flex;
flex-direction: row;
align-items: center;
justify-content: space-between;
margin-bottom: 5px;
}
.mian-foot-list{
width: 72%;
display: flex;
flex-direction: column;
}
.mian-foot-img image{
width: 100%;
height: 100%;
border-radius: 20rpx;
}
.mian-foot-img{
width: 160rpx;
height: 160rpx;
background: #E6E6E6;
border-radius: 30rpx;
}
.mian-foot{
width: 100%;
display: flex;
flex-direction: row;
justify-content: space-between;
}
.shouyi-text{
color: #7D7D7D;
font-size: 26rpx;
}
.mian-head-time span:nth-child(2){
color: #11957C;
margin-top: 1px;
}
.mian-head-time{
display: flex;
flex-direction: row;
align-items: center;
font-weight: 400;
font-size: 26rpx;
}
.mian-head-biao{
width: 130rpx;
height: 47rpx;
line-height: 47rpx;
color: #fff;
font-size: 25rpx;
text-align: center;
background: linear-gradient(90deg, #019C88, #28BA92, #35C495);
border-top-left-radius: 21rpx;
border-bottom-right-radius: 21rpx;
}
.mian-head{
width: 100%;
display: flex;
flex-direction: row;
align-items: center;
justify-content: space-between;
border-bottom: 1px solid #E5E5E5;
padding-bottom: 5px;
margin-bottom: 10px;
}
.mian-view{
width: 100%;
background-color: #fff;
padding:22rpx 26rpx;
border-radius: 24rpx;
display: flex;
flex-direction: column;
margin: 12rpx auto;
}
/deep/.refresh-body .content{
/* background-color: #f7f7f7; */
}
/deep/.refresh-body{
height:660px !important;
border-top: 2px solid #f7f7f7;
}
.content{
width: 100%;
/* height: 100vh; */
background-color: #f7f7f7;
overflow: hidden;
}
.mian{
width: 100%;
display: flex;
flex-direction: column;
align-items: center;
}
</style>
<style>
page {
background-color: #f1f1f1;
height: 100%;
}
</style>