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

fix:处理资金账户查询提现是查询对公账户异常和账户充值后记录无更新问题,采购下单对于简单流程使用电子合同的商品添加必须签署电子合同的操作

parent a21333c1
......@@ -69,6 +69,7 @@ const AccountDetail: React.FC<{}> = () => {
const { data } = res
setMoveData(data)
})
refTrade.current.reload()
}
// 获取交易记录
......
......@@ -35,8 +35,6 @@ const AccountDetail: React.FC<{}> = () => {
let bankRes = await PublicApi.getSettleAccountsCorporateAccountConfig({memberId: data.memberId + '', memberRoleId: data.memberRoleId + ''})
if(bankRes.code === 1000) {
setBankDetail(bankRes.data)
} else {
message.error(bankRes.message)
}
}
}
......
import React, { useEffect, useState, useContext } from 'react'
import { message, Modal } from 'antd'
import { OrderDetailContext } from '../../_public/order/context'
import { PublicApi } from '@/services/api'
import { history } from 'umi'
import { useHttpRequest } from '@/hooks/useHttpRequest'
export interface OrderElectronModalProps {
currentRef: any,
type?: 'purchaseOrder' | 'saleOrder',
ctx?: any
}
//@todo 尚未完成
const OrderElectronModal:React.FC<OrderElectronModalProps> = (props) => {
const { currentRef, type, ctx } = props
const { data } = useContext(OrderDetailContext)
// @ts-ignore
const { run, loading } = useHttpRequest(type === 'saleOrder' ? PublicApi.postOrderSignaturePlatformSign : PublicApi.postOrderElectronicContractsAffirm)
const [visible, setVisible] = useState(false)
useEffect(() => {
currentRef.current = {
visible,
setVisible
}
}, [])
const handleSubmit = async () => {
console.log('签署')
let params: any = {}
if(type === 'saleOrder') {
params.contractName = data.electronicContractName
params.contractUrl = data.electronicContractUrl
} else {
params.id = parseInt(data.id)
}
const res = await run(params)
if (res.code === 1000) {
setVisible(false)
if(type === 'saleOrder') {
handleConfirmOrder({
id: Number(data.id),
state: ctx.getFieldValue('state'),
signatureLogId: res.data.signatureLogId
})
} else {
history.goBack()
}
}
}
const handleConfirmOrder = async (params) => {
const res = await PublicApi.postOrderConfirmedOrder(params, { ctlType: 'none' })
if(res.code === 1000) {
history.goBack()
} else {
message.error(res.message)
}
}
return (
<Modal
width={1000}
style={{minHeight: 600}}
title='签署电子合同'
okText='签署合同并提交'
cancelText='不签署'
visible={visible}
onOk={handleSubmit}
confirmLoading={loading}
onCancel={() => setVisible(false)}
>
{
data && <div style={{height: 600, position: 'relative'}}>
<iframe src={data.electronicContractUrl} style={{position: 'absolute', left: 0, top: 0, width: '100%', height: '100%', display: 'block'}}/>
</div>
}
</Modal>
)
}
OrderElectronModal.defaultProps = {}
export default OrderElectronModal
\ No newline at end of file
import React, { useEffect, useState, useContext } from 'react'
import { message, Modal } from 'antd'
import { OrderDetailContext } from '../../_public/order/context'
import { PublicApi } from '@/services/api'
import { history } from 'umi'
import { useHttpRequest } from '@/hooks/useHttpRequest'
export interface OrderElectronModalProps {
currentRef: any,
type?: 'purchaseOrder' | 'saleOrder',
ctx?: any
}
//@todo 尚未完成
const OrderElectronModal:React.FC<OrderElectronModalProps> = (props) => {
const { currentRef, type, ctx } = props
const { data } = useContext(OrderDetailContext)
// @ts-ignore
const { run, loading } = useHttpRequest(type === 'saleOrder' ? PublicApi.postOrderSignaturePlatformSign : PublicApi.postOrderElectronicContractsAffirm)
const [visible, setVisible] = useState(false)
useEffect(() => {
currentRef.current = {
visible,
setVisible
}
}, [])
const handleSubmit = async () => {
console.log('签署')
let params: any = {}
if(type === 'saleOrder') {
params.contractName = data.electronicContractName
params.contractUrl = data.electronicContractUrl
} else {
params.id = parseInt(data.id)
}
const res = await run(params)
if (res.code === 1000) {
setVisible(false)
if(type === 'saleOrder') {
handleConfirmOrder({
id: Number(data.id),
state: ctx.getFieldValue('state'),
signatureLogId: res.data.signatureLogId
})
} else {
history.goBack()
}
}
}
const handleConfirmOrder = async (params) => {
const res = await PublicApi.postOrderConfirmedOrder(params, { ctlType: 'none' })
if(res.code === 1000) {
history.goBack()
} else {
message.error(res.message)
}
}
return (
<Modal
width={1000}
style={{minHeight: 600}}
title='签署电子合同'
okText='签署合同并提交'
cancelText='不签署'
visible={visible}
onOk={handleSubmit}
confirmLoading={loading}
onCancel={() => setVisible(false)}
>
{
data && <div style={{height: 600, position: 'relative'}}>
<iframe src={data.electronicContractUrl} style={{position: 'absolute', left: 0, top: 0, width: '100%', height: '100%', display: 'block'}}/>
</div>
}
</Modal>
)
}
OrderElectronModal.defaultProps = {}
export default OrderElectronModal
import { PublicApi } from '@/services/api'
export const fetchOrderApi = {
// 弹窗获取商品列表
async getProductList(params) {
const { data } = await PublicApi.getProductCommodityCommonGetCommodityListByBuyer(params, { useCache: true, ttl: 10 * 1000 })
return data
},
// 弹窗获取询价报价单列表
async getQuotationList(params) {
const { data } = await PublicApi.getOrderProductQuotationList(params)
return data
},
// 弹窗获取需求报价单列表
async getOrderQuotationDemandList(params) {
const { data } = await PublicApi.getOrderQuotationList(params)
return data
},
// 根据询价报价id查询商品列表
async getProductListByQuotationOrderId(params) {
const { data } = await PublicApi.getOrderEnquiryProductAll(params)
return data
},
// 根据需求报价id查询商品列表
async getProductListByDemandOrderId(params) {
const { data } = await PublicApi.getOrderQuotationParticularsProductList(params)
return data
},
// 根据下单类型获取会员列表
async getMemberListByModelType(params) {
const { data } = await PublicApi.getMemberManageAllPageByordertype(params)
return data
},
// 获取所有商品收货地址
async getProductAddressAll() {
const { data } = await PublicApi.getLogisticsSelectListReceiverAddress()
return data
},
// 获取发票列表
async getInvoicesList() {
const { data } = await PublicApi.getSettleAccountsInvoiceMessageList()
return data
},
// 获取支付信息列表
async getPayInfoList(params) {
const { data } = await PublicApi.getOrderInitializationPaymentInformation(params)
return data
}
}
\ No newline at end of file
import { PublicApi } from '@/services/api'
export const fetchOrderApi = {
// 弹窗获取商品列表
async getProductList(params) {
const { data } = await PublicApi.getProductCommodityCommonGetCommodityListByBuyer(params, { useCache: true, ttl: 10 * 1000 })
return data
},
// 弹窗获取询价报价单列表
async getQuotationList(params) {
const { data } = await PublicApi.getOrderProductQuotationList(params)
return data
},
// 弹窗获取需求报价单列表
async getOrderQuotationDemandList(params) {
const { data } = await PublicApi.getOrderQuotationList(params)
return data
},
// 根据询价报价id查询商品列表
async getProductListByQuotationOrderId(params) {
const { data } = await PublicApi.getOrderEnquiryProductAll(params)
return data
},
// 根据需求报价id查询商品列表
async getProductListByDemandOrderId(params) {
const { data } = await PublicApi.getOrderQuotationParticularsProductList(params)
return data
},
// 根据下单类型获取会员列表
async getMemberListByModelType(params) {
const { data } = await PublicApi.getMemberManageAllPageByordertype(params)
return data
},
// 获取所有商品收货地址
async getProductAddressAll() {
const { data } = await PublicApi.getLogisticsSelectListReceiverAddress()
return data
},
// 获取发票列表
async getInvoicesList() {
const { data } = await PublicApi.getSettleAccountsInvoiceMessageList()
return data
},
// 获取支付信息列表
async getPayInfoList(params) {
const { data } = await PublicApi.getOrderInitializationPaymentInformation(params)
return data
},
// 查询当前订单工作流
async getOrderWorkFlow(params) {
const { data } = await PublicApi.getOrderTradingRulesByProductId(params)
return data
},
// 根据合同模板id查询合同模板详情
// async getContractDetail(params) {
// const { data } = await PublicApi.getOrderContractTemplateGet(params)
// return data
// },
// 生成电子合同
async createContract(params) {
const { data } = await PublicApi.postOrderSignatureSignContractCreate(params, {ctlType: "none"})
return data
},
}
import React, { useState, useRef, useEffect } from 'react'
import {history} from "umi"
import { Button, Radio, Row, Col, Tag, Checkbox, Modal } from 'antd'
import { ISchemaFormProps, ISchemaFieldProps, ISchemaFieldComponentProps, createFormActions, useFieldState } from '@formily/antd'
import { FilePdfFilled } from '@ant-design/icons'
import { PublicApi } from '@/services/api'
const SelectContract = (props: ISchemaFieldComponentProps) => {
let { form, value = {}, mutators, editable } = props
const popConfirm = () => {
history.push(`/memberCenter/tranactionAbility/electronicContracts/apply`)
}
const onChange = (e) => {
if(e.target.checked) {
PublicApi.getOrderSignatureAuthAuthState().then(({data}) => {
if(data.state !== 1) {
// 未认证
Modal.confirm({
title: '提示',
content: '未签约电子合同, 是否要立即前往?',
onOk: popConfirm,
maskClosable: true
})
} else {
mutators.change(1)
}
})
} else {
mutators.change(0)
}
}
return (
<div style={{display: "flex", flexDirection: "column"}}>
<Checkbox onChange={onChange}>同意</Checkbox>
<Button
type="link"
icon={<FilePdfFilled />}
style={{color: "#7178ea"}}
href={`/api/order/contractTemplate/downloadContract?contractName=${props.props["x-component-props"].contract.contractName}&contractUrl=${props.props["x-component-props"].contract.contractUrl}`}
>
{
props.props["x-component-props"].contract?.contractName
}
</Button>
</div>
)
}
SelectContract.defaultProps = {}
SelectContract.isFieldComponent = true;
export default SelectContract
import React, { useEffect, useState, useContext, useRef } from 'react'
import { message, Modal } from 'antd'
import { PublicApi } from '@/services/api'
import { history } from 'umi'
import { useHttpRequest } from '@/hooks/useHttpRequest'
export interface SimpleElectronModalProps {
currentRef: any,
schemaAction?: any
}
const SimpleElectronModal:React.FC<SimpleElectronModalProps> = (props) => {
const { currentRef, schemaAction } = props
// @ts-ignore
// const { run, loading } = useHttpRequest(PublicApi.postOrderSignatureOrderSettleSign, { ctlType: "none" })
const [visible, setVisible] = useState(false)
const [confirmLoading, setConfirmLoading] = useState(false)
const signatureState = useRef(null)
// 合同信息
const contracts = schemaAction.getFieldState("usingElectronicContracts").props["x-component-props"].contract
let timer = null
useEffect(() => {
return () => {
clearInterval(timer)
timer = null
}
}, [])
useEffect(() => {
currentRef.current = {
visible,
setVisible
}
}, [])
const handleSubmit = async () => {
setConfirmLoading(true)
// const res = await run(contracts)
const res = await PublicApi.postOrderSignatureOrderSettleSign(contracts, { ctlType: "none" })
if(res.code === 1000) {
timer = setInterval(() => {
console.log(signatureState.current, 'signatureState')
if (signatureState.current !== 4) {
PublicApi.getOrderSignatureOrderSettleSignDetail({signatureLogId: res.data.signatureLogId + ''}).then(_res => {
if(_res.code === 1000) {
signatureState.current = _res.data.state
} else {
clearInterval(timer)
timer = null
signatureState.current = null
}
})
} else {
clearInterval(timer)
timer = null
signatureState.current = null
setVisible(false)
schemaAction.setFieldValue("signatureLogId", res.data.signatureLogId)
message.success("操作成功")
}
}, 2000)
}
}
return (
<Modal
width={1000}
style={{minHeight: 600}}
title='签署电子合同'
okText='签署合同并提交'
cancelText='不签署'
visible={visible}
onOk={handleSubmit}
confirmLoading={confirmLoading}
onCancel={() => setVisible(false)}
>
{
contracts && <div style={{height: 600, position: 'relative'}}>
<iframe src={contracts.contractUrl} style={{position: 'absolute', left: 0, top: 0, width: '100%', height: '100%', display: 'block'}}/>
</div>
}
</Modal>
)
}
SimpleElectronModal.defaultProps = {}
export default SimpleElectronModal
import { parmas } from './../../../inquiryQuote/components/reviewList';
import { ISchemaFormActions, FormEffectHooks, IFieldState, ISchemaFormAsyncActions, createEffectHook } from '@formily/antd';
import { usePageStatus, PageStatus } from '@/hooks/usePageStatus';
import { useLinkageUtils } from '@/utils/formEffectUtils';
......@@ -100,7 +101,6 @@ export const useProductTableChangeForPay = (ctx: ISchemaFormActions | ISchemaFor
if (value && value.length > 0){
// 请求一次并复制给支付信息
const productItem = value[0]
console.log(productItem, 'pp')
if(pageStatus === PageStatus.EDIT) { // 编辑下 支付信息联动实现
} else if(pageStatus === PageStatus.ADD) { // 新增下 需要支付信息生成支付次数
......@@ -214,6 +214,13 @@ export const useOrderFormInitEffect = (ctx: ISchemaFormActions | ISchemaFormAsyn
useInvoiceList(ctx)
}
})
// 查询商品对应的工作流 获取电子合同
FormEffectHooks.onFieldValueChange$('orderProductRequests').subscribe(state => {
if (state.value?.length) {
useElectronicContract(ctx)
}
})
}
export const useProductAddress = (ctx: ISchemaFormActions | ISchemaFormAsyncActions) => {
......@@ -243,3 +250,31 @@ export const useInvoiceList = (ctx: ISchemaFormActions | ISchemaFormAsyncActions
})
})
}
// 查询工作流获取电子合同
export const useElectronicContract = (ctx: ISchemaFormActions | ISchemaFormAsyncActions) => {
let params: any = {};
params['productId'] = ctx.getFieldValue('orderProductRequests')[0]['id']
params['orderModelId'] = ctx.getFieldValue('orderModel')
params['memberId'] = ctx.getFieldValue('supplyMembersId')
params['memberRoleId'] = ctx.getFieldValue('supplyMembersRoleId')
fetchOrderApi.getOrderWorkFlow(params).then(data => {
// 简单流程并使用电子合同 强行启用电子合同
if(data["processEnum"] === 24 && data["isElectronicContract"]) {
ctx.setFieldState("usingElectronicContracts", state => {
state.visible = true
})
ctx.setFieldValue("processEnum", data["processEnum"])
// ctx.setFieldValue("usingElectronicContracts", data["isElectronicContract"] ? 1 : 0)
}
if(data['electronicContractId']) {
/** orderNo字段先行写死 */
fetchOrderApi.createContract({contractTemplateId: data['electronicContractId'], signMemberId: params['memberId'], orderNo: "CGBN50585" }).then(_data => {
ctx.setFieldState("usingElectronicContracts", state => {
state.props["x-component-props"].contract = { contractTemplateId: data['electronicContractId'], ..._data, }
})
})
}
})
}
......@@ -3,9 +3,9 @@ import { history } from 'umi'
import { PageHeaderWrapper } from '@ant-design/pro-layout'
import ReutrnEle from '@/components/ReturnEle'
import { usePageStatus, PageStatus } from '@/hooks/usePageStatus'
import { Button, Card, Row, Col, Drawer, message } from 'antd'
import { Button, Card, Row, Col, Drawer, message, Tooltip } from 'antd'
import { createFormActions, registerVirtualBox, useFormSpy, createAsyncFormActions } from '@formily/antd'
import { SaveOutlined, LinkOutlined, PlusOutlined, CodeSandboxCircleFilled } from '@ant-design/icons'
import { SaveOutlined, LinkOutlined, PlusOutlined, CodeSandboxCircleFilled, QuestionCircleOutlined, FilePdfOutlined, FilePdfFilled } from '@ant-design/icons'
import NiceForm from '@/components/NiceForm'
import { orderDetailSchema, orderAddSchema, mergeAllSchemas } from './schema'
import { useModelTypeChange, useEditHideField, useOrderFormInitEffect, useProductTableChangeForPay } from './effects'
......@@ -17,6 +17,7 @@ import InquiryModalTable from './components/inquiryModalTable'
import DemandModalTable from './components/demandModalTable'
import CirculationRecord from '../components/circulationRecord'
import SelectAddress from './components/selectAddress'
import SelectContract from './components/selectContract'
import TheInvoiceList from './components/theInvoiceList'
import moment from 'moment'
import { usePaymentInfo } from './model/usePaymentInfo'
......@@ -30,6 +31,7 @@ import { changeRouterTitleByStatus } from '../../_public/order/utils'
import { ReadyAddOrderDetailContext } from '../context'
import AuditProcess from '@/components/AuditProcess'
import styles from './index.less'
import SimpleElectronModal from './components/simpleElectronModal'
export interface PurchaseOrderDetailProps {}
......@@ -44,6 +46,19 @@ const RowStyle = styled(props => <Row style={{marginTop: 12}} justify='end' {...
}
`
const help = (title, desc) => {
return (
<div>
<span>{title}</span>
<Tooltip title={desc}>
<QuestionCircleOutlined
style={{ margin: "0 3px", cursor: "default", marginLeft: 3 }}
/>
</Tooltip>
</div>
);
};
const addSchemaAction = createFormActions()
// 总计金额联动框
......@@ -109,6 +124,7 @@ const PurchaseOrderDetail:React.FC<PurchaseOrderDetailProps> = (props) => {
const memberRef = useRef<any>({})
const inquiryRef = useRef<any>({})
const demandRef = useRef<any>({})
const contractRef = useRef<any>({})
const [formLoading, setFormLoading] = useState(false)
const [btnLoading, setBtnLoading] = useState(false)
const update = useUpdate()
......@@ -170,13 +186,20 @@ const PurchaseOrderDetail:React.FC<PurchaseOrderDetailProps> = (props) => {
}, [])
const handleSubmit = async (value) => {
let processEnum = addSchemaAction.getFieldValue('processEnum')
let usingElectronicContracts = addSchemaAction.getFieldValue('usingElectronicContracts')
let signatureLogId = addSchemaAction.getFieldValue("signatureLogId")
console.log(processEnum, usingElectronicContracts, signatureLogId)
if(processEnum === 24 && usingElectronicContracts && !signatureLogId) {
contractRef.current.setVisible(true)
return ;
}
try {
let fnResult = null
// 可做新增/修改的判断
// if (lastTypeParams === 'add') {
// } else if (lastTypeParams === 'edit') {
// }
switch (page_type) {
case '0': {
......@@ -243,6 +266,10 @@ const PurchaseOrderDetail:React.FC<PurchaseOrderDetailProps> = (props) => {
if(!judgementByCount || judgementByCount.includes(false)){
throw new Error('请填写商品采购数量')
}
// 校验简单电子合同必选
if(processEnum === 24 && !usingElectronicContracts){
throw new Error('此订单必须签署电子合同')
}
// logistics render字段字符串化
params.orderProductRequests = params.orderProductRequests.map(item => {
let logistics: any = { ...item.logistics, render: item.logistics?.render ? JSON.stringify(item.logistics.render) : '' };
......@@ -262,7 +289,6 @@ const PurchaseOrderDetail:React.FC<PurchaseOrderDetailProps> = (props) => {
setTimeout(() => {
history.goBack()
}, 1000)
// history.replace('/memberCenter/tranactionAbility/purchaseOrder/readyAddOrder')
} else {
setBtnLoading(false)
}
......@@ -379,7 +405,8 @@ const PurchaseOrderDetail:React.FC<PurchaseOrderDetailProps> = (props) => {
onSubmit={handleSubmit}
components={{
SelectAddress,
TheInvoiceList
TheInvoiceList,
SelectContract
}}
effects={($, ctx) => {
$('onFormMount').subscribe(() => {
......@@ -478,7 +505,8 @@ const PurchaseOrderDetail:React.FC<PurchaseOrderDetailProps> = (props) => {
orderCombination,
addNewAddress,
CirculationRecord: <CirculationRecord/>,
handleQuotation: (value) => addSchemaAction.getFieldValue('orderModel') === OrderModalType.CONSOLIDATED_ORDER && !!value
handleQuotation: (value) => addSchemaAction.getFieldValue('orderModel') === OrderModalType.CONSOLIDATED_ORDER && !!value,
help,
}}
/>
</Card>
......@@ -489,6 +517,10 @@ const PurchaseOrderDetail:React.FC<PurchaseOrderDetailProps> = (props) => {
{/* 需求报价单弹窗 */}
<DemandModalTable currentRef={demandRef} schemaAction={addSchemaAction}/>
{/* 简单流程签合同弹窗 */}
<SimpleElectronModal currentRef={contractRef} schemaAction={addSchemaAction}/>
</ReadyAddOrderDetailContext.Provider>
</PageHeaderWrapper>
)
......
......@@ -343,11 +343,26 @@ const ortherInfo: ISchema = {
wrapperCol: 10
},
properties: {
usingElectronicContracts: {
type: "number",
title: "{{help('电子合同','勾选则表示同意签署电子合同,电子合同和纸质合同一样具备同等法律效力')}}",
"x-component-props": {
// disabled: true,
contract: {},
},
"x-component": "selectContract",
// default: true,
required: true,
visible: false,
},
needTheInvoice: {
type: 'number',
"x-component": 'CheckboxSingle',
"x-component-props": {
children: '需要发票'
children: '需要发票',
style: {
marginTop: 4,
}
},
title: '发票',
default: 0,
......@@ -394,10 +409,22 @@ const ortherInfo: ISchema = {
},
// 仅进货单下单传入接口使用
shopId: {
type: 'string',
type: 'number',
title: '店铺ID',
visible: false
},
// 仅简单流程使用合同情况下使用
processEnum: {
type: 'number',
title: '工作流枚举',
visible: false
},
// 合同签署记录id
signatureLogId: {
type: "number",
title: '合同签署记录id',
visible: false
},
}
}
}
......
import React from 'react'
import { formatTimeString } from '@/utils'
import { ORDER_TYPE, PurchaseOrderInsideWorkStateTexts, SaleOrderInsideWorkStateTexts, PurchaseOrderOutWorkStateTexts } from '@/constants'
import StatusColors from '@/pages/transaction/components/StatusColors'
import EyePreview from '@/components/EyePreview'
import { history } from 'umi'
export const baseOrderListColumns: any[] = [
{
title: '订单号',
align: 'center',
dataIndex: 'orderNo',
key: 'orderNo',
render: (text, record) => {
// 查看订单, 需根据状态显示不同schema
return (
<EyePreview url={`${history.location.pathname}/preview?id=${record.id}`}>
{text}
</EyePreview>
)
}
},
{
title: '订单摘要',
align: 'center',
dataIndex: 'orderThe',
key: 'orderThe',
},
{
title: '采购会员',
align: 'center',
dataIndex: 'memberName',
key: 'memberName',
},
{
title: '下单时间',
align: 'center',
dataIndex: 'createTime',
key: 'createTime',
render: (text) => formatTimeString(text)
},
{
title: '订单总额',
align: 'center',
dataIndex: 'sumPrice',
key: 'sumPrice',
},
{
title: '订单类型',
align: 'center',
dataIndex: 'type',
key: 'type',
render: (text) => ORDER_TYPE[text],
filters: [
{text: '询价采购', value: 1},
{text: '需求采购', value: 2},
{text: '现货采购', value: 3},
{text: '集采', value: 4},
{text: '积分兑换', value: 5},
{text: '渠道直采', value: 6},
{text: '渠道现货', value: 7},
{text: '渠道积分兑换', value: 8},
],
onFilter: (value, record) => value === record.type,
},
{
title: '外部状态',
align: 'center',
dataIndex: 'externalState',
key: 'externalState',
render: text => <StatusColors status={text} type='out'/>,
filters: Object.entries(PurchaseOrderOutWorkStateTexts).map(([key, value]) => ({text: value, value: Number(key)})),
onFilter: (value, record) => value === record.externalState,
},
{
title: '内部状态',
align: 'center',
dataIndex: 'purchaseOrderInteriorState',
key: 'purchaseOrderInteriorState',
render: (text) => <StatusColors status={text} type='saleInside'/>,
filters: Object.entries(SaleOrderInsideWorkStateTexts).map(([key, value]) => ({text: value, value: Number(key)})),
onFilter: (value, record) => value === record.purchaseOrderInteriorState,
},
]
\ No newline at end of file
import React from 'react'
import { formatTimeString } from '@/utils'
import { ORDER_TYPE, PurchaseOrderInsideWorkStateTexts, SaleOrderInsideWorkStateTexts, PurchaseOrderOutWorkStateTexts } from '@/constants'
import StatusColors from '@/pages/transaction/components/StatusColors'
import EyePreview from '@/components/EyePreview'
import { history } from 'umi'
export const baseOrderListColumns: any[] = [
{
title: '订单号',
align: 'center',
dataIndex: 'orderNo',
key: 'orderNo',
render: (text, record) => {
// 查看订单, 需根据状态显示不同schema
return (
<EyePreview url={`${history.location.pathname}/preview?id=${record.id}`}>
{text}
</EyePreview>
)
}
},
{
title: '订单摘要',
align: 'center',
dataIndex: 'orderThe',
key: 'orderThe',
},
{
title: '采购会员',
align: 'center',
dataIndex: 'memberName',
key: 'memberName',
},
{
title: '下单时间',
align: 'center',
dataIndex: 'createTime',
key: 'createTime',
render: (text) => formatTimeString(text)
},
{
title: '订单总额',
align: 'center',
dataIndex: 'sumPrice',
key: 'sumPrice',
},
{
title: '订单类型',
align: 'center',
dataIndex: 'type',
key: 'type',
render: (text) => ORDER_TYPE[text],
filters: [
{text: '询价采购', value: 1},
{text: '需求采购', value: 2},
{text: '现货采购', value: 3},
{text: '集采', value: 4},
{text: '积分兑换', value: 5},
{text: '渠道直采', value: 6},
{text: '渠道现货', value: 7},
{text: '渠道积分兑换', value: 8},
],
onFilter: (value, record) => value === record.type,
},
{
title: '外部状态',
align: 'center',
dataIndex: 'externalState',
key: 'externalState',
render: text => <StatusColors status={text} type='out'/>,
filters: Object.entries(PurchaseOrderOutWorkStateTexts).map(([key, value]) => ({text: value, value: Number(key)})),
onFilter: (value, record) => value === record.externalState,
},
{
title: '内部状态',
align: 'center',
dataIndex: 'purchaseOrderInteriorState',
key: 'purchaseOrderInteriorState',
render: (text) => <StatusColors status={text} type='saleInside'/>,
filters: Object.entries(SaleOrderInsideWorkStateTexts).map(([key, value]) => ({text: value, value: Number(key)})),
onFilter: (value, record) => value === record.purchaseOrderInteriorState,
},
]
import React, { useRef, useState } from 'react'
import { Card, Button, Modal } from 'antd'
import { StandardTable } from 'god'
import { PageHeaderWrapper } from '@ant-design/pro-layout'
import { PublicApi } from '@/services/api'
import { baseOrderListColumns } from './constant'
import { history } from 'umi'
import { PurchaseOrderInsideWorkState, PurchaseOrderOutWorkState } from '@/constants'
import { tableListSchema } from '../_public/order/constant'
import { useStateFilterSearchLinkageEffect } from '@/formSchema/effects/useFilterSearch'
import { FORM_FILTER_PATH } from '@/formSchema/const'
import DateRangePickerUnix from '@/components/NiceForm/components/DateRangePickerUnix'
import Submit from '@/components/NiceForm/components/Submit'
import moment from 'moment'
import NiceForm from '@/components/NiceForm'
import { createFormActions } from '@formily/antd'
// 销售订单查询
export interface SaleOrderProps { }
const fetchTableData = async (params) => {
console.log(params, 'ppp')
const { data } = await PublicApi.getOrderPurchaseOrderList(params)
return data
}
const formActions = createFormActions();
// 最后一步开始调试 TODO
const SaleOrder: React.FC<SaleOrderProps> = (props) => {
const ref = useRef<any>({})
const [saleVisible, setSaleVisible] = useState<any>(false)
// 售后唤起弹窗 @todo
const handleSaleAfter = (id) => {
}
const handleEvaluate = (id) => {
history.push(`/memberCenter/tranactionAbility/supplierEvaluation/unevaluated`)
}
const secondColumns: any[] = baseOrderListColumns.concat([
{
title: '操作',
align: 'center',
dataIndex: 'ctl',
key: 'ctl',
render: (text, record) => <>
{ record.externalState === PurchaseOrderOutWorkState.FINISH_ORDER && <Button type='link' onClick={() => handleEvaluate(record.id)}>评价</Button> }
{/* todo */}
{/* <Button type='link' onClick={() => handleSaleAfter(record.id)}>售后</Button> */}
</>
}
])
const controllerBtns = <Button style={{width: 140}} onClick={() => {}} type='default'>导出</Button>
return <PageHeaderWrapper>
<Card>
<StandardTable
fetchTableData={params => fetchTableData(params)}
columns={secondColumns}
currentRef={ref}
controlRender={
<NiceForm
actions={formActions}
onSubmit={values => ref.current.reload(values)}
expressionScope={{
controllerBtns,
}}
effects={($, actions) => {
useStateFilterSearchLinkageEffect(
$,
actions,
'orderNo',
FORM_FILTER_PATH,
)
}}
schema={tableListSchema}
components={{
DateRangePickerUnix,
Submit
}}
/>
}
tableProps={{
rowKey: 'orderNo',
}}
/>
</Card>
</PageHeaderWrapper>
}
SaleOrder.defaultProps = {}
export default SaleOrder
import React, { useRef, useState } from 'react'
import { Card, Button, Modal } from 'antd'
import { StandardTable } from 'god'
import { PageHeaderWrapper } from '@ant-design/pro-layout'
import { PublicApi } from '@/services/api'
import { baseOrderListColumns } from './constant'
import { history } from 'umi'
import { PurchaseOrderInsideWorkState, PurchaseOrderOutWorkState } from '@/constants'
import { tableListSchema } from '../_public/order/constant'
import { useStateFilterSearchLinkageEffect } from '@/formSchema/effects/useFilterSearch'
import { FORM_FILTER_PATH } from '@/formSchema/const'
import DateRangePickerUnix from '@/components/NiceForm/components/DateRangePickerUnix'
import Submit from '@/components/NiceForm/components/Submit'
import moment from 'moment'
import NiceForm from '@/components/NiceForm'
import { createFormActions } from '@formily/antd'
// 销售订单查询
export interface SaleOrderProps { }
const fetchTableData = async (params) => {
const { data } = await PublicApi.getOrderPurchaseOrderList(params)
return data
}
const formActions = createFormActions();
// 最后一步开始调试 TODO
const SaleOrder: React.FC<SaleOrderProps> = (props) => {
const ref = useRef<any>({})
const [saleVisible, setSaleVisible] = useState<any>(false)
// 售后唤起弹窗 @todo
const handleSaleAfter = (id) => {
}
const handleEvaluate = (id) => {
history.push(`/memberCenter/tranactionAbility/supplierEvaluation/unevaluated`)
}
const secondColumns: any[] = baseOrderListColumns.concat([
{
title: '操作',
align: 'center',
dataIndex: 'ctl',
key: 'ctl',
render: (text, record) => <>
{ record.externalState === PurchaseOrderOutWorkState.FINISH_ORDER && <Button type='link' onClick={() => handleEvaluate(record.id)}>评价</Button> }
{/* todo */}
{/* <Button type='link' onClick={() => handleSaleAfter(record.id)}>售后</Button> */}
</>
}
])
const controllerBtns = <Button style={{width: 140}} onClick={() => {}} type='default'>导出</Button>
return <PageHeaderWrapper>
<Card>
<StandardTable
fetchTableData={params => fetchTableData(params)}
columns={secondColumns}
currentRef={ref}
controlRender={
<NiceForm
actions={formActions}
onSubmit={values => ref.current.reload(values)}
expressionScope={{
controllerBtns,
}}
effects={($, actions) => {
useStateFilterSearchLinkageEffect(
$,
actions,
'orderNo',
FORM_FILTER_PATH,
)
}}
schema={tableListSchema}
components={{
DateRangePickerUnix,
Submit
}}
/>
}
tableProps={{
rowKey: 'orderNo',
}}
/>
</Card>
</PageHeaderWrapper>
}
SaleOrder.defaultProps = {}
export default SaleOrder
import React, {useState, useRef, useEffect} from 'react'
import { history } from 'umi'
import { Button, Card } from 'antd'
import { PageHeaderWrapper } from '@ant-design/pro-layout'
import {
SaveOutlined,
} from '@ant-design/icons'
import ReutrnEle from '@/components/ReturnEle';
import './index.less'
import { ruleDetailSchema } from './schema'
import { createFormActions, ISchema, FormEffectHooks } from '@formily/antd'
import { findItemAndDelete, omit } from '@/utils'
import { PublicApi } from '@/services/api'
import { usePageStatus, PageStatus } from '@/hooks/usePageStatus'
import RuleSetting from './components/RuleSetting'
const addSchemaAction = createFormActions()
const AddRule:React.FC<{}> = (props) => {
const [isDisabled, setIsDisabled] = useState<boolean>(false)
const {
id,
preview,
pageStatus
} = usePageStatus()
// 整体表单提交
const formSubmit = async (values) => {
setIsDisabled(true)
if(values?.products)
values.products = values.products.map(item => ({
productId: item.id,
commodityId: item.commodityId,
name: item.name,
customerCategoryName: item.customerCategoryName,
priceType: item.priceType,
brandName: item.brandName
}))
values.isElectronicContract = values.isElectronicContract ? 1 : 0
const params = omit(values, ['state']) // 移除不需要的字段
addSchemaAction.getFieldState('transactionProcesssId', state => {
let dataSource = state.dataSource.filter(item => params.transactionProcesssId === item.id)
params.transactionProcess = dataSource[0].name
})
let res: any = {}
if(pageStatus === PageStatus.EDIT){
res = await PublicApi.postOrderTradingRulesUpdata(params)
}else if(pageStatus === PageStatus.ADD){
res = await PublicApi.postOrderTradingRulesAdd(params)
}
// if(res.code === 1000){
setIsDisabled(false)
history.goBack(-1)
// }
}
return (
<PageHeaderWrapper
onBack={() => history.goBack()}
backIcon={<ReutrnEle description="返回"/>}
title={pageStatus === PageStatus.PREVIEW ? '查看交易规则' : ( pageStatus === PageStatus.EDIT ? '编辑交易规则' : '新增交易规则' )}
className="addRule"
extra={[
<Button key="1"
onClick={() => addSchemaAction.submit()}
type="primary"
icon={<SaveOutlined />}
disabled={pageStatus === PageStatus.PREVIEW || isDisabled}
>
保存
</Button>,
]}
>
<Card className=''>
<RuleSetting addSchemaAction={addSchemaAction} schema={ruleDetailSchema} formSubmit={formSubmit}/>
</Card>
</PageHeaderWrapper>
)
}
export default AddRule
import React, {useState, useRef, useEffect} from 'react'
import { history } from 'umi'
import { Button, Card } from 'antd'
import { PageHeaderWrapper } from '@ant-design/pro-layout'
import {
SaveOutlined,
} from '@ant-design/icons'
import ReutrnEle from '@/components/ReturnEle';
import './index.less'
import { ruleDetailSchema } from './schema'
import { createFormActions, ISchema, FormEffectHooks } from '@formily/antd'
import { findItemAndDelete, omit } from '@/utils'
import { PublicApi } from '@/services/api'
import { usePageStatus, PageStatus } from '@/hooks/usePageStatus'
import RuleSetting from './components/RuleSetting'
const addSchemaAction = createFormActions()
const AddRule:React.FC<{}> = (props) => {
const [isDisabled, setIsDisabled] = useState<boolean>(false)
const {
id,
preview,
pageStatus
} = usePageStatus()
// 整体表单提交
const formSubmit = async (values) => {
setIsDisabled(true)
if(values?.products)
values.products = values.products.map(item => ({
productId: item.id,
commodityId: item.commodityId,
name: item.name,
customerCategoryName: item.customerCategoryName,
priceType: item.priceType,
brandName: item.brandName
}))
values.isElectronicContract = values.isElectronicContract ? 1 : 0
const params = omit(values, ['state']) // 移除不需要的字段
addSchemaAction.getFieldState('transactionProcesssId', state => {
let dataSource = state.dataSource.filter(item => params.transactionProcesssId === item.id)
params.transactionProcess = dataSource[0].name
params.type = dataSource[0].type
})
let res: any = {}
if(pageStatus === PageStatus.EDIT){
res = await PublicApi.postOrderTradingRulesUpdata(params)
}else if(pageStatus === PageStatus.ADD){
res = await PublicApi.postOrderTradingRulesAdd(params)
}
// if(res.code === 1000){
setIsDisabled(false)
history.goBack(-1)
// }
}
return (
<PageHeaderWrapper
onBack={() => history.goBack()}
backIcon={<ReutrnEle description="返回"/>}
title={pageStatus === PageStatus.PREVIEW ? '查看交易规则' : ( pageStatus === PageStatus.EDIT ? '编辑交易规则' : '新增交易规则' )}
className="addRule"
extra={[
<Button key="1"
onClick={() => addSchemaAction.submit()}
type="primary"
icon={<SaveOutlined />}
disabled={pageStatus === PageStatus.PREVIEW || isDisabled}
>
保存
</Button>,
]}
>
<Card className=''>
<RuleSetting addSchemaAction={addSchemaAction} schema={ruleDetailSchema} formSubmit={formSubmit}/>
</Card>
</PageHeaderWrapper>
)
}
export default AddRule
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