<template>
	<view class="Scanning_B" v-if="status !== null">
		<view class="Scanning_top" v-if="status == 200">
			<view class="Scanning_top_icon">
				<text class="cubeic-ok icon_transport transport-duigou"></text>
			</view>
		</view>
		<view class="Scanning_top" v-else>
			<view class="Scanning_top_icon">
				<text class="cubeic-close icon_transport transport-shibai"></text>
			</view>
		</view>
		<view class="Scanning_cont" v-if="status == 200">
			<view class="tl">您已经成功接收{{result.deptName}}的{{result.num}}个药包</view>
			<!-- <view class="tl">您已经成功接收N7血液科的1个药包,共2组药品</view> -->
			<view class="success_item tl">发药单号包括:</view>
			<!-- <view class="success_item tl">明细详情:</view> -->
			<view class="tl">{{result.drugBagsCodes}}</view>
			<!-- <view class="tl">3200024183024</view> -->
			<!-- <view class="tl">3200024183025</view> -->
		</view>
		<view class="Scanning_cont" v-else>
			<view>{{errorContent}}</view>
		</view>
		<view class="foot_btn">
			<view class="btn3" @click="showAlert()">知道了</view>
		</view>
	</view>
</template>

<script>
	import {
		post,
		webHandle
	} from "../../http/http.js";
	export default {
		data() {
			return {
				result: {},
				options: {},
				errorContent: '',
				status: null,
			};
		},
		methods: {
			// 知道了
			showAlert() {
				uni.navigateTo({
					url: "../receiptpage/receiptpage",
				});
			},
			getInfo() {
				uni.showLoading({
					title: "加载中",
					mask: true,
				});
				post("/drugsBag/takeAndFillMedicineScan", {
						drugBagsCodes: this.options.code,
					})
					.then((result) => {
						uni.hideLoading();
						this.status = result.status;
						if (result.status == 200) {
							this.result = result || {};
						} else {
							this.errorContent = result.error;
						}
					})
			}
		},
		onLoad(options) {
			this.options = options;
			this.getInfo();
			// #ifdef APP-PLUS
			webHandle("no", "app");
			// #endif
			// #ifdef H5
			webHandle("no", "wx");
			// #endif
		}
	}
</script>

<style lang="less">
	.Scanning_B {
    display: flex;
    flex-direction: column;
    height: 100vh;
    padding: 0 40rpx;
		.Scanning_top {
			height: 150rpx;

			.Scanning_top_icon {
				width: 140rpx;
				height: 140rpx;
				margin: 0 auto;
				border-radius: 50%;
				line-height: 140rpx;
				text-align: center;

				.cubeic-ok {
					font-size: 140rpx;
					color: #35b34a;
				}

				.cubeic-close {
					font-size: 140rpx;
					color: #ff3b53;
				}
			}

			.Scanning_top_text {
				.text1 {
					margin-top: 40rpx;
					font-size: 48rpx;
					text-align: center;
				}
			}
		}

		.Scanning_cont {
			font-size: 32rpx;
			.tl{
        text-align: left;
      }
      .success_item{
        color: #8f8f8f;
      }

			view {
				margin-bottom: 16rpx;
				text-align: center;
			}

			.text {
				margin-top: 24rpx;
				color: #35b34a;
			}

			.text1 {
				margin-top: 24rpx;
				color: #ff3b53;
			}
		}

		.foot_btn {
			line-height: 88rpx;
			height: 100rpx;
			margin-top: 40rpx;
			display: flex;
			justify-content: center;

			.btn3 {
				flex: 1;
				height: 88rpx;
				background-image: linear-gradient(to right, #72c172, #3bb197);
				color: #fff;
				border-radius: 8rpx;
				font-size: 32rpx;
				margin-top: 16rpx;
				margin-right: 16rpx;
				text-align: center;

				&:last-of-type {
					margin-right: 0;
				}
			}
		}
	}
</style>