import {computed} from 'vue'
import {GlobalStore} from '@/stores/index'

const globalStore = GlobalStore()

interface ItemType {
	T_name: string
	Id: number
}

export interface SaleFormType {
	T_type: number
	T_uuid: string
	T_receive: string
	T_number: string
	T_depot_id: any
	T_product: any
	T_date: string
	T_remark: string
	T_contract_number: string
	T_delivery_type: string
	T_signer_unit: string
	T_signer: string
	T_signer_phone: string
	T_signer_date: string
	T_courier_number: string
}

export interface ReceiveFormType {
	T_type: number
	T_uuid: string
	T_receive: string
	T_project: string
	T_number: string
	T_depot_id: any
	T_product: any
	T_date: string
	T_remark: string
	T_contract_number: string
}

export interface ReceiveApplyFormType {
	T_project: string
	T_number: string
	T_depot_id: any
	T_date: string
	T_product: any
	T_remark: string
	T_contract_number: string
	T_company_name: string
	T_payment_method: string
	T_receive: string
	T_receive_name: string
}

export interface InfoType {
	Id: number
	T_type: number
	T_depot_name: string
	T_date: string
	T_number: string
	T_remark: string
	T_submit: string
	T_signer?: string
	T_signer_phone?: string
	T_signer_date?: string
	T_signer_unit?: string
	T_submit_name: string
	T_receive_name: string
	T_warehouse_name: string
	T_project: string
	T_delivery_type: string
	T_courier_number?: number
	T_company_name: string
	T_payment_method: string
	T_state_str: string
	T_application_date: string
	T_finance_approval_opinion: string
	T_manager_approval_opinion: string
}

export interface InStorageInfoType {
	Id: number
	T_depot_name: string
	T_date: string
	T_type: number
	T_number: string
	T_remark: string
	T_submit: string
	T_submit_name: string
	T_project: string
	T_return_user_name: string
	T_batch_number: string
}

export interface InStoreageFormType {
	T_number: string
	T_depot_id: any
	T_type: any
	T_product: any
	T_date: string
	T_remark: string
	T_project: string
	T_company_name: string
	T_return_user: string
	T_return_user_name: string
	T_batch_number: string
}


export interface InStoreageFormTypes {
	T_number: string
	T_depot_id: any
	T_product: any
	T_project: any
	T_date: string
	T_receive: string
	T_receive_name: string
	T_remark: string
	T_company_name: string
	T_payment_method: string
}

export interface OutStockAuditFormType {
	T_number: string
	T_audit: number
	T_approval_opinion: string
	T_approval_img: string
	T_type: string
}

export const delivery_type = [
	{name: '自送', id: 1},
	{name: '自提', id: 2},
	{name: '快递', id: 3}
]

export const depotHooks = () => {
	const options = computed<ItemType[]>(() => {
		return globalStore.GET_depotList
	})
	const getDepotList = async () => {
		if (globalStore.GET_depotList.length) return
		globalStore.SET_Storehouse_Depot_List()
	}
	getDepotList()
	return {
		options
	}
}
