Commit 18d124c0 authored by 前端-钟卫鹏's avatar 前端-钟卫鹏

fix:处理订单支付方式(到付)切换问题

parent 09899393
......@@ -88,6 +88,7 @@ const OrderPayModal: React.FC<OrderPayModalProps> = (props) => {
const [isSpin, setIsSpin] = useState<boolean>(false)
const [creditInfo, setCreditInfo] = useState<any>()
const [balanceInfo, setBalanceInfo] = useState<any>()
const [payOnReceived, setPayOnReceived] = useState<boolean>(false) // 是否要禁用到付方式
useEffect(() => {
if (currentRef) {
......@@ -103,6 +104,16 @@ const OrderPayModal: React.FC<OrderPayModalProps> = (props) => {
setCurrent(0)
setPayStep(0)
setChecked(null)
} else {
// 过滤出当前支付信息 到付 channel7 payType4
if(data?.paymentInformationResponses?.length) {
let currentPayment = data.paymentInformationResponses.filter(item => item.id === currentPayInfoId)
if(currentPayment.length && currentPayment[0].channel === 7) {
setPayOnReceived(false)
} else {
setPayOnReceived(true)
}
}
}
}, [visible])
......@@ -336,13 +347,17 @@ const OrderPayModal: React.FC<OrderPayModalProps> = (props) => {
>
{current === 0 &&
transformPayList && Object.entries(transformPayList).map(([key, value]) => <Row key={key} style={{ marginBottom: 24 }}>
<Col span={6} style={{ color: '#909399', fontSize: 12 }}>{payTextList[key]}</Col>
<Col span={6} style={{ color: '#909399', fontSize: 12, display: payOnReceived && Number(key)===4 ? 'none' : 'block' }}>{payTextList[key]}</Col>
<Col style={{ flex: 1 }}>
<div className={style.radioBox}>
{
(value as any[]).map(v =>
<div key={v.value} className={cx(style.payRadio, (checked && v.value === checked.id) ? style.active : '')} onClick={() => setChecked({ id: v.value, channel: v.channel })}>{v.label}</div>
)
(value as any[]).map(v => {
if(payOnReceived && v.value === 7) { // 到付
return null
} else {
return <div key={v.value} className={cx(style.payRadio, (checked && v.value === checked.id) ? style.active : '')} onClick={() => setChecked({ id: v.value, channel: v.channel })}>{v.label}</div>
}
})
}
</div>
</Col>
......
......@@ -312,7 +312,11 @@ const OrderSaleRecord:React.FC<OrderSaleRecordProps> = (props) => {
icon: <ExclamationCircleOutlined />,
content: tip,
onOk() {
PublicApi.postOrderReceiptOrderContinueShipping({orderId: data.id})
PublicApi.postOrderReceiptOrderContinueShipping({orderId: data.id}).then(res => {
if(res.code === 1000) {
history.goBack()
}
})
},
});
}
......
......@@ -233,10 +233,10 @@ const PurchaseOrderDetail:React.FC<PurchaseOrderDetailProps> = (props) => {
}
// logistics render字段字符串化
params.orderProductRequests = params.orderProductRequests.map(item => {
let logs: any = { ...item.logistics, render: item.logistics?.render ? JSON.stringify(item.logistics.render) : '' };
let logistics: any = { ...item.logistics, render: item.logistics?.render ? JSON.stringify(item.logistics.render) : '' };
return {
...item,
logistics: logs
logistics
}
})
setBtnLoading(true)
......
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