Commit 48590cde authored by Bill's avatar Bill

Merge branch 'dev' of 10.0.0.22:lingxi/lingxi-business-paltform into dev

parents eaf30f12 84956d1c
......@@ -18,7 +18,8 @@
"prettier": "prettier --write '**/*.{js,jsx,tsx,ts,less,md,json}'",
"test": "umi-test",
"test:coverage": "umi-test --coverage",
"start:cross": "cross-env SITE_ID=352 yarn start"
"start:cross": "cross-env SITE_ID=352 yarn start",
"start:url": "cross-env SITE_ID=1 BACK_GATEWAY=http://lingxi-all.wg.shushangyun.com yarn start"
},
"lint-staged": {
"*.{js,jsx,less,md,json}": [
......
......@@ -44,8 +44,8 @@ export enum LAYOUT_TYPE {
}
// 本地环境跳过权限校验
export const isDev = process.env.NODE_ENV === "development"
// export const isDev = false
// export const isDev = process.env.NODE_ENV === "development"
export const isDev = false
export const Environment_Status = {
0: "所有",
......
......@@ -17,10 +17,6 @@ export const useAsyncSelect = async (name, service: () => Promise<any[]>, format
})
linkage.loading(name)
service().then(res => {
setFieldState(name, state => {
state.originAsyncData = res
})
linkage.loaded(name)
if (format) {
const [labelString, valueString] = format
res = res.map(v => ({
......@@ -28,6 +24,11 @@ export const useAsyncSelect = async (name, service: () => Promise<any[]>, format
value: v[valueString]
}))
}
setFieldState(name, state => {
state.originAsyncData = res
})
linkage.loaded(name)
linkage.enum(name, res)
//请求结束可以dispatch一个自定义事件收尾,方便后续针对该事件做联动
dispatch('requestAsyncSelect', {
......
......@@ -2,7 +2,7 @@
* @Author: LeeJiancong
* @Date: 2020-07-15 10:31:55
* @LastEditors: LeeJiancong
* @LastEditTime: 2020-10-09 11:00:43
* @LastEditTime: 2020-10-09 14:41:19
*/
import React, { Component, useState, useEffect } from 'react';
import ReactDOM from 'react-dom'
......@@ -335,10 +335,13 @@ const diaLogForm: React.FC<ListProps> = (props) => {
x-component-props={{
placeholder: '请输入发货人'
}}
x-rules= {{
x-rules= {[{
max: 20,
message:'输入发货人字数不能大于20'
}}
},{
required: true,
message:'请输入发货人'
}]}
/>
:
<Field
......@@ -349,10 +352,13 @@ const diaLogForm: React.FC<ListProps> = (props) => {
x-component-props={{
placeholder: '请输入收货人'
}}
x-rules= {{
x-rules= {[{
max: 20,
message:'输入收货人字数不能大于20'
}}
},{
required: true,
message:'请输入收货人'
}]}
/>
}
......@@ -366,6 +372,10 @@ const diaLogForm: React.FC<ListProps> = (props) => {
x-component-props={{
placeholder: '-省份/直辖市-'
}}
x-rules= {[{
required: true,
message:'请选择省份/直辖市'
}]}
/>
<Field
x-mega-props={{ span: 1 }}
......@@ -376,16 +386,25 @@ const diaLogForm: React.FC<ListProps> = (props) => {
x-component-props={{
placeholder: '-市-'
}}
x-rules= {[{
required: true,
message:'请选择城市'
}]}
/>
<Field
x-mega-props={{ span: 1 }}
x-component="Select"
enum={selectList}
required
name="districtCode"
x-component-props={{
placeholder: '-区-'
}}
x-rules= {[{
required: true,
message:'请选择县市'
}]}
/>
</FormMegaLayout>
<Field
......@@ -397,10 +416,13 @@ const diaLogForm: React.FC<ListProps> = (props) => {
placeholder: '请输入详细地址',
autocomplete: 'off'
}}
x-rules= {{
x-rules= {[{
max: 30,
message:'输入详细地址字数不能大于30'
}}
},{
required: true,
message:'请输入详细地址'
}]}
/>
<Field
title="邮编"
......@@ -421,18 +443,25 @@ const diaLogForm: React.FC<ListProps> = (props) => {
x-component-props={{
placeholder: '+86'
}}
x-rules= {[{
required: true,
message:'请选择区号'
}]}
/>
<Field
x-mega-props={{ span: 5 }}
name="phone"
required
x-component="Input"
x-rules={{
x-rules={[{
pattern: PATTERN_MAPS.phone,
message:'请输入正确手机号',
// maximum={11}数值的意思
}}
},{
required: true,
message:'请输入手机号'
}]}
x-component-props={{
placeholder: '输入你的手机号码',
......
......@@ -12,18 +12,24 @@ import { PublicApi } from '@/services/api'
const { TabPane } = Tabs;
const AddQuotes: React.FC<{}> = () => {
const [memberList, setmemberList] = useState([]);
const [memberList, setmemberList] = useState([]); //存放用户信息
const [goodsList, setgoodsList] = useState([]); //存放商品
const basicInfoRef = useRef<any>({});
const tradingConditionsRef = useRef<any>({});
/************* 页面的一些操作start *************/
const onSumbit = async (params: any) => {
const basicInfo = await basicInfoRef.current.validateFields();
const tradingConditions = await tradingConditionsRef.current.validateFields();
console.log(tradingConditions, basicInfo)
console.log(tradingConditions, basicInfo, goodsList, memberList)
}
// 获取到会员信息
const getMemberList = (list: any) => {
setmemberList(list);
}
// 获取添加的商品列表
const getGoodsList = (list:any) => {
setgoodsList(list)
}
/************* 页面的一些操作end *************/
return (
<PageHeaderWrapper
......@@ -45,6 +51,7 @@ const AddQuotes: React.FC<{}> = () => {
<TabPane tab="询价商品" key="2">
<EnquiryGoods
memberList={memberList}
getGoodsList={getGoodsList}
/>
</TabPane>
<TabPane tab="交易条件" key="3">
......
import React, { useState, useEffect } from 'react';
import styles from './index.less';
import { Button, message, Input,Table } from 'antd';
import { Button, message, Input, Table, Form } from 'antd';
import { ColumnType } from 'antd/lib/table/interface';
import { PlusOutlined } from '@ant-design/icons';
import { useRowSelectionTable } from '@/hooks/useRowSelectionTable';
......@@ -15,86 +15,34 @@ import Submit from '@/components/NiceForm/components/Submit'
interface queryProps extends ModalTableProps {
memberList?: any,
schemaAction?: ISchemaFormActions | ISchemaFormAsyncActions
schemaAction?: ISchemaFormActions | ISchemaFormAsyncActions,
getGoodsList: Function
}
// 只能输入数字的输入框
const NumericInput = (props) => {
const onChange = (e) => {
const { value } = e.target;
const reg = /^-?\d*(\.\d*)?$/;
if ((!isNaN(value) && reg.test(value)) || value === "" || value === "-") {
props.onChange(value);
}
};
const onBlur = () => {
const { value, onBlur, onChange } = props;
let valueTemp = value;
if (value.charAt(value.length - 1) === "." || value === "-") {
valueTemp = value.slice(0, -1);
}
onChange(valueTemp.replace(/0*(\d+)/, "$1"));
if (onBlur) {
onBlur();
}
};
return (
<Input
{...props}
onChange={onChange}
onBlur={onBlur}
maxLength={25}
/>
);
};
const EnquiryGoods: React.FC<queryProps> = (props) => {
const { memberList, schemaAction, ...restProps } = props
const { memberList, schemaAction, getGoodsList, ...restProps } = props
const [value, setValue] = useState<any>('')
const productFormActions = createAsyncFormActions()
const onChange = (value) => {
setValue(value);
};
const columns: ColumnType<any>[] = [{
title: '序号',
dataIndex: 'productId',
}, {
title: '商品名称',
dataIndex: 'productName',
}, {
title: '品类',
dataIndex: 'inquiryListNo',
}, {
title: '品牌',
dataIndex: 'brand',
}, {
title: '单位',
dataIndex: 'nuit',
}, {
title: '采购数量',
dataIndex: 'purchaseQuantity',
render:(text:any, record: any) => (
<NumericInput value={value} onChange={onChange} />
)
}, {
title: '操作',
dataIndex: 'operation',
render:(text:any, record: any) => <Button type='link' onClick={() => handleDelete(record)}>删除</Button>
}]
// 会员添加弹窗控制
const [visibleChannelMember, setVisibleChannelMember] = useState(false);
const [goodsList, setgoodsList] = useState([]);
const [memberRowSelection, memberRowCtl] = useRowSelectionTable({ customKey: 'commodityId' });
const handleOkAddMember = () => {
setVisibleChannelMember(false);
const arr : any[] = []
const arr: any[] = []
memberRowCtl.selectRow.forEach((v, i) => {
arr.push({
productId: v.commodityId,
productName: v.name,
inquiryListNo: v.customerCategoryName,
brand: v.brandName,
nuit: v.unitName
nuit: v.unitName,
purchaseQuantity: 0
})
setgoodsList(arr)
})
......@@ -175,7 +123,51 @@ const EnquiryGoods: React.FC<queryProps> = (props) => {
}
}
}
/**输入框输入 */
const inputOnchange = (id, e) => {
const {value} = e.target
goodsList.forEach(v => {
if(v.productId === id) {
v.purchaseQuantity = value
}
})
getGoodsList(goodsList) // 返回给父级
setgoodsList(goodsList)
}
const columns: ColumnType<any>[] = [{
title: '序号',
dataIndex: 'productId',
}, {
title: '商品名称',
dataIndex: 'productName',
}, {
title: '品类',
dataIndex: 'inquiryListNo',
}, {
title: '品牌',
dataIndex: 'brand',
}, {
title: '单位',
dataIndex: 'nuit',
}, {
title: '采购数量',
dataIndex: 'purchaseQuantity',
render: (text: any, record: any) => (
<Form.Item name={record.productId} noStyle initialValue={record.purchaseQuantity}>
<Input
onBlur={(e) => inputOnchange(record.productId, e)}
type='number'
maxLength={25}
/>
</Form.Item>
)
}, {
title: '操作',
dataIndex: 'operation',
render: (text: any, record: any) => <Button type='link' onClick={() => handleDelete(record)}>删除</Button>
}]
// 模拟数据
const data = [{
commodityId: 1,
......@@ -184,26 +176,26 @@ const EnquiryGoods: React.FC<queryProps> = (props) => {
brandName: 'PELLE',
unitName: '个',
},{
}, {
commodityId: 2,
name: '进口头层黄牛皮荔枝纹/红色/XXL',
customerCategoryName: '牛皮',
brandName: 'PELLE',
unitName: '个',
},{
}, {
commodityId: 3,
name: '进口头层黄牛皮荔枝纹/红色/XXL',
customerCategoryName: '牛皮',
brandName: 'PELLE',
unitName: '个',
},{
}, {
commodityId: 4,
name: '进口头层黄牛皮荔枝纹/红色/XXL',
customerCategoryName: '牛皮',
brandName: 'PELLE',
unitName: '个',
},{
}, {
commodityId: 5,
name: '进口头层黄牛皮荔枝纹/红色/XXL',
customerCategoryName: '牛皮',
......@@ -233,7 +225,7 @@ const EnquiryGoods: React.FC<queryProps> = (props) => {
}, [memberList])
// 添加商品
const addGoods = () => {
if(memberList.length > 0 && memberList[0].memberId) {
if (memberList.length > 0 && memberList[0].memberId) {
setVisibleChannelMember(true);
} else {
message.error('请选择被询价会员')
......@@ -254,14 +246,17 @@ const EnquiryGoods: React.FC<queryProps> = (props) => {
return (
<div className={styles.revise_style}>
<Button block type='dashed' onClick={addGoods}><PlusOutlined />添加商品</Button>
<Table rowKey={'productId'} style={{marginTop: '16px'}} columns={columns} dataSource={goodsList} pagination={false} />
<Form>
<Table rowKey={'productId'} style={{ marginTop: '16px' }} columns={columns} dataSource={goodsList} pagination={false} />
</Form>
{/* 选择商品弹框 */}
<ModalTable
modalTitle='选择商品'
confirm={handleOkAddMember}
cancel={handleCancelAddMember}
visible={visibleChannelMember}
resetModal={{destroyOnClose: true, forceRender: true}}
resetModal={{ destroyOnClose: true, forceRender: true }}
columns={columnsSetMember}
rowSelection={memberRowSelection}
fetchTableData={params => fetchGoodsList(params)}
......@@ -287,6 +282,7 @@ const EnquiryGoods: React.FC<queryProps> = (props) => {
}}
{...restProps}
/>
</div>
)
}
......
import React, { useEffect } from 'react';
import React, { useState, useEffect } from 'react';
import styles from './index.less';
import moment from 'moment';
import { Form, Input, Select, Row, Col, DatePicker } from 'antd';
import { PublicApi } from '@/services/api';
interface queryProps {
currentRef?: any
......@@ -16,6 +17,7 @@ const layout: any = {
const TradingConditions: React.FC<queryProps> = (props) => {
const { currentRef } = props;
const [TradingConditionsForm] = Form.useForm();
const [address, setAddress] = useState<any>([]);
const hadnleValidateFields = () => {
return new Promise((resolve) => {
TradingConditionsForm.validateFields().then(values => {
......@@ -49,6 +51,13 @@ const TradingConditions: React.FC<queryProps> = (props) => {
currentRef.current = userAction;
}
}
// 获取交付地址
PublicApi.getLogisticsSelectListReceiverAddress().then(res => {
setAddress(res.data)
console.log(res.data)
})
}, [])
return (
<Form
......@@ -61,9 +70,11 @@ const TradingConditions: React.FC<queryProps> = (props) => {
<Form.Item label='交付日期' name='deliveryTime' rules={[{ required: true, message: '请选择交付日期' }]}>
<DatePicker format="YYYY-MM-DD HH:mm:ss" />
</Form.Item>
<Form.Item label='交付地址' name='' rules={[{ required: true, message: '请选择交付地址' }]}>
<Form.Item label='交付地址' name='fullAddress' rules={[{ required: true, message: '请选择交付地址' }]}>
<Select>
<Select.Option value="demo">Demo</Select.Option>
{address.lengtn > 0 && address.map(v => (
<Select.Option key={v.id} value={v.id}>{v.fullAddress}</Select.Option>
))}
</Select>
</Form.Item>
<Form.Item label='报价截止时间' name='quotationAsTime' rules={[{ required: true, message: '请选择报价截止时间' }]}>
......
......@@ -167,7 +167,7 @@ const OrderElectronModal:React.FC<OrderElectronModalProps> = (props) => {
expressionScope={{
electronBtn
}}
effects={($) => {
effects={($, actions) => {
useAsyncSelect('contractTemplateId', async () => (await PublicApi.getOrderSelectListContractTemplate()).data, ['name', 'id'])
}}
/>
......
......@@ -282,17 +282,19 @@ const OrderProductTable:React.FC<OrderProductTableProps> = (props) => {
const hasPriceList = orderProductRequests.filter(v => !v.memberPrice)
if (hasPriceList.length > 0) {
asyncGetMemberPrice(hasPriceList).then((asyncData) => {
const newData = orderProductRequests.map((v, i) => {
if (!v.memberPrice) {
v.memberPrice = asyncData.find(j => j.id === v.id)?.value || ''
}
return v
})
ctl.setData({
...data,
orderProductRequests: newData
})
if (asyncData.length > 0) {
const newData = orderProductRequests.map((v, i) => {
if (!v.memberPrice) {
v.memberPrice = asyncData.find(j => j.id === v.id)?.value || 0
}
return v
})
ctl.setData({
...data,
orderProductRequests: newData
})
}
})
}
}, [orderProductRequests])
......
......@@ -228,6 +228,8 @@ const CommonOrderDetail:React.FC<CommonOrderDetailProps> = (props) => {
titleLabel: '订单号: ',
titleValue: formData.orderNo
} : null
console.log('123')
return formData ? (
<div>
<OrderDetailContext.Provider value={formContext}>
......
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