<template>
	<view>
		<u-navbar title="挂号费用" title-size="34" title-color="#fff" :background="{background: '#FF8D7C'}">
		</u-navbar>
		<view class="bg" :style="{top:`${statusBarHeight+navbarHeight-1}px`}"></view>
		<view class="p-2">
			<view class="b-r-8 white info flex-col box flex-jus-center">
				<d-text text="总收益" color="#6C7380" align="center"></d-text>
				<view class="flex-row flex-jus-center flex-ali-baseline">
					<d-text text="￥" className="fs-28 main-c" align="end" :bold="true"></d-text>
					<d-text :text="priceList.total_price" className="fs-44 main-c m-t-16" :bold="true"></d-text>
				</view>
				<view class="flex-row flex-jus-sp m-t-32 p-row-32 flex-ali-center">
					<view class="flex-col flex-jus-center flex-1">
						<d-text text="当月收益" className="fs-24" color="#6C7380" align="center"></d-text>
						<d-text :text="'￥'+priceList.current_month" className="fs-36 main-c" align="center"></d-text>
					</view>
					<view class="flex-col flex-jus-center flex-1">
						<d-text text="当天收益" className="fs-24" align="center" color="#6C7380"></d-text>
						<d-text :text="'￥'+priceList.current_day" className="fs-36 main-c" align="center"></d-text>
					</view>
				</view>
				<view class="p-row-48 m-t-32">
					<u-button :throttle-time="0" :custom-style="{ backgroundColor:'#6ACDBB',color:'#fff' }"
						shape="circle" @click="$go('withdraw')" :ripple="true">
						提现</u-button>
				</view>
			</view>
			<!-- <view class="m-t-2 white b-r-8 p-row-32">
				<view class="bottom-border p-col-4 flex-row flex-jus-sp flex-ali-center" @click="$go('record')">
					<view class="flex-row flex-ali-center">
						<image src="../../../static/image/cf.png" style="width: 40rpx; height: 40rpx;"></image>
						<d-text text="提现记录" className="m-l-16 content-c" align="center"></d-text>
					</view>
					<u-icon name="arrow-right" color="#A7ABB0" size="32"></u-icon>
				</view>
				<view class="bottom-border p-col-4 flex-row flex-jus-sp flex-ali-center" @click="$go('earnings')">
					<view class="flex-row flex-ali-center">
						<image src="../../../static/image/wj.png" style="width: 40rpx; height: 40rpx;"></image>
						<d-text text="收益明细" className="m-l-16 content-c" align="center"></d-text>
					</view>
					<u-icon name="arrow-right" color="#A7ABB0" size="32"></u-icon>
				</view>
			</view> -->
			<view class="flex-row flex-jus-center box" v-if="!loading&&list.length==0">
				<d-empty text="暂无收入" mode="search"></d-empty>
			</view>

			<view class="p-row-2" style="margin-top: 114rpx" v-if="!loading && list.length >= 0">
				<view class="p-32 white flex-col m-b-2" v-for="item in list" :key="item.id">
					<view class="flex-row">
						<!-- 接诊状态 -->
						<!-- <d-text :color="tabs[current]['color']" :text="tabs[current]['name']"></d-text> -->
						<u-image width="104rpx" height="104rpx" shape="circle" :src="item.avatar">
							<u-loading slot="loading"></u-loading>
						</u-image>
						<view class="list">
							<view class="names">
								<text class="fs-32">{{item.name}}</text>
							</view>
							<view class="time">
								<text>{{item.pay_time}}</text>
								<text class="price">{{'￥'+ item.price}}</text>
							</view>
						</view>
					</view>
				</view>
				<u-loadmore :status="status" :load-text="loadText" v-if="!loading && list.length > 0" />
			</view>


		</view>
		<d-loading-page :loading="loading"></d-loading-page>
	</view>
</template>

<script>
	import {
		doctorIncome,
		doctorRegister
	} from '../../../api/all';
	export default {
		data() {
			return {
				navbarHeight: this.$navbarHeight,
				statusBarHeight: this.$statusBarHeight,
				loading: true,
				userInfo: uni.getStorageSync('userInfo') || {},
				list: [],
				priceList: [],
				loadText: {
					loadmore: "轻轻上拉",
					loading: "努力加载中",
					nomore: "实在没有了",
				},
			};
		},
		computed: {},
		created() {
			this.loading = false
			this.getList()
			this.getPrice()
		},
		onReachBottom() {
			if (this.page >= this.totalPage) {
				this.$toast("数据已全部加载");
				return;
			}
			this.page++;
			this.getList();
		},
		methods: {
			async getList() {
				let res = {}
				res = await doctorIncome({
					store_id: uni.getStorageSync('store_id') || '11001'
				})
				this.list = []
				if (res.errcode == 0) {
					this.list = res.data.list
					this.$nextTick(() => {
						this.loading = false
					})
				} else {
					this.$toast(res.msg);
					this.loading = false
				}
			},

			async getPrice() {
				let res = {}
				res = await doctorRegister({
					store_id: uni.getStorageSync('store_id') || '11001'
				})
				this.priceList = []
				if (res.errcode == 0) {
					this.priceList = res.data
					this.$nextTick(() => {
						this.loading = false
					})
				} else {
					this.$toast(res.msg);
					this.loading = false
				}
			}
		}
	};
</script>
<style>
	page {
		background-color: #F9FAFB;
	}
</style>
<style lang="scss" scoped>
	.bg {
		position: fixed;
		width: 750rpx;
		height: 400rpx;
		background: linear-gradient(180deg, #FF8D7C 0%, #FFC092 100%);
		z-index: 981;
	}

	.info {
		padding: 64rpx 0;
	}

	.box {
		position: relative;
		z-index: 982;
	}

	.list {
		flex: 1;
		display: flex;
		justify-content: space-between;
		margin-left: 30rpx;

		.names {
			display: flex;
			justify-content: space-between;
			align-items: center;
			margin-bottom: 20rpx;
		}

		text {
			margin-right: 20rpx;
		}

		.time {
			display: flex;
			flex-direction: column;
			text-align: right;

			.price {
				color: #FF4747;
				margin-top: 10rpx;
			}
		}
	}
</style>