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

fix:商品属性值添加同步功能,处理采购订单下单支付比例校验/取消订单没有刷新页面/支付订单返回异常清空原有密码数据的问题

parent 64c7d643
...@@ -36,6 +36,7 @@ const AddAtttribute: React.FC<{}> = () => { ...@@ -36,6 +36,7 @@ const AddAtttribute: React.FC<{}> = () => {
const [queryId, setQueryId] = useState('') // 判断编辑依据 const [queryId, setQueryId] = useState('') // 判断编辑依据
const [isSee, setIsSee] = useState(false) // 判断查看依据 const [isSee, setIsSee] = useState(false) // 判断查看依据
const [isSpecial, setIsSpecial] = useState(false) //特殊属性禁用展示方式 const [isSpecial, setIsSpecial] = useState(false) //特殊属性禁用展示方式
const [submitLoading, setSubmitLoading] = useState<boolean>(false)
useEffect(() => { useEffect(() => {
const { location } = history const { location } = history
...@@ -56,6 +57,7 @@ const AddAtttribute: React.FC<{}> = () => { ...@@ -56,6 +57,7 @@ const AddAtttribute: React.FC<{}> = () => {
}, []) }, [])
const handleSubmitAllSetting = () => { const handleSubmitAllSetting = () => {
setSubmitLoading(true)
menuForm.validateFields().then((values: any) => { menuForm.validateFields().then((values: any) => {
delete values.attributeShow delete values.attributeShow
if (JSON.stringify(values.attribute) === '{}') if (JSON.stringify(values.attribute) === '{}')
...@@ -63,6 +65,8 @@ const AddAtttribute: React.FC<{}> = () => { ...@@ -63,6 +65,8 @@ const AddAtttribute: React.FC<{}> = () => {
PublicApi.postProductCustomerSaveOrUpdateCustomerAttribute(values).then(res => { PublicApi.postProductCustomerSaveOrUpdateCustomerAttribute(values).then(res => {
if (res.code === 1000) if (res.code === 1000)
history.goBack() history.goBack()
else
setSubmitLoading(false)
}) })
}).catch(error => { }).catch(error => {
console.error(error) console.error(error)
...@@ -72,15 +76,12 @@ const AddAtttribute: React.FC<{}> = () => { ...@@ -72,15 +76,12 @@ const AddAtttribute: React.FC<{}> = () => {
const handleSelectOk = () => { const handleSelectOk = () => {
setRoleVisible(false) setRoleVisible(false)
if (selectRow.length) { if (selectRow.length) {
console.log(selectRow[0], 'handleSelectOk')
//@ts-ignore //@ts-ignore
// menuForm.setFieldsValue({attribute: selectRow[0], attributeShow: `${selectRow[0].groupName}-->${selectRow[0].name}`})
menuForm.setFieldsValue({ attribute: selectRow[0], attributeShow: selectRow[0].name }) menuForm.setFieldsValue({ attribute: selectRow[0], attributeShow: selectRow[0].name })
} }
} }
const fetchData = (params: any) => { const fetchData = (params: any) => {
console.log(params, 'params')
return new Promise((resolve, reject) => { return new Promise((resolve, reject) => {
//@ts-ignore //@ts-ignore
PublicApi.getProductPlatformGetAttributeList({ ...params, name: params.name || '', groupName: params.groupName || '', isEnable: true }).then(res => { PublicApi.getProductPlatformGetAttributeList({ ...params, name: params.name || '', groupName: params.groupName || '', isEnable: true }).then(res => {
...@@ -349,7 +350,7 @@ const AddAtttribute: React.FC<{}> = () => { ...@@ -349,7 +350,7 @@ const AddAtttribute: React.FC<{}> = () => {
</Col> </Col>
{!isSee && <Col span={18}> {!isSee && <Col span={18}>
<Form.Item {...tailLayout}> <Form.Item {...tailLayout}>
<Button onClick={handleSubmitAllSetting} type="primary" style={{ marginTop: 32, marginBottom: 16, marginRight: 24 }}> <Button loading={submitLoading} onClick={handleSubmitAllSetting} type="primary" style={{ marginTop: 32, marginBottom: 16, marginRight: 24 }}>
保存 保存
</Button> </Button>
<Popconfirm <Popconfirm
......
...@@ -48,6 +48,8 @@ const ClassProperty: React.FC<{}> = () => { ...@@ -48,6 +48,8 @@ const ClassProperty: React.FC<{}> = () => {
const [customPlateformExpandkeys, setCustomPlateformExpandkeys] = useState<any>() const [customPlateformExpandkeys, setCustomPlateformExpandkeys] = useState<any>()
const [syncLoading, setSyncLoading] = useState<boolean>(false) const [syncLoading, setSyncLoading] = useState<boolean>(false)
const [finshLoading, setFinshLoading] = useState<boolean>(false)
const [deleteLoading, setDeleteLoading] = useState<boolean>(false)
/* 选择品类树 */ /* 选择品类树 */
const { const {
...@@ -95,6 +97,7 @@ const ClassProperty: React.FC<{}> = () => { ...@@ -95,6 +97,7 @@ const ClassProperty: React.FC<{}> = () => {
}) })
const onFinish = (values) => { const onFinish = (values) => {
setFinshLoading(true)
const editOrAdd = nodeRecord && treeStatus === FormState.EDIT const editOrAdd = nodeRecord && treeStatus === FormState.EDIT
const params = editOrAdd ? { ...values, parentId: nodeRecord.parentId } : { const params = editOrAdd ? { ...values, parentId: nodeRecord.parentId } : {
...values, ...values,
...@@ -102,6 +105,7 @@ const ClassProperty: React.FC<{}> = () => { ...@@ -102,6 +105,7 @@ const ClassProperty: React.FC<{}> = () => {
id: null, id: null,
} }
PublicApi.postProductCustomerSaveOrUpdateCustomerCategory(params).then(res => { PublicApi.postProductCustomerSaveOrUpdateCustomerCategory(params).then(res => {
setFinshLoading(false)
resetMenu() resetMenu()
setTreeStatus(FormState.FREE) setTreeStatus(FormState.FREE)
setNodeRecord(undefined) setNodeRecord(undefined)
...@@ -237,7 +241,7 @@ const ClassProperty: React.FC<{}> = () => { ...@@ -237,7 +241,7 @@ const ClassProperty: React.FC<{}> = () => {
}} }}
> >
<FormButtonGroup> <FormButtonGroup>
<Button htmlType='submit' type="primary" style={{ marginTop: 32, marginBottom: 16, marginRight: 24}}> <Button loading={finshLoading} htmlType='submit' type="primary" style={{ marginTop: 32, marginBottom: 16, marginRight: 24}}>
保存 保存
</Button> </Button>
<Popconfirm title="确定要删除吗?" okText="是" cancelText="否" onConfirm={handleDeleteMenu}> <Popconfirm title="确定要删除吗?" okText="是" cancelText="否" onConfirm={handleDeleteMenu}>
......
...@@ -45,6 +45,7 @@ const AddPropertyValue: React.FC<{}> = () => { ...@@ -45,6 +45,7 @@ const AddPropertyValue: React.FC<{}> = () => {
const [proviceOptions, setProviceOptions] = useState<any>() const [proviceOptions, setProviceOptions] = useState<any>()
const [areaString, setAreaString] = useState<string>() const [areaString, setAreaString] = useState<string>()
const [customPlateformExpandkeys, setCustomPlateformExpandkeys] = useState<any>() const [customPlateformExpandkeys, setCustomPlateformExpandkeys] = useState<any>()
const [submitLoading, setSubmitLoading] = useState<boolean>(false)
/* 平台属性值列表树 */ /* 平台属性值列表树 */
const { const {
...@@ -95,6 +96,7 @@ const AddPropertyValue: React.FC<{}> = () => { ...@@ -95,6 +96,7 @@ const AddPropertyValue: React.FC<{}> = () => {
}, []) }, [])
const handleSubmitAllSetting = () => { const handleSubmitAllSetting = () => {
setSubmitLoading(true)
attrValueForm.validateFields().then(values => { attrValueForm.validateFields().then(values => {
const { attrId, attrName, type } = history.location.query const { attrId, attrName, type } = history.location.query
let pararms: any = { ...values } let pararms: any = { ...values }
...@@ -109,6 +111,8 @@ const AddPropertyValue: React.FC<{}> = () => { ...@@ -109,6 +111,8 @@ const AddPropertyValue: React.FC<{}> = () => {
if (res.code === 1000) if (res.code === 1000)
// history.goBack() // history.goBack()
history.push(`/memberCenter/commodityAbility/classAndProperty/propertyValue?attrId=${attrId}&attrName=${attrName}&type=${type}`) history.push(`/memberCenter/commodityAbility/classAndProperty/propertyValue?attrId=${attrId}&attrName=${attrName}&type=${type}`)
else
setSubmitLoading(false)
}) })
}).catch(error => { }).catch(error => {
...@@ -298,7 +302,7 @@ const AddPropertyValue: React.FC<{}> = () => { ...@@ -298,7 +302,7 @@ const AddPropertyValue: React.FC<{}> = () => {
{ {
!isSee && <Col span={18}> !isSee && <Col span={18}>
<Form.Item {...tailLayout}> <Form.Item {...tailLayout}>
<Button onClick={handleSubmitAllSetting} type="primary" style={{ marginTop: 32, marginBottom: 16, marginRight: 24 }}> <Button loading={submitLoading} onClick={handleSubmitAllSetting} type="primary" style={{ marginTop: 32, marginBottom: 16, marginRight: 24 }}>
保存 保存
</Button> </Button>
<Popconfirm title="确定要取消吗?" okText="是" cancelText="否" onConfirm={() => history.goBack()}> <Popconfirm title="确定要取消吗?" okText="是" cancelText="否" onConfirm={() => history.goBack()}>
......
import React, { useState, useRef, ReactNode, useEffect, useContext, useReducer } from 'react' import React, { useState, useRef, ReactNode, useEffect } from 'react'
import { Row, Col, message, Popconfirm, Button, Card } from 'antd'; import { Row, Col, Popconfirm, Button, Card, message, Modal, Tooltip } from 'antd';
import { import {
DeleteOutlined,
PauseCircleOutlined, PauseCircleOutlined,
PlusCircleOutlined,
PlayCircleOutlined, PlayCircleOutlined,
PlusOutlined, PlusOutlined,
EyeOutlined, EyeOutlined,
SearchOutlined QuestionCircleOutlined,
} from '@ant-design/icons'; } from '@ant-design/icons';
import { PageHeaderWrapper } from '@ant-design/pro-layout'; import { PageHeaderWrapper } from '@ant-design/pro-layout';
import { history } from 'umi'; import { history } from 'umi';
import { MenuTree, StandardTable } from 'god'; import { MenuTree, StandardTable } from 'god';
import { ColumnType } from 'antd/lib/table/interface'; import { ColumnType } from 'antd/lib/table/interface';
import { PublicApi } from '@/services/api'; import { PublicApi } from '@/services/api';
import { createFormActions } from '@formily/antd';
import { useTreeTabs } from '@/hooks/useTreeTabs'; import { useTreeTabs } from '@/hooks/useTreeTabs';
import TabTree, { createTreeActions } from '@/components/TabTree'; import TabTree, { createTreeActions } from '@/components/TabTree';
// const formActions = createFormActions()
const treeActions = createTreeActions() const treeActions = createTreeActions()
const fetchAttributeTreeData = async (params?) => { const fetchAttributeTreeData = async (params?) => {
...@@ -29,26 +25,26 @@ const fetchAttributeTreeData = async (params?) => { ...@@ -29,26 +25,26 @@ const fetchAttributeTreeData = async (params?) => {
const PropertyValue: React.FC<{}> = () => { const PropertyValue: React.FC<{}> = () => {
const ref = useRef<any>({}) const ref = useRef<any>({})
const syncRef = useRef<any>({})
const [selectKey, setSelectKey] = useState(undefined) const [selectKey, setSelectKey] = useState(undefined)
const [selectNode, setSelectNode] = useState<any>() const [selectNode, setSelectNode] = useState<any>()
const [customExpandkeys, setCustomExpandkeys] = useState<any>() const [customExpandkeys, setCustomExpandkeys] = useState<any>()
const [syncVisible, setSyncVisible] = useState(false)
const [syncLoading, setSyncLoading] = useState<boolean>(false)
const [selectRow, setSelectRow] = useState<any[]>([]) // 模态框选择的行数据
const [selectedRowKeys, setSelectedRowKeys] = useState<Array<string>>([])
const { const {
treeStatus,
setTreeStatus,
treeData, treeData,
setIsEditForm, // 是否编辑状态
nodeRecord,
setNodeRecord,
handleSelect,
getTreeMaps,
setTreeMaps,
resetMenu resetMenu
} = useTreeTabs({ } = useTreeTabs({
treeActions, treeActions,
fetchMenuData: fetchAttributeTreeData, fetchMenuData: fetchAttributeTreeData,
}) })
useEffect(() => { useEffect(() => {
let prefix = sessionStorage.getItem('beforeKeyPrefix') let prefix = sessionStorage.getItem('beforeKeyPrefix')
let beforeKey = history.location.query.attrId let beforeKey = history.location.query.attrId
...@@ -95,6 +91,17 @@ const PropertyValue: React.FC<{}> = () => { ...@@ -95,6 +91,17 @@ const PropertyValue: React.FC<{}> = () => {
}) })
} }
const fetchPlatformData = async (params) => { // 平台后台属性值列表
delete params['name']
delete params['customerAttributeId']
return new Promise((resolve, reject) => {
PublicApi.getProductPlatformGetSyncAttributeValueList(params).then(res => {
resolve(res.data)
})
})
}
const handleSee = (record: any) => { const handleSee = (record: any) => {
history.push(`/memberCenter/commodityAbility/classAndProperty/propertyValue/detail?attrId=${selectKey}&attrName=${record.customerAttribute.name}&attrValueId=${record.id}&isSee=true&type=${record.type}`) history.push(`/memberCenter/commodityAbility/classAndProperty/propertyValue/detail?attrId=${selectKey}&attrName=${record.customerAttribute.name}&attrValueId=${record.id}&isSee=true&type=${record.type}`)
} }
...@@ -170,6 +177,33 @@ const PropertyValue: React.FC<{}> = () => { ...@@ -170,6 +177,33 @@ const PropertyValue: React.FC<{}> = () => {
} }
]; ];
const syncColumns: ColumnType<any>[] = [
{
title: '属性ID',
dataIndex: 'id',
align: 'center',
key: 'id',
},
{
title: '属性组名',
dataIndex: ['attribute', 'groupName'],
align: 'center',
key: 'attribute.groupName',
},
{
title: '属性名称',
dataIndex: ['attribute', 'name'],
align: 'center',
key: 'attribute.name',
},
{
title: '属性值名称',
dataIndex: 'value',
align: 'center',
key: 'value',
},
]
const confirm = (record: any) => { const confirm = (record: any) => {
PublicApi.postProductCustomerUpdateCustomerAttributeValueStatus({id: record.id, isEnable: !record.isEnable}).then(res=>{ PublicApi.postProductCustomerUpdateCustomerAttributeValueStatus({id: record.id, isEnable: !record.isEnable}).then(res=>{
ref.current.reload() ref.current.reload()
...@@ -186,11 +220,51 @@ const PropertyValue: React.FC<{}> = () => { ...@@ -186,11 +220,51 @@ const PropertyValue: React.FC<{}> = () => {
console.log('cancel') console.log('cancel')
} }
// 同步平台属性值
const asyncClass = () => {
setSyncVisible(true)
}
const rowSelection: any = {
type: 'checkbox',
selectedRowKeys: selectedRowKeys,
onChange: (selectedRowKeys: any, selectedRows: any) => {
setSelectRow(selectedRows)
setSelectedRowKeys(selectedRowKeys)
}
};
const handleAsyncOk = () => {
setSyncLoading(true)
if(selectedRowKeys.length) {
// @ts-ignore
PublicApi.postProductCustomerSyncAttributeValue({idList: selectedRowKeys}).then(res => {
if(res.code === 1000) {
ref.current.reload()
}
setSyncVisible(false)
setSyncLoading(false)
})
} else {
message.error('请选择需要同步的属性值')
setSyncLoading(false)
}
}
return <PageHeaderWrapper> return <PageHeaderWrapper>
<Row gutter={[24, 36]}> <Row gutter={[24, 36]}>
<Col span={8}> <Col span={8}>
<Card> <Card>
<p style={{display: 'flex', justifyContent: 'space-between'}}>
<h3 className="mb-30">选择要编辑的项目</h3> <h3 className="mb-30">选择要编辑的项目</h3>
<p>
<Button type="default" onClick={asyncClass}>平台属性值同步</Button>
<Tooltip title="同步平台维护的属性值。">
&nbsp;<QuestionCircleOutlined />
</Tooltip>
</p>
</p>
{ {
treeData && treeData.length > 0 treeData && treeData.length > 0
? <TabTree ? <TabTree
...@@ -258,6 +332,58 @@ const PropertyValue: React.FC<{}> = () => { ...@@ -258,6 +332,58 @@ const PropertyValue: React.FC<{}> = () => {
</Card> </Card>
</Col> </Col>
</Row> </Row>
<Modal
title="同步平台属性"
visible={syncVisible}
onOk={handleAsyncOk}
onCancel={() => setSyncVisible(false)}
okText="确认"
cancelText="取消"
width={704}
destroyOnClose={true}
confirmLoading={syncLoading}
>
<StandardTable
columns={syncColumns}
currentRef={syncRef}
tableProps={{
rowKey: 'id'
}}
rowSelection={rowSelection}
fetchTableData={(params: any) => fetchPlatformData(params)}
formilyLayouts={{
justify: 'space-between'
}}
formilyProps={{
ctx: {
schema: {
type: 'object',
properties: {
attributeGroupName: {
type: 'string',
'x-component-props': {
placeholder: '属性组名称'
}
},
attributeName: {
type: 'string',
'x-component-props': {
placeholder: '属性名称'
},
},
attributeValue: {
type: 'string',
'x-component-props': {
placeholder: '属性值名称'
},
'x-component': 'Search'
},
}
}
}
}}
/>
</Modal>
</PageHeaderWrapper> </PageHeaderWrapper>
} }
......
...@@ -207,15 +207,16 @@ const AccountDetail: React.FC<{}> = () => { ...@@ -207,15 +207,16 @@ const AccountDetail: React.FC<{}> = () => {
money: Number(value.money), money: Number(value.money),
type: value['type'][0] type: value['type'][0]
} }
PublicApi.postPayAssetAccountRecharge(parasm, { ctlType: "none" }).then(res => { PublicApi.postPayAssetAccountRecharge(parasm).then(res => {
const { code, data } = res const { code, data } = res
if(code === 1000){ if(code === 1000){
modalRef.current.setVisible(false) modalRef.current.setVisible(false)
setScanVisible(true) setScanVisible(true)
setRenderCodeCharacter(data) setRenderCodeCharacter(data)
}else{
message.error(res.message)
} }
// else{
// message.error(res.message)
// }
setIsBtnLoading(false) setIsBtnLoading(false)
}) })
} }
......
...@@ -32,7 +32,7 @@ const AccountDetail: React.FC<{}> = () => { ...@@ -32,7 +32,7 @@ const AccountDetail: React.FC<{}> = () => {
const { code, data } = res const { code, data } = res
setDetails(data) setDetails(data)
if(code === 1000) { if(code === 1000) {
let bankRes = await PublicApi.getSettleAccountsCorporateAccountConfig({memberId: data.memberId + ''}) let bankRes = await PublicApi.getSettleAccountsCorporateAccountConfig({memberId: data.memberId + '', memberRoleId: data.memberRoleId + ''})
if(bankRes.code === 1000) { if(bankRes.code === 1000) {
setBankDetail(bankRes.data) setBankDetail(bankRes.data)
} else { } else {
......
...@@ -125,8 +125,8 @@ const AddBrand: React.FC<{}> = () => { ...@@ -125,8 +125,8 @@ const AddBrand: React.FC<{}> = () => {
const handleChange = ({ fileList }) =>setFileList(fileList) const handleChange = ({ fileList }) =>setFileList(fileList)
const handleSave = () => { const handleSave = () => {
setIsDisabledSave(true)
form.validateFields().then((values:any) => { form.validateFields().then((values:any) => {
console.log(values,'vvv')
if(history.location.query.id){ if(history.location.query.id){
values.id = Number(history.location.query.id) values.id = Number(history.location.query.id)
let obj = {}; let obj = {};
...@@ -140,9 +140,12 @@ const AddBrand: React.FC<{}> = () => { ...@@ -140,9 +140,12 @@ const AddBrand: React.FC<{}> = () => {
delete values.proveUrl.file delete values.proveUrl.file
} }
PublicApi.postProductBrandSaveOrUpdateBrand(values).then(res => { PublicApi.postProductBrandSaveOrUpdateBrand(values).then(res => {
setIsDisabledSave(true) if(res.code === 1000) {
setIsEnableCheck(false) setIsEnableCheck(false)
setReponseId(res.data) setReponseId(res.data)
} else {
setIsDisabledSave(false)
}
}) })
}) })
} }
......
...@@ -45,7 +45,7 @@ const ApproveSchemaUseContract = { ...@@ -45,7 +45,7 @@ const ApproveSchemaUseContract = {
title: '电子合同', title: '电子合同',
"x-rules": [ "x-rules": [
{ {
message: '请先生成电子合同', message: '请选择电子合同',
required: true required: true
} }
], ],
......
...@@ -71,7 +71,7 @@ const schema: ISchema = { ...@@ -71,7 +71,7 @@ const schema: ISchema = {
title: '电子合同', title: '电子合同',
"x-rules": [ "x-rules": [
{ {
message: '请先生成电子合同', message: '请选择电子合同',
required: true required: true
} }
] ]
......
...@@ -287,6 +287,7 @@ const OrderPayModal: React.FC<OrderPayModalProps> = (props) => { ...@@ -287,6 +287,7 @@ const OrderPayModal: React.FC<OrderPayModalProps> = (props) => {
setPayStep(0) setPayStep(0)
setOpenTimer(0) setOpenTimer(0)
} }
setCode('')
} }
const handleSubmitPay = async () => { const handleSubmitPay = async () => {
...@@ -318,6 +319,8 @@ const OrderPayModal: React.FC<OrderPayModalProps> = (props) => { ...@@ -318,6 +319,8 @@ const OrderPayModal: React.FC<OrderPayModalProps> = (props) => {
setQrCodeInfo({ ...qrCodeInfo, generateCharacter: res.data }) setQrCodeInfo({ ...qrCodeInfo, generateCharacter: res.data })
setQrLoading(false) setQrLoading(false)
} }
} else {
setCode('')
} }
} }
......
...@@ -211,16 +211,26 @@ const PurchaseOrderDetail:React.FC<PurchaseOrderDetailProps> = (props) => { ...@@ -211,16 +211,26 @@ const PurchaseOrderDetail:React.FC<PurchaseOrderDetailProps> = (props) => {
// theInvoiceInfo: (value.typeof value.theInvoiceId === 'object' ? value.theInvoiceId : null // theInvoiceInfo: (value.typeof value.theInvoiceId === 'object' ? value.theInvoiceId : null
// theInvoiceInfo: value.theInvoiceInfo // theInvoiceInfo: value.theInvoiceInfo
} }
// 校验是否选择支付渠道 // 校验是否选择支付渠道/支付比例
let judgementByPay = params.paymentInformationResponses.map(item => { let judgementByPay = params.paymentInformationResponses.map(item => {
if(item.channel && item.payWay && Number(item.payRatio)){ if(item.channel && item.payWay){
return true return true
} else { } else {
return false return false
} }
}) })
if(judgementByPay.includes(false)){ if(judgementByPay.includes(false)){
throw new Error('请正确填写支付信息') throw new Error('请选择支付方式或支付渠道')
}
let judgementByRatio = params.paymentInformationResponses.map(item => {
if(Number(item.payRatio) > 0 && Number(item.payRatio) < 100){
return true
} else {
return false
}
})
if(judgementByRatio.includes(false)){
throw new Error('请正确填写支付比例(0-100范围内)')
} }
// 校验采购数量 // 校验采购数量
let judgementByCount = params.orderProductRequests.map(item => { let judgementByCount = params.orderProductRequests.map(item => {
......
...@@ -125,19 +125,20 @@ export const usePaymentInfo = (ctx: ISchemaFormActions | ISchemaFormAsyncActions ...@@ -125,19 +125,20 @@ export const usePaymentInfo = (ctx: ISchemaFormActions | ISchemaFormAsyncActions
// 限制使用到付(多次支付和商品仅有物流) // 限制使用到付(多次支付和商品仅有物流)
const restrictArrivalPay = (cols, pros) => { const restrictArrivalPay = (cols, pros) => {
if(pros?.length) { if(pros?.length) {
// const newColumns = [...columns]
const newColumns = [...cols] const newColumns = [...cols]
let options = newColumns[5].formItemProps.options let options = newColumns[5].formItemProps.options
if(pros.filter(item => item.deliveryType === 1).length !== pros.length) { // if(pros.filter(item => item.deliveryType === 1).length !== pros.length) {
if(options.filter(_item => _item.payType === 4).length) { // if(options.filter(_item => _item.payType === 4).length) {
options.filter(_item => _item.payType === 4)[0].disabled = true // console.log(true, '1')
} // options.filter(_item => _item.payType === 4)[0].disabled = true
} else { // }
if(options.filter(_item => _item.payType === 4).length) { // } else {
options.filter(_item => _item.payType === 4)[0].disabled = false // if(options.filter(_item => _item.payType === 4).length) {
} // console.log(false, '2')
} // options.filter(_item => _item.payType === 4)[0].disabled = false
// }
// }
// 异步延迟获取数据
setTimeout(() => { setTimeout(() => {
let payment = ctx.getFieldValue('paymentInformationResponses') let payment = ctx.getFieldValue('paymentInformationResponses')
// 多次支付也要禁用到付 // 多次支付也要禁用到付
...@@ -149,7 +150,19 @@ export const usePaymentInfo = (ctx: ISchemaFormActions | ISchemaFormAsyncActions ...@@ -149,7 +150,19 @@ export const usePaymentInfo = (ctx: ISchemaFormActions | ISchemaFormAsyncActions
if(options.filter(_item => _item.payType === 4).length) if(options.filter(_item => _item.payType === 4).length)
options.filter(_item => _item.payType === 4)[0].disabled = false options.filter(_item => _item.payType === 4)[0].disabled = false
} }
} , 1000) } , 500)
setTimeout(() => {
if(pros.filter(item => item.deliveryType === 1).length !== pros.length) {
if(options.filter(_item => _item.payType === 4).length) {
options.filter(_item => _item.payType === 4)[0].disabled = true
}
} else {
if(options.filter(_item => _item.payType === 4).length) {
options.filter(_item => _item.payType === 4)[0].disabled = false
}
}
} , 800)
setColumns(newColumns) setColumns(newColumns)
} }
......
...@@ -24,17 +24,18 @@ const fetchTableData = async (params) => { ...@@ -24,17 +24,18 @@ const fetchTableData = async (params) => {
// TODO // TODO
const FirstApprovedOrder:React.FC<FirstApprovedOrderProps> = (props) => { const FirstApprovedOrder:React.FC<FirstApprovedOrderProps> = (props) => {
const refTable = useRef<any>({}) // const refTable = useRef<any>({})
const { const {
ref,
columns columns
} = useSelfTable(refTable) } = useSelfTable()
return <PageHeaderWrapper> return <PageHeaderWrapper>
<Card> <Card>
<StandardTable <StandardTable
fetchTableData={params => fetchTableData(params)} fetchTableData={params => fetchTableData(params)}
ref={refTable} currentRef={ref}
columns={columns} columns={columns}
rowKey={'orderNo'} rowKey={'orderNo'}
formilyLayouts={{ formilyLayouts={{
......
...@@ -49,14 +49,13 @@ const CircleChart = props => { ...@@ -49,14 +49,13 @@ const CircleChart = props => {
} }
// 业务hooks, 待支付订单 // 业务hooks, 待支付订单
export const useSelfTable = (props) => { export const useSelfTable = () => {
const { refTable } = props
const ref = useRef<any>({}) const ref = useRef<any>({})
const handleCancel = (param) => { const handleCancel = (param) => {
PublicApi.postOrderPurchaseOrderCancel({id: param}).then(res => { PublicApi.postOrderPurchaseOrderCancel({id: param}).then(res => {
if(res.code === 1000) { if(res.code === 1000) {
refTable.current.reload() ref.current.reload()
} }
}) })
} }
...@@ -182,6 +181,7 @@ export const useSelfTable = (props) => { ...@@ -182,6 +181,7 @@ export const useSelfTable = (props) => {
] ]
return { return {
ref,
columns: payOrderColumns columns: payOrderColumns
} }
} }
...@@ -41,7 +41,7 @@ const ReadyConfirmReturnOrderDetail: React.FC = () => { ...@@ -41,7 +41,7 @@ const ReadyConfirmReturnOrderDetail: React.FC = () => {
detailData={formContext.data} detailData={formContext.data}
extraRight={ extraRight={
<Button type='primary' onClick={handleSubmit} loading={loading}> <Button type='primary' onClick={handleSubmit} loading={loading}>
确认全部已回单 去确认回单
</Button> </Button>
} }
/> />
......
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