Commit 36e94582 authored by 前端-彭佳文's avatar 前端-彭佳文

Merge branch 'v2-0418-transferOrder-molei' into 'v2-220418'

V2 0418 transfer order molei See merge request linkseeks-design/pro-platform!76
parents fbeba638 59a513c8
...@@ -23,21 +23,24 @@ interface AddressDrawerProps { ...@@ -23,21 +23,24 @@ interface AddressDrawerProps {
renderForm?: React.ReactNode renderForm?: React.ReactNode
sumbitRequest?: SumbitRequest sumbitRequest?: SumbitRequest
addressListRequest?: (values?: any) => Promise<any> addressListRequest?: (values?: any) => Promise<any>
value?: any
} }
function AddressDrawer(props: AddressDrawerProps) { function AddressDrawer(props: AddressDrawerProps) {
const { onChange, formInstance, renderForm, sumbitRequest, addressListRequest } = props; const { onChange, formInstance, renderForm, sumbitRequest, addressListRequest, value: addr } = props;
const [visible, setVisible] = useState<boolean>(false); const [visible, setVisible] = useState<boolean>(false);
const [showForm, setShowForm] = useState<boolean>(false); const [showForm, setShowForm] = useState<boolean>(false);
const [value, setValue] = useState(); const [value, setValue] = useState(addr);
const [addrForm] = Form.useForm(formInstance); const [addrForm] = Form.useForm(formInstance);
const [addrList, setAddrList] = useState([]); const [addrList, setAddrList] = useState([]);
useEffect(() => { useEffect(() => {
renderAddressList(); renderAddressList();
}, []) // props 更新 内部状态更新 用于FormItem 的操作
addr && setValue(addr);
}, [addr])
//地址提交 //地址提交
function sumbitAddressForm() { function sumbitAddressForm() {
...@@ -73,11 +76,19 @@ function AddressDrawer(props: AddressDrawerProps) { ...@@ -73,11 +76,19 @@ function AddressDrawer(props: AddressDrawerProps) {
form={addrForm} /> form={addrForm} />
} }
function renderAddressFormBtnGroup() {
if (showForm) {
return <Button type='primary' onClick={sumbitAddressForm}>提交</Button>
} else {
return <Button type='primary' onClick={() => { setVisible(false) }}>确认</Button>
}
}
return ( return (
<AddressRaioContextProvider value={addrList}> <AddressRaioContextProvider value={addrList}>
<Row gutter={10}> <Row gutter={10}>
<Col span={20}> <Col span={20}>
<Input.TextArea value={value}/> <Input.TextArea value={`${value?.fullAddress} ${value?.shipperName} ${value?.phone}`} />
</Col> </Col>
<Col span={4}> <Col span={4}>
...@@ -92,21 +103,19 @@ function AddressDrawer(props: AddressDrawerProps) { ...@@ -92,21 +103,19 @@ function AddressDrawer(props: AddressDrawerProps) {
title="地址管理" title="地址管理"
footer={ footer={
<Button.Group> <Button.Group>
<Button type='primary' onClick={sumbitAddressForm}>提交</Button> {renderAddressFormBtnGroup()}
</Button.Group> </Button.Group>
} }
> >
<Radio.Group className='w-full' onChange={(e) => { <Radio.Group className='w-full' onChange={(e) => {
const value = e.target.value; const value = e.target.value;
const inputV: any = Object.values(value).filter((v, index) => index > 0 && index < 4).join(' ') setValue(JSON.parse(value));
setValue(inputV); onChange(JSON.parse(value));
onChange(value)
}}> }}>
<Space className='w-full' direction="vertical"> <Space className='w-full' direction="vertical">
<AddressRaio <AddressRaio
servicePromise={props.addressListRequest}
onEdit={(addr) => { onEdit={(addr) => {
setShowForm(true) setShowForm(true)
addrForm.setFieldsValue(addr); addrForm.setFieldsValue(addr);
......
...@@ -13,12 +13,10 @@ export const AddressRaioContextProvider = AddressRaioContext.Provider; ...@@ -13,12 +13,10 @@ export const AddressRaioContextProvider = AddressRaioContext.Provider;
interface AddressRaioProps { interface AddressRaioProps {
onChange?: (value) => void onChange?: (value) => void
onEdit?: (address) => void onEdit?: (address) => void
servicePromise: (params?: any) => Promise<any>
} }
function AddressRaio(props: AddressRaioProps) { function AddressRaio(props: AddressRaioProps) {
const { onEdit } = props;
const { onChange, onEdit, servicePromise } = props;
const addrList = useContext(AddressRaioContext); const addrList = useContext(AddressRaioContext);
...@@ -27,7 +25,7 @@ function AddressRaio(props: AddressRaioProps) { ...@@ -27,7 +25,7 @@ function AddressRaio(props: AddressRaioProps) {
{addrList.map(addr => ( {addrList.map(addr => (
<div className='flex mb-14' key={addr.id}> <div className='flex mb-14' key={addr.id}>
<div className='_left felx-auto'> <div className='_left felx-auto'>
<Radio className={styles['antRadioWrapperItems']} value={addr}> <Radio className={styles['antRadioWrapperItems']} value={JSON.stringify(addr)}>
<div className='address_base ml-10'> <div className='address_base ml-10'>
<span>{addr.shipperName}</span> <span>{addr.shipperName}</span>
<span>{addr.phone}</span> <span>{addr.phone}</span>
...@@ -43,7 +41,7 @@ function AddressRaio(props: AddressRaioProps) { ...@@ -43,7 +41,7 @@ function AddressRaio(props: AddressRaioProps) {
<Button.Group size='small'> <Button.Group size='small'>
<Button onClick={() => { <Button onClick={() => {
if (onEdit) { if (onEdit) {
getLogisticsShipperAddressGet({id:addr.id}).then(res=>{ getLogisticsShipperAddressGet({ id: addr.id }).then(res => {
onEdit(res.data) onEdit(res.data)
}) })
} }
......
...@@ -7,7 +7,7 @@ function DatePickerSelect(props) { ...@@ -7,7 +7,7 @@ function DatePickerSelect(props) {
const { } = props; const { } = props;
const disabledDate = (current) => { const disabledDate = (current) => {
return current && current < moment().endOf('day'); return current && current < moment().startOf('day');
} }
return ( return (
......
...@@ -6,7 +6,7 @@ import { HarvestMaterialMock } from '../mock/HarvestMaterialMock'; ...@@ -6,7 +6,7 @@ import { HarvestMaterialMock } from '../mock/HarvestMaterialMock';
* HarvestMaterial table dataSource context,只限制使用HarvestMaterial Context * HarvestMaterial table dataSource context,只限制使用HarvestMaterial Context
*/ */
export const HarvestMaterialContext = React.createContext({ export const HarvestMaterialContext = React.createContext({
dataSource: HarvestMaterialMock dataSource: []
}) })
export const HarvestMaterialContextProvider = HarvestMaterialContext.Provider export const HarvestMaterialContextProvider = HarvestMaterialContext.Provider
......
...@@ -45,10 +45,12 @@ function DeliveryGoodTableModal(props: DeliveryGoodTableModalProps) { ...@@ -45,10 +45,12 @@ function DeliveryGoodTableModal(props: DeliveryGoodTableModalProps) {
let data = record; let data = record;
let combination = (record.orders as any[]).map(v => { let combination = (record.orders as any[]).map(v => {
return { let result = {
...record, ...record,
...v, ...v,
} }
delete result['orders']
return result
}) })
return ( return (
......
...@@ -4,7 +4,7 @@ ...@@ -4,7 +4,7 @@
* @description: 与B2B内容大致相同,文件分开方便后续对接以及日后变动修改二开 * @description: 与B2B内容大致相同,文件分开方便后续对接以及日后变动修改二开
*/ */
import AnchorPage, { AnchorsItem } from '@/components/AnchorPage' import AnchorPage, { AnchorsItem } from '@/components/AnchorPage'
import React, { useCallback, useState } from 'react' import React, { useCallback, useEffect, useState, useContext } from 'react'
import { BillsInfo, BuyerLabel, ConsigneeLabel, ConsigneePhoneLabel, ConsigneeTimeLabel, DeliveryAbstractLabel, DeliveryAddrLabel, DeliveryDateLabel, DeliveryGood, DeliveryInfo, DeliveryNameLabel, DeliveryNoLabel, DeliveryPhoneLabel, DeliverySlefAddrLabel, DeliveryTimeLabel, DeliveryTypeLabel, Distribution, LogisticsCarNoLabel, LogisticsCompanyLabel, LogisticsInfo, LogisticsNoLabel, NoteLabel, OutStatusLabel } from '../../constants' import { BillsInfo, BuyerLabel, ConsigneeLabel, ConsigneePhoneLabel, ConsigneeTimeLabel, DeliveryAbstractLabel, DeliveryAddrLabel, DeliveryDateLabel, DeliveryGood, DeliveryInfo, DeliveryNameLabel, DeliveryNoLabel, DeliveryPhoneLabel, DeliverySlefAddrLabel, DeliveryTimeLabel, DeliveryTypeLabel, Distribution, LogisticsCarNoLabel, LogisticsCompanyLabel, LogisticsInfo, LogisticsNoLabel, NoteLabel, OutStatusLabel } from '../../constants'
import { BaseInfo as ContentBox } from '@/components/BaseInfo' import { BaseInfo as ContentBox } from '@/components/BaseInfo'
import { Input, Table, Row, Col, Select, Radio, Form, Button } from 'antd'; import { Input, Table, Row, Col, Select, Radio, Form, Button } from 'antd';
...@@ -15,13 +15,41 @@ import DatePicker from '@/components/DatePicker'; ...@@ -15,13 +15,41 @@ import DatePicker from '@/components/DatePicker';
import { AddressDrawer } from '@/components/AddressDrawer'; import { AddressDrawer } from '@/components/AddressDrawer';
import { getLogisticsSelectListShipperAddress, postLogisticsShipperAddressAdd, postLogisticsShipperAddressUpdate } from '@/services/LogisticsV2Api'; import { getLogisticsSelectListShipperAddress, postLogisticsShipperAddressAdd, postLogisticsShipperAddressUpdate } from '@/services/LogisticsV2Api';
import DeliveryGoodTableSelect from '../../components/DeliveryGoodTableSelect/DeliveryGoodTableSelect'; import DeliveryGoodTableSelect from '../../components/DeliveryGoodTableSelect/DeliveryGoodTableSelect';
import { HarvestMaterialContextProvider } from '../../assets/context'; import { HarvestMaterialContextProvider, HarvestMaterialContext } from '../../assets/context';
import moment from 'moment';
const ContentBoxItem = ContentBox.BaseInfoItem; const ContentBoxItem = ContentBox.BaseInfoItem;
const DeliveryNoticeManageSRMDetails: React.FC = () => { const DeliveryNoticeManageSRMDetails: React.FC = () => {
const [tableDataSource, setTableDataSource] = useState([]); const [tableDataSource, setTableDataSource] = useState([
{
"skuId": "demoData",
"productNo": "demoData",
"orderProductId": 2,
"productName": "demoData",
"spec": "demoData",
"category": "demoData",
"brand": "demoData",
"unit": "demoData",
"purchaseCount": 1,
"receiveCount": 1,
"transitCount": 1,
"leftCount": 1,
"planCount": 1,
"orderNo": "demoData2",
"orderDigest": "demoData",
"consigneeId": 1,
"consignee": "demoData",
"provinceName": "demoData",
"cityName": "demoData",
"districtName": "demoData",
"streetName": "demoData",
"address": "demoData",
"phone": "demoData"
}
]);
const dataSource$ = useContext(HarvestMaterialContext)
const [form] = Form.useForm() const [form] = Form.useForm()
const [anchors, setAnchors] = useState<AnchorsItem[]>([ const [anchors, setAnchors] = useState<AnchorsItem[]>([
...@@ -32,16 +60,46 @@ const DeliveryNoticeManageSRMDetails: React.FC = () => { ...@@ -32,16 +60,46 @@ const DeliveryNoticeManageSRMDetails: React.FC = () => {
DeliveryGood, DeliveryGood,
]) ])
const handleSubmit = useCallback(() => { const initData = {
console.log(form.getFieldsValue()) "digest": "11",
"remark": "22",
"buyerMemberId": "333",
"deliveryTime": moment('2015-01-14'),
"executorVO.consignee": "莫雷 ",
"deliveryRangeTime": [
moment('2015-01-15'),
moment('2015-01-16')
],
"executorVO.phone": "13286326255",
"sendTime": moment('2015-01-14 08:25:21'),
"receiveVO": {
"id": 5,
"shipperName": "李工",
"fullAddress": "天津市天津市河东区和平路",
"phone": "18800000000",
"isDefault": 1
},
"deliveryType": 1,
"executorVO.carNumbers": "11234",
"logisticsCompanyId": null,
"logisticsNo": "112334"
}
useEffect(() => {
form.setFieldsValue(initData)
}, []) }, [])
const handleSubmit = useCallback(() => {
// console.log(form.getFieldsValue())
console.log(tableDataSource)
}, [form, tableDataSource])
return ( return (
<AnchorPage title="送货单管理详情(SRM)" <AnchorPage title="送货单管理详情(SRM)"
anchors={anchors} anchors={anchors}
extra={ extra={
<Button.Group> <Button.Group>
<Button onClick={handleSubmit}>提交</Button> <Button onClick={handleSubmit} type='primary'>提交</Button>
</Button.Group> </Button.Group>
} }
> >
...@@ -72,7 +130,7 @@ const DeliveryNoticeManageSRMDetails: React.FC = () => { ...@@ -72,7 +130,7 @@ const DeliveryNoticeManageSRMDetails: React.FC = () => {
<Input /> <Input />
</FormItem> </FormItem>
<FormItem label={DeliveryTimeLabel} name="deliveryTime"> <FormItem label={DeliveryTimeLabel} name="deliveryRangeTime">
<DatePickerSelect.RangePicker className="w-full" picker='time' /> <DatePickerSelect.RangePicker className="w-full" picker='time' />
</FormItem> </FormItem>
...@@ -87,10 +145,6 @@ const DeliveryNoticeManageSRMDetails: React.FC = () => { ...@@ -87,10 +145,6 @@ const DeliveryNoticeManageSRMDetails: React.FC = () => {
</FormItem> </FormItem>
<FormItem label={DeliveryAddrLabel} name="receiveVO"> <FormItem label={DeliveryAddrLabel} name="receiveVO">
<Input />
</FormItem>
<FormItem name="receiveVO" label={DeliverySlefAddrLabel}>
<AddressDrawer <AddressDrawer
addressListRequest={(val) => { addressListRequest={(val) => {
return getLogisticsSelectListShipperAddress(val) return getLogisticsSelectListShipperAddress(val)
...@@ -114,7 +168,7 @@ const DeliveryNoticeManageSRMDetails: React.FC = () => { ...@@ -114,7 +168,7 @@ const DeliveryNoticeManageSRMDetails: React.FC = () => {
<Radio.Group> <Radio.Group>
<Radio.Button value={1}>物流</Radio.Button> <Radio.Button value={1}>物流</Radio.Button>
<Radio.Button value={2}>自提</Radio.Button> <Radio.Button value={2}>自提</Radio.Button>
<Radio.Button value={3}>无效配送</Radio.Button> {/* <Radio.Button value={3}>无效配送</Radio.Button> */}
</Radio.Group> </Radio.Group>
</FormItem> </FormItem>
......
function HandelFormFieldsKeyValue() {
}
\ No newline at end of file
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