Commit bbda74a1 authored by GuanHua's avatar GuanHua
parents a8a4333b 9adf6169
......@@ -6,6 +6,7 @@ import { PayOutWorkState } from '@/constants'
import { PublicApi } from '@/services/api'
import { history, Link } from 'umi'
import OverflowText from '@/components/OverflowText'
import { useHttpRequest } from '@/hooks/useHttpRequest'
export interface OrderPayResultModalProps {
type: 'default' | 'preview',
......@@ -16,7 +17,9 @@ const OrderPayResultModal:React.FC<OrderPayResultModalProps> = ({type, currentRe
const { data } = useContext(OrderDetailContext)
const { id } = usePageStatus()
const [visible, setVisible] = useState(false)
const [isReady, setIsReady] = useState()
const canCtlData = data.paymentInformationResponses.find(v => v.externalState === PayOutWorkState.READY_CONFIRM_RESULT) || {}
const { run, loading } = useHttpRequest(PublicApi.postOrderPlatformConfirmedPaymentResultsOrder)
const transData = canCtlData.payOrderUrls?.split(',') || []
useEffect(() => {
......@@ -33,14 +36,15 @@ const OrderPayResultModal:React.FC<OrderPayResultModalProps> = ({type, currentRe
}
const handleConfirm = async (isReady) => {
setIsReady(isReady)
const params = {
state: isReady,
id: Number(id),
paymentInformationId: canCtlData.id
}
const { code } = await PublicApi.postOrderPlatformConfirmedPaymentResultsOrder(params)
if (code === 1000) {
const res = await run(params)
if (res && res.code === 1000) {
history.goBack()
}
}
......@@ -52,8 +56,8 @@ const OrderPayResultModal:React.FC<OrderPayResultModalProps> = ({type, currentRe
onCancel={handleCancel}
footer={(type === 'default' && transData) ? <Space>
<Button onClick={handleCancel}>取消</Button>
<Button onClick={() => handleConfirm(0)} type='dashed'>确认未到账</Button>
<Button onClick={() => handleConfirm(1)} type='primary'>确认到账</Button>
<Button loading={isReady === 0 && loading} onClick={() => handleConfirm(0)} type='dashed'>确认未到账</Button>
<Button loading={isReady === 1 && loading} onClick={() => handleConfirm(1)} type='primary'>确认到账</Button>
</Space> : null}
>
<List
......@@ -73,4 +77,4 @@ const OrderPayResultModal:React.FC<OrderPayResultModalProps> = ({type, currentRe
OrderPayResultModal.defaultProps = {}
export default OrderPayResultModal
\ No newline at end of file
export default OrderPayResultModal
......@@ -84,10 +84,10 @@ const warehouseColumns: any[] = [
const modalPriceActions = createFormActions()
// 总计金额联动框
export const MoneyTotalBox = ({ dataSource, isEditData }) => {
const { orderProductRequests = [], receiverAddressId, orderModel } = dataSource || {}
const { orderProductRequests = [], receiverAddressId, orderModel, sumPrice, amount, freight } = dataSource || {}
const creditsCommodity = (orderModel === 24 || orderModel === 25) // 积分或渠道积分下单模式
const sum = orderProductRequests.reduce((prev, next) => prev + Number((next.price || 0)), 0)
const sum = amount || orderProductRequests.reduce((prev, next) => prev + Number((next.price || 0)), 0)
const modelRef = useRef<any>({})
const [freePrice, setFreePrice] = useState<number>(0)
const handleSetting = () => {
......@@ -126,11 +126,11 @@ export const MoneyTotalBox = ({ dataSource, isEditData }) => {
</Col>
<Col span={2}>
<div>运费 { isEditData && <SettingOutlined style={{marginLeft: 8}} onClick={handleSetting}/>}</div>
<div>{freePrice}</div>
<div>{freight || freePrice}</div>
</Col>
<Col span={2}>
<div>{creditsCommodity ? '总计所需积分' : '总计金额'}</div>
<div>{sum + freePrice}</div>
<div>{sumPrice || sum + freePrice}</div>
</Col>
<ModalForm
modalTitle='设置运费'
......@@ -293,7 +293,7 @@ const OrderProductTable:React.FC<OrderProductTableProps> = (props) => {
}
return v
})
ctl.setData({
...data,
orderProductRequests: newData
......@@ -365,7 +365,7 @@ const OrderProductTable:React.FC<OrderProductTableProps> = (props) => {
dataIndex: 'memberPrice',
align: 'center',
key: 'memberPrice',
render: (text, record) => record.isMemberPrice ? (text + '%') : null
render: (text, record) => record.isMemberPrice ? (text * 100 + '%') : null
},
{
title: creditsCommodity ? '兑换数量' : '采购数量',
......@@ -382,9 +382,9 @@ const OrderProductTable:React.FC<OrderProductTableProps> = (props) => {
},
{
title: creditsCommodity ? '所需积分小计' : '金额',
dataIndex: 'price',
dataIndex: 'money',
align: 'center',
key: 'price',
key: 'money',
},
// 接口调用
{
......@@ -450,4 +450,4 @@ const OrderProductTable:React.FC<OrderProductTableProps> = (props) => {
OrderProductTable.defaultProps = {}
export default OrderProductTable
\ No newline at end of file
export default OrderProductTable
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