Merge remote-tracking branch 'origin/main' into dev/chat

dev/chat
Lei OT 1 year ago
commit fda145219e

@ -4,7 +4,7 @@ import { API_HOST } from '@/config'
const useOrderStore = create((set, get) => ({
orderData: [],
orderList: [],
orderDetail: {},
customerDetail: {},
lastQuotation: {},
@ -51,21 +51,16 @@ const useOrderStore = create((set, get) => ({
.then(json => {
if (json.errcode === 0) {
set(() => ({
orderData: json.result.map((order) => { return { ...order, key: order.COLI_ID } }),
orderList: json.result.map((order) => { return { ...order, key: order.COLI_ID } }),
}))
} else {
throw new Error(json?.errmsg + ': ' + json.errcode)
}
})
// .finally(() => setLoading(false))
.catch(reason => {
throw new Error(reason.message)
})
},
fetchOrderDetail: async (colisn) => {
const { orderDetail, updateQuotation } = get()
const json = await fetchJSON(`${API_HOST}/getorderinfo`, { colisn })
if (json.errcode === 0 && json.result.length > 0) {
const orderResult = json.result[0]
@ -74,13 +69,29 @@ const useOrderStore = create((set, get) => ({
customerDetail: orderResult.contact.length > 0 ? orderResult.contact[0] : {},
lastQuotation: orderResult.quotes.length > 0 ? orderResult.quotes[0] : {},
quotationList: orderResult.quotes,
}))
}))
}
},
setOrderPropValue: async (colisn, propName, value) => {
const json = await fetchJSON(`${API_HOST}/setorderstatus`, { colisn, stype: propName, svalue: value })
console.info(json)
if (propName === 'orderlabel') {
set((state) => ({
orderDetail: {
...state.orderDetail,
tags: value
}
}))
}
if (propName === 'orderstatus') {
set((state) => ({
orderDetail: {
...state.orderDetail,
states: value
}
}))
}
},
}))

@ -31,7 +31,6 @@ const CustomerProfile = (() => {
}}
variant='borderless'
onSelect={(value) => {
console.info(value)
setOrderPropValue(order_sn, 'orderlabel', value)
}}
value={orderDetail.tags}
@ -48,7 +47,6 @@ const CustomerProfile = (() => {
}}
variant='borderless'
onSelect={(value) => {
console.info(value)
setOrderPropValue(order_sn,'orderstatus', value)
}}
value={orderDetail.states}

@ -204,7 +204,7 @@ function OrderCollapseTable({ formValues }) {
]
const { notification } = App.useApp()
const [loading, setLoading] = useState(false)
const { orderData, fetchOrderList } = useOrderStore()
const { orderList, fetchOrderList } = useOrderStore()
const { loginUser } = useAuthStore()
useEffect(() => {
@ -268,7 +268,7 @@ function OrderCollapseTable({ formValues }) {
['35', 'newsletter营销'],
])
const groupOrderData = groupByParam(orderData, 'OPI_DEI_SN')
const groupOrderData = groupByParam(orderList, 'OPI_DEI_SN')
const deptKeys = Object.keys(groupOrderData)
const collapseItems = []

Loading…
Cancel
Save