Commit 362c1aa1 authored by GuanHua's avatar GuanHua
parents 438c61c1 7ccac348
/*
* @Author: LeeJiancong
* @Date: 2020-07-31 19:56:22
* @LastEditors: XieZhiXiong
* @LastEditors: LeeJiancong
* @Copyright: 1549414730@qq.com
* @LastEditTime: 2020-09-14 19:37:53
* @LastEditTime: 2020-09-15 17:18:01
*/
const TranactionRoute = {
......@@ -72,26 +72,22 @@ const TranactionRoute = {
{
path:'/memberCenter/tranactionAbility/enquirySubmit/enquirySearch',
name:'enquirySearch',
key:'enquirySearch',
component: '@/pages/transaction/enquirySubmit/enquirySearch'
},
{
path:'/memberCenter/tranactionAbility/enquirySubmit/toAddSubmitList',
name:'toAddSubmitList',
key:'toAddSubmitList',
component: '@/pages/transaction/enquirySubmit/toAddSubmit'
},
{
path:'/memberCenter/tranactionAbility/enquirySubmit/addEnquiry',
name:'addEnquiry',
key:'addEnquiry',
component: '@/pages/transaction/enquirySubmit/toAddSubmit/detail',
hideInMenu: true,
},
{//需求单详情
path:'/memberCenter/tranactionAbility/enquirySubmit/viewEnquiryDetail',
name:'viewEnquiryDetail',
key:'viewEnquiryDetail',
component: '@/pages/transaction/enquirySubmit/components/detail',
hideInMenu: true,
},
......@@ -99,19 +95,16 @@ const TranactionRoute = {
{
path:'/memberCenter/tranactionAbility/enquirySubmit/enquiryOne',
name:'enquiryOne',
key:'enquiryOne',
component: '@/pages/transaction/enquirySubmit/enquiryOne'
},
{
path:'/memberCenter/tranactionAbility/enquirySubmit/enquiryTwo',
name:'enquiryTwo',
key:'enquiryTwo',
component: '@/pages/transaction/enquirySubmit/enquiryTwo'
},
{
path:'/memberCenter/tranactionAbility/enquirySubmit/toSubmit',
name:'toSubmit',
key:'toSubmit',
component: '@/pages/transaction/enquirySubmit/toSubmit'
},
......@@ -133,13 +126,11 @@ const TranactionRoute = {
{
path:'/memberCenter/tranactionAbility/enquiryOffer/enquirySearch',
name:'enquirySearch',
key:'enquirySearch',
component: '@/pages/transaction/enquiryOffer/enquirySearch'
},
{//需求单详情
path:'/memberCenter/tranactionAbility/enquiryOffer/viewEnquiryDetail',
name:'viewEnquiryDetail',
key:'viewEnquiryDetail',
component: '@/pages/transaction/enquiryOffer/components/detail',
hideInMenu: true,
},
......@@ -148,14 +139,12 @@ const TranactionRoute = {
{
path:'/memberCenter/tranactionAbility/enquiryOffer/toAddSubmitList',
name:'toAddSubmitList',
key:'toAddSubmitList',
component: '@/pages/transaction/enquiryOffer/toAddSubmit'
},
//新增
{
path:'/memberCenter/tranactionAbility/enquiryOffer/addEnquiry',
name:'addEnquiry',
key:'addEnquiry',
component: '@/pages/transaction/enquiryOffer/toAddSubmit/detail',
hideInMenu: true,
},
......
import React, { Component,ReactNode } from 'react';
import {Badge} from 'antd'
/****** *********************** 需求单 ************************** */
/**
* @description: 一级
* @description: 需求提交一级
* @param {type}
* @return {type}
*/
......@@ -17,7 +17,7 @@ export const interiorState = (text:any) => {
/**
* @description: 二级
* @description: 需求提交二级
* @param {type}
* @return {type}
*/
......@@ -62,4 +62,10 @@ export const enquirySearchexternalState = (text:any) => {
text === 6 ? component = <Badge status='error' text="审核不通过" />:
component = <Badge status="default" text="取消报价单" />
return component;
}
\ No newline at end of file
}
/****** *********************** 报价单 ************************** */
......@@ -3,9 +3,9 @@
* @Date: 2020-08-28 10:07:45
* @LastEditors: LeeJiancong
* @Copyright: 1549414730@qq.com
* @LastEditTime: 2020-09-12 11:40:07
* @LastEditTime: 2020-09-15 14:32:41
*/
import React, { Component, useState, useEffect } from 'react';
import React, { Component, useState,useRef, useEffect,useImperativeHandle } from 'react';
import { Modal, Button,Space, Form, Radio, AutoComplete, Badge,Tabs, Input, Select, Checkbox } from 'antd'
import { PublicApi } from '@/services/api'
import ModalTable from '@/components/ModalTable'
......@@ -20,13 +20,17 @@ const { TextArea } = Input
export interface Params {
sourceData?: Array<any>[],
eqInfo: any,
id?: any,
mode?: number,
type?: number | string,
dialogVisible: boolean;
currentRef?: any;
onCancel: Function;
onRef?: any;
onOK?: Function;
initialValues?: any;
productAttributeJson: Function;//明细中的属性
dontReceive?: boolean; //默认展示
}
const layout = {
......@@ -44,10 +48,10 @@ const layout = {
* @param {type}
* @return {type}
*/
// const fetchData = async (params) => {
// const res = await PublicApi.getProductCommodityCommonGetCommodityDetailList({ ...params, environment: 1, shopType: 1 })
// return res.data
// }
const fetchData = async (params) => {
const res = await PublicApi.getProductCommodityCommonGetCommodityDetailList({ ...params, environment: 1, shopType: 1 })
return res.data
}
//数据是真实的 只是模拟
let data = [
......@@ -69,18 +73,18 @@ let data = [
unitName: "件"
}
]
const fetchData = params => {
return new Promise((resolve, reject) => {
const queryResult = data.find(v => v.key === params.keywords);
setTimeout(() => {
resolve({
code: 200,
message: '',
data: queryResult ? [queryResult] : data,
});
}, 1000);
});
};
// const fetchData = params => {
// return new Promise((resolve, reject) => {
// const queryResult = data.find(v => v.key === params.keywords);
// setTimeout(() => {
// resolve({
// code: 200,
// message: '',
// data: queryResult ? [queryResult] : data,
// });
// }, 1000);
// });
// };
const columns: ColumnType<any>[] = [
{
......@@ -113,7 +117,9 @@ const columns: ColumnType<any>[] = [
* @param {type}
* @return {type}
*/
const comfirmDialog: React.FC<Params> = (props) => {
const comfirmDialog: React.FC<Params> = (props,{onRef}) => {
// const {onRef} = props
// const cRef = props.currentRef
// console.log('数据',props.sourceData)
const [visible, setsVisible] = useState(false) //state hook写法
const [Curform] = Form.useForm()
......@@ -128,6 +134,14 @@ const comfirmDialog: React.FC<Params> = (props) => {
const [placeOfOriginList, setplaceOfOriginList] = useState([])//产地
const handleCancel = () => {
}
const inRef = useRef<any>({})
useImperativeHandle(onRef,() => {
retSetForm: () => {
Curform.resetFields()
}
})
//选择商品
const handleLink = () => {
......@@ -137,16 +151,24 @@ const comfirmDialog: React.FC<Params> = (props) => {
const handleSelectOk = () => {
console.log('数据', productRowCtl);
const selectRow = productRowCtl.selectRow[0]
let { commodityId, id, goodsId, roleId, name, brandName } = selectRow
let { commodityId, id,customerCategoryName, goodsId, roleId, name, brandName } = selectRow
Curform.setFieldsValue({
name: name,//商品名称
brand: brandName
brand: brandName,
category: customerCategoryName
})
//查询属性
PublicApi.getProductCommodityGetCommodity({ id: commodityId }).then(res => {
//查询属性
// PublicApi.getProductCommodityGetCommodity({ id: commodityId }).then(res => {
// if (res.code === 1000) {
// let { data } = res || {}
// setcommodityAttributedataSource(data)
// }
// })
PublicApi.getProductCommodityGetCommodityAttributeByUnitPriceAndPicId({unitPriceAndPicId: id}).then(res => {
if (res.code === 1000) {
let { data } = res || {}
setcommodityAttributedataSource(data)
console.log('data',data)
}
})
setsVisible(false)
......@@ -155,22 +177,21 @@ const comfirmDialog: React.FC<Params> = (props) => {
setsVisible(false)
}
/**
* @description: 报价明细
* @param {type}
* @return {type}
*/
const handletOk = () => {
Curform.validateFields().then(v => {
console.log('表单', v)
// props.onOK(v)
props.onOK(v,commodityAttributedataSource)
props.productAttributeJson(commodityAttributedataSource)
Curform.resetFields()
})
// if(props.type){
// value.type = props.type
// }
// console.log('列表',value)
}
useEffect(() => {
// onRef(inRef)
return () => {
}
}, [])
......@@ -284,10 +305,10 @@ const comfirmDialog: React.FC<Params> = (props) => {
</>
)
}
const placeholderText = '请先选择对应需求单号'
return (
<>
<Modal
// title={props.mode === 0 ? '新增报价明细' : '查看报价明细'}
title={headerTitle}
width={800}
......@@ -302,10 +323,14 @@ const comfirmDialog: React.FC<Params> = (props) => {
<Form
{...layout}
colon={false}
ref={inRef}
labelAlign="left"
form={Curform}
autoComplete="off"
initialValues={{
purchaseQuantity: props.eqInfo.purchaseQuantity,
purchaseNuit: props.eqInfo.purchaseNuit
}}
>
<Tabs defaultActiveKey='tab1'
......@@ -317,12 +342,17 @@ const comfirmDialog: React.FC<Params> = (props) => {
name='model'
rules={[
{
required: true
}
]}
>
<Select>
<Option value="1">11</Option>
<Select placeholder="请先选择对应需求单号">
{
props.eqInfo.modelList.map((item,index) => {
return <Option key={index} value={item}>{item}</Option>
})
}
</Select>
</Form.Item>
<Form.Item
......@@ -350,6 +380,13 @@ const comfirmDialog: React.FC<Params> = (props) => {
>
<Input disabled placeholder='' />
</Form.Item>
<Form.Item
label='品类'
name='category'
hidden
>
<Input disabled placeholder='' />
</Form.Item>
</Tabs.TabPane>
{
......@@ -372,8 +409,8 @@ const comfirmDialog: React.FC<Params> = (props) => {
}
{
commodityAttributedataSource.commodityAttributeList.length > 0 && commodityAttributedataSource.commodityAttributeList.map((item: any) => <>
<TabPane tab={item.customerAttribute.name} key={item.customerAttribute.id}>
commodityAttributedataSource.length > 0 && commodityAttributedataSource.map((item: any) => <>
<TabPane tab={item.customerAttribute.name} key={item.customerAttribute.name}>
<Space key={item.customerAttribute.id} direction="vertical" size={16}>
{item.customerAttributeValueList.map((child,childIndex) => {
return <Badge text={child.value} key={childIndex} status="default"/>
......@@ -391,12 +428,11 @@ const comfirmDialog: React.FC<Params> = (props) => {
name='purchaseNuit'
rules={[
{
required: true,
message:"请先选择需求单"
required: true
}
]}
>
<Input placeholder='' />
<Input disabled placeholder={placeholderText} />
</Form.Item>
<Form.Item
......@@ -404,12 +440,11 @@ const comfirmDialog: React.FC<Params> = (props) => {
name='purchaseQuantity'
rules={[
{
required: true,
message:"请先选择需求单"
required: true
}
]}
>
<Input placeholder='' />
<Input disabled placeholder={placeholderText} />
</Form.Item>
<Form.Item
label='报价单价'
......@@ -453,6 +488,10 @@ const comfirmDialog: React.FC<Params> = (props) => {
)
}
comfirmDialog.defaultProps = {
eqInfo:{
// purchaseQuantity: '',//数量
// purchaseNuit:''//单位
},//规格列表
dontReceive: true,
type: 1 //1.支付宝 2.支付宝转账到银行卡参数配置 3.微信
......
......@@ -3,7 +3,7 @@
* @Date: 2020-08-24 11:39:29
* @LastEditors: LeeJiancong
* @Copyright: 1549414730@qq.com
* @LastEditTime: 2020-09-12 15:55:28
* @LastEditTime: 2020-09-15 17:11:17
*/
import React, { Component, useState, useEffect,useRef } from 'react'
import ReactDOM from 'react-dom'
......@@ -248,6 +248,13 @@ const Detail: React.FC<{}> = () => {
quotationDeadline:'',//报价截至时间
requisitionFormAddress: []//地市
})
const [SetForm, setSetForm] = useState<any>('')
const proRef = useRef<any>({})
const [eqInfo, seteqInfo] = useState({
purchaseNuit:'',
purchaseQuantity:null,
modelList:[]
})//报价明细里的规格列表
const [requisitionFormId, setrequisitionFormId] = useState(null)//对应需求单号
let [dataInfo, setdataInfo] = useState<any>({
status: '',
......@@ -519,23 +526,45 @@ const Detail: React.FC<{}> = () => {
}
]
/**
* @description: 删除明细
* @param {type}
* @return {type}
*/
const hanldeDeleteModel = (index) => {
let list = productSource.slice(1,index)
// let ol = otherList.slice(1,index)
// setotherList([...ol])
setproductSource([...list])
}
const equiryColumns: ColumnType<any>[] = [
{
title: '报价商品名称',
dataIndex: 'productName',
key: 'productName',
align: 'left'
},
{
title: '品类',
dataIndex: 'category',
key: 'category',
align: 'left'
},
{
title: '商品规格型号',
dataIndex: 'model',
key: 'model',
align: 'left'
},
{
title: '品牌',
dataIndex: 'brand',
key: 'brand',
align: 'center'
},
...otherList,
// ...otherList,//不展示
{
title: '单位',
dataIndex: 'purchaseNuit',
......@@ -547,7 +576,31 @@ const Detail: React.FC<{}> = () => {
dataIndex: 'purchaseQuantity',
key: 'purchaseQuantity',
align: 'center'
}
},
{
title: '报价单价',
dataIndex: 'price',
key: 'price',
align: 'center',
render:(text,record) => <>{text}</>
},
{
title: '金额',
dataIndex: 'totalPrice',
key: 'totalPrice',
align: 'center',
render:(text,record) => <>{(record.purchaseQuantity &&record.price) ?
record.purchaseQuantity * record.price : ''}</>
},
{
title: '操作',
dataIndex: 'option',
key: 'option',
align: 'center',
render:(text,record,index) => <>
<Button type="link" onClick={(index) =>hanldeDeleteModel(index)}>删除</Button>
</>
},
]
const formSearch: ISchema = {
type: 'object',
......@@ -601,6 +654,13 @@ const Detail: React.FC<{}> = () => {
switch (type) {
case 1:
setdialogVisible(true)
console.log(proRef,proRef.current)
// proRef.current.retSetForm()
// console.log('SetForm', SetForm.current)
// if(JSON.stringify(SetForm) != '{}' && JSON.stringify(SetForm.current) != '{}'){
// SetForm.current.resetFields();//重置子组件Form方法
// }
break;
case 2:
setVisibleChannelMember(true)
......@@ -610,61 +670,6 @@ const Detail: React.FC<{}> = () => {
useEffect(() => {
let shopList = GlobalConfig.web.shopInfo.filter(v => v.type == 1).map(
v => v
)
setgoodAllIds(shopList)
// setmenberList2(menberList)
PublicApi.getManageAreaByPcodeAll({ pcode: '100000' }).then(res => {
let list = []
res.data.forEach((item: any, index: number) => {
list.push({ label: item.name, value: item.code })
})
setProvinceList(list)
})
PublicApi.getProductPlatformGetCategoryTree({ rootNodeId: null }).then(res => {
if (res.code === 1000) {
let { data } = res
setCategoryTreeOne(data)
}
})
/**
* @description: 收货地址
* @param {type}
* @return {type}
*/
PublicApi.getLogisticsSelectListShipperAddress().then(res => {
let list = []
res.data.forEach(item => {
list.push({ value: item.id, label: item.fullAddress })
})
setshipperAddressList(list)
})
/**
* @description: 省市区
* @param {type}
* @return {type}
*/
PublicApi.getManageAreaAll().then(res => {
if (res.code === 1000) {
let arr = [...res.data] //裁去最后一级别
for (let index in arr) {
for (let _index in arr[index].areaResponses) {
let o = arr[index].areaResponses
//@ts-ignore
o[_index].areaResponses = null
}
}
setProviceOptions(arr)
setAreaOption(arr)
}
})
/**
* @description: 获取详情
......@@ -673,26 +678,22 @@ const Detail: React.FC<{}> = () => {
*/
if (id) {
PublicApi.getOrderRequisitionFormDetails({ id: id }).then(res => {
PublicApi.getOrderQuotationDetails({ id: id }).then(res => {
if (res.code === 1000) {
let data = res.data
let areaCodeList = []
let _plattype = data.type ;
setplatType(data.type)
setgoodIds(data.shopIds)
setsumitGoods(data.shopIds)
setdataInfo(data)//总
setAreaParams(data.requisitionFormAddress)
if (data.requisitionFormAddress) {
data.requisitionFormAddress.forEach((v) => {
areaCodeList.push([v.provinceCode, v.cityCode])
})
}
//品类
if (data.productCategory) {
setcustomerCategoryId([data.productCategory.key])
initCreatePro(data.productCategory.key,false)//生产弹窗
}
// setAreaParams(data.requisitionFormAddress)
// if (data.requisitionFormAddress) {
// data.requisitionFormAddress.forEach((v) => {
// areaCodeList.push([v.provinceCode, v.cityCode])
// })
// }
// //品类
// if (data.productCategory) {
// setcustomerCategoryId([data.productCategory.key])
// initCreatePro(data.productCategory.key,false)//生产弹窗
// }
......@@ -703,57 +704,63 @@ const Detail: React.FC<{}> = () => {
console.log('platType',platType)
//需求单对接列表
PublicApi.getOrderRequisitionFormDemandDockingList({ id: id }).then(res => {
if (res.code === 1000) {
let { data } = res.data
if(_plattype == 2){//系统匹配
setdockingList(data)
}else if(_plattype == 3){//会员
setmemberList(data)
}
}
})
// PublicApi.getOrderRequisitionFormDemandDockingList({ id: id }).then(res => {
// if (res.code === 1000) {
// let { data } = res.data
// if(_plattype == 2){//系统匹配
// setdockingList(data)
// }else if(_plattype == 3){//会员
// setmemberList(data)
// }
// }
// })
}
})
//商品列表
PublicApi.getOrderRequisitionFormProductAll({ id: id }).then(res => {
if (res.code === 1000) {
let { data } = res
//商品
let source = []
let otherColumnkey = []//动态列的展示
data.forEach((v)=> {
let obj:any = {}
obj.model = v.model
obj.id = v.id
obj.brand = v.brand
obj.purchaseNuit = v.purchaseNuit
obj.purchaseQuantity = v.purchaseQuantity
if(v.productAttributeJson){
JSON.parse(v.productAttributeJson).forEach(child => {
Object.keys(child).forEach(key => {
//获取列头
otherColumnkey.push({
title: key,
dataIndex: key,
key: key,
align:'center'
})
// console.log('key',key,child,child[key])
obj[key] = child[key]
})
});
}
source.push(obj)
})
console.log([...source])
setotherList([...otherColumnkey])//生成列
setproductSource([...source])
PublicApi.getOrderQuotationParticulars({ id: id }).then(res => {
if(res.code === 1000){
let {data} = res.data
setproductSource([...data])
}
})
//商品列表
// PublicApi.getOrderRequisitionFormProductAll({ id: id }).then(res => {
// if (res.code === 1000) {
// let { data } = res
// //商品
// let source = []
// let otherColumnkey = []//动态列的展示
// data.forEach((v)=> {
// let obj:any = {}
// obj.model = v.model
// obj.id = v.id
// obj.brand = v.brand
// obj.purchaseNuit = v.purchaseNuit
// obj.purchaseQuantity = v.purchaseQuantity
// if(v.productAttributeJson){
// JSON.parse(v.productAttributeJson).forEach(child => {
// Object.keys(child).forEach(key => {
// //获取列头
// otherColumnkey.push({
// title: key,
// dataIndex: key,
// key: key,
// align:'center'
// })
// // console.log('key',key,child,child[key])
// obj[key] = child[key]
// })
// });
// }
// source.push(obj)
// })
// console.log([...source])
// setotherList([...otherColumnkey])//生成列
// setproductSource([...source])
// }
// })
}
......@@ -805,37 +812,8 @@ const Detail: React.FC<{}> = () => {
const handlePlatTypeChange = (e: any) => {
setplatType(e.target.value)
}
/**
* @description: 选择地区
* @param {type}
* @return {type}
*/
const onCommodityAreaChange = (value: any, selected: any, index) => {
let list = []
if (selected.length === 2) {
let item: any = {}
item.province = selected[0].name
item.provinceCode = selected[0].code
item.city = selected[1].name
item.key = index
item.cityCode = selected[1].code
if (areaParams.length == 0) {
list.push(item)
} else {
areaParams.forEach((v, childIndex) => {
console.log('v', v)
if (v.key == index) {
areaParams.splice(childIndex, 1, item)
} else {
list.push(item)
}
});
}
}
setAreaParams([...areaParams, ...list])
console.log('list', [...areaParams, ...list], 'area')
}
const changePlatform = (e: any) => {
console.log('e',e.target.value)
setplatType(e.target.value)
......@@ -858,6 +836,46 @@ const Detail: React.FC<{}> = () => {
}
}
/**
* @description: 添加时候生成列 和数据
* @param {type}
* @return {type}
*/
const productAttributeJson = (val) => {
// let source = []
// let otherColumnkey = []//动态列的展示
// let {commodityAttributeList: data} = val
// console.log(data)
// // return
// let obj:any = {}
// data.forEach((v)=> {
// // obj.model = v.model
// // obj.id = v.id
// // obj.brand = v.brand
// // obj.purchaseNuit = v.purchaseNuit
// // obj.purchaseQuantity = v.purchaseQuantity
// if(JSON.stringify(v.customerAttribute) != '{}' ){
// //获取列头
// otherColumnkey.push({
// title: v.customerAttribute.name,
// dataIndex: v.customerAttribute.name,
// key: v.customerAttribute.id,
// align:'center'
// })
// v.customerAttributeValueList.forEach((item,itemIndex) => {
// console.log('name',v.customerAttribute.name,'value',item.value)
// if(itemIndex == 0){
// obj[v.customerAttribute.name] = item.value
// }
// })
// }
// })
// source.push(obj)
// console.log([...source])
// setotherList([...otherColumnkey])//生成列
// setproductSource([...source])
}
/**
* @description: TabForm提交 保存
......@@ -866,53 +884,29 @@ const Detail: React.FC<{}> = () => {
*/
const handleSubmitTabForm = () => {
tabForm.validateFields().then(values => {
// console.log('valiue', values)
console.log('valiue', values)
values['requisitionFormId'] = requisitionFormId
if(id){
if(!haschangeCategory){
//不做处理
}else{
if (values.customerCategoryId && values.customerCategoryId.length > 0) {
values['productCategory'] = {}
values.productCategory.id = values.customerCategoryId[0]
values.productCategory.key = values.customerCategoryId[0]
let NameList = seletCategoryNameList.map((v) => {
return v.title
})
values.productCategory.name = NameList.join('-')
delete values.customerCategoryId
}
}
}else{
if (values.customerCategoryId && values.customerCategoryId.length > 0) {
values['productCategory'] = {}
values.productCategory.id = values.customerCategoryId[0]
values.productCategory.key = values.customerCategoryId[0]
let NameList = seletCategoryNameList.map((v) => {
return v.title
})
values.productCategory.name = NameList.join('-')
delete values.customerCategoryId
}
}
if (values.deliveryTime) {
values.deliveryTime = moment(values.deliveryTime).format("x")
}
if (values.quotationAsTime) {
values.quotationAsTime = moment(values.quotationAsTime).format("x")
}
values['shopIds'] = goodIds
let productList = []
productSource.forEach((v) => {
let item: any = {}
item.requisitionFormId = requisitionFormId
item.category = v.category
item.price = v.price //报价单位
item.requisitionFormNo = values.requisitionFormNo
item.specifications = v.specifications
item.productName = v.productName
item.brand = v.brand
item.model = v.model
item.purchaseNuit = v.purchaseNuit
item.purchaseQuantity = v.purchaseQuantity
item.purchaseQuantity = v.purchaseQuantity //数量
let _otherList = []
Object.keys(v).forEach(child => {
......@@ -928,56 +922,13 @@ const Detail: React.FC<{}> = () => {
productList.push(item)
console.log('item', item)
})
// values['voucherTime'] = null
values['memberIds'] = []// memberRowCtl.selectedRowKeys
if (platType == 3) {
values['memberIds'] = memberList.filter((v) => v.state == true).map(v => {
return v.memberId
})
} else if (platType == 2) {
values['memberIds'] = dockingList.filter((v) => v.state === 1).map(v => {
return v.memberId
})
}
values['demandDockings'] = []
values['requisitionFormProducts'] = [...productList]
console.log('productList', productList)
values['type'] = platType
console.log((JSON.stringify(values)))
let bb = tabForm.getFieldValue('requisitionFormAddress')
let objList = []
let arr = Array.from(new Set(areaParams))
bb.forEach(v => {
arr.forEach((item: any) => {
let obj: any = {}
if (v[0] === item.provinceCode && v[1] === item.cityCode) {
obj.provinceCode = item.provinceCode
obj.cityCode = item.cityCode
obj.province = item.province
obj.city = item.city
objList.push(obj)
} else if (v[0] === item.provinceCode) {
obj.provinceCode = item.provinceCode
obj.province = item.province
objList.push(obj)
}
});
})
let requisitionFormAddress = Array.from(new Set(objList)) || []
//省市
if (values.requisitionFormAddress.length > 0) {
values.requisitionFormAddress = [...requisitionFormAddress]
values['defaultAddres'] = 0
} else {
values['defaultAddres'] = 1
}
values['quoteDetailss'] = [...productList]
console.log('valse',values)
console.log('valse',JSON.stringify(values))
if (id) {//修改
values['id'] = id
console.log('编辑',values)
return
PublicApi.postOrderRequisitionFormUpdate(values).then(res => {
PublicApi.postOrderQuotationUpdate(values).then(res => {
if (res.code === 1000) {
setTimeout(() => {
history.goBack()
......@@ -987,7 +938,7 @@ const Detail: React.FC<{}> = () => {
} else {
PublicApi.postOrderRequisitionFormAdd(values).then(res => {
PublicApi.postOrderQuotationAdd(values).then(res => {
if (res.code === 1000) {
setTimeout(() => {
history.goBack()
......@@ -1004,34 +955,69 @@ const Detail: React.FC<{}> = () => {
* @param {type}
* @return {type}
*/
const handleSubmit = (values: any) => {
console.log('弹窗内容', values)
const handleSubmit = (values: any,sourData:any) => {
console.log('弹窗内容', values,sourData)
let item = {}
// Object.keys(values).forEach((key) => {
// item[key] = values[key]
// })
let list = []
console.log('item', item)
//先循环所有 再循环有值的
otherList.forEach((vitem: any) => {
Object.keys(values).forEach((key) => {
console.log('key', key)
if (vitem.title == key) {
console.log('vitem.title:', vitem.title)
console.log('value', values[vitem.title])
item[key] = values[vitem.title]
} else {
item[key] = values[key]
}
})
// otherList.forEach((vitem: any) => {
// Object.keys(values).forEach((key) => {
// console.log('key', key)
// if (vitem.title == key) {
// console.log('vitem.title:', vitem.title)
// console.log('value', values[vitem.title])
// item[key] = values[vitem.title]
// } else {
// item[key] = values[key]
// }
// })
// })
// list.push(item)
// console.log('list', list)
let source = []
let otherColumnkey = []//动态列的展示
let data = sourData
console.log(data)
// return
let obj:any = {}
//弹窗必填项
Object.keys(values).forEach(key => {
obj[key] = values[key]
});
obj['category'] = values.category
obj['specifications'] = values.model
//动态
data.forEach((v)=> {
if(JSON.stringify(v.customerAttribute) != '{}' ){
//获取列头
otherColumnkey.push({
title: v.customerAttribute.name,
dataIndex: v.customerAttribute.name,
key: v.customerAttribute.name,
align:'center'
})
v.customerAttributeValueList.forEach((item,itemIndex) => {
console.log('name',v.customerAttribute.name,'value',item.value)
if(itemIndex == 0){
obj[v.customerAttribute.name] = item.value
}
})
}
})
list.push(item)
console.log('list', list)
source.push(obj)
console.log([...source])
setotherList([...otherColumnkey])//生成列
setproductSource([...productSource, ...list])//新增就要合并
setproductSource([...productSource, ...source])//新增就要合并
setdialogVisible(false)
}
const onFinish = fieldsValue => {
console.log('11', fieldsValue)
const values = {
......@@ -1074,6 +1060,12 @@ const Detail: React.FC<{}> = () => {
setmemberList([...memberList])
}} />
}
/**
* @description: 选择对应需求单号
* @param {type}
* @return {type}
*/
const confirmModal = (values) => {
console.log(values)
let {id,requisitionFormNo,voucherTime} = values
......@@ -1081,6 +1073,20 @@ const Detail: React.FC<{}> = () => {
tabForm.setFieldsValue({
requisitionFormNo: requisitionFormNo
})
//查询 商品规格
PublicApi.getOrderRequisitionFormProductAll({id:id}).then(res => {
if(res.code === 1000){
let {data} = res || {}
let {purchaseNuit,purchaseQuantity} = data[0]
let list = data.map(v => v.model)
seteqInfo({...eqInfo,modelList: list,
purchaseNuit: purchaseNuit,
purchaseQuantity: purchaseQuantity
})
}
})
}
return (
......@@ -1119,18 +1125,19 @@ const Detail: React.FC<{}> = () => {
> */}
<Form.Item
label="报价单摘要"
initialValue={initialValues.details}
initialValue={initialValues.quotationSummary}
rules={[
{
required: true
}
]}
name="details"
name="quotationSummary"
>
<Input placeholder="请输入报价单摘要" maxLength={30} />
</Form.Item>
<Form.Item
label='对应需求单号'
initialValue={initialValues.requisitionFormNo}
name='requisitionFormNo'
rules={[
{
......@@ -1147,7 +1154,7 @@ const Detail: React.FC<{}> = () => {
>
<>
{
initialValues.requisitionFormNo
initialValues.quotationNo
}
</>
</Form.Item>
......@@ -1163,7 +1170,7 @@ const Detail: React.FC<{}> = () => {
>
<div>
{
initialValues.quotationDeadline ? moment(initialValues.quotationDeadline).format("YYYY-MM-DD HH:mm:ss") : ''
initialValues.quotationAsTime ? moment(initialValues.quotationAsTime).format("YYYY-MM-DD HH:mm:ss") : ''
}
</div>
</Form.Item>
......@@ -1173,7 +1180,7 @@ const Detail: React.FC<{}> = () => {
>
<div>
{
initialValues.voucherTime ? moment(initialValues.voucherTime).format("YYYY-MM-DD HH:mm:ss") : ''
initialValues.documentsTime ? moment(initialValues.documentsTime).format("YYYY-MM-DD HH:mm:ss") : ''
}
</div>
</Form.Item>
......@@ -1208,94 +1215,63 @@ const Detail: React.FC<{}> = () => {
<Button style={{ marginBottom: 16, marginTop: 24 }} block icon={<PlusOutlined />} onClick={() => handleOptionBtn(1)} type='dashed'>添加报价明细</Button>
<Table dataSource={productSource} columns={equiryColumns} pagination={pagination} />
</TabPane>
<TabPane tab="交易条件" key='3'>
<TabPane tab="其他说明" key='3'>
<Row>
<Col span={11}>
<Form.Item
initialValue={initialValues.deliveryTime ? moment(initialValues.deliveryTime) : ''}
label="交付日期"
rules={[
{
required: true,
type: 'object'
}
]}
name="deliveryTime"
>
<DatePicker style={{ width: '100%' }} />
</Form.Item>
<Form.Item
initialValue={initialValues.addresId}
label="交付地址"
initialValue={initialValues.minimumOrder}
label="最小起订"
rules={[
{
required: true
}
]}
name="addresId"
>
<Select placeholder="选择收货地址">
{
shipperAddressList.map((v: any) => {
return <Option key={v.value} value={v.value}>{v.label}</Option>
})
}
</Select>
</Form.Item>
<Form.Item
label="报价截止时间"
initialValue={initialValues.quotationAsTime ? moment(initialValues.quotationAsTime) : ''}
rules={[
{
required: true,
type: 'object'
}
]}
name="quotationAsTime"
name="minimumOrder"
>
<DatePicker showTime format="YYYY-MM-DD HH:mm" style={{ width: '100%' }} />
<Input style={{ width: '100%' }} />
</Form.Item>
<Form.Item
initialValue={initialValues.offer}
label="报价要求"
name="offer"
initialValue={initialValues.deliveryInstructions}
label="交付说明"
name="deliveryInstructions"
>
<TextArea placeholder="最长100个字符,50个汉字" maxLength={50} />
</Form.Item>
<Form.Item
initialValue={initialValues.paymentType}
label="付款方式"
name="paymentType"
initialValue={initialValues.paymentInstruction}
label="付款说明"
name="paymentInstruction"
>
<TextArea placeholder="最长100个字符,50个汉字" maxLength={50} />
</Form.Item>
<Form.Item
initialValue={initialValues.taxes}
label="税费要求"
name="taxes"
initialValue={initialValues.taxation}
label="税费说明"
name="taxation"
>
<TextArea placeholder="最长100个字符,50个汉字" maxLength={50} />
</Form.Item>
</Col>
<Col span={11} push={2}>
<Form.Item
initialValue={initialValues.logistics}
label="物流要求"
name="logistics"
initialValue={initialValues.logisticsInstructions}
label="物流说明"
name="logisticsInstructions"
>
<TextArea placeholder="最长100个字符,50个汉字" maxLength={50} />
</Form.Item>
<Form.Item
initialValue={initialValues.packRequire}
label="包装要求"
name="packRequire"
initialValue={initialValues.packingInstruction}
label="包装说明"
name="packingInstruction"
>
<TextArea placeholder="最长100个字符,50个汉字" maxLength={50} />
</Form.Item>
</Col>
<Col span={11} push={2}>
<Form.Item
initialValue={initialValues.otherRequire}
label="其他要求"
name="otherRequire"
initialValue={initialValues.otherDescription}
label="其他说明"
name="otherDescription"
>
<TextArea placeholder="最长100个字符,50个汉字" maxLength={50} />
</Form.Item>
......@@ -1304,42 +1280,7 @@ const Detail: React.FC<{}> = () => {
</Row>
</TabPane>
<TabPane tab="需求对接" key='4'>
<PlatType platType={platType} changePlatform={changePlatform}/>
{
platType == 1 &&
<RowStyleLayout>
<Row className='card-checkbox'>
{
goodAllIds.map((v, i) => {
return (
<Col key={v.id} className={cx('card-checkbox-item', isChecked(v.id) ? 'active' : '')} onClick={() => handleChange(v.id)}>
{v.logoUrl ? <img className='card-logo' src={v.logoUrl} /> : <div className='card-logo default'>logo</div>}
<span className='card-checkbox-title'>{v.name}</span>
</Col>
)
})
}
</Row>
</RowStyleLayout>
}
{
platType == 3 &&
<>
<Button style={{ marginBottom: 16, marginTop: 24 }} block icon={<PlusOutlined />} onClick={() => handleOptionBtn(2)} type='dashed'>选择会员</Button>
<Table rowKey={"id"} dataSource={memberList} columns={memberColumn(switchState)} pagination={pagination} />
</>
}
{
(platType != 1 && platType != 3) &&
<Table rowKey={"id"} dataSource={dockingList} columns={dockingColumn} pagination={pagination} />
}
</TabPane>
<TabPane tab="流转记录" key='5'>
<TabPane tab="流转记录" key='5'>
{/* <Radio.Group value={memberType} optionType="button" buttonStyle="solid" onChange={(e) => handleMemberTypeChange(e)}>
<Radio value={0}>外部单据(0)</Radio>
<Radio value={1}>内部单据</Radio>
......@@ -1363,8 +1304,12 @@ const Detail: React.FC<{}> = () => {
<RroductModal
sourceData={tabData}
dialogVisible={dialogVisible}
eqInfo={eqInfo}//需求单相关
onRef={proRef}
// onRef={(refs) => setSetForm(refs)}
mode={0}
onOK={(values: any) => handleSubmit(values)}
productAttributeJson = {productAttributeJson}
onOK={(values: any,data) => handleSubmit(values,data)}
onCancel={() => setdialogVisible(false)}
>
</RroductModal>
......@@ -1384,8 +1329,7 @@ const Detail: React.FC<{}> = () => {
}
}
tableProps={{
rowKey: 'id'
}}
rowKey: 'id'
/> */}
<ModalTable
......
......@@ -3,7 +3,7 @@
* @Date: 2020-08-24 11:39:11
* @LastEditors: LeeJiancong
* @Copyright: 1549414730@qq.com
* @LastEditTime: 2020-09-11 16:59:50
* @LastEditTime: 2020-09-15 14:11:15
*/
import React, { ReactNode, useRef, useState,useEffect } from 'react';
import { history } from 'umi';
......@@ -158,7 +158,7 @@ const List:React.FC<{}> = () => {
},[])
const toEdit = (id:number | string) => {
history.push(`/memberCenter/tranactionAbility/enquirySubmit/addEnquiry?id=${id}`)
history.push(`/memberCenter/tranactionAbility/enquiryOffer/addEnquiry?id=${id}`)
}
/**
* @description: 删除
......
......@@ -3,7 +3,7 @@
* @Date: 2020-08-24 11:39:29
* @LastEditors: LeeJiancong
* @Copyright: 1549414730@qq.com
* @LastEditTime: 2020-09-11 11:43:16
* @LastEditTime: 2020-09-15 15:15:36
*/
import React, { Component, useState, useEffect } from 'react'
import ReactDOM from 'react-dom'
......@@ -912,7 +912,6 @@ const Detail: React.FC<{}> = () => {
if (id) {//修改
values['id'] = id
console.log('编辑',values)
return
PublicApi.postOrderRequisitionFormUpdate(values).then(res => {
if (res.code === 1000) {
setTimeout(() => {
......@@ -922,7 +921,6 @@ const Detail: React.FC<{}> = () => {
})
} else {
PublicApi.postOrderRequisitionFormAdd(values).then(res => {
if (res.code === 1000) {
setTimeout(() => {
......
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