<template>
	<view>
		<view class=" bg-white  margin-top flex justify-between " style="height: 120upx;font-size: 36upx;">
			<view class=" flex align-center margin-left" style="width:50%">
				<text class="cuIcon-titles text-red"></text>
				<text>充值</text>
			</view>
			<view class="flex align-center margin-left" style="width: 50%;">
				<text class="cuIcon-titles text-red"></text>
				<text>疗程</text>
			</view>
		</view>
		<view class="flex justify-start cradtext">
			<view class="margin-left" style="width: 50%;" >
				<view class="margin-top">
					<text class="margin-left">期初</text>
					<text class='text-price text-red'>{{form1.startMoney}}</text>
				</view>
				<view class="margin-top">
					<text class="margin-left">收入</text>
					<text class='text-price text-red'>{{form1.rechargeMoney}}</text>
				</view>
				<view class="margin-top">
					<text class="margin-left">还款</text>
					<text class='text-price text-red'>{{form1.recRepayMoney+form1.cashRefundMoney}}</text>
				</view>
				<view class="margin-top">
					<text class="margin-left">服务</text>
					<text class='text-price text-red'>{{form1.recStoreCashMoney}}</text>
				</view>
				<view class="margin-top">
					<text class="margin-left">退款</text>
					<text class='text-price text-red'>{{form1.recRefundMoney}}</text>
				</view>
				<view class="margin-top">
					<text class="margin-left">购疗程</text>
					<text class='text-price text-red'>{{form1.cardToCourseMoney}}</text>
				</view>
				<view class="margin-top">
					<text class="margin-left">结存</text>
					<text class='text-price text-red'>{{form1.endMoney}}</text>
				</view>

			</view>
			<view class="margin-left" style="width: 50%;">
				<view class="margin-top">
					<text class="margin-left">期初</text>
					<text class='text-price text-red'>{{form2.startMoney}}</text>
				</view>
				<view class="margin-top">
					<text class="margin-left">收入</text>
					<text class='text-price text-red'>{{form2.courseMoney}}</text>
				</view>
				<view class="margin-top">
					<text class="margin-left">还款</text>
					<text class='text-price text-red'>{{form2.courseRepayMoney}}</text>
				</view>
				<view class="margin-top">
					<text class="margin-left">服务</text>
					<text class='text-price text-red'>{{form2.courseStoreCashMoney}}</text>
				</view>
				<view class="margin-top">
					<text class="margin-left">退款</text>
					<text class='text-price text-red'>{{form2.cashRefundMoney+form2.courseRefundMoney}}</text>
				</view>
				<view class="margin-top">
					<text class="margin-left"></text>
					<text class='text-red'></text>
				</view>
				<view class="margin-top">
					<text class="margin-left">结存</text>
					<text class='text-price text-red'>{{form2.endMoney}}</text>
				</view>
			</view>
		</view>
	</view>
</template>

<script>
	export default {
		data() {

			return {
				form1:{},
				form2:{},
				userInfo: {},
			}
		},
		methods: {
			achiCommList() {
				const dates = new Date();
				let year = dates.getFullYear();
				let month = dates.getMonth() + 1;
				let day = dates.getDate()
				month = month > 9 ? month : '0' + month;;
				day = day > 9 ? day : '0' + day;;
				let date= year+'-'+month+"-"+day
				this.$api.dayStatistic({
					date: date,storeId:this.userInfo.storeId
				}).then(res => {
					//console.log(res);
					if (res.code == '000000') {
						this.form1 = res.rows[0]
						this.form2 = res.rows[1]
					} else {
						uni.showToast({
							title: res.message,
							icon: "none",
							duration: 2000
						});
					}

				})
			}
		},
		onShow: function() {
			this.userInfo = uni.getStorageSync("userInfo")
			this.achiCommList()
		},
		onPullDownRefresh: function() {
			setTimeout(function() {
				uni.stopPullDownRefresh();
			}, 1000);
		},

	}
</script>

<style>
	.text-main {
		font-size: 28upx;
		height: 80upx;
		width: 100%;
		line-height: 80upx;
		margin-top: 10upx;
		color: #000000;
	}
	.cradtext text{
		display: inline-block;
			width: 100upx;
		}
</style>
