117 lines
2.9 KiB
TypeScript
117 lines
2.9 KiB
TypeScript
import { cloudService } from './index'
|
|
import {
|
|
IBillBook,
|
|
IBillCategory,
|
|
IBillPay,
|
|
IBillQuery,
|
|
IBillRecord, IBillSearch
|
|
} from '@/types/bill'
|
|
import { IStatsChart } from 'vue3-common/dist/types'
|
|
|
|
export const addBillRecordApi = (billRecord: IBillRecord): Promise<boolean> =>
|
|
cloudService({
|
|
url: '/home-api/bill',
|
|
method: 'post',
|
|
data: billRecord
|
|
})
|
|
|
|
export const updateBillRecordApi = (id: number, billRecord: IBillRecord): Promise<boolean> =>
|
|
cloudService({
|
|
url: `/home-api/bill/${id}`,
|
|
method: 'put',
|
|
data: billRecord
|
|
})
|
|
|
|
export const deleteBillRecordApi = (id: number): Promise<boolean> =>
|
|
cloudService({
|
|
url: `/home-api/bill/${id}`,
|
|
method: 'DELETE'
|
|
})
|
|
|
|
export const queryBillRecordApi = (id: number): Promise<IBillRecord> =>
|
|
cloudService({
|
|
url: `/home-api/bill/${id}`,
|
|
method: 'get'
|
|
})
|
|
|
|
export const queryBillSummaryApi = (query: IBillQuery): Promise<IBillRecord[]> =>
|
|
cloudService({
|
|
url: '/home-api/bill/summary',
|
|
method: 'get',
|
|
params: query
|
|
})
|
|
|
|
export const searchBillSummaryApi = (search: IBillSearch): Promise<IBillRecord[]> =>
|
|
cloudService({
|
|
url: '/home-api/bill/search',
|
|
method: 'get',
|
|
params: search
|
|
})
|
|
|
|
export const queryBillStatsApi = (type: string, query: IBillQuery): Promise<IStatsChart[]> =>
|
|
cloudService({
|
|
url: `/home-api/bill/stats/${type}`,
|
|
method: 'get',
|
|
params: query
|
|
})
|
|
|
|
export const queryBillPayApi = (): Promise<IBillPay[]> =>
|
|
cloudService({
|
|
url: '/home-api/bill/pay',
|
|
method: 'get'
|
|
})
|
|
|
|
export const queryBillBookApi = (): Promise<IBillBook[]> =>
|
|
cloudService({
|
|
url: '/home-api/bill/book',
|
|
method: 'get'
|
|
})
|
|
|
|
export const queryBillCategoryApi = (): Promise<IBillCategory[]> =>
|
|
cloudService({
|
|
url: '/home-api/bill/category',
|
|
method: 'get'
|
|
})
|
|
|
|
export const addBillPayApi = (billPay: IBillPay): Promise<boolean> =>
|
|
cloudService({
|
|
url: '/home-api/bill-manage/pay',
|
|
method: 'post',
|
|
data: billPay
|
|
})
|
|
|
|
export const updateBillPayApi = (id: number, billPay: IBillPay): Promise<boolean> =>
|
|
cloudService({
|
|
url: `/home-api/bill-manage/pay/${id}`,
|
|
method: 'put',
|
|
data: billPay
|
|
})
|
|
|
|
export const addBillBookApi = (billBook: IBillBook): Promise<boolean> =>
|
|
cloudService({
|
|
url: '/home-api/bill-manage/book',
|
|
method: 'post',
|
|
data: billBook
|
|
})
|
|
|
|
export const updateBillBookApi = (id: number, billBook: IBillBook): Promise<boolean> =>
|
|
cloudService({
|
|
url: `/home-api/bill-manage/book/${id}`,
|
|
method: 'put',
|
|
data: billBook
|
|
})
|
|
|
|
export const addBillCategoryApi = (billCategory: IBillCategory): Promise<boolean> =>
|
|
cloudService({
|
|
url: '/home-api/bill-manage/category',
|
|
method: 'post',
|
|
data: billCategory
|
|
})
|
|
|
|
export const updateBillCategoryApi = (id: number, billCategory: IBillCategory): Promise<boolean> =>
|
|
cloudService({
|
|
url: `/home-api/bill-manage/category/${id}`,
|
|
method: 'put',
|
|
data: billCategory
|
|
})
|