<template name="invoice">
	<view class="invoice-template">
		 <!-- 发票信息 -->
		 <view class="invoice-content">
		 	<view class="invoice-title">发票信息</view>
			<view class="invoice-empty" v-if="isEmpty">
			 	<text>不要发票</text></text>
			</view>
			<view class="invoice-text" v-else>
				<view class="invoice-top" @click="showInvoice">
					<view class="name">{{orderInvoice.invoiceTitle ? orderInvoice.invoiceTitle : ''}}</view>
					<text class="iconfont icon-web_xiangxiazhankai" :class="{'icon-web_xiangxiazhankai-active':isOpen}"></text>
				</view>
				<view :class="{'invoice-warp--hide':!isOpen}" class="invoice-warp">
					<view  class="invoice-warp__wrapper invoice-animation" 
						   :style="{'transform':isOpen?'translateY(0)':'translateY(-50%)','-webkit-transform':isOpen?'translateY(0)':'translateY(-50%)'}">
						<view class="table">
							<text class="label-name">单位名称：</text>
							<text>{{orderInvoice.invoiceTitle ? orderInvoice.invoiceTitle : ''}}</text>
						</view>
						<view class="table long">
							<text class="label-name">纳锐人识别号：</text>
							<text>{{orderInvoice.corporationTaxNum ? orderInvoice.corporationTaxNum :''}}</text> 
						</view>
						<view class="table">
							<text class="label-name">注册地址：</text>
							<text>{{orderInvoice.registeredAddress ? orderInvoice.registeredAddress : ''}}</text> 
						</view>
						<view class="table">
							<text class="label-name">注册电话：</text>
							<text>{{orderInvoice.registeredPhone ? orderInvoice.registeredPhone : ''}}</text>
						</view>
						<view class="table">
							<text class="label-name">开户银行：</text>
							<text>{{orderInvoice.openBank ? orderInvoice.openBank : ''}}</text>
						</view>
						<view class="table">
							<text class="label-name">银行账号：</text>
							<text>{{bankAccountNo ? bankAccountNo : ''}}</text>
						</view>
					</view>
				</view>
			</view>
		 </view>
	</view>
</template>

<script>
	export default{
		name:"invoice",
		props:{
			orderInvoice:{
				type:Object
			}
		},
		data() {
			return{
				isEmpty:false,
				title:'发票信息',
				isOpen:false,
				bankAccountNo:''
			}
		},
		created(){
			this.initData(this.orderInvoice)
		},
		computed: {

		},
		methods:{
			initData(res) {
				if(res == null || res.type == 0){
					this.isEmpty = true
				}else{
					this.isEmpty = false
					this.bankAccountNo = this.$reg.bankRegex(res.bankAccountNo)
				}
			},
			onMessage(pros){
			},
			showInvoice(){
				this.isOpen = !this.isOpen
			}
		}
	}
</script>

<style lang="scss">
	.invoice-template{
		width: 100%;
		height: auto;
		background: #FFFFFF;
		float: left;
		margin-top: 24rpx;
		.invoice-content{
			width: 702rpx;
			padding: 20rpx 24rpx;
		}
		.invoice-title{
			font-size: $font-size-28;
			color: $text-color;
			text-align: left;
			line-height: 40rpx;
			font-weight: bold;
			margin-bottom: 30rpx;
		}
		.invoice-empty{
			font-size: $font-size-28;
			color: $text-color;
			text-align: left;
			line-height: 40rpx;
			.txt{
				font-size: $font-size-24;
				color: #999999;
			}
		}
		.invoice-animation {
			/* transition: transform 0.3s ease;*/
			transition-property: transform;
			transition-duration: 0.3s;
			transition-timing-function: ease;
		}
		.invoice-text{
			width: 100%;
			height: auto;
			.invoice-top{
				width: 100%;
				height: 40rpx;
				line-height: 40rpx;
				font-size: $font-size-28;
				color: $text-color;
				text-align: left;
				.name{
					width: 400rpx;
					float: left;
					-o-text-overflow: ellipsis;
					text-overflow: ellipsis;
					display: -webkit-box;
					word-break: break-all;
					-webkit-box-orient: vertical;
					-webkit-line-clamp: 1;
					overflow: hidden;
				}
				.icon-web_xiangxiazhankai{
					transform: rotate(0deg);
					transform-origin: center center;
					float: right;
					font-size: $font-size-32;
					color: #000000;
					/* transition: transform 0.3s ease;*/
					transition-property: transform;
					transition-duration: 0.3s;
					transition-timing-function: ease;
				}
				.icon-web_xiangxiazhankai-active{
					transform: rotate(180deg);
				}
			}
			.invoice-warp{
				width: 100%;
				padding: 24rpx 0 0 0;
				overflow: hidden;
				.table{
					padding-left: 130rpx;
					height: auto;
					line-height: 64rpx;
					font-size: $font-size-26;
					color: $text-color;
					text-align: left;
					position: relative;
					.label-name{
						display: inline-block;
						line-height: 64rpx;
						position: absolute;
						left: 0;
						top: 0;
					}
					&.long{
						padding-left: 180rpx;
					}
				}
			}	
			.invoice-warp__wrapper{
				/* #ifndef APP-NVUE */
				display: flex;
				/* #endif */
				flex-direction: column;
				padding-top: 20rpx;
			}
			.invoice-warp--hide {
				padding: 0 0;
				height: 0px;
				line-height: 0px;
			}		
		}
	}
</style>
