const purchase = {
  state: {
    type: '',
    addFlag: 'false',
    changeFlag: false,
    demandPlanId: '',
    moneyType: null,
    inventoryLocation: null,
    exchangeRate: 0,
    oneListAdd: [],
    oneListDelete: [],
    oneListUpdate: [],
    twoListAdd: {},
    twoListUpdate: {},
    twoListDelete: {},
    checkedRows: [],
    listTwo: [],
    planId: '',
    dispatchId: '',
    orderId: '',
    contractId: '',
    applyId: ''
  },

  mutations: {
    SET_PURCHASE_TYPE: (state, type) => {
      state.type = type
    },
    SET_INVENTORY_LOCATION: (state, inventoryLocation) => {
      state.inventoryLocation = inventoryLocation
    },
    SET_ADD_FLAG: (state, addFlag) => {
      state.addFlag = addFlag
    },
    SET_CHANGE_FLAG: (state, changeFlag) => {
      state.changeFlag = changeFlag
    },
    SET_DEMAND_PLAN_ID: (state, demandPlanId) => {
      state.demandPlanId = demandPlanId
    },
    SET_MONEY_TYPE: (state, moneyType) => {
      state.moneyType = moneyType
    },
    SET_EXCHANGE_RATE: (state, exchangeRate) => {
      state.exchangeRate = exchangeRate
    },
    SET_ONE_LIST_ADD: (state, oneListAdd) => {
      state.oneListAdd = oneListAdd
    },
    SET_ONE_LIST_UPDATE: (state, oneListUpdate) => {
      state.oneListUpdate = oneListUpdate
    },
    SET_ONE_LIST_DELETE: (state, oneListDelete) => {
      state.oneListDelete = oneListDelete
    },
    SET_TWO_LIST_ADD: (state, towListAdd) => {
      state.twoListAdd = towListAdd
    },
    SET_TWO_LIST_UPDATE: (state, twoListUpdate) => {
      state.twoListUpdate = twoListUpdate
    },
    SET_TWO_LIST_DELETE: (state, towListDelete) => {
      state.twoListDelete = towListDelete
    },
    SET_CHECKED_ROWS: (state, checkedRows) => {
      state.checkedRows = checkedRows
    },
    SET_PURCHASE_PLAN_ID: (state, planId) => {
      state.planId = planId
    },
    SET_PURCHASE_APPLY_ID: (state, applyId) => {
      state.applyId = applyId
    },
    SET_PURCHASE_ORDER_ID: (state, orderId) => {
      state.orderId = orderId
    },
    SET_PURCHASE_CONTRACT_ID: (state, contractId) => {
      state.contractId = contractId
    },
    SET_PURCHASE_DISPATCH_ID: (state, dispatchId) => {
      state.dispatchId = dispatchId
    }
  },

  actions: {
    setPurchaseType ({ commit }, type) {
      commit('SET_PURCHASE_TYPE', type)
    },
    setInventoryLocation ({ commit }, inventoryLocation) {
      commit('SET_INVENTORY_LOCATION', inventoryLocation)
    },
    setAddFlag ({ commit }, addFlag) {
      commit('SET_ADD_FLAG', addFlag)
    },
    setChangeFlag ({ commit }, changeFlag) {
      commit('SET_CHANGE_FLAG', changeFlag)
    },
    setDemandPlanId ({ commit }, demandPlanId) {
      commit('SET_DEMAND_PLAN_ID', demandPlanId)
    },
    setOneListAdd ({ commit }, oneListAdd) {
      commit('SET_ONE_LIST_ADD', oneListAdd)
    },
    setOneListUpdate ({ commit }, oneListUpdate) {
      commit('SET_ONE_LIST_UPDATE', oneListUpdate)
    },
    setOneListDelete ({ commit }, oneListDelete) {
      commit('SET_ONE_LIST_DELETE', oneListDelete)
    },
    setTwoListAdd ({ commit }, twoListAdd) {
      commit('SET_TWO_LIST_ADD', twoListAdd)
    },
    setTwoListUpdate ({ commit }, twoListUpdate) {
      commit('SET_TWO_LIST_UPDATE', twoListUpdate)
    },
    setTwoListDelete ({ commit }, twoListDelete) {
      commit('SET_TWO_LIST_DELETE', twoListDelete)
    },
    setPurchasePlanId ({ commit }, planId) {
      commit('SET_PURCHASE_PLAN_ID', planId)
    },
    setMoneyType ({ commit }, moneyType) {
      commit('SET_MONEY_TYPE', moneyType)
    },
    setExchangeRate ({ commit }, exchangeRate) {
      commit('SET_EXCHANGE_RATE', exchangeRate)
    },
    setPurchaseApplyId ({ commit }, planId) {
      commit('SET_PURCHASE_APPLY_ID', planId)
    },
    setPurchaseOrderId ({ commit }, planId) {
      commit('SET_PURCHASE_ORDER_ID', planId)
    },
    setPurchaseContractId ({ commit }, planId) {
      commit('SET_PURCHASE_CONTRACT_ID', planId)
    },
    setCheckedRows ({ commit }, checkedRows) {
      commit('SET_CHECKED_ROWS', checkedRows)
    },
    setPurchaseDispatchId ({ commit }, planId) {
      commit('SET_PURCHASE_DISPATCH_ID', planId)
    }

  }
}

export default purchase
