<template>
	<view class="billDetailsStyle" :style="{'height':contentHeight}">
		<view style="width: 100%;height: 100%;">
			<u-empty v-if="g.length==0" text="暂无数据" mode="data"></u-empty>
			<template v-if="g.length > 0">
				<view  
				  style="
						height: calc(100vh);
						width: calc(100vw);
						overflow: hidden;
						padding: 10px 0;
				  ">
					<scroll-view
						:scroll-y="true"
						:enable-back-to-top="true"
						:enable-flex="true"
						@scrolltolower="lower"
						:style="{ height: '100%' }">
						<view style="display: flex;flex-direction: column;align-items: center;">
							<view v-for="(item, index) in g" :key="index" class="listbox">
								<view class="box_t">
									<u-avatar :src="item.Photo" size="64"></u-avatar>
									<text style="margin-left: 15px;">{{item.UserName}}</text>
								</view>
								<view class="box_c"  v-for="(x, index2) in item.DetailList" :key="index2">
									<image :src="x.CoverImagePath" style="width: 65px;height: 65px;border-radius: 6px;" ></image>	
									<view style="width: calc(100vw - 30px - 65px - 15px);display: flex;flex-direction: column;margin-left: 15px;">
										<view class="box_c_name">{{x.GoodsName}}</view>
										<view class="box_c_name" style="font-size: 12px;color: #555555;margin-top: 3px;">
											规格:
											<text v-for="(t, y) in x.SpecificationList" :key="y">{{t}}</text>
										</view>
										<view class="box_r_b">
											<text style="font-size: 12px;color: #555555;">X{{x.Number}}</text>
											
										</view>
									</view>
									
								</view>
								<view class="OrderNoStyle" >
									<text>订单号:{{item.OrderNo}}</text>
									<view style="font-size: 12px;color: #111111;">
										<text>已得佣金：</text>
										<text style="color: #FF4048;font-size: 12px;">{{item.Commission}}</text>
										<text>元</text>
									</view>
								</view>
								
							</view>
						</view>
							<u-loadmore
							  :status="status"
							  :load-text="loadText"
							  :font-size="24"
							  :margin-top="20"
							  :margin-bottom="20"
							  bg-color="#f3f4f6"
							/>
					</scroll-view>
					
				</view>
			</template>
		</view>
		
		
	</view>
</template>

<script>
	export default {
		data() {
			return {
				pageTitle: "账单详情",
				contentHeight:0,
				mainColor:'',
				secondary:'',
				g:[],
				
				msg:{
					pageIndex: 1,
					pageSize:10,
					BillId:0
				},
				SelectBillState:0,
				page_count:1,
				status: "loadmore",
				loadText: {
				  loadmore: "轻轻上拉，加载更多",
				  loading: "努力加载中",
				  nomore: "没有更多了",
				},
			}
		},
	
		created(){
			 this.contentHeight = this.$utils.calcContentHeight(-40)+'px';
			 this.mainColor = this.$uiConfig.mainColor;
			 this.secondary = this.$uiConfig.secondary;
			uni.setNavigationBarTitle({
			  title: this.pageTitle,
			});
		},
		onLoad(options){
			if(options){
				this.msg.BillId = options.ID
			}
			 this.init()
		},
		mounted() {
			
		},
		methods: {
			init(){
				
				uni.showLoading({
					title: '加载中'
				});
				this.request2(
				  {
				  	url: '/api/AppletUser/GetOrderBilldetailPageList',
				  	data: this.msg
				  },
							
				  (res) => {
					 
					uni.hideLoading();
					
					this.g = this.g.concat(res.data.pageData);
					
					this.page_count = res.data.pageCount;
					if (this.page_count == 1) {
					  this.status = "nomore";
					}
					
				  }
			);
			},
			
			lower(e) {
			  if (this.msg.pageIndex < this.page_count) {
				this.msg.pageIndex++;
				this.status = "loading";
				this.init();
			  } else {
				this.status = "nomore";
			  }
			},
		}
	}
</script>

<style>
.billDetailsStyle{
	background: #FAF8F9;
	
}

	.billDetailsStyle .listbox{
		width: 100%;
		margin-bottom: 10px;
		padding: 15px;
		background: #fff;
		display: flex;
		flex-direction: column;
		align-items: center
		
	}
	.billDetailsStyle .box_t{
		display: flex;
		flex-direction: row;
		align-items: center;
		width: 100%;
		overflow: hidden;
		height: 32px;
	}
	.billDetailsStyle .box_c{
		display: flex;
		flex-direction: row;
		align-items: center;
		width: 100%;
		overflow: hidden;
		margin-top: 15px;
	}
	.billDetailsStyle .box_c_name{
		text-overflow: -o-ellipsis-lastline;
		overflow: hidden;
		text-overflow: ellipsis;
		display: -webkit-box;
		-webkit-line-clamp: 1;
		line-clamp: 1;
		-webkit-box-orient: vertical;
		font-size: 13px;
		color: #111111;
	}
	.billDetailsStyle .box_r_b{
		width: 100%;
		display: flex;
		flex-direction: row;
		align-items: center;
		justify-content: space-between;
		margin-top: 3px;
	}
	.billDetailsStyle .OrderNoStyle{
		width: 100%;
		height: 35px;
		background: #F8F6F5;
		display: flex;
		flex-direction: row;
		align-items: center;
		font-size: 12px;
		color: #888888;
		margin-top: 15px;
		padding: 0 15px;
		justify-content: space-between;
		
	}
</style>
