Commit a07ded6e authored by 张子雨's avatar 张子雨

feat: 新增商家资料和合同

parent 978bf3d6
const isProduction = process.env.NODE_ENV === 'production';
const isPre = process.env.PRE_ENV === 'pre';
const environment = 'xyqb';
const environment = 'sc1';
const envAPi = {
api: `https://security-${environment}.liangkebang.net`, //'https://security-xyqb.liangkebang.net',
kdspOpApi: `https://sc-merchant-api-${environment}.liangkebang.net`,
......
......@@ -2,13 +2,11 @@ import React from 'react';
import moment from 'moment';
import { PlusOutlined } from '@ant-design/icons';
import { notification, Tag, Tooltip, Input } from 'antd';
// import { reject } from 'lodash-es';
import {
uploadFile,
apiCategoryList,
apiAddrArea,
apiServiceFacility,
apiApplyDetail,
apiBusinessDetail,
apiBankList,
} from '../service';
......@@ -42,24 +40,38 @@ export const businessModel = [
];
// 获取申请信息
export async function getInfo(id, type) {
let api = apiApplyDetail;
if (['info', 'edit', 'revision'].includes(type)) {
api = apiBusinessDetail;
}
const [res] = await api(id);
export async function getInfo() {
const data = await apiBusinessDetail();
let settlementType = 1;
const res = data.data;
if (res) {
if (res.facilities) {
res.customList = res.facilities.customList || [];
res.selfList = res.facilities.selfList || [];
}
res.accountOpenPermitImage = [{ uid: 0, url: res.accountOpenPermitImage }];
res.businessLicenseImage = [{ uid: 0, url: res.businessLicenseImage }];
res.idCardEmblemImage = [{ uid: 0, url: res.idCardEmblemImage }];
res.idCardPortraitImage = [{ uid: 0, url: res.idCardPortraitImage }];
res.primaryImage = [{ uid: 0, url: res.primaryImage }];
res.sealImage = [{ uid: 0, url: res.sealImage }];
res.accountOpenPermitImage = res.accountOpenPermitImage
? [{ uid: 0, url: res.accountOpenPermitImage }]
: [];
res.businessLicenseImage = res.businessLicenseImage
? [{ uid: 0, url: res.businessLicenseImage }]
: [];
res.idCardEmblemImage = res.idCardEmblemImage ? [{ uid: 0, url: res.idCardEmblemImage }] : [];
res.idCardPortraitImage = res.idCardPortraitImage
? [{ uid: 0, url: res.idCardPortraitImage }]
: [];
res.primaryImage = res.primaryImage ? [{ uid: 0, url: res.primaryImage }] : [];
res.sealImage = res.sealImage ? [{ uid: 0, url: res.sealImage }] : [];
res.brandCertificate = res.brandCertificate ? [{ uid: 0, url: res.brandCertificate }] : [];
// 非同名结算授权文件
res.differentNameAuthorizationImage = res.differentNameAuthorizationImage
? [{ uid: 0, url: res.brandCertificate }]
: [];
// 户口本本人页
res.householdRegisterImage = res.householdRegisterImage
? [{ uid: 0, url: res.householdRegisterImage }]
: [];
// 工商局
res.icbProofImage = res.icbProofImage ? [{ uid: 0, url: res.icbProofImage }] : [];
if (res.categoryQualificateImage) {
res.categoryQualificateImage = [{ uid: 0, url: res.categoryQualificateImage }];
}
......@@ -75,11 +87,18 @@ export async function getInfo(id, type) {
}
settlementType = +res.settlementType;
}
res.legalPersonPeriod = res.legalPersonPeriod.split('-').map(item => moment(item));
res.businessLicensePeriod = moment(res.businessLicensePeriod);
res.checked = res.legalPersonPeriod === '长期';
res.legalPerson =
res.legalPersonPeriod &&
res.legalPersonPeriod !== '长期' &&
res.legalPersonPeriod.split('-').map(item => moment(item));
res.businessLicensePeriod = res.businessLicensePeriod && moment(res.businessLicensePeriod);
const companyNamedis = !!res.companyName;
this.setState({
settlementType,
businessInfo: res,
checkboxDisabled: res.checked,
companyNamedis,
});
}
......@@ -92,6 +111,7 @@ function delImg(keyName, e) {
};
});
}
// 上传图片
export function uploadPropsFn(
{ keyName, limit = 1, maxSize = 1024 * 1024 * 5, maxSizeMsg = '文件大小不能超过5M!', type = 0 },
......@@ -247,16 +267,6 @@ export function renderServiceTags() {
}
/** **** 自定义服务设施 end ***************************** */
// 获取主营类目
export async function getCategoryList() {
const [res] = await apiCategoryList();
if (res) {
this.setState({
categoryList: res,
});
}
}
// 获取服务设施
export async function getServiceFacility() {
const res = await apiServiceFacility();
......@@ -288,6 +298,7 @@ export async function getAreaAddr() {
label: item.addrName,
value: item.addrId,
}));
console.log(this.state.businessInfo, '......');
// 编辑时 回显 市、区、街道
if (this.state.businessInfo.provinceId) {
const pros = res.filter(item => +item.value === +this.state.businessInfo.provinceId);
......
......@@ -25,7 +25,6 @@ import {
wrapperCol,
uploadPropsFn,
formItemLayout,
getCategoryList,
renderServiceTags,
loadData,
getAreaAddr,
......@@ -38,7 +37,7 @@ import {
import { validatePhone, validateEMail, validNumber } from '@/utils/validator';
import { getErrorMessage } from '@/utils/utils';
import MapModal from '@/components/BaiduMap';
import { apiNewStoreInfo, apiEditStoreInfo, apiRecognize, apiRevision } from '../service';
import { apiCategoryList, apiEditStoreInfo, apiRecognize, apiRevision } from '../service';
import {
infoTypeFind,
infoTypeChecked,
......@@ -52,11 +51,6 @@ const { Item: FormItem } = Form;
const { RangePicker } = DatePicker;
const { TabPane } = Tabs;
const applyTypeDesc = {
1: '用户提交申请:',
3: '易宝驳回:',
};
class BusinessInfo extends Component {
getFieldDecorator = this.props?.form?.getFieldDecorator;
......@@ -83,78 +77,36 @@ class BusinessInfo extends Component {
visibleMap: false,
visibleLoading: false,
calculateType: [1, 1],
defaultType: '1',
visibleCalculate: false,
checkboxDisabled: false,
mainCategoryId: null,
companyNamedis: false, // 公司名称
bankAccounts: false,
};
async componentDidMount() {
const { id, type } = this.props.location.query;
const info = {};
let businessType = [];
if (id) {
info.id = id;
info.type = type || infoTypeFind;
await getInfo.call(this, id, type);
businessType = this.state.businessInfo.productBusiness.map(item => this.getDataInfo(item));
}
// find 查看 checked审核 edit修改 info审核之后查看
if (id && [infoTypeFind, infoTypeInfo, infoTypeRevision].includes(type)) {
info.disabled = !0;
} else if (type === infoTypeRevision) {
// 订正 除了邮箱其他都禁止修改
info.disabled = !0;
info.emailDisabled = false;
}
this.setState(state => {
const businessInfo = Object.assign(
{
businessType,
},
state.businessInfo,
);
return {
...info,
businessInfo,
};
});
getAreaAddr.call(this);
// getCategoryList.call(this);
getInfo.call(this);
getServiceFacility.call(this);
getBankList.call(this);
}
// 审核的时候 切换业务模式 更改服务费率配置
onChangeBusinessModel = e => {
if (this.state.type !== infoTypeChecked) {
return false;
if (this.state.businessInfo.productBusiness) {
this.getCategoryList(this.state.businessInfo.productBusiness);
}
const arr = [];
e.forEach(item => {
if (item === 1 || item === 3) {
arr.push(item);
}
});
const businessType = arr.map(item => this.getDataInfo(item));
this.setState(state => {
const { businessInfo } = state;
businessInfo.businessType = businessType;
return {
businessInfo,
};
});
return console.log('.');
};
}
// 切换审核结果 - 显示/隐藏费率
onChangeAuditResult = e => {
// 主营类目
onMainCategory(e) {
this.setState({
visibleCalculate: e.target.value,
mainCategoryId: e,
});
};
}
onTabChange = e => {
// 长期
oncheckedChange = e => {
this.setState({
defaultType: e,
checkboxDisabled: e.target.checked,
});
this.props.form.setFieldsValue({
legalPerson: '',
});
};
......@@ -237,38 +189,13 @@ class BusinessInfo extends Component {
});
};
// 订正 - 修改邮箱
onRevision = () => {
const email = this.props.form.getFieldValue('contactEmail');
const contactPhone = this.props.form.getFieldValue('contactPhone');
if (email) {
validateEMail('', email, async e => {
if (!e) {
const [res, error] = await apiRevision({
id: this.state.id,
contactPhone,
contactEmail: email,
});
console.log('res :>> ', res);
if (!error) {
notification.success({ message: '订正完成!~' });
this.onCancel();
}
} else {
notification.warning({ message: '请输入正确的邮箱地址' });
}
});
} else {
notification.warning({ message: '请输入邮箱地址' });
}
};
/* eslint-disable no-return-assign */
saveInputRef = input => (this.input = input);
// 返回
onCancel = () => {
window.history.back();
// window.history.back();
getInfo.call(this);
};
// 提交
......@@ -279,9 +206,13 @@ class BusinessInfo extends Component {
if (!err) {
const imgs = this.state.businessInfo;
obj.businessLicensePeriod = moment(obj.businessLicensePeriod).format('YYYY-MM-DD');
obj.legalPersonPeriod = obj.legalPersonPeriod
.map(o => moment(o).format('YYYY/MM/DD'))
.join('-');
if (this.state.checkboxDisabled) {
obj.legalPersonPeriod = '长期';
} else {
obj.legalPersonPeriod = obj.legalPerson
.map(o => moment(o).format('YYYY/MM/DD'))
.join('-');
}
obj.facilities = {
customList: this.state.businessInfo.customList,
selfList: obj.selfList,
......@@ -307,7 +238,16 @@ class BusinessInfo extends Component {
obj.idCardPortraitImage = imgs.idCardPortraitImage[0].url;
obj.primaryImage = imgs.primaryImage[0].url;
obj.sealImage = imgs.sealImage[0].url;
obj.differentNameAuthorizationImage =
imgs.differentNameAuthorizationImage?.length &&
imgs.differentNameAuthorizationImage[0].url;
obj.householdRegisterImage =
imgs.householdRegisterImage?.length && imgs.householdRegisterImage[0].url;
obj.icbProofImage = imgs.icbProofImage?.length && imgs.icbProofImage[0].url;
obj.applySource = 1;
obj.signDateType = 1;
if (imgs.otherImage && imgs.otherImage.length) {
obj.otherImage = imgs.otherImage.map(item => item.url);
} else {
......@@ -321,21 +261,14 @@ class BusinessInfo extends Component {
obj.legalPersonIdCard = obj.legalPersonIdCard?.toLocaleUpperCase() || '';
obj.bankAccountLicenseNum = obj.bankAccountLicenseNum?.toLocaleUpperCase() || '';
obj.socialCode = obj.socialCode?.toLocaleUpperCase() || '';
let api = apiNewStoreInfo;
if (this.state.id) {
obj.id = this.state.id;
if (this.state.type === infoTypeEdit) {
obj.headImage = obj.primaryImage;
api = apiEditStoreInfo;
}
} else {
obj.completed = !0;
}
this.setState({
loading: true,
});
obj.id = this.state.id;
obj.headImage = obj.primaryImage;
// this.setState({
// loading: true,
// });
console.log('obj :>>提交 ', obj);
const data = await api(obj);
const data = await apiEditStoreInfo(obj);
console.log(data, '.........');
if (data.businessCode === '0000') {
// const msg = this.state.type === infoTypeChecked ? '审核完成' : '保存成功';
notification.success({ message: `${data.msg}!~` });
......@@ -357,6 +290,22 @@ class BusinessInfo extends Component {
});
};
// 修改公司名称
setCompanyName = () => {
const val = this.state.companyNamedis;
this.setState({
companyNamedis: !val,
});
};
// 修改银行账号
setBankAccount = () => {
const val = this.state.bankAccounts;
this.setState({
bankAccounts: !val,
});
};
openMap(e, disabled) {
if (!disabled) {
this.setState({
......@@ -370,15 +319,33 @@ class BusinessInfo extends Component {
return current && current < moment(moment().format('YYYY-MM-DD'));
}
onChangeBusinessModel = e => {
this.getCategoryList(e);
};
// 获取主营类目
async getCategoryList(e) {
const data = await apiCategoryList(e);
if (!data.data) return;
this.setState({ categoryList: data.data });
}
render() {
const {
form: { getFieldDecorator },
} = this.props;
const { businessInfo, type } = this.state;
const {
businessInfo,
type,
checkboxDisabled,
mainCategoryId,
companyNamedis,
bankAccounts,
} = this.state;
return (
<div className={styles.infoBox}>
<Form className="login-form" onSubmit={this.handleSubmit} {...formItemLayout}>
<Card title="基本信息">
<Card title="店铺基本信息">
<Row gutter={24}>
<Col span={24}>
<FormItem label="业务模式" labelCol={{ span: 4 }}>
......@@ -461,59 +428,74 @@ class BusinessInfo extends Component {
})(<Input maxLength={11} />)}
</FormItem>
</Col>
<Col span={12} className={styles.imgList}>
<FormItem label="商户头图" labelCol={{ span: 8 }} wrapperCol={wrapperCol}>
{getFieldDecorator('primaryImage', {
rules: [{ required: true, message: '请上传商户头图!' }],
initialValue: businessInfo.primaryImage,
})(
<Upload
{...uploadPropsFn.call(this, { keyName: 'primaryImage', type: 1 })}
fileList={businessInfo.primaryImage}
>
<UploadOutlined /> 上传文件
</Upload>,
)}
</FormItem>
</Col>
<Col span={24}>
<FormItem label="服务设施" labelCol={{ span: 4 }}>
{getFieldDecorator('selfList', {
initialValue: businessInfo.selfList,
})(
<Select mode="multiple">
{this.state.serviceFacilitys.map(item => (
<Option value={item.code} key={item.code}>
{item.desc}
</Option>
))}
</Select>,
)}
</FormItem>
</Col>
<Col span={24}>
<FormItem label="自定义服务设施" labelCol={{ span: 4 }}>
{getFieldDecorator('customList', {
initialValue: businessInfo.customList,
})(renderServiceTags.call(this))}
<FormItem label="签约日期" labelCol={{ span: 4 }}>
{getFieldDecorator('signDateType', {
rules: [{ required: true, message: '请选择签约日期' }],
initialValue: businessInfo.signDateType,
})(<Checkbox>自商品售卖起默认一年</Checkbox>)}
</FormItem>
</Col>
</Row>
</Card>
<Card title="店铺营业信息">
<Col span={12} className={styles.imgList}>
<FormItem label="商户头图" labelCol={{ span: 8 }} wrapperCol={wrapperCol}>
{getFieldDecorator('primaryImage', {
rules: [{ required: true, message: '请上传商户头图!' }],
initialValue: businessInfo.primaryImage,
})(
<Upload
{...uploadPropsFn.call(this, { keyName: 'primaryImage', type: 1 })}
fileList={businessInfo.primaryImage}
>
<UploadOutlined /> 上传文件
</Upload>,
)}
</FormItem>
</Col>
<Col span={24}>
<FormItem label="服务设施" labelCol={{ span: 4 }}>
{getFieldDecorator('selfList', {
initialValue: businessInfo.selfList,
})(
<Select mode="multiple">
{this.state.serviceFacilitys.map(item => (
<Option value={item.code} key={item.code}>
{item.desc}
</Option>
))}
</Select>,
)}
</FormItem>
</Col>
<Col span={24}>
<FormItem label="自定义服务设施" labelCol={{ span: 4 }}>
{getFieldDecorator('customList', {
initialValue: businessInfo.customList,
})(renderServiceTags.call(this))}
</FormItem>
</Col>
</Card>
<Card title="证照信息录入区">
<Row gutter={24}>
<Col span={24}>
<FormItem label="主营类目" labelCol={{ span: 4 }}>
{getFieldDecorator('mainCategoryId', {
// rules: [{ required: true, message: '请选择主营类目!' }],
rules: [{ required: true, message: '请选择主营类目!' }],
initialValue: businessInfo.mainCategoryId,
})(
<Select>
<Select
onChange={e => this.onMainCategory(e)}
showSearch
filterOption={(input, option) =>
option.props.children.toLowerCase().indexOf(input.toLowerCase()) >= 0
}
>
{this.state.categoryList.map(item => (
<Option value={item.categoryId} key={item.categoryId}>
{item.categoryName}
<Option value={item.id} key={item.id}>
{item.name}
</Option>
))}
</Select>,
......@@ -526,7 +508,7 @@ class BusinessInfo extends Component {
rules: [{ required: true, message: '请选择企业类型!' }],
initialValue: businessInfo.companyType,
})(
<Radio.Group>
<Radio.Group disabled={businessInfo.companyType}>
<Radio value={1}>一般纳税人</Radio>
<Radio value={2}>小规模</Radio>
<Radio value={3}>个体工商</Radio>
......@@ -554,12 +536,21 @@ class BusinessInfo extends Component {
</FormItem>
</Col>
<Col span={12}>
<FormItem label="公司名称" labelCol={{ span: 8 }}>
{getFieldDecorator('companyName', {
rules: [{ required: true, message: '请输入公司名称!' }],
initialValue: businessInfo.companyName,
})(<Input maxLength={50} />)}
</FormItem>
<Row>
<Col span={4} style={{ marginTop: '4px' }}>
{businessInfo.companyName && (
<Button onClick={this.setCompanyName}>修改</Button>
)}
</Col>
<Col span={12}>
<FormItem label="公司名称" labelCol={{ span: 8 }}>
{getFieldDecorator('companyName', {
rules: [{ required: true, message: '请输入公司名称!' }],
initialValue: businessInfo.companyName,
})(<Input maxLength={50} disabled={companyNamedis} />)}
</FormItem>
</Col>
</Row>
</Col>
<Col span={12}>
<FormItem label="统一社会信用代码" labelCol={{ span: 8 }}>
......@@ -569,6 +560,80 @@ class BusinessInfo extends Component {
})(<Input maxLength={32} />)}
</FormItem>
</Col>
{!companyNamedis && businessInfo.companyType && businessInfo.companyType !== 2 && (
<Col span={12}>
<FormItem label="工商局变更证明" labelCol={{ span: 8 }} wrapperCol={wrapperCol}>
{getFieldDecorator('icbProofImage', {
rules: [{ required: true, message: '请上传工商局变更证明!' }],
initialValue: businessInfo.icbProofImage,
})(
<Upload
{...uploadPropsFn.call(this, {
keyName: 'icbProofImage',
type: 3,
maxSize: 1024 * 200,
maxSizeMsg: '文件大小不能超过200K',
limit: 1,
})}
fileList={businessInfo.icbProofImage}
>
<UploadOutlined /> 上传文件
</Upload>,
)}
</FormItem>
</Col>
)}
{!companyNamedis && businessInfo.companyType && businessInfo.companyType === 2 && (
<Col span={12}>
<FormItem label="户口本本人页" labelCol={{ span: 8 }} wrapperCol={wrapperCol}>
{getFieldDecorator('householdRegisterImage', {
rules: [{ required: true, message: '请上传户口本本人页!' }],
initialValue: businessInfo.householdRegisterImage,
})(
<Upload
{...uploadPropsFn.call(this, {
keyName: 'householdRegisterImage',
type: 3,
maxSize: 1024 * 200,
maxSizeMsg: '文件大小不能超过200K',
limit: 1,
})}
fileList={businessInfo.householdRegisterImage}
>
<UploadOutlined /> 上传文件
</Upload>,
)}
</FormItem>
</Col>
)}
{((businessInfo.differentNameAuthorizationImage &&
businessInfo.differentNameAuthorizationImage.length) ||
!companyNamedis) && (
<Col span={24}>
<FormItem
label="非同名结算授权文件"
labelCol={{ span: 4 }}
wrapperCol={wrapperCol}
>
{getFieldDecorator('differentNameAuthorizationImage', {
initialValue: businessInfo.differentNameAuthorizationImage,
})(
<Upload
{...uploadPropsFn.call(this, {
keyName: 'differentNameAuthorizationImage',
type: 3,
maxSize: 1024 * 200,
maxSizeMsg: '文件大小不能超过200K',
limit: 1,
})}
fileList={businessInfo.differentNameAuthorizationImage}
>
<UploadOutlined /> 上传文件
</Upload>,
)}
</FormItem>
</Col>
)}
<Col span={24}>
<FormItem label="营业执照有效期" labelCol={{ span: 4 }}>
{getFieldDecorator('businessLicensePeriod', {
......@@ -615,6 +680,39 @@ class BusinessInfo extends Component {
)}
</FormItem>
</Col>
{+mainCategoryId === 301008 && (
<div>
<Col span={24}>
<FormItem label="授权品牌" labelCol={{ span: 4 }}>
{getFieldDecorator('brand', {
initialValue: businessInfo.brand,
})(<Input maxLength={32} />)}
</FormItem>
</Col>
<Col span={24}>
<FormItem
label="品牌经销商授权书"
labelCol={{ span: 4 }}
wrapperCol={wrapperCol}
>
{getFieldDecorator('brandCertificate', {
initialValue: businessInfo.brandCertificate,
})(
<Upload
{...uploadPropsFn.call(this, {
keyName: 'brandCertificate',
type: 3,
limit: 1,
})}
fileList={businessInfo.brandCertificate}
>
<UploadOutlined /> 上传文件
</Upload>,
)}
</FormItem>
</Col>
</div>
)}
</Row>
</Card>
<Card title="法人信息录入区">
......@@ -677,13 +775,29 @@ class BusinessInfo extends Component {
</FormItem>
</Col>
<Col span={12}>
<FormItem label="身份证有效期" labelCol={{ span: 8 }}>
{getFieldDecorator('legalPersonPeriod', {
rules: [{ required: true, message: '请输入身份证有效期!' }],
initialValue: businessInfo.legalPersonPeriod,
})(<RangePicker />)}
</FormItem>
<Row gutter={24}>
<Col span={18}>
<FormItem label="身份证有效期" labelCol={{ span: 8 }}>
{getFieldDecorator('legalPerson', {
rules: [{ required: !checkboxDisabled, message: '请输入身份证有效期!' }],
initialValue: businessInfo.legalPerson,
})(<RangePicker disabled={checkboxDisabled} />)}
</FormItem>
</Col>
<Col span={6}>
<FormItem labelCol={{ span: 8 }}>
{getFieldDecorator('legalPersonPeriod', {
initialValue: businessInfo.checked,
})(
<Checkbox Group className={styles.radio} onChange={this.oncheckedChange}>
长期
</Checkbox>,
)}
</FormItem>
</Col>
</Row>
</Col>
<Col span={12}>
<FormItem label="手机号" labelCol={{ span: 8 }}>
{getFieldDecorator('legalPersonPhone', {
......@@ -785,12 +899,19 @@ class BusinessInfo extends Component {
</FormItem>
</Col>
<Col span={12}>
<FormItem label="银行帐号" labelCol={{ span: 8 }}>
{getFieldDecorator('bankAccount', {
rules: [{ required: true, message: '请输入银行帐号!' }],
initialValue: businessInfo.bankAccount,
})(<Input maxLength={20} />)}
</FormItem>
<Row>
<Col span={4} style={{ marginTop: '4px' }}>
{businessInfo.companyName && (
<Button onClick={this.setBankAccount}>修改</Button>
)}
</Col>
<FormItem label="银行帐号" labelCol={{ span: 8 }}>
{getFieldDecorator('bankAccount', {
rules: [{ required: true, message: '请输入银行帐号!' }],
initialValue: businessInfo.bankAccount,
})(<Input maxLength={20} disabled={!bankAccounts} />)}
</FormItem>
</Row>
</Col>
<Col span={12}>
<FormItem label="联行号" labelCol={{ span: 8 }}>
......@@ -799,6 +920,34 @@ class BusinessInfo extends Component {
})(<Input maxLength={50} />)}
</FormItem>
</Col>
{((businessInfo.differentNameAuthorizationImage &&
businessInfo.differentNameAuthorizationImage.length) ||
bankAccounts) && (
<Col span={24}>
<FormItem
label="非同名结算授权文件"
labelCol={{ span: 4 }}
wrapperCol={wrapperCol}
>
{getFieldDecorator('differentNameAuthorizationImage', {
initialValue: businessInfo.differentNameAuthorizationImage,
})(
<Upload
{...uploadPropsFn.call(this, {
keyName: 'differentNameAuthorizationImage',
type: 3,
maxSize: 1024 * 200,
maxSizeMsg: '文件大小不能超过200K',
limit: 1,
})}
fileList={businessInfo.differentNameAuthorizationImage}
>
<UploadOutlined /> 上传文件
</Upload>,
)}
</FormItem>
</Col>
)}
</Row>
)}
{this.state.settlementType === 2 && (
......@@ -857,185 +1006,38 @@ class BusinessInfo extends Component {
</Row>
)}
</Card>
<Card title="其他信息">
<Row gutter={24}>
<Col span={24}>
<FormItem label="礼包内容" labelCol={{ span: 4 }}>
{getFieldDecorator('giftPackageContent', {
// rules: [{ required: true, message: '请输入礼包内容!' }],
initialValue: businessInfo.giftPackageContent,
})(<Input style={{ width: '50%' }} />)}
</FormItem>
</Col>
<Col span={24}>
<FormItem label="邀请码" labelCol={{ span: 4 }}>
{getFieldDecorator('invitationCode', {
// rules: [{ required: true, message: '请输入礼包内容!' }],
initialValue: businessInfo.invitationCode,
})(<Input style={{ width: '50%' }} />)}
</FormItem>
</Col>
</Row>
</Card>
{this.state.type === infoTypeChecked && [
<Card title="信息审核区" key="checked">
{/* 汽车301008 */}
{+mainCategoryId === 301008 && (
<Card title="其他信息">
<Row gutter={24}>
{businessInfo.applyType && (
<Col span={24}>
<FormItem label="上级节点" labelCol={{ span: 4 }} wrapperCol={wrapperCol}>
{applyTypeDesc[businessInfo.applyType] || ''}
{businessInfo.remark}
</FormItem>
</Col>
)}
<Col span={24}>
<FormItem label="审核结果" labelCol={{ span: 4 }} wrapperCol={wrapperCol}>
{getFieldDecorator('auditResult', {
rules: [{ required: true, message: '请选择审核结果!' }],
initialValue: businessInfo.auditResult,
})(
<Radio.Group onChange={this.onChangeAuditResult}>
<Radio value>通过</Radio>
<Radio value={false}>驳回</Radio>
</Radio.Group>,
)}
<FormItem label="礼包内容" labelCol={{ span: 4 }}>
{getFieldDecorator('giftPackageContent', {
rules: [{ required: true, message: '请输入礼包内容!' }],
initialValue: businessInfo.giftPackageContent,
})(<Input style={{ width: '50%' }} />)}
</FormItem>
</Col>
<Col span={24}>
<FormItem label="审核结果" labelCol={{ span: 4 }}>
{getFieldDecorator('auditRemark', {
rules: [{ required: true, message: '请输入审核结果!' }],
initialValue: businessInfo.auditRemark,
})(<Input maxLength={500} />)}
<FormItem label="邀请码" labelCol={{ span: 4 }}>
{getFieldDecorator('invitationCode', {
rules: [{ required: true, message: '请输入邀请码!' }],
initialValue: businessInfo.invitationCode,
})(<Input style={{ width: '50%' }} />)}
</FormItem>
</Col>
</Row>
</Card>,
this.state.visibleCalculate && (
<Card title="商户服务费率配置" key="set">
<Tabs defaultActiveKey={this.state.defaultType} onChange={this.onTabChange}>
{businessInfo.businessType.map((item, i) => (
<TabPane tab={item.name} key={item.key}>
<Row gutter={24}>
<Col span={12}>
<Form.Item label="商户编码">
<span>{businessInfo.id}</span>
</Form.Item>
<Form.Item label="商户类型" hidden>
{getFieldDecorator(`supplierRateDTOList[${i}]['businessType']`, {
initialValue: item.key,
})(<Input />)}
</Form.Item>
{/* <Form.Item label="供应商ID" hidden>
{getFieldDecorator(`supplierRateDTOList[${i}]['supplierId']`, {
initialValue: businessInfo.businessType[i].supplierId,
})(<Input />)}
</Form.Item>
<Form.Item label="费率ID" hidden>
{getFieldDecorator(`supplierRateDTOList[${i}]['id']`, {
initialValue: businessInfo.businessType[i].id,
})(<Input />)}
</Form.Item> */}
</Col>
<Col span={12}>
<Form.Item label="商户名称">
<span>{businessInfo.name}</span>
</Form.Item>
</Col>
<Col span={12}>
<Form.Item label="计费类型">
{getFieldDecorator(`supplierRateDTOList[${i}]['calculateType']`, {
initialValue: businessInfo.businessType[i].calculateType,
rules: [{ required: true, message: '请选择计费类型!' }],
})(
<Select
placeholder="请选择"
disabled={!!item.id}
onChange={e => this.onChangeCalculateType(e, i)}
>
<Option value={1}>单笔百分比</Option>
{/* <Option value={2}>单笔固定值</Option> */}
</Select>,
)}
</Form.Item>
</Col>
<Col span={12}>
<Form.Item label={this.state.calculateType[i] === 1 ? '百分比' : ''}>
{getFieldDecorator(`supplierRateDTOList[${i}]['calculateValue']`, {
initialValue: businessInfo.businessType[i].calculateValue,
rules: [
{ required: true, message: '请输入百分比!' },
// { min: 0, message: '最小0' },
// { max: 0.9999, message: '最大输入0.9999' },
{ validator: validNumber, message: '请输入0~0.9999之间的小数' },
],
})(
<Input
maxLength={6}
placeholder={
this.state.calculateType[i] === 1
? '0.1=10%,直接写小数形式即可'
: ''
}
/>,
)}
</Form.Item>
</Col>
<Col span={12}>
<Form.Item label="收取方式">
{getFieldDecorator(`supplierRateDTOList[${i}]['chargeMethod']`, {
initialValue: businessInfo.businessType[i].chargeMethod,
rules: [{ required: true, message: '请选择收取方式!' }],
})(
<Select placeholder="请选择" disabled={!!item.id}>
<Option value={1}>坐扣</Option>
</Select>,
)}
</Form.Item>
</Col>
<Col span={12}>
<Form.Item label="有效期">
{getFieldDecorator(`supplierRateDTOList[${i}]['ratedate']`, {
initialValue: businessInfo.businessType[i].ratedate,
rules: [{ required: true, message: '请选择有效期!' }],
})(
<RangePicker format="YYYY/MM/DD" disabledDate={this.disabledDate} />,
)}
</Form.Item>
</Col>
</Row>
</TabPane>
))}
</Tabs>
</Card>
),
]}
</Card>
)}
<div className={styles.formBtns}>
<Row gutter={24}>
<Col span={4}></Col>
<Col span={20}>
{!this.state.id || [infoTypeEdit, infoTypeChecked].includes(this.state.type) ? (
<Button
type="primary"
size="large"
htmlType="submit"
loading={this.state.loading}
>
保存
</Button>
) : (
''
)}
{type === infoTypeRevision && (
<Button
type="primary"
size="large"
onClick={this.onRevision}
loading={this.state.loading}
>
保存
</Button>
)}
<Col span={8}>
<Button type="primary" size="large" htmlType="submit" loading={this.state.loading}>
修改并提交
</Button>
</Col>
<Col span={12}>
<Button size="large" onClick={this.onCancel}>
取消
</Button>
......
......@@ -4,20 +4,20 @@ import config from '../../../config/env.config';
import qs from 'qs';
import { da } from 'date-fns/locale';
const { kdspApi } = config;
const { kdspApi, goodsApi } = config;
// 获取地址
export const apiAddrArea = params =>
request.post('/api/merchants/addresses/list', {
request.get(`/api/merchants/addresses/list?${qs.stringify(params)}`, {
prefix: kdspApi,
data: params,
emulateJSON: true,
});
// 主营类目
export const apiCategoryList = params =>
request.post('/product/category/list', { prefix: kdspApi, params });
export async function apiCategoryList(param) {
return request.post('/api/merchants/suppliers/main-category/list', {
data: param,
prefix: goodsApi,
});
}
// 服务设施
export const apiServiceFacility = () =>
request.get('/api/merchants/suppliers/facilities/list', { prefix: kdspApi });
......@@ -48,22 +48,14 @@ export async function uploadFile(files, imageType = 0) {
return data;
}
// 新增商家端入驻申请
export const apiNewStoreInfo = params =>
request.post(`${kdspApi}/api/merchants/suppliers/register`, { prefix: kdspApi, data: params });
// 图片内容识别
export const apiRecognize = params =>
request.get(`/api/merchants/images/recognize?${qs.stringify(params)}`, { prefix: kdspApi });
// 编辑商户信息
export const apiEditStoreInfo = params =>
request.post(`${kdspApi}/api/merchants/suppliers/pops/edit`, { prefix: kdspApi, data: params });
// 查询申请详情
export const apiApplyDetail = applyId =>
request.get(`${kdspApi}/api/merchants/suppliers/register/detail?applyId=${applyId}`);
request.post('/api/merchants/suppliers/edit', { prefix: kdspApi, data: params });
// 查询商户详情
export const apiBusinessDetail = businessId =>
request.get(`${kdspApi}/api/merchants/suppliers/pops/detail/${businessId}`);
request.get('/api/merchants/suppliers/pops/detail', { prefix: kdspApi });
......@@ -4,7 +4,7 @@ import moment from 'moment';
import { PlusSquareFilled, MinusSquareFilled } from '@ant-design/icons';
import { Modal, Input, TimePicker, Checkbox, Cascader, Radio, notification } from 'antd';
import { apiAddrArea, apiCreatStore, apiEditStore } from '../services';
import { weekOptions, weekDefault, layout } from '../data';
import { weekOptions, weekDefault, layout, businessModel } from '../data';
import MapModal from '@/components/GaoDeMap';
import style from './style.less';
import { isCheckNumberLine } from '@/utils/validator';
......@@ -19,6 +19,7 @@ const StoreModal = props => {
form: { getFieldDecorator, setFieldsValue, getFieldsValue, validateFields, resetFields },
formInfo,
status,
productBusiness,
} = props;
const [areaAddr, setAreaAddr] = useState([]);
const [visibleMap, setVisibleMap] = useState(false);
......@@ -29,12 +30,21 @@ const StoreModal = props => {
address: '',
});
const [disabled, setDisabled] = useState(false);
const [isDisabled, setIsDisabled] = useState(true);
const divDom = useRef();
useEffect(() => {
setDisabled(props.status);
}, [props.status]);
useEffect(() => {
if (props.productBusiness.length) {
const val = props.productBusiness.includes(2) || props.productBusiness.includes(3);
setIsDisabled(val);
}
}, [props.productBusiness]);
const handleCancel = isSuccess => {
resetFields();
onCancel(isSuccess);
......@@ -49,6 +59,10 @@ const StoreModal = props => {
params[areaArr[i]] = item;
});
}
if (params.shopHeadImage.length) {
// eslint-disable-next-line prefer-destructuring
params.shopHeadImage = params.shopHeadImage[0];
}
if (params.lnglat) {
const arr = params.lnglat.split(',');
if (arr.length === 2) {
......@@ -223,9 +237,11 @@ const StoreModal = props => {
}
info.lnglat = `${info.longitude},${info.latitude}`;
info.addr = [info.provinceId, info.cityId, info.countyId];
info.shopHeadImage = [info.shopHeadImage] || [];
if (info.townId) {
info.addr.push(info.townId);
}
console.log(info);
setTimes(harr);
setFormData(info);
getLazyAddr(info);
......@@ -242,21 +258,28 @@ const StoreModal = props => {
<Modal
title="门店信息"
visible={visible}
width="800px"
width="1000px"
destroyOnClose
maskClosable={false}
onOk={() => onSubmit()}
onCancel={() => handleCancel()}
>
<Form {...layout} name="formData">
<FormItem label="门店头像">
{getFieldDecorator('supplement', {
rules: [{ required: true, message: '请上传门店头像' }],
initialValue: formData.shopHeadImage || [],
valuePropName: 'fileList',
getValueFromEvent: normFile,
})(<Upload max={1} accept=".jpg,.png,.jpeg" disabled={disabled} />)}
<FormItem label="业务模式">
{getFieldDecorator('productBusiness', {
initialValue: productBusiness,
})(<Checkbox.Group disabled options={businessModel} />)}
</FormItem>
{isDisabled && (
<FormItem label="门店头像">
{getFieldDecorator('shopHeadImage', {
rules: [{ required: true, message: '请上传门店头像' }],
initialValue: formData.shopHeadImage || [],
valuePropName: 'fileList',
getValueFromEvent: normFile,
})(<Upload max={1} accept=".jpg,.png,.jpeg" disabled={disabled} />)}
</FormItem>
)}
<FormItem
label="门店名称"
name="name"
......@@ -366,11 +389,13 @@ const StoreModal = props => {
</Radio.Group>,
)}
</FormItem>
<FormItem label="门店公告">
{getFieldDecorator('publicNotice', {
initialValue: formData.publicNotice,
})(<Input placeholder="请输入门店公告" maxLength={120} disabled={disabled} />)}
</FormItem>
{isDisabled && (
<FormItem label="门店公告">
{getFieldDecorator('publicNotice', {
initialValue: formData.publicNotice,
})(<Input placeholder="请输入门店公告" maxLength={120} disabled={disabled} />)}
</FormItem>
)}
</Form>
<MapModal
visible={visibleMap}
......
......@@ -17,3 +17,10 @@ export const layout = {
labelCol: { span: 6 },
wrapperCol: { span: 16 },
};
// 业务模式
export const businessModel = [
{ label: '到家外卖业务(外卖配送业务)', value: 1 },
{ label: '实物商品业务员', value: 2 },
{ label: '到店业务(服务类业务)', value: 3 },
];
......@@ -13,7 +13,7 @@ import {
} from 'antd';
import _ from 'lodash';
import { el } from 'date-fns/locale';
import { searchList, apiEnableStore, apiAddrArea } from './services';
import { searchList, apiEnableStore, apiAddrArea, apiproductBusiness } from './services';
import { stateDesc, weeks, layout } from './data';
import StoreModal from './components/storeModal';
import style from './style.less';
......@@ -28,18 +28,26 @@ export default () => {
const [pageNo, setPageNo] = useState(1);
const [totalNum, setTotalNum] = useState(0);
const [pageSize, setPageSize] = useState(20);
const [productBusiness, setProductBusiness] = useState([]);
const refSearch = useRef();
const divDom = useRef();
// 获取业务模式
const getBusiness = async () => {
const res = await apiproductBusiness();
setProductBusiness(res);
};
const onCreate = () => {
setStoreInfo({});
setVisible(true);
getBusiness();
};
const onShowInfo = (info, val) => {
setStoreInfo(info);
const value = val !== 'edit';
console.log(value);
setStatus(value);
setVisible(true);
getBusiness();
};
// 获取市区街道
......@@ -115,6 +123,7 @@ export default () => {
if (isReload) {
onSearch(refSearch.current?.getFieldValue?.() || {});
}
setStatus(false);
setStoreInfo({});
setVisible(false);
};
......@@ -336,7 +345,13 @@ export default () => {
/>
</div>
) : null}
<StoreModal visible={visible} onCancel={closeModal} formInfo={storeInfo} status={status} />
<StoreModal
visible={visible}
onCancel={closeModal}
formInfo={storeInfo}
status={status}
productBusiness={productBusiness}
/>
</div>
);
};
......@@ -65,3 +65,11 @@ export async function apiEditStore(params) {
});
return data.businessCode;
}
// 获取商户业务模式
export async function apiproductBusiness() {
const data = await request.get('/api/merchants/suppliers/product-business/list', {
prefix: kdspApi,
});
return data.data;
}
......@@ -29,13 +29,14 @@ class PicturesWall extends React.Component {
token = await qiniuToken();
}
componentWillReceiveProps(nextProps) {
this.initFileList(nextProps.fileList || []);
static getDerivedStateFromProps(nextProps) {
new PicturesWall(nextProps).initFileList();
return null;
}
initFileList = fileList => {
const fileLists =
fileList.map((item, index) => ({
fileList?.map((item, index) => ({
url: item,
name: '',
uid: index,
......
import React, { useState, useRef } from 'react';
import ProTable from '@ant-design/pro-table';
import { PageHeaderWrapper } from '@ant-design/pro-layout';
import { notification, Button } from 'antd';
import { notification, Button, Modal, Image } from 'antd';
import { query } from './services';
const ContractView = () => {
const [visible, setVisible] = useState(false);
const url =
'https://contract-test.q-gp.com/621-621T18364B279E2null.pdf?Expires=1679994655&OSSAccessKeyId=LTAI5tGV1jdSEBjuKDUYZVHY&Signature=nVC2YgG8t5DWZl6sMyRmCzeRYLw%3D';
// 查看
const onLook = ({ contractPdfUrl }) => {
console.log(contractPdfUrl);
setVisible(true);
// window.open(url)
};
// 下载
const ondown = ({ contractPdfUrl }) => {
console.log(contractPdfUrl);
window.open(url);
};
const columns = [
{
......@@ -76,6 +80,9 @@ const ContractView = () => {
toolBarRender={false}
scroll={{ x: '100%', y: 400 }}
/>
<Modal visible={visible} width="1000px" onCancel={() => setVisible(false)}>
<iframe src={url} height="500" width="95%" title="合同"></iframe>
</Modal>
</PageHeaderWrapper>
);
};
......
......@@ -8,20 +8,20 @@ const { goodsApi } = config;
// 分页查询所有数据
export async function query(params) {
const param = {
pageNo: params.current || 1,
...params,
pageIndex: params.current,
pageSize: params.pageSize || 20,
};
const data = await request.post('/api/kdsp/template/page', {
const data = await request.post('/api/merchants/suppliers/contract/list', {
prefix: goodsApi,
data: stringify(_.omitBy(param, v => !v)),
data: param,
headers: {
'Content-Type': 'application/x-www-form-urlencoded',
'Content-Type': 'application/json;charset=UTF-8',
},
});
if (data.data) {
return {
total: data.data.total,
data: data.data.forbiddenAreaTemplateList,
data: data.data,
};
}
return {
......@@ -29,41 +29,3 @@ export async function query(params) {
data: [],
};
}
// 添加区域受限模板
export async function getAddTemplate(param) {
const data = await request.post('/api/kdsp/add/template', {
prefix: goodsApi,
data: param,
});
return data;
}
// 获取区域地址
export async function areaList(params) {
const { data } = await request.get('/api/merchants/addresses/list', {
prefix: goodsApi,
params,
headers: {
'Content-Type': 'application/x-www-form-urlencoded',
},
});
return data;
}
// 根据模板id查询受限区域
export async function forbiddenAddress(params) {
const data = await request.post('/api/kdsp/edit/template', {
prefix: goodsApi,
data: params,
});
return data;
}
// 根据模板id查询受限区域
export async function addressTree(params) {
const data = await request.post('/api/kdsp/forbidden/address', {
prefix: goodsApi,
params,
});
return data;
}
/* eslint-disable prefer-destructuring */
import { parse } from 'querystring';
import pathRegexp from 'path-to-regexp';
import moment from 'moment';
......@@ -131,6 +132,7 @@ export const getObjectType = v => Object.prototype.toString.call(v).replace(/\[o
// 获取长表单错误提示
export const getErrorMessage = err => {
const message = '请检查表单数据!';
// eslint-disable-next-line wrap-iife
// (function getMsg(v) {
// if (Array.isArray(v)) {
// getMsg(v[0]);
......
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