Commit 3fd6b5c8 authored by tjy's avatar tjy
parents ec415e43 f11b8435
......@@ -90,6 +90,14 @@ const LogisticsRoute = {
path: '/memberCenter/logisticsAbility/logisticsSubmit/toOrderSumitList',
name: 'toOrderSumitList',
component: '@/pages/logistics/logisticsSubmit/toOrderSumitList',
},
//待提交详情页
{
path: '/memberCenter/logisticsAbility/logisticsSubmit/toOrderSubmitDetail',
name: 'toOrderSubmitDetail',
component: '@/pages/logistics/logisticsSubmit/toOrderSubmitDetail',
hideInMenu: true
}
......
......@@ -7,5 +7,6 @@ export const PATTERN_MAPS = {
password: /^(?=.*[a-z])(?=.*[A-Z])[a-zA-Z\d]{8,20}$/,
email: /^[\w-]+(\.[\w-]+)*@[\w-]+(\.[\w-]+)+$/,
phone: /^1[3|4|5|6|7|8|9][0-9]{9}$/,
smsCode: /^\d{6}$/
smsCode: /^\d{6}$/,
money:/^\d*(?:\.\d{0,2})?$/
}
\ No newline at end of file
......@@ -2,7 +2,7 @@
* @Author: LeeJiancong
* @Date: 2020-07-13 14:08:50
* @LastEditors: LeeJiancong
* @LastEditTime: 2020-07-27 11:29:16
* @LastEditTime: 2020-07-28 11:31:13
*/
export default {
......@@ -80,6 +80,7 @@ export default {
'menu.logisticsAbility.logisticsSubmit.orderSubmitSearchList': '物流单查询',
'menu.logisticsAbility.logisticsSubmit.orderSubmitDeatil': '物流单详情',
'menu.logisticsAbility.logisticsSubmit.toOrderSumitList': '待提交物流单',
'menu.logisticsAbility.logisticsSubmit.toOrderSubmitDetail': '新建物流单',
'menu.logisticsAbility.logisticsResult': '物流单处理',
'menu.logisticsAbility.logisticsResult.orderResultSearchList': '物流单查询',
......
export interface IProductModule {
productName: string;
productSelectAttribute: any[];
selectedGoods: any[];
tableDataSource: any[];
setProductName(name: string):void;
setProductSelectAttribute(list: any[]):void;
setSelectedGoods(lists: any[]):void;
setTableDataSource(datas: any[]):void;
}
import React, { useState, useRef, useEffect } from 'react'
import React, { useState, useRef, useEffect, createContext } from 'react'
import { history } from 'umi';
import { Button, Card, Tabs } from 'antd'
import { PageHeaderWrapper } from '@ant-design/pro-layout'
......@@ -21,9 +21,12 @@ const { TabPane } = Tabs
const AddProducts: React.FC<{}> = (props) => {
const [attributeList, setAttributeList] = useState<any[]>([])
let [formRefs, setFormRefs] = useState([]) //子form的ref数组
const onSave = () => {
console.log('点击保存')
console.log(formRefs, 'formrefs')
}
const callback = (key: any) => {
......@@ -45,16 +48,23 @@ const AddProducts: React.FC<{}> = (props) => {
<Card>
<Tabs onChange={callback} type="card" defaultActiveKey="1">
<TabPane tab="基本信息" key="11">
<BasicInfoForm onChangeAttributeList={(_lists: any)=>setAttributeList(_lists)} />
<BasicInfoForm
onRef={(refs)=>setFormRefs([...formRefs, refs])}
onChangeAttributeList={(_lists: any)=>setAttributeList(_lists)} />
</TabPane>
<TabPane tab="选择货品" key="22">
<SelectGoodsForm />
</TabPane>
<TabPane tab="商品属性" key="33">
<ProductAttributeForm attributesData={attributeList} />
<ProductAttributeForm
onRef={(refs)=>setFormRefs([...formRefs, refs])}
attributesData={attributeList}
/>
</TabPane>
<TabPane tab="价格设置" key="44">
<PriceAttributeForm />
<PriceAttributeForm
onRef={(refs)=>setFormRefs([...formRefs, refs])}
/>
</TabPane>
<TabPane tab="商品图片" key="55" style={{ border: '1px solid rgba(223,225,230,1)' }}>
<ProductImageForm />
......@@ -63,10 +73,14 @@ const AddProducts: React.FC<{}> = (props) => {
<ProductDescForm />
</TabPane>
<TabPane tab="物流信息" key="77">
<LogisticsForm/>
<LogisticsForm
onRef={(refs)=>setFormRefs([...formRefs, refs])}
/>
</TabPane>
<TabPane tab="其他" key="88">
<OtherForm />
<OtherForm
onRef={(refs)=>setFormRefs([...formRefs, refs])}
/>
</TabPane>
</Tabs>
</Card>
......
import React, { useState, useEffect } from 'react'
import React, { useState, useEffect, useRef } from 'react'
import {history} from 'umi'
import { Button, Form, Select, Checkbox, Tooltip, Radio, Input, Table, Modal, Row, Col } from 'antd'
import styles from './index.less'
......@@ -17,21 +17,29 @@ const layout = {
}
export interface Iprops {
onRef: (refs: any) => void;
}
const { Option } = Select
const LogisticsForm: React.FC<Iprops> = (props) => {
const { onRef } = props
const logisticsFormRef = useRef()
const [logisticsForm] = Form.useForm()
useEffect(()=>{
//传入ref给父级
onRef(logisticsFormRef)
}, [])
return (<>
<Form
{...layout}
form={logisticsForm}
name="add-products-transport"
name="logistic-form"
labelAlign="left"
ref={logisticsFormRef}
>
<Form.Item
name="transportType"
......
import React, { useState, useEffect } from 'react'
import React, { useState, useEffect, useRef } from 'react'
import {history} from 'umi'
import { Button, Form, Select, Checkbox, Tooltip, Radio, Input, Table, Modal, Row, Col } from 'antd'
import styles from './index.less'
......@@ -17,22 +17,29 @@ const layout = {
}
export interface Iprops {
onRef: (refs: any) => void;
}
const { Option } = Select
const { TextArea } = Input
const OtherForm: React.FC<Iprops> = (props) => {
const { onRef } = props
const otherFormRef = useRef()
const [otherForm] = Form.useForm()
useEffect(()=>{
//传入ref给父级
onRef(otherFormRef)
}, [])
return (<>
<Form
{...layout}
form={otherForm}
name="add-products-other"
name="other-form"
labelAlign="left"
ref={otherFormRef}
>
<Form.Item
name="bill"
......
import React, { useState, useEffect } from 'react'
import React, { useState, useEffect, useRef, useContext } from 'react'
import {history} from 'umi'
import { Button, Form, Select, Checkbox, Tabs, Input } from 'antd'
import styles from './index.less'
......@@ -7,6 +7,11 @@ import { StandardTable } from 'god'
import { ColumnType } from 'antd/lib/table/interface'
import { EyeOutlined } from '@ant-design/icons'
import { inject, observer } from 'mobx-react'
// import { IProductModule } from '@/module/productModule'
// import { IStore } from '@/store';
import { store } from '@/store'
const layout = {
labelCol: {
span: 2,
......@@ -24,6 +29,7 @@ const tailLayout = {
export interface Iprops {
attributesData: any[];
onRef: (refs: any) => void;
}
const { TabPane } = Tabs
......@@ -31,8 +37,15 @@ const { Option } = Select
const { TextArea } = Input
const ProductAttributeForm: React.FC<Iprops> = (props) => {
const { attributesData } = props
const { attributesData, onRef } = props
const productAttributeFormRef = useRef()
const [attributeForm] = Form.useForm()
const { ProductStore } = store
useEffect(()=>{
//传入ref给父级
onRef(productAttributeFormRef)
}, [])
let paramsArray = [];
......@@ -47,7 +60,7 @@ const ProductAttributeForm: React.FC<Iprops> = (props) => {
* @param {Object} attrItem 属性数据对象
*/
const onChange = (value, attrItem) => {
let params = { customerAttributeId: attrItem.id, customerAttributeValueList: [] }
let params = { customerAttributeId: attrItem.id, attributeName: attrItem.name, isPrice: attrItem.isPrice, customerAttributeValueList: [] }
if(attrItem.type!==3){
for(let item of attrItem?.customerAttributeValueList){
if(value?.length){
......@@ -55,7 +68,7 @@ const ProductAttributeForm: React.FC<Iprops> = (props) => {
if(item.id===i){
params.customerAttributeValueList.push({
customerAttributeValueId: i,
value: item.value
value: item.value,
})
}
}
......@@ -63,7 +76,7 @@ const ProductAttributeForm: React.FC<Iprops> = (props) => {
if(item.id===value){
params.customerAttributeValueList.push({
customerAttributeValueId: value,
value: item.value
value: item.value,
})
}
}
......@@ -71,7 +84,7 @@ const ProductAttributeForm: React.FC<Iprops> = (props) => {
}else{
params.customerAttributeValueList.push({
customerAttributeValueId: null,
value: value.target.value
value: value.target.value,
})
}
paramsArray.push(params)
......@@ -80,8 +93,8 @@ const ProductAttributeForm: React.FC<Iprops> = (props) => {
item[next.customerAttributeId] = next;
return item
},{}))
console.log(resultParams) // 最终转换的数据格式
console.log(resultParams, 'resultParams') // 最终转换数据
ProductStore.setProductSelectAttribute(resultParams) //注入mobx
}
const renderTabPanchildren = (attrItem: any) => {
......@@ -123,7 +136,7 @@ const ProductAttributeForm: React.FC<Iprops> = (props) => {
<Checkbox.Group onChange={(v)=>onChange(v, attrItem)}>
{
attrItem?.customerAttributeValueList.length > 0 && attrItem.customerAttributeValueList.map((item: any, index: string) => (
<Checkbox key={item.id} value={item.id}>{item.value}</Checkbox>
<Checkbox key={item.id + index} value={item.id}>{item.value}</Checkbox>
))
}
</Checkbox.Group>
......@@ -153,6 +166,7 @@ const ProductAttributeForm: React.FC<Iprops> = (props) => {
name="attribute-form"
labelAlign="left"
onFinish={onFinish}
ref={productAttributeFormRef}
>
<Tabs defaultActiveKey="1" tabPosition="left">
{
......@@ -179,4 +193,4 @@ const ProductAttributeForm: React.FC<Iprops> = (props) => {
</>)
}
export default ProductAttributeForm
\ No newline at end of file
export default observer(ProductAttributeForm)
\ No newline at end of file
import React, { useState, useEffect } from 'react'
import React, { useState, useEffect, useContext } from 'react'
import {history} from 'umi'
import { Button, Form, Select, Checkbox } from 'antd'
import styles from './index.less'
......@@ -7,6 +7,11 @@ import { StandardTable } from 'god'
import { ColumnType } from 'antd/lib/table/interface'
import { EyeOutlined } from '@ant-design/icons'
import { inject, observer } from 'mobx-react'
// import { IProductModule } from '@/module/productModule'
// import { IStore } from '@/store';
import { store } from '@/store'
const layout = {
labelCol: {
span: 2,
......@@ -22,9 +27,10 @@ export interface Iprops {
const SelectGoodsForm: React.FC<Iprops> = (props) => {
const [selectGoodsForm] = Form.useForm()
const [showSelectGoods, setSelectGoods] = useState(false)
const [showSelectGoods, setIsSelectGoods] = useState(false)
const [selectGoodsRow, setSelectGoodsRow] = useState<any[]>([]) // 模态框选择的行数据
const [selectedGoodsRowKeys, setSelectedGoodsRowKeys] = useState<Array<number>>([])
const { ProductStore } = store
const fetchData = (params: any) => {
console.log(params)
......@@ -78,12 +84,13 @@ const SelectGoodsForm: React.FC<Iprops> = (props) => {
const onSelectGoodsChange = (value: any) => {
setSelectedGoodsRowKeys([])
setSelectGoods(value.target.checked)
setIsSelectGoods(value.target.checked)
}
const rowSelection = {
selectedRowKeys: selectedGoodsRowKeys,
onChange: (selectedRowKeys: any, selectedRows: any) => {
ProductStore.setSelectedGoods(selectedRows)
setSelectGoodsRow(selectedRows);
setSelectedGoodsRowKeys(selectedRowKeys);
console.log(`selectedRowKeys: ${selectedRowKeys}`, 'selectedRows: ', selectedRows);
......@@ -112,4 +119,4 @@ const SelectGoodsForm: React.FC<Iprops> = (props) => {
</>)
}
export default SelectGoodsForm
\ No newline at end of file
export default observer(SelectGoodsForm)
\ No newline at end of file
@import "../../member/components/index.less";
.count{
font-size: 24px;
color: #172B4D;
font-weight: 500;
}
.add-btn{
margin-bottom: 24px;
padding: 6px 0;
text-align: center;
background: #FAFBFC;
}
.alignCenter{
text-align: center;
}
.alignLeft{
text-align: left;
}
.hidden{
display: none;
}
.block{
display: block;
}
......
import React, { Component, useState, useEffect,useRef } from 'react';
import { Modal, Button, Form,Row,Col,Tooltip,Input,Select } from 'antd'
import {UpOutlined, DownOutlined} from '@ant-design/icons'
import {StandardTable} from 'god'
import { ColumnType,TableRowSelection} from 'antd/lib/table/interface'
import style from '../components/index.less'
let {Option} = Select
export interface Params {
title: string;
type: number,
columns: Array<any>;
dialogVisible: boolean;
onCancel: Function;
dontReceive?: boolean; //默认展示
}
interface Item {
key: string;
}
const listDialog: React.FC<Params> = (props) => {
const ref = useRef({})
const [selectRow, setSelectRow] = useState<Item[]>([]) // 模态框选择的行数据
const [selectedRowKeys, setSelectedRowKeys] = useState<Array<string>>([])
let [isSearch, setIsSearch] = useState(false)
const [searchForm, setSearchForm] = useState({
searName: '',
buyer:'',//收货商
dateSelect: '',
outSideStatus: '',
TimeRange: ''
})
const TimeList = [
{
label:'单据时间(全部)',value: ''
},
{
label:'今天',value:1
},
{
label:'一周内',value:2
},
{
label:'一个月内',value:3
},
{
label:'三个月内',value:4
},
{
label:'六个月内',value:5
},
{
label:'一年内',value: 6
},
{
label:'一年前',value: 7
}
]
const outSideStatusList = [
{
label:'外部状态(全部)',value: ''
},
{
label:'待提交',value: 1
},
{
label:'待确认',value: 2
},
{
label:'接受物流单',value: 3
},
{
label:'不接受物流单',value: 4
}
]
const handleCancel = () => {
}
const handletOk = (values:any) => {
console.log(values)
props.onCancel()
}
const data = [
{
id:'123',
key:'123',
name:'1231',
}
]
const fetchData = (params:any) => {
return new Promise((resolve, reject) => {
const queryResult = data.find(v => v.key === params.keywords)
setTimeout(() => {
resolve({
code: 200,
message: '',
data: queryResult ? [queryResult] : data
})
}, 1000)
})
}
useEffect(() => {
return () => {
}
}, [])
const Reset = () => {
}
const handleSearch = () => {
}
const handleReset = () => {
for (let key in searchForm) {
searchForm[key] = ''
}
setSearchForm({ ...searchForm })
}
const rowSelection = {
selectedRowKeys: selectedRowKeys,
onChange: (selectedRowKeys: any, selectedRows: any) => {
setSelectRow(selectedRows);
setSelectedRowKeys(selectedRowKeys);
console.log(`selectedRowKeys: ${selectedRowKeys}`, 'selectedRows: ', selectedRows);
}
}
return (
<>
<Modal
title={props.title}
width={960}
visible={props.dialogVisible}
onOk={handletOk}
onCancel={() => props.onCancel()}
destroyOnClose
afterClose={() => Reset()}
okText='确定'
cancelText='取消'
>
<StandardTable
tableProps={{ rowKey: 'id' }}
columns={props.columns}
currentRef={ref}
fetchTableData={(params: any) => fetchData(params)}
controlRender={
<>
<Row>
<Col span={24}>
{
//选择订单
props.type === 1 &&
<Select
style={{
marginRight:'16px'
}}
value={searchForm.buyer}
onChange={(val) => setSearchForm({ ...searchForm, buyer: val })}
>
<Option value=''>单据来源:订单</Option>
<Option value='1'>待审核</Option>
<Option value='2'>审核通过</Option>
<Option value='3'>审核不通过</Option>
</Select>
}
{
//选择商品
props.type === 3 &&
<Select
style={{
marginRight:'16px'
}}
value={searchForm.buyer}
onChange={(val) => setSearchForm({ ...searchForm, buyer: val })}
>
<Option value=''>来源:发货单</Option>
<Option value='1'>待审核</Option>
<Option value='2'>审核通过</Option>
<Option value='3'>审核不通过</Option>
</Select>
}
<Tooltip trigger={['focus']} placement='top'
title={props.type === 1? '输入物流单号、订单号进行搜索':'输入物流单号、发货方进行搜索' }>
<Input.Search
style={{ width: '232px' }}
value={searchForm.searName}
placeholder='搜索'
onChange={(e) => setSearchForm({ ...searchForm, searName: e.target.value })}
onSearch={() => handleSearch}
/>
</Tooltip>
<Button className={style['filter-btn']} onClick={() => setIsSearch(isSearch = !isSearch) }>
高级筛选{isSearch ? <UpOutlined /> : <DownOutlined />}
</Button>
<Button className={style.selectBtn} onClick={() => handleReset()}>重置</Button>
</Col>
</Row>
<Row style={{margin: '16px 0'}}>
{
isSearch &&
<Col>
{
props.type === 1?
<Select
className={style.select}
value={searchForm.buyer}
onChange={(val) => setSearchForm({ ...searchForm, buyer: val })}
>
<Option value=''>物流服务商(全部)</Option>
<Option value='1'>待审核</Option>
<Option value='2'>审核通过</Option>
<Option value='3'>审核不通过</Option>
</Select>
:
<Select
className={style.select}
value={searchForm.buyer}
onChange={(val) => setSearchForm({ ...searchForm, buyer: val })}
>
<Option value=''>发货方(全部)</Option>
<Option value='1'>待审核</Option>
<Option value='2'>审核通过</Option>
<Option value='3'>审核不通过</Option>
</Select>
}
<Select
className={style.select}
value={searchForm.TimeRange}
onChange={(val) => setSearchForm({ ...searchForm, TimeRange: val })}
>
{
TimeList.map((item) => {
return <Option value={item.value}>{item.label}</Option>
})
}
</Select>
<Select
className={style.select}
value={searchForm.outSideStatus}
onChange={(val) => setSearchForm({ ...searchForm, outSideStatus: val })}
>
{
outSideStatusList.map((item) => {
return <Option value={item.value}>{item.label}</Option>
})
}
</Select>
</Col>
}
</Row>
</>
}
/>
</Modal>
</>
)
}
listDialog.defaultProps = {
dontReceive: true
}
export default listDialog
\ No newline at end of file
......@@ -2,7 +2,7 @@
* @Author: LeeJiancong
* @Date: 2020-07-15 10:31:55
* @LastEditors: LeeJiancong
* @LastEditTime: 2020-07-27 19:11:21
* @LastEditTime: 2020-07-28 14:01:19
*/
import React, { Component, useState, useEffect } from 'react';
import ReactDOM from 'react-dom'
......@@ -63,25 +63,6 @@ const actions = createFormActions()
const { ON_FORM_SUBMIT } = LifeCycleTypes //拿到Form提交API
const onFormSubmit$ = FormEffectHooks
const { Option } = ISelect;
const children: any = [];
for (let i = 10; i < 36; i++) {
children.push(<Option value={i} key={i.toString(36) + i}>{i.toString(36) + i}</Option>);
}
const dropdownRender = () => {
return (
<div>12</div>
)
}
// const CustomSelect = (props: any) => {
// return (
// <ISelect showArrow style={{ width: '100%' }} dropdownRender={dropdownRender}
// placeholder="Tags Mode" onChange={value => props.onChange(value)}>
// {/* {children} */}
// </ISelect>
// )
// }
// registerFormFields({ prefixSelect: connect()(CustomSelect) })
const diaLogForm: React.FC<ListProps> = (props) => {
const [provinceList, setProvinceList] = useState([])
const [editable, setEditable] = useState<boolean>(true)
......
This diff is collapsed.
......@@ -2,7 +2,7 @@
* @Author: LeeJiancong
* @Date: 2020-07-14 15:07:34
* @LastEditors: LeeJiancong
* @LastEditTime: 2020-07-27 20:28:06
* @LastEditTime: 2020-07-28 11:40:21
*/
import React, { Component, ReactNode, useRef, useState } from 'react'
import { history } from 'umi'
......@@ -339,7 +339,7 @@ const OrderList: React.FC<ListProps> = (props) => {
<Button
type="primary"
onClick={() =>
history.push('')
history.push('/memberCenter/logisticsAbility/logisticsSubmit/toOrderSubmitDetail?id=0')
}
>
<PlusOutlined />
......
import UserStore from './user'
import ThemeStore from './theme'
import ProductStroe from './product'
import React from 'react';
import { Provider } from 'mobx-react'
import { IUserModule } from '@/module/userModule';
import { IProductModule } from '@/module/productModule'
// import { ProductContext } from '@/pages/commodity/products/addProducts';
/**
*
......@@ -20,12 +23,14 @@ import { IUserModule } from '@/module/userModule';
*/
export interface IStore {
userStore: IUserModule
userStore: IUserModule;
ProductStore: IProductModule;
}
const store = {
export const store = {
userStore: new UserStore,
ThemeStore: new ThemeStore,
ProductStore: new ProductStroe
}
const MobxProvider: React.FC = (props) => {
......
import {action, computed, observable, runInAction} from 'mobx'
import { IProductModule } from '@/module/productModule'; // mobx要用到的数据类型
class ProductStore implements IProductModule {
@observable public productName: string = "";
@observable public productSelectAttribute: any[] = [];
@observable public selectedGoods: any[] = [];
@observable public tableDataSource: any[] = [];
/** 定义动作区块,外部调用,改变对应的状态 **/
// 可以改变存的testText值
@action.bound
public setProductName(name: string) {
this.productName = name;
}
@action.bound
public setProductSelectAttribute(list: any[]) {
this.productSelectAttribute = list;
}
@action.bound
public setSelectedGoods(list: any[]) {
this.selectedGoods = list;
}
@action.bound
public setTableDataSource(datas: any[]) {
console.log(datas, 'innerBox')
this.tableDataSource = datas;
}
}
export default ProductStore
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