<template>
	<view class="fabric-out-page">
		<OrderStatusBar class="fabric-out-mt32" :status="displayAuditStatus" :name="displayAuditStatusName" />

		<view class="flex-white-plr26 ptb10 bdb_f5">
			<text class="mr26">进仓单号</text>
			<u-input disabled placeholder="保存后自动生成" v-model="form.order_no" />
		</view>
		<view class="flex-white-plr26 ptb20 bdb_f5">
			<text class="mr26">进仓类型</text>
			<view>加工进仓单</view>
		</view>
		<view @click="pickerSelectFun('加工单位')" class="flex-white-plr26 ptb20 bdb_f5">
			<text class="mr26">加工单位<text class="redXingh">*</text></text>
			<view :class="form.process_name ? '' : 'cBlack'">
				{{ form.process_name || '请选择' }}
				<u-icon v-if="headerEditable" class="ml26" name="arrow-right" size="40" color="#888888"></u-icon>
			</view>
		</view>
		<view @click="pickerSelectFun('仓库名称')" class="flex-white-plr26 ptb20 bdb_f5">
			<text class="mr26">仓库名称<text class="redXingh">*</text></text>
			<view :class="form.warehouse_name ? '' : 'cBlack'">
				{{ form.warehouse_name || '请选择' }}
				<u-icon v-if="headerEditable" class="ml26" name="arrow-right" size="40" color="#888888"></u-icon>
			</view>
		</view>
		<view class="flex-white-plr26-column ptb20 mt32">
			<view style="margin-bottom: 8rpx;"><text>单据备注</text></view>
			<u-input v-model="form.remark" :disabled="!headerEditable" type="textarea" :border="true" :height="100" :auto-height="true" />
		</view>

		<ProcessInBinBar
			:can-scan="canScan"
			:bin-id="warehouseBinId"
			:code="warehouseBinCode"
			:name="warehouseBinName"
			:show-phone-scan="canScan"
			@code-input="warehouseBinCode = $event"
			@confirm="resolveWarehouseBin"
			@phone-scan="handleBinPhoneScan"
			@clear="clearWarehouseBin"
		/>
		<FabricOutScanBar
			:can-scan="showQrScanBar"
			:value="QRBarCode"
			:delete-mode="BarCodeDelStatus"
			:message="BillDataMessage"
			:disabled-tip="qrDisabledTip"
			:show-phone-scan="canScanQr"
			@input="QRBarCode = $event"
			@scan="handleScan"
			@phone-scan="handlePhoneScan"
			@delete-mode-change="BarCodeDelChange"
		/>
		<ProcessInScanDetail :detail="scanDetail" />

		<ProcessInDetailList
			:list="form.item_data"
			:deletable="canScan"
			@delete="onDeleteFineCode"
		/>

		<FabricOutFooter
			v-if="!headerSaved"
			:buttons="[{ label: '提交保存', action: 'save' }]"
			single
			@action="submitSave"
		/>
		<FabricOutFooter
			v-else
			:buttons="statusActionButtons"
			@action="handleStatusAction"
		/>

		<u-select v-model="selectShow" :list="selectList" @confirm="selectConfirmFun"></u-select>
	</view>
</template>

<script>
import formMixin from './storeGoodsProcessInMixin.js';
import OrderStatusBar from '@/components/storefabric/OrderStatusBar.vue';
import FabricOutScanBar from '@/components/storefabric/FabricOutScanBar.vue';
import FabricOutFooter from '@/components/storefabric/FabricOutFooter.vue';
import ProcessInScanDetail from '@/components/storegoods/ProcessInScanDetail.vue';
import ProcessInDetailList from '@/components/storegoods/ProcessInDetailList.vue';
import ProcessInBinBar from '@/components/storegoods/ProcessInBinBar.vue';

export default {
	components: {
		OrderStatusBar,
		FabricOutScanBar,
		FabricOutFooter,
		ProcessInScanDetail,
		ProcessInDetailList,
		ProcessInBinBar,
	},
	mixins: [formMixin],
	onLoad() {
		uni.setNavigationBarTitle({ title: '新增加工进仓单' });
		this.pageMode = 'add';
		this.loadBaseDropdowns();
	},
};
</script>

<style lang="scss">
@import '@/pages/storefabric/storeFabricBusinessOutPage.scss';
page {
	background-color: #F8F8F8;
	padding-bottom: 260rpx;
}
</style>
