Commit 918b240b authored by 前端-钟卫鹏's avatar 前端-钟卫鹏

fix:处理新增订单或者支付订单时获取支付方式没有带memberId

parent af1ef987
......@@ -38,7 +38,7 @@ export const useOrderDetail = (options: OrderDetailHookProps) => {
useEffect(() => {
reloadFormData()
reloadPayList()
// reloadPayList()
}, [])
const reloadFormData = useCallback(() => {
......@@ -51,6 +51,7 @@ export const useOrderDetail = (options: OrderDetailHookProps) => {
if(data.paymentInformationResponses.length > 0){
setCurrentPayInfoId(data.paymentInformationResponses[0].id)
}
reloadPayList(data.supplyMembersId)
} else {
message.error(msg)
}
......@@ -58,14 +59,23 @@ export const useOrderDetail = (options: OrderDetailHookProps) => {
}
}, [id])
const reloadPayList = useCallback(() => {
PublicApi.getPayPayWayList().then(res => {
const reloadPayList = (memberId) => {
PublicApi.getPayPayWayList({memberId}).then(res => {
const { code, data } = res
if (code === 1000) {
setPaylist(data)
}
})
}, [id])
}
// const reloadPayList = useCallback(() => {
// PublicApi.getPayPayWayList().then(res => {
// const { code, data } = res
// if (code === 1000) {
// setPaylist(data)
// }
// })
// }, [id])
......
......@@ -127,7 +127,7 @@ const PurchaseOrderDetail:React.FC<PurchaseOrderDetailProps> = (props) => {
}
return resultState
})
const [paymentColumns, paymentComponents, paymentSave] = usePaymentInfo(addSchemaAction)
const [paymentColumns, paymentComponents, paymentSave] = usePaymentInfo(addSchemaAction, addSchemaAction.getFieldValue('supplyMembersId'))
const { productAddButton, productRef, productColumns, productComponents, ...sectionProps } = useProductTable(addSchemaAction)
// 页面进入时, 当前所处的下单模式
......
......@@ -5,7 +5,7 @@ import { useEffect, useState, useRef, useContext } from 'react'
import { PublicApi } from '@/services/api'
import { ReadyAddOrderDetailContext } from '../../context'
export const usePaymentInfo = (ctx: ISchemaFormActions | ISchemaFormAsyncActions): any => {
export const usePaymentInfo = (ctx: ISchemaFormActions | ISchemaFormAsyncActions, memberId: any): any => {
const paywayData = useRef<any>({})
const [columns, setColumns] = useState<any[]>(paymentInformationColumns)
const { productSumPrice } = useContext(ReadyAddOrderDetailContext)
......@@ -54,8 +54,29 @@ export const usePaymentInfo = (ctx: ISchemaFormActions | ISchemaFormAsyncActions
return result
}
// useEffect(() => {
// PublicApi.getPayPayWayList().then(res => {
// const { code, data } = res
// if (code === 1000) {
// const newColumns = [...columns]
// newColumns[5].formItemProps.options = initPayWayList(data)
// paywayData.current = data
// setColumns(newColumns)
// }
// })
// }, [])
useEffect(() => {
PublicApi.getPayPayWayList().then(res => {
console.log(memberId, 'memberId')
// 当选择报价单/会员/商品时有memberId传入时 调用支付方式api
if(memberId) {
getPayLists(memberId)
}
}, [memberId])
const getPayLists = (memberId) => {
PublicApi.getPayPayWayList({memberId}).then(res => {
const { code, data } = res
if (code === 1000) {
const newColumns = [...columns]
......@@ -65,7 +86,7 @@ export const usePaymentInfo = (ctx: ISchemaFormActions | ISchemaFormAsyncActions
setColumns(newColumns)
}
})
}, [])
}
const handleSave = row => {
return new Promise((resolve, reject) => {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment