Commit b12ae118 authored by 前端-许佳敏's avatar 前端-许佳敏

sale

parent bf7a40ed
......@@ -2,16 +2,18 @@ import React from 'react'
import { history } from 'umi'
import { Button } from 'antd'
import { baseOrderListColumns } from '../../constant'
import { PublicApi } from '@/services/api'
// 业务hooks, 待新增订单
export const useSelfTable = () => {
const handleConfirm = async (record) => {
//@todo 是否签约电子签章, 如果没有,需跳转至签约页面
const isSignUp = true
if (isSignUp) {
const { data } = await PublicApi.getOrderSignatureAuthAuthState()
const flag = true
if (flag || data.state === 1) {
history.push(`/memberCenter/tranactionAbility/purchaseOrder/orderPreview?page_type=4&id=${record.id}&preview=0`)
} else {
// 未认证
}
}
const secondColumns: any[] = baseOrderListColumns.concat([
......
import React from 'react'
import { history } from 'umi'
import { Card, Button, Space, Dropdown, Menu } from 'antd'
import { StandardTable } from 'god'
import { PageHeaderWrapper } from '@ant-design/pro-layout'
import { PublicApi } from '@/services/api'
import { useSelfTable } from './model/useSelfTable'
import { PlusCircleOutlined, DownOutlined, DeleteOutlined } from '@ant-design/icons'
import DropDeleteDown from '@/components/DropDeleteDown'
import { tableListSchema } from './schema'
import { useStateFilterSearchLinkageEffect } from '@/formSchema/effects/useFilterSearch'
import { FORM_FILTER_PATH } from '@/formSchema/const'
import Submit from '@/components/NiceForm/components/Submit'
import { DatePicker } from '@formily/antd-components'
// 待确认支付结果订单
export interface FirstApprovedOrderProps {}
const fetchTableData = async (params) => {
const { data } = await PublicApi.getOrderSalesInvoiceOrderList(params)
return data
}
// TODO
const FirstApprovedOrder:React.FC<FirstApprovedOrderProps> = (props) => {
const {
columns
} = useSelfTable()
return <PageHeaderWrapper>
<Card>
<StandardTable
fetchTableData={params => fetchTableData(params)}
columns={columns}
rowKey={'orderNo'}
formilyLayouts={{
justify: 'space-between'
}}
formilyProps={{
ctx: {
inline: false,
schema: tableListSchema,
effects: ($, actions) => {
useStateFilterSearchLinkageEffect(
$,
actions,
'orderNo',
FORM_FILTER_PATH,
);
},
components: {
DateRangePicker: DatePicker.RangePicker,
Submit
}
}
}}
/>
</Card>
</PageHeaderWrapper>
}
FirstApprovedOrder.defaultProps = {}
export default FirstApprovedOrder
\ No newline at end of file
import React, { useRef } from 'react'
import { history, Link } from 'umi'
import { Button, Row, Col } from 'antd'
import { PublicApi } from '@/services/api'
import EyePreview from '@/components/EyePreview'
import { formatTimeString } from '@/utils'
import { ORDER_TYPE } from '@/constants'
import StatusColors from '@/pages/transaction/components/StatusColors'
import { FieldTimeOutlined } from '@ant-design/icons'
import {
Chart,
Interval,
Axis,
Tooltip,
Coordinate,
Legend,
View,
Annotation,
} from 'bizcharts';
import DataSet from "@antv/data-set";
// 圆形环状金额显示
const CircleChart = props => {
const { sumPrice = 100, alreadyPay = 10 } = props
const { DataView } = DataSet;
const dv = new DataView();
const userData = [
{ type: '总金额', value: sumPrice - alreadyPay },
{ type: '已支付', value: alreadyPay }
];
const userDv = new DataView();
userDv.source(userData).transform({
type: 'percent',
field: 'value',
dimension: 'type',
as: 'percent',
});
return <Chart placeholder={false} height={40} autoFit>
<Legend visible={false} />
{/* 绘制图形 */}
<View data={userDv.rows}>
<Coordinate type="theta" innerRadius={0.75} />
<Interval
position="percent"
adjust="stack"
color={['type', ['#EBECF0', '#41CC9E']]}
tooltip={false}
/>
</View>
</Chart>
}
// 业务hooks, 待支付订单
export const useSelfTable = () => {
const ref = useRef<any>({})
const customOrderColumns: any[] = [
{
title: '订单号',
align: 'center',
dataIndex: 'orderNo',
key: 'orderNo',
render: (text, record) => {
// 查看订单, 需根据状态显示不同schema
return <EyePreview url={`/memberCenter/tranactionAbility/purchaseOrder/orderDetail?page_type=-1&id=${record.id}&preview=1`}>
{text}
</EyePreview>
}
},
{
title: '订单商品摘要/下单时间',
align: 'center',
dataIndex: 'orderThe',
key: 'orderThe',
render: (text, record) => <>
<div>{record.orderThe}</div>
<div><FieldTimeOutlined />{formatTimeString(record.createTime)}</div>
</>,
width: 200
},
{
title: '采购会员',
align: 'left',
dataIndex: 'supplyMembersName',
key: 'supplyMembersName',
},
{
title: '总金额/已支付(元)',
align: 'center',
dataIndex: 'sumPrice',
key: 'sumPrice',
render: text => '¥' + text
},
{ title: '发货批次', align: 'center', dataIndex: 'shipmentBatch', key: 'shipmentBatch', render: text => `第${text}次` },
// @todo 发货单号跳转
{ title: '发货单号', align: 'center', dataIndex: 'invoiceNumber', key: 'invoiceNumber', render: text => <Link to={'/'}>{text}</Link> },
{ title: '当前支付', align: 'center', dataIndex: 'currentPayments', render: (text, record) => text},
{
title: '订单类型',
align: 'center',
dataIndex: 'type',
key: 'type',
render: (text) => ORDER_TYPE[text]
},
{
title: '外部状态',
align: 'center',
dataIndex: 'externalState',
key: 'externalState',
render: text => <StatusColors status={text} type='out'/>
},
{
title: '内部状态',
align: 'center',
dataIndex: 'interiorState',
key: 'interiorState',
render: (text) => <StatusColors status={text} type='inside'/>
},
{
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>
</>
}
]
const handleConfirm = async (record) => {
history.push(`/memberCenter/tranactionAbility/saleOrder/orderDetail?page_type=4&id=${record.id}&preview=0`)
}
const handleCancel = async (id) => {
await PublicApi.postOrderPurchaseOrderCancel({id})
ref.current.reload()
}
return {
columns: customOrderColumns
}
}
import { ISchema } from '@formily/antd';
import { FORM_FILTER_PATH } from '@/formSchema/const';
/**
* 除了订单必填字段, 默认
*/
export const tableListSchema: ISchema = {
type: 'object',
properties: {
orderNo: {
type: 'string',
"x-component": 'SearchFilter',
'x-component-props': {
placeholder: '请输入订单编号',
align: 'flex-start',
},
},
[FORM_FILTER_PATH]: {
type: 'object',
'x-component': 'flex-layout',
'x-component-props': {
inline: true,
colStyle: {
marginRight: 20
}
},
properties: {
orderThe: {
type: 'string',
'x-component-props': {
placeholder: '请输入订单摘要',
}
},
"supplyMembersName": {
type: 'string',
"x-component-props": {
placeholder: '请输入供应会员名称'
}
},
"[startCreateTime,endCreateTime]": {
type: 'array',
"x-component": 'daterangepicker',
'x-component-props': {
placeholder: ['开始时间','结束时间'],
},
},
submit: {
'x-component': 'Submit',
'x-component-props': {
children: '查询',
},
},
},
},
}
}
\ No newline at end of file
......@@ -5,7 +5,7 @@ import { formatTimeString } from '@/utils'
import './index.less'
import cx from 'classnames'
import { ReadyAddOrderDetailContext } from '../../context'
import StatusColors from '../StatusColors'
import StatusColors from '@/pages/transaction/components/StatusColors'
export interface CirculationRecordProps {}
......
import React from 'react'
import { formatTimeString } from '@/utils'
import { ORDER_TYPE } from '@/constants'
import StatusColors from '../components/StatusColors'
import StatusColors from '@/pages/transaction/components/StatusColors'
import EyePreview from '@/components/EyePreview'
......
......@@ -4,7 +4,7 @@ import { usePageStatus } from '@/hooks/usePageStatus'
import { OrderDetailContext } from '../../context'
import { PayOutWorkState } from '@/constants'
import { PublicApi } from '@/services/api'
import { history } from 'umi'
import { history, Link } from 'umi'
export interface OrderPayResultModalProps {
type: 'default' | 'preview',
......@@ -46,7 +46,7 @@ const OrderPayResultModal:React.FC<OrderPayResultModalProps> = ({type, currentRe
<Modal
title={type === 'default' ? '确认支付结果' : '查看支付结果'}
visible={visible}
footer={type === 'default' ? <Space>
footer={(type === 'default' && canCtlData.payOrderUrls) ? <Space>
<Button onClick={handleCancel}>取消</Button>
<Button onClick={() => handleConfirm(0)} type='dashed'>确认未到账</Button>
<Button onClick={() => handleConfirm(1)} type='primary'>确认到账</Button>
......@@ -56,7 +56,7 @@ const OrderPayResultModal:React.FC<OrderPayResultModalProps> = ({type, currentRe
itemLayout="horizontal"
dataSource={canCtlData.payOrderUrls || []}
renderItem={item => (
<List.Item extra={<Button type='link'>预览</Button>}>
<List.Item extra={<Link to={item} target='_blank'>预览</Link>}>
{item}
</List.Item>
)}
......
......@@ -13,6 +13,7 @@ export interface OrderPayTabsProps {}
const TabPane = Tabs.TabPane
const TabHeader = ({dataSource}) => {
const { setPayResultType, payResultVisible } = useContext(OrderDetailContext)
return <div>
<Row justify='space-between' style={{minWidth: 216}}>
<Col>
......@@ -26,7 +27,10 @@ const TabHeader = ({dataSource}) => {
<Row justify='space-between' align='middle' style={{width: '100%'}}>
<Col className={style.smallnumber}>{dataSource.payPrice || 0}</Col>
<Col>
{ dataSource.externalState === PayOutWorkState.READY_PAY && <a>查看</a> }
{ dataSource.externalState === PayOutWorkState.READY_PAY && <a onClick={() => {
setPayResultType('preview')
payResultVisible.current.setVisible(true)
}}>查看</a> }
</Col>
</Row>
</div>
......
......@@ -2,7 +2,6 @@ import React, { useContext, useState, useRef, useEffect } from 'react'
import { StandardTable } from 'god'
import { Card, Table, Form, Input, Row, Col, Button, Modal } from 'antd'
import { OrderDetailContext } from '../../context'
import ProductTableCell, { ProductEditableRow } from '../productTableCell'
import { EditOutlined, SettingOutlined } from '@ant-design/icons'
import style from './index.less'
import { PublicApi } from '@/services/api'
......
import React, { useContext } from 'react'
import { Tabs, Table } from 'antd'
import StatusColors from '../../../components/StatusColors'
import StatusColors from '@/pages/transaction/components/StatusColors'
import { formatTimeString } from '@/utils'
import { OrderDetailContext } from '../../context'
import MellowCard from '@/components/MellowCard'
......
......@@ -40,6 +40,9 @@ const CommonOrderDetail:React.FC<CommonOrderDetailProps> = (props) => {
const formContext = {
data: formData,
payResultType,
setPayResultType,
payResultVisible,
ctl: {
setData: setFormData
}
......@@ -105,8 +108,9 @@ const CommonOrderDetail:React.FC<CommonOrderDetailProps> = (props) => {
const startPush = () => {
if (page_type === SALE_ORDER_STATUS.CONFIRM_PAY_RESULT_ORDER) {
setPayResultType('default')
payResultVisible.current.setVisible(true)
return
return
}
handleSubmit()
}
......
import { paymentInformationColumns } from '../constant'
import { PayInfoCell, EditableRow } from '../components/payInfoTableCell'
import { ISchemaFormActions, ISchemaFormAsyncActions } from '@formily/antd'
import { useEffect, useState, useRef } from 'react'
import { PublicApi } from '@/services/api'
export const usePaymentInfo = (ctx: ISchemaFormActions | ISchemaFormAsyncActions): any => {
const paywayData = useRef<any>({})
const [columns, setColumns] = useState<any[]>(paymentInformationColumns)
const components = {
body: {
row: EditableRow,
cell: PayInfoCell
},
}
const initPayWayList = (data) => {
if (!data) {
return []
}
let result = []
for (let item of data) {
if (result.some(tempItem => tempItem.payType === item.payType)) {
result = result.map(resItem => {
if (resItem.payType === item.payType) {
resItem.payList = [...resItem.payList, item]
}
return resItem
})
} else {
let payVal = ""
switch (item.payType) {
case 1:
payVal = "线上支付"
break
case 2:
payVal = "线下支付"
break
case 3:
payVal = "授信支付"
break
case 4:
payVal = "货到付款"
break
}
result.push({
payVal,
payType: item.payType,
payList: [item]
})
}
}
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)
}
})
}, [])
const handleSave = row => {
return new Promise((resolve, reject) => {
const newData = [...ctx.getFieldValue('paymentInformationResponses')];
const index = newData.findIndex(item => row.payCount === item.payCount);
const item = newData[index];
newData.splice(index, 1, {
...item,
...row,
});
ctx.setFieldValue('paymentInformationResponses', newData)
resolve({item, newData})
})
};
return [
columns,
components,
handleSave
]
}
\ No newline at end of file
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