<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.rechargeTask}}</text>
				</view>
				<view class="margin-top">
					<text class="margin-left">疗程</text>
					<text class='text-price text-red'>{{form1.courseTask}}</text>
				</view>
				<view class="margin-top">
					<view class="cuIcon-titles text-red" style="display: inline-block;margin-left:5upx;margin-right: 50upx;"></view>
					<text>服务</text> <text class="text-red">{{form1.storeCashTask}}</text>
				</view>
				<view class="margin-top">
					<text class="margin-left">卡付</text>
					<text class='text-price text-red'>{{form1.storeCashTask*3/12}}</text>
				</view>
				<view class="margin-top">
					<text class="margin-left">疗程</text>
					<text class='text-price text-red'>{{form1.storeCashTask*5/12}}</text>
				</view>
				<view class="margin-top">
					<text class="margin-left">现付</text>
					<text class='text-price text-red'>{{form1.storeCashTask*4/12}}</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'>{{form1.rechargeMoney}}</text>
				</view>
				<view class="margin-top">
					<text class="margin-left">疗程</text>
					<text class='text-price text-red'>{{form1.courseMoney}}</text>
				</view>
				<view class="margin-top">
					<view class="cuIcon-titles text-red" style="display: inline-block;margin-left:5upx;margin-right: 50upx;"></view>
					<text>服务</text> <text class="text-red">{{(form1.recStoreCashMoney+form1.courseStoreCashMoney+form1.cashStoreCashMoney).toFixed(2)*1}}</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.courseStoreCashMoney}}</text>
				</view>
				<view class="margin-top">
					<text class="margin-left">现付</text>
					<text class='text-price text-red'>{{form1.cashStoreCashMoney}}</text>
				</view>


			</view>
		</view>
	</view>
</template>

<script>
	export default {
		data() {

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

				})
			}
		},
		onShow: function() {
			this.userInfo = uni.getStorageSync("userInfo")
			this.statistic()
		},
		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: 80upx;
	}
</style>
