Commit 51ea4387 authored by 前端-许佳敏's avatar 前端-许佳敏
parents a061f0c4 d946d57e
import React, { useState } from 'react';
import { Button, Input, Form, Radio, message, Modal } from 'antd'
import React, { ReactNode, useState } from 'react';
import { Button, Input, Form, Radio, message, Modal, Upload, Row, Col, } from 'antd'
const { TextArea } = Input
import { PublicApi } from '@/services/api';
import { IAntdSchemaFormProps } from '@formily/antd'
import { UploadOutlined } from '@ant-design/icons';
export interface Iprops extends IAntdSchemaFormProps {
/* 显示隐藏 */
......@@ -17,6 +18,7 @@ export interface Iprops extends IAntdSchemaFormProps {
agreeText?: string,
/* 不同意 */
disagree?: string,
}
/* 合同审核组建 */
const Examine: React.FC<Iprops> = ({
......@@ -26,8 +28,10 @@ const Examine: React.FC<Iprops> = ({
type,
agreeText,
disagree,
}) => {
const [isPass, setIsAllMember] = useState(1)
const [state, setstate] = useState<any>(false);
/* 设置选中值 */
const handleIsAllMemberChange = (v: any) => {
setIsAllMember(v.target.value)
......@@ -121,6 +125,53 @@ const Examine: React.FC<Iprops> = ({
console.log('确认')
}
}
const uploadProps = {
name: 'file',
action: '/api/file/file/upload/prefix',
data: {
fileType: 1,
prefix: '',
},
onChange(info) {
if (info.file.response) {
const { code } = info.file.response;
console.log(code);
message.info('上传成功');
console.log(info.file)
setstate(true);
}
;
if (info.file.status !== 'uploading') {
}
if (info.file.status === 'done') {
} else if (info.file.status === 'error') {
message.error(`${info.file.name} 上传失败`);
}
},
beforeUpload(file) {
if (file.size / 1024 / 1024 > 20) {
message.warning('附件大小超过20M');
return Promise.reject();
}
},
}
const uploadNode = () => {
return (
<div>
<p style={{ paddingTop: 10, paddingBottom: 10, }}>纸质合同(乙方已盖章签字)</p>
<Row style={{ marginBottom: 30, }}>
<Col>
<Upload
{...uploadProps}
>
<Button icon={<UploadOutlined />}>上传附件</Button>
</Upload>
</Col>
</Row>
</div>
)
}
return (
<div>
<Modal footer={null} title="提交审核" visible={ExamineFlag} onCancel={() => fetchData('onCancel')}>
......@@ -131,6 +182,7 @@ const Examine: React.FC<Iprops> = ({
onFinish={onFinish}
onFinishFailed={onFinishFailed}
>
{type === 'Signacontract' ? uploadNode() : null}
<Form.Item name="isPass" label="" rules={[{ required: true, message: '请选择通过方式' }]} initialValue={isPass} >
<Radio.Group onChange={handleIsAllMemberChange}>
<Radio value={1}>{agreeText}</Radio>
......@@ -154,5 +206,6 @@ const Examine: React.FC<Iprops> = ({
Examine.defaultProps = {
agreeText: "通过",
disagree: "不通过",
uploadNode: null
}
export default Examine;
......@@ -126,7 +126,7 @@ const FormList = (props: any) => {
id: _filterArr(sourceType, item, ['', 'goodsId', 'categoryId', 'ids']),
},
brand: {
name: _filter(sourceType, item, ['', 'brand', 'categoryName', 'brand'])
name: _filter(sourceType, item, ['', 'brand', 'brandName', 'brand'])
}, // 品牌
unitName: _filter(sourceType, item, ['', 'unit', 'unitName', 'unitPrice']), //单位
purchaseCount: _filter(sourceType, item, ['', 'purchaseCount', 'count', 'purchaseCount']),// 数量
......
import { Table, } from 'antd';
import React, { useEffect, useState, useRef } from 'react';
import { PublicApi } from '@/services/api';
export interface Iprops extends IAntdSchemaFormProps {
contractId: any,
listIndex: any
}
const TableList: React.FC<Iprops> = ({ contractId, listIndex }) => {
const [index, setIndex] = useState(1)
/* 外部 */
const [ListData, setListData] = useState<any>([]) // 外部数据
const [page, setPage] = useState(1); // 当前页
const [size, setSize] = useState(10); // 页大小
const [total, setTotal] = useState(0); // 外部总条数
/* 内部 */
const [List, setList] = useState<any>([]); // 内部数据
const [innerpage, setinnerPage] = useState(1); // 当前页
const [innersize, setinnerSize] = useState(10); // 页大小
const [innertotal, setinnerTotal] = useState(0); // 内部总条数
const [listLoading, setListLoading] = useState(false);
/* 流转列表 */
const CirculationList: any = [
{ title: '序号', dataIndex: 'name', align: 'center', render: (_, record, index) => index + 1, },
{ title: '操作角色', dataIndex: 'roleName', align: 'center', },
{ title: '状态', dataIndex: 'statusName', align: 'center', },
{ title: '操作', dataIndex: 'operate', align: 'center', },
{ title: '操作时间', dataIndex: 'operateTime', align: 'center', },
{ title: '审核意见', dataIndex: 'opinion', align: 'center', },
]
/* 内部 */
const fetchDataListcolumns: any = [
{ title: '操作人', dataIndex: 'name', align: 'center', render: (_, record, index) => index + 1, },
{ title: '部门', dataIndex: 'department', align: 'center', },
{ title: '职位', dataIndex: 'jobTitle', align: 'center', },
{ title: '状态', dataIndex: 'statusName', align: 'center', },
{ title: '操作', dataIndex: 'operate', align: 'center', },
{ title: '操作时间', dataIndex: 'operateTime', align: 'center', },
{ title: '审核意见', dataIndex: 'opinion', align: 'center', },
]
/*分页 */
const handlePaginationChange = (current: number, pageSize: number) => {
let data = {
current,
pageSize
}
if (index === 1) {
PageOuterRecordList(data)
} else {
InnerRecordList(data);
}
};
/* 外部 */
const PageOuterRecordList = (data) => {
PublicApi.getContractManagePageOuterRecordList({
contractId,
...data
}).then(res => {
console.log(res);
if (res.code === 1000) {
setListData(res.data.data)
setTotal(res.data.totalCount)
}
}).catch(err => {
console.log(err)
})
}
/* 内部 */
const InnerRecordList = (innerData) => {
PublicApi.getContractManagePageInnerRecordList({
contractId,
...innerData
}).then(res => {
console.log(res);
if (res.code === 1000) {
setList(res.data.data)
setTotal(res.data.totalCount)
}
}).catch(err => {
console.log(err)
})
}
useEffect(() => {
setIndex(listIndex)
}, [listIndex])
useEffect(() => {
if (contractId) {
const data = {
pageSize: size,
current: page,
}
PageOuterRecordList(data)
const innerData = {
pageSize: innersize,
current: innerpage,
}
InnerRecordList(innerData);
}
}, [contractId])
return (
<>
{
index == 1 ?
<Table
columns={CirculationList}
rowKey='id'
loading={listLoading}
dataSource={ListData}
pagination={
{
pageSize: size,
total,
onChange: handlePaginationChange
}
}
style={{
width: "100%"
}}
/>
:
<Table
columns={fetchDataListcolumns}
rowKey='id'
loading={listLoading}
dataSource={List}
pagination={
{
pageSize: size,
total: innertotal,
onChange: handlePaginationChange
}
}
style={{
width: "100%"
}}
/>
}
</>
)
}
export default TableList
import React, { useEffect, useState, useRef } from 'react';
import { StandardTable } from 'god';
import { Anchor, Radio, Steps, Table, Space, Typography, Button } from 'antd';
import { Anchor, Radio, Steps, Table, Space, Typography, Button, message } from 'antd';
import style from './index.less';
import { ArrowLeftOutlined } from '@ant-design/icons';
import { history } from 'umi';
......@@ -8,6 +8,7 @@ import { PublicApi } from '@/services/api';
import ExamineFrom from '../../components/examine'
import Basic from '../../components/detailCard/basic'
import PaymentCard from '../../components/detailCard/PaymentCard'
import TableList from './components/TableList'
import {
FileWordFilled
} from '@ant-design/icons'
......@@ -43,6 +44,7 @@ const Details = (props: any) => {
* @param contractText 合同文档
*/
const [StepList, setStepList] = useState<any>([]);
const [outerTaskStepList, setouterTaskStepList] = useState<any>([])
const [innerTaskStepList, setinnerTaskStepList] = useState<any>([]);
const [currentBatch, setCurrentBatch] = useState('1');
......@@ -139,31 +141,10 @@ const Details = (props: any) => {
setStepList(StepList)
return;
} else {
setTimeout(() => {
setlistIndex(e.target.value)
}, 100);
setTimeout(() => {
ref.current.reload();
}, 300);
setlistIndex(e.target.value)
}
};
/* 流转记录内部 */
const fetchData = (params) => {
return new Promise((resolve, reject) => {
let fn;
fn = listIndex == '1' ? PublicApi.getContractManagePageOuterRecordList : PublicApi.getContractManagePageInnerRecordList;
fn({
...params,
contractId: contractId
}).then(res => {
console.log(res.data, listIndex)
resolve(res.data)
}).catch(err => {
console.log(err)
})
})
}
/*查询合同详情-分页查询合同采购物料*/
const columns: any = [
{
......@@ -304,25 +285,7 @@ const Details = (props: any) => {
</div>
)
/* 流转列表 */
const CirculationList: any = [
{ title: '序号', dataIndex: 'name', align: 'center', render: (_, record, index) => index + 1, },
{ title: '操作角色', dataIndex: 'roleName', align: 'center', },
{ title: '状态', dataIndex: 'statusName', align: 'center', },
{ title: '操作', dataIndex: 'operate', align: 'center', },
{ title: '操作时间', dataIndex: 'operateTime', align: 'center', },
{ title: '审核意见', dataIndex: 'opinion', align: 'center', },
]
/* 内部 */
const fetchDataListcolumns: any = [
{ title: '操作人', dataIndex: 'name', align: 'center', render: (_, record, index) => index + 1, },
{ title: '部门', dataIndex: 'department', align: 'center', },
{ title: '职位', dataIndex: 'jobTitle', align: 'center', },
{ title: '状态', dataIndex: 'statusName', align: 'center', },
{ title: '操作', dataIndex: 'operate', align: 'center', },
{ title: '操作时间', dataIndex: 'operateTime', align: 'center', },
{ title: '审核意见', dataIndex: 'opinion', align: 'center', },
]
/* 提交审核的回调 */
const getfetchData = (data) => {
console.log(data)
......@@ -345,8 +308,8 @@ const Details = (props: any) => {
} else {
setIsModalVisible(!Visible)
}
}
return (
<div className={style.anchorWrap}>
<Anchor
......@@ -497,14 +460,7 @@ const Details = (props: any) => {
</div>
</div>
<div className='ant-card-body'>
<StandardTable
tableProps={{
rowKey: 'id',
}}
currentRef={ref}
columns={listIndex === '1' ? CirculationList : fetchDataListcolumns}
fetchTableData={(params: any) => fetchData(params)}
/>
<TableList contractId={contractId} listIndex={listIndex} />
</div>
</div>
</div>
......
......@@ -8,3 +8,6 @@ export const BidDetailContext = createContext<any>({})
/**采购竞价单详情 Context */
export const PurchaseBidContext = createContext<any>({})
/** 营销活动 */
export const EditableContext = createContext(null);
......@@ -61,7 +61,10 @@ const AddedFormLayout: React.FC<AddedFormLayoutProps> = (props: any) => {
otherRequire: res.otherRequire,
enclosureUrls: res.enclosureUrls,
inquiryListProductRequests: res.inquiryListProductRequests,
contacts: res.contacts,
contactsPhone: res.contactsPhone,
phoneCode: res.phoneCode,
shopId: res.shopId,
}
id && (params.id = id);
fetchRequest({ ...params }).then(res => {
......@@ -131,6 +134,14 @@ const AddedFormLayout: React.FC<AddedFormLayoutProps> = (props: any) => {
})
}
const getContacts = (value) => {
form.setFieldsValue({
"contacts": value.name,
'contactsPhone': value.phone,
'phoneCode': 86,
});
}
const init = async () => {
if (isEdit && spam) {
// const data: any = JSON.parse(sessionStorage.getItem(spam));
......@@ -148,7 +159,8 @@ const AddedFormLayout: React.FC<AddedFormLayoutProps> = (props: any) => {
purchaseCount: 1,
logistics: data.logistics,
memberId: data.memberId,
memberRoleId: data.memberRoleId
memberRoleId: data.memberRoleId,
taxRate: data.taxRate,
})
setMenberInfo({
memberId: data.memberId,
......@@ -228,7 +240,7 @@ const AddedFormLayout: React.FC<AddedFormLayoutProps> = (props: any) => {
>
<BasicInfoLatyout getMemberInfo={getMemberInfo} memb={memberInfo} isEdit={spam} />
<InquiryProductLayout getInquiryProduct={getInquiryProduct} member={memberInfo} setInquiryProduct={inquiryProduct} />
<TradeTermsLayout getFullAddress={getFullAddress} />
<TradeTermsLayout getFullAddress={getFullAddress} getContacts={getContacts} />
<AttachLayout enclosureUrls={enclosureUrls} getEnclosureUrls={getEnclosureUrls} removeEnclosureUrls={removeEnclosureUrls} />
</Form>
}
......
import React, { useCallback, useEffect, useState } from 'react';
import { Row, Col, Form, Input, Button } from 'antd';
import { Row, Col, Form, Input, Button, Select } from 'antd';
import { GlobalConfig } from '@/global/config'
import { LinkOutlined } from '@ant-design/icons';
import Card from '@/pages/transaction/components/card';
import TableModal from '@/pages/transaction/components/TableModal';
......@@ -23,6 +24,7 @@ const BasicInfoLayout: React.FC<BasicInfoLayoutProps> = (props: any) => {
const { getMemberInfo, memb, isEdit } = props;
const [visible, setVisible] = useState<boolean>(false);
const [member, setMember] = useState<any>({})
const [storeList, setStoreList] = useState<Array<any>>([]);
const columns: any = [
{
......@@ -52,6 +54,14 @@ const BasicInfoLayout: React.FC<BasicInfoLayoutProps> = (props: any) => {
}
]
useEffect(() => {
let shopList = GlobalConfig.web.shopInfo.filter(v => (v.type == 1 && v.environment == 1)).map(
v => v
)
console.log(shopList, 962039)
setStoreList(shopList)
}, [])
const handleFetchData = useCallback((params: any) => {
return new Promise(resolve => {
PublicApi.getMemberManagePlatformProviderPage({ ...params }).then(res => {
......@@ -99,6 +109,13 @@ const BasicInfoLayout: React.FC<BasicInfoLayoutProps> = (props: any) => {
<Form.Item label="询价单摘要" name="details" rules={[{ required: true, message: '请输入询价单摘要' }]}>
<Input maxLength={30} placeholder="最长60字符,30个汉字" />
</Form.Item>
<Form.Item label="询价商城" name="shopId" rules={[{ required: true, message: '请选择询价商城' }]}>
<Select>
{storeList.map(item => (
<Select.Option key={item.id} value={item.id}>{item.name}</Select.Option>
))}
</Select>
</Form.Item>
</Col>
<Col span={12} className={style.searchColor}>
<Form.Item label="被询价会员" name='memberName' rules={[{ required: true, message: '请选择被询价会员' }]}>
......
......@@ -141,7 +141,8 @@ const InquiryProductLayout: React.FC<InquiryProductLayoutProps> = (props: any) =
logistics: v.logistics,
memberId: v.memberId,
memberRoleId: v.memberRoleId,
imgUrl: v.mainPic
imgUrl: v.mainPic,
taxRate: v.taxRate,
})
})
resolve({
......
import React, { useEffect, useState } from 'react';
import React, { useCallback, useEffect, useState } from 'react';
import { Row, Col, Form, Input, DatePicker, Select, Button, Space } from 'antd';
import Card from '@/pages/transaction/components/card';
import moment from 'moment';
import { PublicApi } from '@/services/api';
import { isEmpty } from 'lodash';
import { LinkOutlined } from '@ant-design/icons';
import TableModal from '@/pages/transaction/components/TableModal';
import { FORM_FILTER_PATH } from '@/formSchema/const';
import { useStateFilterSearchLinkageEffect } from '@/formSchema/effects/useFilterSearch';
const disabledDate = (current) => {
return current && current < moment().startOf('day');
......@@ -13,11 +16,14 @@ const disabledDate = (current) => {
interface TradeTermsLayoutProps {
/** 获取地址详情 */
getFullAddress?: (e) => void,
/** 获取联系人 */
getContacts?: (e) => void,
}
const TradeTermsLayout: React.FC<TradeTermsLayoutProps> = (props: any) => {
const { getFullAddress } = props;
const { getFullAddress, getContacts } = props;
const [fullAddress, setFullAddress] = useState<any[]>([]);
const [visible, setVisible] = useState<boolean>(false)
useEffect(() => {
PublicApi.getLogisticsSelectListReceiverAddress().then(res => {
......@@ -34,6 +40,52 @@ const TradeTermsLayout: React.FC<TradeTermsLayoutProps> = (props: any) => {
getFullAddress(option)
}
const handleFetchData = useCallback((params: any) => {
return new Promise(resolve => {
PublicApi.getMemberManageUsersPage({ ...params }).then(res => {
if (res.code !== 1000) {
return
}
resolve(res.data)
}).catch(error => {
console.warn(error)
})
})
}, [])
const toggle = (flag: boolean) => {
setVisible(flag)
}
const columns: any = [
{
title: '序号',
dataIndex: 'userId',
key: 'userId',
},
{
title: '用户姓名',
dataIndex: 'name',
key: 'name',
},
{
title: '手机号',
dataIndex: 'phone',
key: 'phone',
},
{
title: '所属机构',
dataIndex: 'orgName',
key: 'orgName',
},
]
const handleConfirm = (selectRowKeys: string[] | number[], selectRowRecord: any) => {
const target = selectRowRecord[0];
getContacts(target)
toggle(false)
}
return (
<Card
id="tradeTermsLayout"
......@@ -76,7 +128,7 @@ const TradeTermsLayout: React.FC<TradeTermsLayoutProps> = (props: any) => {
name='contacts'
rules={[{ required: true, message: '请选择询价联系人' }]}
>
<Input.Search readOnly enterButton={<Button style={{ height: '31.19px' }} icon={<LinkOutlined />}>选择</Button>} />
<Input.Search onSearch={() => toggle(true)} readOnly enterButton={<Button style={{ height: '31.19px' }} icon={<LinkOutlined />}>选择</Button>} />
</Form.Item>
<Form.Item
label='联系人电话'
......@@ -126,6 +178,88 @@ const TradeTermsLayout: React.FC<TradeTermsLayoutProps> = (props: any) => {
</Form.Item>
</Col>
</Row>
<TableModal
modalType="Drawer"
visible={visible}
title="选择用户"
mode="radio"
tableProps={{
rowKey: 'userId',
}}
customKey="userId"
fetchData={handleFetchData}
onClose={() => toggle(false)}
onOk={handleConfirm}
columns={columns}
effects={($, actions) => {
actions.reset()
useStateFilterSearchLinkageEffect($, actions, "name", FORM_FILTER_PATH)
}}
schema={{
type: 'object',
properties: {
megalayout: {
type: 'object',
"x-component": 'mega-layout',
properties: {
name: {
type: 'string',
"x-component": "Search",
"x-mega-props": {
},
"x-component-props": {
placeholder: '用户姓名',
align: 'flex-left',
}
}
}
},
[FORM_FILTER_PATH]: {
type: 'object',
"x-component": "flex-layout",
"x-component-props": {
rowStyle: {
justifyContent: 'flex-start',
flexWrap: 'nowrap'
},
colStyle: {//改变间隔
marginRight: 20
}
},
properties: {
PRO_LAYOUT: {
type: 'object',
"x-component": 'mega-layout',
"x-mega-props": {
span: 5
},
"x-component-props": {
inline: true
},
properties: {
orgName: {
type: 'string',
"x-component-props": {
placeholder: '所属机构'
}
},
}
},
sumbit: {
"x-component": 'Submit',
"x-mega-props": {
span: 1
},
"x-component-props": {
children: '查询'
}
}
}
}
}
}}
/>
</Card>
)
}
......
......@@ -46,7 +46,8 @@ const ActivityUserLayout: React.FC<ActivityUserLayoutProps> = (props: any) => {
<h5 className={style.label}>适用用户: </h5>
<h5 className={style.content}>
<Space>
<div className={style.selector}>新用户</div>
{data.newMember && <div className={style.selector}>新会员(平台会员)</div>}
{data.oldMember && <div className={style.selector}>老会员(平台会员)</div>}
</Space>
</h5>
</div>
......@@ -54,8 +55,8 @@ const ActivityUserLayout: React.FC<ActivityUserLayoutProps> = (props: any) => {
<h5 className={style.label}>适用用户角色: </h5>
<h5 className={style.content}>
<Space>
<div className={style.selector}>会员用户</div>
<div className={style.selector}>普通用户</div>
{data.enterpriseMember && <div className={style.selector}>企业会员</div>}
{data.personalMember && <div className={style.selector}>个人会员</div>}
</Space>
</h5>
</div>
......
......@@ -107,6 +107,7 @@ export const Columns = (int) => {
</Tooltip>,
key: 'plummetPrice',
dataIndex: 'plummetPrice',
render: (text) => `¥${Number(text).toFixed(2)}`
},
{
title: '活动价格',
......@@ -173,7 +174,8 @@ export const Columns = (int) => {
{
title: '活动价格',
key: 'activityPrice',
dataIndex: 'activityPrice'
dataIndex: 'activityPrice',
render: (text) => `¥${Number(text).toFixed(2)}`
},
{
title: '个人限购数量',
......@@ -185,11 +187,6 @@ export const Columns = (int) => {
key: 'restrictTotalNum',
dataIndex: 'restrictTotalNum'
},
{
title: '操作',
key: '',
dataIndex: ''
},
]
case 4:
case 5:
......@@ -234,7 +231,8 @@ export const Columns = (int) => {
{
title: '商品价格',
key: 'price',
dataIndex: 'price'
dataIndex: 'price',
render: (text) => `¥${Number(text).toFixed(2)}`
},
{
title: '个人限购数量',
......@@ -246,11 +244,6 @@ export const Columns = (int) => {
key: 'restrictTotalNum',
dataIndex: 'restrictTotalNum'
},
{
title: '操作',
key: '',
dataIndex: ''
},
]
case 9:
return [
......@@ -288,12 +281,14 @@ export const Columns = (int) => {
{
title: '商品价格',
key: 'price',
dataIndex: 'price'
dataIndex: 'price',
render: (text) => `¥${Number(text).toFixed(2)}`
},
{
title: '团购价格',
key: 'activityPrice',
dataIndex: 'activityPrice'
dataIndex: 'activityPrice',
render: (text) => `¥${Number(text).toFixed(2)}`
},
{
title: '个人限购数量',
......@@ -305,11 +300,6 @@ export const Columns = (int) => {
key: 'restrictTotalNum',
dataIndex: 'restrictTotalNum'
},
{
title: '操作',
key: '',
dataIndex: ''
},
]
case 11:
return [
......@@ -347,7 +337,8 @@ export const Columns = (int) => {
{
title: '商品价格',
key: 'price',
dataIndex: 'price'
dataIndex: 'price',
render: (text) => `¥${Number(text).toFixed(2)}`
},
{
title: <Tooltip placement="top" title="第一个用户帮砍价时的起始价格">
......@@ -355,6 +346,7 @@ export const Columns = (int) => {
</Tooltip>,
key: 'plummetPrice',
dataIndex: 'plummetPrice',
render: (text) => `¥${Number(text).toFixed(2)}`
},
{
title: <Tooltip placement="top" title="砍价过程中最后一次砍价不能超过砍价底价">
......@@ -362,6 +354,7 @@ export const Columns = (int) => {
</Tooltip>,
key: 'activityPrice',
dataIndex: 'activityPrice',
render: (text) => `¥${Number(text).toFixed(2)}`
},
{
title: '个人限购数量',
......@@ -410,14 +403,16 @@ export const Columns = (int) => {
{
title: '商品价格',
key: 'price',
dataIndex: 'price'
dataIndex: 'price',
render: (text) => `¥${Number(text).toFixed(2)}`
},
{
title: <Tooltip placement="top" title="秒杀价格表示在秒杀时间段内商城直接以该商品的秒杀价格进行销售">
秒杀价格 <QuestionCircleOutlined />
</Tooltip>,
key: 'activityPrice',
dataIndex: 'activityPrice'
dataIndex: 'activityPrice',
render: (text) => `¥${Number(text).toFixed(2)}`
},
{
title: '个人限购数量',
......@@ -429,11 +424,6 @@ export const Columns = (int) => {
key: 'restrictTotalNum',
dataIndex: 'restrictTotalNum'
},
{
title: '操作',
key: '',
dataIndex: ''
},
]
case 14:
return [
......@@ -471,22 +461,26 @@ export const Columns = (int) => {
{
title: '商品价格',
key: 'price',
dataIndex: 'price'
dataIndex: 'price',
render: (text) => `¥${Number(text).toFixed(2)}`
},
{
title: '预售价格',
key: 'activityPrice',
dataIndex: 'activityPrice'
dataIndex: 'activityPrice',
render: (text) => `¥${Number(text).toFixed(2)}`
},
{
title: '单位定金',
key: 'activityPrice',
dataIndex: 'activityPrice'
dataIndex: 'activityPrice',
render: (text) => `¥${Number(text).toFixed(2)}`
},
{
title: '定金抵扣单价',
key: 'activityPrice',
dataIndex: 'activityPrice'
dataIndex: 'activityPrice',
render: (text) => `¥${Number(text).toFixed(2)}`
},
{
title: '个人限购数量',
......@@ -498,11 +492,6 @@ export const Columns = (int) => {
key: 'restrictTotalNum',
dataIndex: 'restrictTotalNum'
},
{
title: '操作',
key: '',
dataIndex: ''
},
]
}
}
......
import React from 'react';
import React, { useState, useRef } from 'react';
import TableLayout from '../../../components/TableLayout';
import { FORM_FILTER_PATH } from '@/formSchema/const';
import { ColumnType } from 'antd/lib/table/interface';
import StatusTag from '@/components/StatusTag';
import { Button, Space } from 'antd';
import { Button, Space, Popconfirm } from 'antd';
import { format } from '@/pages/transaction/common/dateFormat';
import { useLinkageUtils } from '@/utils/formEffectUtils';
import { FormEffectHooks } from '@formily/antd';
......@@ -13,6 +13,27 @@ import EyePreview from '@/components/EyePreview';
const { onFormMount$ } = FormEffectHooks;
const ReadySubmit = () => {
const ref = useRef<any>({});
const [rowkeys, setRowKeys] = useState<Array<number>>([]);
const [confirmLoading, setConfirmLoading] = useState<boolean>(false)
/** 批量审核 */
const fetchSubmitBatch = async (id?: number) => {
let res = null;
if (id) {
res = await PublicApi.postMarketingPlatformActivitySignupSubmitSignUp({ id });
} else {
res = await PublicApi.postPurchaseQuotedPriceSubmitBatch({ ids: rowkeys });
}
setConfirmLoading(true)
if (res.code !== 1000) {
setConfirmLoading(false)
return
}
setConfirmLoading(false)
ref.current.reload();
setRowKeys([])
}
const columns: ColumnType<any>[] = [
{
title: '活动ID',
......@@ -23,7 +44,7 @@ const ReadySubmit = () => {
title: '活动名称',
key: 'activityName',
dataIndex: 'activityName',
render: (text) => <EyePreview>{text}</EyePreview>
render: (text, record) => <EyePreview url={`/memberCenter/marketingAbility/paltformSign/readySubmit/preview?activityId=${record.activityId}&signUpId=${record.id}`}>{text}</EyePreview>
},
{
title: '活动类型',
......@@ -75,24 +96,13 @@ const ReadySubmit = () => {
title: '操作',
key: 'state',
dataIndex: 'state',
render: (text, record) => (
<>
<Button type='link'>提交审核</Button>
<Button type='link'>填写报名资料</Button>
</>
)
render: (text, record) => <Popconfirm title="确定要提交吗?" okButtonProps={{ loading: confirmLoading }} disabled={!record.id} okText="是" cancelText="否" onConfirm={() => fetchSubmitBatch(record.id)}>
<Button type='link' disabled={!record.id}>
提交
</Button>
</Popconfirm>
},
]
/* 多选返回的 */
const fetchRowkeys = (row) => {
console.log(row);
}
/* 操作按钮 */
const controllerBtns = (
<Space>
<Button type="ghost">批量提交审核</Button>
</Space>
)
const useStateEffects = () => {
const linkage = useLinkageUtils();
......@@ -109,42 +119,66 @@ const ReadySubmit = () => {
return (
<TableLayout
reload={ref}
columns={columns}
effects="id"
fetch={PublicApi.getMarketingPlatformActivitySignupPageTobeSubmitSignUp}
selectedRow={true}
fetchRowkeys={fetchRowkeys}
controllerBtns={controllerBtns}
fetchRowkeys={(e) => setRowKeys(e)}
controllerBtns={
<Space>
<Button
loading={confirmLoading}
disabled={rowkeys.length === 0}
onClick={() => fetchSubmitBatch()}
>
批量提交
</Button>
</Space>
}
schema={{
type: 'object',
type: "object",
properties: {
mageLayout: {
type: 'object',
'x-component': 'Mega-Layout',
megalayout: {
type: "object",
"x-component": "mega-layout",
"x-component-props": {
grid: true
},
properties: {
topLayout: {
type: 'object',
'x-component': 'Mega-Layout',
ctl: {
type: "object",
"x-component": "controllerBtns",
},
id: {
type: 'string',
'x-component': 'Search',
'x-component-props': {
grid: true,
},
properties: {
id: {
type: 'string',
'x-component': 'Search',
'x-component-props': {
placeholder: '活动ID',
},
},
placeholder: '活动ID',
},
},
[FORM_FILTER_PATH]: {
type: 'object',
'x-component': 'Flex-Layout',
'x-component-props': {
colStyle: {
marginLeft: 20,
},
}
},
[FORM_FILTER_PATH]: {
type: "object",
"x-component": "flex-layout",
"x-component-props": {
rowStyle: {
flexWrap: "nowrap"
},
colStyle: {
marginLeft: 20
}
},
properties: {
PRO_LAYOUT: {
type: "object",
"x-component": "mega-layout",
"x-mega-props": {
span: 5
},
"x-component-props": {
inline: true
},
properties: {
activityName: {
......@@ -176,20 +210,20 @@ const ReadySubmit = () => {
},
enum: [],
},
submit: {
'x-component': 'Submit',
'x-mega-props': {
span: 1,
},
'x-component-props': {
children: '查询',
},
},
},
}
},
},
},
},
sumbit: {
"x-component": "Submit",
"x-mega-props": {
span: 1
},
"x-component-props": {
children: "查询"
}
}
}
}
}
}}
useStateEffects={useStateEffects}
/>
......
......@@ -121,7 +121,7 @@ export const Columns = (int) => {
title: '活动价格',
key: 'activityPrice',
dataIndex: 'activityPrice',
render: (text) => `¥${Number(text).toFixed(2)}`
render: (text) => text ? `¥${Number(text).toFixed(2)}` : `¥0`
},
{
title: '个人限购数量',
......@@ -178,7 +178,8 @@ export const Columns = (int) => {
{
title: '商品价格',
key: 'price',
dataIndex: 'price'
dataIndex: 'price',
render: (text) => `¥${Number(text).toFixed(2)}`
},
{
title: <Tooltip placement="top" title="折扣为商品价格的折扣,输入数字,如85折,输入85,9折输入90">
......@@ -190,22 +191,26 @@ export const Columns = (int) => {
{
title: '活动价格',
key: 'activityPrice',
dataIndex: 'activityPrice'
dataIndex: 'activityPrice',
render: (text) => text ? `¥${Number(text).toFixed(2)}` : `¥0`
},
{
title: '个人限购数量',
key: 'restrictNum',
dataIndex: 'restrictNum'
dataIndex: 'restrictNum',
editable: true,
},
{
title: '活动限购总数量',
key: 'restrictTotalNum',
dataIndex: 'restrictTotalNum'
dataIndex: 'restrictTotalNum',
editable: true,
},
{
title: '操作',
key: '',
dataIndex: ''
key: 'operation',
dataIndex: 'operation',
operation: true,
},
]
case 4:
......@@ -251,22 +256,26 @@ export const Columns = (int) => {
{
title: '商品价格',
key: 'price',
dataIndex: 'price'
dataIndex: 'price',
render: (text) => `¥${Number(text).toFixed(2)}`
},
{
title: '个人限购数量',
key: 'restrictNum',
dataIndex: 'restrictNum'
dataIndex: 'restrictNum',
editable: true,
},
{
title: '活动限购总数量',
key: 'restrictTotalNum',
dataIndex: 'restrictTotalNum'
dataIndex: 'restrictTotalNum',
editable: true,
},
{
title: '操作',
key: '',
dataIndex: ''
key: 'operation',
dataIndex: 'operation',
operation: true,
},
]
case 9:
......@@ -305,7 +314,8 @@ export const Columns = (int) => {
{
title: '商品价格',
key: 'price',
dataIndex: 'price'
dataIndex: 'price',
render: (text) => `¥${Number(text).toFixed(2)}`
},
{
title: '团购价格',
......@@ -315,12 +325,14 @@ export const Columns = (int) => {
{
title: '个人限购数量',
key: 'restrictNum',
dataIndex: 'restrictNum'
dataIndex: 'restrictNum',
editable: true,
},
{
title: '活动限购总数量',
key: 'restrictTotalNum',
dataIndex: 'restrictTotalNum'
dataIndex: 'restrictTotalNum',
editable: true,
},
{
title: '操作',
......@@ -364,7 +376,8 @@ export const Columns = (int) => {
{
title: '商品价格',
key: 'price',
dataIndex: 'price'
dataIndex: 'price',
render: (text) => `¥${Number(text).toFixed(2)}`
},
{
title: <Tooltip placement="top" title="第一个用户帮砍价时的起始价格">
......@@ -437,7 +450,8 @@ export const Columns = (int) => {
{
title: '商品价格',
key: 'price',
dataIndex: 'price'
dataIndex: 'price',
render: (text) => `¥${Number(text).toFixed(2)}`
},
{
title: <Tooltip placement="top" title="秒杀价格表示在秒杀时间段内商城直接以该商品的秒杀价格进行销售">
......@@ -449,12 +463,14 @@ export const Columns = (int) => {
{
title: '个人限购数量',
key: 'restrictNum',
dataIndex: 'restrictNum'
dataIndex: 'restrictNum',
editable: true,
},
{
title: '活动限购总数量',
key: 'restrictTotalNum',
dataIndex: 'restrictTotalNum'
dataIndex: 'restrictTotalNum',
editable: true,
},
{
title: '操作',
......@@ -498,7 +514,8 @@ export const Columns = (int) => {
{
title: '商品价格',
key: 'price',
dataIndex: 'price'
dataIndex: 'price',
render: (text) => `¥${Number(text).toFixed(2)}`
},
{
title: '预售价格',
......@@ -518,12 +535,14 @@ export const Columns = (int) => {
{
title: '个人限购数量',
key: 'restrictNum',
dataIndex: 'restrictNum'
dataIndex: 'restrictNum',
editable: true,
},
{
title: '活动限购总数量',
key: 'restrictTotalNum',
dataIndex: 'restrictTotalNum'
dataIndex: 'restrictTotalNum',
editable: true,
},
{
title: '操作',
......
import React, { useContext } from 'react';
import { Input, Form, Popconfirm } from 'antd';
import { EditableContext } from '@/pages/transaction/components/detailLayout/components/context';
const EditableCell = ({
title,
operation,
editable,
children,
dataIndex,
record,
activities,
handleSave,
handleDelete,
sumTotal,
...restProps
}) => {
const form = useContext(EditableContext);
let childNode = children;
const save = async () => {
try {
const values = await form.validateFields();
handleSave({ ...record, ...values });
} catch (errInfo) { }
}
const rate = async () => {
try {
const values = await form.getFieldValue(dataIndex);
if (activities && Number(activities) !== 11) {
record.activityPrice = sumTotal(record.price, values)
}
handleSave({ ...record, ...values });
} catch (errInfo) { }
}
/** 编辑按钮 */
if (editable) {
switch (dataIndex) {
case 'activityPrice':
case 'plummetPrice':
childNode = (
<Form.Item
style={{
margin: 0,
}}
name={dataIndex}
initialValue={record[dataIndex]}
rules={[
{
required: true,
validator: async (_rule, value) => {
const pattern = /^(\-)?\d+(\.\d{1,4})?$/;
const plummetPrice = await form.getFieldValue('plummetPrice');
if (!value) {
return Promise.reject(new Error('必填项'));
}
if ((Number(activities) === 11 && dataIndex === 'activityPrice') && (!pattern.test(value) || (Number(value) >= Number(plummetPrice)))) {
console.log((Number(activities) === 11 && dataIndex === 'activityPrice'), !pattern.test(value) || (Number(value) >= Number(plummetPrice)), 10086)
return Promise.reject(new Error('必须大于0且小于起始价格'));
}
if (!pattern.test(value) || (Number(value) >= Number(record.price))) {
return Promise.reject(new Error('必须大于0且小于商品价格'));
}
return Promise.resolve();
},
},
]}
>
<Input style={{ width: '112px' }} addonBefore="¥" onPressEnter={rate} onBlur={rate} />
</Form.Item>
)
break;
case 'restrictNum':
childNode = (
<Form.Item
style={{
margin: 0,
}}
name={dataIndex}
initialValue={record[dataIndex]}
rules={[
{
required: true,
validator: async (_rule, value) => {
const pattern = /^(\-)?\d+(\.\d{1,3})?$/;
const restrictTotalNum = await form.getFieldValue('restrictTotalNum');
if (!value) {
return Promise.reject(new Error('必填项'));
}
if (!pattern.test(value) || !(Number(value) <= Number(restrictTotalNum))) {
return Promise.reject(new Error('个人限购数量必须大于0且小于活动限购总数量'));
}
return Promise.resolve();
},
},
]}
>
<Input style={{ width: '112px' }} onPressEnter={save} onBlur={save} />
</Form.Item>
)
break;
case 'restrictTotalNum':
childNode = (
<Form.Item
style={{
margin: 0,
}}
name={dataIndex}
initialValue={record[dataIndex]}
rules={[
{
required: true,
validator: (_rule, value) => {
const pattern = /^(\-)?\d+(\.\d{1,3})?$/;
if (!value) {
return Promise.reject(new Error('必填项'));
}
if (!pattern.test(value)) {
return Promise.reject(new Error('活动限购总数量必须大于0'));
}
return Promise.resolve();
},
},
]}
>
<Input style={{ width: '112px' }} onPressEnter={save} onBlur={save} />
</Form.Item>
)
break;
}
}
/** 操作按钮 */
if (operation) {
childNode = (
<Popconfirm
title="是否删除?"
onConfirm={() => handleDelete(record.productId)}
>
<a>删除</a>
</Popconfirm>
)
}
return <td {...restProps}>{childNode}</td>;
}
export default EditableCell
import React, { useState, useMemo, useEffect, useContext, useCallback } from 'react';
import { Table, Form, Input, Popconfirm, Button } from 'antd';
import React, { useState, useMemo, useEffect, useCallback } from 'react';
import { Table, Form, Button } from 'antd';
import Card from '@/pages/transaction/components/card';
import { Columns } from '../columns';
import EditableCell from './EditableCell';
import { isEmpty } from 'lodash';
import { ColumnType } from 'antd/lib/table';
import TableModal from '@/pages/transaction/components/TableModal';
......@@ -9,7 +10,7 @@ import { PublicApi } from '@/services/api';
import { useStateFilterSearchLinkageEffect } from '@/formSchema/effects/useFilterSearch';
import { FORM_FILTER_PATH } from '@/formSchema/const';
import { PlusOutlined } from '@ant-design/icons';
const EditableContext = React.createContext(null);
import { EditableContext } from '@/pages/transaction/components/detailLayout/components/context';
/** 表格头 */
const EditableRow = ({ index, ...props }) => {
......@@ -22,65 +23,6 @@ const EditableRow = ({ index, ...props }) => {
</Form>
);
};
/** 表格内容 */
const EditableCell = ({
title,
operation,
editable,
children,
dataIndex,
record,
handleSave,
handleDelete,
sumTotal,
...restProps
}) => {
const form = useContext(EditableContext);
const save = async () => {
try {
const values = await form.validateFields();
record.activityPrice = sumTotal(record.price, values.plummetPrice)
handleSave({ ...record, ...values });
} catch (errInfo) {}
};
let childNode = children;
if (editable) {
childNode = (
<Form.Item
style={{
margin: 0,
}}
name={dataIndex}
initialValue={record[dataIndex]}
rules={[
{
required: true,
message: `${title}是必填项`,
},
]}
>
<Input style={{ width: '112px' }} onPressEnter={save} onBlur={save} />
</Form.Item>
)
}
if (operation) {
childNode = (
<Popconfirm
title="是否删除?"
onConfirm={() => handleDelete(record.productId)}
>
<a>删除</a>
</Popconfirm>
)
}
return <td {...restProps}>{childNode}</td>;
};
interface ProductListLayoutProps {
/** 详情数据 */
data?: any,
......@@ -151,12 +93,12 @@ const ProductListLayout: React.FC<ProductListLayoutProps> = (props: any) => {
key: 'status',
dataIndex: 'status',
render: (text) => <>
{ Number(text) === 1 && '待提交审核'}
{ Number(text) === 2 && '待审核'}
{ Number(text) === 3 && '审核不通过'}
{ Number(text) === 4 && '审核通过'}
{ Number(text) === 5 && '上架'}
{ Number(text) === 6 && '下架'}
{Number(text) === 1 && '待提交审核'}
{Number(text) === 2 && '待审核'}
{Number(text) === 3 && '审核不通过'}
{Number(text) === 4 && '审核通过'}
{Number(text) === 5 && '上架'}
{Number(text) === 6 && '下架'}
</>
},
]
......@@ -196,7 +138,6 @@ const ProductListLayout: React.FC<ProductListLayoutProps> = (props: any) => {
const handleOk = (selectRowKeys: string[] | number[], selectRowRecord: any) => {
const rowRecord: any[] = [...selectRowRecord]
console.log(rowRecord, 10086)
const productList = rowRecord.map(item => {
return {
id: item.id,
......@@ -207,7 +148,7 @@ const ProductListLayout: React.FC<ProductListLayoutProps> = (props: any) => {
brand: item.brand,
unit: item.unit,
price: item.price,
plummetPrice: item.price,
plummetPrice: item.plummetPrice,
activityPrice: item.activityPrice,
deductionPrice: item.deductionPrice,
discount: item.discount,
......@@ -222,7 +163,7 @@ const ProductListLayout: React.FC<ProductListLayoutProps> = (props: any) => {
/** 活动加个计算 */
const sumTotal = (price, num) => {
switch(Number(type)) {
switch (Number(type)) {
case 2:
return (Number(price) - Number(num))
}
......@@ -261,6 +202,7 @@ const ProductListLayout: React.FC<ProductListLayoutProps> = (props: any) => {
editable: col.editable,
dataIndex: col.dataIndex,
title: col.title,
activities: type,
handleSave: handleSave,
handleDelete: handleDelete,
sumTotal: sumTotal,
......
......@@ -177,8 +177,8 @@ const AnchorModal: React.FC<AnchorModalProps> = (props: any) => {
name: Object.keys(product).length > 0 ? product.name : res.name,
category: Object.keys(product).length > 0 ? product.customerCategory.name : edit.category,
ids: res.ids,
categoryId: Object.keys(product).length > 0 ? product.customerCategory.id : edit.catcategoryIdegory,
memberCategoryId: (Object.keys(product).length > 0 && !isEmpty(product.customerCategory.category)) ? product.customerCategory.category.id : edit.memberCategoryId,
categoryId: (Object.keys(product).length > 0 && !isEmpty(product.customerCategory.category)) ? product.customerCategory.category.id : edit.categoryId,
memberCategoryId: Object.keys(product).length > 0 ? product.customerCategory.id : edit.memberCategoryId,
brand: res.brand,
model: res.model,
purchaseCount: res.purchaseCount,
......
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