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 {
......
import React, { useState, useRef, useEffect } from 'react'
import { history } from 'umi'
import { Button, Steps, Card, Space, Tooltip, Form, Upload, Input, message, Row, Col } from 'antd'
import { PageHeaderWrapper } from '@ant-design/pro-layout'
import {
PlusOutlined,
QuestionCircleOutlined,
SaveOutlined,
LoadingOutlined,
ArrowLeftOutlined,
LikeFilled,
RestTwoTone,
DeleteOutlined
} from '@ant-design/icons'
import { UploadFile, UploadChangeParam } from 'antd/lib/upload/interface';
import ReutrnEle from '@/components/ReturnEle'
import { PublicApi } from '@/services/api'
import { UPLOAD_TYPE } from '@/constants'
import styles from './index.less'
import { validatorByte } from '@/utils/regExp'
const { Step } = Steps;
const layout = {
labelCol: {
span: 24,
},
wrapperCol: {
span: 10,
},
};
function beforeLogoUpload(file: UploadFile) {
const isJpgOrPng = file.type === 'image/jpeg' || file.type === 'image/png' || file.type === 'image/jpg';
if (!isJpgOrPng) {
message.error('仅支持上传JPEG/JPG/PNG文件!');
}
const isLt2M = file.size / 1024 / 10 < 6;
if (!isLt2M) {
message.error('上传图片不超过60K!');
}
return isJpgOrPng && isLt2M;
}
function beforeUpload(file: UploadFile) {
const isJpgOrPng = file.type === 'image/jpeg' || file.type === 'image/png' || file.type === 'image/jpg';
if (!isJpgOrPng) {
message.error('仅支持上传JPEG/JPG/PNG文件!');
}
const isLt2M = file.size / 1024 / 1024 < 2;
if (!isLt2M) {
message.error('上传图片不超过2MB!');
}
return isJpgOrPng && isLt2M;
}
const AddBrand: React.FC<{}> = () => {
const [form] = Form.useForm();
const [loading, setLoading] = useState(false)
const [logoLoading, setLogoLoading] = useState(false)
const [logoUrl, setlogoUrl] = useState('')
const [currentStep, setCurrentStep] = useState(0)
const [fileList, setFileList] = useState<any[]>([])
// const [proveUrl, setProveUrl] = useState<any>({})
const [isEnableCheck, setIsEnableCheck] = useState(true)
const [responseId, setReponseId] = useState<number>(null)
const [formValues, setFormValues] = useState<any>({})
const [banSomeField, setBanSomeField] = useState<boolean>(false)
const [isDisabledSave, setIsDisabledSave] = useState<boolean>(false)
useEffect(()=>{
const { id } = history.location.query
if(id){
PublicApi.getProductBrandGetBrand({id: id}).then(res=>{
if(res.code===1000){
const { data } = res
setFormValues(data)
form.setFieldsValue(data)
setlogoUrl(data.logoUrl)
// if(data.status === 4)
// setBanSomeField(true)
// 多图回显
let proveImgs = Object.values(data.proveUrl)
let files = [];
for(let i in proveImgs){
files.push({
uid: i,
name: 'image.png',
status: 'done',
url: proveImgs[i],
})
}
setFileList([...files])
}
})
}
}, [])
useEffect(() => {
let obj = {};
fileList.forEach((item, index)=>{
obj[index] = item.response?.data
})
// setProveUrl(obj)
form.setFieldsValue({proveUrl: obj})
}, [fileList])
const handleUploadLogoChange = (info: UploadChangeParam) => {
if (info.file.status === 'uploading') {
setLogoLoading(true)
return;
}
if (info.file.status === 'done') {
// 图片回显
console.log(info)
const { code, data } = info.file.response
if (code === 1000) {
setlogoUrl(data)
form.setFieldsValue({logoUrl: data})
}
setLogoLoading(false)
}
};
const handleChange = ({ fileList }) =>setFileList(fileList)
const handleSave = () => {
form.validateFields().then((values:any) => {
console.log(values,'vvv')
if(history.location.query.id){
values.id = Number(history.location.query.id)
let obj = {};
fileList.forEach((item, index)=>{
obj[index] = item?.url || item?.response?.data
})
values.proveUrl = obj
}
if(values?.proveUrl?.fileList&&fileList.length){
delete values.proveUrl.fileList
delete values.proveUrl.file
}
PublicApi.postProductBrandSaveOrUpdateBrand(values).then(res => {
setIsDisabledSave(true)
setIsEnableCheck(false)
setReponseId(res.data)
})
})
}
const handleApplyCheck = () => {
PublicApi.postProductBrandApplyCheckBrand({id: responseId}).then(res=>{
setCurrentStep(1)
setTimeout(() => {
history.goBack()
},1000)
})
}
const uploadLogoButton = (
<div>
{logoLoading ? <LoadingOutlined /> : <PlusOutlined />}
<div className="ant-upload-text">上传图片</div>
</div>
);
const uploadButton = (
<div>
{loading ? <LoadingOutlined /> : <PlusOutlined />}
<div className="ant-upload-text">上传图片</div>
</div>
);
const tips = <>证明材料<Tooltip title="证明材料:如商标注册证书、品牌授权证书等证明材料"><span>&nbsp;<QuestionCircleOutlined /></span></Tooltip></>
return (
<PageHeaderWrapper
onBack={() => history.goBack()}
backIcon={<ReutrnEle description="返回"/>}
title={history.location.query?.id?'修改品牌':'新建品牌'}
extra={[
<Button key="2" disabled={isEnableCheck} onClick={handleApplyCheck}>直接提交审核</Button>,
<Button icon={<SaveOutlined />} key="1" type="primary" onClick={handleSave} disabled={isDisabledSave}>
保存
</Button>,
]}
>
<Space direction="vertical" style={{width:'100%'}}>
<Card headStyle={{borderBottom:'none'}} title="流程进度">
<Steps progressDot current={currentStep}>
<Step title="提交审核" description="供应商" />
<Step title="审核品牌" description="平台" />
<Step title="完成" description="" />
</Steps>
</Card>
</Space>
<Form
form={form}
name="edit_infomation"
layout="horizontal"
{...layout}
initialValues={formValues}
autoComplete="off"
className="addForm"
>
<Space direction="vertical" style={{width:'100%'}}>
<Card headStyle={{borderBottom:'none'}} title="基本信息">
<Form.Item
name='name'
label={<span>品牌名称&nbsp;&nbsp;</span>}
rules={[
{
required: true,
message: '输入品牌名称!',
},
{
validator: (r, v, c) => validatorByte(r, v, c, 20)
}
]}
>
<Input disabled={banSomeField} placeholder="输入品牌名称" />
</Form.Item>
{/* <Form.Item
label='审核状态'
name="status"
initialValue={1}
style={{display:'none'}}
>
<span className="commonStatusModify"></span>待提交审核
</Form.Item>
<Form.Item
label='是否有效'
name="isEnable"
initialValue={true}
style={{display:'none'}}
>
<span className="commonStatusValid"></span>有效
</Form.Item> */}
<Form.Item
name="logoUrl"
label={<span>品牌LOGO&nbsp;&nbsp;</span>}
// valuePropName="fileList"
extra="支持JPG/PNG/JPEG,最大不超过 60K,为了减少加载数据量,只建议一级项目使用"
rules={[
{
required: true,
message: '上传图片!',
},
]}
className={styles.uploadForm}
>
<Upload
disabled={banSomeField}
name="file"
listType="picture-card"
className="avatar-uploader"
showUploadList={false}
action="/api/file/file/upload"
beforeUpload={beforeLogoUpload}
onChange={handleUploadLogoChange}
data={{ fileType: UPLOAD_TYPE }}
>
{logoUrl ? <img src={logoUrl} alt="avatar" style={{ width: '100%' }} /> : uploadLogoButton}
</Upload>
</Form.Item>
</Card>
</Space>
<Space direction="vertical" style={{width:'100%'}}>
<Card headStyle={{borderBottom:'none'}} title={tips}>
<Row>
{/* <Col span={2}>
<div>横版</div>
</Col> */}
<Col span={24}>
<Form.Item
name="proveUrl"
// valuePropName="fileList"
>
<Upload
name="file"
listType="picture-card"
className="avatar-uploader"
action="/api/file/file/upload"
fileList={fileList}
beforeUpload={beforeUpload}
onChange={handleChange}
data={{ fileType: UPLOAD_TYPE }}
showUploadList={{ showPreviewIcon: false }}
>
{fileList.length >= 20 ? null : uploadButton}
</Upload>
</Form.Item>
</Col>
</Row>
</Card>
</Space>
</Form>
</PageHeaderWrapper>
)
}
export default AddBrand
import React, { useState, useRef, useEffect } from 'react'
import { history } from 'umi'
import { Button, Steps, Card, Space, Tooltip, Form, Upload, Input, message, Row, Col } from 'antd'
import { PageHeaderWrapper } from '@ant-design/pro-layout'
import {
PlusOutlined,
QuestionCircleOutlined,
SaveOutlined,
LoadingOutlined,
ArrowLeftOutlined,
LikeFilled,
RestTwoTone,
DeleteOutlined
} from '@ant-design/icons'
import { UploadFile, UploadChangeParam } from 'antd/lib/upload/interface';
import ReutrnEle from '@/components/ReturnEle'
import { PublicApi } from '@/services/api'
import { UPLOAD_TYPE } from '@/constants'
import styles from './index.less'
import { validatorByte } from '@/utils/regExp'
const { Step } = Steps;
const layout = {
labelCol: {
span: 24,
},
wrapperCol: {
span: 10,
},
};
function beforeLogoUpload(file: UploadFile) {
const isJpgOrPng = file.type === 'image/jpeg' || file.type === 'image/png' || file.type === 'image/jpg';
if (!isJpgOrPng) {
message.error('仅支持上传JPEG/JPG/PNG文件!');
}
const isLt2M = file.size / 1024 / 10 < 6;
if (!isLt2M) {
message.error('上传图片不超过60K!');
}
return isJpgOrPng && isLt2M;
}
function beforeUpload(file: UploadFile) {
const isJpgOrPng = file.type === 'image/jpeg' || file.type === 'image/png' || file.type === 'image/jpg';
if (!isJpgOrPng) {
message.error('仅支持上传JPEG/JPG/PNG文件!');
}
const isLt2M = file.size / 1024 / 1024 < 2;
if (!isLt2M) {
message.error('上传图片不超过2MB!');
}
return isJpgOrPng && isLt2M;
}
const AddBrand: React.FC<{}> = () => {
const [form] = Form.useForm();
const [loading, setLoading] = useState(false)
const [logoLoading, setLogoLoading] = useState(false)
const [logoUrl, setlogoUrl] = useState('')
const [currentStep, setCurrentStep] = useState(0)
const [fileList, setFileList] = useState<any[]>([])
// const [proveUrl, setProveUrl] = useState<any>({})
const [isEnableCheck, setIsEnableCheck] = useState(true)
const [responseId, setReponseId] = useState<number>(null)
const [formValues, setFormValues] = useState<any>({})
const [banSomeField, setBanSomeField] = useState<boolean>(false)
const [isDisabledSave, setIsDisabledSave] = useState<boolean>(false)
useEffect(()=>{
const { id } = history.location.query
if(id){
PublicApi.getProductBrandGetBrand({id: id}).then(res=>{
if(res.code===1000){
const { data } = res
setFormValues(data)
form.setFieldsValue(data)
setlogoUrl(data.logoUrl)
// if(data.status === 4)
// setBanSomeField(true)
// 多图回显
let proveImgs = Object.values(data.proveUrl)
let files = [];
for(let i in proveImgs){
files.push({
uid: i,
name: 'image.png',
status: 'done',
url: proveImgs[i],
})
}
setFileList([...files])
}
})
}
}, [])
useEffect(() => {
let obj = {};
fileList.forEach((item, index)=>{
obj[index] = item.response?.data
})
// setProveUrl(obj)
form.setFieldsValue({proveUrl: obj})
}, [fileList])
const handleUploadLogoChange = (info: UploadChangeParam) => {
if (info.file.status === 'uploading') {
setLogoLoading(true)
return;
}
if (info.file.status === 'done') {
// 图片回显
console.log(info)
const { code, data } = info.file.response
if (code === 1000) {
setlogoUrl(data)
form.setFieldsValue({logoUrl: data})
}
setLogoLoading(false)
}
};
const handleChange = ({ fileList }) =>setFileList(fileList)
const handleSave = () => {
setIsDisabledSave(true)
form.validateFields().then((values:any) => {
if(history.location.query.id){
values.id = Number(history.location.query.id)
let obj = {};
fileList.forEach((item, index)=>{
obj[index] = item?.url || item?.response?.data
})
values.proveUrl = obj
}
if(values?.proveUrl?.fileList&&fileList.length){
delete values.proveUrl.fileList
delete values.proveUrl.file
}
PublicApi.postProductBrandSaveOrUpdateBrand(values).then(res => {
if(res.code === 1000) {
setIsEnableCheck(false)
setReponseId(res.data)
} else {
setIsDisabledSave(false)
}
})
})
}
const handleApplyCheck = () => {
PublicApi.postProductBrandApplyCheckBrand({id: responseId}).then(res=>{
setCurrentStep(1)
setTimeout(() => {
history.goBack()
},1000)
})
}
const uploadLogoButton = (
<div>
{logoLoading ? <LoadingOutlined /> : <PlusOutlined />}
<div className="ant-upload-text">上传图片</div>
</div>
);
const uploadButton = (
<div>
{loading ? <LoadingOutlined /> : <PlusOutlined />}
<div className="ant-upload-text">上传图片</div>
</div>
);
const tips = <>证明材料<Tooltip title="证明材料:如商标注册证书、品牌授权证书等证明材料"><span>&nbsp;<QuestionCircleOutlined /></span></Tooltip></>
return (
<PageHeaderWrapper
onBack={() => history.goBack()}
backIcon={<ReutrnEle description="返回"/>}
title={history.location.query?.id?'修改品牌':'新建品牌'}
extra={[
<Button key="2" disabled={isEnableCheck} onClick={handleApplyCheck}>直接提交审核</Button>,
<Button icon={<SaveOutlined />} key="1" type="primary" onClick={handleSave} disabled={isDisabledSave}>
保存
</Button>,
]}
>
<Space direction="vertical" style={{width:'100%'}}>
<Card headStyle={{borderBottom:'none'}} title="流程进度">
<Steps progressDot current={currentStep}>
<Step title="提交审核" description="供应商" />
<Step title="审核品牌" description="平台" />
<Step title="完成" description="" />
</Steps>
</Card>
</Space>
<Form
form={form}
name="edit_infomation"
layout="horizontal"
{...layout}
initialValues={formValues}
autoComplete="off"
className="addForm"
>
<Space direction="vertical" style={{width:'100%'}}>
<Card headStyle={{borderBottom:'none'}} title="基本信息">
<Form.Item
name='name'
label={<span>品牌名称&nbsp;&nbsp;</span>}
rules={[
{
required: true,
message: '输入品牌名称!',
},
{
validator: (r, v, c) => validatorByte(r, v, c, 20)
}
]}
>
<Input disabled={banSomeField} placeholder="输入品牌名称" />
</Form.Item>
{/* <Form.Item
label='审核状态'
name="status"
initialValue={1}
style={{display:'none'}}
>
<span className="commonStatusModify"></span>待提交审核
</Form.Item>
<Form.Item
label='是否有效'
name="isEnable"
initialValue={true}
style={{display:'none'}}
>
<span className="commonStatusValid"></span>有效
</Form.Item> */}
<Form.Item
name="logoUrl"
label={<span>品牌LOGO&nbsp;&nbsp;</span>}
// valuePropName="fileList"
extra="支持JPG/PNG/JPEG,最大不超过 60K,为了减少加载数据量,只建议一级项目使用"
rules={[
{
required: true,
message: '上传图片!',
},
]}
className={styles.uploadForm}
>
<Upload
disabled={banSomeField}
name="file"
listType="picture-card"
className="avatar-uploader"
showUploadList={false}
action="/api/file/file/upload"
beforeUpload={beforeLogoUpload}
onChange={handleUploadLogoChange}
data={{ fileType: UPLOAD_TYPE }}
>
{logoUrl ? <img src={logoUrl} alt="avatar" style={{ width: '100%' }} /> : uploadLogoButton}
</Upload>
</Form.Item>
</Card>
</Space>
<Space direction="vertical" style={{width:'100%'}}>
<Card headStyle={{borderBottom:'none'}} title={tips}>
<Row>
{/* <Col span={2}>
<div>横版</div>
</Col> */}
<Col span={24}>
<Form.Item
name="proveUrl"
// valuePropName="fileList"
>
<Upload
name="file"
listType="picture-card"
className="avatar-uploader"
action="/api/file/file/upload"
fileList={fileList}
beforeUpload={beforeUpload}
onChange={handleChange}
data={{ fileType: UPLOAD_TYPE }}
showUploadList={{ showPreviewIcon: false }}
>
{fileList.length >= 20 ? null : uploadButton}
</Upload>
</Form.Item>
</Col>
</Row>
</Card>
</Space>
</Form>
</PageHeaderWrapper>
)
}
export default AddBrand
import React, { useContext, useEffect, useState } from 'react'
import ModalForm from '@/components/ModalForm'
import { createFormActions, registerVirtualBox } from '@formily/antd'
import { OrderDetailContext } from '../../_public/order/context'
import { Checkbox } from 'antd'
export interface ApprovedOrderModalProps {
currentRef: any,
onConfirm(),
loading?: boolean,
title?: string,
isUseElectronicContract?: boolean,
}
// 虚线边框
registerVirtualBox("CustomDashLayout", ({ children, schema }) => {
return (
<>
<p style={{ fontSize: 12, color: '#c0c4cc' }}>注:勾选则表示同意签署电子合同,电子合同与纸质合同一样具备同等法律效力</p>
<div style={{ borderTop: "1px dashed #DFE1E6", marginTop: 24, height: 24 }}>
{children}
</div>
</>
);
});
// 采用电子合同字段的Schema
const ApproveSchemaUseContract = {
type: 'object',
properties: {
NO_SUBMIT: {
type: 'object',
"x-component": 'mega-layout',
"x-component-props": {
labelAlign: 'top',
},
properties: {
// 合同相关
isElectronicContract: {
type: 'boolean',
"x-component": 'children',
"x-component-props": {
children: "",
},
title: '电子合同',
"x-rules": [
{
message: '请先生成电子合同',
required: true
}
],
},
electronicContractName: {
type: 'string',
display: false,
},
electronicContractUrl: {
type: 'string',
display: false,
},
signatureLogId: {
type: 'string',
display: false,
},
//--
NOFIELD: {
type: "object",
title: "",
"x-component": "CustomDashLayout",
"x-component-props": {},
},
state: {
type: 'radio',
enum: [
{ label: '审核通过', value: 1 },
{ label: '审核不通过', value: 0 },
],
default: 1,
"x-linkages": [
{
type: 'value:visible',
target: 'cause',
condition: "{{$value === 0}}"
},
{
type: 'value:visible',
target: 'isElectronicContract',
condition: "{{$value === 1}}"
},
{
type: 'value:visible',
target: 'NOFIELD',
condition: "{{$value === 1}}"
}
]
},
cause: {
type: 'textarea',
"x-component-props": {
rows: 4,
placeholder: '在此输入你的原因, 最多60个汉字'
},
title: '审核不通过原因',
"x-rules": [
{
required: true,
message: '请输入审核不通过原因'
},
{
limitByte: true,
maxByte: 30
}
]
}
}
}
}
}
// 不采用电子合同字段的Schema
const ApproveSchema = {
type: 'object',
properties: {
NO_SUBMIT: {
type: 'object',
"x-component": 'mega-layout',
"x-component-props": {
labelAlign: 'top',
},
properties: {
state: {
type: 'radio',
enum: [
{ label: '审核通过', value: 1 },
{ label: '审核不通过', value: 0 },
],
default: 1,
"x-linkages": [
{
type: 'value:visible',
target: 'cause',
condition: "{{$value === 0}}"
},
{
type: 'value:visible',
target: 'isElectronicContract',
condition: "{{$value === 1}}"
},
{
type: 'value:visible',
target: 'NOFIELD',
condition: "{{$value === 1}}"
}
]
},
cause: {
type: 'textarea',
"x-component-props": {
rows: 4,
placeholder: '在此输入你的原因, 最多60个汉字'
},
title: '审核不通过原因',
"x-rules": [
{
required: true,
message: '请输入审核不通过原因'
},
{
limitByte: true,
maxByte: 30
}
]
}
}
}
}
}
const approvedActions = createFormActions()
// 需要弹窗确认的审核订单
const ApprovedOrderModal:React.FC<ApprovedOrderModalProps> = (props) => {
const { currentRef, onConfirm, title, children, loading, isUseElectronicContract = false } = props
const { data } = useContext(OrderDetailContext)
const [checkedContract, setCheckedContract] = useState<boolean>(false)
useEffect(() => {
if (currentRef) {
currentRef.current = Object.assign({}, currentRef.current, {actions: approvedActions})
}
}, [currentRef])
const onChange = (e) => {
setCheckedContract(e.target.checked)
if(e.target.checked) {
approvedActions.setFieldValue("isElectronicContract", true)
} else {
approvedActions.setFieldValue("isElectronicContract", null)
}
}
return <ModalForm
modalTitle={title || '提示'}
currentRef={currentRef}
confirm={onConfirm}
actions={approvedActions}
schema={isUseElectronicContract ? ApproveSchemaUseContract : ApproveSchema}
effects={($, ctx) => {
$('onFormInit').subscribe(() => {
ctx.setFieldState("isElectronicContract", innerState => {
innerState.props['x-component-props'] = {
children: <><Checkbox onChange={onChange} />&nbsp;&nbsp;<a href={data.electronicContractUrl} target="blank">{data.electronicContractName}</a></>
}
})
})
}}
modalProps={{confirmLoading: loading}}
/>
}
ApprovedOrderModal.defaultProps = {}
export default ApprovedOrderModal
\ No newline at end of file
import React, { useContext, useEffect, useState } from 'react'
import ModalForm from '@/components/ModalForm'
import { createFormActions, registerVirtualBox } from '@formily/antd'
import { OrderDetailContext } from '../../_public/order/context'
import { Checkbox } from 'antd'
export interface ApprovedOrderModalProps {
currentRef: any,
onConfirm(),
loading?: boolean,
title?: string,
isUseElectronicContract?: boolean,
}
// 虚线边框
registerVirtualBox("CustomDashLayout", ({ children, schema }) => {
return (
<>
<p style={{ fontSize: 12, color: '#c0c4cc' }}>注:勾选则表示同意签署电子合同,电子合同与纸质合同一样具备同等法律效力</p>
<div style={{ borderTop: "1px dashed #DFE1E6", marginTop: 24, height: 24 }}>
{children}
</div>
</>
);
});
// 采用电子合同字段的Schema
const ApproveSchemaUseContract = {
type: 'object',
properties: {
NO_SUBMIT: {
type: 'object',
"x-component": 'mega-layout',
"x-component-props": {
labelAlign: 'top',
},
properties: {
// 合同相关
isElectronicContract: {
type: 'boolean',
"x-component": 'children',
"x-component-props": {
children: "",
},
title: '电子合同',
"x-rules": [
{
message: '请选择电子合同',
required: true
}
],
},
electronicContractName: {
type: 'string',
display: false,
},
electronicContractUrl: {
type: 'string',
display: false,
},
signatureLogId: {
type: 'string',
display: false,
},
//--
NOFIELD: {
type: "object",
title: "",
"x-component": "CustomDashLayout",
"x-component-props": {},
},
state: {
type: 'radio',
enum: [
{ label: '审核通过', value: 1 },
{ label: '审核不通过', value: 0 },
],
default: 1,
"x-linkages": [
{
type: 'value:visible',
target: 'cause',
condition: "{{$value === 0}}"
},
{
type: 'value:visible',
target: 'isElectronicContract',
condition: "{{$value === 1}}"
},
{
type: 'value:visible',
target: 'NOFIELD',
condition: "{{$value === 1}}"
}
]
},
cause: {
type: 'textarea',
"x-component-props": {
rows: 4,
placeholder: '在此输入你的原因, 最多60个汉字'
},
title: '审核不通过原因',
"x-rules": [
{
required: true,
message: '请输入审核不通过原因'
},
{
limitByte: true,
maxByte: 30
}
]
}
}
}
}
}
// 不采用电子合同字段的Schema
const ApproveSchema = {
type: 'object',
properties: {
NO_SUBMIT: {
type: 'object',
"x-component": 'mega-layout',
"x-component-props": {
labelAlign: 'top',
},
properties: {
state: {
type: 'radio',
enum: [
{ label: '审核通过', value: 1 },
{ label: '审核不通过', value: 0 },
],
default: 1,
"x-linkages": [
{
type: 'value:visible',
target: 'cause',
condition: "{{$value === 0}}"
},
{
type: 'value:visible',
target: 'isElectronicContract',
condition: "{{$value === 1}}"
},
{
type: 'value:visible',
target: 'NOFIELD',
condition: "{{$value === 1}}"
}
]
},
cause: {
type: 'textarea',
"x-component-props": {
rows: 4,
placeholder: '在此输入你的原因, 最多60个汉字'
},
title: '审核不通过原因',
"x-rules": [
{
required: true,
message: '请输入审核不通过原因'
},
{
limitByte: true,
maxByte: 30
}
]
}
}
}
}
}
const approvedActions = createFormActions()
// 需要弹窗确认的审核订单
const ApprovedOrderModal:React.FC<ApprovedOrderModalProps> = (props) => {
const { currentRef, onConfirm, title, children, loading, isUseElectronicContract = false } = props
const { data } = useContext(OrderDetailContext)
const [checkedContract, setCheckedContract] = useState<boolean>(false)
useEffect(() => {
if (currentRef) {
currentRef.current = Object.assign({}, currentRef.current, {actions: approvedActions})
}
}, [currentRef])
const onChange = (e) => {
setCheckedContract(e.target.checked)
if(e.target.checked) {
approvedActions.setFieldValue("isElectronicContract", true)
} else {
approvedActions.setFieldValue("isElectronicContract", null)
}
}
return <ModalForm
modalTitle={title || '提示'}
currentRef={currentRef}
confirm={onConfirm}
actions={approvedActions}
schema={isUseElectronicContract ? ApproveSchemaUseContract : ApproveSchema}
effects={($, ctx) => {
$('onFormInit').subscribe(() => {
ctx.setFieldState("isElectronicContract", innerState => {
innerState.props['x-component-props'] = {
children: <><Checkbox onChange={onChange} />&nbsp;&nbsp;<a href={data.electronicContractUrl} target="blank">{data.electronicContractName}</a></>
}
})
})
}}
modalProps={{confirmLoading: loading}}
/>
}
ApprovedOrderModal.defaultProps = {}
export default ApprovedOrderModal
......@@ -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