<template>
	<view class="">
		<u-sticky offset-top="50">
			<u-subsection fontSize='25' mode='subsection' :list="list" :current="curNow" @change="sectionChange"
				activeColor='#157A2C'></u-subsection>
		</u-sticky>

		<view v-show='curNow===0'>
			<u--form style="margin: 0 20px;" labelPosition="left" :model="form" ref="uForm" labelWidth='140rpx'>
				<!-- @tap="showDeptPicker" -->
				<u-form-item label="合同类型" prop="categoryName" borderBottom>
					<u--input style="width: 100%;" disabled :value='`${form.typeName} ${form.categoryName}`'></u--input>
				</u-form-item>
				<!-- @tap="showUserPicker" -->
				<u-form-item label="合同名称" prop="contractName" borderBottom>
					<u--input style="width: 100%;" disabled v-model="form.contractName"></u--input>
					<!-- <u-icon slot="right" name="arrow-right"></u-icon> -->
				</u-form-item>
				<u-form-item label="编码" prop="contractNo" borderBottom>
					<u--input style="width: 100%;" disabled v-model="form.contractNo"></u--input>
				</u-form-item>
				<u-form-item label="编号" prop="contractNumber" borderBottom>
					<u--input style="width: 100%;" disabled v-model="form.contractNumber"></u--input>
				</u-form-item>
				<u-form-item label="签订日期" prop="contractStartDate" borderBottom>
					<u--input style="width: 100%;" disabled v-model="form.contractStartDate"></u--input>
				</u-form-item>

				<u-form-item label="结束日期" prop="contractEndDate" borderBottom>
					<u--input style="width: 100%;" disabled v-model="form.contractEndDate"></u--input>
				</u-form-item>
				<u-form-item label="结算方式" prop="settlementModeName" borderBottom>
					<u--input style="width: 100%;" disabled v-model="form.settlementModeName"></u--input>
				</u-form-item>
				<u-form-item label="附件" prop="settlementModeName" borderBottom>
				 <fileMain v-model="form.fileId" type="view"></fileMain>
				</u-form-item>
			</u--form>

		</view>
		<view v-show='curNow===1'>
			<u--form style="margin: 0 20px;" labelPosition="left" :model="form" ref="uForm" labelWidth='140rpx'>
				<u-form-item label="甲方名称" prop="partaName" borderBottom>
					<u--input style="width: 100%;" disabled :value='`${form.partaName}`'></u--input>
				</u-form-item>
				<u-form-item label="甲方代码" prop="partaUnifiedSocialCreditCode" borderBottom>
					<u--input style="width: 100%;" disabled v-model="form.partaUnifiedSocialCreditCode"></u--input>
				</u-form-item>
				<u-form-item label="甲方联系人" prop="partaLinkName" borderBottom>
					<u--input style="width: 100%;" disabled v-model="form.partaLinkName"></u--input>
				</u-form-item>
				<u-form-item label="甲方电话" prop="partaTel" borderBottom>
					<u--input style="width: 100%;" disabled v-model="form.partaTel"></u--input>
				</u-form-item>
				<u-form-item label="甲方传真" prop="partaFax" borderBottom>
					<u--input style="width: 100%;" disabled v-model="form.partaFax"></u--input>
				</u-form-item>
				<u-form-item label="甲方Email" prop="partaEmail" borderBottom>
					<u--input style="width: 100%;" disabled v-model="form.partaEmail"></u--input>
				</u-form-item>
				<u-form-item label="甲方地址" prop="partaAddress" borderBottom>
					<u--input style="width: 100%;" disabled v-model="form.partaAddress"></u--input>
				</u-form-item>


				<u-form-item label="乙方名称" prop="partbName" borderBottom>
					<u--input style="width: 100%;" disabled :value='`${form.partbName}`'></u--input>
				</u-form-item>
				<u-form-item label="乙方代码" prop="partbUnifiedSocialCreditCode" borderBottom>
					<u--input style="width: 100%;" disabled v-model="form.partbUnifiedSocialCreditCode"></u--input>
				</u-form-item>
				<u-form-item label="乙方联系人" prop="partbLinkName" borderBottom>
					<u--input style="width: 100%;" disabled v-model="form.partbLinkName"></u--input>
				</u-form-item>
				<u-form-item label="乙方电话" prop="partbTel" borderBottom>
					<u--input style="width: 100%;" disabled v-model="form.partbTel"></u--input>
				</u-form-item>
				<u-form-item label="乙方传真" prop="partbFax" borderBottom>
					<u--input style="width: 100%;" disabled v-model="form.partbFax"></u--input>
				</u-form-item>
				<u-form-item label="乙方Email" prop="partbEmail" borderBottom>
					<u--input style="width: 100%;" disabled v-model="form.partbEmail"></u--input>
				</u-form-item>
				<u-form-item label="乙方地址" prop="partbAddress" borderBottom>
					<u--input style="width: 100%;" disabled v-model="form.partbAddress"></u--input>
				</u-form-item>
			</u--form>
		</view>
		<view v-show='curNow===2'>
			<u-sticky offset-top="100">
				<u-tag
					:text="`总计: ${form.totalPrice&&form.totalPrice} 优惠总计: ${form.discountTotalPrice&&form.discountTotalPrice}`"
					size="large" type="success"></u-tag>
			</u-sticky>
			<view v-for="(item,index) in detailData['productList']" :key="index">
				<u--form style="margin: 0 20px;" labelPosition="left" :model="form" ref="uForm" labelWidth='140rpx'>
					<u-row v-for="(key,index1) in tableField" :key="index1">
						<u-col :span="12">
							<u-form-item :label="key.label" prop="categoryName" borderBottom>
								<u--input style="width: 100%;" :title='item[key.field]' disabled
									v-model="item[key.field]"></u--input>
							</u-form-item>
						</u-col>

					</u-row>
				</u--form>
				<u-gap height="40" bgColor="#f0f0f0"></u-gap>
			</view>

		</view>
		<view v-show='curNow===3'>

			<view v-for="(item,index) in detailData['receiptPaymentList']" :key="index">
				<u--form style="margin: 0 20px;" labelPosition="left" :model="form" ref="uForm" labelWidth='140rpx'>
					<u-row v-for="(key,index1) in feeTableField" :key="index1">
						<u-col :span="12">
							<u-form-item :label="key.label" prop="categoryName" borderBottom>
								<u--input style="width: 100%;" :title='item[key.field]' disabled
									v-model="item[key.field]"></u--input>
							</u-form-item>
						</u-col>

					</u-row>
				</u--form>
				<u-gap height="40" bgColor="#f0f0f0"></u-gap>
			</view>

		</view>


	</view>
</template>

<script>
	import {
		getDetail
	} from '@/api/wt/index.js'
	import fileMain from "@/pages/doc/index.vue"
	export default {
		components:{
			fileMain
		},
		props: {
			businessId: {
				default: ''
			},
			taskDefinitionKey: {
				default: ''
			},
		},
		data() {
			return {
				detailData: {},
				form: {},
				tableField: [{
						label: '类型',
						field: 'productCategoryName',
					}, {
						label: '名称',
						field: 'productName',
					},
					{
						label: '编码',
						field: 'productCode',
					},

					{
						field: 'specification',
						label: '规格',

					},
					{
						field: 'brandNo',
						label: '牌号',

					},
					{
						label: '客户代号',
						field: 'customerMark',
					},
					{
						label: '单价',
						field: 'singlePrice',
					},
					{
						label: '数量',
						field: 'totalCount',
					},
					{
						label: '合计',
						field: 'totalPrice',
					},
				],
				feeTableField: [{
						label: '款项名称',
						field: 'moneyName',
					},
					{
						label: '金额(元)',
						field: 'price',
					},
					{
						label: '比例(%)',
						field: 'ratio',
					},
					{
						label: '截止日期',
						field: 'deadLine',
					},
					{
						label: '说明',
						field: 'remark',
					}
				],
				list: ['合同信息', '基本信息', '产品清单', '付款方式'],
				curNow: 0
			}
		},
		async mounted() {
			await this.getDetailData(this.businessId);
		},
		methods: {
			sectionChange(index) {
				this.curNow = index;
			},
			async getDetailData(id) {
				const data = await getDetail(id);
				if (data) {
					data['receiptPaymentList'] = data['receiptPaymentList'].length ? data['receiptPaymentList'] : [{}]
					this.detailData = data;
					this.form = data.contractVO;
				}
			}
		}
	}
</script>

<style>
</style>