Commit 7ca01d71 authored by 前端-黄佳鑫's avatar 前端-黄佳鑫

修复支付参数设置和物流单新增和编辑

parent 34d0a9f8
......@@ -22,3 +22,37 @@ export const SelectGoodsColumns: ColumnType<any>[] = [
dataIndex: 'brand',
}
]
export const ExternalListColumns: ColumnType<any>[] = [
{
title: '流转顺序号',
key: 'number',
dataIndex: 'number',
render:(text:any, record:any, index:number) => {return index + 1;}
},
{
title: '操作角色',
key: 'roleName',
dataIndex: 'roleName',
},
{
title: '状态',
key: 'status',
dataIndex: 'status',
},
{
title: '操作',
key: 'operationalProcess',
dataIndex: 'operationalProcess',
},
{
title: '操作时间',
key: 'brand',
dataIndex: 'brand',
},
{
title: '审核意见',
key: 'brand',
dataIndex: 'brand',
}
]
......@@ -8,7 +8,7 @@ import { PageHeaderWrapper } from '@ant-design/pro-layout';
import { LinkOutlined, PlusOutlined } from '@ant-design/icons';
import { PublicApi } from '@/services/api';
import ModalTable from '@/components/ModalTable';
import { SelectGoodsColumns } from './components/columns';
import { SelectGoodsColumns, ExternalListColumns } from './components/columns';
import { useRowSelectionTable } from '@/hooks/useRowSelectionTable';
import moment from 'moment';
import ModalTableOrder from './components/ModalTableOrder';
......@@ -201,12 +201,14 @@ const AddLogistics: React.FC<{}> = () => {
receiverName: res.data.receiveUserName,
receiverPhone: res.data.receiveUserTel,
receiverFullAddress: res.data.receiveAddress,
shipperAddressId: res.data.deliveryAddressId,
shipperFullAddress: res.data.deliveryAddress,
shipmentOrderCode: res.data.deliveryNo,
relevanceOrderCode: res.data.orderNo,
voucherTime: res.data.transactionTime,
externalState: res.data.state,
relevanceOrderCode: res.data.noticeNo,
shipmentOrderId: res.data.deliveryId,
relevanceOrderId: res.data.id,
voucherTime: res.data.createTime,
externalState: res.data.outerStatus,
}
form.setFieldsValue(obj);
setQuery({ ...obj })
......@@ -224,7 +226,7 @@ const AddLogistics: React.FC<{}> = () => {
voucherTime: res.data.applyTime,
relevanceOrderId: res.data.applyId,
externalState: res.data.state,
digest: res.data.applyAbstract
digest: res.data.applyAbstract,
}
form.setFieldsValue(obj);
setQuery({ ...obj })
......@@ -294,6 +296,7 @@ const AddLogistics: React.FC<{}> = () => {
externalState: res.data.status,
shipperAddressId: res.data.shipperAddressId,
shipperFullAddress: res.data.shipperFullAddress,
externalList: res.data.externalList
}
form.setFieldsValue(obj)
setQuery(obj)
......@@ -329,11 +332,12 @@ const AddLogistics: React.FC<{}> = () => {
case 1:
case 2:
case 3:
PublicApi.getWarehouseInvoicesProductList({ ...params, invoicesId: id }).then((res:any) => {
PublicApi.getWarehouseInvoicesProductList({ ...params, invoicesId: id }).then((res: any) => {
if (res.code === 1000) {
res.data.data.forEach(item => {
item.category = item.categoryName
item.brand = item.brandName
item.unit = item.unitName
})
resolve(res.data)
}
......@@ -376,7 +380,7 @@ const AddLogistics: React.FC<{}> = () => {
productName: item.productName,
categoryName: item.category,
brandName: item.brand,
unitName: item.unitName,
unitName: item.unit,
amount: item.amount,
carton: item.carton,
weight: item.weight,
......@@ -533,7 +537,10 @@ const AddLogistics: React.FC<{}> = () => {
/**打开选择商品 */
const handleVisible = () => {
console.log(query)
if(query.shipmentOrderId || query.relevanceOrderId) {
if (query.shipmentOrderCode || query.relevanceOrderCode) {
const list = [...detailList];
goodsRowCtl.setSelectRow(list)
goodsRowCtl.setSelectedRowKeys(list.map(v => v.productId));
setvisible(true)
} else {
message.error('请先选择要操作的对应发货单号或对应订单号/售后单')
......@@ -542,9 +549,11 @@ const AddLogistics: React.FC<{}> = () => {
/** 提交数据 */
const handleSubmit = async () => {
const basicRef = await form.validateFields().then(res => { return true }).catch(error => { return error });
const goodsRef = await goodsForm.validateFields().then(res => { return true }).catch(error => { return error });
const data = [...badge]
const params = { ...query };
const basicRef = await form.validateFields().then(res => { console.log(res); params.digest = res.digest; return true }).catch(error => { return error });
const goodsRef = await goodsForm.validateFields().then(res => { return true }).catch(error => { return error });
params.createType = createType;
if (basicRef.errorFields) {
data[0] = basicRef.errorFields.length;
setbadge(data);
......@@ -560,10 +569,9 @@ const AddLogistics: React.FC<{}> = () => {
setbadge(data)
const { pathname } = history.location;
const path = pathname.split('/')[pathname.split('/').length - 1];
const params = {...query};
params.detailList = detailList
if(path === 'edit') {
PublicApi.postLogisticsOrderWaitSubmitUpdate({...params }).then(res => {
if (path === 'edit') {
PublicApi.postLogisticsOrderWaitSubmitUpdate({ ...params }).then(res => {
if (res.code === 1000) {
history.goBack()
}
......@@ -589,7 +597,7 @@ const AddLogistics: React.FC<{}> = () => {
if (Object.keys(memberInfo).length > 0) {
PublicApi.getSettleAccountsPlatformConfigGetSettlementWay({ ...memberInfo }).then(res => {
if (res.code === 1000) {
const data = {...query}
const data = { ...query }
data.settlementWay = res.data;
setQuery(data)
}
......@@ -675,7 +683,12 @@ const AddLogistics: React.FC<{}> = () => {
</Form>
</TabPane>
{/** 流转记录 */}
<TabPane key='tab-4' tab='流转记录' forceRender></TabPane>
<TabPane key='tab-4' tab='流转记录' forceRender>
<Table
columns={ExternalListColumns}
dataSource={query.externalList}
/>
</TabPane>
</Tabs>
</Card>
{/* 选择对应发货单 - createType === 1的时候才显示 */}
......
import * as React from 'react';
import { useState, useRef, useEffect } from 'react';
import { Row, Col, Form, Input, Select, Popconfirm, Button, Card } from 'antd';
import { LinkOutlined } from '@ant-design/icons';
import { PageHeaderWrapper } from '@ant-design/pro-layout';
import { ColumnType } from 'antd/lib/table/interface'
import { history } from 'umi'
import ReutrnEle from '@/components/ReturnEle';
import ModalTable from '@/components/ModalTable'
import { PublicApi } from '@/services/api'
import { PageStatus } from '@/hooks/usePageStatus'
import { useRowSelectionTable } from '@/hooks/useRowSelectionTable'
import { ISchema } from '@formily/antd';
export interface companyProps {
}
export interface companyState {
}
interface Item {
key: string;
}
const { TextArea } = Input;
const layout = {
labelCol: { span: 6 },
wrapperCol: { span: 18 },
};
const data = [
{
key: '1',
memberId: 1,
name: '名称',
roleName: '角色1',
levelTag: '青铜'
}]
const columns: ColumnType<any>[] = [
{
title: 'ID',
dataIndex: 'memberId',
align: 'center',
key: 'memberId',
},
{
title: '会员名称',
dataIndex: 'name',
key: 'name',
align: 'left'
},
{
title: '会员角色',
dataIndex: 'roleName',
key: 'roleName',
align: 'center'
},
{
title: '会员等级',
dataIndex: 'levelTag',
key: 'levelTag',
align: 'center'
}
]
const fetchData = async (params) => {
const res = await PublicApi.getMemberManageLowerPageBynamerole(params)
return res.data
}
const { Option } = Select;
const defaultValue = 'lucy'
interface parmas {
pageStatus?: any,
id?: any,
isSee?: any
}
const company: React.FC<parmas> = (props) => {
//hook只能写在函数组件的顶级作用域
const ref = useRef<any>({})
const { pageStatus, id, isSee } = props
const [productRowSelection, productRowCtl] = useRowSelectionTable({ type: 'radio', customKey: 'memberId' })
const [menuForm] = Form.useForm();
const [headerTitle, setHeaderTitle] = useState('新建物流公司')
const [Code, setCode] = useState('')
const [loading, setLoading] = useState<boolean>(false)
const [roleList, setroleList] = useState([])
const [codeDisabled, setCodeDisabled] = useState(false)
const [companyType, setCompanyType] = useState<number>(null)
const [memberId, setMemberId] = useState<number>(null)
const [visible, setsVisible] = useState(false) //state hook写法
const [selectRow, setSelectRow] = useState<Item[]>([]) // 模态框选择的行数据
const [selectedRowKeys, setSelectedRowKeys] = useState<Array<string>>([])
useEffect(() => {
let _title = pageStatus === PageStatus.PREVIEW ? '查看' : id ? '编辑' : '新建'
setHeaderTitle(`${_title}物流公司`)
PublicApi.getMemberManageRoleList().then(res => {
if (res.code === 1000) {
let { data } = res || {}
let list = data.map(v => ({
label: v.roleName,
value: v.roleId
}))
setroleList(list)
}
})
if (id) {
PublicApi.getLogisticsCompanyGet({ id: id }).then(res => {
const data = res.data
menuForm.setFieldsValue(data)
let type = data.cooperateType === 2 ? 2 : 1
setCompanyType(type)
})
}
return () => {
}
}, [])
const handleSubmitAllSetting = () => {
menuForm.validateFields().then((values: any) => {
console.log(values, '嘿嘿嘿')
if (id) {
values.id = id
setLoading(true)
PublicApi.postLogisticsCompanyUpdate(values).then(res => {
if (res.code === 1000) {
menuForm.resetFields()
setLoading(false)
history.goBack()
}
})
} else {
setLoading(true)
PublicApi.postLogisticsCompanyAdd(values).then(res => {
if (res.code === 1000) {
setLoading(false)
menuForm.resetFields()
history.goBack()
}
})
}
}).catch(error => {
console.error(error)
})
}
const handleCancel = () => {
history.go(-1)
}
const handleLink = () => {
setsVisible(true)
}
//改变code
const onCodeChange = (e: any) => {
const value = e.target.value
setCode(value)
console.log(value);
}
const onChangeType = (value: any) => {
setCompanyType(value)
if (value == 2) {
setCodeDisabled(true)
menuForm.setFieldsValue({
companyMemberId: '',
name: ''
})
} else {
setCodeDisabled(false)
}
}
const handleSelectOk = () => {
console.log('数据', productRowCtl);
const selectRow = productRowCtl.selectRow[0]
let { memberId, roleId, name } = selectRow
menuForm.setFieldsValue({
companyMemberId: memberId,
name: name
})
setsVisible(false)
}
const handleSelectCancel = () => {
setsVisible(false)
}
const rowSelection = {
selectedRowKeys: selectedRowKeys,
onChange: (selectedRowKeys: any, selectedRows: any) => {
setSelectRow(selectedRows);
setSelectedRowKeys(selectedRowKeys);
console.log(`selectedRowKeys: ${selectedRowKeys}`, 'selectedRows: ', selectedRows);
}
}
const selectBtn = (
<Button style={{ backgroundColor: '#909399', borderColor: '#909399', color: 'white' }} onClick={handleLink}>
<LinkOutlined />选择
</Button>
)
const formSearch: ISchema = {
type: 'object',
properties: {
name: {
type: 'string',
"x-component": "Search",
"x-component-props": {
placeholder: '输入关键字搜索'
}
},
roleId: {
type: 'string',
"x-component-props": {
placeholder: '选择会员角色'
},
enum: roleList
}
}
}
return (
<PageHeaderWrapper
onBack={() => history.goBack()}
backIcon={<ReutrnEle description="返回" />}
title={headerTitle}
>
<Row gutter={[36, 36]}>
<Col span={24}>
<Card>
{
(<Form
form={menuForm}
colon={false}
name="edit_infomation"
labelAlign="left"
{...layout}
>
<Row gutter={24}>
<Col span={18}>
<Form.Item
name='cooperateType'
label='合作类型'
rules={[
{
required: true,
message: '选择合作类型!',
},
]}
// initialValue={}
>
<Select disabled={isSee} placeholder="请选择合作类型" value={companyType} onChange={onChangeType}>
<Option value={1}>平台物流服务商</Option>
<Option value={2}>商户合作物流公司</Option>
</Select>
</Form.Item>
</Col>
<Col span={18}>
{
companyType === 1 ?
<Form.Item
name='companyMemberId'
label='物流公司代码/
平台会员ID'
rules={[
{
required: true,
message: '输入物流公司代码/平台会员ID!',
}
]}
>
<Input disabled={isSee} className="input_addonAfter" maxLength={20} addonAfter={selectBtn} />
</Form.Item>
:
<Form.Item
name='code'
label='物流公司代码/平台会员ID'
rules={[
{
required: true,
message: '输入物流公司代码/平台会员ID!',
}
]}
>
<Input disabled={isSee} maxLength={20} />
</Form.Item>
}
</Col>
<Col span={18}>
<Form.Item
name='name'
label='物流公司名称'
rules={[
{
required: true,
message: '输入物流公司名称!',
},
]}
>
<Input maxLength={40} disabled={isSee ? isSee : (companyType === 2 ? false : true)} placeholder="输入物流公司名称" />
</Form.Item>
</Col>
<Col span={18}>
<Form.Item
name='remark'
label='备注'
>
<TextArea disabled={isSee} rows={4} maxLength={60} />
</Form.Item>
</Col>
{
(pageStatus !== PageStatus.PREVIEW) &&
<Col span={18}>
<Row>
<Col span={6}></Col>
<Col span={18}>
<Button loading={loading} onClick={handleSubmitAllSetting} type="primary" style={{ marginTop: 32, marginBottom: 16, marginRight: 24 }}>
保存
</Button>
<Popconfirm
title="未保存,是否确定执行这个操作?"
onConfirm={handleCancel}
okText="是"
cancelText="否"
>
<Button style={{ marginTop: 32, marginBottom: 16 }}>
取消
</Button>
</Popconfirm>
</Col>
</Row>
</Col>
}
</Row>
</Form>)
}
</Card>
</Col>
</Row>
{/* <Modal
title="选择平台物流服务商"
width='800px'
visible={visible}
onOk={handleSelectOk}
onCancel={handleSelectCancel}
okText="确认"
cancelText="取消"
>
<Row>
<Col span={10}> <Input.Search placeholder="输入关键字进行搜索" /></Col>
<Col span={14}></Col>
</Row>
<StandardTable
columns={columns}
currentRef={ref}
rowSelection={{
type:'radio',
...rowSelection
}}
fetchTableData={(params: any) => fetchData(params)}
/>
</Modal> */}
<ModalTable
modalTitle='选择平台物流服务商'
confirm={handleSelectOk}
cancel={handleSelectCancel}
visible={visible}
columns={columns}
rowSelection={productRowSelection}
fetchTableData={params => fetchData(params)}
formilyProps={{
ctx: {
schema: formSearch
}
}}
tableProps={{
rowKey: 'memberId'
}}
>
</ModalTable>
</PageHeaderWrapper>
);
}
export default company;
\ No newline at end of file
import * as React from 'react';
import { useState, useRef, useEffect } from 'react';
import { Row, Col, Form, Input, Select, Popconfirm, Button, Card } from 'antd';
import { LinkOutlined } from '@ant-design/icons';
import { PageHeaderWrapper } from '@ant-design/pro-layout';
import { ColumnType } from 'antd/lib/table/interface'
import { history } from 'umi'
import ReutrnEle from '@/components/ReturnEle';
import ModalTable from '@/components/ModalTable'
import { PublicApi } from '@/services/api'
import { PageStatus } from '@/hooks/usePageStatus'
import { useRowSelectionTable } from '@/hooks/useRowSelectionTable'
import { ISchema } from '@formily/antd';
export interface companyProps {
}
export interface companyState {
}
interface Item {
key: string;
}
const { TextArea } = Input;
const layout = {
labelCol: { span: 6 },
wrapperCol: { span: 18 },
};
const data = [
{
key: '1',
memberId: 1,
name: '名称',
roleName: '角色1',
levelTag: '青铜'
}]
const columns: ColumnType<any>[] = [
{
title: 'ID',
dataIndex: 'memberId',
align: 'center',
key: 'memberId',
},
{
title: '会员名称',
dataIndex: 'name',
key: 'name',
align: 'left'
},
{
title: '会员角色',
dataIndex: 'roleName',
key: 'roleName',
align: 'center'
},
{
title: '会员等级',
dataIndex: 'levelTag',
key: 'levelTag',
align: 'center'
}
]
const fetchData = async (params) => {
const res = await PublicApi.getMemberManageLowerPageBynamerole(params)
return res.data
}
const { Option } = Select;
const defaultValue = 'lucy'
interface parmas {
pageStatus?: any,
id?: any,
isSee?: any
}
const company: React.FC<parmas> = (props) => {
//hook只能写在函数组件的顶级作用域
const ref = useRef<any>({})
const { pageStatus, id, isSee } = props
const [productRowSelection, productRowCtl] = useRowSelectionTable({ type: 'radio', customKey: 'memberId' })
const [menuForm] = Form.useForm();
const [headerTitle, setHeaderTitle] = useState('新建物流公司')
const [Code, setCode] = useState('')
const [loading, setLoading] = useState<boolean>(false)
const [roleList, setroleList] = useState([])
const [codeDisabled, setCodeDisabled] = useState(false)
const [companyType, setCompanyType] = useState<number>(null)
const [memberId, setMemberId] = useState<number>(null)
const [visible, setsVisible] = useState(false) //state hook写法
const [selectRow, setSelectRow] = useState<Item[]>([]) // 模态框选择的行数据
const [selectedRowKeys, setSelectedRowKeys] = useState<Array<string>>([])
useEffect(() => {
let _title = pageStatus === PageStatus.PREVIEW ? '查看' : id ? '编辑' : '新建'
setHeaderTitle(`${_title}物流公司`)
PublicApi.getMemberManageRoleAll().then(res => {
if (res.code === 1000) {
let { data } = res || {}
let list = data.map(v => ({
label: v.roleName,
value: v.roleId
}))
setroleList(list)
}
})
if (id) {
PublicApi.getLogisticsCompanyGet({ id: id }).then(res => {
const data = res.data
menuForm.setFieldsValue(data)
let type = data.cooperateType === 2 ? 2 : 1
setCompanyType(type)
})
}
return () => {
}
}, [])
const handleSubmitAllSetting = () => {
menuForm.validateFields().then((values: any) => {
console.log(values, '嘿嘿嘿')
if (id) {
values.id = id
setLoading(true)
PublicApi.postLogisticsCompanyUpdate(values).then(res => {
if (res.code === 1000) {
menuForm.resetFields()
setLoading(false)
history.goBack()
}
})
} else {
setLoading(true)
PublicApi.postLogisticsCompanyAdd(values).then(res => {
if (res.code === 1000) {
setLoading(false)
menuForm.resetFields()
history.goBack()
}
})
}
}).catch(error => {
console.error(error)
})
}
const handleCancel = () => {
history.go(-1)
}
const handleLink = () => {
setsVisible(true)
}
//改变code
const onCodeChange = (e: any) => {
const value = e.target.value
setCode(value)
console.log(value);
}
const onChangeType = (value: any) => {
setCompanyType(value)
if (value == 2) {
setCodeDisabled(true)
menuForm.setFieldsValue({
companyMemberId: '',
name: ''
})
} else {
setCodeDisabled(false)
}
}
const handleSelectOk = () => {
console.log('数据', productRowCtl);
const selectRow = productRowCtl.selectRow[0]
let { memberId, roleId, name } = selectRow
menuForm.setFieldsValue({
companyMemberId: memberId,
name: name
})
setsVisible(false)
}
const handleSelectCancel = () => {
setsVisible(false)
}
const rowSelection = {
selectedRowKeys: selectedRowKeys,
onChange: (selectedRowKeys: any, selectedRows: any) => {
setSelectRow(selectedRows);
setSelectedRowKeys(selectedRowKeys);
console.log(`selectedRowKeys: ${selectedRowKeys}`, 'selectedRows: ', selectedRows);
}
}
const selectBtn = (
<Button style={{ backgroundColor: '#909399', borderColor: '#909399', color: 'white' }} onClick={handleLink}>
<LinkOutlined />选择
</Button>
)
const formSearch: ISchema = {
type: 'object',
properties: {
name: {
type: 'string',
"x-component": "Search",
"x-component-props": {
placeholder: '输入关键字搜索'
}
},
roleId: {
type: 'string',
"x-component-props": {
placeholder: '选择会员角色'
},
enum: roleList
}
}
}
return (
<PageHeaderWrapper
onBack={() => history.goBack()}
backIcon={<ReutrnEle description="返回" />}
title={headerTitle}
>
<Row gutter={[36, 36]}>
<Col span={24}>
<Card>
{
(<Form
form={menuForm}
colon={false}
name="edit_infomation"
labelAlign="left"
{...layout}
>
<Row gutter={24}>
<Col span={18}>
<Form.Item
name='cooperateType'
label='合作类型'
rules={[
{
required: true,
message: '选择合作类型!',
},
]}
// initialValue={}
>
<Select disabled={isSee} placeholder="请选择合作类型" value={companyType} onChange={onChangeType}>
<Option value={1}>平台物流服务商</Option>
<Option value={2}>商户合作物流公司</Option>
</Select>
</Form.Item>
</Col>
<Col span={18}>
{
companyType === 1 ?
<Form.Item
name='companyMemberId'
label='物流公司代码/
平台会员ID'
rules={[
{
required: true,
message: '输入物流公司代码/平台会员ID!',
}
]}
>
<Input disabled={isSee} className="input_addonAfter" maxLength={20} addonAfter={selectBtn} />
</Form.Item>
:
<Form.Item
name='code'
label='物流公司代码/平台会员ID'
rules={[
{
required: true,
message: '输入物流公司代码/平台会员ID!',
}
]}
>
<Input disabled={isSee} maxLength={20} />
</Form.Item>
}
</Col>
<Col span={18}>
<Form.Item
name='name'
label='物流公司名称'
rules={[
{
required: true,
message: '输入物流公司名称!',
},
]}
>
<Input maxLength={40} disabled={isSee ? isSee : (companyType === 2 ? false : true)} placeholder="输入物流公司名称" />
</Form.Item>
</Col>
<Col span={18}>
<Form.Item
name='remark'
label='备注'
>
<TextArea disabled={isSee} rows={4} maxLength={60} />
</Form.Item>
</Col>
{
(pageStatus !== PageStatus.PREVIEW) &&
<Col span={18}>
<Row>
<Col span={6}></Col>
<Col span={18}>
<Button loading={loading} onClick={handleSubmitAllSetting} type="primary" style={{ marginTop: 32, marginBottom: 16, marginRight: 24 }}>
保存
</Button>
<Popconfirm
title="未保存,是否确定执行这个操作?"
onConfirm={handleCancel}
okText="是"
cancelText="否"
>
<Button style={{ marginTop: 32, marginBottom: 16 }}>
取消
</Button>
</Popconfirm>
</Col>
</Row>
</Col>
}
</Row>
</Form>)
}
</Card>
</Col>
</Row>
{/* <Modal
title="选择平台物流服务商"
width='800px'
visible={visible}
onOk={handleSelectOk}
onCancel={handleSelectCancel}
okText="确认"
cancelText="取消"
>
<Row>
<Col span={10}> <Input.Search placeholder="输入关键字进行搜索" /></Col>
<Col span={14}></Col>
</Row>
<StandardTable
columns={columns}
currentRef={ref}
rowSelection={{
type:'radio',
...rowSelection
}}
fetchTableData={(params: any) => fetchData(params)}
/>
</Modal> */}
<ModalTable
modalTitle='选择平台物流服务商'
confirm={handleSelectOk}
cancel={handleSelectCancel}
visible={visible}
columns={columns}
rowSelection={productRowSelection}
fetchTableData={params => fetchData(params)}
formilyProps={{
ctx: {
schema: formSearch
}
}}
tableProps={{
rowKey: 'memberId'
}}
>
</ModalTable>
</PageHeaderWrapper>
);
}
export default company;
......@@ -4,19 +4,20 @@
* @LastEditors: HJX
* @LastEditTime: 2020-11-19 15:25:54
*/
import React, { useState, useEffect} from 'react';
import React, { useState, useEffect } from 'react';
import { history } from 'umi';
import { Button, Card, Tabs, Space, Input } from 'antd';
import { PageHeaderWrapper } from '@ant-design/pro-layout';
import { PublicApi } from '@/services/api';
import PayWayRadio from './components/payWayRadio';
import PayWayTable from './components/payWayTable';
import { set } from 'mobx';
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 => {
......@@ -107,9 +108,9 @@ const PayWaySetTemplate: React.FC<{}> = () => {
setPayItem(data);
}
const onGet = (value:any, type:number, idx:number) => {
const onGet = (value: any, type: number, idx: number) => {
const data = [...payItem];
if(type === 1) {
if (type === 1) {
data[idx].payParametersAddListRequests = [...data[idx].payParametersAddListRequests, value]
} else {
data[idx].payParametersList.push(value)
......@@ -118,10 +119,10 @@ const PayWaySetTemplate: React.FC<{}> = () => {
}
/**删除 */
const onDel = (value:any, index:number, idx:number) => {
const onDel = (value: any, index: number, idx: number) => {
console.log(value, index, idx, 10086)
const data = [...payItem];
if(Number(value) === 1) {
if (Number(value) === 1) {
data[idx].payParametersAddListRequests.splice(index, 1);
data[idx].payParametersAddListRequests = [...data[idx].payParametersAddListRequests]
} else {
......@@ -131,14 +132,14 @@ const PayWaySetTemplate: React.FC<{}> = () => {
setPayItem([...data]);
}
/**编辑 */
const onEdit = (value:any, type:number, index:number, idx: number) => {
const onEdit = (value: any, type: number, index: number, idx: number) => {
console.log(value, type, index, idx)
const data = [...payItem];
if(type === 1) {
data[idx].payParametersAddListRequests[index] = {...value};
if (type === 1) {
data[idx].payParametersAddListRequests[index] = { ...value };
data[idx].payParametersAddListRequests = [...data[idx].payParametersAddListRequests]
} else {
data[idx].payParametersList[index] = {...value};
data[idx].payParametersList[index] = { ...value };
data[idx].payParametersList = [...data[idx].payParametersList]
}
console.log(data, 10086)
......@@ -150,12 +151,22 @@ const PayWaySetTemplate: React.FC<{}> = () => {
PublicApi.postPayMemberQueryPlatformUpdate({
platformPayWays: payItem
}).then(res => {
if(res.code === 1000) {
location.reload();
if (res.code === 1000) {
history.push('/memberCenter/payandSettle/paySetting/payParamsSetting')
// location.reload();
}
})
}
/** */
const handleBlur = (e, name, idx) => {
const data = [...payItem];
const assginObj = {...obj, ...{[name]: e.target.value}}
setObj(assginObj)
const arr: any[] = []
arr.push(assginObj)
data[idx].payParametersAddListRequests = [...arr]
}
return (
<PageHeaderWrapper
extra={<Button type='primary' onClick={onHnadleSubmit}>保存</Button>}
......@@ -189,16 +200,14 @@ const PayWaySetTemplate: React.FC<{}> = () => {
}
{
(payItem[idx].id === 6 && !!payItem[idx].isPitchOn) &&
payItem[idx].payParametersAddListRequests.map((item: any, index: number) => (
<div style={{ marginTop: 42 }} key={`space_${index}`}>
<Space direction="horizontal" size={16}>
初始申请额度不超过
<Input value={item.code} addonBefore="¥" />
允许满<Input value={item.value} />
天后申请上调<Input value={item.describe} addonAfter="%" />
</Space>
</div>
))
<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="¥" />
允许满<Input 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>
}
</>
......
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