Commit 847ea846 authored by 前端-钟卫鹏's avatar 前端-钟卫鹏
parents 9ec53c3a 7792d18d
......@@ -144,7 +144,8 @@ const AddRepository:React.FC<{}> = (props) => {
inventory: values.inventory,
inventoryDeductWay: values.inventoryDeductWay,
shopIds: values.shopIds,
isAllMemberShare: values.isAllMemberShare
isAllMemberShare: values.isAllMemberShare,
shopType: values.shopType
}
if (values['applyMember']) {
params['applyMember'] = values['applyMember'].map(v => v.memberId)
......
......@@ -3,10 +3,10 @@
* @Date: 2020-08-28 10:07:45
* @LastEditors: LeeJiancong
* @Copyright: 1549414730@qq.com
* @LastEditTime: 2020-08-29 10:16:45
* @LastEditTime: 2020-09-01 15:45:57
*/
import React, { Component, useState, useEffect } from 'react';
import { Modal, Button, Form, Radio, Tabs, Input, Select,Checkbox } from 'antd'
import { Modal, Button, Form, Radio, AutoComplete,Tabs, Input, Select,Checkbox } from 'antd'
import { PublicApi } from '@/services/api'
const { TabPane } = Tabs
const { Option } = Select
......@@ -68,10 +68,14 @@ const comfirmDialog: React.FC<Params> = (props) => {
const renderTabPanchildren = (item: any) => {
console.log('子项',item)
return (
<>
{
item.attributeList.map((attrItem:any) => {
const options = attrItem.attributeValueList.map((item: any) => ({
value: item.value
}))
return (
<>
{
......@@ -84,7 +88,15 @@ const comfirmDialog: React.FC<Params> = (props) => {
message: '此项为必填项'
}]}
>
<Select
<AutoComplete
style={{ width: 200 }}
options={options}
placeholder="选择或输入"
filterOption={(inputValue, option) =>
option.value.toUpperCase().indexOf(inputValue.toUpperCase()) !== -1
}
/>
{/* <Select
placeholder="请选择"
allowClear
onChange={(v)=>onChange(v, attrItem)}
......@@ -94,7 +106,7 @@ const comfirmDialog: React.FC<Params> = (props) => {
<Option key={item.id} value={item.id}>{item.value}</Option>
))
}
</Select>
</Select> */}
</Form.Item>
}
{
......
......@@ -22,21 +22,22 @@ import { Row, Col, Card, Button, Table, Popconfirm, Radio,DatePicker,
import { PageHeaderWrapper } from '@ant-design/pro-layout'
import moment from 'moment'
import { ColumnType } from 'antd/lib/table/interface'
import { dockingList } from './detailFormColumnType'
import { dockingColumn } from './detailFormColumnType'
import { getAuth} from '@/utils/auth'
// import {
// MegaLayout, Input, Switch, Select, FormMegaLayout, FormTab,
// Radio, ArrayTable, ArrayCards, Transfer
// } from '@formily/antd-components'
import { PublicApi } from '@/services/api'
import styles from './templateForm.less';
import ReutrnEle from '@/components/ReturnEle'
import RroductModal from '../components/productModal'
import { PATTERN_MAPS } from '@/constants/regExp'
import {PageStatus,usePageStatus} from '@/hooks/usePageStatus'
import statuStyle from '../../common/colorTag'
import {interiorState} from '../../common/tableStatusList'
import {
GetManageAreaAllResponse
} from '@/services';
import { store } from '@/store'
import colorTag from '@/pages/logistics/colorTag'
import { Effects } from 'bizcharts'
const { TabPane } = Tabs
const {TextArea} = Input
......@@ -66,11 +67,35 @@ interface AreaParams {
cityCode: any;
cityName: any;
}
const init = {
deliveryTime: ''
}
const Detail: React.FC<{}> = () => {
const headerTitle = '需求单'
const [tabForm] = Form.useForm()
const [otherList, setotherList] = useState([])
const {pageStatus, id} = usePageStatus()
const [initialValues, setinitialValues] = useState<any>({
details: '',
addresId: null,
packRequire:'',
taxes:'',
logistics:'',
offer:'',
paymentType:'',
otherRequire:'',
quotationAsTime:'',
deliveryTime:'',
voucherTime:'',
requisitionFormAddress:[]//地市
})
const [requisitionFormAddress, setrequisitionFormAddress] = useState([])//地市多项回显用
const [customerCategoryId, setcustomerCategoryId] = useState<any>([]) //品类
const [selectRow, setSelectRow] = useState([])//需求单用
const [selectedRowKeys, setSelectedRowKeys] = useState<Array<number>>([])//需求单
const [categoryId, setcategoryId] = useState(null)//选择的分类id
const [otherList, setotherList] = useState([])//动态tab循环
const [dockingList, setdockingList] = useState([])//需求列表
const [productSource, setproductSource] = useState([])//商品列表 新增
const [shipperAddressList, setshipperAddressList] = useState([])
const [CategoryTreeOne, setCategoryTreeOne] = useState([])
......@@ -95,6 +120,60 @@ const Detail: React.FC<{}> = () => {
}
/**
* @description: 初始化需求对接表格 需求单
* @param {type}
* @return {type}
*/
const InitMemberList = () => {
let params:any = {}
params.categoryId = categoryId
let codeList = tabForm.getFieldValue('requisitionFormAddress')|| []
if(categoryId && otherList.length != 0){
console.log('codeList',codeList)
params.areaRequestList =
codeList.map((v:any)=> {
if(Array.isArray(v)){
return ({
provinceCode: v[0],
cityCode: v && v.length > 1 ? v[1] : null
})
}
})
let productList = []
productSource.forEach((v) => {
// console.log('v',v)
let item:any = {}
Object.keys(v).forEach(child => {
otherList.forEach((j:any) => {
let otherItem:any = {}
if(child === j.title){
otherItem['attributeId'] = j.key
otherItem['attributeValue'] = v[child]
productList.push(otherItem)
}
})
})
})
params.attributeList = [...productList]
params.current = 1
params.pageSize= 20
console.log('params',JSON.stringify(params))
PublicApi.postOrderSystemMatchingMemberInitializeList(
params
).then(res=> {
if(res.code === 1000){
let {data} = res.data || {}
setdockingList(data)
}
})
}
}
/**
* @description: 选择品类
* @param {type}
......@@ -103,6 +182,7 @@ const Detail: React.FC<{}> = () => {
const onCustomerCategoryChange = (value: any,options:any) => {
console.log(3112,value,options)
let seletCategoryId = value[value.length - 1 ]
setcategoryId(seletCategoryId)
setseletCategoryNameList(options)
console.log(seletCategoryId, 'seleellele')
......@@ -110,82 +190,6 @@ const Detail: React.FC<{}> = () => {
PublicApi.getProductPlatformGetCategoryById({ id: seletCategoryId }).then(res => {
if(res.code === 1000){
let data = res.data
// let data = [
// {
// id: '1',
// name: '外观尺寸',
// attributeList: [
// {
// id: '2',
// type: 1,
// name: '面料',
// attributeValueList: [
// {
// id: 1,
// value: '涤沦'
// },
// {
// id: 2,
// value: '面料'
// }
// ]
// },
// {
// id: '3',
// type: 1,
// name: '颜色',
// attributeValueList: [
// {
// id: 1,
// value: '红色'
// },
// {
// id: 2,
// value: '白色'
// }
// ]
// },
// ]
// },
// {
// id: '5',
// name: '工艺',
// attributeList: [
// {
// id: '4',
// type: 1,
// name: '化学处理',
// attributeValueList: [
// {
// id: 5,
// value: '化学1'
// },
// {
// id: 6,
// value: '化学2'
// }
// ]
// },
// {
// id: '5',
// type: 1,
// name: '表皮处理',
// attributeValueList: [
// {
// id: 1,
// value: '表皮1'
// },
// {
// id: 2,
// value: '表皮2'
// }
// ]
// },
// ]
// },
// ]
settabData([data])//转成数组
let da = []
// data.forEach((item: any) => {
......@@ -198,8 +202,9 @@ const Detail: React.FC<{}> = () => {
align: 'center',
render:(text:any) => {
const name = v.attributeValueList.filter(v=> v.id == text).map(v=> v.value)
console.log('name',name)
return (
<>{name}</>
<>{name.length > 0? name[0]: text}</>
)
}
})
......@@ -275,6 +280,8 @@ const Detail: React.FC<{}> = () => {
}
})
/**
* @description: 收货地址
......@@ -308,8 +315,52 @@ const Detail: React.FC<{}> = () => {
setAreaOption(arr)
}
})
/**
* @description: 获取详情
* @param {type}
* @return {type}
*/
if(id){
PublicApi.getOrderRequisitionFormDetails({id:id}).then(res => {
if(res.code === 1000){
let data = res.data
let areaCodeList = []
if(data.requisitionFormAddress){
data.requisitionFormAddress.forEach((v)=> {
areaCodeList.push([v.provinceCode,v.cityCode])
})
}
//品类
if(data.productCategory){
setcustomerCategoryId([data.productCategory.key])
}
//地区
setrequisitionFormAddress(areaCodeList)
setinitialValues(data)
tabForm.resetFields()
}
})
PublicApi.getOrderRequisitionFormProductDetails({id:id}).then(res => {
if(res.code === 1000){
let {data} = res
}
})
}
}, [])
/**
* @description: 交易类型
* @param {type}
......@@ -341,12 +392,25 @@ const Detail: React.FC<{}> = () => {
}
const changePlatform = (e: any) => {
setplatType(e.target.value)
if(e.target.value == 2){
//调用需求单
InitMemberList()
}
}
const handleMemberTypeChange = (e: any) => {
setmemberType(e.target.value)
}
const rowSelection = {
selectedRowKeys: selectedRowKeys,
onChange: (selectedRowKeys: any, selectedRows: any) => {
setSelectRow(selectedRows);
setSelectedRowKeys(selectedRowKeys);
console.log(`selectedRowKeys: ${selectedRowKeys}`, 'selectedRows: ', selectedRows)
}
}
/**
* @description: TabForm提交 保存
......@@ -416,7 +480,9 @@ const Detail: React.FC<{}> = () => {
console.log((JSON.stringify(values)))
PublicApi.postOrderRequisitionFormAdd(values).then(res => {
if(res.code === 1000){
history.goBack()
setTimeout(() => {
history.goBack()
},1000)
}
})
......@@ -485,6 +551,10 @@ const Detail: React.FC<{}> = () => {
labelAlign="left"
autoComplete="off"
onFinish = {onFinish}
initialValues={{
customerCategoryId: customerCategoryId,
requisitionFormAddress: requisitionFormAddress
}}
>
<Tabs defaultActiveKey='1'>
<TabPane tab="基本信息" key='1'>
......@@ -498,6 +568,7 @@ const Detail: React.FC<{}> = () => {
> */}
<Form.Item
label="报价单摘要"
initialValue={initialValues.details}
rules={[
{
required: true
......@@ -508,6 +579,9 @@ const Detail: React.FC<{}> = () => {
<Input placeholder="请输入报价单摘要" maxLength={30} />
</Form.Item>
<Form.Item
// initialValue={
// initialValues.
// }
name="customerCategoryId"
label="商品品类"
rules={[
......@@ -636,7 +710,9 @@ const Detail: React.FC<{}> = () => {
}}
</Form.List> */}
<Form.List name="requisitionFormAddress">
<Form.List name="requisitionFormAddress"
>
{(fields: any[], { add, remove }: any) => {
if (!fields.length) {
add()
......@@ -646,6 +722,7 @@ const Detail: React.FC<{}> = () => {
{fields.map((field, index) => (
<Form.Item
{...(index === 0 ? layout : layoutFormList)}
label={
field.key === 0 && <span>
归属地市&nbsp;
......@@ -659,6 +736,7 @@ const Detail: React.FC<{}> = () => {
<Form.Item
{...field}
noStyle
>
<Cascader
options={proviceOptions}
......@@ -678,12 +756,19 @@ const Detail: React.FC<{}> = () => {
)
}}
</Form.List>
{
id&&
<Form.Item
name="requisitionFormNo"
label='需求单号'
>
<>
{
initialValues.requisitionFormNo
}
</>
</Form.Item>
}
<Form.Item
// name='memberName'
label='会员名称'
......@@ -691,23 +776,38 @@ const Detail: React.FC<{}> = () => {
<>{getAuth().name || '未知用户'}</>
</Form.Item>
<Form.Item
// name='voucherTime'
name='voucherTime'
label='单据时间'
>
<div>
{
initialValues.voucherTime ? moment(initialValues.voucherTime).format("YYYY-MM-DD HH:mm:ss") :''
}
</div>
</Form.Item>
<Form.Item
label='外部状态'
// name="externalState"
>
{
initialValues.externalState == 1 ?<span style={statuStyle.default}>待提交需求单</span>:
initialValues.externalState == 2?<span style={statuStyle.warn}>审核不通过需求单</span>:''
}
</Form.Item>
{
id &&
<Form.Item
// name="interiorState"
label='内部状态'
>
>
<>
{interiorState(initialValues.interiorState)}
</>
</Form.Item>
}
{/* </Form> */}
</Col>
</Row>
......@@ -720,6 +820,7 @@ const Detail: React.FC<{}> = () => {
<Row>
<Col span={11}>
<Form.Item
initialValue={initialValues.deliveryTime ? moment(initialValues.deliveryTime):''}
label="交付日期"
rules={[
{
......@@ -732,6 +833,7 @@ const Detail: React.FC<{}> = () => {
<DatePicker style={{width:'100%'}} />
</Form.Item>
<Form.Item
initialValue={initialValues.addresId}
label="交付地址"
rules={[
{
......@@ -750,6 +852,7 @@ const Detail: React.FC<{}> = () => {
</Form.Item>
<Form.Item
label="报价截止时间"
initialValue={initialValues.quotationAsTime ? moment(initialValues.quotationAsTime):''}
rules={[
{
required: true,
......@@ -761,18 +864,21 @@ const Detail: React.FC<{}> = () => {
<DatePicker showTime format="YYYY-MM-DD HH:mm" style={{width:'100%'}}/>
</Form.Item>
<Form.Item
initialValue={initialValues.offer}
label="报价要求"
name="offer"
>
<TextArea placeholder="最长100个字符,50个汉字" maxLength={50} />
</Form.Item>
<Form.Item
initialValue={initialValues.paymentType}
label="付款方式"
name="paymentType"
>
<TextArea placeholder="最长100个字符,50个汉字" maxLength={50} />
</Form.Item>
<Form.Item
initialValue={initialValues.taxes}
label="税费要求"
name="taxes"
>
......@@ -781,18 +887,21 @@ const Detail: React.FC<{}> = () => {
</Col>
<Col span={11} push={2}>
<Form.Item
initialValue={initialValues.logistics}
label="物流要求"
name="logistics"
>
<TextArea placeholder="最长100个字符,50个汉字" maxLength={50} />
</Form.Item>
<Form.Item
initialValue={initialValues.packRequire}
label="包装要求"
name="packRequire"
>
<TextArea placeholder="最长100个字符,50个汉字" maxLength={50} />
</Form.Item>
<Form.Item
initialValue={initialValues.otherRequire}
label="其他要求"
name="otherRequire"
>
......@@ -835,7 +944,7 @@ const Detail: React.FC<{}> = () => {
}
{
platType != 1 &&
<Table dataSource={[]} columns={dockingList} pagination={pagination} />
<Table dataSource={dockingList} rowSelection={rowSelection} columns={dockingColumn} pagination={pagination} />
}
......
......@@ -3,7 +3,7 @@
* @Date: 2020-08-27 16:27:53
* @LastEditors: LeeJiancong
* @Copyright: 1549414730@qq.com
* @LastEditTime: 2020-08-29 14:29:40
* @LastEditTime: 2020-09-01 10:08:44
*/
import { ColumnType } from 'antd/lib/table/interface'
export const equiryColumns: ColumnType<any>[] = [
......@@ -66,7 +66,7 @@ export const equiryColumns: ColumnType<any>[] = [
]
export const dockingList: ColumnType<any>[] = [
export const dockingColumn: ColumnType<any>[] = [
{
title: '序号',
dataIndex: 'id',
......
export enum OrderModalType {
/**
* 进货单下单
*/
PURCHASE_ORDER = 5,
/**
* 手工下单
*/
HAND_ORDER,
/**
* 询价报价下单
*/
INQUIRY_QUOTATION_ORDER,
/**
* 需求报价下单
*/
DEMAND_QUOTATION_ORDER = 206,
DEMAND_QUOTATION_ORDER,
/**
* 合并订单下单
*/
......@@ -28,19 +42,15 @@ export enum OrderModalType {
* 渠道现货手工下单
*/
CHANNEL_SPOT_MANUAL_ORDER,
}
/**
* 询价报价下单
*/
INQUIRY_QUOTATION_ORDER,
/**
* 进货单下单
*/
PURCHASE_ORDER,
/**
* 手工下单
*/
HAND_ORDER
}
\ No newline at end of file
export const orderTypeLabel = ['',
'询价采购',
'需求采购',
'现货采购',
'集采',
'积分兑换',
'渠道直采',
'渠道现货',
'渠道积分兑换'
]
\ No newline at end of file
......@@ -10,15 +10,19 @@ import NiceForm from '@/components/NiceForm'
import { orderDetailSchema } from './schema'
import { useDetailOrder } from './model/useDetailOrder'
import ModalTable from '@/components/ModalTable'
import { useModelTypeChange } from './effects'
import { OrderModalType, orderTypeLabel } from './constant'
export interface PurchaseOrderDetailProps {}
const addSchemaAction = createFormActions()
// 采购订单详情页. 包含新增和编辑
const PurchaseOrderDetail:React.FC<PurchaseOrderDetailProps> = (props) => {
const { productColumns } = useDetailOrder()
// 页面进入时, 当前所处的下单模式
const { orderModel } = history.location.query
const { productColumns, setShowProBtn, showProBtn } = useDetailOrder({
orderModel
})
// 页面进入时, 当前所处的下单模式
const { pageStatus } = usePageStatus()
const handleOrderNo = () => {}
......@@ -27,7 +31,7 @@ const PurchaseOrderDetail:React.FC<PurchaseOrderDetailProps> = (props) => {
const orderNoPrice = pageStatus !== PageStatus.PREVIEW && <div className='connectBtn' onClick={handleOrderNo}><LinkOutlined style={{marginRight: 4}}/>选择</div>
const orderMember = pageStatus !== PageStatus.PREVIEW && <div className='connectBtn' onClick={handleOrderMember}><LinkOutlined style={{marginRight: 4}}/>选择</div>
const productAddButton = <Button block type='default' style={{margin: '24px auto'}}>选择订单商品</Button>
const productAddButton = showProBtn && <Button block type='default' style={{margin: '24px auto'}}>选择订单商品</Button>
return (
<PageHeaderWrapper
onBack={() => history.goBack()}
......@@ -45,6 +49,28 @@ const PurchaseOrderDetail:React.FC<PurchaseOrderDetailProps> = (props) => {
actions={addSchemaAction}
schema={orderDetailSchema}
className='useConnectBtnWrapper'
effects={($, ctx) => {
useModelTypeChange(state => {
const { value } = state
// 报价单的值 等同于是否填写过报价单
const quotationOrderValue = ctx.getFieldValue('quotationNo')
// 当选择了手工下单、渠道直采手工下单、渠道现货手工下单、或者选择了合并订单下单并未选择报价单则需要显示商品列表添加接口
if (
value === OrderModalType.HAND_ORDER ||
value === OrderModalType.CHANNEL_DIRECT_MINING_ORDER ||
value === OrderModalType.CHANNEL_SPOT_MANUAL_ORDER ||
(value === OrderModalType.CONSOLIDATED_ORDER && quotationOrderValue)
) {
setShowProBtn(true)
} else {
setShowProBtn(false)
}
// 选择某种类型时, 需显示对应的订单类型
ctx.setFieldValue('type', orderTypeLabel[value - 4]) // -4 获得对应的数组下标, 由于id是固定的
})
}}
expressionScope={{
orderNoPrice,
orderMember,
......
import { ISchemaFormActions, FormEffectHooks } from '@formily/antd';
export const useModelTypeChange = (callback) => {
// 下单模式发生改变时
FormEffectHooks.onFieldValueChange$('orderModel').subscribe(state => {
callback(state)
})
}
\ No newline at end of file
import React, { useState } from 'react'
import { OrderModalType } from '../constant'
export const useDetailOrder = () => {
export const useDetailOrder = (options) => {
// const [productDataSource, setProductDataSource] = useState
const [showProBtn, setShowProBtn] = useState(options.orderModel)
const [showMemberType, setShowMemberType] = useState(false)
const productColumns: any[] = [
{
title: '商品ID',
......@@ -30,6 +34,10 @@ export const useDetailOrder = () => {
]
return {
productColumns
productColumns,
showProBtn,
setShowProBtn,
showMemberType,
setShowMemberType
}
}
\ No newline at end of file
......@@ -103,7 +103,29 @@ const basicInfo: ISchema = {
disabled: true,
addonAfter: "{{orderMember}}"
},
}
},
orderNo: {
type: 'string',
title: '订单编号',
"x-component": 'text'
},
type: {
type: 'string',
title: '订单类型',
"x-component": 'text'
},
createTime: {
type: 'string',
title: '下单时间'
},
interiorState: {
type: 'string',
title: '内部状态'
},
externalState: {
type: 'string',
title: '外部状态'
},
}
},
......
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