feat: add function submit
This commit is contained in:
parent
9c34172422
commit
84f5a06874
2 changed files with 36 additions and 4 deletions
|
|
@ -41,7 +41,18 @@ export const useQuotationStore = defineStore('quotation-store', () => {
|
|||
}
|
||||
|
||||
async function createQuotation(payload: QuotationPayload) {
|
||||
const res = await api.post('/quotation', payload);
|
||||
const res = await api.post('/quotation', {
|
||||
...payload,
|
||||
productServiceList: payload.productServiceList.map((v) => ({
|
||||
vat: v.vat,
|
||||
amount: v.amount,
|
||||
pricePerUnit: v.pricePerUnit,
|
||||
discount: v.discount,
|
||||
productId: v.product.id,
|
||||
workId: v.work?.id,
|
||||
serviceId: v.service?.id,
|
||||
})),
|
||||
});
|
||||
if (res.status < 400) {
|
||||
return res.data;
|
||||
}
|
||||
|
|
@ -51,6 +62,15 @@ export const useQuotationStore = defineStore('quotation-store', () => {
|
|||
async function editQuotation(payload: QuotationPayload & { id: string }) {
|
||||
const res = await api.put(`/quotation/${payload.id}`, {
|
||||
...payload,
|
||||
productServiceList: payload.productServiceList.map((v) => ({
|
||||
vat: v.vat,
|
||||
amount: v.amount,
|
||||
pricePerUnit: v.pricePerUnit,
|
||||
discount: v.discount,
|
||||
productId: v.product.id,
|
||||
workId: v.work?.id,
|
||||
serviceId: v.service?.id,
|
||||
})),
|
||||
id: undefined,
|
||||
});
|
||||
if (res.status < 400) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue