<template>
	<view class="">
		<view class="box safe-area-inset-bottom">
			<view class="p-row-2 m-t-2">
				<block v-if="list.length > 0">
					<view class="p-32 b-r-8 white m-b-2 item" v-for="(item, i) in list" :key="item.id"
						@click="$go('/subPackages/sub_workbench/prescriptionDetail?id=' +item.data + '&notice_id=' + item.id)">
						<view class="flex-row flex-ali-center flex-jus-sp m-t-2">
							<u-icon margin-left="8" label-size="32" label-color="#6C7380"
								:name="require('@/static/image/ys.png')" :label="item.content"
								color="#6ACDBB" size="32"></u-icon>
							<!-- <d-text :text="statusName[item.status]"></d-text> -->
						</view>
						<!-- <view class="flex-row flex-ali-center flex-jus-sp m-t-2">
							<d-text className="content-c fs-32" :text="getInfo(item.patient || {})"></d-text>
						</view> -->
						<view class="flex-row flex-ali-center flex-jus-sp m-t-2">
							<d-text :text="item.notice_at"></d-text>
						</view>
						<view class="rotation" @click.stop="rotation(item)">转方</view>
					</view>
				</block>
			</view>
		</view>
	</view>
</template>

<script>
	import {
		getNotice,
		rotationApi
	} from "@/api/all.js";
	export default {
		data() {
			return {
				list: [],
				page: 1,
				loading: true,
				loading2: true,
				status: "loading",
				totalPage: 1,
				loadText: {
					loadmore: "轻轻上拉",
					loading: "努力加载中",
					nomore: "已加载全部",
				},
				current: 0,
				status: ""
			};
		},

		created() {},
		onShow() {
			this.getList();
		},
		methods: {
			getInfo(user) {
				return `${user.name} ${user.sex == 1 ? "男" : "女"} ${user.age}岁`;
			},
			async getList() {
				getNotice({
					page_size: 9999,
					store_id: uni.getStorageSync('store_id') || '11001'
				}).then(res => {
					console.log(res, 'reess')
					this.list = res.data.list
				})
			},
			async rotation(row) {
				rotationApi({
					notice_id: row.id,
					store_id: uni.getStorageSync('store_id') || '11001'
				}).then(res => {
					uni.showToast({
						title: '转方成功',
						icon: 'success',
						mask: true
					})
					this.list = this.list.filter(item => item.id != row.id)
				})
			},
		},
	};
</script>
<style>
	page {
		background-color: #f9fafb;
	}
</style>
<style lang="scss" scoped>
	.tabs{
		background-color: #fff;
		width: 750rpx;
		position: sticky;
		top: 0rpx;
		z-index: 9999999;
		padding-top: 12rpx;
	}

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

		image {
			width: 32rpx;
			height: 32rpx;
		}
	}

	::v-deep .box {
		.u-tab-item {
			line-height: 1 !important;
		}
	}

	.state {
		margin-top: 160rpx;

		image {
			width: 300rpx;
			height: 223rpx;
		}
	}

	.search {
		padding: 16rpx 32rpx;
	}
	.item {
		position: relative;
		.rotation {
			position: absolute;
			right: 24rpx;
			bottom: 24rpx;
			padding: 8rpx 30rpx;
			background: #5792f9;
			color: #fff;
			border-radius: 8rpx;
		}
	}
</style>