Commit 4bcdea5e 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!60
parents e4782c65 ed06dd7f
import { Button, Col, Drawer, Form, FormInstance, Input, Radio, Row, Select, Space } from 'antd';
import React, { useState } from 'react';
import React, { useContext, useEffect, useState } from 'react';
import AddressForm from './AddressForm';
import AddressRaio from './AddressRaio';
import AddressRaio, { AddressRaioContext, AddressRaioContextProvider } from './AddressRaio';
import AreaSet from './AreaSet';
interface SumbitRequest {
add: (values?: any) => Promise<any>
update: (values?: any) => Promise<any>
}
/**
* AddressDrawerProps的器
......@@ -15,35 +21,63 @@ interface AddressDrawerProps {
onChange?: (val) => void
formInstance?: FormInstance
renderForm?: React.ReactNode
sumbitRequest?: <T>(values?: any) => Promise<T>
addressListRequest?: <T>(values?: any) => Promise<T>
sumbitRequest?: SumbitRequest
addressListRequest?: (values?: any) => Promise<any>
}
function AddressDrawer(props: AddressDrawerProps) {
const { onChange, formInstance, renderForm } = props;
const { onChange, formInstance, renderForm, sumbitRequest, addressListRequest } = props;
const [visible, setVisible] = useState<boolean>(false);
const [showForm, setShowForm] = useState<boolean>(false);
const [value, setValue] = useState();
const [addrForm] = Form.useForm(formInstance);
const [addrList, setAddrList] = useState([]);
useEffect(() => {
renderAddressList();
}, [])
//地址提交
function sumbitAddressForm() {
addrForm.validateFields().then(values => {
console.log(values);
values.isDefault = values.isDefault ? 1 : 0;
values.provinceName = AreaSet.getInstance().getProvinceNameByCode(values.provinceCode)
values.cityName = AreaSet.getInstance().getCityNameByCode(values.cityCode)
values.districtName = AreaSet.getInstance().getDistrictNameByCode(values.districtCode)
values.streetName = AreaSet.getInstance().getStreetNameByCode(values.streetCode)
values.id ?
handleSumbitRequest(sumbitRequest.update(values)) :
handleSumbitRequest(sumbitRequest.add(values))
})
}
function renderAddressList() {
addressListRequest().then(res => {
setAddrList(res.data);
})
}
function handleSumbitRequest(promise: Promise<any>) {
promise.then(res => {
renderAddressList()
setShowForm(false)
})
}
function renderAddressForm() {
return renderForm ? renderForm : <AddressForm form={addrForm} />
return renderForm ?
renderForm :
<AddressForm
form={addrForm} />
}
return (
<>
<AddressRaioContextProvider value={addrList}>
<Row gutter={10}>
<Col span={20}>
<Input value={value} />
<Input.TextArea value={value}/>
</Col>
<Col span={4}>
......@@ -64,12 +98,16 @@ function AddressDrawer(props: AddressDrawerProps) {
>
<Radio.Group className='w-full' onChange={(e) => {
setValue(e.target.value);
onChange(e.target.value)
const value = e.target.value;
const inputV: any = Object.values(value).filter((v, index) => index > 0 && index < 4).join(' ')
setValue(inputV);
onChange(value)
}}>
<Space className='w-full' direction="vertical">
<AddressRaio onEdit={(addr) => {
<AddressRaio
servicePromise={props.addressListRequest}
onEdit={(addr) => {
setShowForm(true)
addrForm.setFieldsValue(addr);
}} />
......@@ -81,8 +119,7 @@ function AddressDrawer(props: AddressDrawerProps) {
{showForm && renderAddressForm()}
</Drawer>
</>
</AddressRaioContextProvider>
);
}
......
import { PATTERN_MAPS } from '@/constants/regExp';
import { getManageAreaByPcode } from '@/services/ManageV2Api';
import { Cascader, Form, FormInstance, Input, Select, Switch } from 'antd';
import React, { useEffect } from 'react';
import React, { useEffect, useState } from 'react';
import AreaSet from './AreaSet';
const FormItem = Form.Item;
......@@ -11,27 +13,141 @@ interface addrFormProps {
function AddressForm(props: addrFormProps) {
const [selfForm] = Form.useForm(props.form)
const [province, setProvince] = useState([]);
const [city, setCity] = useState([])
const [district, setDistrict] = useState([])
const [street, setStreet] = useState([])
useEffect(() => {
fetchData().then(res => {
setProvince(res)
AreaSet.getInstance().setArea('province', res)
const id = selfForm.getFieldValue('id')
if (id) {
//如果是编辑需要把子的select 也请求
const provinceCode = selfForm.getFieldValue('provinceCode');
fetchData(provinceCode).then(city => {
setCity(city)
AreaSet.getInstance().setArea('city', city)
fetchData(city[0].value).then(district => {
setDistrict(district)
AreaSet.getInstance().setArea('district', district)
fetchData(district[0].value).then(street => {
AreaSet.getInstance().setArea('street', street)
setStreet(street)
})
})
})
}
})
}, [])
/**
* 获取地区ID下的所有字菜单
* @param id 地区ID
* @returns
*/
const fetchData = (id?: string): Promise<any> => {
return getManageAreaByPcode({ pcode: id }).then(res => res.data.map(v => ({
label: v.name,
value: v.code
})))
}
const handleSelectChange = (v, upTarget: string) => {
if (upTarget === 'city') {
fetchData(v).then(city => {
selfForm.setFieldsValue({ cityCode: '', districtCode: '', streetCode: '' })
setCity(city)
AreaSet.getInstance().setArea('city', city)
fetchData(city[0].value).then(district => {
setDistrict(district)
AreaSet.getInstance().setArea('district', district)
fetchData(district[0].value).then(street => {
AreaSet.getInstance().setArea('street', street)
setStreet(street)
})
})
})
}
if (upTarget === 'district') {
fetchData(v).then(district => {
selfForm.setFieldsValue({ districtCode: '', streetCode: '' })
setDistrict(district)
AreaSet.getInstance().setArea('district', district)
fetchData(district[0].value).then(street => {
AreaSet.getInstance().setArea('street', street)
setStreet(street)
})
})
}
if (upTarget === 'street') {
fetchData(v).then(street => {
selfForm.setFieldsValue({ streetCode: '' })
setStreet(street)
AreaSet.getInstance().setArea('street', street)
})
}
}
return (
<Form style={{ marginTop: 32 }}
layout="vertical"
form={selfForm}
>
<FormItem label="收货人" name="name" rules={[
<FormItem name="id" >
<Input type="hidden" />
</FormItem>
<FormItem label="收货人" name="shipperName" rules={[
{ required: true }
]}>
<Input />
</FormItem>
<FormItem label="收货人" name="cons" rules={[
<div className='mt-16'>
<div className='text-gray-400'>收货地址 <span className='text-red-500' style={{ fontFamily: "SimSun, sans-serif" }}>*</span></div>
<div className='grid gap-5 mt-5 grid-cols-4'>
<FormItem name="provinceCode" rules={[
{ required: true }
]}>
<Select className='w-full' options={province} onChange={(v) => handleSelectChange(v, 'city')} />
</FormItem>
<FormItem name="cityCode" rules={[
{ required: true }
]}>
<Select className='w-full' options={city} onChange={(v) => handleSelectChange(v, 'district')} />
</FormItem>
<FormItem name="districtCode" rules={[
{ required: true }
]}>
<Cascader />
<Select className='w-full' options={district} onChange={(v) => handleSelectChange(v, 'street')} />
</FormItem>
<FormItem name="streetCode" rules={[
{ required: true }
]}>
<Select className='w-full' options={street} />
</FormItem>
</div>
</div>
<FormItem label="收货地址详情" name="address" rules={[
{ required: true }
]}>
<Input />
</FormItem>
<div className='mt-16'>
<div className='text-gray-400'>法人手机号 <span className='text-red-500' style={{ fontFamily: "SimSun, sans-serif" }}>*</span></div>
<div className='flex gap-5 mt-5'>
......@@ -62,7 +178,7 @@ function AddressForm(props: addrFormProps) {
<Switch />
</FormItem>
</Form>
</Form >
)
}
......
import { getLogisticsShipperAddressGet } from '@/services/LogisticsV2Api';
import { Radio, Button } from 'antd'
import React from 'react'
import React, { useContext, useEffect, useState } from 'react'
import styles from './AddressDrawer.less'
export const AddressRaioContext = React.createContext([]);
export const AddressRaioContextProvider = AddressRaioContext.Provider;
/**
* FormItem 修个值
*/
interface AddressRaioProps {
onChange?: (value) => void
onEdit?: (address) => void
servicePromise: (params?: any) => Promise<any>
}
function AddressRaio(props: AddressRaioProps) {
const { onChange, onEdit } = props;
const { onChange, onEdit, servicePromise } = props;
const addrList = useContext(AddressRaioContext);
return (
<>
{[1, 2, 3, 4].map(addr => (
<div className='flex mb-14'>
{addrList.map(addr => (
<div className='flex mb-14' key={addr.id}>
<div className='_left felx-auto'>
<Radio className={styles['antRadioWrapperItems']} value={addr}>
<div className='address_base ml-10'>
<span>蒯美政</span>
<span>185 2929 6758</span>
<span>默认地址</span>
<span>{addr.shipperName}</span>
<span>{addr.phone}</span>
{addr.isDefault === 1 && <span>默认地址</span>}
</div>
<div className='address_decs ml-10'>
广东省广州市海珠区新港东路1068号中洲中心北塔6楼
{addr.fullAddress}
</div>
</Radio>
</div>
......@@ -34,7 +43,9 @@ function AddressRaio(props: AddressRaioProps) {
<Button.Group size='small'>
<Button onClick={() => {
if (onEdit) {
onEdit({ name: 'molei' })
getLogisticsShipperAddressGet({id:addr.id}).then(res=>{
onEdit(res.data)
})
}
}}>
编辑
......
class AreaSet {
static #instance;
#area = new Map();
static getInstance(): AreaSet {
if (!this.#instance) {
this.#instance = new AreaSet()
}
return this.#instance;
}
setArea(key: string, value: any) {
this.#area.set(key, value);
}
getName(key: string, code: string) {
const provinces = this.#area.get(key)
console.log(key,provinces)
for (const province of provinces) {
if (province.value == code) {
return province.label
}
}
}
getProvinceNameByCode(code: string) {
return this.getName('province',code);
}
getCityNameByCode(code: string) {
return this.getName('city',code);
}
getDistrictNameByCode(code: string) {
return this.getName('district',code);
}
getStreetNameByCode(code: string) {
return this.getName('street',code);
}
}
export default AreaSet
\ No newline at end of file
......@@ -21,6 +21,7 @@ export function HarvestMaterialInput(props: {
value: any, //input 显示的值
index: number // table 当前的 index下标
keyUp: string // dataSource 对应的row key
min?: number
}) {
const context = useContext(HarvestMaterialContext);
......@@ -35,5 +36,5 @@ export function HarvestMaterialInput(props: {
setInputVal(targetVal)
}
return <Input value={inputVal} onChange={handleChange} />
return <Input {...props} value={inputVal} onChange={handleChange} />
}
\ No newline at end of file
import { isDev } from '@/constants';
import { getOrderDeliveryPlanOrderSrmProductPage } from '@/services/OrderNewV2Api';
import DeliveryGoodTableSelectMock from '../mock/DeliveryGoodTableSelectMock';
class DeliveryNoticeOrder {
getOrderDeliveryPlanProduct() {
if (isDev) {
return Promise.resolve({
data: DeliveryGoodTableSelectMock
});
}
return getOrderDeliveryPlanOrderSrmProductPage().then(res => {
return res.data;
})
}
}
class DeliveryNoticeOrderFactory {
#instance
static getInstance() {
return new DeliveryNoticeOrder();
}
}
export default DeliveryNoticeOrderFactory;
\ No newline at end of file
export default [
{
"skuId": "demoData",
"productNo": "demoData",
"orderProductId": 1,
"productName": "demoData",
"spec": "demoData",
"category": "demoData",
"brand": "demoData",
"unit": "demoData",
"purchaseCount": 1,
"receiveCount": 1,
"transitCount": 1,
"leftCount": 1,
"planCount": 1,
"orders": [
{
"orderNo": "demoData1",
"orderProductId": 1,
"orderDigest": "demoData",
"purchaseCount": 1,
"receiveCount": 1,
"transitCount": 1,
"leftCount": 1,
"planCount": 1,
"consigneeId": 1,
"consignee": "demoData",
"provinceName": "demoData",
"cityName": "demoData",
"districtName": "demoData",
"streetName": "demoData",
"address": "demoData",
"phone": "demoData"
},
{
"orderNo": "demoData2",
"orderProductId": 2,
"orderDigest": "demoData",
"purchaseCount": 1,
"receiveCount": 1,
"transitCount": 1,
"leftCount": 1,
"planCount": 1,
"consigneeId": 1,
"consignee": "demoData",
"provinceName": "demoData",
"cityName": "demoData",
"districtName": "demoData",
"streetName": "demoData",
"address": "demoData",
"phone": "demoData"
},
{
"orderNo": "demoData3",
"orderProductId": 3,
"orderDigest": "demoData",
"purchaseCount": 1,
"receiveCount": 1,
"transitCount": 1,
"leftCount": 1,
"planCount": 1,
"consigneeId": 1,
"consignee": "demoData",
"provinceName": "demoData",
"cityName": "demoData",
"districtName": "demoData",
"streetName": "demoData",
"address": "demoData",
"phone": "demoData"
}
]
},
{
"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,
"orders": [
{
"orderNo": "demoData4",
"orderProductId": 4,
"orderDigest": "demoData",
"purchaseCount": 1,
"receiveCount": 1,
"transitCount": 1,
"leftCount": 1,
"planCount": 1,
"consigneeId": 1,
"consignee": "demoData",
"provinceName": "demoData",
"cityName": "demoData",
"districtName": "demoData",
"streetName": "demoData",
"address": "demoData",
"phone": "demoData"
},
{
"orderNo": "demoData5",
"orderProductId": 5,
"orderDigest": "demoData",
"purchaseCount": 1,
"receiveCount": 1,
"transitCount": 1,
"leftCount": 1,
"planCount": 1,
"consigneeId": 1,
"consignee": "demoData",
"provinceName": "demoData",
"cityName": "demoData",
"districtName": "demoData",
"streetName": "demoData",
"address": "demoData",
"phone": "demoData"
},
{
"orderNo": "demoData6",
"orderProductId": 6,
"orderDigest": "demoData",
"purchaseCount": 1,
"receiveCount": 1,
"transitCount": 1,
"leftCount": 1,
"planCount": 1,
"consigneeId": 1,
"consignee": "demoData",
"provinceName": "demoData",
"cityName": "demoData",
"districtName": "demoData",
"streetName": "demoData",
"address": "demoData",
"phone": "demoData"
}
]
}
]
\ No newline at end of file
import { Button, Drawer, Table } from "antd";
import { isNull } from "lodash";
import { useCallback, useEffect, useLayoutEffect, useState } from "react";
import DeliveryNoticeOrderFactory from "../../assets/handles/DeliveryNoticeOrder";
import { PlannedDeliveryMaterialExpandableTableColumn, PlannedDeliveryMaterialTableColumn } from "../../constants/page-table-column";
import ExpandedRowTableRender from "./ExpandedRowTableRender";
interface DeliveryGoodTableModalProps {
onChange: (value) => void
}
function DeliveryGoodTableModal(props: DeliveryGoodTableModalProps) {
const { onChange } = props;
const [visible, setVisible] = useState(false)
const service = DeliveryNoticeOrderFactory.getInstance()
const [tableData, setTableData] = useState([])
const selectedRowKeys = new Map()
const handleVisible = useCallback(() => {
setVisible(true)
}, [visible])
const handleSubmit = useCallback(() => {
let result = []
for (const v of selectedRowKeys) {
result.push(...v[1])
}
setVisible(false)
onChange(result)
}, [visible])
useEffect(() => {
service.getOrderDeliveryPlanProduct().then(res => {
if (isNull(res)) return;
const data = res.data
setTableData(data)
})
}, [])
const expandedRowRender = (record, index) => {
let data = record;
let combination = (record.orders as any[]).map(v => {
return {
...record,
...v,
}
})
return (
<ExpandedRowTableRender
row={index}
dataSource={combination}
onChange={(keys, index) => {
selectedRowKeys.set(index, keys);
}}
/>
);
}
return (
<>
<div className='mt-16'>
<Button onClick={handleVisible}>选择物流</Button>
</div>
<Drawer
title="选择送货物料"
visible={visible}
width="90vw"
onClose={() => { setVisible(false) }}
footer={
<Button.Group>
<Button type="primary" onClick={handleSubmit}>确认</Button>
</Button.Group>
}
>
<Table
columns={PlannedDeliveryMaterialTableColumn}
rowKey={row => row.orderProductId}
dataSource={tableData}
expandedRowRender={expandedRowRender}
/>
</Drawer>
</>
);
}
export default DeliveryGoodTableModal;
\ No newline at end of file
import { Table } from "antd";
import { useState } from "react";
import { PlannedDeliveryMaterialExpandableTableColumn } from "../../constants/page-table-column";
/**
* 子table渲染
* @param dataSource
* @param row 下标index
* @param selectedRowKeys 勾选的值 callback func
*/
interface ExpandedRowTableRenderProps {
dataSource: any[],
row?: number,
onChange?: (selectedRowKeys, index?: number) => void
}
function ExpandedRowTableRender(props: ExpandedRowTableRenderProps) {
const { row = 0, onChange } = props;
const [selectedRowKeys, setSelectedRowKeys] = useState([]);
const onSelectChange = (selectedRowKeys: any[]) => {
setSelectedRowKeys(selectedRowKeys)
let result = props.dataSource.filter(v => selectedRowKeys.includes(v.orderNo));
onChange(result, row)
};
const rowSelection = {
selectedRowKeys,
onChange: onSelectChange,
};
return (
<Table
rowSelection={rowSelection}
dataSource={props.dataSource}
rowKey={record => record.orderNo}
columns={PlannedDeliveryMaterialExpandableTableColumn}
pagination={false}
/>
);
}
export default ExpandedRowTableRender
\ No newline at end of file
export { default as DeliveryGoodTableModal } from './DeliveryGoodTableSelect'
\ No newline at end of file
......@@ -5,7 +5,7 @@
import { HarvestMaterialInput } from "../assets/context";
import { BrandColumn, ClassColumn, CommodityIdColumn, ConsigneeNumColumn, DeliveredNumColumn, DeliveryNumColumn, FlowNoteColumn, FlowOnColumn, FlowOptionsColumn, FlowOptionsTimeColumn, FlowRoleColumn, FlowStatusColumn, MaterialModelColumn, MaterialNameColumn, MaterialNoColumn, OrderCreatedAtColumn, OrderNoColumn, OrderSummaryColumn, OredrNumColumn, PlannedDeliveryNumColumn, TradeNameColumn, TransitNumColumn, UntilColumn } from "./table-column";
export const DeliveryNoteAddFromTableColumn = [
export const DeliveryNoteAddFromTableColumn: any = [
MaterialNoColumn,
MaterialNameColumn,
ClassColumn,
......@@ -27,7 +27,7 @@ export const DeliveryNoteAddFromTableColumn = [
}
]
export const OutStatusLogTableColumn = [
export const OutStatusLogTableColumn: any = [
FlowOnColumn,
FlowRoleColumn,
FlowStatusColumn,
......@@ -46,34 +46,45 @@ export const DeliveryNoticeTableColumn: any = [
OrderNoColumn,
OrderCreatedAtColumn,
OredrNumColumn,
DeliveryNumColumn
{
...DeliveryNumColumn,
render: (t, rcode, index) => {
return (
<HarvestMaterialInput
value={rcode[OredrNumColumn.key]}
index={index}
keyUp="deliveryCount"
/>
)
}
}
];
// 计划送货物料表格
export const PlannedDeliveryMaterialTableColumn: any = [
{ dataIndex: 'name1', width: 80, ...MaterialNoColumn, },
{ dataIndex: 'name2', width: 192, ...MaterialNameColumn, },
{ dataIndex: 'name3', width: 128, ...MaterialModelColumn, },
{ dataIndex: 'name4', width: 96, ...ClassColumn, },
{ dataIndex: 'name5', width: 96, ...BrandColumn, },
{ dataIndex: 'name6', width: 64, ...UntilColumn, },
{ dataIndex: 'name7', width: 96, ...OredrNumColumn, },
{ dataIndex: 'name8', width: 96, ...ConsigneeNumColumn, },
{ dataIndex: 'name9', width: 96, ...TransitNumColumn, },
{ dataIndex: 'name10', width: 96, ...DeliveredNumColumn, },
{ dataIndex: 'name11', width: 128, ...PlannedDeliveryNumColumn, },
{ dataIndex: 'skuId', width: 80, ...MaterialNoColumn, },
{ dataIndex: 'productName', width: 192, ...MaterialNameColumn, },
{ dataIndex: 'spec', width: 128, ...MaterialModelColumn, },
{ dataIndex: 'category', width: 96, ...ClassColumn, },
{ dataIndex: 'brand', width: 96, ...BrandColumn, },
{ dataIndex: 'unit', width: 64, ...UntilColumn, },
{ dataIndex: 'purchaseCount', width: 96, ...OredrNumColumn, },
{ dataIndex: 'receiveCount', width: 96, ...ConsigneeNumColumn, },
{ dataIndex: 'transitCount', width: 96, ...TransitNumColumn, },
{ dataIndex: 'leftCount', width: 96, ...DeliveredNumColumn, },
{ dataIndex: 'planCount', width: 128, ...PlannedDeliveryNumColumn, },
];
// 计划送货物料子表格
export const PlannedDeliveryMaterialExpandableTableColumn: any = [
{ dataIndex: 'name1', ...OrderNoColumn, },
{ dataIndex: 'name2', ...OrderSummaryColumn, },
{ dataIndex: 'name3', ...OrderCreatedAtColumn, },
{ dataIndex: 'name4', ...OredrNumColumn, },
{ dataIndex: 'name5', ...ConsigneeNumColumn, },
{ dataIndex: 'name6', ...TransitNumColumn, },
{ dataIndex: 'name7', ...DeliveredNumColumn, },
{ dataIndex: 'name8', ...PlannedDeliveryNumColumn, },
{ dataIndex: 'orderNo', ...OrderNoColumn, },
{ dataIndex: 'orderDigest', ...OrderSummaryColumn, },
{ dataIndex: 'createTime', ...OrderCreatedAtColumn, },
{ dataIndex: 'purchaseCount', ...OredrNumColumn, },
{ dataIndex: 'receiveCount', ...ConsigneeNumColumn, },
{ dataIndex: 'transitCount', ...TransitNumColumn, },
{ dataIndex: 'leftCount', ...DeliveredNumColumn, },
{ dataIndex: 'planCount', ...PlannedDeliveryNumColumn, },
];
// 外部单据流转记录
......
......@@ -6,8 +6,8 @@ import dayjs from "dayjs"
*/
export const CommodityIdColumn: any = {
title: '商品ID',
dataIndex: 'productId',
key: 'productId',
dataIndex: 'orderProductId',
key: 'orderProductId',
align: 'center',
}
......@@ -20,16 +20,22 @@ export const TradeNameColumn: any = {
export const MaterialNoColumn: any = {
title: '物料编号',
dataIndex: 'orderProductId',
key: 'orderProductId',
align: 'center',
}
export const MaterialNameColumn: any = {
title: '物料名称',
dataIndex: 'productName',
key: 'productName',
align: 'center',
}
export const MaterialModelColumn: any = {
title: '规格型号',
dataIndex: 'spec',
key: 'spec',
align: 'center',
}
......@@ -81,8 +87,7 @@ export const OredrNumColumn: any = {
export const DeliveryNumColumn: any = {
title: '送货数量',
dataIndex: 'deliveryCount',
key: 'deliveryCount',
width: 100,
align: 'center',
}
......
......@@ -4,19 +4,26 @@
* @description: 与B2B内容大致相同,文件分开方便后续对接以及日后变动修改二开
*/
import AnchorPage, { AnchorsItem } from '@/components/AnchorPage'
import React, { useState } from 'react'
import React, { useCallback, useState } 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 { BaseInfo as ContentBox } from '@/components/BaseInfo'
import { Input, Table, Row, Col, Select, Radio, Form } from 'antd';
import { Input, Table, Row, Col, Select, Radio, Form, Button } from 'antd';
import { DeliveryNoticeTableColumn } from '../../constants/page-table-column';
import { FormItem } from '@/components/FormItem';
import { DatePickerSelect } from '@/components/DatePickerSelect'
import DatePicker from '@/components/DatePicker';
import { AddressDrawer } from '@/components/AddressDrawer';
import { getLogisticsSelectListShipperAddress, postLogisticsShipperAddressAdd, postLogisticsShipperAddressUpdate } from '@/services/LogisticsV2Api';
import DeliveryGoodTableSelect from '../../components/DeliveryGoodTableSelect/DeliveryGoodTableSelect';
import { HarvestMaterialContextProvider } from '../../assets/context';
const ContentBoxItem = ContentBox.BaseInfoItem;
const DeliveryNoticeManageSRMDetails: React.FC = () => {
const [tableDataSource, setTableDataSource] = useState([]);
const [form] = Form.useForm()
const [anchors, setAnchors] = useState<AnchorsItem[]>([
BillsInfo,
Distribution,
......@@ -25,87 +32,122 @@ const DeliveryNoticeManageSRMDetails: React.FC = () => {
DeliveryGood,
])
const handleSubmit = useCallback(() => {
console.log(form.getFieldsValue())
}, [])
return (
<AnchorPage title="送货单管理详情(SRM)"
anchors={anchors}
extra={
<Button.Group>
<Button onClick={handleSubmit}>提交</Button>
</Button.Group>
}
>
<Form
form={form}
>
<Form>
<ContentBox title={BillsInfo.name} id={BillsInfo.key}>
<FormItem label={DeliveryAbstractLabel}>
<FormItem label={DeliveryAbstractLabel} name="digest">
<Input />
</FormItem>
<FormItem label={NoteLabel}>
<FormItem label={NoteLabel} name="remark">
<Input />
</FormItem>
<FormItem label={BuyerLabel}>
<FormItem label={BuyerLabel} name="buyerMemberId">
<Input />
</FormItem>
</ContentBox>
<ContentBox title={Distribution.name} id={Distribution.key}>
<FormItem label={DeliveryDateLabel}>
<FormItem label={DeliveryDateLabel} name="deliveryTime">
<DatePickerSelect className='w-full' />
</FormItem>
<FormItem label={DeliveryNameLabel}>
<FormItem label={DeliveryNameLabel} name="executorVO.consignee">
<Input />
</FormItem>
<FormItem label={DeliveryTimeLabel}>
<FormItem label={DeliveryTimeLabel} name="deliveryTime">
<DatePickerSelect.RangePicker className="w-full" picker='time' />
</FormItem>
<FormItem label={DeliveryPhoneLabel}>
<FormItem label={DeliveryPhoneLabel} name="executorVO.phone">
<Input />
</FormItem>
</ContentBox>
<ContentBox title={DeliveryInfo.name} id={DeliveryInfo.key}>
<FormItem label={ConsigneeTimeLabel}>
<FormItem label={ConsigneeTimeLabel} name="sendTime">
<DatePickerSelect className="w-full" />
</FormItem>
<FormItem label={DeliveryAddrLabel}>
<FormItem label={DeliveryAddrLabel} name="receiveVO">
<Input />
</FormItem>
<FormItem name={"DeliverySlefAddrLabel"} label={DeliverySlefAddrLabel}>
<AddressDrawer />
<FormItem name="receiveVO" label={DeliverySlefAddrLabel}>
<AddressDrawer
addressListRequest={(val) => {
return getLogisticsSelectListShipperAddress(val)
}}
sumbitRequest={{
update: (val) => {
return postLogisticsShipperAddressUpdate(val)
},
add: (val) => {
return postLogisticsShipperAddressAdd(val)
}
}}
/>
</FormItem>
</ContentBox>
<ContentBox title={LogisticsInfo.name} id={LogisticsInfo.key}>
<FormItem label={DeliveryTypeLabel}>
<FormItem label={DeliveryTypeLabel} name="deliveryType">
<Radio.Group>
<Radio.Button value={1}>物流</Radio.Button>
<Radio.Button value={2}>自提</Radio.Button>
<Radio.Button value={3}>无效配送</Radio.Button>
</Radio.Group>
</FormItem>
<FormItem label={LogisticsCarNoLabel}>
<FormItem label={LogisticsCarNoLabel} name="executorVO.carNumbers">
<Input />
</FormItem>
<FormItem label={LogisticsCompanyLabel}>
<FormItem label={LogisticsCompanyLabel} name="logisticsCompanyId">
<Select>
<Select.Option>顺丰快递</Select.Option>
</Select>
</FormItem>
<FormItem label={LogisticsNoLabel}>
<FormItem label={LogisticsNoLabel} name="logisticsNo">
<Input />
</FormItem>
</ContentBox>
<ContentBox title={DeliveryGood.name} id={DeliveryGood.key} cols={1}>
<Table columns={DeliveryNoticeTableColumn} />
<DeliveryGoodTableSelect
onChange={(value) => {
setTableDataSource(value)
}}
/>
<HarvestMaterialContextProvider value={{
dataSource: tableDataSource
}}>
<Table
rowKey={row => row.orderNo}
columns={DeliveryNoticeTableColumn}
dataSource={tableDataSource}
/>
</HarvestMaterialContextProvider>
</ContentBox>
</Form>
......
......@@ -19,6 +19,7 @@ import { deliveryNoticeManageSRMSchema } from './schema'
import NoteFactoryService from '../../assets/handles/DeliveryNoteService'
import dayjs from 'dayjs'
import { TagStatus, TagStatusFactory } from '../../utils'
import { Link } from 'umi'
const DeliveryNoticeManageSRM: React.FC = () => {
const ref = useRef<any>({})
......@@ -28,9 +29,15 @@ const DeliveryNoticeManageSRM: React.FC = () => {
const statusTxt = new Map([[1, '已提交'], [2, '已收货'], [3, '已作废']]);
const controllerBtns = (<Space>
<Button type='primary' icon={<PlusOutlined />} href="/memberCenter/order/deliveryNotice/manageSRM/add">新增</Button>
</Space>)
const controllerBtns = (
<Space>
<Link to="/memberCenter/order/deliveryNotice/manageSRM/add">
<Button type='primary' icon={<PlusOutlined />}>
新增
</Button>
</Link>
</Space>
)
const renderOptionButton = (record: any) => {
const btnAuthOfOperationTextMap = {
'修改': 'DevTest',
......
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