<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'>
				<u-form-item label="发货单据编码" prop="docNo" borderBottom>
					<u--input style="width: 100%;" disabled v-model="form.docNo"></u--input>
				</u-form-item>
				<u-form-item label="订单编码" prop="orderNo" borderBottom>
					<u--input style="width: 100%;" disabled v-model="form.orderNo"></u--input>
				</u-form-item>
				<u-form-item label="客户名称" prop="contactName" borderBottom>
					<u--input style="width: 100%;" disabled v-model="form.contactName"></u--input>
				</u-form-item>
				<u-form-item label="客户联系人" prop="linkName" borderBottom>
					<u--input style="width: 100%;" disabled v-model="form.linkName"></u--input>
				</u-form-item>
				<u-form-item label="客户电话" prop="linkPhone" borderBottom>
					<u--input style="width: 100%;" disabled v-model="form.linkPhone"></u--input>
				</u-form-item>
				<u-form-item label="客户地址" prop="receiveAddress" borderBottom>
					<u--input style="width: 100%;" disabled v-model="form.receiveAddress"></u--input>
				</u-form-item>
				<u-form-item label="车牌号" prop="carNo" borderBottom>
					<u--input style="width: 100%;" disabled v-model="form.carNo"></u--input>
				</u-form-item>

			</u--form>

		</view>
		<view v-show='curNow===1'>
			<view v-for="(item,index) in form['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>
</template>

<script>
	import {
		getSaleOrderSendRecordDetailAPI
	} from '@/api/wt/index.js'
	export default {
		props: {
			businessId: {
				default: ''
			},
			taskDefinitionKey: {
				default: ''
			},
		},
		data() {
			return {
				form: {},
				tableField: [{
						label: '名称',
						field: 'productName',
					},
					{
						label: '编码',
						field: 'productCode',
					},
					{
						label: '类型',
						field: 'productCategoryName',
					},
					{
						label: '客户代号',
						field: 'customerMark',
					},
					{
						label: '单价',
						field: 'singlePrice',
					},
					{
						label: '数量',
						field: 'totalCount',
					},
					{
						label: '合计',
						field: 'totalPrice',
					},
				],
				list: ['发货信息', '产品清单'],
				curNow: 0
			}
		},
		async mounted() {
			await this.getDetailData(this.businessId);
		},
		methods: {
			sectionChange(index) {
				this.curNow = index;
			},
			async getDetailData(id) {
				const data = await getSaleOrderSendRecordDetailAPI(id);
				this.form = data;
			},
			//
			getTableValue() {
				return new Promise(async (resolve, reject) => {
					try {
						await this.$refs.uForm[0].validate()
						resolve(this.form)
					} catch {
						reject(null)
					}


				})
			},
		}
	}
</script>

<style>
</style>