<template>
	<view class="center">
		<view class="" @click="dataShow = true">{{data}}</view>
		<u-picker :show="dataShow" :columns="columns" @confirm="dataChange" @cancel="dataShow = false"
			@close="dataShow = false"></u-picker>
		<view class="formData" v-for="(item,index) in formlist">
			<view class="flex row">
				<view class="left-text">{{item.types}}</view>
				<view class="flex right-text">
					{{item.amountMoney}}
				</view>
			</view>
			<view class="date_css">
				{{item.createDate}}
			</view>

		</view>

	</view>
</template>

<script>
	export default {
		data() {
			return {
				type: "", //1个人  2 企业
				companyId: "",
				pageSize: 10,
				currentPage: 1,
				data: "2022",
				dataShow: false,
				value1: Number(new Date()),
				columns: [
					["2022", "2023", "2024", "2025", "2026", "2027", "2028", "2029", "2030", "2031", "2032", "2033",
						"2034", "2035"
					],
				],
				startDate: "",
				endDate: "",
				formlist: []


			}
		},
		onLoad(options) {
			this.type = options.type
			this.companyId = options.id
			this.getList()

		},
		onShow() {

		},
		methods: {
			dataChange(e) {
				this.data = e.value[0]
				this.dataShow = false
				this.getList()
			},
			getList() {
				// commonId ，companyId，date
				this.startDate = this.data + "-01-01"
				this.endDate = this.data + "-12-31"
				if (this.type == 1) { //个人
					this.$request.baseRequest('get', '/hyCargoOwnerCapitalInfo/selectBill', {
						commonId: uni.getStorageSync("userInfo").id,
						startDate: this.startDate,
						endDate: this.endDate,
						pageSize: this.pageSize,
						currentPage: this.currentPage,
					}).then(res => {
						this.formlist = res.data.records
					})
				} else if (this.type == 2) {
					this.$request.baseRequest('get', '/hyCargoOwnerCapitalInfo/selectBill', {
						companyId: this.companyId,
						startDate: this.startDate,
						endDate: this.endDate,
						pageSize: this.pageSize,
						currentPage: this.currentPage,
					}).then(res => {
						this.formlist = res.data.records

					})
				}

			}
		}
	}
</script>

<style lang="scss" scoped>
	.center {
		padding: 20rpx;

		.formData {
			.tips {
				text-align: right;
				border-bottom: 2rpx solid #e6e6e6;
				height: 60rpx;
			}

			.row {
				margin: 30rpx 0;
			}

			.left-text {
				// background: red;
				width: 40%;
				color: #333333;
				display: flex;
				align-items: center;
			}

			.right-text {
				width: 60%;
				justify-content: flex-end;
			}

			.date_css {
				text-align: right;
			}
		}
	}
</style>
uni.setStorageSync('userInfo', res.data)
helper.getListByUserId()
that.$store.commit('login', res.data)
// that.liangxinLogin()
uni.switchTab({
url: '/pages/order/index'
});
uni.hideLoading()
