import { defineStore } from 'pinia'
import { reactive, ref } from 'vue'
import { queryProjectCost } from '@/api/cost'
export const payData = defineStore('expenses', () => {
  const projectCostList = reactive([])
  const costListTotal = ref(0)
  const getCostList = (data) => {
    queryProjectCost(data).then(res => {
      if (res.data === 0) {
        console.log(res)
      }
    })
  }
  const changeCostList = (list) => {
    projectCostList.length = 0
    projectCostList.push(...list)
  }
  const changeCostTotal = (total) => {
    costListTotal.value = total
  }
  return {
    projectCostList,
    changeCostList,
    costListTotal,
    changeCostTotal,
    getCostList
  }
})
