Commit 3ccdb14c authored by 前端-钟卫鹏's avatar 前端-钟卫鹏

fix:阶梯价格校验信息显示异常

parent 3574c4d3
...@@ -310,3 +310,7 @@ a { ...@@ -310,3 +310,7 @@ a {
margin-left: auto !important; margin-left: auto !important;
margin-right: auto !important; margin-right: auto !important;
} }
.ant-modal {
width: 704px !important; // 重置模态框高度
}
\ No newline at end of file
@import './mixins/layout.less'; @import './mixins/layout.less';
#root { #root {
// 去除input type为number时的箭头 // 去除input type为number时的箭头
.ant-input-number-handler-wrap { .ant-input-number-handler-wrap {
display: none; display: none;
......
...@@ -336,40 +336,40 @@ const AddProducts: React.FC<{}> = (props) => { ...@@ -336,40 +336,40 @@ const AddProducts: React.FC<{}> = (props) => {
]} ]}
> >
<Card> <Card>
<Tabs onChange={callback} type="card" defaultActiveKey="1"> <Tabs onChange={callback} type="card" defaultActiveKey="10000">
<TabPane tab="基本信息" key="1"> <TabPane tab="基本信息" key="10001">
<BasicInfoForm <BasicInfoForm
onRef={(refs) => setFormRefs([...formRefs, refs])} onRef={(refs) => setFormRefs([...formRefs, refs])}
onChangeAttributeList={(_lists: any) => setAttributeList(_lists)} /> onChangeAttributeList={(_lists: any) => setAttributeList(_lists)} />
</TabPane> </TabPane>
<TabPane tab="选择货品" key="2"> <TabPane tab="选择货品" key="20002">
<SelectGoodsForm /> <SelectGoodsForm />
</TabPane> </TabPane>
<TabPane tab="商品属性" key="3"> <TabPane tab="商品属性" key="30003">
<ProductAttributeForm <ProductAttributeForm
onRef={(refs) => setFormRefs([...formRefs, refs])} onRef={(refs) => setFormRefs([...formRefs, refs])}
attributesData={attributeList} attributesData={attributeList}
/> />
</TabPane> </TabPane>
<TabPane tab="价格设置" key="4"> <TabPane tab="价格设置" key="40004">
<PriceAttributeForm <PriceAttributeForm
onRef={(refs) => setFormRefs([...formRefs, refs])} onRef={(refs) => setFormRefs([...formRefs, refs])}
/> />
</TabPane> </TabPane>
<TabPane tab="商品图片" key="5"> <TabPane tab="商品图片" key="50005">
<ProductImageForm /> <ProductImageForm />
</TabPane> </TabPane>
<TabPane tab="商品描述" key="6"> <TabPane tab="商品描述" key="60006">
{ {
renderTemplate() renderTemplate()
} }
</TabPane> </TabPane>
<TabPane tab="物流信息" key="7"> <TabPane tab="物流信息" key="70007">
<LogisticsForm <LogisticsForm
onRef={(refs) => setFormRefs([...formRefs, refs])} onRef={(refs) => setFormRefs([...formRefs, refs])}
/> />
</TabPane> </TabPane>
<TabPane tab="其他" key="8"> <TabPane tab="其他" key="80008">
<OtherForm <OtherForm
onRef={(refs) => setFormRefs([...formRefs, refs])} onRef={(refs) => setFormRefs([...formRefs, refs])}
/> />
......
import React, { useState, useEffect, useRef, useMemo } from 'react' import React, { useState, useEffect, useRef, useMemo } from 'react'
import {history} from 'umi' import {history} from 'umi'
import { Button, Form, Select, Checkbox, Tooltip, Radio, Input, Table, Modal, Row, Col, InputNumber } from 'antd' import { Button, Form, Select, Checkbox, Tooltip, Radio, Input, Table, Modal, Row, Col, InputNumber, Space } from 'antd'
import styles from './index.less' import styles from './index.less'
import { PublicApi } from '@/services/api' import { PublicApi } from '@/services/api'
import { ColumnType } from 'antd/lib/table/interface' import { ColumnType } from 'antd/lib/table/interface'
...@@ -68,6 +68,7 @@ const PriceAttributeForm: React.FC<Iprops> = (props) => { ...@@ -68,6 +68,7 @@ const PriceAttributeForm: React.FC<Iprops> = (props) => {
productInfoByEdit, productInfoByEdit,
getPriceAttributeFormParamsByEdit, getPriceAttributeFormParamsByEdit,
selectCategoryId, selectCategoryId,
productAttributeAndImageParams,
} = ProductStore } = ProductStore
_tableDataSource = useMemo(() => tableDataSource, [tableDataSource]) // 保持最新值 _tableDataSource = useMemo(() => tableDataSource, [tableDataSource]) // 保持最新值
...@@ -486,7 +487,6 @@ const PriceAttributeForm: React.FC<Iprops> = (props) => { ...@@ -486,7 +487,6 @@ const PriceAttributeForm: React.FC<Iprops> = (props) => {
tempArr.push({ numberPrice: null, numberRange: { numberMin: minOrder, numberMax: null } }) tempArr.push({ numberPrice: null, numberRange: { numberMin: minOrder, numberMax: null } })
setPriceForm.setFieldsValue({ladderPrice: true, ladderRange: tempArr}) setPriceForm.setFieldsValue({ladderPrice: true, ladderRange: tempArr})
} }
} }
} }
...@@ -511,6 +511,7 @@ const PriceAttributeForm: React.FC<Iprops> = (props) => { ...@@ -511,6 +511,7 @@ const PriceAttributeForm: React.FC<Iprops> = (props) => {
// 校验阶梯范围 // 校验阶梯范围
const validatorNumberRange = (rule, value, callback) => { const validatorNumberRange = (rule, value, callback) => {
console.log(value,'v')
try { try {
if(Array.isArray(value)){ if(Array.isArray(value)){
let range = value.map(item => { let range = value.map(item => {
...@@ -523,7 +524,6 @@ const PriceAttributeForm: React.FC<Iprops> = (props) => { ...@@ -523,7 +524,6 @@ const PriceAttributeForm: React.FC<Iprops> = (props) => {
[] []
) )
let result = range.reduce((a, b) => { if(a<b) return b }) let result = range.reduce((a, b) => { if(a<b) return b })
// console.log(result, range, 'result')
if(!result) throw new Error('请正确输入阶梯数量范围'); if(!result) throw new Error('请正确输入阶梯数量范围');
if(range[0]!==minOrderNumber) throw new Error('阶段的起始值必须为最小起订数'); if(range[0]!==minOrderNumber) throw new Error('阶段的起始值必须为最小起订数');
callback() callback()
...@@ -702,6 +702,7 @@ const PriceAttributeForm: React.FC<Iprops> = (props) => { ...@@ -702,6 +702,7 @@ const PriceAttributeForm: React.FC<Iprops> = (props) => {
name="settingPrice" name="settingPrice"
form={setPriceForm} form={setPriceForm}
initialValues={{ladderPrice: false}} initialValues={{ladderPrice: false}}
autoComplete="off"
> >
{ {
planPrice!==3 && planPrice!==3 &&
...@@ -728,7 +729,7 @@ const PriceAttributeForm: React.FC<Iprops> = (props) => { ...@@ -728,7 +729,7 @@ const PriceAttributeForm: React.FC<Iprops> = (props) => {
} }
]} ]}
> >
<Form.List name="ladderRange" key={Math.random()}> <Form.List name="ladderRange">
{(fields, { add, remove }) => { {(fields, { add, remove }) => {
if (!fields.length) { if (!fields.length) {
add() add()
...@@ -736,35 +737,26 @@ const PriceAttributeForm: React.FC<Iprops> = (props) => { ...@@ -736,35 +737,26 @@ const PriceAttributeForm: React.FC<Iprops> = (props) => {
return ( return (
<div> <div>
{fields.map(field => ( {fields.map(field => (
<Row key={field.key} gutter={[0, 10]}> <Row key={ field.key } gutter={[0, 10]}>
<Col span={20} style={{ display: 'flex' }}> <Col span={20} style={{ display: 'flex' }}>
<Item
{...field}
name={[field.name, 'numberRange']}
fieldKey={[field.fieldKey, 'numberRange']}
key={'_' + field.fieldKey}
noStyle
>
<Input.Group compact>
<Form.Item <Form.Item
{...field}
name={[field.name, 'numberRange', 'numberMin']} name={[field.name, 'numberRange', 'numberMin']}
noStyle fieldKey={[field.fieldKey, 'numberRange', 'numberMin']}
rules={[ rules={[
{ { required: true, message: '阶梯最小数量为必填项' },
required: true,
message: '阶梯最小数量为必填项'
},
{ {
pattern: /^\d+(\.\d{1,3})?$/, pattern: /^\d+(\.\d{1,3})?$/,
message: '阶梯数值小数点后仅限三位', message: '阶梯数值仅限三位小数',
} }
]} ]}
> >
<InputNumber min={0} style={{ width: 100, textAlign: 'center' }} placeholder="最小数量" /> <Input placeholder="最小数量" />
</Form.Item> </Form.Item>
<Input <Input
style={{ style={{
width: 30, width: 30,
height: 32,
borderLeft: 0, borderLeft: 0,
borderRight: 0, borderRight: 0,
pointerEvents: 'none', pointerEvents: 'none',
...@@ -773,50 +765,35 @@ const PriceAttributeForm: React.FC<Iprops> = (props) => { ...@@ -773,50 +765,35 @@ const PriceAttributeForm: React.FC<Iprops> = (props) => {
disabled disabled
/> />
<Form.Item <Form.Item
{...field}
name={[field.name, 'numberRange', 'numberMax']} name={[field.name, 'numberRange', 'numberMax']}
noStyle fieldKey={[field.fieldKey, 'numberRange', 'numberMax']}
rules={[ rules={[
{ { required: true, message: '阶梯最大数量为必填项' },
required: true,
message: '阶梯最大数量为必填项'
},
{ {
pattern: /^\d+(\.\d{1,3})?$/, pattern: /^\d+(\.\d{1,3})?$/,
message: '阶梯数值小数点后仅限三位', message: '阶梯数值仅限三位小数',
} }
]} ]}
> >
<InputNumber <Input placeholder="最大数量" />
min={0}
className={styles.siteInputRight}
style={{
width: 100,
textAlign: 'center',
}}
placeholder="最大数量"
/>
</Form.Item> </Form.Item>
</Input.Group>
</Item> <Form.Item
<Item
{...field} {...field}
name={[field.name, 'numberPrice']} name={[field.name, 'numberPrice']}
fieldKey={[field.fieldKey, 'numberPrice']} fieldKey={[field.fieldKey, 'numberPrice']}
key={'__' + field.fieldKey}
noStyle
rules={[ rules={[
{ { required: true, message: '阶梯单价为必填项' },
required: true,
message: '阶梯单价为必填项'
},
{ {
pattern: /^\d+(\.\d{1,4})?$/, pattern: /^\d+(\.\d{1,4})?$/,
message: '阶梯单价小数点后仅限四位', message: '阶梯单价仅限四位小数',
} }
]} ]}
style={{marginLeft: 20}}
> >
<InputNumber min={0} style={{ width: '50%', marginLeft: 24 }} placeholder="请输入单价" /> <Input placeholder="请输入单价" />
</Item> </Form.Item>
</Col> </Col>
<Col span={4}> <Col span={4}>
<Button size="small" onClick={() => add()} style={{ marginLeft: 20, marginRight: 8 }} icon={<PlusOutlined />} /> <Button size="small" onClick={() => add()} style={{ marginLeft: 20, marginRight: 8 }} icon={<PlusOutlined />} />
......
...@@ -17,11 +17,22 @@ const formActions = createFormActions(); ...@@ -17,11 +17,22 @@ const formActions = createFormActions();
const AccountLists: React.FC<{}> = () => { const AccountLists: React.FC<{}> = () => {
const ref = useRef<any>({}) const ref = useRef<any>({})
// "memberName": "L1LCU",
// "memberTypeName": "hgVH2V",
// "memberRoleName": "7V4vEk",
// "memberLevelName": "DT5Q",
// "accountBalance": 1071807455613740.5,
// "lockBalance": -5417889512914380,
// "usableBalance": -604051859942576.9,
// "memberStatus": 6014545168701916,
// "accountStatus": 6386448687731208,
// "createTime": 5022413924183292
const columns: ColumnType<any>[] = [ const columns: ColumnType<any>[] = [
{ {
title: '账户归属', title: '账户归属',
dataIndex: 'name', dataIndex: 'memberName',
key: 'name', key: 'memberName',
className: 'commonPickColor', className: 'commonPickColor',
render: (text, record) => <EyePreview render: (text, record) => <EyePreview
url={`/memberCenter/payandSettle/capitalAccounts/accountLists/accountDetail?id=${record.id}`} url={`/memberCenter/payandSettle/capitalAccounts/accountLists/accountDetail?id=${record.id}`}
...@@ -31,18 +42,18 @@ const AccountLists: React.FC<{}> = () => { ...@@ -31,18 +42,18 @@ const AccountLists: React.FC<{}> = () => {
}, },
{ {
title: '会员类型', title: '会员类型',
dataIndex: 'type', dataIndex: 'memberTypeName',
key: 'type', key: 'memberTypeName',
}, },
{ {
title: '会员角色', title: '会员角色',
dataIndex: ['customerCategory', 'name'], dataIndex: 'memberRoleName',
key: 'customerCategory', key: 'memberRoleName',
}, },
{ {
title: '会员等级', title: '会员等级',
dataIndex: ['brand', 'name'], dataIndex: 'memberLevelName',
key: 'brand', key: 'memberLevelName',
}, },
{ {
title: '会员等级类型', title: '会员等级类型',
...@@ -51,24 +62,30 @@ const AccountLists: React.FC<{}> = () => { ...@@ -51,24 +62,30 @@ const AccountLists: React.FC<{}> = () => {
}, },
{ {
title: '会员状态', title: '会员状态',
dataIndex: 'unitName', dataIndex: 'memberStatus',
key: 'unit', key: 'memberStatus',
}, },
{ {
title: '账户状态', title: '账户状态',
dataIndex: 'unitName', dataIndex: 'accountStatus',
key: 'unit', key: 'accountStatus',
},
{
title: '账户余额',
dataIndex: 'accountStatus',
key: 'accountStatus',
render: text => `¥${text}`
}, },
{ {
title: '锁定余额', title: '锁定余额',
dataIndex: 'costPrice', dataIndex: 'lockBalance',
key: 'costPrice', key: 'lockBalance',
render: text => `¥${text}` render: text => `¥${text}`
}, },
{ {
title: '可用余额', title: '可用余额',
dataIndex: 'batch', dataIndex: 'usableBalance',
key: 'batch', key: 'usableBalance',
render: text => `¥${text}` render: text => `¥${text}`
}, },
] ]
...@@ -77,7 +94,7 @@ const AccountLists: React.FC<{}> = () => { ...@@ -77,7 +94,7 @@ const AccountLists: React.FC<{}> = () => {
console.log(params) console.log(params)
return new Promise((resolve, reject) => { return new Promise((resolve, reject) => {
let obj = { ...params } let obj = { ...params }
PublicApi.getProductGoodsGetGoodsList(obj).then(res => { PublicApi.getPayAssetAccountGetAssetAccountList(obj).then(res => {
resolve(res.data) resolve(res.data)
}) })
}) })
...@@ -99,7 +116,7 @@ const AccountLists: React.FC<{}> = () => { ...@@ -99,7 +116,7 @@ const AccountLists: React.FC<{}> = () => {
useStateFilterSearchLinkageEffect( useStateFilterSearchLinkageEffect(
$, $,
actions, actions,
'name', 'parentMemberName',
FORM_FILTER_PATH, FORM_FILTER_PATH,
); );
}} }}
......
...@@ -15,7 +15,7 @@ export const searchSchema: ISchema = { ...@@ -15,7 +15,7 @@ export const searchSchema: ISchema = {
grid: true, grid: true,
}, },
properties: { properties: {
name: { parentMemberName: {
type: 'string', type: 'string',
'x-component': 'Search', 'x-component': 'Search',
'x-component-props': { 'x-component-props': {
...@@ -38,17 +38,39 @@ export const searchSchema: ISchema = { ...@@ -38,17 +38,39 @@ export const searchSchema: ISchema = {
}, },
}, },
properties: { properties: {
code: { memberStatus: {
type: 'string', type: 'string',
'x-component-props': { 'x-component-props': {
placeholder: '会员状态' placeholder: '会员状态',
style: { width: '174px' },
}, },
enum: [
{
label: '正常',
value: 1,
}, },
batch: { {
label: '已冻结',
value: 2,
}
],
},
accountStatus: {
type: 'string', type: 'string',
'x-component-props': { 'x-component-props': {
placeholder: '账户状态' placeholder: '账户状态',
style: { width: '174px' },
}, },
enum: [
{
label: '正常',
value: 1,
},
{
label: '已冻结',
value: 2,
}
],
}, },
applyTime: { applyTime: {
type: "daterange", type: "daterange",
...@@ -56,6 +78,7 @@ export const searchSchema: ISchema = { ...@@ -56,6 +78,7 @@ export const searchSchema: ISchema = {
"[start,end]": { "[start,end]": {
'x-component-props': { 'x-component-props': {
placeholder: ['开始时间','结束时间'], placeholder: ['开始时间','结束时间'],
style: { width: '174px' },
}, },
} }
} }
......
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