<template>
	<view class="jnpf-wrap jnpf-wrap-form" v-if="!loading">
		<u-form :model="dataForm" :rules="rules" ref="dataForm" :errorType="['toast']" label-position="left"
			label-align="left" :label-width="labelwidth" class="jnpf-form">
			<view class="u-p-l-20 u-p-r-20 ">
				<u-form-item>
					<jnpf-group value="订单类型" content="订单类型" contentPosition="left">
					</jnpf-group>
				</u-form-item>
			</view>
			<view class="u-p-l-20 u-p-r-20 form-item-box">
				<u-form-item v-if="judgeShow('orderType')" :required="requiredList.orderType" label-width="0"
					prop="orderType">
					<jnpf-radio v-model="dataForm.orderType" :disabled="judgeWrite('orderType')"
						@change="changeData('orderType',-1)" optionType="button" direction="horizontal"
						:props="orderTypeProps" :options="orderTypeOptions">
					</jnpf-radio>
				</u-form-item>
			</view>
			<view class="u-p-l-20 u-p-r-20 ">
				<u-form-item>
					<jnpf-group value="基础信息" content="基础信息" contentPosition="left">
					</jnpf-group>
				</u-form-item>
			</view>
			<view class="u-p-l-20 u-p-r-20 form-item-box">
				<u-form-item v-if="judgeShow('code')" :required="requiredList.code" label="单据编号" prop="code">
					<u-input v-model="dataForm.code" disabled @change="changeData('code',-1)" 
						placeholder="系统自动生成" :style='{"width":"100%"}' readonly>
					</u-input>
				</u-form-item>
			</view>
			<view class="u-p-l-20 u-p-r-20 form-item-box">
				<u-form-item v-if="judgeShow('businessLineId')" :required="requiredList.businessLineId" label="关联业务"
					prop="businessLineId">
					<jnpf-popup-select v-model="dataForm.businessLineId" :disabled="judgeWrite('businessLineId')"
						@change="changeData('businessLineId',-1)" :rowIndex="null" :formData="dataForm"
						:templateJson="interfaceRes.businessLineId" clearable propsValue="id" popupWidth="800px"
						popupTitle="选择数据" popupType="dialog" relationField='name' vModel='businessLineId'
						:columnOptions="businessLineIdColumnOptions" interfaceId="517979330417001669" :pageSize="20"
						placeholder="请选择" type="popup" :style='{"width":"100%"}'>
					</jnpf-popup-select>
				</u-form-item>
			</view>
			<view class="u-p-l-20 u-p-r-20 form-item-box">
				<u-form-item v-if="judgeShow('counterpartOrderCode')" :required="requiredList.counterpartOrderCode"
					label="对方订单号" prop="counterpartOrderCode">
					<u-input v-model="dataForm.counterpartOrderCode" :disabled="judgeWrite('counterpartOrderCode')"
						@change="changeData('counterpartOrderCode',-1)"  clearable placeholder="请输入"
						:style='{"width":"100%"}'>
					</u-input>
				</u-form-item>
			</view>
			<view class="u-p-l-20 u-p-r-20 form-item-box">
				<u-form-item v-if="judgeShow('urgentOrder')" :required="requiredList.urgentOrder" label="是否紧急"
					prop="urgentOrder">
					<jnpf-radio v-model="dataForm.urgentOrder" :disabled="judgeWrite('urgentOrder')"
						@change="changeData('urgentOrder',-1)" optionType="default" direction="horizontal"
						:props="urgentOrderProps" :options="urgentOrderOptions">
					</jnpf-radio>
				</u-form-item>
			</view>

			<view class="u-p-l-20 u-p-r-20 form-item-box">
				<u-form-item v-if="judgeShow('expectArriveDateStart')" :required="requiredList.expectArriveDateStart"
					label="期望送达" prop="expectArriveDateStart">
					<jnpf-date-time v-model="dataForm.expectArriveDateStart"
						:disabled="judgeWrite('expectArriveDateStart')" @change="changeData('expectArriveDateStart',-1)"
						:startTime="dateTime(false,1,1,'','')" :endTime="dateTime(false,1,1,'','')" format="yyyy-MM-dd"
						clearable placeholder="请选择" type="date" :style='{"width":"100%"}'>
					</jnpf-date-time>
				</u-form-item>
			</view>
			<view class="u-p-l-20 u-p-r-20 form-item-box">
				<u-form-item v-if="judgeShow('createOrderDate')" :required="requiredList.createOrderDate" label="制单时间"
					prop="createOrderDate">
					<jnpf-open-data v-model="dataForm.createOrderDate" disabled
						@change="changeData('createOrderDate',-1)" placeholder="系统自动生成" type="currTime"
						:style='{"width":"100%"}' readonly>
					</jnpf-open-data>
				</u-form-item>
			</view>
			<view class="u-p-l-20 u-p-r-20 form-item-box">
				<u-form-item v-if="judgeShow('deliveryType')" :required="requiredList.deliveryType" label="配送方式"
					prop="deliveryType">
					<jnpf-select v-model="dataForm.deliveryType" :disabled="judgeWrite('deliveryType')"
						@change="changeData('deliveryType',-1)" clearable placeholder="请选择" :props="deliveryTypeProps"
						:options="deliveryTypeOptions" :style='{"width":"100%"}'>
					</jnpf-select>
				</u-form-item>
			</view>
			<view class="u-p-l-20 u-p-r-20 ">
				<u-form-item>
					<jnpf-group value="关联信息" content="关联信息" contentPosition="left">
					</jnpf-group>
				</u-form-item>
			</view>
			<view class="u-p-l-20 u-p-r-20 form-item-box">
				<u-form-item v-if="judgeShow('contractId')" :required="requiredList.contractId" label="关联合同"
					prop="contractId">
					<jnpf-popup-select v-model="dataForm.contractId" :disabled="judgeWrite('contractId')"
						@change="changeData('contractId',-1)" :rowIndex="null" :formData="dataForm"
						:templateJson="interfaceRes.contractId" clearable propsValue="id" popupWidth="800px"
						popupTitle="选择数据" popupType="dialog" relationField='contract_name' vModel='contractId'
						:columnOptions="contractIdColumnOptions" interfaceId="523139566396246597" :pageSize="20"
						placeholder="请选择" type="popup" :style='{"width":"100%"}'>
					</jnpf-popup-select>
				</u-form-item>
			</view>
			<view class="u-p-l-20 u-p-r-20 ">
				<u-form-item>
					<jnpf-group value="详细信息" content="详细信息" contentPosition="left">
					</jnpf-group>
				</u-form-item>
			</view>
			<view class="u-p-l-20 u-p-r-20 form-item-box">
				<u-form-item v-if="judgeShow('currency')" :required="requiredList.currency" label="币种" prop="currency">
					<jnpf-select v-model="dataForm.currency" :disabled="judgeWrite('currency')"
						@change="changeData('currency',-1)" clearable placeholder="请选择" :props="currencyProps"
						:options="currencyOptions" :style='{"width":"100%"}'>
					</jnpf-select>
				</u-form-item>
			</view>
			<view class="u-p-l-20 u-p-r-20 form-item-box">
				<u-form-item v-if="judgeShow('saleMode')" :required="requiredList.saleMode" label="销售模式"
					prop="saleMode">
					<jnpf-select v-model="dataForm.saleMode" :disabled="judgeWrite('saleMode')"
						@change="changeData('saleMode',-1)" clearable placeholder="请选择" :props="saleModeProps"
						:options="saleModeOptions" :style='{"width":"100%"}'>
					</jnpf-select>
				</u-form-item>
			</view>
			<view class="u-p-l-20 u-p-r-20 form-item-box">
				<u-form-item v-if="judgeShow('correlatedOrderId')" :required="requiredList.correlatedOrderId"
					label="关联采购" prop="correlatedOrderId">
					<jnpf-popup-select v-model="dataForm.correlatedOrderId" :disabled="judgeWrite('correlatedOrderId')"
						@change="changeData('correlatedOrderId',-1)" :rowIndex="null" :formData="dataForm"
						:templateJson="interfaceRes.correlatedOrderId" clearable propsValue="id" popupWidth="800px"
						popupTitle="选择数据" popupType="dialog" relationField='code' vModel='correlatedOrderId'
						:columnOptions="correlatedOrderIdColumnOptions" interfaceId="522687073317030149" :pageSize="20"
						placeholder="请选择" type="popup" :style='{"width":"100%"}'>
					</jnpf-popup-select>
				</u-form-item>
			</view>
			<view class="u-p-l-20 u-p-r-20 form-item-box">
				<u-form-item v-if="judgeShow('fixPriceMode')" :required="requiredList.fixPriceMode" label="定价模式"
					prop="fixPriceMode">
					<jnpf-select v-model="dataForm.fixPriceMode" :disabled="judgeWrite('fixPriceMode')"
						@change="changeData('fixPriceMode',-1)" clearable placeholder="请选择" :props="fixPriceModeProps"
						:options="fixPriceModeOptions" :style='{"width":"100%"}'>
					</jnpf-select>
				</u-form-item>
			</view>
			<view class="u-p-l-20 u-p-r-20 form-item-box">
				<u-form-item v-if="judgeShow('secondSubjectBasicId')" :required="requiredList.secondSubjectBasicId"
					label="二级客户" prop="secondSubjectBasicId">
					<jnpf-popup-select v-model="dataForm.secondSubjectBasicId"
						:disabled="judgeWrite('secondSubjectBasicId')" @change="changeData('secondSubjectBasicId',-1)"
						:rowIndex="null" :formData="dataForm" :templateJson="interfaceRes.secondSubjectBasicId"
						clearable propsValue="id" popupWidth="800px" popupTitle="选择数据" popupType="dialog"
						relationField='name' vModel='secondSubjectBasicId'
						:columnOptions="secondSubjectBasicIdColumnOptions" interfaceId="522692511710316805"
						:pageSize="20" placeholder="请选择" type="popup" :style='{"width":"100%"}'>
					</jnpf-popup-select>
				</u-form-item>
			</view>
			<view class="u-p-l-20 u-p-r-20 ">
				<u-form-item>
					<jnpf-group value="收货信息" content="收货信息" contentPosition="left">
					</jnpf-group>
				</u-form-item>
			</view>
			<view class="u-p-l-20 u-p-r-20 form-item-box">
				<u-form-item v-if="judgeShow('firstSubjectBasicId')" :required="requiredList.firstSubjectBasicId"
					label="一级客户" prop="firstSubjectBasicId">
					<jnpf-popup-select v-model="dataForm.firstSubjectBasicId"
						:disabled="judgeWrite('firstSubjectBasicId')" @change="changeData('firstSubjectBasicId',-1)"
						:rowIndex="null" :formData="dataForm" :templateJson="interfaceRes.firstSubjectBasicId" clearable
						propsValue="id" popupWidth="800px" popupTitle="选择数据" popupType="dialog" relationField='name'
						vModel='firstSubjectBasicId' :columnOptions="firstSubjectBasicIdColumnOptions"
						interfaceId="522693551289534725" :pageSize="20" placeholder="请选择" type="popup"
						:style='{"width":"100%"}'>
					</jnpf-popup-select>
				</u-form-item>
			</view>
			<view class="u-p-l-20 u-p-r-20 form-item-box">
				<u-form-item v-if="judgeShow('transactionMode')" :required="requiredList.transactionMode" label="交货方式"
					prop="transactionMode">
					<jnpf-select v-model="dataForm.transactionMode" :disabled="judgeWrite('transactionMode')"
						@change="changeData('transactionMode',-1)" clearable placeholder="请选择"
						:props="transactionModeProps" :options="transactionModeOptions" :style='{"width":"100%"}'>
					</jnpf-select>
				</u-form-item>
			</view>
			<view class="u-p-l-20 u-p-r-20 form-item-box">
				<u-form-item v-if="judgeShow('receiveAddress')" :required="requiredList.receiveAddress" label="收货地址"
					prop="receiveAddress">
					<u-input v-model="dataForm.receiveAddress" :disabled="judgeWrite('receiveAddress')"
						@change="changeData('receiveAddress',-1)"  clearable placeholder="请输入"
						:style='{"width":"100%"}'>
					</u-input>
				</u-form-item>
			</view>
			<view class="u-p-l-20 u-p-r-20 ">
				<u-form-item>
					<jnpf-group value="发货信息" content="发货信息" contentPosition="left">
					</jnpf-group>
				</u-form-item>
			</view>
			<view class="u-p-l-20 u-p-r-20 form-item-box">
				<u-form-item v-if="judgeShow('enterpriseId')" :required="requiredList.enterpriseId" label="机构名称"
					prop="enterpriseId">
					<jnpf-popup-select v-model="dataForm.enterpriseId" :disabled="judgeWrite('enterpriseId')"
						@change="changeData('enterpriseId',-1)" :rowIndex="null" :formData="dataForm"
						:templateJson="interfaceRes.enterpriseId" clearable propsValue="f_id" popupWidth="800px"
						popupTitle="选择数据" popupType="dialog" relationField='f_full_name' vModel='enterpriseId'
						:columnOptions="enterpriseIdColumnOptions" interfaceId="522729853024209157" :pageSize="20"
						placeholder="请选择" type="popup" :style='{"width":"100%"}'>
					</jnpf-popup-select>
				</u-form-item>
			</view>
			<view class="u-p-l-20 u-p-r-20 form-item-box">
				<u-form-item v-if="judgeShow('deliveryWarehouse')" :required="requiredList.deliveryWarehouse"
					label="发货仓库" prop="deliveryWarehouse">
					<jnpf-popup-select v-model="dataForm.deliveryWarehouse" :disabled="judgeWrite('deliveryWarehouse')"
						@change="changeData('deliveryWarehouse',-1)" :rowIndex="null" :formData="dataForm"
						:templateJson="interfaceRes.deliveryWarehouse" clearable propsValue="id" popupWidth="800px"
						popupTitle="选择数据" popupType="dialog" relationField='name' vModel='deliveryWarehouse'
						:columnOptions="deliveryWarehouseColumnOptions" interfaceId="522701377537837317" :pageSize="20"
						placeholder="请选择" type="popup" :style='{"width":"100%"}'>
					</jnpf-popup-select>
				</u-form-item>
			</view>
			<view class="u-p-l-20 u-p-r-20 form-item-box">
				<u-form-item v-if="judgeShow('deliveryAddress')" :required="requiredList.deliveryAddress" label="发货地址"
					prop="deliveryAddress">
					<jnpf-popup-select v-model="dataForm.deliveryAddress" :disabled="judgeWrite('deliveryAddress')"
						@change="changeData('deliveryAddress',-1)" :rowIndex="null" :formData="dataForm"
						:templateJson="interfaceRes.deliveryAddress" clearable propsValue="id" popupWidth="800px"
						popupTitle="选择数据" popupType="dialog" relationField='addressDetail' vModel='deliveryAddress'
						:columnOptions="deliveryAddressColumnOptions" interfaceId="522724961224231173" :pageSize="20"
						placeholder="请选择" type="popup" :style='{"width":"100%"}'>
					</jnpf-popup-select>
				</u-form-item>
			</view>
			<view class="u-p-l-20 u-p-r-20 ">
				<u-form-item>
					<jnpf-group value="运输信息" content="运输信息" contentPosition="left">
					</jnpf-group>
				</u-form-item>
			</view>
			<view class="u-p-l-20 u-p-r-20 form-item-box">
				<u-form-item v-if="judgeShow('transportMode')" :required="requiredList.transportMode" label="运输方式"
					prop="transportMode">
					<jnpf-select v-model="dataForm.transportMode" :disabled="judgeWrite('transportMode')"
						@change="changeData('transportMode',-1)" clearable placeholder="请选择" :props="transportModeProps"
						:options="transportModeOptions" :style='{"width":"100%"}'>
					</jnpf-select>
				</u-form-item>
			</view>
			<view class="u-p-l-20 u-p-r-20 ">
				<u-form-item>
					<jnpf-group value="结算信息" content="结算信息" contentPosition="left">
					</jnpf-group>
				</u-form-item>
			</view>
			<view class="jnpf-table" v-if="judgeShow('settlementinfoList')">
				<view class="jnpf-table-item" v-for="(item,i) in dataForm.settlementinfoList" :key="i">
					<view class="jnpf-table-item-title u-flex u-row-between">
						<text class="jnpf-table-item-title-num">({{i+1}})</text>
						<view class="jnpf-table-item-title-action"
							v-if=" !judgeWrite('settlementinfoList') && dataForm.settlementinfoList.length>0"
							@click="delsettlementinfoList(i)">删除</view>
					</view>
					<view class="u-p-l-20 u-p-r-20 form-item-box">
						<u-form-item v-if="judgeShow('settlementinfoList-subjectBasicId')"
							:required="requiredList['settlementinfoList-subjectBasicId']" label="客户名称">
							<u-input v-model="dataForm.settlementinfoList[i].subjectBasicId"
								:disabled="judgeWrite('settlementinfoList')||judgeWrite('settlementinfoList-subjectBasicId')"
								@change="changeData('settlementinfo-subjectBasicId',i)"  clearable
								placeholder="请输入" :style='{"width":"100%"}'>
							</u-input>
						</u-form-item>
					</view>
					<view class="u-p-l-20 u-p-r-20 form-item-box">
						<u-form-item v-if="judgeShow('settlementinfoList-paymentMethod')"
							:required="requiredList['settlementinfoList-paymentMethod']" label="付款方式">
							<jnpf-select v-model="dataForm.settlementinfoList[i].paymentMethod"
								:disabled="judgeWrite('settlementinfoList')||judgeWrite('settlementinfoList-paymentMethod')"
								@change="changeData('settlementinfo-paymentMethod',i)" clearable placeholder="请选择"
								:props="settlementinfopaymentMethodProps" :options="settlementinfopaymentMethodOptions"
								:style='{"width":"100%"}'>
							</jnpf-select>
						</u-form-item>
					</view>
					<view class="u-p-l-20 u-p-r-20 form-item-box">
						<u-form-item v-if="judgeShow('settlementinfoList-collaborationMethod')"
							:required="requiredList['settlementinfoList-collaborationMethod']" label="合作方式">
							<jnpf-select v-model="dataForm.settlementinfoList[i].collaborationMethod"
								:disabled="judgeWrite('settlementinfoList')||judgeWrite('settlementinfoList-collaborationMethod')"
								@change="changeData('settlementinfo-collaborationMethod',i)" clearable placeholder="请选择"
								:props="settlementinfocollaborationMethodProps"
								:options="settlementinfocollaborationMethodOptions" :style='{"width":"100%"}'>
							</jnpf-select>
						</u-form-item>
					</view>
					<view class="u-p-l-20 u-p-r-20 form-item-box">
						<u-form-item v-if="judgeShow('settlementinfoList-settlementMethod')"
							:required="requiredList['settlementinfoList-settlementMethod']" label="结算方式">
							<jnpf-select v-model="dataForm.settlementinfoList[i].settlementMethod"
								:disabled="judgeWrite('settlementinfoList')||judgeWrite('settlementinfoList-settlementMethod')"
								@change="changeData('settlementinfo-settlementMethod',i)" clearable placeholder="请选择"
								:props="settlementinfosettlementMethodProps"
								:options="settlementinfosettlementMethodOptions" :style='{"width":"100%"}'>
							</jnpf-select>
						</u-form-item>
					</view>
					<view class="u-p-l-20 u-p-r-20 form-item-box">
						<u-form-item v-if="judgeShow('settlementinfoList-advanceRatio')"
							:required="requiredList['settlementinfoList-advanceRatio']" label="预付比例">
							<u-input v-model="dataForm.settlementinfoList[i].advanceRatio"
								:disabled="judgeWrite('settlementinfoList')||judgeWrite('settlementinfoList-advanceRatio')"
								@change="changeData('settlementinfo-advanceRatio',i)"  clearable
								placeholder="请输入" :style='{"width":"100%"}'>
							</u-input>
						</u-form-item>
					</view>
					<view class="u-p-l-20 u-p-r-20 form-item-box">
						<u-form-item v-if="judgeShow('settlementinfoList-accountPeriod')"
							:required="requiredList['settlementinfoList-accountPeriod']" label="账期">
							<u-input v-model="dataForm.settlementinfoList[i].accountPeriod"
								:disabled="judgeWrite('settlementinfoList')||judgeWrite('settlementinfoList-accountPeriod')"
								@change="changeData('settlementinfo-accountPeriod',i)"  clearable
								placeholder="请输入" :style='{"width":"100%"}'>
							</u-input>
						</u-form-item>
					</view>
					<view class="u-p-l-20 u-p-r-20 form-item-box">
						<u-form-item v-if="judgeShow('settlementinfoList-underpaymentMethod')"
							:required="requiredList['settlementinfoList-underpaymentMethod']" label="压款方式">
							<jnpf-select v-model="dataForm.settlementinfoList[i].underpaymentMethod"
								:disabled="judgeWrite('settlementinfoList')||judgeWrite('settlementinfoList-underpaymentMethod')"
								@change="changeData('settlementinfo-underpaymentMethod',i)" clearable placeholder="请选择"
								:props="settlementinfounderpaymentMethodProps"
								:options="settlementinfounderpaymentMethodOptions" :style='{"width":"100%"}'>
							</jnpf-select>
						</u-form-item>
					</view>
					<view class="u-p-l-20 u-p-r-20 form-item-box">
						<u-form-item v-if="judgeShow('settlementinfoList-marginMethod')"
							:required="requiredList['settlementinfoList-marginMethod']" label="保证金方式">
							<jnpf-select v-model="dataForm.settlementinfoList[i].marginMethod"
								:disabled="judgeWrite('settlementinfoList')||judgeWrite('settlementinfoList-marginMethod')"
								@change="changeData('settlementinfo-marginMethod',i)" clearable placeholder="请选择"
								:props="settlementinfomarginMethodProps" :options="settlementinfomarginMethodOptions"
								:style='{"width":"100%"}'>
							</jnpf-select>
						</u-form-item>
					</view>
					<view class="u-p-l-20 u-p-r-20 form-item-box">
						<u-form-item v-if="judgeShow('settlementinfoList-overdueInterestRate')"
							:required="requiredList['settlementinfoList-overdueInterestRate']" label="逾期利率">
							<jnpf-select v-model="dataForm.settlementinfoList[i].overdueInterestRate"
								:disabled="judgeWrite('settlementinfoList')||judgeWrite('settlementinfoList-overdueInterestRate')"
								@change="changeData('settlementinfo-overdueInterestRate',i)" clearable placeholder="请选择"
								:props="settlementinfooverdueInterestRateProps"
								:options="settlementinfooverdueInterestRateOptions" :style='{"width":"100%"}'>
							</jnpf-select>
						</u-form-item>
					</view>
					<view class="u-p-l-20 u-p-r-20 form-item-box">
						<u-form-item v-if="judgeShow('settlementinfoList-applyForUnderpaymentRatio')"
							:required="requiredList['settlementinfoList-applyForUnderpaymentRatio']" label="申请压款金额/比例">
							<u-input v-model="dataForm.settlementinfoList[i].applyForUnderpaymentRatio"
								:disabled="judgeWrite('settlementinfoList')||judgeWrite('settlementinfoList-applyForUnderpaymentRatio')"
								@change="changeData('settlementinfo-applyForUnderpaymentRatio',i)" 
								clearable placeholder="请输入" :style='{"width":"100%"}'>
							</u-input>
						</u-form-item>
					</view>
					<view class="u-p-l-20 u-p-r-20 form-item-box">
						<u-form-item v-if="judgeShow('settlementinfoList-applyForMarginRatio')"
							:required="requiredList['settlementinfoList-applyForMarginRatio']" label="申请保证金额/比例">
							<u-input v-model="dataForm.settlementinfoList[i].applyForMarginRatio"
								:disabled="judgeWrite('settlementinfoList')||judgeWrite('settlementinfoList-applyForMarginRatio')"
								@change="changeData('settlementinfo-applyForMarginRatio',i)" 
								clearable placeholder="请输入" :style='{"width":"100%"}'>
							</u-input>
						</u-form-item>
					</view>
					<view class="u-p-l-20 u-p-r-20 form-item-box">
						<u-form-item v-if="judgeShow('settlementinfoList-applyForOverdueRatio')"
							:required="requiredList['settlementinfoList-applyForOverdueRatio']" label="申请逾期利率">
							<u-input v-model="dataForm.settlementinfoList[i].applyForOverdueRatio"
								:disabled="judgeWrite('settlementinfoList')||judgeWrite('settlementinfoList-applyForOverdueRatio')"
								@change="changeData('settlementinfo-applyForOverdueRatio',i)" 
								clearable placeholder="请输入" :style='{"width":"100%"}'>
							</u-input>
						</u-form-item>
					</view>
				</view>
				<view class="jnpf-table-addBtn" @click="addsettlementinfoList" v-if="!judgeWrite('settlementinfoList')">
					<u-icon name="plus" color="#2979ff"></u-icon>
					<span>{{dataForm.settlementinfoList.length==0?"添加":"添加"}}</span>
				</view>
			</view>
			<view class="u-p-l-20 u-p-r-20 ">
				<u-form-item>
					<jnpf-group value="其他信息" content="其他信息" contentPosition="left">
					</jnpf-group>
				</u-form-item>
			</view>
			<view class="u-p-l-20 u-p-r-20 form-item-box">
				<u-form-item v-if="judgeShow('remark')" :required="requiredList.remark" label="备注" prop="remark">
					<u-input v-model="dataForm.remark" :disabled="judgeWrite('remark')"
						@change="changeData('remark',-1)"  placeholder="请输入" type="textarea"
						:style='{"width":"100%"}'>
					</u-input>
				</u-form-item>
			</view>
			<view class="u-p-l-20 u-p-r-20 ">
				<u-form-item>
					<jnpf-group value="商品信息" content="商品信息" contentPosition="left">
					</jnpf-group>
				</u-form-item>
			</view>
			<view class="jnpf-table" v-if="judgeShow('businessorderproductrelationalList')">
				<view class="jnpf-table-item" v-for="(item,i) in dataForm.businessorderproductrelationalList" :key="i">
					<view class="jnpf-table-item-title u-flex u-row-between">
						<text class="jnpf-table-item-title-num">({{i+1}})</text>
						<view class="jnpf-table-item-title-action"
							v-if=" !judgeWrite('businessorderproductrelationalList') && dataForm.businessorderproductrelationalList.length>0"
							@click="delbusinessorderproductrelationalList(i)">删除</view>
					</view>
					<view class="u-p-l-20 u-p-r-20 form-item-box">
						<u-form-item v-if="judgeShow('businessorderproductrelationalList-productId')"
							:required="requiredList['businessorderproductrelationalList-productId']" label="商品名称">
							<jnpf-popup-select v-model="dataForm.businessorderproductrelationalList[i].productId"
								:disabled="judgeWrite('businessorderproductrelationalList')||judgeWrite('businessorderproductrelationalList-productId')"
								@change="changeData('businessorderproductrelational-productId',i)" :rowIndex="i"
								:formData="dataForm"
								:templateJson="interfaceRes.businessorderproductrelationalproductId" clearable
								propsValue="id" popupWidth="800px" popupTitle="选择数据" popupType="dialog"
								relationField='commodity_name' :vModel="'productId'+i"
								:columnOptions="businessorderproductrelationalproductIdColumnOptions"
								interfaceId="523160915206474309" :pageSize="20" placeholder="请选择" type="popup"
								:style='{"width":"100%"}'>
							</jnpf-popup-select>
						</u-form-item>
					</view>
					<view class="u-p-l-20 u-p-r-20 form-item-box">
						<u-form-item v-if="judgeShow('businessorderproductrelationalList-spec')"
							:required="requiredList['businessorderproductrelationalList-spec']" label="规格">
							<u-input v-model="dataForm.businessorderproductrelationalList[i].spec"
								:disabled="judgeWrite('businessorderproductrelationalList')||judgeWrite('businessorderproductrelationalList-spec')"
								@change="changeData('businessorderproductrelational-spec',i)" 
								clearable placeholder="请输入" :style='{"width":"100%"}'>
							</u-input>
						</u-form-item>
					</view>
					<view class="u-p-l-20 u-p-r-20 form-item-box">
						<u-form-item v-if="judgeShow('businessorderproductrelationalList-inventoryUnitId')"
							:required="requiredList['businessorderproductrelationalList-inventoryUnitId']" label="库存单位">
							<u-input v-model="dataForm.businessorderproductrelationalList[i].inventoryUnitId"
								:disabled="judgeWrite('businessorderproductrelationalList')||judgeWrite('businessorderproductrelationalList-inventoryUnitId')"
								@change="changeData('businessorderproductrelational-inventoryUnitId',i)"
								  clearable placeholder="请输入" :style='{"width":"100%"}'>
							</u-input>
						</u-form-item>
					</view>
					<view class="u-p-l-20 u-p-r-20 form-item-box">
						<u-form-item v-if="judgeShow('businessorderproductrelationalList-realBound')"
							:required="requiredList['businessorderproductrelationalList-realBound']" label="实物库存">
							<u-input v-model="dataForm.businessorderproductrelationalList[i].realBound"
								:disabled="judgeWrite('businessorderproductrelationalList')||judgeWrite('businessorderproductrelationalList-realBound')"
								@change="changeData('businessorderproductrelational-realBound',i)" 
								clearable placeholder="请输入" :style='{"width":"100%"}'>
							</u-input>
						</u-form-item>
					</view>
					<view class="u-p-l-20 u-p-r-20 form-item-box">
						<u-form-item v-if="judgeShow('businessorderproductrelationalList-useBound')"
							:required="requiredList['businessorderproductrelationalList-useBound']" label="可用库存">
							<u-input v-model="dataForm.businessorderproductrelationalList[i].useBound"
								:disabled="judgeWrite('businessorderproductrelationalList')||judgeWrite('businessorderproductrelationalList-useBound')"
								@change="changeData('businessorderproductrelational-useBound',i)" 
								clearable placeholder="请输入" :style='{"width":"100%"}'>
							</u-input>
						</u-form-item>
					</view>
					<view class="u-p-l-20 u-p-r-20 form-item-box">
						<u-form-item v-if="judgeShow('businessorderproductrelationalList-salesMainUnitId')"
							:required="requiredList['businessorderproductrelationalList-salesMainUnitId']" label="销售单位">
							<jnpf-select v-model="dataForm.businessorderproductrelationalList[i].salesMainUnitId"
								:disabled="judgeWrite('businessorderproductrelationalList')||judgeWrite('businessorderproductrelationalList-salesMainUnitId')"
								@change="changeData('businessorderproductrelational-salesMainUnitId',i)" clearable
								placeholder="请选择" :props="businessorderproductrelationalsalesMainUnitIdProps"
								:options="businessorderproductrelationalsalesMainUnitIdOptions"
								:style='{"width":"100%"}'>
							</jnpf-select>
						</u-form-item>
					</view>
					<view class="u-p-l-20 u-p-r-20 form-item-box">
						<u-form-item v-if="judgeShow('businessorderproductrelationalList-businessNum')"
							:required="requiredList['businessorderproductrelationalList-businessNum']" label="业务数量">
							<u-input v-model="dataForm.businessorderproductrelationalList[i].businessNum"
								:disabled="judgeWrite('businessorderproductrelationalList')||judgeWrite('businessorderproductrelationalList-businessNum')"
								@change="changeData('businessorderproductrelational-businessNum',i)" 
								addonAfter="吨" clearable placeholder="请输入" :style='{"width":"100%"}'>
							</u-input>
						</u-form-item>
					</view>
					<view class="u-p-l-20 u-p-r-20 form-item-box">
						<u-form-item v-if="judgeShow('businessorderproductrelationalList-businessPrice')"
							:required="requiredList['businessorderproductrelationalList-businessPrice']" label="业务单价">
							<u-input v-model="dataForm.businessorderproductrelationalList[i].businessPrice"
								:disabled="judgeWrite('businessorderproductrelationalList')||judgeWrite('businessorderproductrelationalList-businessPrice')"
								@change="changeData('businessorderproductrelational-businessPrice',i)"
								  addonAfter="吨" clearable placeholder="请输入"
								:style='{"width":"100%"}'>
							</u-input>
						</u-form-item>
					</view>
					<view class="u-p-l-20 u-p-r-20 form-item-box">
						<u-form-item v-if="judgeShow('businessorderproductrelationalList-tax')"
							:required="requiredList['businessorderproductrelationalList-tax']" label="税率">
							<u-input v-model="dataForm.businessorderproductrelationalList[i].tax"
								:disabled="judgeWrite('businessorderproductrelationalList')||judgeWrite('businessorderproductrelationalList-tax')"
								@change="changeData('businessorderproductrelational-tax',i)" 
								clearable placeholder="请输入" :style='{"width":"100%"}'>
							</u-input>
						</u-form-item>
					</view>
					<view class="u-p-l-20 u-p-r-20 form-item-box">
						<u-form-item v-if="judgeShow('businessorderproductrelationalList-taxCount')"
							:required="requiredList['businessorderproductrelationalList-taxCount']" label="含税小计">
							<u-input v-model="dataForm.businessorderproductrelationalList[i].taxCount"
								:disabled="judgeWrite('businessorderproductrelationalList')||judgeWrite('businessorderproductrelationalList-taxCount')"
								@change="changeData('businessorderproductrelational-taxCount',i)" 
								clearable placeholder="请输入" :style='{"width":"100%"}'>
							</u-input>
						</u-form-item>
					</view>
					<view class="u-p-l-20 u-p-r-20 form-item-box">
						<u-form-item v-if="judgeShow('businessorderproductrelationalList-notTaxPrice')"
							:required="requiredList['businessorderproductrelationalList-notTaxPrice']" label="不含税单价">
							<u-input v-model="dataForm.businessorderproductrelationalList[i].notTaxPrice"
								:disabled="judgeWrite('businessorderproductrelationalList')||judgeWrite('businessorderproductrelationalList-notTaxPrice')"
								@change="changeData('businessorderproductrelational-notTaxPrice',i)" 
								clearable placeholder="请输入" :style='{"width":"100%"}'>
							</u-input>
						</u-form-item>
					</view>
					<view class="u-p-l-20 u-p-r-20 form-item-box">
						<u-form-item v-if="judgeShow('businessorderproductrelationalList-notTaxCount')"
							:required="requiredList['businessorderproductrelationalList-notTaxCount']" label="不含税小计">
							<u-input v-model="dataForm.businessorderproductrelationalList[i].notTaxCount"
								:disabled="judgeWrite('businessorderproductrelationalList')||judgeWrite('businessorderproductrelationalList-notTaxCount')"
								@change="changeData('businessorderproductrelational-notTaxCount',i)" 
								clearable placeholder="请输入" :style='{"width":"100%"}'>
							</u-input>
						</u-form-item>
					</view>
					<view class="u-p-l-20 u-p-r-20 form-item-box">
						<u-form-item v-if="judgeShow('businessorderproductrelationalList-lastSalePrice')"
							:required="requiredList['businessorderproductrelationalList-lastSalePrice']"
							label="上一次销售单价">
							<u-input v-model="dataForm.businessorderproductrelationalList[i].lastSalePrice"
								:disabled="judgeWrite('businessorderproductrelationalList')||judgeWrite('businessorderproductrelationalList-lastSalePrice')"
								@change="changeData('businessorderproductrelational-lastSalePrice',i)"
								  clearable placeholder="请输入" :style='{"width":"100%"}'>
							</u-input>
						</u-form-item>
					</view>
				</view>
				<view class="jnpf-table-addBtn" @click="addbusinessorderproductrelationalList"
					v-if="!judgeWrite('businessorderproductrelationalList')">
					<u-icon name="plus" color="#2979ff"></u-icon>
					<span>{{dataForm.businessorderproductrelationalList.length==0?"添加":"添加"}}</span>
				</view>
			</view>
			<view class="u-p-l-20 u-p-r-20 form-item-box">
				<u-form-item v-if="judgeShow('status')" :required="requiredList.status" label="状态" prop="status">
					<jnpf-select v-model="dataForm.status" :disabled="judgeWrite('status')"
						@change="changeData('status',-1)" clearable placeholder="请选择" :props="statusProps"
						:options="statusOptions" :style='{"width":"100%"}'>
					</jnpf-select>
				</u-form-item>
			</view>
		</u-form>
		<u-modal v-model="show" :content="content" width='70%' border-radius="16"
			:content-style="{fontSize: '28rpx',padding: '20rpx',lineHeight: '44rpx',textAlign: 'left'}"
			:titleStyle="{padding: '20rpx'}" :confirm-style="{height: '80rpx',lineHeight: '80rpx'}" :title="title"
			confirm-text="确定">
		</u-modal>
	</view>
</template>

<script>
	import {
		getDictionaryDataSelector,
		getDataInterfaceRes,
		getDefaultCurrentValueUserId,
		getDefaultCurrentValueDepartmentId
	} from '@/api/common'
	import comMixin from '../../../workFlow/workFlowForm/mixin'
	import {
		getDateDay,
		getLaterData,
		getBeforeData,
		getBeforeTime,
		getLaterTime
	} from '@/components/index.js'
	import request from '@/utils/request'
	export default {
		mixins: [comMixin],
		data() {
			return {
				idList: [],
				index: 0,
				actionList: [],
				actionListLength: false,
				showAction: false,
				btnLoading: false,
				loading: false,
				text: '提示：测试文本',
				tableKey: '',
				dataForm: {
					id: "",
					orderType: "2",
					code: '',
					businessLineId: "",
					counterpartOrderCode: '',
					urgentOrder: "1",
					expectArriveDateStart: '',
					createOrderDate: "",
					deliveryType: "",
					contractId: "",
					currency: "",
					saleMode: "",
					correlatedOrderId: "",
					fixPriceMode: "",
					secondSubjectBasicId: "",
					firstSubjectBasicId: "",
					transactionMode: "",
					receiveAddress: '',
					enterpriseId: "",
					deliveryWarehouse: "",
					deliveryAddress: "",
					transportMode: "",
					remark: '',
					status: "",
					settlementinfoList: [],
					businessorderproductrelationalList: [],
				},
				rules: {
					businessLineId: [{
						required: true,
						message: '关联业务请选择',
					}, ],
					urgentOrder: [{
						required: true,
						message: '是否紧急请至少选择一个',
					}, ],
					expectArriveDateStart: [{
						required: true,
						message: '期望送达请选择',
					}, ],
					deliveryType: [{
						required: true,
						message: '配送方式请选择',
					}, ],
					currency: [{
						required: true,
						message: '币种请选择',
					}, ],
					saleMode: [{
						required: true,
						message: '销售模式请选择',
					}, ],
					correlatedOrderId: [{
						required: true,
						message: '关联采购请选择',
					}, ],
					fixPriceMode: [{
						required: true,
						message: '定价模式请选择',
					}, ],
					secondSubjectBasicId: [{
						required: true,
						message: '二级客户请选择',
					}, ],
					firstSubjectBasicId: [{
						required: true,
						message: '一级客户请选择',
					}, ],
					transactionMode: [{
						required: true,
						message: '交货方式请选择',
					}, ],
					receiveAddress: [{
						required: true,
						message: '收货地址请输入',
					}, ],
					enterpriseId: [{
						required: true,
						message: '机构名称请选择',
					}, ],
					deliveryWarehouse: [{
						required: true,
						message: '发货仓库请选择',
					}, ],
					deliveryAddress: [{
						required: true,
						message: '发货地址请选择',
					}, ],
					transportMode: [{
						required: true,
						message: '运输方式请选择',
					}, ],
				},
				orderTypeOptions: [{
					"fullName": "标准销售",
					"id": "1"
				}, {
					"fullName": "合同销售",
					"id": "2"
				}],
				orderTypeProps: {
					"label": "fullName",
					"value": "id",
					"multiple": false,
					"children": ""
				},
				businessLineIdColumnOptions: [{
						"label": "业务线编码",
						"value": "code"
					},
					{
						"label": "业务线名称",
						"value": "name"
					},
				],
				urgentOrderOptions: [{
					"fullName": "否",
					"id": "1"
				}, {
					"fullName": "是",
					"id": "2"
				}],
				urgentOrderProps: {
					"label": "fullName",
					"value": "id",
					"multiple": false,
					"children": ""
				},
				deliveryTypeOptions: [{
					"fullName": "无",
					"id": "1"
				}, {
					"fullName": "仓配",
					"id": "2"
				}, {
					"fullName": "直达",
					"id": "3"
				}],
				deliveryTypeProps: {
					"label": "fullName",
					"value": "id",
					"multiple": false,
					"children": ""
				},
				contractIdColumnOptions: [{
						"label": "合同编码",
						"value": "contract_number"
					},
					{
						"label": "合同名称",
						"value": "contract_name"
					},
				],
				currencyOptions: [{
					"fullName": "人民币",
					"id": "1"
				}, {
					"fullName": "港元",
					"id": "2"
				}, {
					"fullName": "美元",
					"id": "3"
				}, {
					"fullName": "欧元",
					"id": "4"
				}, {
					"fullName": "加币",
					"id": "5"
				}, {
					"fullName": "日元",
					"id": "6"
				}, {
					"fullName": "台币",
					"id": "7"
				}],
				currencyProps: {
					"label": "fullName",
					"value": "id",
					"multiple": false,
					"children": ""
				},
				saleModeOptions: [{
					"fullName": "以销定采",
					"id": "1"
				}, {
					"fullName": "以采定销",
					"id": "2"
				}],
				saleModeProps: {
					"label": "fullName",
					"value": "id",
					"multiple": false,
					"children": ""
				},
				correlatedOrderIdColumnOptions: [{
						"label": "订单编号",
						"value": "code"
					},
					{
						"label": "单据类型",
						"value": "order_type"
					},
					{
						"label": "是否紧急订单",
						"value": "urgent_order"
					},
				],
				fixPriceModeOptions: [{
					"fullName": "锁价模式",
					"id": "1"
				}, {
					"fullName": "后结算模式",
					"id": "2"
				}],
				fixPriceModeProps: {
					"label": "fullName",
					"value": "id",
					"multiple": false,
					"children": ""
				},
				secondSubjectBasicIdColumnOptions: [{
						"label": "客户编码",
						"value": "code"
					},
					{
						"label": "客户名称",
						"value": "name"
					},
				],
				firstSubjectBasicIdColumnOptions: [{
						"label": "客户编码",
						"value": "code"
					},
					{
						"label": "客户名称",
						"value": "name"
					},
				],
				transactionModeOptions: [{
					"fullName": "快递交货",
					"id": "1"
				}, {
					"fullName": "送货上门",
					"id": "2"
				}, {
					"fullName": "上门提货",
					"id": "3"
				}],
				transactionModeProps: {
					"label": "fullName",
					"value": "id",
					"multiple": false,
					"children": ""
				},
				enterpriseIdColumnOptions: [{
						"label": "机构编码",
						"value": "f_en_code"
					},
					{
						"label": "机构名称",
						"value": "f_full_name"
					},
				],
				deliveryWarehouseColumnOptions: [{
						"label": "仓库编号",
						"value": "code"
					},
					{
						"label": "仓库名称",
						"value": "name"
					},
				],
				deliveryAddressColumnOptions: [{
						"label": "业务类型",
						"value": "address_type"
					},
					{
						"label": "国家",
						"value": "country"
					},
					{
						"label": "详细地址",
						"value": "addressDetail"
					},
				],
				transportModeOptions: [{
					"fullName": "公路",
					"id": "1"
				}, {
					"fullName": "铁路",
					"id": "2"
				}, {
					"fullName": "轮船",
					"id": "3"
				}, {
					"fullName": "空运",
					"id": "4"
				}, {
					"fullName": "无",
					"id": "5"
				}],
				transportModeProps: {
					"label": "fullName",
					"value": "id",
					"multiple": false,
					"children": ""
				},
				statusOptions: [{
					"fullName": "待校验",
					"id": "1"
				}, {
					"fullName": "待审核",
					"id": "2"
				}, {
					"fullName": "待处理",
					"id": "3"
				}, {
					"fullName": "待执行",
					"id": "4"
				}, {
					"fullName": "执行中",
					"id": "5"
				}, {
					"fullName": "已完成",
					"id": "6"
				}, {
					"fullName": "校验失败",
					"id": "7"
				}, {
					"fullName": "已取消",
					"id": "8"
				}],
				statusProps: {
					"label": "fullName",
					"value": "id",
					"multiple": false,
					"children": ""
				},
				settlementinfopaymentMethodOptions: [],
				settlementinfopaymentMethodProps: {
					"label": "fullName",
					"value": "enCode",
					"multiple": false,
					"children": ""
				},
				settlementinfocollaborationMethodOptions: [],
				settlementinfocollaborationMethodProps: {
					"label": "fullName",
					"value": "enCode",
					"multiple": false,
					"children": ""
				},
				settlementinfosettlementMethodOptions: [],
				settlementinfosettlementMethodProps: {
					"label": "fullName",
					"value": "enCode",
					"multiple": false,
					"children": ""
				},
				settlementinfounderpaymentMethodOptions: [{
					"fullName": "无",
					"id": "1"
				}, {
					"fullName": "按金额",
					"id": "2"
				}, {
					"fullName": "按比例",
					"id": "3"
				}],
				settlementinfounderpaymentMethodProps: {
					"label": "fullName",
					"value": "id",
					"multiple": false,
					"children": ""
				},
				settlementinfomarginMethodOptions: [{
					"fullName": "无",
					"id": "1"
				}, {
					"fullName": "按金额",
					"id": "2"
				}, {
					"fullName": "按比例",
					"id": "3"
				}],
				settlementinfomarginMethodProps: {
					"label": "fullName",
					"value": "id",
					"multiple": false,
					"children": ""
				},
				settlementinfooverdueInterestRateOptions: [{
					"fullName": "按年化",
					"id": "1"
				}, {
					"fullName": "按月化",
					"id": "fCgxew1"
				}],
				settlementinfooverdueInterestRateProps: {
					"label": "fullName",
					"value": "id",
					"multiple": false,
					"children": ""
				},
				businessorderproductrelationalproductIdColumnOptions: [{
						"label": "商品编码",
						"value": "commodity_code"
					},
					{
						"label": "商品名称",
						"value": "commodity_name"
					},
					{
						"label": "商品规格",
						"value": "specifications"
					},
				],
				businessorderproductrelationalsalesMainUnitIdOptions: [{
					"fullName": "选项一",
					"id": "1"
				}, {
					"fullName": "选项二",
					"id": "2"
				}],
				businessorderproductrelationalsalesMainUnitIdProps: {
					"label": "fullName",
					"value": "id",
					"multiple": false,
					"children": ""
				},
				labelwidth: 210 * 1.5,
				menuId: '',
				jurisdictionType: '',
				ruleList: {
					settlementinfoList: {},
					businessorderproductrelationalList: {
						'salesMainUnitId': '销售单位不能为空',
					},
				},
				interfaceRes: {
					orderType: [],
					code: [],
					businessLineId: [],
					counterpartOrderCode: [],
					urgentOrder: [],
					expectArriveDateStart: [],
					createOrderDate: [],
					deliveryType: [],
					contractId: [],
					currency: [],
					saleMode: [],
					correlatedOrderId: [],
					fixPriceMode: [],
					secondSubjectBasicId: [],
					firstSubjectBasicId: [],
					transactionMode: [],
					receiveAddress: [],
					enterpriseId: [],
					deliveryWarehouse: [{
						fieldName: "",
						field: "businessLineId",
						defaultValue: "",
						jnpfKey: "popupSelect",
						dataType: "varchar",
						id: "PneOdw1",
						required: "0",
						relationField: "businessLineId",
					}, ],
					deliveryAddress: [{
						fieldName: "",
						field: "businessOrganizeId",
						defaultValue: "",
						jnpfKey: "popupSelect",
						dataType: "varchar",
						id: "AyAmdw1",
						required: "0",
						relationField: "deliveryWarehouse",
					}, ],
					transportMode: [],
					remark: [],
					status: [],
					settlementinfosubjectBasicId: [],
					settlementinfopaymentMethod: [],
					settlementinfocollaborationMethod: [],
					settlementinfosettlementMethod: [],
					settlementinfoadvanceRatio: [],
					settlementinfoaccountPeriod: [],
					settlementinfounderpaymentMethod: [],
					settlementinfomarginMethod: [],
					settlementinfooverdueInterestRate: [],
					settlementinfoapplyForUnderpaymentRatio: [],
					settlementinfoapplyForMarginRatio: [],
					settlementinfoapplyForOverdueRatio: [],
					businessorderproductrelationalproductId: [{
						fieldName: "",
						field: "contractId",
						defaultValue: "",
						jnpfKey: "popupSelect",
						dataType: "varchar",
						id: "spNokw1",
						required: "0",
						relationField: "contractId",
					}, ],
					businessorderproductrelationalspec: [],
					businessorderproductrelationalinventoryUnitId: [],
					businessorderproductrelationalrealBound: [],
					businessorderproductrelationaluseBound: [],
					businessorderproductrelationalsalesMainUnitId: [],
					businessorderproductrelationalbusinessNum: [],
					businessorderproductrelationalbusinessPrice: [],
					businessorderproductrelationaltax: [],
					businessorderproductrelationaltaxCount: [],
					businessorderproductrelationalnotTaxPrice: [],
					businessorderproductrelationalnotTaxCount: [],
					businessorderproductrelationallastSalePrice: [],
				},
				regList: {
					settlementinfoList: {
						subjectBasicId: [],
						paymentMethod: [],
						collaborationMethod: [],
						settlementMethod: [],
						advanceRatio: [],
						accountPeriod: [],
						underpaymentMethod: [],
						marginMethod: [],
						overdueInterestRate: [],
						applyForUnderpaymentRatio: [],
						applyForMarginRatio: [],
						applyForOverdueRatio: [],
					},
					businessorderproductrelationalList: {
						productId: [],
						spec: [],
						inventoryUnitId: [],
						realBound: [],
						useBound: [],
						salesMainUnitId: [],
						businessNum: [],
						businessPrice: [],
						tax: [],
						taxCount: [],
						notTaxPrice: [],
						notTaxCount: [],
						lastSalePrice: [],
					},
				},
				ableAll: {},
				childIndex: -1,
				dataValue: {},
				isEdit: false,
				userInfo: {},
				formatType: {
					"yyyy": "yyyy",
					"yyyy-MM": "yyyy-mm",
					"yyyy-MM-dd": "yyyy-mm-dd",
					"yyyy-MM-dd HH:mm": "yyyy-mm-dd hh:MM",
					"yyyy-MM-dd HH:mm:ss": "yyyy-mm-dd hh:MM:ss",
					"HH:mm:ss": "hh:MM:ss",
					"HH:mm": "hh:MM"
				},
				content: '',
				title: '',
				show: false,
			}
		},
		onLoad(option) {
			uni.$on('linkPageConfirm', (subVal) => {
				if (this.tableKey) {
					for (let i = 0; i < subVal.length; i++) {
						let t = subVal[i]
						if (this['get' + this.tableKey]) {
							this['get' + this.tableKey](t)
						}
					}
					this.childIndex = -1
					this.collapse()
				}
			})
			this.jurisdictionType = option.jurisdictionType
			this.menuId = option.menuId
			this.userInfo = uni.getStorageSync('userInfo') || {}
			this.dataForm.id = option.id || 0
			let _title = ""
			if (option.jurisdictionType == 'btn_edit') {
				_title = "编辑"
			}
			if (option.jurisdictionType == 'btn_detail') {
				_title = "详情"
			}
			if (option.jurisdictionType == 'btn_add') {
				_title = "新增"
			}
			if (_title) {
				uni.setNavigationBarTitle({
					title: _title
				})
			}
			this.selfInit()
			this.initDefaultData()
			this.dataAll()
			this.initData()
			this.dataValue = JSON.parse(JSON.stringify(this.dataForm))
			this.idList = option.idList ? option.idList.split(",") : []
			for (let i = 0; i < this.idList.length; i++) {
				if (this.idList[i] == option.id) {
					this.index = i;
				}
			}
			if (!option.id) {
				this.actionList.push({
					text: '确定并新增',
					id: 'save_add'
				})
			} else {
				let upper = {
					text: '上一条',
					id: 'upper',
					disabled: this.index == 0 ? true : false
				}
				this.actionList.push(upper)
				let lower = {
					text: '下一条',
					id: 'lower',
					disabled: this.index == this.idList.length - 1 ? true : false
				}
				this.actionList.push(lower)
				this.actionList.push({
					text: '确定并继续',
					id: 'save_proceed'
				})
				this.collapse()
			}
		},
		onReady() {
			this.$nextTick(() => {
				setTimeout(() => {
					this.$refs.dataForm.setRules(this.rules);
				}, 100)
			})
		},
		watch: {
			dataForm: {
				handler(val, oldVal) {
					this.settlementinfo()
					this.businessorderproductrelational()
				},
				deep: true
			}
		},
		methods: {
			handleAction(index) {
				if (this.actionList[index].id === 'save_add' || this.actionList[index].id === 'save_proceed') {
					this.submitForm(1)
				} else {
					this.calculation(this.actionList[index].id, index)
				}
			},
			calculation(type, index) {
				if (type === 'upper') {
					this.index--
					this.actionList[index + 1].disabled = false
					if (this.index == 0) this.actionList[index].disabled = true
				} else {
					this.index++
					this.actionList[index - 1].disabled = false
					if (this.index == this.idList.length - 1) this.actionList[index].disabled = true
				}
				this.dataForm.id = this.idList[this.index]
				this.initData()
			},
			changeData(model, index) {
				this.isEdit = false
				this.childIndex = index
				let modelAll = model.split("-");
				let faceMode = "";
				for (let i = 0; i < modelAll.length; i++) {
					faceMode += modelAll[i];
				}
				for (let key in this.interfaceRes) {
					if (key != faceMode) {
						let faceReList = this.interfaceRes[key]
						for (let i = 0; i < faceReList.length; i++) {
							if (faceReList[i].relationField == model) {
								let options = 'get' + key + 'Options';
								if (this[options]) {
									this[options]()
								}
								this.changeData(key, index)
							}
						}
					}
				}
			},
			changeDataFormData(type, data, model, index, defaultValue, edit) {
				if (!edit) {
					if (type == 2) {
						for (let i = 0; i < this.dataForm[data].length; i++) {
							if (index == -1) {
								this.dataForm[data][i][model] = defaultValue
							} else if (index == i) {
								this.dataForm[data][i][model] = defaultValue
							}
						}
					} else {
						this.dataForm[data] = defaultValue
					}
				}
			},
			clickIcon(label, tipLabel) {
				this.content = tipLabel
				this.title = label
				this.show = true
			},
			exist() {
				let title = [];
				let _ruleList = this.ruleList
				for (let k in _ruleList) {
					let childData = this.dataForm[k]
					childData.forEach((item, index) => {
						for (let model in _ruleList[k]) {
							if (item[model] instanceof Array) {
								if (item[model].length == 0) {
									title.push(_ruleList[k][model])
								}
							} else if (!item[model]) {
								title.push(_ruleList[k][model])
							}
						}
					})
				}
				let _regList = this.regList
				for (let k in _regList) {
					let childData = this.dataForm[k]
					for (let n in _regList[k]) {
						for (let i = 0; i < _regList[k][n].length; i++) {
							const element = _regList[k][n][i]
							if (element.pattern) {
								element.pattern = element.pattern.toString()
								let start = element.pattern.indexOf('/')
								let stop = element.pattern.lastIndexOf('/')
								let str = element.pattern.substring(start + 1, stop)
								let reg = new RegExp(str)
								element.pattern = reg
							}
							childData.forEach((item, index) => {
								if (item[n] && !element.pattern.test(item[n])) {
									title.push(element.message)
								}
							})
						}
					}
				}
				if (title.length > 0) {
					return title[0]
				}
			},
			resetForm() {
				uni.navigateBack()
			},
			dataAll() {
				this.getsettlementinfopaymentMethodOptions()
				this.getsettlementinfocollaborationMethodOptions()
				this.getsettlementinfosettlementMethodOptions()
				this.collapse()
			},
			dateTime(timeRule, timeType, timeTarget, timeValueData, dataValue) {
				let timeDataValue = null;
				let timeValue = Number(timeValueData)
				if (timeRule) {
					if (timeType == 1) {
						timeDataValue = timeValueData ? timeValue : null
					} else if (timeType == 2) {
						timeDataValue = dataValue
					} else if (timeType == 3) {
						timeDataValue = new Date().getTime()
					} else if (timeType == 4) {
						let previousDate = '';
						if (timeTarget == 1 || timeTarget == 2) {
							previousDate = getDateDay(timeTarget, timeType, timeValue)
							timeDataValue = new Date(previousDate).getTime()
						} else if (timeTarget == 3) {
							previousDate = getBeforeData(timeValue)
							timeDataValue = new Date(previousDate).getTime()
						} else {
							timeDataValue = getBeforeTime(timeTarget, timeValue).getTime()
						}
					} else if (timeType == 5) {
						let previousDate = '';
						if (timeTarget == 1 || timeTarget == 2) {
							previousDate = getDateDay(timeTarget, timeType, timeValue)
							timeDataValue = new Date(previousDate).getTime()
						} else if (timeTarget == 3) {
							previousDate = getLaterData(timeValue)
							timeDataValue = new Date(previousDate).getTime()
						} else {
							timeDataValue = getLaterTime(timeTarget, timeValue).getTime()
						}
					}
				}
				return timeDataValue;
			},
			time(timeRule, timeType, timeTarget, timeValue, formatType, dataValue) {
				let format = formatType == 'HH:mm' ? 'HH:mm:00' : formatType
				let timeDataValue = null
				if (timeRule) {
					if (timeType == 1 && timeValue) {
						timeDataValue = timeValue || '00:00:00'
						if (timeDataValue.split(':').length == 3) {
							timeDataValue = timeDataValue
						} else {
							timeDataValue = timeDataValue + ':00'
						}
					} else if (timeType == 2) {
						timeDataValue = dataValue
					} else if (timeType == 3) {
						timeDataValue = this.jnpf.toDate(new Date(), format)
					} else if (timeType == 4) {
						let previousDate = '';
						previousDate = getBeforeTime(timeTarget, timeValue)
						timeDataValue = this.jnpf.toDate(previousDate, format)
					} else if (timeType == 5) {
						let previousDate = '';
						previousDate = getLaterTime(timeTarget, timeValue)
						timeDataValue = this.jnpf.toDate(previousDate, format)
					}
				}
				return timeDataValue;
			},
			settlementinfo() {
				let table = this.dataForm.settlementinfoList
				let summaryField = []
				let summaryFieldName = {}
				let data = {}
				let thousandsField = []
				for (let i in summaryField) {
					let map = {}
					let val = 0
					for (let j = 0; j < table.length; j++) {
						let summary = table[j][summaryField[i]];
						if (summary) {
							let data = isNaN(summary) ? 0 : Number(summary)
							val += data
						}
					}
					map.id = summaryField[i];
					map.name = summaryFieldName[summaryField[i]];
					map.val = (thousandsField.includes(summaryField[i])) ? Number(val).toLocaleString('zh', {
						maximumFractionDigits: '2'
					}) : val;
					data[summaryField[i]] = map;
				}
				return data;
			},
			getsettlementinfopaymentMethodOptions() {
				getDictionaryDataSelector('522791131704985861').then(res => {
					this.settlementinfopaymentMethodOptions = res.data.list
				})
			},
			getsettlementinfocollaborationMethodOptions() {
				getDictionaryDataSelector('522791293974219013').then(res => {
					this.settlementinfocollaborationMethodOptions = res.data.list
				})
			},
			getsettlementinfosettlementMethodOptions() {
				getDictionaryDataSelector('522791717301127429').then(res => {
					this.settlementinfosettlementMethodOptions = res.data.list
				})
			},
			businessorderproductrelational() {
				let table = this.dataForm.businessorderproductrelationalList
				let summaryField = []
				let summaryFieldName = {}
				let data = {}
				let thousandsField = []
				for (let i in summaryField) {
					let map = {}
					let val = 0
					for (let j = 0; j < table.length; j++) {
						let summary = table[j][summaryField[i]];
						if (summary) {
							let data = isNaN(summary) ? 0 : Number(summary)
							val += data
						}
					}
					map.id = summaryField[i];
					map.name = summaryFieldName[summaryField[i]];
					map.val = (thousandsField.includes(summaryField[i])) ? Number(val).toLocaleString('zh', {
						maximumFractionDigits: '2'
					}) : val;
					data[summaryField[i]] = map;
				}
				return data;
			},
			initData() {
				this.$nextTick(function() {
					if (this.dataForm.id) {
						this.loading = true
						request({
							url: '/api/scm/BusinessOrder/' + this.dataForm.id,
							method: 'get',
						}).then(res => {
							this.dataInfo(res.data)
							this.loading = false
						})
					} else {
						this.initDefaultData()
					}
				})
			},
			beforeSubmit() {
				const _data = this.dataList()
				return _data
			},
			initDefaultData() {},
			selfInit() {
				this.$store.commit('base/UPDATE_RELATION_DATA', {})
				this.dataAll()
				this.initDefaultData()
				this.collapse()
			},
			selfGetInfo(dataForm) {
				this.dataForm.id = this.dataForm.id
				this.dataInfo(dataForm)
			},
			addsettlementinfoList() {
				let value = {}
				this.tableKey = 'settlementinfoList';
				let _addTableConf = {
					"popupType": "dialog",
					"hasPage": true,
					"popupTitle": "选择数据",
					"pageSize": 20,
					"columnOptions": [{
						"label": "客户名称",
						"value": "name"
					}, {
						"label": "付款方式",
						"value": "payment_method"
					}, {
						"label": "合作方式",
						"value": "collaboration_method"
					}, {
						"label": "结算方式",
						"value": "settlement_method"
					}, {
						"label": "预付比例",
						"value": "advance_ratio"
					}, {
						"label": "账期",
						"value": "account_period"
					}, {
						"label": "压款方式",
						"value": "underpayment_method"
					}, {
						"label": "保证金方式",
						"value": "margin_method"
					}, {
						"label": "逾期利率",
						"value": "overdue_interest_rate"
					}],
					"interfaceId": "522785130423519493",
					"interfaceName": "销售订单-根据客户获取结算信息",
					"relationOptions": [{
						"field": "subjectBasicId",
						"type": 1,
						"value": "name"
					}, {
						"field": "paymentMethod",
						"type": 1,
						"value": "payment_method"
					}, {
						"field": "collaborationMethod",
						"type": 1,
						"value": "collaboration_method"
					}, {
						"field": "settlementMethod",
						"type": 1,
						"value": "settlement_method"
					}, {
						"field": "advanceRatio",
						"type": 1,
						"value": "advance_ratio"
					}, {
						"field": "accountPeriod",
						"type": 1,
						"value": "account_period"
					}, {
						"field": "applyForUnderpaymentRatio",
						"type": 1,
						"value": "apply_for_underpayment_ratio"
					}, {
						"field": "applyForMarginRatio",
						"type": 1,
						"value": "apply_for_margin_ratio"
					}, {
						"field": "applyForOverdueRatio",
						"type": 1,
						"value": "apply_for_overdue_ratio"
					}],
					"templateJson": [{
						"fieldName": "",
						"field": "subjectBasicId",
						"defaultValue": "",
						"jnpfKey": "popupSelect",
						"dataType": "varchar",
						"parameter": "subjectBasicId",
						"id": "YHSkew1",
						"required": 0,
						"relationField": "firstSubjectBasicId"
					}],
					"popupWidth": "800px"
				}
				let data = {
					addTableConf: _addTableConf,
					formData: this.dataForm
				}
				uni.navigateTo({
					url: '/pages/apply/tableLinkage/index?data=' + encodeURIComponent(JSON.stringify(data))
				})
				return
				this.getsettlementinfoList(value)
				this.childIndex = -1
				this.collapse()
			},
			delsettlementinfoList(index) {
				var that = this
				uni.showModal({
					title: '提示',
					content: '确认删除该条信息吗？',
					success: function(res) {
						if (res.confirm) {
							that.dataForm.settlementinfoList.splice(index, 1);
							that.collapse()
						}
					}
				})
			},
			getsettlementinfoList(value) {
				let item = {
					subjectBasicId: '',
					paymentMethod: "",
					paymentMethodOptions: [],
					collaborationMethod: "",
					collaborationMethodOptions: [],
					settlementMethod: "",
					settlementMethodOptions: [],
					advanceRatio: '',
					accountPeriod: '',
					underpaymentMethod: "",
					marginMethod: "",
					overdueInterestRate: "",
					applyForUnderpaymentRatio: '',
					applyForMarginRatio: '',
					applyForOverdueRatio: '',
				}
				let result = {
					...item,
					...value
				}
				this.dataForm.settlementinfoList.push(result)
				this.childIndex = this.dataForm.settlementinfoList.length - 1
				this.isEdit = true
				this.isEdit = false
			},
			addbusinessorderproductrelationalList() {
				let value = {}
				this.tableKey = 'businessorderproductrelationalList';
				this.getbusinessorderproductrelationalList(value)
				this.childIndex = -1
				this.collapse()
			},
			delbusinessorderproductrelationalList(index) {
				var that = this
				uni.showModal({
					title: '提示',
					content: '确认删除该条信息吗？',
					success: function(res) {
						if (res.confirm) {
							that.dataForm.businessorderproductrelationalList.splice(index, 1);
							that.collapse()
						}
					}
				})
			},
			getbusinessorderproductrelationalList(value) {
				let item = {
					productId: "",
					spec: '',
					inventoryUnitId: '',
					realBound: '',
					useBound: '',
					salesMainUnitId: "",
					businessNum: '',
					businessPrice: '',
					tax: '',
					taxCount: '',
					notTaxPrice: '',
					notTaxCount: '',
					lastSalePrice: '',
				}
				let result = {
					...item,
					...value
				}
				this.dataForm.businessorderproductrelationalList.push(result)
				this.childIndex = this.dataForm.businessorderproductrelationalList.length - 1
				this.isEdit = true
				this.isEdit = false
			},
			dataList() {
				var _data = this.dataForm;
				return _data;
			},
			dataInfo(dataAll) {
				let _dataAll = dataAll
				this.dataForm = _dataAll
				this.isEdit = true
				this.dataAll()
				for (let i = 0; i < _dataAll.settlementinfoList.length; i++) {
					this.childIndex = i
				}
				for (let i = 0; i < _dataAll.businessorderproductrelationalList.length; i++) {
					this.childIndex = i
				}
				this.childIndex = -1
				this.collapse()
			},
			collapse() {
				setTimeout(() => {}, 1000);
			},
		},
	}
</script>
<style>
	page {
		background-color: #f0f2f6;
	}
</style>