master
Joe 1 year ago
parent 49bf6382bf
commit 61815bef45

@ -97,6 +97,12 @@ export default [
access: 'productQuery',
component: './ProductList',
},
{
name: '新增商品',
path: 'add',
hideInMenu: true,
component: './ProductList/add',
},
{
name: '详情',
path: 'detail/:id',

@ -22,6 +22,7 @@ export default function access(initialState: { currentUser?: API.PbcUsersVO | un
business: false,
businessQuery: false,
businessSave: false,
businessAdd: false,
businessUpdateState: false,
member: false,
memberQuery: false,
@ -36,6 +37,7 @@ export default function access(initialState: { currentUser?: API.PbcUsersVO | un
productCategoryDelete: false,
product: false,
productQuery: false,
productAdd: false,
productUpdateState: false,
content: false,
contentQuery: false,

@ -92,6 +92,24 @@ const Constants = {
link: '链接',
share: '买家'
},
/**
*
*/
pbcBusinessHeadUserNoType: {
0: '居民身份证',
1: '港澳居民来往内地通行证',
2: '台湾居民来往大陆通行证'
},
// 手机正则
PHONE_PATTERN: /^(?:(0\d{2,3}-)?\d{7,8}|1[3-9]\d{9})$/,
//邮箱正则
EMAIL_PATTERN: /^[A-Za-z0-9\u4e00-\u9fa5._%+-]+@[a-zA-Z0-9_-]+(\.[a-zA-Z0-9_-]+)+$/,
// 统一社会信用代码
USCC_PATTERN: /[^_IOZSVa-z\W]{2}\d{6}[^_IOZSVa-z\W]{10}$/,
// 身份证件号码
IDCARD_PATTERN: /(^\d{15}$)|(^\d{18}$)|(^\d{17}(\d|X|x)$)/,
HRP_PATTERN: /^([A-Z]\d{6,10}(\(\w{1}\))?)$/,
MTP_PATTERN: /^\d{8}|^[a-zA-Z0-9]{10}|^\d{18}$/,
};
export default Constants;

@ -1,51 +1,59 @@
import Constants from '@/constants';
import {
adminChangeBusinessInfoUsingPost,
getPbcBusinessByIdUsingPost,
} from '@/services/pop-b2b2c/pbcBusinessController';
import { addBusinessForAdminUsingPost } from '@/services/pop-b2b2c/pbcBusinessApprovalController';
import { getCities } from '@/utils/cities';
import { CheckCircleOutlined, InfoCircleOutlined, PlusCircleOutlined } from '@ant-design/icons';
import {
ProCard,
ProConfigProvider,
ProDescriptions,
ProForm,
ProFormCascader,
ProFormDatePicker,
ProFormInstance,
ProFormSelect,
ProFormSwitch,
ProFormText,
ProFormTextArea,
ProFormUploadButton,
} from '@ant-design/pro-components';
import { PageContainer } from '@ant-design/pro-layout';
import { useAccess, useParams, useSearchParams } from '@umijs/max';
import { Button, Col, Image, message, Row, Tag } from 'antd';
import { RcFile } from 'antd/es/upload';
import React, { useEffect, useState } from 'react';
import { Button, Col, message, Row } from 'antd';
import Upload, { RcFile } from 'antd/es/upload';
import moment from 'moment';
import React, { useRef, useState } from 'react';
const Detail: React.FC<any> = () => {
const params = useParams();
const [searchParams] = useSearchParams();
const access: any = useAccess();
const isEdit = searchParams.get('isEdit') === '1';
const [cities] = useState(() => getCities())
const [info, setInfo] = useState<API.PbcBusiness>({});
const formRef = useRef<ProFormInstance>();
const getInfo = () => {
if (params.id) {
getPbcBusinessByIdUsingPost({ pbcId: parseInt(params.id) }).then((res) => {
if (res.retcode && res.data) {
setInfo(res.data);
}
});
}
};
const onSave = () => {
formRef.current?.submit()
}
useEffect(() => {
getInfo();
}, []);
const onSubmit = async (values: any) => {
const [pbcBusinessProvince, pbcBusinessCity, pbcBusinessArea] = values.pbcZone;
const params: API.PbcBusinessDTO = {
...values,
pbcState: values.pbcState ? 1 : 0,
pbcBusinessProvince,
pbcBusinessCity,
pbcBusinessArea,
pbcBusinessStartDate: moment(values.pbcBusinessStartDate, 'YYYY-MM-DD'),
pbcBusinessLogo: values.pbcBusinessLogo.filter((e: any) => e.response && e.response.data).map((e: any) => e.response.data).join(','),
pbcBusinessImage: values.pbcBusinessImage.filter((e: any) => e.response && e.response.data).map((e: any) => e.response.data).join(','),
pbcBusinessPosterUrl: values.pbcBusinessPosterUrl.filter((e: any) => e.response && e.response.data).map((e: any) => e.response.data).join(','),
pbcBusinessHeadUserNoBackUrl: values.pbcBusinessHeadUserNoBackUrl.filter((e: any) => e.response && e.response.data).map((e: any) => e.response.data).join(','),
pbcBusinessHeadUserNoFrontUrl: values.pbcBusinessHeadUserNoFrontUrl.filter((e: any) => e.response && e.response.data).map((e: any) => e.response.data).join(','),
pbcBusinessLicenseUrl: values.pbcBusinessLicenseUrl.filter((e: any) => e.response && e.response.data).map((e: any) => e.response.data).join(','),
pbcZone: undefined
}
const msg = await addBusinessForAdminUsingPost(params)
if (msg.retcode) {
message.success("创建成功!")
history.back();
return true
} else {
message.error(msg.retmsg)
return false
}
}
return (
<PageContainer
@ -61,30 +69,39 @@ const Detail: React.FC<any> = () => {
>
</Button>,
<Button type="primary" key="submit">
<Button type="primary" key="submit" onClick={onSave}>
</Button>
]}
>
<ProForm layout="horizontal" labelAlign="left" submitter={false}>
<ProForm layout="horizontal" labelAlign="left" formRef={formRef} onFinish={onSubmit} submitter={false}>
<ProCard title="基本信息" style={{ marginBottom: 12 }}>
<Row gutter={20}>
<Col span={8}>
<ProFormText label="商户名称" name="pbcBusinessName" />
<ProFormText label="商户名称" name="pbcBusinessName" rules={[
{ required: true, message: '商户名称' },
]} />
</Col>
<Col span={8}>
<ProFormSelect label="商户类别" name="pbcBusinessType" valueEnum={Constants.pbcBusinessType} />
<ProFormSelect label="商户类别" name="pbcBusinessType" valueEnum={Constants.pbcBusinessType} rules={[
{ required: true, message: '请选择商户类别' },
]} />
</Col>
<Col span={8}>
{/* <Col span={8}>
<ProFormSwitch label="商户状态" name="pbcState" fieldProps={{ checkedChildren: '启用', unCheckedChildren: '禁用' }} />
</Col>
</Col> */}
</Row>
<Row gutter={20}>
<Col span={8}>
<ProFormText label="联系人" name="pbcBusinessContact" />
<ProFormText label="联系人" name="pbcBusinessContact" rules={[
{ required: true, message: '请输入联系人' },
]} />
</Col>
<Col span={8}>
<ProFormText label="手机号" name="pbcBusinessContactMobile" />
<ProFormText label="手机号" name="pbcBusinessContactMobile" rules={[
{ required: true, message: '请输入手机号' },
{ pattern: Constants.PHONE_PATTERN, message: '请输入正确的手机号' },
]} />
</Col>
<Col span={8}>
<ProFormSelect label="商户等级" name="pbcBusinessLevel" options={['1级', '2级', '3级', '4级', '5级']} />
@ -92,18 +109,27 @@ const Detail: React.FC<any> = () => {
</Row>
<Row gutter={20}>
<Col span={8}>
<ProFormText label="邮箱" name="pbcBusinessEmail" />
<ProFormText label="邮箱" name="pbcBusinessEmail" rules={[
{ required: true, message: '请输入邮箱' },
{ pattern: Constants.EMAIL_PATTERN, message: '请输入正确的邮箱' },
]} />
</Col>
<Col span={16}>
<ProFormTextArea label="商户简介" name="pbcBusinessIntroduction" />
<ProFormTextArea label="商户简介" name="pbcBusinessIntroduction" rules={[
{ required: true, message: '请输入简介' },
]} />
</Col>
</Row>
<Row gutter={20}>
<Col span={8}>
<ProFormCascader label="省市区" name="pbcZone" fieldProps={{ options: cities }} />
<ProFormCascader label="省市区" name="pbcZone" fieldProps={{ options: cities }} rules={[
{ required: true, message: '请选择省市区' },
]} />
</Col>
<Col span={8}>
<ProFormTextArea label="详细地址" name="pbcBusinessAddress" />
<ProFormTextArea label="详细地址" name="pbcBusinessAddress" rules={[
{ required: true, message: '请输入详细地址' },
]} />
</Col>
<Col span={8}>
<ProFormText label="门牌号" name="pbcBusinessDoorLabel" />
@ -116,8 +142,32 @@ const Detail: React.FC<any> = () => {
name="pbcBusinessLogo"
fieldProps={{
name: 'file',
accept: 'image/*',
headers: {
authorization: localStorage.getItem('token') ?? '',
},
action: '/oss/imgUpload',
beforeUpload(file: RcFile) {
const isLt2M = file.size / 1024 / 1024 < 10;
if (!isLt2M) {
message.error('图片大小不能超过10MB!');
}
return isLt2M || Upload.LIST_IGNORE;
},
onPreview: async (file) => {
if (file.uid === '-1') {
window.open(file.url);
}
if (file.response && file.response.retcode) {
window.open(file.response.data);
}
},
listType: 'picture-card',
}}
rules={[
{ required: true, message: '请上传商户LOGO' },
]}
max={1}
/>
</Col>
@ -129,8 +179,32 @@ const Detail: React.FC<any> = () => {
name="pbcBusinessImage"
fieldProps={{
name: 'file',
accept: 'image/*',
headers: {
authorization: localStorage.getItem('token') ?? '',
},
action: '/oss/imgUpload',
beforeUpload(file: RcFile) {
const isLt2M = file.size / 1024 / 1024 < 10;
if (!isLt2M) {
message.error('图片大小不能超过10MB!');
}
return isLt2M || Upload.LIST_IGNORE;
},
onPreview: async (file) => {
if (file.uid === '-1') {
window.open(file.url);
}
if (file.response && file.response.retcode) {
window.open(file.response.data);
}
},
listType: 'picture-card',
}}
rules={[
{ required: true, message: '请上传商户图片' },
]}
/>
</Col>
</Row>
@ -141,8 +215,32 @@ const Detail: React.FC<any> = () => {
name="pbcBusinessPosterUrl"
fieldProps={{
name: 'file',
accept: 'image/*',
headers: {
authorization: localStorage.getItem('token') ?? '',
},
action: '/oss/imgUpload',
beforeUpload(file: RcFile) {
const isLt2M = file.size / 1024 / 1024 < 10;
if (!isLt2M) {
message.error('图片大小不能超过10MB!');
}
return isLt2M || Upload.LIST_IGNORE;
},
onPreview: async (file) => {
if (file.uid === '-1') {
window.open(file.url);
}
if (file.response && file.response.retcode) {
window.open(file.response.data);
}
},
listType: 'picture-card',
}}
rules={[
{ required: true, message: '请上传商户海报' },
]}
/>
</Col>
</Row>
@ -150,24 +248,69 @@ const Detail: React.FC<any> = () => {
<ProCard title="工商信息" style={{ marginBottom: 12 }}>
<Row gutter={20}>
<Col span={8}>
<ProFormText label="法人" name="pbcBusinessHead" />
<ProFormText label="法人" name="pbcBusinessHead" rules={[
{ required: true, message: '请输入法人' },
]} />
</Col>
<Col span={8}>
<ProFormText label="法人身份证号" name="pbcBusinessHeadUserNo" />
<ProFormText label="统一社会信用代码" name="pbcUnifiedSocialCreditCode" rules={[
{ required: true, message: '请输入统一社会信用代码' },
{ pattern: Constants.USCC_PATTERN, message: '请输入正确的统一社会信用代码' }
]} />
</Col>
<Col span={8}>
<ProFormDatePicker label="公司成立时间" name="pbcBusinessStartDate" rules={[
{ required: true, message: '请选择公司成立时间' },
]} />
</Col>
</Row>
<Row gutter={20}>
<Col span={8}>
<ProFormSelect label="法人身份证件类型" name="pbcBusinessHeadUserNoType" valueEnum={Constants.pbcBusinessHeadUserNoType} rules={[
{ required: true, message: '请选择法人身份证件类型' },
]} onChange={(e) => {
if (e) {
const values = formRef.current?.getFieldsValue()
formRef.current?.setFieldsValue({...values, pbcBusinessHeadUserNo: null, pbcBusinessHeadUserNoBackUrl: null, pbcBusinessHeadUserNoFrontUrl: null})
}
}} />
</Col>
<Col span={8}>
<ProFormDatePicker label="公司成立时间" name="pbcBusinessStartDate" />
<ProFormText label="法人身份号码" name="pbcBusinessHeadUserNo" rules={[
{ required: true, message: `请输入法人身份号码` },
{
validator: (_, value) => {
if (!value) return Promise.resolve()
const pbcBusinessHeadUserNoType = parseInt(formRef.current?.getFieldValue("pbcBusinessHeadUserNoType"))
let flag = false
if (pbcBusinessHeadUserNoType === 0) {
flag = Constants.IDCARD_PATTERN.test(value)
} else if (pbcBusinessHeadUserNoType === 1) {
flag = Constants.HRP_PATTERN.test(value)
} else if (pbcBusinessHeadUserNoType === 2) {
flag = Constants.MTP_PATTERN.test(value)
}
return flag ? Promise.resolve() : Promise.reject(`请输入合法的身份号码`)
}
},
]} />
</Col>
</Row>
<Row gutter={20}>
<Col span={8}>
<ProFormText label="开户行" name="pbcBusinessBank" />
<ProFormText label="开户行" name="pbcBusinessBank" rules={[
{ required: true, message: '请输入开户行' },
]} />
</Col>
<Col span={8}>
<ProFormText label="商户账户名称" name="pbcBusinessAccountName" />
<ProFormText label="商户账户名称" name="pbcBusinessAccountName" rules={[
{ required: true, message: '请输入商户账户名称' },
]} />
</Col>
<Col span={8}>
<ProFormDatePicker label="收款账号" name="pbcBusinessAccount" />
<ProFormText label="收款账号" name="pbcBusinessAccount" rules={[
{ required: true, message: '请输入收款账号' },
]} />
</Col>
</Row>
<Row gutter={20}>
@ -177,9 +320,33 @@ const Detail: React.FC<any> = () => {
name="pbcBusinessHeadUserNoBackUrl"
fieldProps={{
name: 'file',
accept: 'image/*',
headers: {
authorization: localStorage.getItem('token') ?? '',
},
action: '/oss/imgUpload',
beforeUpload(file: RcFile) {
const isLt2M = file.size / 1024 / 1024 < 10;
if (!isLt2M) {
message.error('图片大小不能超过10MB!');
}
return isLt2M || Upload.LIST_IGNORE;
},
onPreview: async (file) => {
if (file.uid === '-1') {
window.open(file.url);
}
if (file.response && file.response.retcode) {
window.open(file.response.data);
}
},
listType: 'picture-card',
}}
max={1}
rules={[
{ required: true, message: '请上传身份证人像面' },
]}
/>
</Col>
<Col span={8}>
@ -188,16 +355,42 @@ const Detail: React.FC<any> = () => {
name="pbcBusinessHeadUserNoFrontUrl"
fieldProps={{
name: 'file',
accept: 'image/*',
headers: {
authorization: localStorage.getItem('token') ?? '',
},
action: '/oss/imgUpload',
beforeUpload(file: RcFile) {
const isLt2M = file.size / 1024 / 1024 < 10;
if (!isLt2M) {
message.error('图片大小不能超过10MB!');
}
return isLt2M || Upload.LIST_IGNORE;
},
onPreview: async (file) => {
if (file.uid === '-1') {
window.open(file.url);
}
if (file.response && file.response.retcode) {
window.open(file.response.data);
}
},
listType: 'picture-card',
}}
max={1}
rules={[
{ required: true, message: '请上传身份证国徽面' },
]}
/>
</Col>
<Col span={8}></Col>
</Row>
<Row gutter={20}>
<Col span={24}>
<ProFormTextArea label="经营范围" name="pbcBusinessMainCategory" />
<ProFormTextArea label="经营范围" name="pbcBusinessMainCategory" rules={[
{ required: true, message: '请输入经营范围' },
]} />
</Col>
</Row>
<Row gutter={20}>
@ -207,8 +400,32 @@ const Detail: React.FC<any> = () => {
name="pbcBusinessLicenseUrl"
fieldProps={{
name: 'file',
accept: 'image/*',
headers: {
authorization: localStorage.getItem('token') ?? '',
},
action: '/oss/imgUpload',
beforeUpload(file: RcFile) {
const isLt2M = file.size / 1024 / 1024 < 10;
if (!isLt2M) {
message.error('图片大小不能超过10MB!');
}
return isLt2M || Upload.LIST_IGNORE;
},
onPreview: async (file) => {
if (file.uid === '-1') {
window.open(file.url);
}
if (file.response && file.response.retcode) {
window.open(file.response.data);
}
},
listType: 'picture-card',
}}
rules={[
{ required: true, message: '请上传营业执照' },
]}
/>
</Col>
</Row>

@ -174,7 +174,9 @@ const TableList: React.FC<{}> = () => {
}}
toolbar={{
actions: [
<Button type="primary" onClick={() => history.push('/business/add')}></Button>
<Access key="add" accessible={access.businessAdd}>
<Button type="primary" onClick={() => history.push('/business/add')}></Button>
</Access>
]
}}
pagination={{

@ -0,0 +1,252 @@
import Constants from '@/constants';
import { addOrUpdateProductForAdminUsingPost } from '@/services/pop-b2b2c/pbcProductController';
import { getCities } from '@/utils/cities';
import {
ProCard,
ProForm,
ProFormCascader,
ProFormInstance,
ProFormSelect,
ProFormText,
ProFormTextArea,
ProFormUploadButton,
} from '@ant-design/pro-components';
import { PageContainer } from '@ant-design/pro-layout';
import { Button, Col, message, Row } from 'antd';
import Upload, { RcFile } from 'antd/es/upload';
import moment from 'moment';
import React, { useRef, useState } from 'react';
const Detail: React.FC<any> = () => {
const [cities] = useState(() => getCities())
const formRef = useRef<ProFormInstance>();
const onSave = () => {
formRef.current?.submit()
}
const onSubmit = async (values: any) => {
const [pbcBusinessProvince, pbcBusinessCity, pbcBusinessArea] = values.pbcZone;
const params: API.PbcProductDTO = {
...values,
pbcState: values.pbcState ? 1 : 0,
pbcBusinessProvince,
pbcBusinessCity,
pbcBusinessArea,
pbcBusinessStartDate: moment(values.pbcBusinessStartDate, 'YYYY-MM-DD'),
pbcBusinessLogo: values.pbcBusinessLogo.filter((e: any) => e.response && e.response.data).map((e: any) => e.response.data).join(','),
pbcBusinessImage: values.pbcBusinessImage.filter((e: any) => e.response && e.response.data).map((e: any) => e.response.data).join(','),
pbcBusinessPosterUrl: values.pbcBusinessPosterUrl.filter((e: any) => e.response && e.response.data).map((e: any) => e.response.data).join(','),
pbcBusinessHeadUserNoBackUrl: values.pbcBusinessHeadUserNoBackUrl.filter((e: any) => e.response && e.response.data).map((e: any) => e.response.data).join(','),
pbcBusinessHeadUserNoFrontUrl: values.pbcBusinessHeadUserNoFrontUrl.filter((e: any) => e.response && e.response.data).map((e: any) => e.response.data).join(','),
pbcBusinessLicenseUrl: values.pbcBusinessLicenseUrl.filter((e: any) => e.response && e.response.data).map((e: any) => e.response.data).join(','),
pbcZone: undefined
}
const msg = await addOrUpdateProductForAdminUsingPost(params)
if (msg.retcode) {
message.success("创建成功!")
history.back();
return true
} else {
message.error(msg.retmsg)
return false
}
}
return (
<PageContainer
header={{
title: '',
}}
footer={[
<Button
key="back"
onClick={() => {
history.back();
}}
>
</Button>,
<Button type="primary" key="submit" onClick={onSave}>
</Button>
]}
>
<ProForm layout="horizontal" labelAlign="left" formRef={formRef} onFinish={onSubmit} submitter={false}>
<ProCard title="基本信息" style={{ marginBottom: 12 }}>
<Row gutter={20}>
<Col span={8}>
<ProFormText label="名称" name="pbcProductTitle" rules={[
{ required: true, message: '请输入商品名称' },
]} />
</Col>
<Col span={8}>
<ProFormSelect label="商户类别" name="pbcBusinessType" valueEnum={Constants.pbcBusinessType} rules={[
{ required: true, message: '请选择商户类别' },
]} />
</Col>
{/* <Col span={8}>
<ProFormSwitch label="商户状态" name="pbcState" fieldProps={{ checkedChildren: '启用', unCheckedChildren: '禁用' }} />
</Col> */}
</Row>
<Row gutter={20}>
<Col span={8}>
<ProFormText label="联系人" name="pbcBusinessContact" rules={[
{ required: true, message: '请输入联系人' },
]} />
</Col>
<Col span={8}>
<ProFormText label="手机号" name="pbcBusinessContactMobile" rules={[
{ required: true, message: '请输入手机号' },
{ pattern: Constants.PHONE_PATTERN, message: '请输入正确的手机号' },
]} />
</Col>
<Col span={8}>
<ProFormSelect label="商户等级" name="pbcBusinessLevel" options={['1级', '2级', '3级', '4级', '5级']} />
</Col>
</Row>
<Row gutter={20}>
<Col span={8}>
<ProFormText label="邮箱" name="pbcBusinessEmail" rules={[
{ required: true, message: '请输入邮箱' },
{ pattern: Constants.EMAIL_PATTERN, message: '请输入正确的邮箱' },
]} />
</Col>
<Col span={16}>
<ProFormTextArea label="商户简介" name="pbcBusinessIntroduction" rules={[
{ required: true, message: '请输入简介' },
]} />
</Col>
</Row>
<Row gutter={20}>
<Col span={8}>
<ProFormCascader label="省市区" name="pbcZone" fieldProps={{ options: cities }} rules={[
{ required: true, message: '请选择省市区' },
]} />
</Col>
<Col span={8}>
<ProFormTextArea label="详细地址" name="pbcBusinessAddress" rules={[
{ required: true, message: '请输入详细地址' },
]} />
</Col>
<Col span={8}>
<ProFormText label="门牌号" name="pbcBusinessDoorLabel" />
</Col>
</Row>
<Row gutter={20}>
<Col span={24}>
<ProFormUploadButton
label="商户LOGO"
name="pbcBusinessLogo"
fieldProps={{
name: 'file',
accept: 'image/*',
headers: {
authorization: localStorage.getItem('token') ?? '',
},
action: '/oss/imgUpload',
beforeUpload(file: RcFile) {
const isLt2M = file.size / 1024 / 1024 < 10;
if (!isLt2M) {
message.error('图片大小不能超过10MB!');
}
return isLt2M || Upload.LIST_IGNORE;
},
onPreview: async (file) => {
if (file.uid === '-1') {
window.open(file.url);
}
if (file.response && file.response.retcode) {
window.open(file.response.data);
}
},
listType: 'picture-card',
}}
rules={[
{ required: true, message: '请上传商户LOGO' },
]}
max={1}
/>
</Col>
</Row>
<Row gutter={20}>
<Col span={24}>
<ProFormUploadButton
label="商户图片"
name="pbcBusinessImage"
fieldProps={{
name: 'file',
accept: 'image/*',
headers: {
authorization: localStorage.getItem('token') ?? '',
},
action: '/oss/imgUpload',
beforeUpload(file: RcFile) {
const isLt2M = file.size / 1024 / 1024 < 10;
if (!isLt2M) {
message.error('图片大小不能超过10MB!');
}
return isLt2M || Upload.LIST_IGNORE;
},
onPreview: async (file) => {
if (file.uid === '-1') {
window.open(file.url);
}
if (file.response && file.response.retcode) {
window.open(file.response.data);
}
},
listType: 'picture-card',
}}
rules={[
{ required: true, message: '请上传商户图片' },
]}
/>
</Col>
</Row>
<Row gutter={20}>
<Col span={24}>
<ProFormUploadButton
label="商户海报"
name="pbcBusinessPosterUrl"
fieldProps={{
name: 'file',
accept: 'image/*',
headers: {
authorization: localStorage.getItem('token') ?? '',
},
action: '/oss/imgUpload',
beforeUpload(file: RcFile) {
const isLt2M = file.size / 1024 / 1024 < 10;
if (!isLt2M) {
message.error('图片大小不能超过10MB!');
}
return isLt2M || Upload.LIST_IGNORE;
},
onPreview: async (file) => {
if (file.uid === '-1') {
window.open(file.url);
}
if (file.response && file.response.retcode) {
window.open(file.response.data);
}
},
listType: 'picture-card',
}}
rules={[
{ required: true, message: '请上传商户海报' },
]}
/>
</Col>
</Row>
</ProCard>
</ProForm>
</PageContainer>
);
};
export default Detail;

@ -7,7 +7,7 @@ import {
} from '@/services/pop-b2b2c/pbcProductController';
import { ActionType, ProColumns, ProTable } from '@ant-design/pro-components';
import { PageContainer } from '@ant-design/pro-layout';
import { Access, Link, useAccess } from '@umijs/max';
import { Access, Link, useAccess, history } from '@umijs/max';
import { Button, message } from 'antd';
import React, { useRef } from 'react';
@ -176,6 +176,13 @@ const TableList: React.FC<{}> = () => {
defaultPageSize: 20,
showSizeChanger: true,
}}
toolbar={{
actions: [
<Access key="add" accessible={access.productAdd}>
<Button type="primary" onClick={() => history.push('/product/add')}></Button>
</Access>
]
}}
scroll={{
y: 'calc(100vh - 320px)',
}}

@ -2,41 +2,41 @@
/* eslint-disable */
import request from '@/utils/request';
/** error GET /error */
export async function errorUsingGet(options?: { [key: string]: any }) {
return request<Record<string, any>>('/error', {
/** errorHtml GET /error */
export async function errorHtmlUsingGet(options?: { [key: string]: any }) {
return request<API.ModelAndView>('/error', {
method: 'GET',
...(options || {}),
});
}
/** error PUT /error */
export async function errorUsingPut(options?: { [key: string]: any }) {
return request<Record<string, any>>('/error', {
/** errorHtml PUT /error */
export async function errorHtmlUsingPut(options?: { [key: string]: any }) {
return request<API.ModelAndView>('/error', {
method: 'PUT',
...(options || {}),
});
}
/** error POST /error */
export async function errorUsingPost(options?: { [key: string]: any }) {
return request<Record<string, any>>('/error', {
/** errorHtml POST /error */
export async function errorHtmlUsingPost(options?: { [key: string]: any }) {
return request<API.ModelAndView>('/error', {
method: 'POST',
...(options || {}),
});
}
/** error DELETE /error */
export async function errorUsingDelete(options?: { [key: string]: any }) {
return request<Record<string, any>>('/error', {
/** errorHtml DELETE /error */
export async function errorHtmlUsingDelete(options?: { [key: string]: any }) {
return request<API.ModelAndView>('/error', {
method: 'DELETE',
...(options || {}),
});
}
/** error PATCH /error */
export async function errorUsingPatch(options?: { [key: string]: any }) {
return request<Record<string, any>>('/error', {
/** errorHtml PATCH /error */
export async function errorHtmlUsingPatch(options?: { [key: string]: any }) {
return request<API.ModelAndView>('/error', {
method: 'PATCH',
...(options || {}),
});

@ -2,6 +2,21 @@
/* eslint-disable */
import request from '@/utils/request';
/** addBusinessForAdmin 管理员后台新增商户 POST /b2b2c/pbcbusinessapproval/addBusinessForAdmin */
export async function addBusinessForAdminUsingPost(
body: API.PbcBusinessDTO,
options?: { [key: string]: any },
) {
return request<API.AjaxResult>('/b2b2c/pbcbusinessapproval/addBusinessForAdmin', {
method: 'POST',
headers: {
'Content-Type': 'application/json',
},
data: body,
...(options || {}),
});
}
/** addBusinessApproval 商家新增或者修改认证申请 POST /b2b2c/pbcbusinessapproval/addorupdatebusinessapproval */
export async function addBusinessApprovalUsingPost(
body: API.PbcBusinessDTO,

@ -17,6 +17,21 @@ export async function addOrUpdateProductUsingPost(
});
}
/** 管理员新增或者修改商品 管理员接口 POST /b2b2c/pbcproduct/api/addOrUpdateProductForAdmin */
export async function addOrUpdateProductForAdminUsingPost(
body: API.PbcProductDTO,
options?: { [key: string]: any },
) {
return request<API.AjaxResultString_>('/b2b2c/pbcproduct/api/addOrUpdateProductForAdmin', {
method: 'POST',
headers: {
'Content-Type': 'application/json',
},
data: body,
...(options || {}),
});
}
/** 更改商品状态,state 1是上架2是下架3是待审核4是审核失败 更改商品状态 GET /b2b2c/pbcproduct/api/changeproductstate */
export async function changeProductStateForAdminUsingGet(
// 叠加生成的Param类型 (非body参数swagger默认没有生成对象)

@ -1637,6 +1637,8 @@ declare namespace API {
pageSize?: number;
/** 商户id */
pbcBusinessId?: number;
/** 商户名称 */
pbcBusinessName?: string;
/** 主键 */
pbcId?: number;
/** 商品细分类id也就是三级类目id */

Loading…
Cancel
Save