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

fix:采购订单待支付订单添加取消订单操作

parent 869f9342
import React from 'react'
import React, { useRef } from 'react'
import { history } from 'umi'
import { Card, Button, Space, Dropdown, Menu } from 'antd'
import { StandardTable } from 'god'
......@@ -24,14 +24,17 @@ const fetchTableData = async (params) => {
// TODO
const FirstApprovedOrder:React.FC<FirstApprovedOrderProps> = (props) => {
const refTable = useRef<any>({})
const {
columns
} = useSelfTable()
} = useSelfTable(refTable)
return <PageHeaderWrapper>
<Card>
<StandardTable
fetchTableData={params => fetchTableData(params)}
ref={refTable}
columns={columns}
rowKey={'orderNo'}
formilyLayouts={{
......
import React, { useRef } from 'react'
import { history, Link } from 'umi'
import { Button, Row, Col, Progress } from 'antd'
import { Button, Row, Col, Progress, Popconfirm } from 'antd'
import { PublicApi } from '@/services/api'
import EyePreview from '@/components/EyePreview'
import { formatTimeString } from '@/utils'
......@@ -49,8 +49,18 @@ const CircleChart = props => {
}
// 业务hooks, 待支付订单
export const useSelfTable = () => {
export const useSelfTable = (props) => {
const { refTable } = props
const ref = useRef<any>({})
const handleCancel = (param) => {
PublicApi.postOrderPurchaseOrderCancel({id: param}).then(res => {
if(res.code === 1000) {
refTable.current.reload()
}
})
}
const payOrderColumns: any[] = [
{
title: '订单号',
......@@ -124,27 +134,41 @@ export const useSelfTable = () => {
title: '当前支付', align: 'center', dataIndex: 'currentPayments', width: 140, render: (text, record) => <>
<Row justify='space-between'>
<Col>{record.currentPayments} / {record.sum}</Col>
<Col>
{/* <Col>
{
record.currentPayments !== record.sum &&
(record.externalState === PurchaseOrderOutWorkState.PAY_ORDER || record.externalState === PurchaseOrderOutWorkState.CONFIRM_NOT_ARRIVED_ACCOUNT) &&
<Link to={`/memberCenter/tranactionAbility/purchaseOrder/readyPayOrder/detail?id=${record.id}`}>去支付</Link>
}
</Col>
</Col> */}
</Row>
<Progress percent={Math.ceil(record.currentPayments / record.sum)} showInfo={false} />
</>
},
// {
// title: '操作',
// align: 'center',
// dataIndex: 'ctl',
// key: 'ctl',
// render: (text, record) => <>
// <Button type='link' onClick={() => handleConfirm(record)}>支付</Button>
// <Button type='link' onClick={() => handleCancel(record.id)}>取消订单</Button>
// </>
// }
{
title: '操作',
align: 'center',
dataIndex: 'ctl',
key: 'ctl',
render: (text, record) => <>
{
record.currentPayments !== record.sum &&
(record.externalState === PurchaseOrderOutWorkState.PAY_ORDER || record.externalState === PurchaseOrderOutWorkState.CONFIRM_NOT_ARRIVED_ACCOUNT) &&
<Link to={`/memberCenter/tranactionAbility/purchaseOrder/readyPayOrder/detail?id=${record.id}`}>去支付</Link>
}
{
(record.externalState === PurchaseOrderOutWorkState.PAY_ORDER && !record.signatureLogId || record.externalState === PurchaseOrderOutWorkState.CONFIRM_NOT_ARRIVED_ACCOUNT) &&
<Popconfirm
title="是否要取消该订单?"
onConfirm={() => handleCancel(record.id)}
okText="是"
cancelText="否"
>
<Button type='link'>取消订单</Button>
</Popconfirm>
}
</>
}
]
return {
......
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