Commit d856c42a authored by GuanHua's avatar GuanHua
parents 4efea365 113a9b09
{"userRegister":{"useType":{"memberType":[{"id":1,"typeName":"企业会员"},{"id":3,"typeName":"渠道企业会员"},{"id":4,"typeName":"渠道个人会员"},{"id":2,"typeName":"个人会员"}],"businessType":[{"id":1,"typeName":"采购"},{"id":39,"typeName":"供货"}]}},"web":{"shopInfo":[{"id":302,"name":"云鲜采企业商城","type":1,"environment":1,"logoUrl":"https://shushangyun01.oss-cn-shenzhen.aliyuncs.com/5b19a059530a4060984fc045125da1f81597395561658.png","describe":null,"state":1,"url":"/"},{"id":303,"name":"云鲜采渠道商城","type":3,"environment":1,"logoUrl":"https://shushangyun01.oss-cn-shenzhen.aliyuncs.com/a63c8c81e74947f88c64d4c72bfb565c1597395598958.png","describe":null,"state":1,"url":"/shop"}]},"global":{"siteId":502,"siteUrl":"http://localhost:4396","logo":"https://shushangyun01.oss-cn-shenzhen.aliyuncs.com/4db4e7c5424c471c968ab540bce027f31597319423082.png","countryList":[{"name":"简体中文-ZH","key":"zh-CN","icon":"http://lingxi-frontend-test.oss-cn-hangzhou.aliyuncs.com/images/china.png"},{"name":"English-EN","key":"en-US","icon":"http://lingxi-frontend-test.oss-cn-hangzhou.aliyuncs.com/images/us.png"},{"name":"日本語-JP","key":"jp","icon":"http://lingxi-frontend-test.oss-cn-hangzhou.aliyuncs.com/images/japen.png"},{"name":"한국어-KO","key":"ko","icon":"http://lingxi-frontend-test.oss-cn-hangzhou.aliyuncs.com/images/koren.png"}]}}
......@@ -3,11 +3,13 @@
"scripts": {
"api": "god-ytt",
"scripts:build": "node scripts/run",
"scripts:build-yxc": "node scripts/run http://yxc-web-demo.shushangyun.com/api",
"start:dev": "umi dev",
"start:analyze": "ANALYZE=1 umi dev",
"clean": "rimraf node_modules",
"start": "yarn api && yarn scripts:build && umi dev",
"build": "yarn api && yarn scripts:build && umi build",
"build:yxc": "yarn api && yarn scripts:build-yxc && umi build",
"build:analyze": "ANALYZE=1 umi build",
"build:dev": "pm2 start scripts/devServer.js",
"postinstall": "umi generate tmp",
......
......@@ -11,8 +11,10 @@ const demoFetch = require('../../demo').fetchConfig
const isDemo = true
const remoteUrl = process.argv[2] || 'http://10.0.0.25:8100'
const axios = Axios.create({
baseURL: 'http://10.0.0.25:8100',
baseURL: remoteUrl,
responseType: 'json',
})
......@@ -67,8 +69,13 @@ async function batchAxiosHttps() {
// serverFn(asyncHttpQueue)
for (const item in serviceConfig) {
for (const subItem in serviceConfig[item]) {
const data = await axios(serviceConfig[item][subItem])
asyncHttpQueue[item][subItem] = data.data.data
try {
const data = await axios(serviceConfig[item][subItem])
asyncHttpQueue[item][subItem] = data.data.data
} catch(err) {
console.log(serviceConfig[item][subItem].url)
console.log(err.response.data)
}
}
}
return isDemo ? Object.assign(asyncHttpQueue, await demoFetch()) : asyncHttpQueue
......
import React, { useState } from 'react';
import { Input, Space, Select, Button } from 'antd';
import { CaretUpOutlined, CaretDownOutlined } from '@ant-design/icons';
import { useFieldState, FormPath, FormEffectHooks } from '@formily/antd';
import { FORM_FILTER_PATH } from '@/formSchema/const';
import { PublicApi } from '@/services/api';
const { Option } = Select
// export interface SearchProps {
// value: string;
// mutators: any;
// props: any;
// }
const CustomInputSearch = props => {
console.log(props);
// const [state, setState] = useFieldState({
// filterSearch: false,
// });
const justifyAlign = props.props['x-component-props'].align || 'flex-end';
// const changeFilterVisible = () => {
// if (state.filterSearch) {
// props.form.reset({
// // 清除FILTER_PARAMS下所有字段
// selector: `*.${FORM_FILTER_PATH}.*`,
// });
// }
// setState({
// filterSearch: !state.filterSearch,
// });
// };
const [brandData, setBrandData] = useState<any>([])
const [brandValue, setBrandValue] = useState(undefined)
const handleBrandSearch = (value: any) => { // end value
console.log(value, 'handleBrandSearch')
if (value) {
PublicApi.getProductSelectGetSelectBrand({ name: value }).then(res => {
if (res.code === 1000)
setBrandData(res.data)
})
} else {
setBrandData([])
}
}
return (
<Space size={20} style={{ justifyContent: justifyAlign, width: '100%' }}>
<Select
showSearch={true}
showArrow={true}
placeholder="品牌"
value={brandValue}
defaultActiveFirstOption={false}
filterOption={false}
onSearch={value => handleBrandSearch(value)}
onChange={v => props.mutators.change(v)}
notFoundContent={null}
style={{ width: '174px', lineHeight: '32px' }}
{...props.props['x-component-props']}
>
{brandData.map(d => <Option value={d.id} key={d.id}>{d.name}</Option>)}
</Select>
{/* <Input.Search
value={props.value || ''}
onChange={e => props.mutators.change(e.target.value)}
onSearch={(_, e) => {
e.preventDefault();
props.form.submit();
}}
{...props.props['x-component-props']}
/> */}
</Space>
);
};
CustomInputSearch.defaultProps = {};
CustomInputSearch.isFieldComponent = true;
export default CustomInputSearch;
......@@ -9,6 +9,7 @@ import CustomStatus from './components/CustomStatus';
import CustomAddArray from './components/CustomAddArray';
import CustomSlider from './components/CustomSlider';
import Search from './components/Search';
import CustomInputSearch from './components/CustomInputSearch'
import Submit from './components/Submit';
import Text from './components/Text';
import CardCheckBox from './components/CardCheckBox';
......@@ -82,6 +83,7 @@ const NiceForm: React.FC<NiceFormProps> = props => {
CustomAddArray,
CustomSlider,
Search,
CustomInputSearch,
Submit,
Text,
CardCheckBox,
......
......@@ -9,7 +9,7 @@ export const MALL_TYPE = {
}
// 本地环境跳过权限校验
export const isDev = false
export const isDev = true
export const Environment_Status = {
0: "所有",
......
......@@ -54,6 +54,12 @@ export const useRowSelectionTable = (options: useRowSelectionOptions = {}): [Tab
type,
// 为解决分页情况下, 保存多选的数据
onSelect: (record, selects, selectedRows, nativeEvent) => {
if (type === 'radio') {
// 单选情况下
setSelectedRowKeys([record.id])
setSelectRow([record])
return ;
}
const findIds = selectedRowKeys.indexOf(record.id)
if (findIds === -1) {
mergeRowKeys(record.id)
......
......@@ -108,7 +108,10 @@ const AddGoods = () => {
}
const onFinish = (values:any) => {
PublicApi.postProductGoodsSaveOrUpdateGoods({...values})
PublicApi.postProductGoodsSaveOrUpdateGoods({...values}).then(res => {
if(res.code === 1000)
history.goBack()
})
};
return (<PageHeaderWrapper
......
......@@ -314,9 +314,9 @@ const Goods: React.FC<{}> = () => {
console.log('取消删除')
}
const handleSearch = (val: string) => {
const handleSearch = (val?: string) => {
console.log(val)
let obj = { ...filterParams, name: val }
let obj = val ? { ...filterParams, name: val } : { ...filterParams }
setFilterParams(obj)
//@ts-ignore
ref.current.reload(obj)
......@@ -402,6 +402,28 @@ const Goods: React.FC<{}> = () => {
tableProps={{ rowKey: "id" }}
fetchTableData={(params: any) => fetchData(params)}
controlRender={
// <NiceForm
// actions={formActions}
// onSubmit={values => ref.current.reload(values)}
// expressionScope={{
// controllerBtns,
// }}
// effects={($, actions) => {
// useStateFilterSearchLinkageEffect(
// $,
// actions,
// 'name',
// FORM_FILTER_PATH,
// );
// // useAsyncInitSelect(
// // ['memberType', 'roleId', 'level', 'source'],
// // fetchSearchItems,
// // );
// }}
// schema={goodsSchema}
// />
<Row>
<Col span={24}>
<Row gutter={[16,16]} justify="space-between" style={{marginBottom:0}}>
......@@ -475,6 +497,9 @@ const Goods: React.FC<{}> = () => {
<Col span={4}>
<Input name="batch" value={filterParams.batch} onChange={(e)=>setFilterParams({...filterParams, batch: e.target.value})} placeholder="导入批次"></Input>
</Col>
<Col>
<Button type="primary" onClick={()=>handleSearch()}>查询</Button>
</Col>
</Col>
</Row>
</Col>
......
......@@ -51,15 +51,9 @@ export const goodsSchema: ISchema = {
},
brandId: {
type: 'string',
enum: [],
'x-component': 'CustomInputSearch',
'x-component-props': {
placeholder: '品牌',
showSearch: true,
showArrow: true,
filterOption: false,
defaultActiveFirstOption: false,
notFoundContent: false,
style: { width: '100%' },
},
},
customerCategoryId: {
......
......@@ -128,10 +128,12 @@ const AddProducts: React.FC<{}> = (props) => {
_params.id = id ? id : null
console.log(_params,'_params')
PublicApi.postProductCommoditySaveOrUpdateCommodity(_params).then(res => {
console.log(res, 'res')
setIsEnableCheck(false)
//@ts-ignore
setReponseId(res.data)
if(res.code === 1000){
setIsEnableCheck(false)
//@ts-ignore
setReponseId(res.data)
history.goBack()
}
})
}).catch(error => {
message.error("请完善表单必填项!")
......
......@@ -8,17 +8,16 @@
padding: 0;
li{
padding-left: 24px;
height: 32px;
line-height: 32px;
// height: 32px;
// line-height: 32px;
color: #172B4D;
display: flex;
justify-content: space-between;
margin: 8px 0;
cursor: pointer;
// span{
// padding-top: 12px;
// padding-bottom: 12px;
// }
span{
padding-right: 16px;
}
a{
color: #97A0AF;
float: right;
......
......@@ -48,6 +48,8 @@ const PriceAttributeForm: React.FC<Iprops> = (props) => {
const [attributeObjArr, setAttributeObjArr] = useState<any[]>([])
const [attributeValObjArr, setAttributeValObjArr] = useState<any[]>([])
const [validatorArray, setValidatorArray] = useState<any>([])
const [colums, setColumns] = useState<ColumnType<any>[]>()
const { ProductStore } = store
const {
......@@ -339,6 +341,19 @@ const PriceAttributeForm: React.FC<Iprops> = (props) => {
priceForm.setFieldsValue({unitName: option.children})
}
// 校验数值范围
const validatorNumberRange = (rule, value, callback) => {
try {
setValidatorArray([...validatorArray, value])
console.log(value, [...validatorArray, value], 'rule')
if(value.numberMin >= value.numberMax){
throw new Error('请正确输入数值范围')
}
} catch (err) {
// callback(err)
}
}
return (<>
<Form
{...layout}
......@@ -347,7 +362,7 @@ const PriceAttributeForm: React.FC<Iprops> = (props) => {
labelAlign="left"
ref={priceFormRef}
colon={false}
initialValues={productInfoByEdit?.id ? getPriceAttributeFormParamsByEdit : {}}
initialValues={productInfoByEdit?.id ? getPriceAttributeFormParamsByEdit : {isMemberPrice: false}}
autoComplete="off"
>
<Form.Item
......@@ -407,7 +422,7 @@ const PriceAttributeForm: React.FC<Iprops> = (props) => {
transform: (value) => Number(value)
}]}
>
<Input placeholder="请输入最小起订数" />
<InputNumber style={{width: '100%'}} min={0} placeholder="请输入最小起订数" />
</Form.Item>
<Form.Item
name="priceType"
......@@ -441,10 +456,10 @@ const PriceAttributeForm: React.FC<Iprops> = (props) => {
</Tooltip>
</span>
}
rules={[{
required: true,
message: '请选择会员折扣'
}]}
// rules={[{
// required: true,
// message: '请选择会员折扣'
// }]}
valuePropName="checked"
>
<Checkbox>允许使用会员折扣价购买</Checkbox>
......@@ -499,10 +514,24 @@ const PriceAttributeForm: React.FC<Iprops> = (props) => {
fieldKey={[field.fieldKey, 'numberRange']}
key={'_' + field.fieldKey}
noStyle
// rules={[
// {
// validator: validatorNumberRange
// }
// ]}
>
<Input.Group compact>
<Form.Item name={[field.name, 'numberRange', 'numberMin']} noStyle>
<Input style={{ width: 100, textAlign: 'center' }} placeholder="最小数量" />
<Form.Item
name={[field.name, 'numberRange', 'numberMin']}
noStyle
rules={[
{
pattern: /^\d+(\.\d{1,3})?$/,
message: '小数点后仅限三位',
}
]}
>
<InputNumber style={{ width: 100, textAlign: 'center' }} placeholder="最小数量" />
</Form.Item>
<Input
style={{
......@@ -514,8 +543,17 @@ const PriceAttributeForm: React.FC<Iprops> = (props) => {
placeholder="~"
disabled
/>
<Form.Item name={[field.name, 'numberRange', 'numberMax']} noStyle>
<Input
<Form.Item
name={[field.name, 'numberRange', 'numberMax']}
noStyle
rules={[
{
pattern: /^\d+(\.\d{1,3})?$/,
message: '小数点后仅限三位',
}
]}
>
<InputNumber
className={styles.siteInputRight}
style={{
width: 100,
......@@ -532,8 +570,14 @@ const PriceAttributeForm: React.FC<Iprops> = (props) => {
fieldKey={[field.fieldKey, 'numberPrice']}
key={'__' + field.fieldKey}
noStyle
rules={[
{
pattern: /^\d+(\.\d{1,4})?$/,
message: '小数点后仅限四位',
}
]}
>
<Input style={{ width: '50%', marginLeft: 24 }} placeholder="请输入单价" />
<InputNumber style={{ width: '50%', marginLeft: 24 }} placeholder="请输入单价" />
</Item>
</Col>
<Col span={4}>
......@@ -549,9 +593,18 @@ const PriceAttributeForm: React.FC<Iprops> = (props) => {
</Form.Item> : <Form.Item
label={planPrice===3?"所需积分":"单价"}
name="uniquePrice"
rules={[{ required: true, message: planPrice===3?'请输入积分!':'请输入价格!' }]}
rules={[
{
required: true,
message: planPrice===3?'请输入积分!':'请输入价格!'
},
{
pattern: planPrice!==3 && /^\d+(\.\d{1,4})?$/,
message: planPrice!==3 && '小数点后仅限四位',
}
]}
>
<Input placeholder={planPrice===3?"请输入积分":"请输入价格"} />
<InputNumber style={{width: '100%'}} placeholder={planPrice===3?"请输入积分":"请输入价格"} />
</Form.Item>
}
</Form>
......
......@@ -109,16 +109,39 @@ const ProductImageForm: React.FC<Iprops> = (props) => {
}
const beforeUpload = (file: UploadFile) => {
console.log(file,'file')
const isJpgOrPng = file.type === 'image/jpeg' || file.type === 'image/png' || file.type === 'image/jpg';
if (!isJpgOrPng) {
message.error('仅支持上传JPEG/JPG/PNG文件!')
}
const isLt2M = file.size / 1024 / 1024 < 2;
const isLt2M = file.size / 1024 < 600;
if (!isLt2M) {
message.error('上传图片不超过2MB!');
}
return isJpgOrPng && isLt2M;
return isJpgOrPng && isLt2M && isSize(file, 800, 800);
}
//检测尺寸
const isSize = (file, w, h) => {
return new Promise((resolve, reject) => {
let width = w;
let height = h;
let _URL = window.URL || window.webkitURL;
let img = new Image();
img.onload = function() {
let valid = img.width < width && img.height < height;
valid ? resolve() : reject();
};
img.src = _URL.createObjectURL(file);
}).then(
() => {
return file;
},
() => {
message.error(file.name + "图片尺寸不符合要求,请修改后重新上传!");
return Promise.reject();
}
);
};
const handlePreview = async file => {
if (!file.url && !file.preview) {
......
......@@ -126,7 +126,7 @@ const FastModifyPrice: React.FC<{}> = () => {
else if (record.status === 3)
component = (<><span className="commonStatusValid"></span>审核通过</>)
else if (record.status === 4)
component = (<><span className="commonStatusInvalid">审核不通过</span></>)
component = (<><span className="commonStatusInvalid"></span>审核不通过</>)
else if (record.status === 5)
component = (<span style={{ color: '#00B37A', padding: '2px 5px', background: 'rgba(235,247,242,1)', borderRadius: '4px' }}>已上架</span>)
else if (record.status === 6)
......
......@@ -524,9 +524,9 @@ const Products: React.FC<{}> = () => {
console.log(value, 'handleClassChange')
}
const handleSearch = (val: string) => {
const handleSearch = (val?: string) => {
console.log(val)
let obj = {...filterParams, name: val}
let obj = val ? {...filterParams, name: val} : { ...filterParams }
setFilterParams(obj)
//@ts-ignore
ref.current.reload(obj)
......@@ -682,6 +682,9 @@ const Products: React.FC<{}> = () => {
/>
</Input.Group>
</Col>
<Col>
<Button type="primary" onClick={()=>handleSearch()}>查询</Button>
</Col>
</Col>
</Row>
</Col>
......
......@@ -202,7 +202,7 @@ const viewProducts: React.FC<{}> = () => {
const content = <>
<Descriptions colon={true} style={{paddingLeft:128}}>
<Descriptions.Item label="商品品牌">{productDetail?.brand?.name}</Descriptions.Item>
<Descriptions.Item label="商品品类">{productDetail?.customerCategoryFullName}</Descriptions.Item>
<Descriptions.Item label="商品品类">{productDetail?.customerCategory?.fullName}</Descriptions.Item>
<Descriptions.Item label="上架商城">
{
productDetail?.commodityShopList?.length>0 && productDetail.commodityShopList.map((item, index)=><span key={index}>{item.name}&nbsp;</span>)
......
......@@ -78,7 +78,7 @@ const AddRepository:React.FC<{}> = (props) => {
{ dataIndex: 'repositOut', title: '调出库存', align: 'center', render: (_, record) => {
return <div>
<p><span>调入库存:</span><span>{record.foldInventory}</span></p>
<p><span>调入库存:</span><span>{record.foldRearInventory}</span></p>
<p><span>调入库存:</span><span>{record.foldRearInventory}</span></p>
</div>
} },
{ dataIndex: 'allotTime', title: '调拨时间', align: 'center' },
......
This source diff could not be displayed because it is too large. You can view the blob instead.
......@@ -67,7 +67,6 @@ const baseRequest = extend({
// 请求拦截器
baseRequest.interceptors.request.use((url: string, options: RequestOptionsInit): { url: string, options: RequestOptionsInit } => {
// 判断是否有权限
const loginAfterHeaders = getAuth()
const headers = {
......@@ -101,6 +100,7 @@ class ApiRequest {
createRequest<T>(url: string, options: IApiRequest = { ctlType: 'none' }): Promise<IRequestSuccess<T>> {
return new Promise((resolve, reject) => {
console.log(options)
baseRequest<IRequestSuccess<T>>(url, options).then(res => {
// 登录验证
if (res.code === 1101) {
......
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