<template>
	<view class="page" :style="themeColor">
		<view class="flex benben-position-layout flex flex-wrap align-center pointsDetails_flex_0"
			:style="{height:(88+StatusBarRpx)+'rpx',paddingTop:StatusBarRpx+'rpx'}">
			<view class='flex flex-wrap align-center justify-between flex-sub pointsDetails_fd0_0'>
				<view class='flex flex-wrap align-center' @tap.stop="handleJumpDiy" data-type="back" data-url="1">
					<text class='fu-iconfont2  pointsDetails_fd0_0_c0_c0' @tap.stop="handleJumpDiy" data-type="back"
						data-url="1">&#xE794;</text>
				</view>
				<view class='flex flex-wrap align-stretch justify-center flex-sub'>
					<text class='pointsDetails_fd0_0_c1_c0'>抵用券明细</text>
				</view>
				<view class='flex flex-wrap align-center pointsDetails_fd0_0_c2'>
				</view>
			</view>

		</view>
		<view :style="{height: (88+StatusBarRpx)+'rpx'}"></view>
		<!---flex布局flex布局开始-->
		<view class="flex flex-direction flex-wrap align-stretch benben-flex-layout pointsDetails_flex_1">
			<view class='flex flex-direction flex-wrap align-start flex-sub pointsDetails_fd1_0'>
				<view class='flex flex-wrap align-center'>
					<text class='pointsDetails_fd1_0_c0_c0'>抵用券余额</text>
          <image  @tap.stop="handleJumpDiy" data-type="navigateTo"
          :data-url="`/pages/dl/registrationAgreemen/registrationAgreemen?type=24`" style="width: 36rpx; height: 36rpx; margin-left: 24rpx;" src="../static/dd_tips.png" mode="widthFix"></image>
				</view>
				<view class='flex flex-wrap align-end pointsDetails_fd1_0_c1'>
					<text class='pointsDetails_fd1_0_c1_c0'>当前</text>
					<text class='pointsDetails_fd1_0_c1_c1'>{{score}}</text>
				</view>
			</view>
		</view>

		<!---flex布局flex布局结束-->
		<!---flex布局flex布局开始-->
		<view class="flex benben-flex-layout flex-wrap align-center pointsDetails_flex_2">
			<view>
				<benben-flex-tabs class-name='pointsDetails_benbenTabsfd2_0' v-model="tabls" ref="benben_tabsfd2_0"
					select-mark="benben_tabsfd2_0" key="benben_tabsfd2_0" :open-title-type='false' :open-sticky='false'
					:top='0' :is-show-content='false' :scrollspy='false' :tabs-info.sync="tabsInfofd2_0">

					<scroll-view @scroll="tabsInfofd2_0.scrollX = $event.detail.scrollLeft" id="benben_tabsfd2_0"
						class="benben-tabs" style="width:750rpx" :scroll-x="true"
						:scroll-left.sync="tabsInfofd2_0.moveX" scroll-with-animation="all .3s ease">
						<view class="benben-tabs-content" id="benben_tabsfd2_0-content">
							<view id="benben_tabsfd2_0-title"
								class="benben-tabs-title flex flex align-center justify-around">
								<view :class="{ 'checkTitlefd2_0': tabls == '1', 'flex flex-wrap align-center': true }"
									@tap="tabClick(1)" :id="`benben_tabsfd2_0-title-item-${'1'}`">

									<text>收入</text>

								</view>
								<view :class="{ 'checkTitlefd2_0': tabls == '2', 'flex flex-wrap align-center': true }"
									@tap="tabClick(2)" :id="`benben_tabsfd2_0-title-item-${'2'}`">

									<text>支出</text>

								</view>
							</view>
							<view :style="{ left: tabsInfofd2_0.lineleft, maxWidth: tabsInfofd2_0.lineWidth }"
								id="benben_tabsfd2_0-line"
								class="benben-tabs-line flex benben-flex-tabs-line pointsDetails_linefd2_0"></view>
						</view>
					</scroll-view>

				</benben-flex-tabs>

			</view>
		</view>

		<!---flex布局flex布局结束-->
		<!---收入flex布局开始-->
		<view class="flex flex-direction flex-wrap align-stretch benben-flex-layout pointsDetails_flex_3">
			<view class="" v-for="(item,index) in lists" :key="index">
				<view v-if="tabls == 1" class='flex flex-direction flex-wrap align-stretch flex-sub pointsDetails_fd3_0'
					@tap.stop="detTap(item)">
					<view class='flex flex-wrap align-center justify-between'>
						<view class='flex flex-wrap align-center'>
							<image class='pointsDetails_fd3_0_c0_c0_c0' mode="aspectFit" :src='STATIC_URL+"22.png"'></image>
							<text class='pointsDetails_fd3_0_c0_c0_c1'>{{item.store.store_name}}</text>
						</view>
						<view class='flex flex-wrap align-center'>
							<text class='pointsDetails_fd3_0_c0_c1_c0'>{{item.type_name}}</text>
						</view>
					</view>
					<view class='flex flex-wrap align-center justify-between pointsDetails_fd3_0_c1'>
						<view class='flex flex-wrap align-center'>
							<image class='pointsDetails_fd3_0_c1_c0_c0' mode="aspectFill" :src='item.store.logo'></image>
						</view>
						<view class='flex flex-wrap align-center'>
							<text class='pointsDetails_fd3_0_c1_c1_c0'>+</text>
							<text class='pointsDetails_fd3_0_c1_c1_c1'>{{item.change_score}}</text>
						</view>
					</view>
					<view class='flex flex-wrap align-center'>
						<text class='pointsDetails_fd3_0_c2_c0'>{{item.create_time}}</text>
					</view>
				</view>

				<!---粉丝奖励flex布局开始-->
				<view class="flex flex-direction flex-wrap align-stretch benben-flex-layout pointsDetails_flex_5" v-if="tabls == 2">
					<view class='flex flex-wrap align-start justify-between flex-sub pointsDetails_fd5_0'>
						<view class='flex flex-direction flex-wrap align-start'>
							<text class='pointsDetails_fd5_0_c0_c0'>{{item.type_name}}</text>
							<text class='pointsDetails_fd5_0_c0_c1'>{{item.create_time}}</text>
						</view>
						<view class='flex flex-wrap align-center'>
							<!-- <text class='pointsDetails_fd5_0_c1_c0'>-</text> -->
							<text class='pointsDetails_fd5_0_c1_c1'>{{item.change_score}}</text>
						</view>
					</view>
				</view>

				<!---粉丝奖励flex布局结束-->
			</view>

		</view>

		<!---收入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 {
				"tabsInfofd2_0": {
					lineleft: '',
					lineWidth: '',
					moveX: 0,
					scrollX: 0,
					PageScrollX: 0
				},
				"tabls": "1",
				score:"",
				lists: [], //订单列表
				page: 1, //页码说
				size: 10, //一页显示几条数据
				status: 'more', //  加载状态  more:有更多数据  noMore:已加载全部数据  loading:数据加载中
				isInit: false, //是否已经初始化
			};
		},
		computed: {
			themeColor() {
				return this.$store.getters.themeColor
			},

		},
		watch: {},
		onLoad(options) {
			this.getOrderList(true)
		},
		onShow() {
			this.post64893775ce02c()
		},
		onPullDownRefresh() {
		  this.page = 1;
		  this.status = 'more';
		  this.getOrderList(false);
		},
		onReachBottom() {
		  this.getOrderList();
		},
		methods: {
			detTap(item){
				if(item.change_type==1){
					uni.navigateTo({
						url:'/pages/md/detailsPage/detailsPage?aid='+ item.aid
					})
				}
			},
			//账户余额信息
			post64893775ce02c(){
				this.$api.post(global.apiUrls.post64893775ce02c).then(res=>{
					if(res.data.code==1){
						this.score = res.data.data.score
					}
				})
			},
			tabClick(index) {
			  this.tabls = index;
			  this.refreshOrderList();
			},
			refreshOrderList(value) {
			  this.page = 1;
			  this.status = 'more';
			  if (value) {
			    this.getOrderList(true);
			  } else {
			    this.getOrderList();
			  }
			},
			getOrderList(value) {
			  // this.isShow = false;
			  if (this.status != 'more') return;
			  this.status = 'loading';
			  let data = {
			    type: this.tabls,
			    page: this.page,
			    list_rows: this.size,
			  };
			  console.log('请求的数据', data);
			  if (this.page == 1 && value) {
			    this.isShowLoading = true;
			  }
			  this.$api
			    .post(global.apiUrls.post649165fd2d3a7, 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();
			    });
			},
		}
	};
</script>
<style lang="scss" scoped>
	.page {
		width: 100vw;
		padding-bottom: 20rpx;
		overflow-x: hidden;
		min-height: calc(100vh - var(--window-bottom));
		background: rgba(246, 247, 249, 1);
		background-size: 100% auto !important;
	}

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

	.pointsDetails_fd0_0_c2 {
		width: 32rpx;
		height: 32rpx;
	}

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

	.pointsDetails_fd0_0_c0_c0 {
		font-size: 32rpx;
		font-weight: 500;
		color: #333;
		line-height: 88rpx;
	}

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

	.pointsDetails_flex_1 {
		background: rgba(255, 231, 199, 1);
		background-size: 100% auto !important;
		padding: 19rpx 32rpx 21rpx 32rpx;
	}

	.pointsDetails_fd1_0_c1_c1 {
		color: #FFFFFF;
		font-size: 48rpx;
		font-weight: 700;
		line-height: 42rpx;
		margin: 0rpx 0rpx 0rpx 16rpx;
	}

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

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

	.pointsDetails_fd1_0_c0_c0 {
		color: #FFFFFF;
		font-size: 32rpx;
		font-weight: 500;
		line-height: 42rpx;
	}

	.pointsDetails_fd1_0 {
		background: url(/static/images/21.png) no-repeat, transparent;
		background-size: 100% auto !important;
		padding: 116rpx 0rpx 110rpx 30rpx;
	}

	.pointsDetails_flex_2 {
		background: linear-gradient(360deg, #F6F7F9 0%, #FFFFFF 100%);
		margin: -32rpx 0rpx 0rpx 0rpx;
		border-radius: 16rpx 16rpx 0rpx 0rpx;
		position: relative;
	}

	.pointsDetails_linefd2_0 {
		background: rgba(255, 147, 0, 1);
		width: 40rpx;
		height: 8rpx;
		top: 91rpx;
		background-size: 100% auto !important;
		border-radius: 25rpx 25rpx 25rpx 25rpx;
	}

	.checkTitlefd2_0 {
		font-weight: 700 !important;
		font-size: 32rpx !important;
		color: #333 !important;
		background-color: rgba(255, 255, 255, 1) !important;
	}

	::v-deep .pointsDetails_benbenTabsfd2_0 {
		width: 750rpx;
		height: 100rpx;
		white-space: nowrap;
		font-size: 32rpx;
		font-weight: 500;
		color: #666666;
		border-radius: 16rpx 16rpx 0rpx 0rpx;
		text-align: center;
	}

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

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

	.pointsDetails_fd3_0_c1_c1_c1 {
		color: #E32121;
		font-size: 36rpx;
		font-weight: 500;
		line-height: 36rpx;
	}

	.pointsDetails_fd3_0_c1_c1_c0 {
		color: #E32121;
		font-size: 36rpx;
		font-weight: 500;
		line-height: 36rpx;
	}

	.pointsDetails_fd3_0_c1_c0_c0 {
		width: 120rpx;
		height: 120rpx;
		border-radius: 16rpx 16rpx 16rpx 16rpx;
	}

	.pointsDetails_fd3_0_c1 {
		margin: 40rpx 0rpx 57rpx 0rpx;
	}

	.pointsDetails_fd3_0_c0_c1_c0 {
		color: #59A6F4;
		font-size: 28rpx;
		font-weight: 500;
		line-height: 50rpx;
	}

	.pointsDetails_fd3_0_c0_c0_c1 {
		color: #333333;
		font-size: 32rpx;
		font-weight: 500;
	}

	.pointsDetails_fd3_0_c0_c0_c0 {
		width: 30rpx;
		height: 28rpx;
		border-radius: 0rpx 0rpx 0rpx 0rpx;
		margin: 0rpx 16rpx 0rpx 0rpx;
	}

	.pointsDetails_fd3_0 {
		background: rgba(255, 255, 255, 1);
		border-radius: 16rpx 16rpx 16rpx 16rpx;
		background-size: 100% auto !important;
		margin: 20rpx 0rpx 0rpx 0rpx;
		padding: 41rpx 24rpx 24rpx 24rpx;
	}

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

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

	.pointsDetails_fd4_0_c1_c1_c1 {
		color: rgba(102, 102, 102, 1);
		font-size: 36rpx;
		font-weight: 500;
		line-height: 36rpx;
	}

	.pointsDetails_fd4_0_c1_c1_c0 {
		color: rgba(102, 102, 102, 1);
		font-size: 36rpx;
		font-weight: 500;
		line-height: 36rpx;
	}

	.pointsDetails_fd4_0_c1_c0_c0 {
		width: 120rpx;
		height: 120rpx;
		border-radius: 16rpx 16rpx 16rpx 16rpx;
	}

	.pointsDetails_fd4_0_c1 {
		margin: 40rpx 0rpx 57rpx 0rpx;
	}

	.pointsDetails_fd4_0_c0_c1_c0 {
		color: #59A6F4;
		font-size: 28rpx;
		font-weight: 500;
		line-height: 50rpx;
	}

	.pointsDetails_fd4_0_c0_c0_c1 {
		color: #333333;
		font-size: 32rpx;
		font-weight: 500;
	}

	.pointsDetails_fd4_0_c0_c0_c0 {
		width: 30rpx;
		height: 28rpx;
		border-radius: 0rpx 0rpx 0rpx 0rpx;
		margin: 0rpx 16rpx 0rpx 0rpx;
	}

	.pointsDetails_fd4_0 {
		background: rgba(255, 255, 255, 1);
		border-radius: 16rpx 16rpx 16rpx 16rpx;
		background-size: 100% auto !important;
		margin: 0rpx 0rpx 20rpx 0rpx;
		padding: 41rpx 24rpx 24rpx 24rpx;
	}

	.pointsDetails_flex_5 {
		// padding: 0rpx 24rpx 0rpx 24rpx;
	}

	.pointsDetails_fd5_0_c1_c1 {
		color: #E32121;
		font-size: 36rpx;
		font-weight: 500;
		line-height: 36rpx;
	}

	.pointsDetails_fd5_0_c1_c0 {
		color: #E32121;
		font-size: 36rpx;
		font-weight: 500;
		line-height: 36rpx;
	}

	.pointsDetails_fd5_0_c0_c1 {
		color: #999999;
		font-size: 28rpx;
		font-weight: 400;
		line-height: 42rpx;
		margin: 24rpx 0rpx 0rpx 0rpx;
	}

	.pointsDetails_fd5_0_c0_c0 {
		max-width: 450rpx;
		color: #333333;
		font-size: 32rpx;
		font-weight: 500;
		line-height: 32rpx;
	}

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