<template>
	<view class="page" :style="themeColor">
		<view class="flex align-stretch benben-position-layout flex revenueDetails_flex_0"
			:style="{height:(88+StatusBarRpx)+'rpx',paddingTop:StatusBarRpx+'rpx'}">
			<view class='flex align-center justify-between flex-sub revenueDetails_fd0_0'>
				<view class='flex align-center revenueDetails_fd0_0_c0' @tap.stop="handleJumpDiy" data-type="back"
					data-url="1">
					<text class='fu-iconfont2  revenueDetails_fd0_0_c0_c0'>&#xE794;</text>
				</view>
				<view class='flex align-center'>
					<text class='revenueDetails_fd0_0_c1_c0'>收益明细</text>
				</view>
				<view class='flex align-center justify-end revenueDetails_fd0_0_c2'
					@tap.stop="popupShow1661324529518=true">
					<image class='revenueDetails_fd0_0_c2_c0' :src='STATIC_URL+"128.png"'
						@tap.stop="popupShow1661324529518=true"></image>
				</view>
			</view>

		</view>
		<view :style="{height: (88+StatusBarRpx)+'rpx'}"></view>
		<!---flex布局flex布局开始-->
		<view class="flex align-center justify-between benben-flex-layout revenueDetails_flex_1"
			v-if="start_time!='' && end_time!=''">
			<view class='flex flex-wrap align-center revenueDetails_fd1_0'>
				<text class='revenueDetails_fd1_0_c0'>{{start_time}}</text>
				<text class='revenueDetails_fd1_0_c1'>–</text>
				<text class='revenueDetails_fd1_0_c2'>{{end_time}}</text>
			</view>
			<image class='revenueDetails_fd1_1' :src='STATIC_URL+"129.png"' @tap.stop="emptyFunc()"></image>
		</view>

		<!---flex布局flex布局结束-->
		<benben-popup v-model="popupShow1661324529518" :mask="true" mode="center">
			<benben-calendar :query="benbenCalendar" :future="true" :start-time.sync='start_time' :end-time.sync='end_time'
				@change="change">
			</benben-calendar>
		</benben-popup>
		<!---flex布局flex布局开始-->
    <fu-loading v-if="isShowLoading"></fu-loading>
		<view class="flex flex-direction flex-wrap align-stretch benben-flex-layout revenueDetails_flex_3">
			<view class='flex flex-direction flex-wrap align-stretch flex-sub revenueDetails_fd3_0' v-for="(item,index) in lists" :key="index">
				<view class='flex flex-wrap align-center'>
					<text class='revenueDetails_fd3_0_c0_c0'>{{item.create_time}}</text>
				</view>
				<view class='flex flex-wrap align-center revenueDetails_fd3_0_c1'>
					<text class='revenueDetails_fd3_0_c1_c0'>收益抵用券：</text>
					<text class='revenueDetails_fd3_0_c1_c1'>{{item.change_score}}</text>
					<text class='revenueDetails_fd3_0_c1_c2'>抵用券</text>
				</view>
				<view class='flex flex-wrap align-center revenueDetails_fd3_0_c2'>
					<text class='revenueDetails_fd3_0_c2_c0'>订单编号：</text>
					<text class='revenueDetails_fd3_0_c2_c1'>{{item.order_sn}}</text>
				</view>
				<view class='flex flex-wrap align-center revenueDetails_fd3_0_c3'>
					<text class='revenueDetails_fd3_0_c3_c0'>订单金额：</text>
					<text class='revenueDetails_fd3_0_c3_c1'>￥</text>
					<view class=' revenueDetails_fd3_0_c3_c2'>
						<text class=' revenueDetails_price1_fd3_0_c3_c2'>{{ item.order_money | frontPrice }}</text>
						<text class=' revenueDetails_price2_fd3_0_c3_c2'>{{ item.order_money | laterPrice }}</text>
					</view>
				</view>
				<view class='flex flex-wrap align-center revenueDetails_fd3_0_c4'>
					<text class='revenueDetails_fd3_0_c4_c0'>{{item.remark}}</text>
				</view>
			</view>
			<!-- <view class='flex flex-direction flex-wrap align-stretch flex-sub revenueDetails_fd3_1'>
				<view class='flex flex-wrap align-center'>
					<text class='revenueDetails_fd3_1_c0_c0'>2022-04-08</text>
				</view>
				<view class='flex flex-wrap align-center revenueDetails_fd3_1_c1'>
					<text class='revenueDetails_fd3_1_c1_c0'>收益抵用券：</text>
					<text class='revenueDetails_fd3_1_c1_c1'>10.00</text>
					<text class='revenueDetails_fd3_1_c1_c2'>抵用券</text>
				</view>
				<view class='flex flex-wrap align-center revenueDetails_fd3_1_c2'>
					<text class='revenueDetails_fd3_1_c2_c0'>订单编号：</text>
					<text class='revenueDetails_fd3_1_c2_c1'>GD20220319155315384936</text>
				</view>
				<view class='flex flex-wrap align-center revenueDetails_fd3_1_c3'>
					<text class='revenueDetails_fd3_1_c3_c0'>订单金额：</text>
					<text class='revenueDetails_fd3_1_c3_c1'>￥</text>
					<view class=' revenueDetails_fd3_1_c3_c2'>
						<text class=' revenueDetails_price1_fd3_1_c3_c2'>{{ 100 | frontPrice }}</text>
						<text class=' revenueDetails_price2_fd3_1_c3_c2'>{{ 100 | laterPrice }}</text>
					</view>
				</view>
				<view class='flex flex-wrap align-center revenueDetails_fd3_1_c4'>
					<text class='revenueDetails_fd3_1_c4_c0'>直推下级蔡小菜购买商品，获得返利抵用券10</text>
				</view>
			</view> -->
		</view>

		<!---flex布局flex布局结束-->
		
		<!-- 空布局 start -->
		<fu-empty-ui v-if="lists.length == 0 && isInit"></fu-empty-ui>
		<!-- 空布局 end -->
		<!-- 页面加载 start -->
		
		<!-- 页面加载 end -->
		<!-- 底部数据加载状态  start-->
		<uni-load-more v-if="lists.length > 8" :status="status"></uni-load-more>
		<!-- 底部数据加载状态  end-->


	</view>
</template>
<script>
	export default {
		components: {},


		data() {
			return {
				"popupShow1661324529518": false,
				"benbenCalendar": {
					'width': 686,
					'background': '#ffffff',
					'borderRadius': '24rpx 24rpx 24rpx 24rpx',
					'mode': 'range',
					'future': false,
					'changeTitle': true,
					'changeYear': true,
					'changeMonth': true,
					'yearArrowColor': '#666666',
					'monthArrowColor': '#999999',
					'startText': '',
					'endText': '',
					'activeBgColor': '#FA2233',
					'rangeBgColor': '#f7d4d6'
				},
				"start_time": "",
				"end_time": "",
				type:"",
				lists: [], //订单列表
        isShowLoading: false,
				page: 1, //页码说
				size: 10, //一页显示几条数据
				status: 'more', //  加载状态  more:有更多数据  noMore:已加载全部数据  loading:数据加载中
				isInit: false, //是否已经初始化
			};
		},
		computed: {
			themeColor() {
				return this.$store.getters.themeColor
			},

		},
		watch: {},
		onLoad(options) {
			this.type = options.type
			this.getOrderList(true);
		},
		onPullDownRefresh() {
		  this.page = 1;
		  this.status = 'more';
      this.isShowLoading = false;
      this.lists = [];
      this.isInit = false;
		  this.getOrderList(true);
		},
		onReachBottom() {
		  this.getOrderList();
		},
		methods: {
			change(value) {
			  if (value.isInit) return;
			  this.start_time = value.start;
			  this.end_time = value.end;
			  setTimeout(() =>{
			    this.popupShow1661324529518 = false;
			  },800)
			  this.refreshOrderList(true);
			},
			getOrderList(value) {
			  // this.isShow = false;
			  if (this.status != 'more') return;
			  this.status = 'loading';
			  let data = {
			    start_time: this.start_time,
			    end_time: this.end_time,
			    page: this.page,
			    list_rows: this.size,
					type:this.type
			  };
			  console.log('请求的数据', data);
			  if (this.page == 1 && value) {
			    this.isShowLoading = true;
			  }
			  this.$api
			    .post(global.apiUrls.post649175157d9de, data)
			    .then(res => {
			      console.log('抵用券明细', res);
			      this.isShowLoading = false;
			      if (res.data.code == 1) {
			        var curPageData = res.data.data.data;
			        let total = res.data.data.total;
			        if (this.page == 1) this.lists = [];
			        this.lists = this.lists.concat(curPageData);
			        if (this.lists.length < total) {
			          this.status = 'more';
			          this.page++;
			        } else {
			          this.status = 'noMore';
			        }
			      } else {
			        this.$message.info(res.data.msg);
			      }
			      this.isInit = true;
			      uni.stopPullDownRefresh();
			    })
			    .catch(err => {
			      this.isShowLoading = false;
			      uni.stopPullDownRefresh();
			    });
			},
			/**
			 * @description  重置列表
			 * @param {Object} value 页面是否初始化
			 */
			refreshOrderList(value) {
			  this.page = 1;
			  this.status = 'more';
        this.isShowLoading = false;
        this.lists = [];
        this.isInit = false;
			  if (value) {
			    this.getOrderList(true);
			  } else {
			    this.getOrderList();
			  }
			},
			//清空
			emptyFunc() {
				this.start_time = '';
				this.end_time = '';
				this.refreshOrderList(true)
			}
		}
	};
</script>
<style lang="scss" scoped>
	.page {
		width: 100vw;
		overflow-x: hidden;
		min-height: calc(100vh - var(--window-bottom));
		background: rgba(248, 248, 248, 1);
		background-size: 100% auto !important;
	}

	.revenueDetails_flex_0 {
		background: #fff;
		width: 750rpx;
		height: 88rpx;
		overflow: hidden;
		z-index: 10;
		top: 0rpx;
		background-size: 100% auto !important;
	}

	.revenueDetails_fd0_0_c2_c0 {
		width: 36rpx;
		height: 36rpx;
		border-radius: 0rpx 0rpx 0rpx 0rpx;
	}

	.revenueDetails_fd0_0_c2 {
		width: 180rpx;
	}

	.revenueDetails_fd0_0_c1_c0 {
		font-size: 36rpx;
		font-weight: 600;
		color: #333333;
		line-height: 36rpx;
	}

	.revenueDetails_fd0_0_c0_c0 {
		font-size: 32rpx;
		font-weight: 500;
		color: #333;
	}

	.revenueDetails_fd0_0_c0 {
		width: 180rpx;
	}

	.revenueDetails_fd0_0 {
		padding: 0rpx 32rpx 0rpx 32rpx;
		line-height: 88rpx;
	}

	.revenueDetails_flex_1 {
		background: rgba(255, 240, 219, 1);
		background-size: 100% auto !important;
		padding: 24rpx 32rpx 23rpx 32rpx;
	}

	.revenueDetails_fd1_1 {
		width: 28rpx;
		height: 28rpx;
		border-radius: 0rpx 0rpx 0rpx 0rpx;
	}

	.revenueDetails_fd1_0_c2 {
		color: #333333;
		font-size: 24rpx;
		font-weight: 500;
		line-height: 24rpx;
	}

	.revenueDetails_fd1_0_c1 {
		color: #333333;
		font-size: 24rpx;
		font-weight: 500;
		line-height: 24rpx;
	}

	.revenueDetails_fd1_0_c0 {
		color: #333333;
		font-size: 24rpx;
		font-weight: 500;
		line-height: 24rpx;
	}

	.revenueDetails_fd1_0 {
		line-height: 33rpx;
		font-size: 24rpx;
		font-weight: 400;
		color: #FF5E37;
	}

	.revenueDetails_flex_3 {
		padding: 24rpx 32rpx 0rpx 32rpx;
	}

	.revenueDetails_fd3_1_c4_c0 {
		color: #F54848;
		font-size: 24rpx;
		font-weight: 700;
		line-height: 24rpx;
	}

	.revenueDetails_fd3_1_c4 {
		margin: 24rpx 0rpx 0rpx 0rpx;
	}

	.revenueDetails_price2_fd3_1_c3_c2 {
		font-size: 28rpx;
		color: #333333;
		font-weight: 500;
		line-height: 28rpx;
	}

	.revenueDetails_price1_fd3_1_c3_c2 {
		font-size: 28rpx;
		color: #333333;
		font-weight: 500;
		line-height: 28rpx;
	}

	.revenueDetails_fd3_1_c3_c2 {
		color: #ff5536;
		font-weight: 600;
	}

	.revenueDetails_fd3_1_c3_c1 {
		color: #333333;
		font-size: 28rpx;
		font-weight: 500;
		line-height: 28rpx;
	}

	.revenueDetails_fd3_1_c3_c0 {
		color: #666666;
		font-size: 28rpx;
		font-weight: 400;
		line-height: 30rpx;
	}

	.revenueDetails_fd3_1_c3 {
		margin: 20rpx 0rpx 0rpx 0rpx;
	}

	.revenueDetails_fd3_1_c2_c1 {
		color: #333333;
		font-size: 28rpx;
		font-weight: 500;
		line-height: 30rpx;
	}

	.revenueDetails_fd3_1_c2_c0 {
		color: #666666;
		font-size: 28rpx;
		font-weight: 400;
		line-height: 30rpx;
	}

	.revenueDetails_fd3_1_c2 {
		margin: 20rpx 0rpx 0rpx 0rpx;
	}

	.revenueDetails_fd3_1_c1_c2 {
		color: #333333;
		font-size: 28rpx;
		font-weight: 500;
		line-height: 30rpx;
	}

	.revenueDetails_fd3_1_c1_c1 {
		color: #333333;
		font-size: 28rpx;
		font-weight: 500;
		line-height: 30rpx;
	}

	.revenueDetails_fd3_1_c1_c0 {
		color: #666666;
		font-size: 28rpx;
		font-weight: 400;
		line-height: 30rpx;
	}

	.revenueDetails_fd3_1_c1 {
		margin: 48rpx 0rpx 0rpx 0rpx;
	}

	.revenueDetails_fd3_1_c0_c0 {
		color: #000000;
		font-size: 28rpx;
		font-weight: 700;
		line-height: 30rpx;
	}

	.revenueDetails_fd3_1 {
		background: url(https://lvtai-files.oss-cn-beijing.aliyuncs.com/mini/18.png) no-repeat, transparent;
		margin: 0rpx 0rpx 20rpx 0rpx;
		padding: 35rpx 24rpx 32rpx 24rpx;
		background-size: 100% auto !important;
	}

	.revenueDetails_fd3_0_c4_c0 {
		color: #F54848;
		font-size: 24rpx;
		font-weight: 700;
		line-height: 24rpx;
	}

	.revenueDetails_fd3_0_c4 {
		margin: 24rpx 0rpx 0rpx 0rpx;
	}

	.revenueDetails_price2_fd3_0_c3_c2 {
		font-size: 28rpx;
		color: #333333;
		font-weight: 500;
		line-height: 28rpx;
	}

	.revenueDetails_price1_fd3_0_c3_c2 {
		font-size: 28rpx;
		color: #333333;
		font-weight: 500;
		line-height: 28rpx;
	}

	.revenueDetails_fd3_0_c3_c2 {
		color: #ff5536;
		font-weight: 600;
	}

	.revenueDetails_fd3_0_c3_c1 {
		color: #333333;
		font-size: 28rpx;
		font-weight: 500;
		line-height: 28rpx;
	}

	.revenueDetails_fd3_0_c3_c0 {
		color: #666666;
		font-size: 28rpx;
		font-weight: 400;
		line-height: 30rpx;
	}

	.revenueDetails_fd3_0_c3 {
		margin: 20rpx 0rpx 0rpx 0rpx;
	}

	.revenueDetails_fd3_0_c2_c1 {
		color: #333333;
		font-size: 28rpx;
		font-weight: 500;
		line-height: 30rpx;
	}

	.revenueDetails_fd3_0_c2_c0 {
		color: #666666;
		font-size: 28rpx;
		font-weight: 400;
		line-height: 30rpx;
	}

	.revenueDetails_fd3_0_c2 {
		margin: 20rpx 0rpx 0rpx 0rpx;
	}

	.revenueDetails_fd3_0_c1_c2 {
		color: #333333;
		font-size: 28rpx;
		font-weight: 500;
		line-height: 30rpx;
	}

	.revenueDetails_fd3_0_c1_c1 {
		color: #333333;
		font-size: 28rpx;
		font-weight: 500;
		line-height: 30rpx;
	}

	.revenueDetails_fd3_0_c1_c0 {
		color: #666666;
		font-size: 28rpx;
		font-weight: 400;
		line-height: 30rpx;
	}

	.revenueDetails_fd3_0_c1 {
		margin: 48rpx 0rpx 0rpx 0rpx;
	}

	.revenueDetails_fd3_0_c0_c0 {
		color: #000000;
		font-size: 28rpx;
		font-weight: 700;
		line-height: 30rpx;
	}

	.revenueDetails_fd3_0 {
		background: url(https://lvtai-files.oss-cn-beijing.aliyuncs.com/mini/130.png) no-repeat, transparent;
		margin: 0rpx 0rpx 20rpx 0rpx;
		padding: 35rpx 24rpx 32rpx 24rpx;
		background-size: 100% auto !important;
	}
</style>
