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

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

parent 64c7d643
......@@ -36,6 +36,7 @@ const AddAtttribute: React.FC<{}> = () => {
const [queryId, setQueryId] = useState('') // 判断编辑依据
const [isSee, setIsSee] = useState(false) // 判断查看依据
const [isSpecial, setIsSpecial] = useState(false) //特殊属性禁用展示方式
const [submitLoading, setSubmitLoading] = useState<boolean>(false)
useEffect(() => {
const { location } = history
......@@ -56,6 +57,7 @@ const AddAtttribute: React.FC<{}> = () => {
}, [])
const handleSubmitAllSetting = () => {
setSubmitLoading(true)
menuForm.validateFields().then((values: any) => {
delete values.attributeShow
if (JSON.stringify(values.attribute) === '{}')
......@@ -63,6 +65,8 @@ const AddAtttribute: React.FC<{}> = () => {
PublicApi.postProductCustomerSaveOrUpdateCustomerAttribute(values).then(res => {
if (res.code === 1000)
history.goBack()
else
setSubmitLoading(false)
})
}).catch(error => {
console.error(error)
......@@ -72,15 +76,12 @@ const AddAtttribute: React.FC<{}> = () => {
const handleSelectOk = () => {
setRoleVisible(false)
if (selectRow.length) {
console.log(selectRow[0], 'handleSelectOk')
//@ts-ignore
// menuForm.setFieldsValue({attribute: selectRow[0], attributeShow: `${selectRow[0].groupName}-->${selectRow[0].name}`})
menuForm.setFieldsValue({ attribute: selectRow[0], attributeShow: selectRow[0].name })
}
}
const fetchData = (params: any) => {
console.log(params, 'params')
return new Promise((resolve, reject) => {
//@ts-ignore
PublicApi.getProductPlatformGetAttributeList({ ...params, name: params.name || '', groupName: params.groupName || '', isEnable: true }).then(res => {
......@@ -349,7 +350,7 @@ const AddAtttribute: React.FC<{}> = () => {
</Col>
{!isSee && <Col span={18}>
<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>
<Popconfirm
......
......@@ -48,6 +48,8 @@ const ClassProperty: React.FC<{}> = () => {
const [customPlateformExpandkeys, setCustomPlateformExpandkeys] = useState<any>()
const [syncLoading, setSyncLoading] = useState<boolean>(false)
const [finshLoading, setFinshLoading] = useState<boolean>(false)
const [deleteLoading, setDeleteLoading] = useState<boolean>(false)
/* 选择品类树 */
const {
......@@ -95,6 +97,7 @@ const ClassProperty: React.FC<{}> = () => {
})
const onFinish = (values) => {
setFinshLoading(true)
const editOrAdd = nodeRecord && treeStatus === FormState.EDIT
const params = editOrAdd ? { ...values, parentId: nodeRecord.parentId } : {
...values,
......@@ -102,6 +105,7 @@ const ClassProperty: React.FC<{}> = () => {
id: null,
}
PublicApi.postProductCustomerSaveOrUpdateCustomerCategory(params).then(res => {
setFinshLoading(false)
resetMenu()
setTreeStatus(FormState.FREE)
setNodeRecord(undefined)
......@@ -237,7 +241,7 @@ const ClassProperty: React.FC<{}> = () => {
}}
>
<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>
<Popconfirm title="确定要删除吗?" okText="是" cancelText="否" onConfirm={handleDeleteMenu}>
......
......@@ -45,6 +45,7 @@ const AddPropertyValue: React.FC<{}> = () => {
const [proviceOptions, setProviceOptions] = useState<any>()
const [areaString, setAreaString] = useState<string>()
const [customPlateformExpandkeys, setCustomPlateformExpandkeys] = useState<any>()
const [submitLoading, setSubmitLoading] = useState<boolean>(false)
/* 平台属性值列表树 */
const {
......@@ -95,6 +96,7 @@ const AddPropertyValue: React.FC<{}> = () => {
}, [])
const handleSubmitAllSetting = () => {
setSubmitLoading(true)
attrValueForm.validateFields().then(values => {
const { attrId, attrName, type } = history.location.query
let pararms: any = { ...values }
......@@ -109,6 +111,8 @@ const AddPropertyValue: React.FC<{}> = () => {
if (res.code === 1000)
// history.goBack()
history.push(`/memberCenter/commodityAbility/classAndProperty/propertyValue?attrId=${attrId}&attrName=${attrName}&type=${type}`)
else
setSubmitLoading(false)
})
}).catch(error => {
......@@ -298,7 +302,7 @@ const AddPropertyValue: React.FC<{}> = () => {
{
!isSee && <Col span={18}>
<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>
<Popconfirm title="确定要取消吗?" okText="是" cancelText="否" onConfirm={() => history.goBack()}>
......
import React, { useState, useRef, ReactNode, useEffect, useContext, useReducer } from 'react'
import { Row, Col, message, Popconfirm, Button, Card } from 'antd';
import React, { useState, useRef, ReactNode, useEffect } from 'react'
import { Row, Col, Popconfirm, Button, Card, message, Modal, Tooltip } from 'antd';
import {
DeleteOutlined,
PauseCircleOutlined,
PlusCircleOutlined,
PlayCircleOutlined,
PlusOutlined,
EyeOutlined,
SearchOutlined
QuestionCircleOutlined,
} from '@ant-design/icons';
import { PageHeaderWrapper } from '@ant-design/pro-layout';
import { history } from 'umi';
import { MenuTree, StandardTable } from 'god';
import { ColumnType } from 'antd/lib/table/interface';
import { PublicApi } from '@/services/api';
import { createFormActions } from '@formily/antd';
import { useTreeTabs } from '@/hooks/useTreeTabs';
import TabTree, { createTreeActions } from '@/components/TabTree';
// const formActions = createFormActions()
const treeActions = createTreeActions()
const fetchAttributeTreeData = async (params?) => {
......@@ -29,26 +25,26 @@ const fetchAttributeTreeData = async (params?) => {
const PropertyValue: React.FC<{}> = () => {
const ref = useRef<any>({})
const syncRef = useRef<any>({})
const [selectKey, setSelectKey] = useState(undefined)
const [selectNode, setSelectNode] = 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 {
treeStatus,
setTreeStatus,
treeData,
setIsEditForm, // 是否编辑状态
nodeRecord,
setNodeRecord,
handleSelect,
getTreeMaps,
setTreeMaps,
resetMenu
} = useTreeTabs({
treeActions,
fetchMenuData: fetchAttributeTreeData,
})
useEffect(() => {
let prefix = sessionStorage.getItem('beforeKeyPrefix')
let beforeKey = history.location.query.attrId
......@@ -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) => {
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<{}> = () => {
}
];
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) => {
PublicApi.postProductCustomerUpdateCustomerAttributeValueStatus({id: record.id, isEnable: !record.isEnable}).then(res=>{
ref.current.reload()
......@@ -186,11 +220,51 @@ const PropertyValue: React.FC<{}> = () => {
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>
<Row gutter={[24, 36]}>
<Col span={8}>
<Card>
<h3 className="mb-30">选择要编辑的项目</h3>
<p style={{display: 'flex', justifyContent: 'space-between'}}>
<h3 className="mb-30">选择要编辑的项目</h3>
<p>
<Button type="default" onClick={asyncClass}>平台属性值同步</Button>
<Tooltip title="同步平台维护的属性值。">
&nbsp;<QuestionCircleOutlined />
</Tooltip>
</p>
</p>
{
treeData && treeData.length > 0
? <TabTree
......@@ -258,6 +332,58 @@ const PropertyValue: React.FC<{}> = () => {
</Card>
</Col>
</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>
}
......
......@@ -207,15 +207,16 @@ const AccountDetail: React.FC<{}> = () => {
money: Number(value.money),
type: value['type'][0]
}
PublicApi.postPayAssetAccountRecharge(parasm, { ctlType: "none" }).then(res => {
PublicApi.postPayAssetAccountRecharge(parasm).then(res => {
const { code, data } = res
if(code === 1000){
modalRef.current.setVisible(false)
setScanVisible(true)
setRenderCodeCharacter(data)
}else{
message.error(res.message)
}
// else{
// message.error(res.message)
// }
setIsBtnLoading(false)
})
}
......
......@@ -32,7 +32,7 @@ const AccountDetail: React.FC<{}> = () => {
const { code, data } = res
setDetails(data)
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) {
setBankDetail(bankRes.data)
} else {
......
This diff is collapsed.
......@@ -71,7 +71,7 @@ const schema: ISchema = {
title: '电子合同',
"x-rules": [
{
message: '请先生成电子合同',
message: '请选择电子合同',
required: true
}
]
......
......@@ -287,6 +287,7 @@ const OrderPayModal: React.FC<OrderPayModalProps> = (props) => {
setPayStep(0)
setOpenTimer(0)
}
setCode('')
}
const handleSubmitPay = async () => {
......@@ -318,6 +319,8 @@ const OrderPayModal: React.FC<OrderPayModalProps> = (props) => {
setQrCodeInfo({ ...qrCodeInfo, generateCharacter: res.data })
setQrLoading(false)
}
} else {
setCode('')
}
}
......
......@@ -211,16 +211,26 @@ const PurchaseOrderDetail:React.FC<PurchaseOrderDetailProps> = (props) => {
// theInvoiceInfo: (value.typeof value.theInvoiceId === 'object' ? value.theInvoiceId : null
// theInvoiceInfo: value.theInvoiceInfo
}
// 校验是否选择支付渠道
// 校验是否选择支付渠道/支付比例
let judgementByPay = params.paymentInformationResponses.map(item => {
if(item.channel && item.payWay && Number(item.payRatio)){
if(item.channel && item.payWay){
return true
} else {
return 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 => {
......
......@@ -125,19 +125,20 @@ export const usePaymentInfo = (ctx: ISchemaFormActions | ISchemaFormAsyncActions
// 限制使用到付(多次支付和商品仅有物流)
const restrictArrivalPay = (cols, pros) => {
if(pros?.length) {
// const newColumns = [...columns]
const newColumns = [...cols]
let options = newColumns[5].formItemProps.options
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
}
}
// if(pros.filter(item => item.deliveryType === 1).length !== pros.length) {
// if(options.filter(_item => _item.payType === 4).length) {
// console.log(true, '1')
// options.filter(_item => _item.payType === 4)[0].disabled = true
// }
// } else {
// if(options.filter(_item => _item.payType === 4).length) {
// console.log(false, '2')
// options.filter(_item => _item.payType === 4)[0].disabled = false
// }
// }
// 异步延迟获取数据
setTimeout(() => {
let payment = ctx.getFieldValue('paymentInformationResponses')
// 多次支付也要禁用到付
......@@ -149,7 +150,19 @@ export const usePaymentInfo = (ctx: ISchemaFormActions | ISchemaFormAsyncActions
if(options.filter(_item => _item.payType === 4).length)
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)
}
......
import React, { useRef } 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 DateRangePickerUnix from '@/components/NiceForm/components/DateRangePickerUnix'
// 待支付订单
export interface FirstApprovedOrderProps {}
const fetchTableData = async (params) => {
const { data } = await PublicApi.getOrderPendingOrderList(params)
return data
}
// TODO
const FirstApprovedOrder:React.FC<FirstApprovedOrderProps> = (props) => {
const refTable = useRef<any>({})
const {
columns
} = useSelfTable(refTable)
return <PageHeaderWrapper>
<Card>
<StandardTable
fetchTableData={params => fetchTableData(params)}
ref={refTable}
columns={columns}
rowKey={'orderNo'}
formilyLayouts={{
justify: 'space-between'
}}
formilyProps={{
ctx: {
inline: false,
schema: tableListSchema,
effects: ($, actions) => {
useStateFilterSearchLinkageEffect(
$,
actions,
'orderNo',
FORM_FILTER_PATH,
);
},
components: {
DateRangePickerUnix,
Submit
}
}
}}
/>
</Card>
</PageHeaderWrapper>
}
FirstApprovedOrder.defaultProps = {}
export default FirstApprovedOrder
\ No newline at end of file
import React, { useRef } 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 DateRangePickerUnix from '@/components/NiceForm/components/DateRangePickerUnix'
// 待支付订单
export interface FirstApprovedOrderProps {}
const fetchTableData = async (params) => {
const { data } = await PublicApi.getOrderPendingOrderList(params)
return data
}
// TODO
const FirstApprovedOrder:React.FC<FirstApprovedOrderProps> = (props) => {
// const refTable = useRef<any>({})
const {
ref,
columns
} = useSelfTable()
return <PageHeaderWrapper>
<Card>
<StandardTable
fetchTableData={params => fetchTableData(params)}
currentRef={ref}
columns={columns}
rowKey={'orderNo'}
formilyLayouts={{
justify: 'space-between'
}}
formilyProps={{
ctx: {
inline: false,
schema: tableListSchema,
effects: ($, actions) => {
useStateFilterSearchLinkageEffect(
$,
actions,
'orderNo',
FORM_FILTER_PATH,
);
},
components: {
DateRangePickerUnix,
Submit
}
}
}}
/>
</Card>
</PageHeaderWrapper>
}
FirstApprovedOrder.defaultProps = {}
export default FirstApprovedOrder
......@@ -49,14 +49,13 @@ const CircleChart = props => {
}
// 业务hooks, 待支付订单
export const useSelfTable = (props) => {
const { refTable } = props
export const useSelfTable = () => {
const ref = useRef<any>({})
const handleCancel = (param) => {
PublicApi.postOrderPurchaseOrderCancel({id: param}).then(res => {
if(res.code === 1000) {
refTable.current.reload()
ref.current.reload()
}
})
}
......@@ -182,6 +181,7 @@ export const useSelfTable = (props) => {
]
return {
ref,
columns: payOrderColumns
}
}
......@@ -41,7 +41,7 @@ const ReadyConfirmReturnOrderDetail: React.FC = () => {
detailData={formContext.data}
extraRight={
<Button type='primary' onClick={handleSubmit} loading={loading}>
确认全部已回单
去确认回单
</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