<template>
	<div>
		<!-- 报送 -->
		<c-col :span="24">
			<c-col :span="12">
				<c-col :span="22">
					<el-form-item label="收付汇日期">
						<el-date-picker
							v-model="model.mtabut.paydat"
							type="date"
							placeholder="选择日期">
						</el-date-picker>
					</el-form-item>
				</c-col>
			</c-col>
		</c-col>

		<c-col :span="12">
			<c-col :span="22">
				<el-form-item label="申报号码">
					<c-col :span="24" class="m-inputbtn">
						<c-col class="m-inputbtn-input">
							<c-input  v-model="model.rmbmod.tdbgrp.bas.levyno" maxlength="16"  placeholder="请输入申报号码"></c-input>
						</c-col>
						<c-button type="primary" class="m-inputbtn-btn" @click="getOwnref">获取</c-button>
					</c-col>
				</el-form-item>
			</c-col>
			<c-col :span="22">
				<el-form-item label="操作类型">
					<c-select v-model="model.rmbmod.tdbgrp.bas.opertype" style="width:100%" placeholder="请选择操作类型">
						<el-option
							v-for="item in codes.actiontype"
							:key="item.value"
							:label="item.label"
							:value="item.value">
						</el-option>
					</c-select>
				</el-form-item>
			</c-col>
		</c-col>

		<c-col :span="12">
			<c-col :span="22">
				<el-form-item label="修改/删除原因">
					<c-input
						type="textarea"
						:rows="3"
						placeholder="请输入原因"
						v-model="model.rmbmod.tdbgrp.bas.actiondesc">
					</c-input>
				</el-form-item>
			</c-col>
		</c-col>

		<c-col :span="24">
			<c-col :span="12">
				<c-col :span="22">
					<el-form-item label="银行业务编号">
						<c-input  v-model="model.rmbmod.tdbgrp.bas.banktrano" maxlength="16"  placeholder="请输入银行业务编号"></c-input>
					</el-form-item>
				</c-col>
			</c-col>

			<c-col :span="12">
				<c-col :span="22">
					<el-form-item label="银行机构代码">
						<c-input  v-model="model.rmbmod.tdbgrp.bas.bankorgcode" maxlength="16"  placeholder="请输入银行机构代码"></c-input>
					</el-form-item>
				</c-col>
			</c-col>
		</c-col>

		<c-col :span="24">
			<c-col :span="12">
				<c-col :span="22">
					<el-form-item label="银行机构名称">
						<c-input  v-model="model.rmbmod.tdbgrp.bas.bankorgname" maxlength="16"  placeholder="请输入银行机构名称"></c-input>
					</el-form-item>
				</c-col>
			</c-col>

			<c-col :span="12">
				<c-col :span="22">
					<el-form-item label="收款人名称">
						<c-input  v-model="model.rmbmod.tdbgrp.bas.payeename" maxlength="16"  placeholder="请输入收款人名称"></c-input>
					</el-form-item>
				</c-col>
			</c-col>
		</c-col>

		<c-col :span="24">
			<c-col :span="12">
				<c-col :span="22">
					<el-form-item label="付款人名称">
						<c-input  v-model="model.rmbmod.tdbgrp.bas.payername" maxlength="16"  placeholder="请输入付款人名称"></c-input>
					</el-form-item>
				</c-col>
			</c-col>

			<c-col :span="12">
				<c-col :span="22">
					<el-form-item label="交易附言">
						<c-input  v-model="model.rmbmod.tdbgrp.bas.addword" maxlength="16"  placeholder="请输入交易附言"></c-input>
					</el-form-item>
				</c-col>
			</c-col>
		</c-col>

		<c-col :span="24">
			<c-col :span="12">
				<c-col :span="22">
					<el-form-item label="中间转汇行">
						<c-input  v-model="model.rmbmod.tdbgrp.bas.midtransbank" maxlength="16"  placeholder="请输入中间转汇行"></c-input>
					</el-form-item>
				</c-col>
			</c-col>

			<c-col :span="12">
				<c-col :span="22">
					<el-form-item label="收款人常驻国家（地区）代码">
						<c-col :span="24" class="m-inputbtn">
							<c-col class="m-inputbtn-input">
								<c-input  v-model="model.rmbmod.tdbgrp.bas.payeecountrycode" maxlength="16"  placeholder="请输入收款人常驻国家（地区）代码"></c-input>
							</c-col>
							<c-button type="primary" icon="el-icon-search" class="m-inputbtn-btn" @click="handleSearch"></c-button>
						</c-col>
					</el-form-item>
				</c-col>
			</c-col>
		</c-col>

		<c-col :span="24">
			<c-col :span="12">
				<c-col :span="22">
					<el-form-item label="清算（结算）账户类型">
						<c-select v-model="model.rmbmod.tdbgrp.bas.payeeaccttype" style="width:100%" placeholder="请选择清算（结算）账户类型">
							<el-option
								v-for="item in codes.payeraccttype"
								:key="item.value"
								:label="item.label"
								:value="item.value">
							</el-option>
						</c-select>
					</el-form-item>
				</c-col>
			</c-col>

			<c-col :span="12">
				<c-col :span="22">
					<el-form-item label="结算方式">
						<c-select v-model="model.rmbmod.tdbgrp.bas.balancemode" style="width:100%" placeholder="结算方式">
							<el-option
								v-for="item in codes.balancemode"
								:key="item.value"
								:label="item.label"
								:value="item.value">
							</el-option>
						</c-select>
					</el-form-item>
				</c-col>
			</c-col>
		</c-col>

		<c-col :span="24">
			<c-col :span="12">
				<c-col :span="22">
					<el-form-item label="清算(结算)账户账号">
						<c-input  v-model="model.rmbmod.tdbgrp.bas.payeeacct" maxlength="16"  placeholder="请输入清算(结算)账户账号"></c-input>
					</el-form-item>
				</c-col>
			</c-col>
		</c-col>

		<c-col :span="24">
			<c-col :span="12">
				<c-col :span="22">
					<el-form-item label="收款行SWIFT BIC">
						<c-input  v-model="model.rmbmod.tdbgrp.bas.swiftbic" maxlength="16"  placeholder="请输入收款行SWIFT BIC"></c-input>
					</el-form-item>
				</c-col>
			</c-col>

			<c-col :span="12">
				<c-col :span="22">
					<el-form-item label="原申报号码">
						<c-input  v-model="model.rmbmod.tdbgrp.bas.orilevyno" maxlength="16"  placeholder="请输入原申报号码"></c-input>
					</el-form-item>
				</c-col>
			</c-col>
		</c-col>

		<c-col :span="24">
			<c-col :span="12">
				<c-col :span="22">
					<el-form-item label="付款人组织机构代码或身份证件号码">
						<c-input  v-model="model.rmbmod.tdbgrp.bas.payerorgcode" maxlength="16"  placeholder="请输入"></c-input>
					</el-form-item>
				</c-col>
			</c-col>

			<c-col :span="12">
				<el-form-item label="付款日期">
					<el-date-picker
						v-model="model.rmbmod.tdbgrp.bas.payerdate"
						type="date"
						placeholder="选择日期">
					</el-date-picker>
				</el-form-item>
			</c-col>
		</c-col>

		<c-col :span="24">
			<c-col :span="12">
				<c-col :span="22">
					<el-form-item label="付款总金额">
						<c-select v-model="model.rmbmod.tdbgrp.bas.payercny" style="width:100%" placeholder="请选择">
							<el-option
								v-for="item in codes.bopcur"
								:key="item.value"
								:label="item.label"
								:value="item.value">
							</el-option>
						</c-select>
					</el-form-item>
				</c-col>
				<c-col :span="22">
					<el-form-item label="">
						<c-input  v-model="model.rmbmod.tdbgrp.bas.totalamt" maxlength="16"  placeholder="请输入"></c-input>
					</el-form-item>
				</c-col>
			</c-col>

			<c-col :span="12">
				<el-form-item label="付款人账号">
					<c-input  v-model="model.cpdgrp.rec.orcacc" maxlength="16"  placeholder="请输入"></c-input>
				</el-form-item>
			</c-col>
		</c-col>

		<c-col :span="24">
			<c-col :span="12">
				<c-col :span="22">
					<el-form-item label="付款人属性">
						<c-select v-model="model.rmbmod.tdbgrp.bas.payerattr" style="width:100%" placeholder="请选择">
							<el-option
								v-for="item in codes.payeeattr"
								:key="item.value"
								:label="item.label"
								:value="item.value">
							</el-option>
						</c-select>
					</el-form-item>
				</c-col>
			</c-col>
		</c-col>
		
		<c-col :span="24">
			<c-col :span="6">
				<c-checkbox v-model="showChechBox.hwmy">货物贸易</c-checkbox>
			</c-col>
			<c-col :span="6">
				<c-checkbox v-model="showChechBox.fwmy">服务贸易</c-checkbox>
			</c-col>
			<c-col :span="6">
				<c-checkbox v-model="showChechBox.zjtz">直接投资</c-checkbox>
			</c-col>
			<c-col :span="6">
				<c-checkbox v-model="showChechBox.zqtz">证券投资</c-checkbox>
			</c-col>
		</c-col>
		<c-col :span="24">
			<c-col :span="6">
				<c-checkbox v-model="showChechBox.qttz">其他投资</c-checkbox>
			</c-col>
			<c-col :span="6">
				<c-checkbox v-model="showChechBox.kjrz">跨境融资</c-checkbox>
			</c-col>
			<c-col :span="6">
				<c-checkbox v-model="showChechBox.sy">收益与经济转移</c-checkbox>
			</c-col>
			<c-col :span="6">
				<c-checkbox v-model="showChechBox.zbzy">资本转移</c-checkbox>
			</c-col>
		</c-col>

		<!-- 货物贸易 -->
		<c-col :span="24" v-if="showChechBox.hwmy" class="showcheckbox">
			<c-col :span="24">
				<h3>支出信息-货物贸易表</h3>
			</c-col>

			<c-col :span="24">
				<c-col :span="12">
					<c-col :span="22">
						<el-form-item label="货物贸易收款金额">
							<c-input  v-model="model.rmbmod.tdbgrp.bas.banktrano" maxlength="16"  placeholder="请输入"></c-input>
						</el-form-item>
					</c-col>
				</c-col>

				<c-col :span="12">
					<c-col :span="22">
						<el-form-item label="结账期">
							<c-input  v-model="model.rmbmod.tdbgrp.tea.customsamt" maxlength="16"  placeholder="请输入"></c-input>
						</el-form-item>
					</c-col>
				</c-col>
			</c-col>

			<c-col :span="24">
				<c-col :span="12">
					<c-col :span="22">
						<el-form-item label="已报关收款金额">
							<c-input  v-model="model.rmbmod.tdbgrp.bas.banktrano" maxlength="16"  placeholder="请输入"></c-input>
						</el-form-item>
					</c-col>
				</c-col>

				<c-col :span="12">
					<c-col :span="22">
						<el-form-item label="已备案收款金额">
							<c-input  v-model="model.rmbmod.tdbgrp.tea.recordamt" maxlength="16"  placeholder="请输入"></c-input>
						</el-form-item>
					</c-col>
				</c-col>
			</c-col>

			<c-col :span="24">
				<c-col :span="18">
					<el-form-item label="预收款金额">
						<c-input  v-model="model.rmbmod.tdbgrp.tea.prepayeramt" maxlength="16"  placeholder="请输入"></c-input>
					</el-form-item>
				</c-col>
			</c-col>

			<c-col :span="24">
				<c-col :span="18">
					<el-form-item label="无货物报关的货物贸易-海关特殊监管区域及保税监管">
						<c-input  v-model="model.rmbmod.tdbgrp.tea.onshoreamt" maxlength="16"  placeholder="请输入"></c-input>
					</el-form-item>
				</c-col>
			</c-col>
			<c-col :span="24">
				<h3>场所进出境物流货物金额</h3>
			</c-col>

			<c-col :span="24">
				<c-col :span="12">
					<c-col :span="22">
						<el-form-item label="无货物报关的货物贸易-离岸转手买卖金额">
							<c-input  v-model="model.rmbmod.tdbgrp.tea.offshoreamt" maxlength="16"  placeholder="请输入"></c-input>
						</el-form-item>
					</c-col>
				</c-col>

				<c-col :span="12">
					<c-col :span="22">
						<el-form-item label="无货物报关的货物贸易-其他金额">
							<c-input  v-model="model.rmbmod.tdbgrp.tea.nogoodsamt" maxlength="16"  placeholder="请输入"></c-input>
						</el-form-item>
					</c-col>
				</c-col>
			</c-col>

			<div class="title">物流明细信息</div>
			<div class="e-table-wrapper">
				<c-table
                :data="model.rmbmod.tdbgrp.tbclst"
					style="width: 100%"
					>
					<el-table-column
						prop="seqno"
						label="序号">
					</el-table-column>
					<el-table-column
						prop="listopertype"
						label="操作类型">
					</el-table-column>
					<el-table-column
						prop="balofpaycode"
						label="服务贸易交易编码">
					</el-table-column>
					<el-table-column
						prop="amt"
						label="服务贸易金额">
					</el-table-column>
					<el-table-column
						prop="contractno"
						label="交易合同号">
					</el-table-column>
					<el-table-column
						prop=""
						label="操作"
						width="150">
					</el-table-column>
				</c-table>
			</div>
			<c-button plain class="add-btn" @click="add">+</c-button>
		</c-col>

		<!-- 服务贸易 -->
		<c-col :span="24" v-if="showChechBox.fwmy" class="showcheckbox">
			<div class="title">服务贸易信息</div>
			<div class="e-table-wrapper">
				<c-table
                :data="model.rmbmod.tdbgrp.tbclst"
					style="width: 100%"
					>
					<el-table-column
						prop="seqno"
						label="序号">
					</el-table-column>
					<el-table-column
						prop="listopertype"
						label="操作类型">
					</el-table-column>
					<el-table-column
						prop="balofpaycode"
						label="服务贸易交易编码">
					</el-table-column>
					<el-table-column
						prop="amt"
						label="服务贸易金额">
					</el-table-column>
					<el-table-column
						prop="contractno"
						label="交易合同号">
					</el-table-column>
					<el-table-column
						prop=""
						label="操作"
						width="150">
					</el-table-column>
				</c-table>
			</div>
			<c-button plain class="add-btn" @click="add">+</c-button>
		</c-col>

		<!-- 直接投资 -->
		<c-col :span="24" v-if="showChechBox.zjtz" class="showcheckbox">
			<div class="title">直接投资信息</div>
			<div class="e-table-wrapper">
				<c-table
                :data="model.rmbmod.tdbgrp.tbdlst"
					style="width: 100%"
					>
					<el-table-column
						prop="seqno"
						label="序号">
					</el-table-column>
					<el-table-column
						prop="listopertype"
						label="操作类型">
					</el-table-column>
					<el-table-column
						prop="balofpaycode"
						label="直接投资交易编码">
					</el-table-column>
					<el-table-column
						prop="currencycode"
						label="直接投资币种">
					</el-table-column>
					<el-table-column
						prop="amt"
						label="直接投资金额">
					</el-table-column>
					<el-table-column
						prop="certificateno"
						label="政府部门核准证书编号">
					</el-table-column>
					<el-table-column
						prop="lendingno"
						label="股东贷款合同号">
					</el-table-column>
					<el-table-column
						prop=""
						label="操作"
						width="150">
					</el-table-column>
				</c-table>
			</div>
			<c-button plain class="add-btn" @click="add">+</c-button>
		</c-col>

		<!-- 证券投资 -->
		<c-col :span="24" v-if="showChechBox.zqtz" class="showcheckbox">
			<div class="title">证券投资信息</div>
			<div class="e-table-wrapper">
				<c-table
                :data="model.rmbmod.tdbgrp.tbelst"
					style="width: 100%"
					>
					<el-table-column
						prop="seqno"
						label="序号">
					</el-table-column>
					<el-table-column
						prop="listopertype"
						label="操作类型">
					</el-table-column>
					<el-table-column
						prop="balofpaycode"
						label="证券投资交易编码">
					</el-table-column>
					<el-table-column
						prop="amt"
						label="证券投资金额">
					</el-table-column>
					<el-table-column
						prop="certificateno"
						label="证券投资批准号">
					</el-table-column>
					<el-table-column
						prop=""
						label="操作"
						width="150">
					</el-table-column>
				</c-table>
			</div>
			<c-button plain class="add-btn" @click="add">+</c-button>
		</c-col>

		<!-- 其他投资 -->
		<c-col :span="24" v-if="showChechBox.qttz" class="showcheckbox">
			<div class="title">其他投资</div>
			<div class="e-table-wrapper">
				<c-table
                :data="model.rmbmod.tdbgrp.tbflst"
					style="width: 100%"
					>
					<el-table-column
						prop="seqno"
						label="序号">
					</el-table-column>
					<el-table-column
						prop="listopertype"
						label="操作类型">
					</el-table-column>
					<el-table-column
						prop="balofpaycode"
						label="其他投资交易编码">
					</el-table-column>
					<el-table-column
						prop="amt"
						label="其他投资金额">
					</el-table-column>
					<el-table-column
						prop="contractno"
						label="交易合同号">
					</el-table-column>
					<el-table-column
						prop=""
						label="操作"
						width="150">
					</el-table-column>
				</c-table>
			</div>
			<c-button plain class="add-btn" @click="add">+</c-button>
		</c-col>

		<!-- 跨境融资 -->
		<c-col :span="24" v-if="showChechBox.kjrz" class="showcheckbox">
			<div class="title">跨境融资信息</div>
			<div class="e-table-wrapper">
				<c-table
                :data="model.rmbmod.tdbgrp.tbglst"
					style="width: 100%"
					>
					<el-table-column
						prop="seqno"
						label="序号">
					</el-table-column>
					<el-table-column
						prop="listopertype"
						label="操作类型">
					</el-table-column>
					<el-table-column
						prop="amt"
						label="跨境融资金额">
					</el-table-column>
					<el-table-column
						prop="contractno"
						label="融资合同备案号">
					</el-table-column>
					<el-table-column
						prop="balofpaycode"
						label="跨境融资交易编码">
					</el-table-column>
					<el-table-column
						prop=""
						label="操作"
						width="150">
					</el-table-column>
				</c-table>
			</div>
			<c-button plain class="add-btn" @click="add">+</c-button>
		</c-col>

		<!-- 收益与经济转移 -->
		<c-col :span="24" v-if="showChechBox.sy" class="showcheckbox">
			<div class="title">收益与进场转移信息</div>
			<div class="e-table-wrapper">
				<c-table
                :data="model.rmbmod.tdbgrp.tbhlst"
					style="width: 100%"
					>
					<el-table-column
						prop="seqno"
						label="序号">
					</el-table-column>
					<el-table-column
						prop="listopertype"
						label="操作类型">
					</el-table-column>
					<el-table-column
						prop="contractno"
						label="交易协议号或核准证书编号">
					</el-table-column>
					<el-table-column
						prop="balofpaycode"
						label="收益及经常转移种类代码">
					</el-table-column>
					<el-table-column
						prop="amt"
						label="跨境收益与经常转移金额">
					</el-table-column>
					<el-table-column
						prop=""
						label="操作"
						width="150">
					</el-table-column>
				</c-table>
			</div>
			<c-button plain class="add-btn" @click="add">+</c-button>
		</c-col>

		<!-- 资本转移 -->
		<c-col :span="24" v-if="showChechBox.zbzy" class="showcheckbox">
			<div class="title">资本转移及非生产、非金融资产的收买和放弃</div>
			<div class="e-table-wrapper">
				<c-table
                :data="model.rmbmod.tdbgrp.tbilst"
					style="width: 100%"
					>
					<el-table-column
						prop="seqno"
						label="序号">
					</el-table-column>
					<el-table-column
						prop="listopertype"
						label="操作类型">
					</el-table-column>
					<el-table-column
						prop="contractno"
						label="交易合同号">
					</el-table-column>
					<el-table-column
						prop="balofpaycode"
						label="类型交易编码">
					</el-table-column>
					<el-table-column
						prop="amt"
						label="跨境资本转移及非生产、非金融资产的收买/放弃金额">
					</el-table-column>
					<el-table-column
						prop=""
						label="操作"
						width="150">
					</el-table-column>
				</c-table>
			</div>
			<c-button plain class="add-btn" @click="add">+</c-button>
		</c-col>


	</div>
</template>
<script>
import Api from "~/service/Api"
import CommonProcess from "~/mixin/CommonProcess"
import Utils from "~/utils"

export default {
	inject: ['root'],
	mixins: [CommonProcess],
	props: ['model', 'codes'],
	data: function () {
		return {
			showChechBox: {
				fwmy: false,
        kjrz: false,
        qttz: false,
        sr: false,
        sy: false,
        wlmx: false,
        zqtz: false,
        zjtz: false,
        zbzy: false,
        hwmy: false,
			}
		}
	},
	methods: {
		add: function () {
			console.log('add')
		},
		async getOwnref () {
			console.log('获取申报号码')
			// const rtnmsg = await Api.post("/cptopn/regmod_getref", { data: this.model })
			
			// if (rtnmsg.respCode == SUCCESS) {
			// 	// Notification.success({ message: 'cptopn/regmod_getref数据提交成功!' })
			// 	this.model.bas2_levyno = rtnmsg.data.bas2_levyno;
			// }
			// else {
			// 	Notification.error({ message: 'cptopn/regmod_getref服务端请求失败!' })
			// }

			const rtnmsg = await Api.post('/cptopn/regmod_getref', { data: Utils.flatObject(this.model) })
			if (rtnmsg.code == SUCCESS) {
				// this.model.bas2_levyno = rtnmsg.data.bas2_levyno
				this.model.rmbmod.tdbgrp.bas.levyno=rtnmsg.data.rmbmod_tdbgrp_bas_levyno
			}
			else {
				this.$notify.error({title: '错误',message: '服务请求失败！'});
			}
		},
		async handleSearch () {
			console.log('搜索')
			const rtnmsg = await Api.post('/cptopn/codsel_ctyinfsub', { data: Utils.flatObject(this.model) })
			if (rtnmsg.code == SUCCESS) {
				// this.model.bas2_levyno = rtnmsg.data.bas2_levyno
				this.model.rmbmod.tdbgrp.bas.payeecountrycode=rtnmsg.data.rmbmod_tdbgrp_bas_payeecountrycode
			}
			else {
				this.$notify.error({title: '错误',message: '服务请求失败！'});
			}
		},
	}
}
</script>

<style scoped>
.title {
	color: rgba(0, 0, 0, 0.65);
	font-size: 14px;
}
.add-btn {
	margin: 12px 0;
	text-align: center;
	width: 100%;
	color: #ccc;
}
.showcheckbox {
	margin: 20px 0 0;
}
</style>