<template>
	<view class="app">
		<view class="prescription">
			<view class="record" @tap="recorddata()">
				处方记录
			</view>
			<view class="recorditem">
				<u-collapse :item-style="itemStyle" :arrow="false" :accordion='false'>
					<u-collapse-item :title="item.tempName" v-for="(item, index) in lastrecodedata.ptList" :key="index" @change='tapcollapse(item)' :class="item.check?'headcollapse':''">
						<view class="itemtext">
							<view class="collapse_top" v-for="uitem in item.ptValList">
							<!-- 	<u-icon name="star-fill" color="#000" size="28"></u-icon>
								<span style="margin-left: 10rpx;">健康生活方式</span> -->
								<view class="itemsdata">
									<view class="itemword">
									<u-checkbox v-model="checked" >{{uitem.formName}}</u-checkbox>
									</view>
									<!-- <view class="itemword">
										<u-checkbox v-model="checked" >测试345353535</u-checkbox>
									</view><view class="itemword">
										<u-checkbox v-model="checked" >测试345353535</u-checkbox>
									</view> -->
								</view>
							</view>
							
						</view>
					</u-collapse-item>
				</u-collapse>
			</view>
		</view>
	</view>
</template>

<script>
	import {lastrecode} from "@/api/pagesB/threeHundredAndSixty/threeHundredAndSixty.js"
	export default {
		data() {
			return {
				lastrecodedata:null,
				cardNo:'',
				itemList: [{
					head: "赏识在于角度的转换",
					body: "只要我们正确择取一个合适的参照物乃至稍降一格去看待他人，值得赏识的东西便会扑面而来",
					open: true,
					disabled: true
				}, {
					head: "生活中不是缺少美，而是缺少发现美的眼睛",
					body: "学会欣赏，实际是一种积极生活的态度，是生活的调味品，会在欣赏中发现生活的美",
					open: false,
				}, {
					head: "周围一些不起眼的人、事、物，或许都隐藏着不同凡响的智慧",
					body: "但是据说雕刻大卫像所用的这块大理石，曾被多位雕刻家批评得一无是处，有些人认为这块大理石采凿得不好，有些人嫌它的纹路不够美",
					open: false,
				}],
				
			}
		},
		mounted() {
			this.lastrecodelist()
			
		},
		methods: {
			tapcollapse(item) {
				item.check = !item.check
			},
			lastrecodelist() {
				if (uni.getStorageSync("userinfo").cardNo) {
					// this.cardNo=uni.getStorageSync("userinfo").cardNo
					this.cardNo = '370522196411282177'
					lastrecode(this.cardNo).then(res => {
						this.lastrecodedata = res.data
					})
				}
			},
			// 处方记录
			recorddata() {
				uni.navigateTo({
					url: "/pagesB/Prescriptionrecords/Prescriptionrecords"
				})
			
			
			},
			
		}
	}
</script>


<style lang="scss">
	.app {
		height: 100vh;
		background-color: #fff;
		// padding: 100rpx 40rpx;
		text-align: center;
		font-size: 36rpx;
		// 健康处方
		.prescription {
			::v-deep .u-collapse-title {
				font-size: 30rpx;
				font-weight: 600;
				padding-left: 10rpx;
			}
			.headcollapse {
				::v-deep .u-collapse-head {
					border-bottom: 2rpx solid #E6E6E6;
					text-align: center !important;
				}
		
				::v-deep .u-collapse-title {
					color: #26A888;
				}
			}
			
			
			::v-deep .u-collapse-head {
				width: 96%;
				margin: 0 auto;
				background: #169BD5 !important;
				text-align: center;
				color: #fff;
			}
			
			.record {
				color: #fff;
				width: 250rpx;
				height: 70rpx;
				line-height: 70rpx;
				border-radius: 10rpx;
				text-align: center;
				margin-left: auto;
				background: #169BD5;
				font-size: 27rpx;
		
			}
		
			.recorditem {
				margin-top: 39rpx;
					
				.itemtext{
					.collapse_top{
						font-size: 30rpx;
						font-weight: 500;
						color: #000;
						width: 94%;
						line-height: 40rpx;
						margin: 0 auto;
						padding: 20rpx 20rpx;
					.itemsdata{
						width: 100%;
						.itemword{
						margin: 15rpx;
		
							
						}
						
					}
						
					}
				}
				
			}
		
		}
		}

</style>
