diff --git a/src/stores/Products/Index.js b/src/stores/Products/Index.js index e868754..b22dd87 100644 --- a/src/stores/Products/Index.js +++ b/src/stores/Products/Index.js @@ -3,7 +3,7 @@ import { devtools } from 'zustand/middleware'; import dayjs from 'dayjs' import { fetchJSON, postForm, postJSON } from '@/utils/request'; import { HT_HOST } from '@/config'; -import { groupBy, isEmpty, generateId } from '@/utils/commons'; +import { groupBy, generateId } from '@/utils/commons'; export const searchAgencyAction = async (param) => { const { errcode, result } = await fetchJSON(`${HT_HOST}/Service_BaseInfoWeb/products_search`, param); @@ -287,15 +287,23 @@ export const useProductsStore = create( }, deleteQuotation: (quotaionId) => { - const { quotationList } = get() + const { editingProduct, quotationList, agencyProducts } = get() + const productTypeId = editingProduct.info.product_type_id; const newList = quotationList.filter(q => { return q.id != quotaionId }) deleteQuotationAction(quotaionId) - set(() => ({ - // 还要设置回 product.quotaion 对象 + + set({ + agencyProducts: { + ...agencyProducts, + [productTypeId]: [{ + ...editingProduct, + quotation: newList + }] + }, quotationList: newList - })) + }) }, // side effects diff --git a/src/views/products/Detail/ProductInfoQuotation.jsx b/src/views/products/Detail/ProductInfoQuotation.jsx index bf59a0a..c21b744 100644 --- a/src/views/products/Detail/ProductInfoQuotation.jsx +++ b/src/views/products/Detail/ProductInfoQuotation.jsx @@ -5,7 +5,6 @@ import { CloseOutlined, StarTwoTone, PlusOutlined, ExclamationCircleFilled } fro import { useDatePresets } from '@/hooks/useDatePresets' import dayjs from 'dayjs' import useProductsStore from '@/stores/Products/Index' -import { generateId } from '@/utils/commons' const { RangePicker } = DatePicker