|
|
|
@ -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
|
|
|
|
|