<template>
	<view class="content" v-if="flag">
		<view class="tit">
			<text v-if="page">养殖信息</text>
			<text v-else>镇批发商信息收集表</text>
		</view>

		<!-- 镇种养殖基地信息收集表 -->
		<view class="card" v-if="page">
			<u--form labelPosition="left" :model="formData" :rules="rules" ref="breedingForm">
				<u-form-item labelWidth="auto" label="法人姓名" required prop="entityName" borderBottom>
					<u--input :readonly="readonly" v-model="formData.entityName" placeholder="请输入法人姓名"></u--input>
				</u-form-item>
				<u-form-item labelWidth="auto" label="联系方式" required prop="phone" borderBottom>
					<u--input :readonly="readonly" v-model="formData.phone" placeholder="请输入联系方式"
						type="number"></u--input>
				</u-form-item>
				<u-form-item labelWidth="auto" label="员工人数" borderBottom>
					<u--input :readonly="readonly" v-model="formData.employee" placeholder="请输入员工人数"></u--input>
				</u-form-item>
				<u-form-item labelWidth="auto" label="耕地总面积" borderBottom>
					<u--input :readonly="readonly" v-model="formData.arableLand" placeholder="请输入员工人数"></u--input>
				</u-form-item>
				<view class="">
					<u-form-item labelWidth="auto" labelPosition="top" label="土地规划" borderBottom>
						<u-radio-group :disabled="readonly" v-model="formData.breeding_company" style="margin: 16rpx;">
							<view class="" style="display: flex;justify-content: space-between;flex-wrap: wrap;">
								<u-radio :customStyle="{marginRight: '16px',overflow: 'auto',marginBottom:'16rpx'}"
									v-for="(item, index) in [{value:'0',label:'自己种'},{value:'1',label:'出租'},{value:'2',label:'代种养'},{value:'3',label:'租更多地扩大种殖'}]"
									:key="index" :label="item.label" :name="item.value">
								</u-radio>
							</view>

						</u-radio-group>
					</u-form-item>
				</view>
				<u-form-item labelWidth="auto" label="有无养殖培训" borderBottom>
					<u-radio-group :disabled="readonly" v-model="formData.breeding_training" style="margin: 16rpx;">
						<u-radio :customStyle="{marginRight: '16px'}"
							v-for="(item, index) in [{value:'1',label:'有'},{value:'0',label:'无'}]" :key="index"
							:label="item.label" :name="item.value">
						</u-radio>
					</u-radio-group>
				</u-form-item>
				<u-form-item labelWidth="auto" label="现代化程度(%)" borderBottom>
					<u--input :readonly="readonly" v-model="formData.modernization" placeholder="请输入现代化程度(%)"
						type="number" maxlength="3"></u--input>
				</u-form-item>
				<picker :range="breedingTypeList" range-key="name" :disabled="readonly" mode="selector"
					@change="changeBreeding">
					<u-form-item labelWidth="auto" label="种养殖类型" borderBottom>
						<u--input :value="breedingName" style="pointer-events: none;" placeholder="请选择养殖类型" disabled
							disabledColor="#fff"></u--input>
						<u-icon slot="right" name="arrow-right"></u-icon>
					</u-form-item>
				</picker>
				<u-form-item labelWidth="auto" label="面积" borderBottom>
					<u--input :readonly="readonly" v-model="formData.area" placeholder="请输入面积"></u--input>
				</u-form-item>
				<u-form-item labelWidth="auto" label="农资农具使用情况" borderBottom>
					<u--input :readonly="readonly" v-model="formData.farm_tools" placeholder="请输入面积"></u--input>
				</u-form-item>
				<u-form-item labelWidth="auto" label="是否生态养殖" borderBottom>
					<u-radio-group :disabled="readonly" v-model="formData.ecological_farming" style="margin: 16rpx;">
						<u-radio :customStyle="{marginRight: '16px'}"
							v-for="(item, index) in [{value:'1',label:'是'},{value:'0',label:'否'}]" :key="index"
							:label="item.label" :name="item.value">
						</u-radio>
					</u-radio-group>
				</u-form-item>
				<picker mode="date" @change="changeDate" :disabled="readonly" :data-value="'breeding_begin_time'">
					<u-form-item labelWidth="auto" label="种植开始时间" borderBottom>
						<u--input :value="formData.breeding_begin_time" style="pointer-events: none;"
							placeholder="请选择养殖开始时间" disabled disabledColor="#fff"></u--input>
						<u-icon slot="right" name="arrow-right"></u-icon>
					</u-form-item>
				</picker>
				<picker mode="date" @change="changeDate" :disabled="readonly" :data-value="'breeding_time'">
					<u-form-item labelWidth="auto" label="成熟时间" borderBottom>
						<u--input :value="formData.breeding_time" style="pointer-events: none;" placeholder="请选择养殖开始时间"
							disabled disabledColor="#fff"></u--input>
						<u-icon slot="right" name="arrow-right"></u-icon>
					</u-form-item>
				</picker>
				<picker mode="date" @change="changeDate" :disabled="readonly" :data-value="'mature_time'">
					<u-form-item labelWidth="auto" label="上市时间" borderBottom>
						<u--input :value="formData.mature_time" style="pointer-events: none;" placeholder="请选择上市时间"
							disabled disabledColor="#fff"></u--input>
						<u-icon slot="right" name="arrow-right"></u-icon>
					</u-form-item>
				</picker>
				<u-form-item labelWidth="auto" label="产量(斤)" borderBottom>
					<u--input :readonly="readonly" v-model="formData.yield" placeholder="请输入产量(斤)"
						type="number"></u--input>
				</u-form-item>
				<u-form-item labelWidth="auto" label="预售卖价格(元/500g)" borderBottom>
					<u--input :readonly="readonly" v-model="formData.pre_price" placeholder="请输入预售卖价格"></u--input>
				</u-form-item>
				<u-form-item labelWidth="auto" label="预计收益(元)" borderBottom>
					<u--input :readonly="readonly" v-model="formData.estimated_income" placeholder="请输入预计收益(元)"
						type="number"></u--input>
				</u-form-item>
				<u-form-item labelWidth="auto" label="销售渠道" borderBottom>
					<u-radio-group :disabled="readonly" v-model="formData.salesChannels" style="margin: 16rpx;">
						<u-radio :customStyle="{marginRight: '16px'}"
							v-for="(item, index) in [{value:'1',label:'自销'},{value:'0',label:'定点'}]" :key="index"
							:label="item.label" :name="item.value">
						</u-radio>
					</u-radio-group>
				</u-form-item>
				<u-form-item labelWidth="auto" label="有无加工仓储" borderBottom>
					<u-radio-group :disabled="readonly" v-model="formData.processing_storage" style="margin: 16rpx;">
						<u-radio :customStyle="{marginRight: '16px'}"
							v-for="(item, index) in [{value:'1',label:'有'},{value:'0',label:'无'}]" :key="index"
							:label="item.label" :name="item.value">
						</u-radio>
					</u-radio-group>
				</u-form-item>
				<u-form-item labelWidth="auto" label="有无宣传推广" borderBottom>
					<u-radio-group :disabled="readonly" v-model="formData.promote" style="margin: 16rpx;">
						<u-radio :customStyle="{marginRight: '16px'}"
							v-for="(item, index) in [{value:'1',label:'有'},{value:'0',label:'无'}]" :key="index"
							:label="item.label" :name="item.value">
						</u-radio>
					</u-radio-group>
				</u-form-item>
				<u-form-item labelWidth="auto" label="有无运输" borderBottom>
					<u-radio-group :disabled="readonly" v-model="formData.transportation" style="margin: 16rpx;">
						<u-radio :customStyle="{marginRight: '16px'}"
							v-for="(item, index) in [{value:'1',label:'有'},{value:'0',label:'无'}]" :key="index"
							:label="item.label" :name="item.value">
						</u-radio>
					</u-radio-group>
				</u-form-item>

				<u-form-item labelWidth="auto" label="是否有扩大经营需求" borderBottom>
					<u-radio-group :disabled="readonly" v-model="formData.isExpandOperations" style="margin: 16rpx;">
						<u-radio :customStyle="{marginRight: '16px'}"
							v-for="(item, index) in [{value:'1',label:'是'},{value:'0',label:'否'}]" :key="index"
							:label="item.label" :name="item.value">
						</u-radio>
					</u-radio-group>
				</u-form-item>
				<u-form-item labelWidth="auto" labelPosition="top" label="种养殖述求" borderBottom>
					<u--textarea :disabled="readonly" v-model="formData.request" autoHeight placeholder="请输入您的述求"
						border="surround" count></u--textarea>
				</u-form-item>
				<u-form-item labelWidth="auto" label="是否有政策补贴" borderBottom>
					<u-radio-group :disabled="readonly" v-model="formData.isPolicySubsidies" style="margin: 16rpx;">
						<u-radio :customStyle="{marginRight: '16px'}"
							v-for="(item, index) in [{value:'1',label:'有'},{value:'0',label:'无'}]" :key="index"
							:label="item.label" :name="item.value">
						</u-radio>
					</u-radio-group>
				</u-form-item>

				<u-form-item labelWidth="auto" label="有无公益拍卖品" borderBottom>
					<u-radio-group :disabled="readonly" v-model="formData.isLots" style="margin: 16rpx;">
						<u-radio :customStyle="{marginRight: '16px'}"
							v-for="(item, index) in [{value:'1',label:'有'},{value:'0',label:'无'}]" :key="index"
							:label="item.label" :name="item.value">
						</u-radio>
					</u-radio-group>
				</u-form-item>

				<u-form-item labelWidth="auto" label="有无需求的公益拍卖品" borderBottom>
					<u-radio-group :disabled="readonly" v-model="formData.isNeedLots" style="margin: 16rpx;">
						<u-radio :customStyle="{marginRight: '16px'}"
							v-for="(item, index) in [{value:'1',label:'有'},{value:'0',label:'无'}]" :key="index"
							:label="item.label" :name="item.value">
						</u-radio>
					</u-radio-group>
				</u-form-item>
				<u-form-item labelWidth="auto" labelPosition="top" label="家庭情况说明" borderBottom>
					<u--textarea :disabled="readonly" v-model="formData.family" autoHeight placeholder="请输入"
						border="surround" count></u--textarea>
				</u-form-item>
				<u-form-item labelWidth="auto" labelPosition="top" label="家庭总述求" borderBottom>
					<u--textarea :disabled="readonly" v-model="formData.familyNotes" autoHeight placeholder="请输入"
						border="surround" count></u--textarea>
				</u-form-item>
				<u-button v-if="!readonly" type="primary" text="提交" @click="confirm1" color="#0122C7"></u-button>
			</u--form>
		</view>
		<!-- 镇批发商信息收集表 -->
		<view class="card" v-show='!page'>

			<u--form labelPosition="left" :model="formData1" :rules="rules1" ref="breedingForm1">
				<u-form-item labelWidth="auto" label="店铺名称" required prop="storeName" borderBottom>
					<u--input :readonly="readonly" v-model="formData1.storeName" placeholder="请输入店铺名称"></u--input>
				</u-form-item>
				<u-form-item labelWidth="auto" label="经营类型" required prop="type" borderBottom>
					<u--input :readonly="readonly" v-model="formData1.type" placeholder="请输入经营类型"></u--input>
				</u-form-item>
				<u-form-item labelWidth="auto" label="店主姓名" required prop="shopkeeperName" borderBottom>
					<u--input :readonly="readonly" v-model="formData1.shopkeeperName" placeholder="请输入店主姓名"></u--input>
				</u-form-item>
				<u-form-item labelWidth="auto" label="店主性别" required prop="arableLand" borderBottom>
					<u-radio-group :disabled="readonly" v-model="formData1.shopkeeperSex" style="margin: 16rpx;">
						<u-radio :customStyle="{marginRight: '16px'}"
							v-for="(item, index) in [{value:'1',label:'男'},{value:'0',label:'女'}]" :key="index"
							:label="item.label" :name="item.value">
						</u-radio>
					</u-radio-group>
				</u-form-item>
				<u-form-item labelWidth="auto" label="店主年龄" required prop="shopkeeperAge" borderBottom>
					<u--input :readonly="readonly" type='number' v-model="formData1.shopkeeperAge"
						placeholder="请输入店主年龄"></u--input>
				</u-form-item>
				<u-form-item labelWidth="auto" label="联系方式" required prop="shopkeeperPhone" borderBottom>
					<u--input :readonly="readonly" type='number' v-model="formData1.shopkeeperPhone"
						placeholder="请输入联系方式"></u--input>
				</u-form-item>
				<u-form-item labelWidth="auto" label="店铺地址" borderBottom>
					<u--input :readonly="readonly" v-model="formData1.address" placeholder="请输入地址"></u--input>
				</u-form-item>
				<u-form-item labelWidth="auto" label="面积" borderBottom>
					<u--input :readonly="readonly" type='number' v-model="formData1.area"
						placeholder="请输入地址"></u--input>
				</u-form-item>
				<u-form-item labelWidth="auto" label="经营年限" borderBottom>
					<u--input :readonly="readonly" type='number' v-model="formData1.storeAge"
						placeholder="请输入经营年限"></u--input>
				</u-form-item>
				<u-form-item labelWidth="auto" label="人数" borderBottom>
					<u--input :readonly="readonly" type='number' v-model="formData1.Number"
						placeholder="请输入人数"></u--input>
				</u-form-item>
				<u-form-item labelWidth="auto" label="店铺规模" required prop="storeScale" borderBottom>
					<u-radio-group :disabled="readonly" v-model="formData1.storeScale" style="margin: 16rpx;">
						<u-radio :customStyle="{marginRight: '16px'}"
							v-for="(item, index) in [{value:'0',label:'批发'},{value:'1',label:'零售'},{value:'2',label:'独家经营'}]"
							:key="index" :label="item.label" :name="item.value">
						</u-radio>
					</u-radio-group>
				</u-form-item>
				<u-form-item labelWidth="auto" label="店铺规模排名" required prop="storeRanking" borderBottom>
					<u-radio-group :disabled="readonly" v-model="formData1.storeRanking" style="margin: 16rpx;">

						<u-radio :customStyle="{marginRight: '16px'}"
							v-for="(item, index) in [{value:'0',label:'前3'},{value:'1',label:'居中'},{value:'2',label:'小规模'}]"
							:key="index" :label="item.label" :name="item.value">
						</u-radio>

					</u-radio-group>
				</u-form-item>
				<u-form-item labelWidth="auto" label="店铺影响力" required prop="Influence" borderBottom>
					<u-radio-group :disabled="readonly" v-model="formData1.Influence" style="margin: 16rpx;">

						<u-radio :customStyle="{marginRight: '16px'}"
							v-for="(item, index) in [{value:'0',label:'大'},{value:'1',label:'中'},{value:'2',label:'小'}]"
							:key="index" :label="item.label" :name="item.value">
						</u-radio>

					</u-radio-group>
				</u-form-item>
				<u-form-item labelWidth="auto" labelPosition="top" label="店铺年营收" required prop="revenue" borderBottom>
					<u-radio-group :disabled="readonly" v-model="formData1.revenue" style="margin: 16rpx;">

						<u-radio :customStyle="{marginRight: '16px',}"
							v-for="(item, index) in [{value:'0',label:'10万以下'},{value:'1',label:'10-30万'},{value:'2',label:'30万以上'}]"
							:key="index" :label="item.label" :name="item.value">
						</u-radio>

					</u-radio-group>
				</u-form-item>
				<u-form-item labelWidth="auto" label="店铺产权" required prop="propertyRights" borderBottom>
					<u-radio-group :disabled="readonly" v-model="formData1.propertyRights" style="margin: 16rpx;">
						<u-radio :customStyle="{marginRight: '16px'}"
							v-for="(item, index) in [{value:'0',label:'自有'},{value:'1',label:'租赁'}]" :key="index"
							:label="item.label" :name="item.value">
						</u-radio>
					</u-radio-group>
				</u-form-item>
				<u-form-item labelWidth="auto" label="店铺归属" required prop="ascription" borderBottom>
					<u-radio-group :disabled="readonly" v-model="formData1.ascription" style="margin: 16rpx;">
						<u-radio :customStyle="{marginRight: '16px',}"
							v-for="(item, index) in [{value:'0',label:'私有'},{value:'1',label:'合伙'},{value:'2',label:'加盟'},{value:'3',label:'国有'},]"
							:key="index" :label="item.label" :name="item.value">
						</u-radio>

					</u-radio-group>
				</u-form-item>
				<u-form-item labelWidth="auto" label="店铺进货渠道" borderBottom>
					<u--input :readonly="readonly" type='number' v-model="formData1.incomingChannels"
						placeholder="请输入进货渠道"></u--input>
				</u-form-item>
				<u-form-item labelWidth="auto" label="有无仓储" borderBottom>
					<u-radio-group :disabled="readonly" v-model="formData1.isWarehousing" style="margin: 16rpx;">
						<u-radio :customStyle="{marginRight: '16px'}"
							v-for="(item, index) in [{value:'1',label:'有'},{value:'0',label:'无'}]" :key="index"
							:label="item.label" :name="item.value">
						</u-radio>
					</u-radio-group>
				</u-form-item>
				<u-form-item labelWidth="auto" label="有无冻库" borderBottom>
					<u-radio-group :disabled="readonly" v-model="formData1.isColdStorage" style="margin: 16rpx;">
						<u-radio :customStyle="{marginRight: '16px'}"
							v-for="(item, index) in [{value:'1',label:'有'},{value:'0',label:'无'}]" :key="index"
							:label="item.label" :name="item.value">
						</u-radio>
					</u-radio-group>
				</u-form-item>
				<u-form-item labelWidth="auto" label="有无入驻其他平台" borderBottom>
					<u-radio-group :disabled="readonly" v-model="formData1.isSettled" style="margin: 16rpx;">
						<u-radio :customStyle="{marginRight: '16px'}"
							v-for="(item, index) in [{value:'1',label:'有'},{value:'0',label:'无'}]" :key="index"
							:label="item.label" :name="item.value">
						</u-radio>
					</u-radio-group>
				</u-form-item>
				<u-form-item labelWidth="auto" label="现代文化程度" borderBottom>
					<u--input :readonly="readonly" v-model="formData1.Education" placeholder="请输入文化程度"></u--input>
				</u-form-item>
				<u-form-item labelWidth="auto" label="有无宣传推广" borderBottom>
					<u-radio-group :disabled="readonly" v-model="formData1.isPublicize" style="margin: 16rpx;">
						<u-radio :customStyle="{marginRight: '16px'}"
							v-for="(item, index) in [{value:'1',label:'有'},{value:'0',label:'无'}]" :key="index"
							:label="item.label" :name="item.value">
						</u-radio>
					</u-radio-group>
				</u-form-item>
				<u-form-item labelWidth="auto" label="有无运输" borderBottom>
					<u-radio-group :disabled="readonly" v-model="formData1.isTransport" style="margin: 16rpx;">
						<u-radio :customStyle="{marginRight: '16px'}"
							v-for="(item, index) in [{value:'1',label:'有'},{value:'0',label:'无'}]" :key="index"
							:label="item.label" :name="item.value">
						</u-radio>
					</u-radio-group>
				</u-form-item>
				<u-form-item labelWidth="auto" label="主要供给明细" borderBottom>
					<u--input :readonly="readonly" v-model="formData1.supply" placeholder="请输入供给明细"></u--input>
				</u-form-item>
				<u-form-item labelWidth="auto" labelPosition="top" label="店铺述求" required prop="notes" borderBottom>
					<u--textarea :disabled="readonly" v-model="formData1.notes" autoHeight placeholder="请输入"
						border="surround" count></u--textarea>
				</u-form-item>
				<u-form-item labelWidth="auto" labelPosition="top" label="综合描述与分析" required prop="description"
					borderBottom>
					<u--textarea :disabled="readonly" v-model="formData1.description" autoHeight placeholder="请输入"
						border="surround" count></u--textarea>
				</u-form-item>
				<view class="" style="height: 20rpx;">

				</view>
				<u-button v-if="!readonly" type="primary" text="提交" @click="confirm" color="#0122C7"></u-button>
			</u--form>

		</view>
	</view>

	<view class="" v-else>
		<u-loading-page></u-loading-page>
	</view>

</template>

<script>
	import {
		Toast
	} from "../../libs/uniApi.js"
	import {
		townMasterTask3Commit,
		townMasterTask3List
	} from "@/api/task.js"
	export default {
		props: {
			datas: {
				type: Object,
				default: null
			},
			update_time: {
				type: String,
				default: null
			}
		},
		data() {
			return {
				flag: false,
				page: 1,
				taskId: "",
				readonly: false,
				landPlanList: ['自己养', '出租', '代养', '租更多地扩大养殖'],
				breedingTypeList: [{
						id: 1,
						name: "水产"
					},
					{
						id: 2,
						name: "禽类"
					},
					{
						id: 3,
						name: "大型动物"
					},
				],
				formData: {
					"entityName": "",
					phone: "",
					employee: "",
					arableLand: "",
					"breeding_training": 1, //有无养殖培训

					"breeding_type": "", //养殖类型
					"area": "", //面积
					breeding_begin_time: "",
					"breeding_time": "", //养殖开始时间
					"mature_time": "", //上市时间
					"yield": "", //产量
					salesChannels: "",
					isExpandOperations: "", //扩大经营
					request: "", //述求
					isPolicySubsidies: "", //政策补贴
					isLots: "", //公仪平
					isNeedLots: "", //公仪平
					family: "",
					familyNotes: "",
					"farm_tools": "", //农资农具使用情况
					"ecological_farming": "", //是否生态养殖
					"modernization": "", //现代化程度
					"processing_storage": "", //有无加工仓储
					"promote": "", //有无宣传推广
					"transportation": "", //有无运输
				},

				formData1: {
					storeName: "",
					type: "",
					shopkeeperName: "",
					shopkeeperSex: "",
					shopkeeperAge: "",
					shopkeeperPhone: "",
					address: "",
					area: "",
					storeAge: "",
					Number: "",
					storeScale: "",
					storeRanking: "",
					Influence: "",
					revenue: "",
					propertyRights: "",
					ascription: "",
					incomingChannels: "",
					isWarehousing: "",
					isColdStorage: "",
					isSettled: "",
					Education: "",
					isPublicize: "",
					isTransport: "",
					supply: "",
					notes: "",
					description: ""
				},
				rules: {

				},
				rules1: {

				}
			}
		},
		onLoad(option) {
			this.taskId = option.task_id
			if (option.type == 'supply') this.page = 0
			if (option.index) {
				townMasterTask3List({
					id: option.task_id
				}).then(res => {
					this.readonly = true
					this.flag = true
					if (option.type == 'supply') {
						this.formData1 = res.data.template_info.extend.purchase_sales_info[option.index]?.supply[0]
					} else {
						this.formData = res.data.template_info.extend.purchase_sales_info[option.index]?.planting[
							0]
					}

				})
			}

			// }
			this.flag = true

		},
		created() {
			this.initRules();

		},

		computed: {
			breedingName() {
				return this.breedingTypeList.find((item) => item.id == this.formData.breeding_type)?.name;
			}
		},
		methods: {
			// 初始化校验
			initRules() {
				let arr = Object.keys(this.formData);
				let arr1 = Object.keys(this.formData1);
				let white = ['demand', 'policy_subsidies'];
				arr = arr.filter(item => {
					return !white.includes(item);
				})
				arr1 = arr1.filter(item => {
					return !white.includes(item);
				})
				arr.forEach(key => {

					this.rules[key] = {
						validator: (rule, value, callback) => {
							this.$refs.breedingForm.clearValidate(rule.field);
							value.trim() !== '' ? callback() : callback('不能为空');
						},
						trigger: ['change', 'blur']
					}
					if (key == 'phone') {
						console.log("phone")
						this.rules[key] = [{
								required: true,
								message: '请输入手机号',
								trigger: ['change', 'blur'],
							},
							{

								validator: (rule, value, callback) => {

									return uni.$u.test.mobile(value);
								},
								message: '手机号码不正确',

								trigger: ['blur'],
							}
						]
					}
				})
				arr1.forEach(key => {
					this.rules1[key] = {
						validator: (rule, value, callback) => {
							this.$refs.breedingForm1.clearValidate(rule.field);
							value.trim() !== '' ? callback() : callback('不能为空');
						},
						trigger: ['change', 'blur']
					}
					if (key == 'shopkeeperPhone') {

						this.rules1[key] = [{
								required: true,
								message: '请输入手机号',
								trigger: ['change', 'blur'],
							},
							{

								validator: (rule, value, callback) => {

									return uni.$u.test.mobile(value);
								},
								message: '手机号码不正确',

								trigger: ['blur'],
							}
						]
					}
				})
			},
			// 校验
			async validate() {
				return await this.$refs.breedingForm.validate();
			},
			async validate1() {
				return await this.$refs.breedingForm1.validate();
			},
			// 选择养殖类型
			changeBreeding(e) {
				// let index = e.currentTarget.dataset.index;
				this.formData.breeding_type = this.breedingTypeList[e.detail.value].id;
			},
			// 选择时间
			changeDate(e) {
				let data = e.currentTarget.dataset;
				this.formData[data.value] = e.detail.value;
			},
			async commit() {
				if (this.page) {
					await townMasterTask3Commit({
						id: Number(this.taskId),
						purchase_sales_info: {
							planting: [{
								...this.formData
							}],

						}
					})


				} else {
					await townMasterTask3Commit({
						id: Number(this.taskId),
						purchase_sales_info: {
							supply: [{
								...this.formData1
							}],
						}
					})
				}
				Toast("操作成功")
				setTimeout(() => {
					uni.navigateBack()
				}, 1000)

			},
			// async nextFormFn() {
			// 	await this.validate()
			// 	this.page = 0
			// },
			async confirm1() {
				await this.validate()
				this.commit()
			},
			async confirm() {
				await this.validate1()
				this.commit()
			}
		},
	}
</script>

<style lang="scss">
	.card {
		background-color: #fff;
		margin: 28rpx;
		padding: 28rpx;
		margin-top: 0;
		padding-top: 0;
		border-radius: 0 0 14rpx 14rpx;
	}

	.tit {
		margin: 28rpx 28rpx 0 28rpx;
		padding: 28rpx 28rpx 0 28rpx;
		border-radius: 14rpx 14rpx 0 0;
		background-color: $theme-oa-color;
		color: white;
		height: 100rpx;
		display: flex;
		justify-content: space-between;
	}

	.title {
		font-weight: 500;
		font-size: 34rpx;

		&::before {
			width: 8rpx;
			height: 26rpx;
			border-radius: 4rpx;
			background-color: #0122c7;
			content: "";
			display: inline-block;
			margin-right: 8rpx;
		}
	}

	.delete {
		margin: 22rpx 0;
		// margin-bottom: 40rpx;
		width: 100%;
		height: 64rpx;
		line-height: 64rpx;
		background: #f56c6c;
		border-radius: 14rpx;
		font-size: 28rpx;
		color: #fff;
		text-align: center;
	}

	.plus {
		margin: 22rpx 0;
		// margin-bottom: 40rpx;
		width: 100%;
		height: 64rpx;
		line-height: 64rpx;
		background: $theme-oa-color;
		border-radius: 14rpx;
		font-size: 28rpx;
		color: #fff;
		text-align: center;
	}
</style>