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_number: string
  T_depot_id: any
  T_product: any
  T_date: string
  T_remark: string
  T_contract_number: 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_delivery_type: string
  T_courier_number?: number
}

export interface InStorageInfoType {
  Id: number
  T_depot_name: string
  T_date: string
  T_number: string
  T_remark: string
  T_submit: string
  T_submit_name: string
}

export interface InStoreageFormType {
  T_number: string
  T_depot_id: any
  T_product: any
  T_date: string
  T_remark: 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
  }
}
