// 【重要】必须使用 const Component 作为组件变量名
// 财务管理 - 提车应收款 - 提车收款单（2026年3月10日版本）

const Component = function () {
	var useState = React.useState;
	var useCallback = React.useCallback;
	var useMemo = React.useMemo;
	var useEffect = React.useEffect;
	var useRef = React.useRef;

	var antd = window.antd;
	var Card = antd.Card;
	var Input = antd.Input;
	var Button = antd.Button;
	var Select = antd.Select;
	var Table = antd.Table;
	var Popover = antd.Popover;
	var Tooltip = antd.Tooltip;
	var Modal = antd.Modal;
	var message = antd.message;
	var DatePicker = antd.DatePicker;
	var Alert = antd.Alert;
	var Option = Select.Option;
	var dayjs = window.dayjs;

	var fmtMoney = window.__oneosFormatMoney || function (v) {
		var n = parseFloat(v);
		if (!Number.isFinite(n)) n = 0;
		return n.toLocaleString('zh-CN', { minimumFractionDigits: 2, maximumFractionDigits: 2 });
	};
	function fmtYuan(v) {
		return fmtMoney(v) + ' 元';
	}

	var edited = useState(false);
	var setEdited = edited[1];
	var submitConfirmVisible = useState(false);
	var setSubmitConfirmVisible = submitConfirmVisible[1];
	var cancelConfirmVisible = useState(false);
	var setCancelConfirmVisible = cancelConfirmVisible[1];
	var projectCardExpanded = useState(true);
	var setProjectCardExpanded = projectCardExpanded[1];
	var receivableCardExpanded = useState(true);
	var setReceivableCardExpanded = receivableCardExpanded[1];
	var servicePopoverRowIndex = useState(null);
	var setServicePopoverRowIndex = servicePopoverRowIndex[1];

	var handleCtx = typeof window !== 'undefined' ? window.__pickupHandleContext : null;
	var pickupCalc = typeof window !== 'undefined' ? window.__pickupCalc : null;

	var pickupDateState = useState(function () {
		return (handleCtx && handleCtx.pickupDate) ? handleCtx.pickupDate : '2026-03-12';
	});
	var pickupDate = pickupDateState[0];
	var setPickupDate = pickupDateState[1];

	// 项目信息：优先读取办理上下文（来自提车应收款列表）
	var projectInfo = useMemo(function () {
		if (handleCtx) {
			return {
				collectCode: handleCtx.collectCode || '',
				contractCode: handleCtx.contractCode || '',
				contractType: handleCtx.contractType || '',
				projectName: handleCtx.projectName || '',
				customerName: handleCtx.customerName || '',
				paymentMethod: handleCtx.paymentMethod || '预付',
				paymentCycle: handleCtx.paymentCycle || '6个月',
				contractStart: handleCtx.contractStart || '',
				contractEnd: handleCtx.contractEnd || '',
				businessDept: handleCtx.businessDept || '',
				businessPerson: handleCtx.businessPerson || ''
			};
		}
		return {
			collectCode: 'HT-ZL-2025-001TC0001',
			contractCode: 'HT-ZL-2025-001',
			contractType: '正式合同',
			projectName: '嘉兴氢能示范项目',
			customerName: '嘉兴某某物流有限公司',
			paymentMethod: '预付',
			paymentCycle: '6个月',
			contractStart: '2025-01-15',
			contractEnd: '2026-01-14',
			businessDept: '业务1部',
			businessPerson: '张经理'
		};
	}, [handleCtx]);

	var paymentCycleMonths = handleCtx && handleCtx.paymentCycleMonths
		? handleCtx.paymentCycleMonths
		: 6;

	var defaultVehicles = handleCtx && handleCtx.vehicles && handleCtx.vehicles.length
		? handleCtx.vehicles
		: [
		{ key: 'v1', index: 1, brand: '东风', model: 'DFH1180', plateNo: '浙A12345', monthRent: 5000, receivableRent: 30000, actualRent: '30000.00', rentRemark: '', receivableDeposit: 10000, serviceItems: [{ name: '代处理费用', receivable: 200, actual: '200.00', discount: '0.00', remark: '' }, { name: '保险上浮', receivable: 500, actual: '500.00', discount: '0.00', remark: '' }], receivableService: 700, actualService: '700.00', discountAmount: '0.00', discountRemark: '', discountProof: [], selected: true, receivableCompleted: true },
		{ key: 'v2', index: 2, brand: '福田', model: 'BJ1180', plateNo: '浙A23456', monthRent: 4500, receivableRent: 27000, actualRent: '27000.00', rentRemark: '', receivableDeposit: 8000, serviceItems: [{ name: '保养费用', receivable: 300, actual: '300.00', discount: '0.00', remark: '' }], receivableService: 300, actualService: '300.00', discountAmount: '0.00', discountRemark: '', discountProof: [], selected: true, receivableCompleted: true },
		{ key: 'v3', index: 3, brand: '重汽', model: 'ZZ1187', plateNo: '浙A34567', monthRent: 5200, receivableRent: 31200, actualRent: '31200.00', rentRemark: '', receivableDeposit: 10000, serviceItems: [{ name: '代处理费用', receivable: 180, actual: '180.00', discount: '0.00', remark: '' }, { name: '上牌服务', receivable: 400, actual: '400.00', discount: '0.00', remark: '' }], receivableService: 580, actualService: '580.00', discountAmount: '0.00', discountRemark: '', discountProof: [], selected: true, receivableCompleted: true },
		{ key: 'v4', index: 4, brand: '陕汽', model: 'SX1313', plateNo: '', monthRent: 4800, receivableRent: 28800, actualRent: '28800.00', rentRemark: '', receivableDeposit: 9000, serviceItems: [{ name: '保险上浮', receivable: 350, actual: '350.00', discount: '0.00', remark: '' }], receivableService: 350, actualService: '350.00', discountAmount: '0.00', discountRemark: '', discountProof: [], selected: false },
		{ key: 'v5', index: 5, brand: '解放', model: 'J6P', plateNo: '浙A45678', monthRent: 5500, receivableRent: 33000, actualRent: '33000.00', rentRemark: '', receivableDeposit: 11000, serviceItems: [{ name: '代处理费用', receivable: 220, actual: '220.00', discount: '0.00', remark: '' }, { name: '保养费用', receivable: 280, actual: '280.00', discount: '0.00', remark: '' }], receivableService: 500, actualService: '500.00', discountAmount: '0.00', discountRemark: '', discountProof: [], selected: false },
		{ key: 'v6', index: 6, brand: '江淮', model: '格尔发K5', plateNo: '浙A56789', monthRent: 4300, receivableRent: 25800, actualRent: '25800.00', rentRemark: '', receivableDeposit: 8500, serviceItems: [{ name: '保养费用', receivable: 260, actual: '260.00', discount: '0.00', remark: '' }], receivableService: 260, actualService: '260.00', discountAmount: '0.00', discountRemark: '', discountProof: [], selected: false },
		{ key: 'v7', index: 7, brand: '东风', model: 'DFH1250', plateNo: '浙A67890', monthRent: 6000, receivableRent: 36000, actualRent: '36000.00', rentRemark: '', receivableDeposit: 12000, serviceItems: [{ name: '代处理费用', receivable: 250, actual: '250.00', discount: '0.00', remark: '' }, { name: '保险上浮', receivable: 600, actual: '600.00', discount: '0.00', remark: '' }], receivableService: 850, actualService: '850.00', discountAmount: '0.00', discountRemark: '', discountProof: [], selected: false },
		{ key: 'v8', index: 8, brand: '福田', model: '欧曼EST', plateNo: '', monthRent: 4700, receivableRent: 28200, actualRent: '28200.00', rentRemark: '', receivableDeposit: 9000, serviceItems: [{ name: '上牌服务', receivable: 380, actual: '380.00', discount: '0.00', remark: '' }], receivableService: 380, actualService: '380.00', discountAmount: '0.00', discountRemark: '', discountProof: [], selected: false },
		{ key: 'v9', index: 9, brand: '重汽', model: '豪沃T7H', plateNo: '浙A78901', monthRent: 5300, receivableRent: 31800, actualRent: '31800.00', rentRemark: '', receivableDeposit: 10500, serviceItems: [{ name: '代处理费用', receivable: 200, actual: '200.00', discount: '0.00', remark: '' }, { name: '保养费用', receivable: 320, actual: '320.00', discount: '0.00', remark: '' }], receivableService: 520, actualService: '520.00', discountAmount: '0.00', discountRemark: '', discountProof: [], selected: false },
		{ key: 'v10', index: 10, brand: '陕汽', model: '德龙X3000', plateNo: '浙A89012', monthRent: 5100, receivableRent: 30600, actualRent: '30600.00', rentRemark: '', receivableDeposit: 10000, serviceItems: [{ name: '保险上浮', receivable: 450, actual: '450.00', discount: '0.00', remark: '' }], receivableService: 450, actualService: '450.00', discountAmount: '0.00', discountRemark: '', discountProof: [], selected: false },
		{ key: 'v11', index: 11, brand: '解放', model: 'JH6', plateNo: '浙A90123', monthRent: 5400, receivableRent: 32400, actualRent: '32400.00', rentRemark: '', receivableDeposit: 10800, serviceItems: [{ name: '代处理费用', receivable: 210, actual: '210.00', discount: '0.00', remark: '' }, { name: '上牌服务', receivable: 420, actual: '420.00', discount: '0.00', remark: '' }], receivableService: 630, actualService: '630.00', discountAmount: '0.00', discountRemark: '', discountProof: [], selected: false },
		{ key: 'v12', index: 12, brand: '江淮', model: '帅铃', plateNo: '', monthRent: 4000, receivableRent: 24000, actualRent: '24000.00', rentRemark: '', receivableDeposit: 8000, serviceItems: [{ name: '保养费用', receivable: 240, actual: '240.00', discount: '0.00', remark: '' }], receivableService: 240, actualService: '240.00', discountAmount: '0.00', discountRemark: '', discountProof: [], selected: false },
		{ key: 'v13', index: 13, brand: '东风', model: 'DFH1180', plateNo: '浙B12345', monthRent: 5000, receivableRent: 30000, actualRent: '30000.00', rentRemark: '', receivableDeposit: 10000, serviceItems: [{ name: '代处理费用', receivable: 200, actual: '200.00', discount: '0.00', remark: '' }], receivableService: 200, actualService: '200.00', discountAmount: '500.00', discountRemark: '首月优惠', discountProof: [], selected: false },
		{ key: 'v14', index: 14, brand: '福田', model: 'BJ1180', plateNo: '浙B23456', monthRent: 4600, receivableRent: 27600, actualRent: '27600.00', rentRemark: '', receivableDeposit: 9200, serviceItems: [{ name: '保险上浮', receivable: 380, actual: '380.00', discount: '0.00', remark: '' }], receivableService: 380, actualService: '380.00', discountAmount: '0.00', discountRemark: '', discountProof: [], selected: false },
		{ key: 'v15', index: 15, brand: '重汽', model: 'ZZ1187', plateNo: '浙B34567', monthRent: 4900, receivableRent: 29400, actualRent: '29400.00', rentRemark: '', receivableDeposit: 9800, serviceItems: [{ name: '代处理费用', receivable: 190, actual: '190.00', discount: '0.00', remark: '' }, { name: '保养费用', receivable: 310, actual: '310.00', discount: '0.00', remark: '' }], receivableService: 500, actualService: '500.00', discountAmount: '0.00', discountRemark: '', discountProof: [], selected: false },
		{ key: 'v16', index: 16, brand: '陕汽', model: 'SX1313', plateNo: '', monthRent: 4750, receivableRent: 28500, actualRent: '28500.00', rentRemark: '', receivableDeposit: 9500, serviceItems: [{ name: '上牌服务', receivable: 360, actual: '360.00', discount: '0.00', remark: '' }], receivableService: 360, actualService: '360.00', discountAmount: '0.00', discountRemark: '', discountProof: [], selected: false },
		{ key: 'v17', index: 17, brand: '解放', model: 'J6P', plateNo: '浙B45678', monthRent: 5600, receivableRent: 33600, actualRent: '33600.00', rentRemark: '', receivableDeposit: 11200, serviceItems: [{ name: '代处理费用', receivable: 230, actual: '230.00', discount: '0.00', remark: '' }, { name: '保险上浮', receivable: 550, actual: '550.00', discount: '0.00', remark: '' }], receivableService: 780, actualService: '780.00', discountAmount: '0.00', discountRemark: '', discountProof: [], selected: false },
		{ key: 'v18', index: 18, brand: '江淮', model: '格尔发K5', plateNo: '浙B56789', monthRent: 4400, receivableRent: 26400, actualRent: '26400.00', rentRemark: '', receivableDeposit: 8800, serviceItems: [{ name: '保养费用', receivable: 270, actual: '270.00', discount: '0.00', remark: '' }], receivableService: 270, actualService: '270.00', discountAmount: '0.00', discountRemark: '', discountProof: [], selected: false },
		{ key: 'v19', index: 19, brand: '东风', model: 'DFH1250', plateNo: '浙B67890', monthRent: 5800, receivableRent: 34800, actualRent: '34800.00', rentRemark: '', receivableDeposit: 11600, serviceItems: [{ name: '代处理费用', receivable: 240, actual: '240.00', discount: '0.00', remark: '' }], receivableService: 240, actualService: '240.00', discountAmount: '200.00', discountRemark: '客户协商', discountProof: [], selected: false },
		{ key: 'v20', index: 20, brand: '福田', model: '欧曼EST', plateNo: '浙B78901', monthRent: 4650, receivableRent: 27900, actualRent: '27900.00', rentRemark: '', receivableDeposit: 9300, serviceItems: [{ name: '上牌服务', receivable: 390, actual: '390.00', discount: '0.00', remark: '' }, { name: '保养费用', receivable: 290, actual: '290.00', discount: '0.00', remark: '' }], receivableService: 680, actualService: '680.00', discountAmount: '0.00', discountRemark: '', discountProof: [], selected: false }
	];

	var vehicleRows = useState(defaultVehicles);
	var vehicles = vehicleRows[0];
	var setVehicles = vehicleRows[1];

	function recalcVehiclesByPickupDate(nextDate, prevVehicles) {
		if (!pickupCalc || !pickupCalc.applyPickupDateToVehicles) return prevVehicles;
		return pickupCalc.applyPickupDateToVehicles(prevVehicles, nextDate, paymentCycleMonths);
	}

	useEffect(function () {
		if (!pickupDate) return;
		setVehicles(function (prev) {
			return recalcVehiclesByPickupDate(pickupDate, prev);
		});
	}, [pickupDate, paymentCycleMonths]);

	var batchSummary = useMemo(function () {
		if (!pickupCalc || !pickupCalc.buildBatchPickupScheduleSummary) return null;
		return pickupCalc.buildBatchPickupScheduleSummary(vehicles, pickupDate, paymentCycleMonths);
	}, [vehicles, pickupDate, paymentCycleMonths]);

	var pickupRuleText = useMemo(function () {
		if (!pickupCalc || !pickupCalc.describePickupRule || !batchSummary) return '';
		return pickupCalc.describePickupRule(batchSummary.rule);
	}, [batchSummary]);

	// 氢费预付款（非预付款模式时不显示）
	var hasHydrogenPrepay = !handleCtx || handleCtx.paymentMethod !== '后付';
	var hydrogenRow = useState({
		receivable: '3580.00',
		actual: '3580.00',
		discount: '0.00',
		discountRemark: ''
	});
	var hydrogen = hydrogenRow[0];
	var setHydrogen = hydrogenRow[1];

	var invoiceMethod = useState('先开票后付款');
	var setInvoiceMethod = invoiceMethod[1];
	var invoiceRemark = useState('');
	var setInvoiceRemark = invoiceRemark[1];

	var toggleVehicleSelected = useCallback(function (key) {
		setEdited(true);
		setVehicles(function (prev) {
			return prev.map(function (r) {
				if (r.key !== key || r.receivableCompleted) return r;
				return Object.assign({}, r, { selected: !r.selected });
			});
		});
	}, []);

	var toggleAllSelected = useCallback(function (checked) {
		setEdited(true);
		setVehicles(function (prev) {
			return prev.map(function (r) {
				if (r.receivableCompleted) return r;
				return Object.assign({}, r, { selected: !!checked });
			});
		});
	}, []);

	var updateVehicle = useCallback(function (key, field, value) {
		setEdited(true);
		setVehicles(function (prev) {
			return prev.map(function (r) {
				if (r.key !== key) return r;
				var next = Object.assign({}, r);
				next[field] = value;
				if (field === 'serviceItems') {
					var total = 0;
					(value || []).forEach(function (s) { total += parseFloat(s.actual) || 0; });
					next.actualService = total.toFixed(2);
				}
				return next;
			});
		});
	}, []);

	var updateServiceItem = useCallback(function (vehicleKey, itemIndex, field, value) {
		setEdited(true);
		setVehicles(function (prev) {
			return prev.map(function (r) {
				if (r.key !== vehicleKey) return r;
				var items = (r.serviceItems || []).slice();
				if (!items[itemIndex]) return r;
				items[itemIndex] = Object.assign({}, items[itemIndex], { [field]: value });
				var total = 0;
				items.forEach(function (s) { total += parseFloat(s.actual) || 0; });
				return Object.assign({}, r, { serviceItems: items, actualService: total.toFixed(2) });
			});
		});
	}, []);

	var totals = useMemo(function () {
		// 只计算已选中且未完成提车应收款的车辆
		var selected = vehicles.filter(function (v) { return v.selected && !v.receivableCompleted; });
		var receivableRent = 0, actualRent = 0, receivableDeposit = 0, receivableService = 0, actualService = 0, discountTotal = 0;
		selected.forEach(function (v) {
			receivableRent += Number(v.receivableRent) || 0;
			actualRent += parseFloat(v.actualRent) || 0;
			receivableDeposit += Number(v.receivableDeposit) || 0;
			receivableService += Number(v.receivableService) || 0;
			actualService += parseFloat(v.actualService) || 0;
			discountTotal += parseFloat(v.discountAmount) || 0;
		});
		return {
			receivableRent: receivableRent.toFixed(2),
			actualRent: actualRent.toFixed(2),
			receivableDeposit: receivableDeposit.toFixed(2),
			receivableService: receivableService.toFixed(2),
			actualService: actualService.toFixed(2),
			discountTotal: discountTotal.toFixed(2)
		};
	}, [vehicles]);

	var hydrogenReceivable = hasHydrogenPrepay ? (parseFloat(hydrogen.receivable) || 0) : 0;
	var hydrogenActual = hasHydrogenPrepay ? (parseFloat(hydrogen.actual) || 0) : 0;

	var receivableTotal = useMemo(function () {
		var base = batchSummary ? batchSummary.totalReceivable : (
			parseFloat(totals.receivableRent) + parseFloat(totals.receivableDeposit) + parseFloat(totals.receivableService)
		);
		return (base + hydrogenReceivable).toFixed(2);
	}, [totals, hydrogenReceivable, batchSummary]);

	var actualTotal = useMemo(function () {
		var base = batchSummary ? batchSummary.beforePickup.amount : (
			parseFloat(totals.actualRent) + parseFloat(totals.receivableDeposit) + parseFloat(totals.actualService) - parseFloat(totals.discountTotal)
		);
		return (base + hydrogenActual).toFixed(2);
	}, [totals, hydrogenActual, batchSummary]);

	var invoiceTotal = useMemo(function () {
		var base = parseFloat(totals.actualRent) + parseFloat(totals.actualService) - parseFloat(totals.discountTotal);
		return (base + hydrogenActual).toFixed(2);
	}, [totals, hydrogenActual]);

	var receivablePopoverContent = useMemo(function () {
		var rows = [];
		if (batchSummary) {
			rows.push(React.createElement('tr', { key: 'before-deposit' }, React.createElement('td', { style: { padding: '6px 8px' } }, '提车前2日内 · 保证金'), React.createElement('td', { style: { textAlign: 'right', padding: '6px 8px' }, className: 'tabular-nums' }, fmtYuan(batchSummary.beforePickup.deposit))));
			rows.push(React.createElement('tr', { key: 'before-rent' }, React.createElement('td', { style: { padding: '6px 8px' } }, '提车前2日内 · 租金'), React.createElement('td', { style: { textAlign: 'right', padding: '6px 8px' }, className: 'tabular-nums' }, fmtYuan(batchSummary.beforePickup.rent))));
			rows.push(React.createElement('tr', { key: 'before-service' }, React.createElement('td', { style: { padding: '6px 8px' } }, '提车前2日内 · 服务费'), React.createElement('td', { style: { textAlign: 'right', padding: '6px 8px' }, className: 'tabular-nums' }, fmtYuan(batchSummary.beforePickup.service))));
			if (batchSummary.month25.amount > 0) {
				rows.push(React.createElement('tr', { key: 'm25-rent' }, React.createElement('td', { style: { padding: '6px 8px' } }, '当月25日 · 下周期租金'), React.createElement('td', { style: { textAlign: 'right', padding: '6px 8px' }, className: 'tabular-nums' }, fmtYuan(batchSummary.month25.rent))));
				rows.push(React.createElement('tr', { key: 'm25-service' }, React.createElement('td', { style: { padding: '6px 8px' } }, '当月25日 · 下周期服务费'), React.createElement('td', { style: { textAlign: 'right', padding: '6px 8px' }, className: 'tabular-nums' }, fmtYuan(batchSummary.month25.service))));
			}
		} else {
			rows = [
				React.createElement('tr', { key: 'rent' }, React.createElement('td', { style: { padding: '6px 8px' } }, '总计应收车辆月租金'), React.createElement('td', { style: { textAlign: 'right', padding: '6px 8px' }, className: 'tabular-nums' }, fmtYuan(totals.receivableRent))),
				React.createElement('tr', { key: 'deposit' }, React.createElement('td', { style: { padding: '6px 8px' } }, '总计应收车辆保证金'), React.createElement('td', { style: { textAlign: 'right', padding: '6px 8px' }, className: 'tabular-nums' }, fmtYuan(totals.receivableDeposit))),
				React.createElement('tr', { key: 'service' }, React.createElement('td', { style: { padding: '6px 8px' } }, '总计应收服务费'), React.createElement('td', { style: { textAlign: 'right', padding: '6px 8px' }, className: 'tabular-nums' }, fmtYuan(totals.receivableService)))
			];
		}
		if (hasHydrogenPrepay) {
			rows.push(React.createElement('tr', { key: 'hydrogen' }, React.createElement('td', { style: { padding: '6px 8px' } }, '氢费预充值应收金额'), React.createElement('td', { style: { textAlign: 'right', padding: '6px 8px' }, className: 'tabular-nums' }, fmtYuan(hydrogen.receivable))));
		}
		return React.createElement('div', { style: { padding: 8, minWidth: 260 } },
			React.createElement('table', { style: { width: '100%', borderCollapse: 'collapse', fontSize: 13 } },
				React.createElement('thead', null,
					React.createElement('tr', null,
						React.createElement('th', { style: { textAlign: 'left', padding: '6px 8px', borderBottom: '1px solid #f0f0f0' } }, '项目'),
						React.createElement('th', { style: { textAlign: 'right', padding: '6px 8px', borderBottom: '1px solid #f0f0f0' } }, '金额')
					)
				),
				React.createElement('tbody', null, rows)
			)
		);
	}, [totals, hasHydrogenPrepay, hydrogen.receivable, batchSummary]);

	var actualPopoverContent = useMemo(function () {
		var rows = [
			React.createElement('tr', { key: 'rent' }, React.createElement('td', { style: { padding: '6px 8px' } }, '总计实收车辆月租金'), React.createElement('td', { style: { textAlign: 'right', padding: '6px 8px' }, className: 'tabular-nums' }, fmtYuan(totals.actualRent))),
			React.createElement('tr', { key: 'deposit' }, React.createElement('td', { style: { padding: '6px 8px' } }, '总计应收车辆保证金'), React.createElement('td', { style: { textAlign: 'right', padding: '6px 8px' }, className: 'tabular-nums' }, fmtYuan(totals.receivableDeposit))),
			React.createElement('tr', { key: 'service' }, React.createElement('td', { style: { padding: '6px 8px' } }, '总计实收服务费'), React.createElement('td', { style: { textAlign: 'right', padding: '6px 8px' }, className: 'tabular-nums' }, fmtYuan(totals.actualService))),
			React.createElement('tr', { key: 'discount' }, React.createElement('td', { style: { padding: '6px 8px' } }, '总计减免金额'), React.createElement('td', { style: { textAlign: 'right', padding: '6px 8px' }, className: 'tabular-nums' }, fmtYuan(totals.discountTotal)))
		];
		if (hasHydrogenPrepay) {
			rows.push(React.createElement('tr', { key: 'hydrogen' }, React.createElement('td', { style: { padding: '6px 8px' } }, '氢费预充值实收金额'), React.createElement('td', { style: { textAlign: 'right', padding: '6px 8px' }, className: 'tabular-nums' }, fmtYuan(hydrogen.actual))));
		}
		return React.createElement('div', { style: { padding: 8, minWidth: 220 } },
			React.createElement('table', { style: { width: '100%', borderCollapse: 'collapse', fontSize: 13 } },
				React.createElement('thead', null,
					React.createElement('tr', null,
						React.createElement('th', { style: { textAlign: 'left', padding: '6px 8px', borderBottom: '1px solid #f0f0f0' } }, '项目'),
						React.createElement('th', { style: { textAlign: 'right', padding: '6px 8px', borderBottom: '1px solid #f0f0f0' } }, '金额')
					)
				),
				React.createElement('tbody', null, rows)
			)
		);
	}, [totals, hasHydrogenPrepay, hydrogen.actual]);

	var handleSubmit = useCallback(function () {
		if (!pickupDate) {
			message.warning('请先设置提车日期');
			return;
		}
		var selected = vehicles.filter(function (v) { return v.selected && !v.receivableCompleted; });
		if (!selected.length) {
			message.warning('请至少勾选一辆本次提车车辆');
			return;
		}
		setSubmitConfirmVisible(true);
	}, [pickupDate, vehicles]);

	var handleSubmitConfirm = useCallback(function () {
		if (!pickupDate) {
			message.warning('请先设置提车日期');
			return;
		}
		var selected = vehicles.filter(function (v) { return v.selected && !v.receivableCompleted; });
		if (!selected.length) {
			message.warning('请至少勾选一辆本次提车车辆');
			return;
		}
		var deliveryVehicles = selected.map(function (v) {
			return { brand: v.brand, model: v.model, plateNo: v.plateNo, seq: v.index };
		});
		var payload = {
			pickupDate: pickupDate,
			receivableSchedule: batchSummary,
			deliveryVehicles: deliveryVehicles,
			receivableRent: batchSummary
				? (batchSummary.beforePickup.rent || 0) + (batchSummary.month25.rent || 0)
				: parseFloat(totals.receivableRent) || 0,
			receivableDeposit: batchSummary
				? (batchSummary.beforePickup.deposit || 0)
				: parseFloat(totals.receivableDeposit) || 0,
			receivableService: batchSummary
				? (batchSummary.beforePickup.service || 0) + (batchSummary.month25.service || 0)
				: parseFloat(totals.receivableService) || 0,
			receivedRent: parseFloat(totals.actualRent) || 0,
			receivedDeposit: parseFloat(totals.receivableDeposit) || 0,
			receivedService: parseFloat(totals.actualService) || 0,
			receivableTotal: parseFloat(receivableTotal) || 0,
			actualTotal: parseFloat(actualTotal) || 0,
			discountTotal: parseFloat(totals.discountTotal) || 0,
			arrivalAmount: 0,
			financeReceived: 0,
		};
		if (window.__pickupHandleSubmit) window.__pickupHandleSubmit(payload);
		var ccMsg = window.__pickupBuildSubmitCcMessage
			? window.__pickupBuildSubmitCcMessage()
			: '已快速生成提车应收款单据，审批中心已抄送「财务」';
		message.success(ccMsg);
		setSubmitConfirmVisible(false);
		if (window.__receivableSubmit) window.__receivableSubmit();
	}, [vehicles, pickupDate, batchSummary, receivableTotal, actualTotal, totals.discountTotal]);

	var handleSave = useCallback(function () {
		message.success('保存成功');
		setEdited(false);
		if (window.__receivableBack) window.__receivableBack(); else message.info('跳转至提车应收款列表页（原型）');
	}, []);

	var handleCancel = useCallback(function () {
		if (edited[0]) {
			setCancelConfirmVisible(true);
		} else {
			if (window.__receivableBack) window.__receivableBack(); else message.info('返回提车应收款列表（原型）');
		}
	}, [edited[0]]);

	var handleCancelConfirm = useCallback(function () {
		setCancelConfirmVisible(false);
		if (window.__receivableBack) window.__receivableBack(); else message.info('返回提车应收款列表（原型）');
	}, []);

	var labelStyle = { marginBottom: 6, fontSize: 14, color: 'rgba(0,0,0,0.65)' };
	var requiredStar = { color: '#ff4d4f', marginRight: 2 };
	var formItemStyle = { marginBottom: 12 };
	var thBase = { padding: '10px 12px', border: '1px solid #f0f0f0', whiteSpace: 'nowrap' };

	function renderReadonlyField(label, value) {
		return React.createElement('div', { className: 'vpr-collect-field' },
			React.createElement('div', { className: 'vpr-collect-field__label' }, label),
			React.createElement('div', { className: 'vpr-collect-field__value' }, value || '-')
		);
	}

	function vehicleRowClassName(row) {
		if (row.receivableCompleted) return 'vpr-collect-row vpr-collect-row--done';
		if (row.selected) return 'vpr-collect-row vpr-collect-row--selected';
		return 'vpr-collect-row vpr-collect-row--idle';
	}

	function handleVehicleRowClick(row, e) {
		if (row.receivableCompleted) return;
		var target = e.target;
		if (!target) return;
		var tag = (target.tagName || '').toUpperCase();
		if (tag === 'INPUT' || tag === 'BUTTON' || tag === 'TEXTAREA' || tag === 'SELECT' || tag === 'A' || tag === 'LABEL') return;
		if (target.closest && target.closest('.ant-popover, .ant-btn, .ant-input, .ant-select')) return;
		toggleVehicleSelected(row.key);
	}

	function handleKpiCardKeyDown(e) {
		if (e.key === 'Enter' || e.key === ' ') {
			e.preventDefault();
			e.currentTarget.click();
		}
	}

	var selectableVehicles = vehicles.filter(function (v) { return !v.receivableCompleted; });
	var selectedCount = vehicles.filter(function (v) { return v.selected && !v.receivableCompleted; }).length;
	var allSelected = selectableVehicles.length > 0 && selectableVehicles.every(function (v) { return v.selected; });
	var indeterminate = selectableVehicles.some(function (v) { return v.selected; }) && !allSelected;
	var headerCheckRef = useRef(null);
	useEffect(function () {
		if (headerCheckRef.current) headerCheckRef.current.indeterminate = indeterminate;
	}, [indeterminate]);

	return React.createElement('div', { className: 'vm-page vpr-collect-page', 'data-annotation-id': 'vpr-collect' },
		React.createElement('header', { className: 'vpr-collect-topbar', 'data-annotation-id': 'vpr-collect-topbar' },
			React.createElement('div', { className: 'vpr-collect-topbar__left' },
				React.createElement('button', {
					type: 'button',
					className: 'vm-btn vm-btn-back',
					onClick: handleCancel,
				}, '返回'),
				React.createElement('div', { className: 'vpr-collect-topbar__intro' },
					React.createElement('h1', { className: 'vpr-collect-topbar__title' }, '办理提车收款单'),
					React.createElement('p', { className: 'vpr-collect-topbar__meta' },
						projectInfo.contractCode || '-',
						' · ',
						projectInfo.projectName || '-',
						edited[0]
							? React.createElement('span', { className: 'vpr-collect-draft-badge' }, '未保存')
							: null
					)
				)
			)
		),
		React.createElement(Card, {
			className: 'vpr-collect-card',
			'data-annotation-id': 'vpr-collect-project',
			title: '项目信息',
			extra: React.createElement(Button, {
				type: 'link',
				size: 'small',
				className: 'vpr-collect-card-toggle',
				onClick: function () { setProjectCardExpanded(!projectCardExpanded[0]); },
			}, projectCardExpanded[0] ? '收起' : '展开')
		},
			projectCardExpanded[0] ? React.createElement('div', { className: 'vpr-collect-info-grid' },
				renderReadonlyField('提车收款单编码', projectInfo.collectCode),
				renderReadonlyField('合同编码', projectInfo.contractCode),
				renderReadonlyField('合同类型', projectInfo.contractType),
				renderReadonlyField('项目名称', projectInfo.projectName),
				renderReadonlyField('客户名称', projectInfo.customerName),
				renderReadonlyField('付款方式', projectInfo.paymentMethod),
				renderReadonlyField('付款周期', projectInfo.paymentCycle),
				renderReadonlyField('合同生效时间', projectInfo.contractStart),
				renderReadonlyField('合同结束时间', projectInfo.contractEnd),
				renderReadonlyField('业务部门', projectInfo.businessDept),
				renderReadonlyField('业务负责人', projectInfo.businessPerson)
			) : null
		),
		React.createElement(Card, {
			className: 'vpr-collect-card',
			'data-annotation-id': 'vpr-collect-form',
			title: '提车应收款信息',
			extra: React.createElement(Button, {
				type: 'link',
				size: 'small',
				className: 'vpr-collect-card-toggle',
				onClick: function () { setReceivableCardExpanded(!receivableCardExpanded[0]); },
			}, receivableCardExpanded[0] ? '收起' : '展开')
		},
			receivableCardExpanded[0] ? React.createElement(React.Fragment, null,
			React.createElement(Alert, {
				type: 'info',
				showIcon: true,
				style: { marginBottom: 16 },
				message: '提车前打款 · 收款记录导入',
				description: '客户于提车前完成打款；财务人员在「收款记录」功能导入到账后，系统反写实收金额。应收金额按提车日期与合同付款规则自动计算。'
			}),
			React.createElement('div', { className: 'vpr-collect-form-grid' },
				React.createElement('div', { className: 'vpr-collect-form-item' },
					React.createElement('div', { style: labelStyle }, React.createElement('span', { style: requiredStar }, '*'), '提车日期'),
					dayjs && DatePicker
						? React.createElement(DatePicker, {
							value: dayjs(pickupDate),
							style: { width: '100%' },
							format: 'YYYY-MM-DD',
							onChange: function (_d, dateString) {
								setEdited(true);
								setPickupDate(dateString || '');
							},
						})
						: React.createElement(Input, {
							value: pickupDate,
							placeholder: 'YYYY-MM-DD',
							onChange: function (e) {
								setEdited(true);
								setPickupDate(e.target.value);
							},
						})
				),
				React.createElement('div', { className: 'vpr-collect-form-item' },
					React.createElement('div', { style: labelStyle }, '计费规则'),
					React.createElement('div', { className: 'vpr-collect-field__value', style: { color: 'var(--ln-muted)' } }, pickupRuleText || '请选择提车日期后自动生成')
				)
			),
			batchSummary ? React.createElement('div', { className: 'vpr-collect-batch-panel' },
				React.createElement('div', { className: 'vpr-collect-batch-panel__title' }, '应收付款节点（选中 ' + batchSummary.vehicleCount + ' 辆）'),
				React.createElement('div', null, '提车前2日内应付：', React.createElement('span', { className: 'vpr-collect-batch-panel__amount tabular-nums' }, fmtYuan(batchSummary.beforePickup.amount)), '（保证金 ', fmtMoney(batchSummary.beforePickup.deposit), ' + 租金 ', fmtMoney(batchSummary.beforePickup.rent), ' + 服务费 ', fmtMoney(batchSummary.beforePickup.service), '）'),
				batchSummary.month25.amount > 0
					? React.createElement('div', { style: { marginTop: 6 } }, '当月25日应付：', React.createElement('span', { className: 'vpr-collect-batch-panel__amount tabular-nums' }, fmtYuan(batchSummary.month25.amount)), '（下周期租金 ', fmtMoney(batchSummary.month25.rent), ' + 服务费 ', fmtMoney(batchSummary.month25.service), '）')
					: null,
				React.createElement('div', { style: { marginTop: 6, color: 'var(--ln-muted-soft)' } }, '当月剩余天数租金/服务费按（月租金+月服务费）/30×实际租赁天数，四舍五入取整到元')
			) : null,
			React.createElement('div', { className: 'vpr-collect-kpi-row', 'data-annotation-id': 'vpr-collect-kpi' },
				React.createElement(Popover, { content: receivablePopoverContent, title: '应收款明细', trigger: 'click' },
					React.createElement('div', {
						className: 'vpr-collect-kpi-card vpr-collect-kpi-card--clickable',
						role: 'button',
						tabIndex: 0,
						onKeyDown: handleKpiCardKeyDown,
					},
						React.createElement('div', { className: 'vpr-collect-kpi-card__label' }, '应收款总额'),
						React.createElement('div', { className: 'vpr-collect-kpi-card__value tabular-nums' }, fmtYuan(receivableTotal)),
						React.createElement('div', { className: 'vpr-collect-kpi-card__hint' }, '点击查看明细')
					)
				),
				React.createElement(Popover, { content: actualPopoverContent, title: '提车前应付明细', trigger: 'click' },
					React.createElement('div', {
						className: 'vpr-collect-kpi-card vpr-collect-kpi-card--clickable',
						role: 'button',
						tabIndex: 0,
						onKeyDown: handleKpiCardKeyDown,
					},
						React.createElement('div', { className: 'vpr-collect-kpi-card__label' }, '提车前应付'),
						React.createElement('div', { className: 'vpr-collect-kpi-card__value tabular-nums' }, fmtYuan(actualTotal)),
						React.createElement('div', { className: 'vpr-collect-kpi-card__hint' }, '点击查看明细')
					)
				),
				React.createElement('div', { className: 'vpr-collect-kpi-card' },
					React.createElement('div', { className: 'vpr-collect-kpi-card__label' }, '应开票总额'),
					React.createElement('div', { className: 'vpr-collect-kpi-card__value tabular-nums' }, fmtYuan(invoiceTotal)),
					React.createElement('div', { className: 'vpr-collect-kpi-card__hint' }, '按实收租金与服务费计算')
				)
			),
			React.createElement('div', { className: 'vpr-collect-table-toolbar' + (selectedCount === 0 ? ' vpr-collect-table-toolbar--warn' : '') },
				React.createElement('div', { className: 'vpr-collect-table-toolbar__left' },
					React.createElement('span', { className: 'vpr-collect-table-toolbar__count' }, '已选 ', selectedCount, ' / ', selectableVehicles.length, ' 辆可办理'),
					React.createElement('span', { className: 'vpr-collect-table-toolbar__hint' },
						selectedCount === 0 ? '请勾选本次提车车辆后再填写实收金额' : '点击行或勾选复选框选择车辆；已完成收款的车辆不可再次选择'
					)
				),
				selectableVehicles.length ? React.createElement('div', { className: 'vpr-collect-table-toolbar__actions' },
					React.createElement(Button, { size: 'small', disabled: allSelected, onClick: function () { toggleAllSelected(true); } }, '全选'),
					React.createElement(Button, { size: 'small', disabled: selectedCount === 0, onClick: function () { toggleAllSelected(false); } }, '取消全选')
				) : null
			),
			React.createElement('div', { className: 'vpr-collect-table-wrap', 'data-annotation-id': 'vpr-collect-table' },
				React.createElement('table', { className: 'vpr-collect-table' },
					React.createElement('thead', null,
						React.createElement('tr', null,
							React.createElement('th', { style: Object.assign({}, thBase, { textAlign: 'left', width: 48 }) },
								React.createElement('input', { type: 'checkbox', checked: allSelected, ref: headerCheckRef, onChange: function (e) { toggleAllSelected(e.target.checked); } })
							),
							React.createElement('th', { style: Object.assign({}, thBase, { textAlign: 'left', width: 50 }) }, '序号'),
							React.createElement('th', { style: Object.assign({}, thBase, { textAlign: 'left', width: 80 }) }, '品牌'),
							React.createElement('th', { style: Object.assign({}, thBase, { textAlign: 'left', width: 90 }) }, '型号'),
							React.createElement('th', { style: Object.assign({}, thBase, { textAlign: 'left', width: 100 }) }, '车牌号'),
							React.createElement('th', { style: Object.assign({}, thBase, { textAlign: 'right', width: 120 }) }, '应收租金（提车前）'),
							React.createElement('th', { style: Object.assign({}, thBase, { textAlign: 'left', width: 130 }) }, React.createElement('span', null, React.createElement('span', { style: requiredStar }, '*'), '实收车辆月租金')),
							React.createElement('th', { style: Object.assign({}, thBase, { textAlign: 'left', width: 130 }) }, '车辆租金备注'),
							React.createElement('th', { style: Object.assign({}, thBase, { textAlign: 'left', width: 130 }) }, '减免金额'),
							React.createElement('th', { style: Object.assign({}, thBase, { textAlign: 'left', width: 130 }) }, '减免金额备注'),
							React.createElement('th', { style: Object.assign({}, thBase, { textAlign: 'left', width: 130 }) }, '减免证明'),
							React.createElement('th', { style: Object.assign({}, thBase, { textAlign: 'right', width: 110 }) }, '应收车辆保证金'),
							React.createElement('th', { style: Object.assign({}, thBase, { textAlign: 'left', width: 90 }) }, '服务费项目'),
							React.createElement('th', { style: Object.assign({}, thBase, { textAlign: 'right', width: 90 }) }, '应收服务费'),
							React.createElement('th', { style: Object.assign({}, thBase, { textAlign: 'right', width: 130 }) }, '实收服务费')
						)
					),
					React.createElement('tbody', null,
						vehicles.map(function (row) {
							var disabled = !row.selected || row.receivableCompleted;
							var servicePopover = React.createElement('div', { style: { padding: 8, minWidth: 360 } },
								React.createElement('div', { style: { fontWeight: 600, marginBottom: 8 } }, '服务费项目'),
								React.createElement('table', { style: { width: '100%', borderCollapse: 'collapse', fontSize: 12 } },
									React.createElement('thead', null,
										React.createElement('tr', null,
											React.createElement('th', { style: { textAlign: 'left', padding: '6px 8px', borderBottom: '1px solid #f0f0f0' } }, '服务项目'),
											React.createElement('th', { style: { textAlign: 'right', padding: '6px 8px', borderBottom: '1px solid #f0f0f0' } }, '应收费用'),
											React.createElement('th', { style: { textAlign: 'right', padding: '6px 8px', borderBottom: '1px solid #f0f0f0' } }, React.createElement('span', null, React.createElement('span', { style: requiredStar }, '*'), '实收费用')),
											React.createElement('th', { style: { textAlign: 'right', padding: '6px 8px', borderBottom: '1px solid #f0f0f0' } }, '减免费用'),
											React.createElement('th', { style: { textAlign: 'left', padding: '6px 8px', borderBottom: '1px solid #f0f0f0' } }, '备注')
										)
									),
									React.createElement('tbody', null,
										(row.serviceItems || []).map(function (s, si) {
											return React.createElement('tr', { key: si },
												React.createElement('td', { style: { padding: '6px 8px' } }, s.name),
												React.createElement('td', { style: { textAlign: 'right', padding: '6px 8px' } }, (s.receivable != null ? s.receivable : '') + ' 元'),
												React.createElement('td', { style: { padding: '6px 8px' } },
													React.createElement(Input, { size: 'small', value: s.actual, disabled: disabled, suffix: '元', onChange: function (e) { updateServiceItem(row.key, si, 'actual', e.target.value); } })
												),
												React.createElement('td', { style: { padding: '6px 8px' } },
													React.createElement(Input, { size: 'small', value: s.discount, disabled: disabled, suffix: '元', onChange: function (e) { updateServiceItem(row.key, si, 'discount', e.target.value); } })
												),
												React.createElement('td', { style: { padding: '6px 8px' } },
													React.createElement(Input, { size: 'small', value: s.remark, disabled: disabled, placeholder: '备注', onChange: function (e) { updateServiceItem(row.key, si, 'remark', e.target.value); } })
												)
											);
										})
									)
								)
							);
							var proofList = row.discountProof || [];
							var onProofUpload = function (e) {
								var files = e.target.files;
								if (!files || !files.length) return;
								setEdited(true);
								var next = proofList.slice();
								for (var i = 0; i < files.length; i++) { next.push({ name: files[i].name }); }
								updateVehicle(row.key, 'discountProof', next);
								e.target.value = '';
							};
							var removeProof = function (idx) {
								setEdited(true);
								var next = (row.discountProof || []).slice();
								next.splice(idx, 1);
								updateVehicle(row.key, 'discountProof', next);
							};
							var checkboxCell = row.receivableCompleted
								? React.createElement(Tooltip, { title: '该车辆已完成提车应收款' },
									React.createElement('span', { style: { display: 'inline-block', cursor: 'not-allowed' } },
										React.createElement('input', { type: 'checkbox', checked: true, disabled: true })
									)
								)
								: React.createElement('input', { type: 'checkbox', checked: row.selected, onChange: function () { toggleVehicleSelected(row.key); } });
							return React.createElement('tr', {
								key: row.key,
								className: vehicleRowClassName(row),
								onClick: function (e) { handleVehicleRowClick(row, e); },
							},
								React.createElement('td', { onClick: function (e) { e.stopPropagation(); } }, checkboxCell),
								React.createElement('td', null, row.index),
								React.createElement('td', null,
									row.brand,
									row.receivableCompleted
										? React.createElement('span', { className: 'vpr-collect-row-badge' }, '已完成')
										: null
								),
								React.createElement('td', null, row.model),
								React.createElement('td', null, row.plateNo || '-'),
								React.createElement('td', { className: 'vpr-collect-td--num tabular-nums' }, fmtYuan(row.receivableRent)),
								React.createElement('td', { onClick: function (e) { e.stopPropagation(); } },
									React.createElement(Input, { size: 'small', value: row.actualRent, disabled: disabled, suffix: '元', onChange: function (e) { updateVehicle(row.key, 'actualRent', e.target.value); } })
								),
								React.createElement('td', { onClick: function (e) { e.stopPropagation(); } },
									React.createElement(Input, { size: 'small', value: row.rentRemark, disabled: disabled, onChange: function (e) { updateVehicle(row.key, 'rentRemark', e.target.value); } })
								),
								React.createElement('td', { onClick: function (e) { e.stopPropagation(); } },
									React.createElement(Input, { size: 'small', value: row.discountAmount, disabled: disabled, suffix: '元', onChange: function (e) { updateVehicle(row.key, 'discountAmount', e.target.value); } })
								),
								React.createElement('td', { onClick: function (e) { e.stopPropagation(); } },
									React.createElement(Input, { size: 'small', value: row.discountRemark, disabled: disabled, onChange: function (e) { updateVehicle(row.key, 'discountRemark', e.target.value); } })
								),
								React.createElement('td', { onClick: function (e) { e.stopPropagation(); } },
									disabled ? '-' : React.createElement('div', { style: { display: 'flex', flexDirection: 'column', gap: 4 } },
										proofList.map(function (p, pidx) {
											return React.createElement('div', { key: pidx, style: { display: 'flex', alignItems: 'center', gap: 4, fontSize: 12 } },
												React.createElement('span', { style: { flex: 1, overflow: 'hidden', textOverflow: 'ellipsis' } }, p.name || '附件'),
												React.createElement(Button, { type: 'link', size: 'small', danger: true, style: { padding: 0, minWidth: 'auto' }, onClick: function () { removeProof(pidx); } }, '删除')
											);
										}),
										React.createElement('span', null,
											React.createElement('input', { type: 'file', multiple: true, accept: '.jpg,.jpeg,.png,.pdf', style: { display: 'none' }, id: 'proof-' + row.key, onChange: onProofUpload }),
											React.createElement(Button, { type: 'default', size: 'small', onClick: function () { var el = document.getElementById('proof-' + row.key); if (el) el.click(); } }, '附件上传')
										)
									)
								),
								React.createElement('td', { className: 'vpr-collect-td--num tabular-nums' }, fmtYuan(row.receivableDeposit)),
								React.createElement('td', { onClick: function (e) { e.stopPropagation(); } },
									React.createElement(Popover, { content: servicePopover, title: null, trigger: 'click' },
										React.createElement(Button, { type: 'link', size: 'small', disabled: disabled }, '管理')
									)
								),
								React.createElement('td', { className: 'vpr-collect-td--num tabular-nums' }, fmtYuan(row.receivableService)),
								React.createElement('td', { className: 'vpr-collect-td--num tabular-nums' }, fmtYuan(row.actualService))
							);
						})
					)
				)
			),
			hasHydrogenPrepay ? React.createElement('div', { style: { marginBottom: 16 } },
				React.createElement('div', { className: 'vpr-collect-section-title' }, '氢费预付款情况'),
				React.createElement('div', { className: 'vpr-collect-form-grid vpr-collect-form-grid--4' },
					React.createElement('div', { className: 'vpr-collect-form-item' },
						React.createElement('div', { style: labelStyle }, '氢费预付款应收金额'),
						React.createElement(Input, { value: fmtYuan(hydrogen.receivable), disabled: true })
					),
					React.createElement('div', { className: 'vpr-collect-form-item' },
						React.createElement('div', { style: labelStyle }, React.createElement('span', { style: requiredStar }, '*'), '氢费预付款实收金额'),
						React.createElement(Input, { value: hydrogen.actual, suffix: '元', onChange: function (e) { setEdited(true); setHydrogen(function (p) { return Object.assign({}, p, { actual: e.target.value }); }); } })
					),
					React.createElement('div', { className: 'vpr-collect-form-item' },
						React.createElement('div', { style: labelStyle }, '减免金额'),
						React.createElement(Input, { value: hydrogen.discount, suffix: '元', onChange: function (e) { setEdited(true); setHydrogen(function (p) { return Object.assign({}, p, { discount: e.target.value }); }); } })
					),
					React.createElement('div', { className: 'vpr-collect-form-item' },
						React.createElement('div', { style: labelStyle }, '减免金额备注'),
						React.createElement(Input, { value: hydrogen.discountRemark, onChange: function (e) { setEdited(true); setHydrogen(function (p) { return Object.assign({}, p, { discountRemark: e.target.value }); }); } })
					)
				)
			) : null,
			React.createElement('div', { className: 'vpr-collect-form-grid vpr-collect-form-grid--2', style: { marginTop: 16 } },
				React.createElement('div', { className: 'vpr-collect-form-item' },
					React.createElement('div', { style: labelStyle }, '开票方式'),
					React.createElement(Select, { style: { width: '100%' }, value: invoiceMethod[0], onChange: function (v) { setEdited(true); setInvoiceMethod(v); }, placeholder: '请选择' },
						React.createElement(Option, { value: '先开票后付款' }, '先开票后付款'),
						React.createElement(Option, { value: '先付款后开票' }, '先付款后开票')
					)
				),
				React.createElement('div', { className: 'vpr-collect-form-item vpr-collect-form-item--full' },
					React.createElement('div', { style: labelStyle }, React.createElement('span', { style: requiredStar }, '*'), '开票备注'),
					React.createElement(Input.TextArea, { value: invoiceRemark[0], onChange: function (e) { setInvoiceRemark(e.target.value); setEdited(true); }, rows: 3, placeholder: '请输入开票项目、税率以及其他备注信息，财务将以此进行开票', style: { width: '100%' } })
				)
			)
		) : null
		),
		React.createElement('footer', { className: 'vpr-collect-footer', 'data-annotation-id': 'vpr-collect-footer' },
			React.createElement('div', { className: 'vpr-collect-footer__summary' + (selectedCount === 0 ? ' vpr-collect-footer__summary--warn' : '') },
				selectedCount === 0 ? '请先勾选提车车辆' : React.createElement(React.Fragment, null,
					'提车前应付',
					React.createElement('strong', { className: 'tabular-nums' }, fmtYuan(actualTotal)),
					' · 已选 ',
					selectedCount,
					' 辆'
				)
			),
			React.createElement('div', { className: 'vpr-collect-footer__actions' },
				React.createElement('button', { 'data-vm-icon': 'x',  type: 'button', className: 'vm-btn vm-btn-ghost', onClick: handleCancel  }, '取消'),
				React.createElement('button', { 'data-vm-icon': 'save',  type: 'button', className: 'vm-btn vm-btn-secondary', onClick: handleSave  }, '保存'),
				React.createElement('button', { 'data-vm-icon': 'send', 
					type: 'button',
					className: 'vm-btn vm-btn-primary',
					disabled: selectedCount === 0,
					onClick: handleSubmit,
				 }, '提交审核')
			)
		),
		React.createElement(Modal, {
			title: '确认',
			open: submitConfirmVisible[0],
			onCancel: function () { setSubmitConfirmVisible(false); },
			onOk: handleSubmitConfirm,
			okText: '确认',
			cancelText: '取消'
		}, React.createElement('div', null, '请仔细核对本次提车车辆与应收金额，确认后将快速生成提车应收款单据并抄送财务')),
		React.createElement(Modal, {
			title: '确认取消',
			open: cancelConfirmVisible[0],
			onCancel: function () { setCancelConfirmVisible(false); },
			onOk: handleCancelConfirm,
			okText: '确认',
			cancelText: '取消'
		}, React.createElement('div', null, '取消将会丢失所有已填写数据，是否确认？'))
	);
};

export default Component;
