<template>
	<view class="query-wrap">
		<view class="inner-item">
			<view class="item-stats">
				{{acceptDetaData.stas=='A'?'待确认':"已确认"}}
			</view>
			<view class="text-title">
				<view class="title-circ">

				</view>
				<span>基本信息</span>
			</view>
			<view class="inventory-item">
				<view class="shuo-item-name">
					<view class="shuo-label-podnme">
						退货单号:
					</view>
					<view class="shuo-cont">
						{{acceptDetaData.id}}
					</view>
				</view>
			</view>
			<view class="inventory-item">
				<view class="shuo-item">
					<view class="shuo-label">
						退货品种数:
					</view>
					<view class="shuo-cont">
						{{acceptDetaData.deltCnt||""}}
					</view>
				</view>
				<view class="shuo-item">
					<view class="shuo-label">
						退货总金额:
					</view>
					<view class="shuo-cont">
						{{acceptDetaData.amt}}
					</view>
				</view>
			</view>
			<view class="inventory-item">
				<view class="shuo-item-name">
					<view class="shuo-label-podnme">
						来源机构:
					</view>
					<view class="shuo-cont">
						{{acceptDetaData.orgName}}
					</view>
				</view>
			</view>
			<view class="inventory-item">
				<view class="shuo-item-name">
					<view class="shuo-label-podnme">
						供应商名称:
					</view>
					<view class="shuo-cont">
						{{acceptDetaData.splerName}}
					</view>
				</view>
			</view>
			<view class="inventory-item">
				<view class="shuo-item-name">
					<view class="shuo-label">
						退货时间:
					</view>
					<view class="shuo-cont">
						{{forMatTimehs(acceptDetaData.retnDate)}}
					</view>
				</view>
			</view>
		</view>
		<view class="empty-cont" v-if="depDelData.length=='0'">
			暂无明细数据
		</view>
		<view class="inner-item" v-for="(item,idex) in depDelData" :key="idex">
			<view class="text-title" v-if="idex=='0'">
				<view class="title-circ">

				</view>
				<span>药品清单</span>
			</view>
			<view class="inventory-item" style="margin-top: 40rpx;">
				<view class="shuo-item-name">
					<view class="shuo-label-podnme">
						药品名称:
					</view>
					<view class="shuo-unit">
						<span>{{ item.drugName }}</span>
					</view>
				</view>
			</view>
			<view class="inventory-item">
				<view class="shuo-item-name">
					<view class="shuo-label-podnme">
						药品编码:
					</view>
					<view class="shuo-cont">
						<span>{{ item.drugListId }}</span>
					</view>
				</view>
			</view>
			<view class="inventory-item">
				<view class="shuo-item-name">
					<view class="shuo-label">
						药品规格:
					</view>
					<view class="shuo-cont">
						{{
			 			         "" +
			 			         item.specName +
			 			         "*" +
			 			         item.convrat +
			 			         item.pac +
			 			         "/" +
			 			         item.pacUnt +
			 			         "】"
			 			       }}
					</view>
				</view>
			</view>
			<view class="inventory-item">
				<view class="shuo-item">
					<view class="shuo-label">
						是否基药:
					</view>
					<view class="shuo-cont">
						<span v-if="item.essdrugType == '0'">否</span>
						<span v-if="item.essdrugType == '1'">是</span>
					</view>
				</view>
				<view class="shuo-item">
					<view class="shuo-label">
						药品剂型:
					</view>
					<view class="shuo-cont">
						{{item.dosformName}}
					</view>
				</view>
			</view>
			<view class="inventory-item">
				<view class="shuo-item">
					<view class="shuo-label">
						制剂单位:
					</view>
					<view class="shuo-cont">
						{{item.prepunt}}
					</view>
				</view>
			</view>
			<view class="inventory-item">
				<view class="shuo-item">
					<view class="shuo-label">
						退货数量:
					</view>
					<view class="shuo-cont">
						{{item.retnCnt}}
					</view>
				</view>
				<view class="shuo-item">
					<view class="shuo-label">
						退货金额:
					</view>
					<view class="shuo-cont">
						{{item.retnAmt}}
					</view>
				</view>
			</view>
			<view class="inventory-item">
				<view class="shuo-item-name">
					<view class="shuo-label-podnme">
						生产厂家:
					</view>
					<view class="shuo-cont">
						<span>{{ item.prodentpName }}</span>
					</view>
				</view>
			</view>
			<view class="inventory-item">
				<view class="shuo-item-name">
					<view class="shuo-label-podnme">
						退货原因:
					</view>
					<view class="shuo-cont">
						<span>{{ item.retnRea }}</span>
					</view>
				</view>
			</view>
		</view>
		<uni-popup ref="popup">
			<uni-popup-dialog type="warn" :before-close="true" cancelText="取消" confirmText="确定" content="你确定当前操作吗？"
				@confirm="dialogConfirm" @close="dialogClose"></uni-popup-dialog>
		</uni-popup>
		<view class="botm-btn" v-if="acceptDetaData.stas == 'A'">
			<button type="default" plain="true" style="width:200rpx;line-height: 70rpx;background: #01A992;color:#fff"
				@click.stop="accessData('Y')">确认</button>
		</view>
	</view>
</template>
<script>
	import {
		mapState,
		mapMutations,
		mapActions
	} from 'vuex';
	import moment from "moment";
	export default {
		data() {
			return {
				listData: [],
				acceptDetaData: {}
			}
		},
		computed: {
			...mapState(['depDelData'])
		},
		onShow() {
			let that = this;
			uni.getStorage({
				key: 'depDetailData',
				success: function(res) {
					that.touData({
						id: res.data.id,
					});
					that.acceptDetaData = res.data;
				}
			});
		},
		mounted() {},
		methods: {
			...mapActions(['getDepretDetail']),
			async touData(data) {
				this.getDepretDetail(data)
			},
			forMatTime(row) {
				return moment(row).format("YYYY-MM-DD");
			},
			//确认
			accessData(type) {
				this.depDelData.map((item) => {
					return item.stas = 'Y';
				})
				this.$http('depTeturn.submit', this.depDelData, '加载中').then(res => {
					if (res.success == true) {
						uni.navigateTo({
							url: '/durgsubpkg/pages/depart-return/index',
							success: function(res) {
								console.log(res, "res")
							}
						});
					}
				}).catch(e => {

				})
			},
			//加时分秒
			forMatTimehs(time) {
				return moment(time).format("YYYY-MM-DD HH:mm");
			},
		},
		watch: {

		}

	}
</script>

<style lang="scss" scoped>
	.query-wrap {
		width: 100%;
		height: 100%;
		padding: 20rpx;
		box-sizing: border-box;
		background-color: #F1F1F1;
		overflow-y: scroll;
		overflow-x: hidden;
		position: relative;
		padding-bottom: 200rpx;

		.botm-btn {
			width: 100%;
			height: 120rpx;
			background-color: #fff;
			position: fixed;
			left: 0;
			bottom: 0;
			padding-top: 40rpx;
			display: flex;
			align-items: center;
			justify-content: space-around;
		}

		.time-view {
			height: 350rpx;
			background-color: #fff;
			padding: 50rpx 50rpx 0 50rpx;
			box-sizing: border-box;

			.btn-view {
				width: 100%;
				height: 100rpx;
				margin-top: 100rpx;
				display: flex;
				justify-content: space-around;
			}
		}

	}

	uni-page-body {
		width: 100%;
		height: 100%;
	}
</style>