Commit af50b258 authored by XieZhiXiong's avatar XieZhiXiong
parents 6f5cf3ec e100eae5
......@@ -10,7 +10,7 @@
// import ChannelRoute from './channelRoute' // 渠道能力路由
import TranactionRoute from './tranactionRoute' // 交易能力路由
// import LogisticsRoute from './logisticsRoutes' // 物流能力路由
// import PayandSettleRoute from './payandSettle' //支付与结算
import PayandSettleRoute from './payandSettle' //支付与结算
// import AuthConfigRoute from './authConfigRoute'
// import AfterService from './afterServiceRoute' // 售后
// import HandlingRoute from './handlingRoute'; // 加工能力
......@@ -77,6 +77,7 @@ const memberCenterRoute = {
// AuthConfigRoute,
// MemberRoute,
// HandlingRoute,
PayandSettleRoute,
marketingRoute,
...asyncRoutes,
{
......
......@@ -21,7 +21,8 @@ const payandSettleRoute: RouterChild = {
{
path:'/memberCenter/payandSettle/paySetting/payParamsSetting',
name:'payParamsSetting',
component:'@/pages/payandSettle/paySetting'
component:'@/pages/payandSettle/paySetting',
noMargin: true,
},
]
},
......
import React, { useCallback, useEffect, useState } from 'react';
import { Modal, Form, Select, Input } from 'antd';
import { PublicApi } from '@/services/api';
import { isEmpty } from 'lodash';
const { Option } = Select;
const { TextArea } = Input;
const layout: any = {
colon: false,
labelCol: { style: { width: '100px' } },
labelAlign: "left"
};
interface ModalProps {
/** 支付渠道 */
payChannel: string,
/** 显示隐藏 */
visible?: boolean,
/** 编辑回显数据 */
value?: {
/** 支付参数枚举值 */
code?: number,
/** 支付参数Key名称 */
key?: string,
/** 支付参数内容 */
value?: string,
/** 描述 */
remark?: String
},
/** 确定 */
onConfirm: (e) => void,
/** 取消 */
onCancel: () => void,
}
type channel = {
/** 参数枚举值 */
code?: number,
/** 参数Key名称 */
key: string,
}[]
const ModalLayout: React.FC<ModalProps> = ({
payChannel,
visible,
value,
onConfirm,
onCancel,
}) => {
const [form] = Form.useForm();
const [channel, setChannel] = useState<channel>([])
const handleChannelFind = useCallback(async () => {
await PublicApi.getOrderMemberPaymentParameterChannelFind({ payChannel }).then(res => {
if (res.code !== 1000) {
return
}
setChannel(res.data);
})
}, [payChannel])
useEffect(() => {
if (payChannel) {
handleChannelFind();
}
}, [payChannel])
const handleCancel = () => {
onCancel()
form.resetFields()
}
const handleConfirm = () => {
form.validateFields().then(res => {
onConfirm({
...res,
key: channel.filter(item => Number(item.code) === Number(res.code))[0].key,
})
form.resetFields();
})
}
useEffect(() => {
if (!isEmpty(value)) {
console.log(value)
form.setFieldsValue({
...value
})
}
}, [value])
return (
<Modal
width={576}
title='新增参数配置'
visible={visible}
onOk={handleConfirm}
onCancel={handleCancel}
>
<Form
form={form}
{...layout}
>
<Form.Item name='code' label='参数代码' rules={[{ required: true, message: '请选择参数代码' }]}>
<Select>
{
channel.map(item => (
<Option key={item.code} value={item.code}>{item.key}</Option>
))
}
</Select>
</Form.Item>
<Form.Item name='value' label='参数值' rules={[{ required: true, message: '请输入参数值' }]}>
<Input maxLength={200} />
</Form.Item>
<Form.Item name='remark' label='参数描述'>
<TextArea maxLength={200} rows={4} />
</Form.Item>
</Form>
</Modal>
)
}
export default ModalLayout;
export const res = {
"code": 1000,
"message": "操作成功",
"data": [
{
"payType": 1,
"payTypeName": "线上支付",
"channels": [
{
"payChannel": 1,
"payChannelName": "支付宝",
"parameters": []
},
{
"payChannel": 2,
"payChannelName": "微信",
"parameters": []
},
{
"payChannel": 3,
"payChannelName": "银联",
"parameters": []
},
{
"payChannel": 4,
"payChannelName": "余额支付",
"parameters": []
}
],
"payChannels": [
1
]
},
{
"payType": 2,
"payTypeName": "线下支付",
"channels": [
{
"payChannel": 5,
"payChannelName": "线下支付线上确认",
"parameters": []
}
],
"payChannels": [
5
]
}
],
"time": 1629166786635
}
.tabsLayout {
:global {
.ant-tabs-top > .ant-tabs-nav::before, .ant-tabs-top > div > .ant-tabs-nav::before {
border-bottom: none;
}
.ant-tabs-tab {
border-radius: 4px;
border: 1px solid #EDEEEF;
margin: 0px 16px 0px 0px;
padding: 6px 16px;
}
.ant-tabs-tab-btn {
height: 18px;
}
.ant-tabs-tab-active {
border-radius: 4px;
border: 1px solid #00B37A;
}
.ant-tabs-ink-bar {
display: none;
}
.ant-radio-group {
.ant-radio-button-wrapper {
width: 80px !important;
text-align: center;
}
}
.ant-space-item {
display: flex;
align-items: center;
}
}
.anchor {
color: #909399;
font-size: 14px;
position: relative;
padding-left: 6px;
margin-bottom: 16px;
&::after {
content: '';
height: 14px;
position: absolute;
top: 0;
left: 0;
right: 0;
bottom: 0;
margin: auto;
border-left: 2px solid @main-color;
transform: scaleY(1);
opacity: 1;
transition: transform .15s cubic-bezier(.645,.045,.355,1),opacity .15s cubic-bezier(.645,.045,.355,1);
}
}
}
This diff is collapsed.
/*
* @Author: HJX
* @Date: 2020-11-19 15:25:54
* @LastEditors: HJX
* @LastEditTime: 2020-11-19 15:25:54
*/
import React, { useState, useEffect } from 'react';
import { history } from 'umi';
import { Button, Card, Tabs, Space, Input, InputNumber, message } from 'antd';
import { PageHeaderWrapper } from '@ant-design/pro-layout';
import { PublicApi } from '@/services/api';
import PayWayRadio from './components/payWayRadio';
import PayWayTable from './components/payWayTable';
const { TabPane } = Tabs
const PayWaySetTemplate: React.FC<{}> = () => {
const [config, setconfig] = useState<any>([]);
const [payItem, setPayItem] = useState<any>([]);
// const [step, setStep] = useState<Array<number>>([]);
const [obj, setObj] = useState<any>({});
const payWayConfigInfo = () => {
// 支付配置信息
return new Promise(resolve => {
PublicApi.getPayMemberPayConfig().then(res => {
if (res.code === 1000) {
resolve(res.data)
}
})
})
}
useEffect(() => {
// 支付配置信息
payWayConfigInfo().then((res: any) => {
const arr: any[] = [];
console.log(res)
res.forEach((item: any) => {
arr.push({
id: item.id,
way: item.way,
isPitchOn: item.isPitchOn ? item.isPitchOn : 0,
payType: item.payType,
payParametersList: item.payParametersList ? item.payParametersList : [],
payParametersAddListRequests: item.payParametersListResponses ? item.payParametersListResponses : []
})
})
setconfig([...res]);
setPayItem([...arr]);
})
}, [])
const onChangeRaido = (e: any, index: number) => {
const data = [...payItem];
payItem[index].isPitchOn = e.target.value;
setPayItem(data);
}
const onGet = (value: any, type: number, idx: number) => {
const data = [...payItem];
if (type === 2) {
data[idx].payParametersList = [...data[idx].payParametersList, value]
} else {
data[idx].payParametersAddListRequests = [...data[idx].payParametersAddListRequests, value]
}
setPayItem(data);
}
/**删除 */
const onDel = (value: any, index: number, idx: number) => {
console.log(value, index, idx, 10086)
const data = [...payItem];
if (Number(value) === 2) {
data[idx].payParametersList.splice(index, 1);
data[idx].payParametersList = [...data[idx].payParametersList]
} else {
data[idx].payParametersAddListRequests.splice(index, 1);
data[idx].payParametersAddListRequests = [...data[idx].payParametersAddListRequests]
}
setPayItem([...data]);
}
/**编辑 */
const onEdit = (value: any, type: number, index: number, idx: number) => {
const data = [...payItem];
if (type === 2) {
data[idx].payParametersList[index] = { ...value };
data[idx].payParametersList = [...data[idx].payParametersList]
} else {
data[idx].payParametersAddListRequests[index] = { ...value };
data[idx].payParametersAddListRequests = [...data[idx].payParametersAddListRequests]
}
setPayItem(data);
}
/**保存更新 */
const onHnadleSubmit = () => {
let conditions = false;
let wayName = '';
try {
payItem.forEach(item => {
if (item.id === 2 && item.isPitchOn === 1) {
console.log(1)
if (item.payParametersAddListRequests.length > 0) {
conditions = true
} else {
conditions = false
wayName = `${item.way}缺少支付参数配置`
throw new Error
}
} else if (item.id === 1 && item.isPitchOn === 1) {
if (item.payParametersAddListRequests.length > 0 && item.payParametersList.length > 0) {
conditions = true
} else {
conditions = false
wayName = `${item.way}缺少支付参数配置`
throw new Error
}
} else if (item.id === 6 && item.isPitchOn === 1) {
if (item.payParametersAddListRequests.length > 0) {
const data = item.payParametersAddListRequests[0]
if (data.code && data.value && data.describe) {
conditions = true
} else {
conditions = false
wayName = `请配置${item.way}的参数`
throw new Error
}
}
} else {
conditions = true
}
})
} catch {
message.error(wayName)
}
if (conditions) {
PublicApi.postPayMemberQueryPlatformUpdate({
platformPayWays: payItem
}).then(res => {
if (res.code === 1000) {
history.push('/memberCenter/payandSettle/paySetting/payParamsSetting')
}
})
}
}
/** */
const handleBlur = (e, name, idx) => {
console.log(e)
const data = [...payItem]
const payParametersAddListRequests = data[idx].payParametersAddListRequests;
if(payParametersAddListRequests.length === 0) {
payParametersAddListRequests.push({code: '', value: '', describe: ''})
}
payParametersAddListRequests.map(item => {
for(let key in item) {
if(key === name) {
if(name === 'value') {
item[key] = e
} else {
item[key] = e.target.value
}
}else {
if(name === 'value') {
item[name] = e
} else {
item[name] = e.target.value
}
}
}
item.type = 6;
})
data[idx].payParametersAddListRequests = [...payParametersAddListRequests]
console.log(payParametersAddListRequests, 10086)
setPayItem(data)
}
return (
<PageHeaderWrapper
extra={<Button type='primary' onClick={onHnadleSubmit}>保存</Button>}
>
<Card>
<Tabs type="card">
{config.map((item: any, idx: number) =>
<TabPane tab={item.way} key={item.id} forceRender>
<>
{
payItem.length > 0 &&
<>
<PayWayRadio
name={payItem[idx].way}
value={payItem[idx].isPitchOn}
selectId={payItem[idx].id}
onChange={(value) => onChangeRaido(value, idx)}
/>
{(payItem[idx].id === 1 || payItem[idx].id === 2) &&
<PayWayTable
id={payItem[idx].id}
onType={payItem[idx].payType}
name={payItem[idx].way}
payParametersList={payItem[idx].payParametersList}
payParametersListResponses={payItem[idx].payParametersAddListRequests}
visible={!!payItem[idx].isPitchOn}
onGet={(value, t) => onGet(value, t, idx)}
onDel={(value, index) => onDel(value, index, idx)}
onEdit={(value, type, index) => onEdit(value, type, index, idx)}
/>
}
{
(payItem[idx].id === 6 && !!payItem[idx].isPitchOn) &&
<div style={{ marginTop: 42 }}>
<Space direction="horizontal" size={16}>
初始申请额度不超过
<Input onChange={(e) => handleBlur(e, 'code', idx)} value={payItem[idx].payParametersAddListRequests.length > 0 ? payItem[idx].payParametersAddListRequests[0].code : undefined} addonBefore="¥" />
允许满<InputNumber min={1} onChange={(e) => handleBlur(e, 'value', idx)} value={payItem[idx].payParametersAddListRequests.length > 0 ? payItem[idx].payParametersAddListRequests[0].value : undefined} />
天后申请上调<Input onChange={(e) => handleBlur(e, 'describe', idx)} value={payItem[idx].payParametersAddListRequests.length > 0 ? payItem[idx].payParametersAddListRequests[0].describe : undefined} addonAfter="%" />
</Space>
</div>
}
</>
}
</>
</TabPane>
)}
</Tabs>
</Card>
</PageHeaderWrapper>
)
};
export default PayWaySetTemplate;
......@@ -254,7 +254,8 @@ const RemarkBidReport: React.FC<RemarkBidReportProps> = ({cardTitle}) => {
components={components}
dataSource={childTableData[index]}
columns={columns}
pagination={{size: "small"}}
pagination={false}
scroll={{ x: true }}
/>
}
})
......
......@@ -254,7 +254,8 @@ const RemarkBidReport: React.FC<RemarkBidReportProps> = ({cardTitle}) => {
components={components}
dataSource={childTableData[index]}
columns={columns}
pagination={{size: "small"}}
pagination={false}
scroll={{ x: true }}
/>
}
})
......
......@@ -163,4 +163,7 @@
}
}
}
.remarkBidMember {
margin-top: 20px;
}
// }
......@@ -42,6 +42,7 @@ const RemarkBidReport: React.FC<RemarkBidReportProps> = ({cardTitle}) => {
tempObject.id = item.id
tempObject.memberId = item.memberId
tempObject.memberName = item.memberName
tempObject.correctScore = item.correctScore
for(let j = 0; j < item.evaluationTenderList.length; j++) {
let _item = item['evaluationTenderList'][j]
tempObject.expertExtractRecordId = _item.expertExtractRecord?.id || _item['sort']
......@@ -65,9 +66,9 @@ const RemarkBidReport: React.FC<RemarkBidReportProps> = ({cardTitle}) => {
total: total.toFixed(2),
average: (total/expertNumber).toFixed(2) || null,
expertNumber,
correctScore: computedData[item][0]['correctScore']
}
})
const dataBySort = groupBy(dataSource, 'sort')
setEvaluationRecord(dataBySort)
// 根据评标sort分类后的数据 遍历 分子表格
......@@ -81,8 +82,8 @@ const RemarkBidReport: React.FC<RemarkBidReportProps> = ({cardTitle}) => {
},
{
title: '修正总分',
dataIndex: 'total',
key: 'total',
dataIndex: 'correctScore',
key: 'correctScore',
// editable: true,
},
{
......@@ -100,6 +101,7 @@ const RemarkBidReport: React.FC<RemarkBidReportProps> = ({cardTitle}) => {
total: computedMemberScoreItem['total'],
average: computedMemberScoreItem['average'] ? Number(computedMemberScoreItem['average']).toFixed(2) : null,
expertNumber: computedMemberScoreItem['expertNumber'],
correctScore: childDataSource[_item][0]['correctScore']
}
let columns: any = []
childDataSource[_item].forEach((__item, __index) => {
......@@ -247,11 +249,12 @@ const RemarkBidReport: React.FC<RemarkBidReportProps> = ({cardTitle}) => {
if(transferRadio === index) {
return <Table
scroll={{ x: true }}
key={index}
components={components}
dataSource={childTableData[index]}
columns={columns}
pagination={{size: "small"}}
pagination={false}
/>
}
})
......
......@@ -92,7 +92,8 @@ const OnlineRemark: React.FC<RemarkBidReportProps> = ({cardTitle, addSchemaActio
rowKey: 'id',
columns: "{{remarkColumns}}",
components: "{{remarkComponents}}",
pagination: { size: 'small' }
pagination: false,
scroll: { x: true }
},
},
memberList: {
......
......@@ -163,4 +163,8 @@
}
}
}
.remarkBidMember {
margin-top: 20px;
}
// }
......@@ -42,6 +42,7 @@ const RemarkBidReport: React.FC<RemarkBidReportProps> = ({cardTitle}) => {
tempObject.id = item.id
tempObject.memberId = item.memberId
tempObject.memberName = item.memberName
tempObject.correctScore = item.correctScore
for(let j = 0; j < item.evaluationTenderList.length; j++) {
let _item = item['evaluationTenderList'][j]
tempObject.expertExtractRecordId = _item.expertExtractRecord?.id || _item['sort']
......@@ -65,6 +66,7 @@ const RemarkBidReport: React.FC<RemarkBidReportProps> = ({cardTitle}) => {
total: total.toFixed(2),
average: (total/expertNumber).toFixed(2) || null,
expertNumber,
correctScore: computedData[item][0]['correctScore']
}
})
......@@ -81,8 +83,8 @@ const RemarkBidReport: React.FC<RemarkBidReportProps> = ({cardTitle}) => {
},
{
title: '修正总分',
dataIndex: 'total',
key: 'total',
dataIndex: 'correctScore',
key: 'correctScore',
// editable: true,
},
{
......@@ -100,6 +102,7 @@ const RemarkBidReport: React.FC<RemarkBidReportProps> = ({cardTitle}) => {
total: computedMemberScoreItem['total'],
average: computedMemberScoreItem['average'] ? Number(computedMemberScoreItem['average']).toFixed(2) : null,
expertNumber: computedMemberScoreItem['expertNumber'],
correctScore: childDataSource[_item][0]['correctScore']
}
let columns: any = []
childDataSource[_item].forEach((__item, __index) => {
......@@ -251,7 +254,8 @@ const RemarkBidReport: React.FC<RemarkBidReportProps> = ({cardTitle}) => {
components={components}
dataSource={childTableData[index]}
columns={columns}
pagination={{size: "small"}}
pagination={false}
scroll={{ x: true }}
/>
}
})
......
import React, { useEffect } from 'react'
import React from 'react'
import CustomTag from '@/pages/procurement/components/customTag'
import { BidInOpeartTexts, BidInStateTexts, BidOutOpeartTexts, BidOutStateTexts } from "@/constants/procurement"
import { formatTimeString } from "@/utils"
import { ISchema } from '@formily/antd'
......
......@@ -133,7 +133,7 @@ const RemarkBidReport: React.FC<RemarkBidReportProps> = ({editable}) => {
render: (t, r, i) => renderRanking(t, r, ++i)
},
{
title: '修正总分', dataIndex: 'total', key: 'total', editable: true,
title: '修正总分', dataIndex: 'modifyTotal', key: 'modifyTotal', editable: true,
},
{
title: '平均分', dataIndex: 'average', key: 'average', className: 'commonHide'
......@@ -148,6 +148,7 @@ const RemarkBidReport: React.FC<RemarkBidReportProps> = ({editable}) => {
memberId: childDataSource[_item][0]['memberId'],
memberName: _item,
total: computedMemberScoreItem['total'],
modifyTotal: computedMemberScoreItem['total'], //在线模式 默认修正总分是总分
average: computedMemberScoreItem['average'] ? Number(computedMemberScoreItem['average']).toFixed(2) : null,
expertNumber: computedMemberScoreItem['expertNumber'],
editable,
......@@ -333,6 +334,7 @@ const RemarkBidReport: React.FC<RemarkBidReportProps> = ({editable}) => {
}
const handleSave = (row) => {
console.log(row, childTableData)
// 双重遍历childTableData数据 改变total和average
setChildrenTableData(() => {
return childTableData.map(element => {
......@@ -340,6 +342,7 @@ const RemarkBidReport: React.FC<RemarkBidReportProps> = ({editable}) => {
if(_e.memberName === row.memberName) {
return {
..._e,
modifyTotal: Number(row.modifyTotal)
// @reason:修正总分和总分不需要联动
// total: Number(row.total),
// average: (Number(row.total) / row.expertNumber).toFixed(2),
......@@ -444,11 +447,12 @@ const RemarkBidReport: React.FC<RemarkBidReportProps> = ({editable}) => {
if(transferRadio === index) {
return <Table
scroll={{ x: true }}
key={index}
components={components}
dataSource={childTableData[index]}
columns={columns}
pagination={{size: "small"}}
pagination={false}
/>
}
})
......@@ -458,6 +462,7 @@ const RemarkBidReport: React.FC<RemarkBidReportProps> = ({editable}) => {
<h3 className="commonPanelTitle">评标记录</h3>
</div>
<Table
scroll={{ x: true }}
key="memberId"
components={components}
dataSource={offlineData}
......@@ -476,7 +481,7 @@ const RemarkBidReport: React.FC<RemarkBidReportProps> = ({editable}) => {
}),
};
})}
pagination={{size: "small"}}
pagination={false}
/>
</div>
}
......
......@@ -57,16 +57,16 @@ export const EditableCell: React.FC<EditableCellProps> = ({
style={{ margin: 0 }}
name={dataIndex}
initialValue={record[dataIndex]}
rules={[
{
required: true,
message: `${title}必须填写`,
},
{
pattern: /^\d+(\.\d{1,2})?$/,
message: `${title}仅限两位小数`,
},
]}
// rules={[
// {
// required: true,
// message: `${title}必须填写`,
// },
// {
// pattern: /^\d+(\.\d{1,2})?$/,
// message: `${title}仅限两位小数`,
// },
// ]}
>
<Input
style={{width: 140}}
......
......@@ -52,7 +52,7 @@ const readySubmitReportDetail: React.FC = () => {
params.evaluationTenderFile = fileList
// 在线
if(data.isOnlineEvaluation) {
params.evaluationTenderReportMemberList = childTableData?.length ? childTableData[0].map(item => ({ memberId: item.memberId, correctScore: item.total })) : []
params.evaluationTenderReportMemberList = childTableData?.length ? childTableData[0].map(item => ({ memberId: item.memberId, correctScore: item.modifyTotal })) : []
} else {
// 非在线
params.evaluationTenderReportMemberList = offlineData?.length
......@@ -65,6 +65,7 @@ const readySubmitReportDetail: React.FC = () => {
:
[]
}
console.log(params)
PublicApi.postPurchaseExpertExtractReportSubmitEvaluationTenderReport(params).then(res => {
setLoading(true)
if(res.code === 1000) {
......
......@@ -163,4 +163,7 @@
}
}
}
.remarkBidMember {
margin-top: 20px;
}
// }
......@@ -99,10 +99,11 @@ const RemarkBidReport: React.FC<RemarkBidReportProps> = ({cardTitle}) => {
// 动态子表格列 // 合并同会员下的专家评标
// 相同同会员名下的分数数据 只需要取一个
const computedMemberScoreItem = computedScore.filter(_v => _v.memberName === _item)[0]
console.log(computedMemberScoreItem)
let objectItem: any = {
memberId: childDataSource[_item][0]['memberId'],
memberName: _item,
total: computedMemberScoreItem['total'].toFixed(2),
total: computedMemberScoreItem['total'] ? Number(computedMemberScoreItem['total']).toFixed(2) : null,
average: computedMemberScoreItem['average'] ? Number(computedMemberScoreItem['average']).toFixed(2) : null,
expertNumber: computedMemberScoreItem['expertNumber'],
correctScore: childDataSource[_item][0]['correctScore']
......@@ -257,7 +258,8 @@ const RemarkBidReport: React.FC<RemarkBidReportProps> = ({cardTitle}) => {
components={components}
dataSource={childTableData[index]}
columns={columns}
pagination={{size: "small"}}
pagination={false}
scroll={{ x: true }}
/>
}
})
......
......@@ -13,6 +13,8 @@ export type tabLink = {
}
export interface IProps {
/** 返回按钮 */
onBack?: boolean,
/** 单号 */
no?: string | React.ReactNode,
/** 详情描述 */
......@@ -29,6 +31,7 @@ export interface IProps {
const PeripheralLayout: React.FC<IProps> = (props: any) => {
const {
onBack,
no,
detail,
tabLink,
......@@ -71,7 +74,7 @@ const PeripheralLayout: React.FC<IProps> = (props: any) => {
<div style={{ flex: 1 }}>
<div className={style.title}>
<div className={style.titleBox}>
<ArrowLeftOutlined className={style.goBack} onClick={() => history.goBack()} />
{!onBack && <ArrowLeftOutlined className={style.goBack} onClick={() => history.goBack()} />}
<span className={style.titleContext}>
{detail ? detail : dataSource.details}
&nbsp;{!hideBreak && '|'}&nbsp;
......
......@@ -186,7 +186,8 @@ export const Columns = (int) => {
折扣 <QuestionCircleOutlined />
</Tooltip>,
key: 'discount',
dataIndex: 'discount'
dataIndex: 'discount',
editable: true,
},
{
title: '活动价格',
......
......@@ -27,10 +27,17 @@ const EditableCell = ({
const rate = async () => {
try {
const values = await form.getFieldValue(dataIndex);
if (activities && Number(activities) !== 11) {
record.activityPrice = sumTotal(record.price, values)
let values = null;
switch (Number(activities)) {
case 2:
values = await form.getFieldValue('plummetPrice');
record.activityPrice = sumTotal(record.price, values);
break;
case 3:
values = await form.getFieldValue('discount');
record.activityPrice = Number(record.price) * (Number(values))/100
}
console.log(values)
handleSave({ ...record, ...values });
} catch (errInfo) { }
}
......@@ -129,7 +136,34 @@ const EditableCell = ({
</Form.Item>
)
break;
}
case 'discount':
childNode = (
<Form.Item
style={{
margin: 0,
}}
name={dataIndex}
initialValue={record[dataIndex]}
rules={[
{
required: true,
validator: (_rule, value) => {
const pattern = /^(\-)?\d+(\.\d{1,2})?$/;
if (!value) {
return Promise.reject(new Error('必填项'));
}
if (!pattern.test(value)) {
return Promise.reject(new Error('折扣必须大于0'));
}
return Promise.resolve();
},
},
]}
>
<Input style={{ width: '112px' }} addonBefore="折"onPressEnter={rate} onBlur={rate} />
</Form.Item>
)
}
}
/** 操作按钮 */
......
......@@ -46,7 +46,7 @@ const ProductListLayout: React.FC<ProductListLayoutProps> = (props: any) => {
};
const handleSave = (row) => {
const newData = [...dataSource];
const index = newData.findIndex((item) => row.productId === item.productId);
const index = newData.findIndex((item) => row.id === item.id);
const item = newData[index];
newData.splice(index, 1, { ...item, ...row });
getDataSource(newData)
......@@ -54,8 +54,8 @@ const ProductListLayout: React.FC<ProductListLayoutProps> = (props: any) => {
};
const handleDelete = (key) => {
const newData = [...dataSource];
getDataSource(newData.filter(item => item.productId !== key))
setDataSource(newData.filter(item => item.productId !== key))
getDataSource(newData.filter(item => item.id !== key))
setDataSource(newData.filter(item => item.id !== key))
};
const columns = useMemo(() => {
return Columns(type || 1)
......@@ -73,9 +73,9 @@ const ProductListLayout: React.FC<ProductListLayoutProps> = (props: any) => {
/** 选择活动商品columns */
const TableModalColumns: ColumnType<any>[] = [
{
title: '商品ID',
key: 'productId',
dataIndex: 'productId',
title: 'SKUID',
key: 'id',
dataIndex: 'id',
},
{
title: '商品名称',
......@@ -193,7 +193,7 @@ const ProductListLayout: React.FC<ProductListLayoutProps> = (props: any) => {
>
<Button style={{ marginBottom: '16px' }} block type="dashed" icon={<PlusOutlined />} onClick={() => toggle(true)}>选择活动商品</Button>
<Table
rowKey={(record) => record.productId}
rowKey={(record) => record.id}
components={components}
columns={columns.map((col: any) => {
if (!col.editable && !col.operation) {
......@@ -227,9 +227,9 @@ const ProductListLayout: React.FC<ProductListLayoutProps> = (props: any) => {
columns={TableModalColumns}
mode="checkbox"
tableProps={{
rowKey: 'productId',
rowKey: 'id',
}}
customKey="productId"
customKey="id"
onClose={() => toggle(false)}
onOk={handleOk}
effects={($, actions) => {
......
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