<template>
	<view class="page" :style="themeColor">
		<view class="flex align-stretch benben-position-layout flex orderDetails_flex_0"
			:style="{height:(88+StatusBarRpx)+'rpx',paddingTop:StatusBarRpx+'rpx'}">
			<view class='flex align-center justify-between flex-sub orderDetails_fd0_0'>
				<view class='flex align-center orderDetails_fd0_0_c0' @tap.stop="handleJumpDiy" data-type="back"
					data-url="1">
					<text class='fu-iconfont2  orderDetails_fd0_0_c0_c0'>&#xE794;</text>
				</view>
				<view class='flex align-center'>
					<text class='orderDetails_fd0_0_c1_c0'>订单明细</text>
				</view>
				<view class='flex align-center justify-end orderDetails_fd0_0_c2'
					@tap.stop="popupShow1661324529518=true">
					<image class='orderDetails_fd0_0_c2_c0' :src='STATIC_URL+"9.png"'
						@tap.stop="popupShow1661324529518=true"></image>
				</view>
			</view>

		</view>
		<view :style="{height: (88+StatusBarRpx)+'rpx'}"></view>
		<benben-popup v-model="popupShow1661324529518" :mask="true" mode="center">
			<benben-calendar :query="benbenCalendar" :start-time.sync='start_time' :end-time.sync='end_time'
				@change="change">
			</benben-calendar>
		</benben-popup>
		<!---flex布局flex布局开始-->
		<view class="flex flex-direction flex-wrap align-stretch benben-flex-layout orderDetails_flex_2">
			<view class='flex flex-direction flex-wrap align-stretch flex-sub orderDetails_fd2_0' v-for="(item,index) in lists" :key="index">
				<view class='flex flex-wrap align-center'>
					<image class='orderDetails_fd2_0_c0_c0' mode="aspectFill" :src='item.avatar'></image>
					<text class='orderDetails_fd2_0_c0_c1'>{{item.nickname}}</text>
				</view>
				<view class='flex flex-wrap align-center orderDetails_fd2_0_c1' v-for="(goods,i) in item.goods_lists" :key="i">
					<view class='flex flex-wrap align-center'>
						<image class='orderDetails_fd2_0_c1_c0_c0' mode="aspectFill" :src='goods.goods_thumb'></image>
					</view>
					<view class='flex flex-wrap align-end justify-between flex-sub orderDetails_fd2_0_c1_c1'>
						<view class='flex flex-direction flex-wrap align-start'>
							<text class='orderDetails_fd2_0_c1_c1_c0_c0'>{{goods.goods_name}}</text>
							<text class='orderDetails_fd2_0_c1_c1_c0_c1'>{{goods.sku_name}}</text>
							<view class='flex flex-wrap align-end orderDetails_fd2_0_c1_c1_c0_c2'>
								<text class='orderDetails_fd2_0_c1_c1_c0_c2_c0'>￥</text>
								<view class=' orderDetails_fd2_0_c1_c1_c0_c2_c1'>
									<text class=' orderDetails_price1_fd2_0_c1_c1_c0_c2_c1'>{{ goods.goods_money | frontPrice }}</text>
									<text class=' orderDetails_price2_fd2_0_c1_c1_c0_c2_c1'>{{ goods.goods_money | laterPrice }}</text>
								</view>
							</view>
						</view>
						<view class='flex flex-wrap align-center'>
							<text class='orderDetails_fd2_0_c1_c1_c1_c0'>x</text>
							<text class='orderDetails_fd2_0_c1_c1_c1_c1'>{{goods.num}}</text>
						</view>
					</view>
				</view>
				<view class='flex flex-wrap align-center orderDetails_fd2_0_c2'>
				</view>
				<view class='flex flex-direction flex-wrap align-stretch'>
					<view class='flex flex-wrap align-center'>
						<text class='orderDetails_fd2_0_c3_c0_c0'>收益等级:</text>
						<text class='orderDetails_fd2_0_c3_c0_c1'>{{item.type_name}}</text>
					</view>
					<view class='flex flex-wrap align-center orderDetails_fd2_0_c3_c1'>
						<text class='orderDetails_fd2_0_c3_c1_c0'>订单编号:</text>
						<text class='orderDetails_fd2_0_c3_c1_c1'>{{item.order_sn}}</text>
					</view>
					<view class='flex flex-wrap align-center'>
						<text class='orderDetails_fd2_0_c3_c2_c0'>下单时间:</text>
						<text class='orderDetails_fd2_0_c3_c2_c1'>{{item.create_time}}</text>
					</view>
				</view>
				<view class='flex flex-wrap align-center orderDetails_fd2_0_c4'>
				</view>
				<view class='flex flex-wrap align-center'>
					<view class='flex flex-wrap align-end'>
						<text>订单实付金额:</text>
						<text class='orderDetails_fd2_0_c5_c0_c1'>￥</text>
						<view class=' orderDetails_fd2_0_c5_c0_c2'>
							<text class=' orderDetails_price1_fd2_0_c5_c0_c2'>{{ item.real_money | frontPrice }}</text>
							<text class=' orderDetails_price2_fd2_0_c5_c0_c2'>{{ item.real_money | laterPrice }}</text>
						</view>
					</view>
					<view class='flex flex-wrap align-center justify-center orderDetails_fd2_0_c5_c1'>
						<text class='orderDetails_fd2_0_c5_c1_c0'>预计收益 </text>
						<text class='orderDetails_fd2_0_c5_c1_c1'>{{item.score}}</text>
						<text class='orderDetails_fd2_0_c5_c1_c2'>抵用券</text>
					</view>
				</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: [], //订单列表
				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.getOrderList(false);
		},
		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();
			},
			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.post649b9700c9ff1, 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';
			  if (value) {
			    this.getOrderList(true);
			  } else {
			    this.getOrderList();
			  }
			},
			//清空
			emptyFunc() {
				this.start_time = '';
				this.end_time = '';
				this.refreshOrderList()
			}
		}
	};
</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;
	}

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

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

	.orderDetails_fd0_0_c2 {
		width: 180rpx;
	}

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

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

	.orderDetails_fd0_0_c0 {
		width: 180rpx;
	}

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

	.orderDetails_flex_2 {
		padding: 24rpx 24rpx 0rpx 24rpx;
	}

	.orderDetails_fd2_0_c5_c1_c2 {
		color: #E63334;
		font-size: 24rpx;
		font-weight: 500;
		line-height: 46rpx;
	}

	.orderDetails_fd2_0_c5_c1_c1 {
		color: #E63334;
		font-size: 24rpx;
		font-weight: 500;
		line-height: 46rpx;
	}

	.orderDetails_fd2_0_c5_c1_c0 {
		color: #E63334;
		font-size: 24rpx;
		font-weight: 500;
		line-height: 46rpx;
	}

	.orderDetails_fd2_0_c5_c1 {
		background: url(/static/images/20.png) no-repeat, transparent;
		width: 231rpx;
		height: 46rpx;
		margin: 0rpx 0rpx 0rpx 16rpx;
		border-radius: 16rpx 16rpx 16rpx 0rpx;
		background-size: 100% auto !important;
	}

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

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

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

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

	.orderDetails_fd2_0_c4 {
		background: rgba(238, 238, 238, 1);
		margin: 23rpx 0rpx 24rpx 0rpx;
		height: 1rpx;
		background-size: 100% auto !important;
	}

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

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

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

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

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

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

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

	.orderDetails_fd2_0_c2 {
		background: rgba(238, 238, 238, 1);
		margin: 32rpx 0rpx 24rpx 0rpx;
		height: 1rpx;
		background-size: 100% auto !important;
	}

	.orderDetails_fd2_0_c1_c1_c1_c1 {
		color: #999999;
		font-size: 24rpx;
		font-weight: 400;
		line-height: 24rpx;
	}

	.orderDetails_fd2_0_c1_c1_c1_c0 {
		color: #999999;
		font-size: 24rpx;
		font-weight: 400;
		line-height: 24rpx;
	}

	.orderDetails_price2_fd2_0_c1_c1_c0_c2_c1 {
		font-size: 32rpx;
		color: #333333;
		font-weight: 700;
		line-height: 36rpx;
	}

	.orderDetails_price1_fd2_0_c1_c1_c0_c2_c1 {
		font-size: 32rpx;
		color: #333333;
		font-weight: 700;
		line-height: 36rpx;
	}

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

	.orderDetails_fd2_0_c1_c1_c0_c2_c0 {
		color: #333333;
		font-size: 22rpx;
		font-weight: 700;
		line-height: 29rpx;
	}

	.orderDetails_fd2_0_c1_c1_c0_c2 {
		margin: 41rpx 0rpx 0rpx 0rpx;
	}

	.orderDetails_fd2_0_c1_c1_c0_c1 {
		color: #999999;
		font-size: 24rpx;
		font-weight: 400;
		line-height: 24rpx;
		margin: 8rpx 0rpx 0rpx 0rpx;
	}

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

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

	.orderDetails_fd2_0_c1_c0_c0 {
		width: 160rpx;
		height: 160rpx;
		border-radius: 16rpx 16rpx 16rpx 16rpx;
	}

	.orderDetails_fd2_0_c1 {
		margin: 32rpx 0rpx 0rpx 0rpx;
	}

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

	.orderDetails_fd2_0_c0_c0 {
		width: 48rpx;
		height: 48rpx;
		border-radius: 100rpx 100rpx 100rpx 100rpx;
		margin: 0rpx 16rpx 0rpx 0rpx;
	}

	.orderDetails_fd2_0 {
		background: rgba(255, 255, 255, 1);
		margin: 0rpx 0rpx 20rpx 0rpx;
		border-radius: 16rpx 16rpx 16rpx 16rpx;
		background-size: 100% auto !important;
		padding: 32rpx 24rpx 24rpx 24rpx;
	}
</style>
