Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
J
jinfa-platform
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
陈智峰
jinfa-platform
Commits
6cbd2b7c
Commit
6cbd2b7c
authored
Sep 24, 2020
by
XieZhiXiong
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'dev' of
http://10.0.0.22:3000/lingxi/lingxi-business-paltform
into dev
parents
b475d4ef
e6554d4b
Hide whitespace changes
Inline
Side-by-side
Showing
14 changed files
with
119 additions
and
72 deletions
+119
-72
addAttribute.tsx
src/pages/classAndProperty/attribute/addAttribute.tsx
+9
-2
addPropertyValue.tsx
...pages/classAndProperty/propertyValue/addPropertyValue.tsx
+5
-1
addGoods.tsx
src/pages/commodity/goods/addGoods.tsx
+9
-2
addProducts.tsx
src/pages/commodity/products/addProducts.tsx
+2
-14
basicInfoForm.tsx
...ages/commodity/products/addProductsItem/basicInfoForm.tsx
+16
-8
otherForm.tsx
src/pages/commodity/products/addProductsItem/otherForm.tsx
+19
-3
productAttributeForm.tsx
...mmodity/products/addProductsItem/productAttributeForm.tsx
+2
-16
productImageForm.tsx
...s/commodity/products/addProductsItem/productImageForm.tsx
+5
-3
addBrand.tsx
src/pages/trademark/addBrand.tsx
+5
-3
addRule.tsx
src/pages/transaction/transactionRules/addRule.tsx
+17
-7
RuleSetting.tsx
...s/transaction/transactionRules/components/RuleSetting.tsx
+1
-2
index.tsx
src/pages/transaction/transactionRules/index.tsx
+1
-8
index.tsx
src/pages/transaction/transactionRules/schema/index.tsx
+1
-3
regExp.ts
src/utils/regExp.ts
+27
-0
No files found.
src/pages/classAndProperty/attribute/addAttribute.tsx
View file @
6cbd2b7c
...
@@ -7,6 +7,7 @@ import { StandardTable } from 'god'
...
@@ -7,6 +7,7 @@ import { StandardTable } from 'god'
import
{
ColumnType
}
from
'antd/lib/table/interface'
;
import
{
ColumnType
}
from
'antd/lib/table/interface'
;
import
ReutrnEle
from
'@/components/ReturnEle'
;
import
ReutrnEle
from
'@/components/ReturnEle'
;
import
{
PublicApi
}
from
'@/services/api'
;
import
{
PublicApi
}
from
'@/services/api'
;
import
{
validatorByte
}
from
'@/utils/regExp'
;
const
{
Option
}
=
Select
;
const
{
Option
}
=
Select
;
...
@@ -180,9 +181,12 @@ const AddAtttribute: React.FC<{}> = () => {
...
@@ -180,9 +181,12 @@ const AddAtttribute: React.FC<{}> = () => {
required
:
true
,
required
:
true
,
message
:
'输入属性组名!'
,
message
:
'输入属性组名!'
,
},
},
{
validator
:
(
r
,
v
,
c
)
=>
validatorByte
(
r
,
v
,
c
,
20
)
}
]
}
]
}
>
>
<
Input
maxLength=
{
10
}
placeholder=
"输入属性组名"
disabled=
{
isSee
}
/>
<
Input
placeholder=
"输入属性组名"
disabled=
{
isSee
}
/>
</
Form
.
Item
>
</
Form
.
Item
>
</
Col
>
</
Col
>
<
Col
span=
{
18
}
>
<
Col
span=
{
18
}
>
...
@@ -202,9 +206,12 @@ const AddAtttribute: React.FC<{}> = () => {
...
@@ -202,9 +206,12 @@ const AddAtttribute: React.FC<{}> = () => {
required
:
true
,
required
:
true
,
message
:
'输入属性名称!'
,
message
:
'输入属性名称!'
,
},
},
{
validator
:
(
r
,
v
,
c
)
=>
validatorByte
(
r
,
v
,
c
,
20
)
}
]
}
]
}
>
>
<
Input
maxLength=
{
10
}
placeholder=
"输入属性名称"
disabled=
{
isSee
}
/>
<
Input
placeholder=
"输入属性名称"
disabled=
{
isSee
}
/>
</
Form
.
Item
>
</
Form
.
Item
>
</
Col
>
</
Col
>
<
Col
span=
{
18
}
>
<
Col
span=
{
18
}
>
...
...
src/pages/classAndProperty/propertyValue/addPropertyValue.tsx
View file @
6cbd2b7c
...
@@ -9,6 +9,7 @@ import { PublicApi } from '@/services/api';
...
@@ -9,6 +9,7 @@ import { PublicApi } from '@/services/api';
import
TabTree
,
{
useTreeActions
,
createTreeActions
}
from
'@/components/TabTree'
;
import
TabTree
,
{
useTreeActions
,
createTreeActions
}
from
'@/components/TabTree'
;
import
{
useTreeTabs
}
from
'@/hooks/useTreeTabs'
;
import
{
useTreeTabs
}
from
'@/hooks/useTreeTabs'
;
import
{
GetManageAreaAllResponse
}
from
'@/services'
;
import
{
GetManageAreaAllResponse
}
from
'@/services'
;
import
{
validatorByte
}
from
'@/utils/regExp'
;
const
layout
=
{
const
layout
=
{
labelCol
:
{
labelCol
:
{
...
@@ -202,9 +203,12 @@ const AddPropertyValue: React.FC<{}> = () => {
...
@@ -202,9 +203,12 @@ const AddPropertyValue: React.FC<{}> = () => {
required
:
true
,
required
:
true
,
message
:
'输入属性值名称!'
,
message
:
'输入属性值名称!'
,
},
},
{
validator
:
(
r
,
v
,
c
)
=>
validatorByte
(
r
,
v
,
c
,
12
)
}
]
}
]
}
>
>
<
Input
maxLength=
{
12
}
placeholder=
"输入属性值名称"
disabled=
{
isSee
}
/>
<
Input
placeholder=
"输入属性值名称"
disabled=
{
isSee
}
/>
</
Form
.
Item
>
</
Form
.
Item
>
}
}
{
{
...
...
src/pages/commodity/goods/addGoods.tsx
View file @
6cbd2b7c
...
@@ -9,6 +9,7 @@ import ReutrnEle from '@/components/ReturnEle';
...
@@ -9,6 +9,7 @@ import ReutrnEle from '@/components/ReturnEle';
import
styles
from
'./index.less'
import
styles
from
'./index.less'
import
{
PublicApi
}
from
'@/services/api'
;
import
{
PublicApi
}
from
'@/services/api'
;
import
{
GetProductCustomerGetCustomerCategoryTreeResponse
}
from
'@/services'
;
import
{
GetProductCustomerGetCustomerCategoryTreeResponse
}
from
'@/services'
;
import
{
validatorByte
}
from
'@/utils/regExp'
;
const
{
Option
}
=
Select
;
const
{
Option
}
=
Select
;
const
layout
=
{
const
layout
=
{
...
@@ -158,9 +159,12 @@ const AddGoods = () => {
...
@@ -158,9 +159,12 @@ const AddGoods = () => {
required
:
true
,
required
:
true
,
message
:
'请填入货品名称'
message
:
'请填入货品名称'
},
},
{
validator
:
(
r
,
v
,
c
)
=>
validatorByte
(
r
,
v
,
c
,
40
)
}
]
}
]
}
>
>
<
Input
placeholder=
"最长
20个字符"
maxLength=
{
20
}
disabled=
{
isSee
}
/>
<
Input
placeholder=
"最长
40个字符20个汉字"
disabled=
{
isSee
}
/>
</
Form
.
Item
>
</
Form
.
Item
>
<
Form
.
Item
<
Form
.
Item
name=
"type"
name=
"type"
...
@@ -170,9 +174,12 @@ const AddGoods = () => {
...
@@ -170,9 +174,12 @@ const AddGoods = () => {
required
:
true
,
required
:
true
,
message
:
'请填入规格型号'
message
:
'请填入规格型号'
},
},
{
validator
:
(
r
,
v
,
c
)
=>
validatorByte
(
r
,
v
,
c
,
40
)
}
]
}
]
}
>
>
<
Input
placeholder=
"最长
20个字符"
maxLength=
{
20
}
disabled=
{
isSee
}
/>
<
Input
placeholder=
"最长
40个字符20个汉字"
disabled=
{
isSee
}
/>
</
Form
.
Item
>
</
Form
.
Item
>
{
/* <Form.Item
{
/* <Form.Item
name={['customerCategory', 'id']}
name={['customerCategory', 'id']}
...
...
src/pages/commodity/products/addProducts.tsx
View file @
6cbd2b7c
...
@@ -162,29 +162,18 @@ const AddProducts: React.FC<{}> = (props) => {
...
@@ -162,29 +162,18 @@ const AddProducts: React.FC<{}> = (props) => {
if
(
_productAttributeAndImageParams
.
length
>
0
){
if
(
_productAttributeAndImageParams
.
length
>
0
){
_productAttributeAndImageParams
.
map
(
_item
=>
{
_productAttributeAndImageParams
.
map
(
_item
=>
{
console
.
log
(
_item
,
'_item'
)
console
.
log
(
_item
,
'_item'
)
_item
.
goods
=
{
id
:
_item
.
goodsId
}
// id为0表示无货品
_item
.
goods
=
{
id
:
_item
.
goodsId
}
// id为0表示无货品
delete
_item
.
goodsId
delete
_item
.
goodsId
// if(_item.attributeAndValueList.length>0){
// _item.attributeAndValueList.map(__item => {
// delete __item.customerAttributeName
// // **** 新字段结构变更
// __item.customerAttribute = { id: __item.customerAttributeId }
// __item.customerAttributeValue = { id: __item.id, value: __item.value }
// delete __item.id
// delete __item.value
// delete __item.customerAttributeId
// })
// }
if
(
_item
.
commodityPic
.
length
>
0
){
if
(
_item
.
commodityPic
.
length
>
0
){
// 编辑情况下兼顾手动添加图片列表属性
// 编辑情况下兼顾手动添加图片列表属性
console
.
log
(
'不一定'
)
_item
.
commodityPic
=
_item
.
commodityPic
.
map
(
__item
=>
__item
?.
response
?.
data
||
__item
?.
url
)
_item
.
commodityPic
=
_item
.
commodityPic
.
map
(
__item
=>
__item
?.
response
?.
data
||
__item
?.
url
)
// 多种属性组合 所有属性共用的情况下 每一行都是用第一项
// 多种属性组合 所有属性共用的情况下 每一行都是用第一项
if
(
isAllAttributePic
)
if
(
isAllAttributePic
)
_item
.
commodityPic
=
_productAttributeAndImageParams
[
0
].
commodityPic
_item
.
commodityPic
=
_productAttributeAndImageParams
[
0
].
commodityPic
}
else
{
}
else
{
if
(
isAllAttributePic
&&
_productAttributeAndImageParams
[
0
].
commodityPic
.
length
>
0
){
//处理所有属性共用
if
(
isAllAttributePic
&&
_productAttributeAndImageParams
[
0
].
commodityPic
.
length
>
0
){
//处理所有属性共用
console
.
log
(
'所有属性共用'
)
_item
.
commodityPic
=
_productAttributeAndImageParams
[
0
].
commodityPic
_item
.
commodityPic
=
_productAttributeAndImageParams
[
0
].
commodityPic
}
}
else
else
...
@@ -201,7 +190,6 @@ const AddProducts: React.FC<{}> = (props) => {
...
@@ -201,7 +190,6 @@ const AddProducts: React.FC<{}> = (props) => {
}
else
{
// 编辑 没有点击商品图片
}
else
{
// 编辑 没有点击商品图片
_params
.
unitPriceAndPicList
=
productInfoByEdit
.
unitPriceAndPicList
_params
.
unitPriceAndPicList
=
productInfoByEdit
.
unitPriceAndPicList
if
(
clickTabIndex
.
indexOf
(
"4"
)
!==
-
1
){
// 没有点击图片单单修改了商品价格 取原有的图片和新的价格合成
if
(
clickTabIndex
.
indexOf
(
"4"
)
!==
-
1
){
// 没有点击图片单单修改了商品价格 取原有的图片和新的价格合成
console
.
log
(
'仅修改商品价格'
)
_params
.
unitPriceAndPicList
=
priceAttributeParams
.
map
((
item
,
index
)
=>
{
_params
.
unitPriceAndPicList
=
priceAttributeParams
.
map
((
item
,
index
)
=>
{
return
{
return
{
goods
:
{
id
:
item
.
goodsId
},
goods
:
{
id
:
item
.
goodsId
},
...
...
src/pages/commodity/products/addProductsItem/basicInfoForm.tsx
View file @
6cbd2b7c
...
@@ -17,6 +17,7 @@ import { inject, observer } from 'mobx-react'
...
@@ -17,6 +17,7 @@ import { inject, observer } from 'mobx-react'
// import { IProductModule } from '@/module/productModule'
// import { IProductModule } from '@/module/productModule'
// import { IStore } from '@/store';
// import { IStore } from '@/store';
import
{
store
}
from
'@/store'
import
{
store
}
from
'@/store'
import
{
validatorByte
}
from
'@/utils/regExp'
;
const
{
Option
}
=
Select
const
{
Option
}
=
Select
const
layout
=
{
const
layout
=
{
...
@@ -268,9 +269,12 @@ const BasicInfoForm: React.FC<Iprops> = (props) => {
...
@@ -268,9 +269,12 @@ const BasicInfoForm: React.FC<Iprops> = (props) => {
required
:
true
,
required
:
true
,
message
:
'商品名称'
message
:
'商品名称'
},
},
{
validator
:
(
r
,
v
,
c
)
=>
validatorByte
(
r
,
v
,
c
,
90
)
}
]
}
]
}
>
>
<
Input
placeholder=
"商品名称"
maxLength=
{
45
}
onBlur=
{
e
=>
onChangeName
(
e
.
target
.
value
)
}
/>
<
Input
placeholder=
"商品名称"
onBlur=
{
e
=>
onChangeName
(
e
.
target
.
value
)
}
/>
</
Form
.
Item
>
</
Form
.
Item
>
<
Form
.
Item
<
Form
.
Item
name=
"slogan"
name=
"slogan"
...
@@ -282,14 +286,17 @@ const BasicInfoForm: React.FC<Iprops> = (props) => {
...
@@ -282,14 +286,17 @@ const BasicInfoForm: React.FC<Iprops> = (props) => {
</
Tooltip
>
</
Tooltip
>
</
span
>
</
span
>
}
}
// rules={[
rules=
{
[
// {
//
{
// required: true,
// required: true,
// message: '请填入商品标语'
// message: '请填入商品标语'
// },
//
},
// ]}
{
validator
:
(
r
,
v
,
c
)
=>
validatorByte
(
r
,
v
,
c
,
90
)
}
]
}
>
>
<
Input
placeholder=
"请输入商品标语"
maxLength=
{
45
}
/>
<
Input
placeholder=
"请输入商品标语"
/>
</
Form
.
Item
>
</
Form
.
Item
>
<
Form
.
Item
<
Form
.
Item
name=
"sellingPoint"
name=
"sellingPoint"
...
@@ -312,6 +319,7 @@ const BasicInfoForm: React.FC<Iprops> = (props) => {
...
@@ -312,6 +319,7 @@ const BasicInfoForm: React.FC<Iprops> = (props) => {
mode=
"tags"
mode=
"tags"
placeholder=
"请输入或选择商品卖点"
placeholder=
"请输入或选择商品卖点"
maxTagCount=
{
3
}
maxTagCount=
{
3
}
maxTagTextLength=
{
8
}
tagRender=
{
tagRender
}
tagRender=
{
tagRender
}
/>
/>
</
Form
.
Item
>
</
Form
.
Item
>
...
...
src/pages/commodity/products/addProductsItem/otherForm.tsx
View file @
6cbd2b7c
...
@@ -2,6 +2,7 @@ import React, { useState, useEffect, useRef } from 'react'
...
@@ -2,6 +2,7 @@ import React, { useState, useEffect, useRef } from 'react'
import
{
history
}
from
'umi'
import
{
history
}
from
'umi'
import
{
Form
,
Select
,
Radio
,
Input
}
from
'antd'
import
{
Form
,
Select
,
Radio
,
Input
}
from
'antd'
import
{
store
}
from
'@/store'
import
{
store
}
from
'@/store'
import
{
validatorByte
}
from
'@/utils/regExp'
const
{
ProductStore
}
=
store
const
{
ProductStore
}
=
store
const
layout
=
{
const
layout
=
{
...
@@ -60,20 +61,35 @@ const OtherForm: React.FC<Iprops> = (props) => {
...
@@ -60,20 +61,35 @@ const OtherForm: React.FC<Iprops> = (props) => {
<
Form
.
Item
<
Form
.
Item
name=
"marks"
name=
"marks"
label=
"唛头"
label=
"唛头"
rules=
{
[
{
validator
:
(
r
,
v
,
c
)
=>
validatorByte
(
r
,
v
,
c
,
50
)
}
]
}
>
>
<
Input
maxLength=
{
25
}
placeholder=
"请输入唛头(最长25个字符)
"
/>
<
Input
placeholder=
"最长50个字符25个汉字
"
/>
</
Form
.
Item
>
</
Form
.
Item
>
<
Form
.
Item
<
Form
.
Item
name=
"packing"
name=
"packing"
label=
"包装清单"
label=
"包装清单"
rules=
{
[
{
validator
:
(
r
,
v
,
c
)
=>
validatorByte
(
r
,
v
,
c
,
120
)
}
]
}
>
>
<
TextArea
maxLength=
{
120
}
rows=
{
4
}
placeholder=
"最长120个字符
"
/>
<
TextArea
rows=
{
4
}
placeholder=
"最长120个字符60个汉字
"
/>
</
Form
.
Item
>
</
Form
.
Item
>
<
Form
.
Item
<
Form
.
Item
name=
"afterService"
name=
"afterService"
label=
"售后服务"
label=
"售后服务"
rules=
{
[
{
validator
:
(
r
,
v
,
c
)
=>
validatorByte
(
r
,
v
,
c
,
300
)
}
]
}
>
>
<
TextArea
maxLength=
{
300
}
rows=
{
4
}
placeholder=
"最长300个字符
"
/>
<
TextArea
rows=
{
4
}
placeholder=
"最长300个字符150个汉字
"
/>
</
Form
.
Item
>
</
Form
.
Item
>
</
Form
>
</
Form
>
</>)
</>)
...
...
src/pages/commodity/products/addProductsItem/productAttributeForm.tsx
View file @
6cbd2b7c
...
@@ -5,6 +5,7 @@ import styles from './index.less'
...
@@ -5,6 +5,7 @@ import styles from './index.less'
import
{
inject
,
observer
}
from
'mobx-react'
import
{
inject
,
observer
}
from
'mobx-react'
import
{
store
}
from
'@/store'
import
{
store
}
from
'@/store'
import
{
validatorByte
}
from
'@/utils/regExp'
const
layout
=
{
const
layout
=
{
labelCol
:
{
labelCol
:
{
...
@@ -166,20 +167,6 @@ const ProductAttributeForm: React.FC<Iprops> = (props) => {
...
@@ -166,20 +167,6 @@ const ProductAttributeForm: React.FC<Iprops> = (props) => {
_isDisabled
=
_isPrice
&&
!
_isUpdateAttribute
_isDisabled
=
_isPrice
&&
!
_isUpdateAttribute
}
}
// 校验字节
const
validatorByte
=
(
rule
,
value
,
callback
)
=>
{
try
{
let
str
=
value
str
=
str
.
replace
(
/
[\u
4e00-
\u
9fa5
]
/g
,
'OO'
)
if
(
str
.
length
>
60
)
throw
new
Error
(
'最多输入60个字符,30个汉字'
);
else
callback
()
}
catch
(
err
)
{
callback
(
err
)
}
}
return
(
return
(
<>
<>
{
{
...
@@ -253,13 +240,12 @@ const ProductAttributeForm: React.FC<Iprops> = (props) => {
...
@@ -253,13 +240,12 @@ const ProductAttributeForm: React.FC<Iprops> = (props) => {
required
:
true
,
required
:
true
,
message
:
'此项为必填项'
message
:
'此项为必填项'
},{
},{
validator
:
validatorByte
validator
:
(
r
,
v
,
c
)
=>
validatorByte
(
r
,
v
,
c
,
60
)
}]
}
}]
}
>
>
<
TextArea
<
TextArea
disabled=
{
_isDisabled
}
disabled=
{
_isDisabled
}
onChange=
{
(
v
)
=>
onChange
(
v
,
attrItem
)
}
onChange=
{
(
v
)
=>
onChange
(
v
,
attrItem
)
}
maxLength=
{
60
}
placeholder=
"最多输入60个字符,30个汉字"
placeholder=
"最多输入60个字符,30个汉字"
rows=
{
4
}
rows=
{
4
}
/>
/>
...
...
src/pages/commodity/products/addProductsItem/productImageForm.tsx
View file @
6cbd2b7c
...
@@ -150,15 +150,17 @@ const ProductImageForm: React.FC<Iprops> = (props) => {
...
@@ -150,15 +150,17 @@ const ProductImageForm: React.FC<Iprops> = (props) => {
const
handleChange
=
({
file
,
fileList
},
index
)
=>
{
const
handleChange
=
({
file
,
fileList
},
index
)
=>
{
let
_priceAttributeParams
=
[...
priceAttributeParamsByRender
]
let
_priceAttributeParams
=
[...
priceAttributeParamsByRender
]
console
.
log
(
_priceAttributeParams
,
index
,
'图片更改初始数据'
)
//
console.log(_priceAttributeParams, index, '图片更改初始数据')
setCommonImageList
(
fileList
)
setCommonImageList
(
fileList
)
_priceAttributeParams
[
index
].
commodityPic
=
fileList
if
(
file
?.
response
?.
data
){
// 服务端是否响应正常url字符
_priceAttributeParams
[
index
].
commodityPic
=
fileList
}
if
(
!
file
?.
status
&&
file
?.
status
!==
'done'
){
if
(
!
file
?.
status
&&
file
?.
status
!==
'done'
){
let
ttt
=
_priceAttributeParams
[
index
].
commodityPic
.
filter
(
_
=>
_
.
status
===
'done'
)
let
ttt
=
_priceAttributeParams
[
index
].
commodityPic
.
filter
(
_
=>
_
.
status
===
'done'
)
_priceAttributeParams
[
index
].
commodityPic
=
ttt
_priceAttributeParams
[
index
].
commodityPic
=
ttt
setCommonImageList
(
ttt
)
setCommonImageList
(
ttt
)
}
}
console
.
log
(
_priceAttributeParams
,
'图片更改之后数据'
)
//
console.log(_priceAttributeParams, '图片更改之后数据')
setPriceAttributeParamsByRender
(
_priceAttributeParams
)
setPriceAttributeParamsByRender
(
_priceAttributeParams
)
setProductAttributeAndImageParams
(
_priceAttributeParams
)
setProductAttributeAndImageParams
(
_priceAttributeParams
)
}
}
...
...
src/pages/trademark/addBrand.tsx
View file @
6cbd2b7c
...
@@ -17,6 +17,7 @@ import ReutrnEle from '@/components/ReturnEle'
...
@@ -17,6 +17,7 @@ import ReutrnEle from '@/components/ReturnEle'
import
{
PublicApi
}
from
'@/services/api'
import
{
PublicApi
}
from
'@/services/api'
import
{
UPLOAD_TYPE
}
from
'@/constants'
import
{
UPLOAD_TYPE
}
from
'@/constants'
import
styles
from
'./index.less'
import
styles
from
'./index.less'
import
{
validatorByte
}
from
'@/utils/regExp'
const
{
Step
}
=
Steps
;
const
{
Step
}
=
Steps
;
...
@@ -120,7 +121,7 @@ const AddBrand: React.FC<{}> = () => {
...
@@ -120,7 +121,7 @@ const AddBrand: React.FC<{}> = () => {
setLogoLoading
(
false
)
setLogoLoading
(
false
)
}
}
};
};
// @ts-ignore
const
handleChange
=
({
fileList
})
=>
setFileList
(
fileList
)
const
handleChange
=
({
fileList
})
=>
setFileList
(
fileList
)
const
handleSave
=
()
=>
{
const
handleSave
=
()
=>
{
...
@@ -141,14 +142,12 @@ const AddBrand: React.FC<{}> = () => {
...
@@ -141,14 +142,12 @@ const AddBrand: React.FC<{}> = () => {
PublicApi
.
postProductBrandSaveOrUpdateBrand
(
values
).
then
(
res
=>
{
PublicApi
.
postProductBrandSaveOrUpdateBrand
(
values
).
then
(
res
=>
{
setIsDisabledSave
(
true
)
setIsDisabledSave
(
true
)
setIsEnableCheck
(
false
)
setIsEnableCheck
(
false
)
//@ts-ignore
setReponseId
(
res
.
data
)
setReponseId
(
res
.
data
)
})
})
})
})
}
}
const
handleApplyCheck
=
()
=>
{
const
handleApplyCheck
=
()
=>
{
//@ts-ignore
PublicApi
.
postProductBrandApplyCheckBrand
({
id
:
responseId
}).
then
(
res
=>
{
PublicApi
.
postProductBrandApplyCheckBrand
({
id
:
responseId
}).
then
(
res
=>
{
setCurrentStep
(
1
)
setCurrentStep
(
1
)
setTimeout
(()
=>
{
setTimeout
(()
=>
{
...
@@ -213,6 +212,9 @@ const AddBrand: React.FC<{}> = () => {
...
@@ -213,6 +212,9 @@ const AddBrand: React.FC<{}> = () => {
required
:
true
,
required
:
true
,
message
:
'输入品牌名称!'
,
message
:
'输入品牌名称!'
,
},
},
{
validator
:
(
r
,
v
,
c
)
=>
validatorByte
(
r
,
v
,
c
,
20
)
}
]
}
]
}
>
>
<
Input
disabled=
{
banSomeField
}
placeholder=
"输入品牌名称"
/>
<
Input
disabled=
{
banSomeField
}
placeholder=
"输入品牌名称"
/>
...
...
src/pages/transaction/transactionRules/addRule.tsx
View file @
6cbd2b7c
...
@@ -17,6 +17,8 @@ import RuleSetting from './components/RuleSetting'
...
@@ -17,6 +17,8 @@ import RuleSetting from './components/RuleSetting'
const
addSchemaAction
=
createFormActions
()
const
addSchemaAction
=
createFormActions
()
const
AddRule
:
React
.
FC
<
{}
>
=
(
props
)
=>
{
const
AddRule
:
React
.
FC
<
{}
>
=
(
props
)
=>
{
const
[
isDisabled
,
setIsDisabled
]
=
useState
<
boolean
>
(
false
)
const
{
const
{
id
,
id
,
preview
,
preview
,
...
@@ -25,7 +27,7 @@ const AddRule:React.FC<{}> = (props) => {
...
@@ -25,7 +27,7 @@ const AddRule:React.FC<{}> = (props) => {
// 整体表单提交
// 整体表单提交
const
formSubmit
=
async
(
values
)
=>
{
const
formSubmit
=
async
(
values
)
=>
{
console
.
log
(
values
)
setIsDisabled
(
true
)
values
.
products
=
values
.
products
.
map
(
item
=>
({
values
.
products
=
values
.
products
.
map
(
item
=>
({
productId
:
item
.
id
,
productId
:
item
.
id
,
commodityId
:
item
.
commodityId
,
commodityId
:
item
.
commodityId
,
...
@@ -33,17 +35,25 @@ const AddRule:React.FC<{}> = (props) => {
...
@@ -33,17 +35,25 @@ const AddRule:React.FC<{}> = (props) => {
customerCategoryName
:
item
.
customerCategoryName
,
customerCategoryName
:
item
.
customerCategoryName
,
priceType
:
item
.
priceType
,
priceType
:
item
.
priceType
,
brandName
:
item
.
brandName
brandName
:
item
.
brandName
}))
}))
values
.
isElectronicContract
=
values
.
isElectronicContract
?
1
:
0
values
.
isElectronicContract
=
values
.
isElectronicContract
?
1
:
0
const
params
=
omit
(
values
,
[
'state'
])
// 移除不需要的字段
const
params
=
omit
(
values
,
[
'state'
])
// 移除不需要的字段
addSchemaAction
.
getFieldState
(
'transactionProcesssId'
,
state
=>
{
let
dataSource
=
state
.
dataSource
.
filter
(
item
=>
params
.
transactionProcesssId
===
item
.
id
)
params
.
transactionProcess
=
dataSource
[
0
].
name
})
let
res
:
any
=
{}
if
(
pageStatus
===
PageStatus
.
EDIT
){
if
(
pageStatus
===
PageStatus
.
EDIT
){
await
PublicApi
.
postOrderTradingRulesUpdata
(
params
)
res
=
await
PublicApi
.
postOrderTradingRulesUpdata
(
params
)
}
else
if
(
pageStatus
===
PageStatus
.
ADD
){
}
else
if
(
pageStatus
===
PageStatus
.
ADD
){
await
PublicApi
.
postOrderTradingRulesAdd
(
params
)
res
=
await
PublicApi
.
postOrderTradingRulesAdd
(
params
)
}
}
setTimeout
(()
=>
{
if
(
res
.
code
===
1000
){
setIsDisabled
(
false
)
history
.
goBack
(
-
1
)
history
.
goBack
(
-
1
)
}
,
1000
)
}
}
}
return
(
return
(
...
@@ -57,7 +67,7 @@ const AddRule:React.FC<{}> = (props) => {
...
@@ -57,7 +67,7 @@ const AddRule:React.FC<{}> = (props) => {
onClick=
{
()
=>
addSchemaAction
.
submit
()
}
onClick=
{
()
=>
addSchemaAction
.
submit
()
}
type=
"primary"
type=
"primary"
icon=
{
<
SaveOutlined
/>
}
icon=
{
<
SaveOutlined
/>
}
disabled=
{
pageStatus
===
PageStatus
.
PREVIEW
}
disabled=
{
pageStatus
===
PageStatus
.
PREVIEW
||
isDisabled
}
>
>
保存
保存
</
Button
>,
</
Button
>,
...
...
src/pages/transaction/transactionRules/components/RuleSetting.tsx
View file @
6cbd2b7c
...
@@ -87,7 +87,7 @@ const RuleSetting:React.FC<RuleSettingProps> = (props) => {
...
@@ -87,7 +87,7 @@ const RuleSetting:React.FC<RuleSettingProps> = (props) => {
key
:
'name'
,
key
:
'name'
,
render
:
(
_
,
record
)
=>
<
EyePreview
url=
{
`/memberCenter/commodityAbility/commodity/products/viewProducts?id=${record.commodityId}`
}
>
{
_
}
</
EyePreview
>
render
:
(
_
,
record
)
=>
<
EyePreview
url=
{
`/memberCenter/commodityAbility/commodity/products/viewProducts?id=${record.commodityId}`
}
>
{
_
}
</
EyePreview
>
},
},
{
{
dataIndex
:
'customerCategoryName'
,
dataIndex
:
'customerCategoryName'
,
title
:
'品类'
,
title
:
'品类'
,
key
:
'customerCategoryName'
key
:
'customerCategoryName'
...
@@ -245,7 +245,6 @@ const RuleSetting:React.FC<RuleSettingProps> = (props) => {
...
@@ -245,7 +245,6 @@ const RuleSetting:React.FC<RuleSettingProps> = (props) => {
}
}
addSchemaAction
.
setFieldValue
(
'isElectronicContract'
,
data
.
isElectronicContract
?
true
:
false
)
addSchemaAction
.
setFieldValue
(
'isElectronicContract'
,
data
.
isElectronicContract
?
true
:
false
)
addSchemaAction
.
setFieldValue
(
'transactionProcesssId'
,
data
.
transactionProcesssId
)
addSchemaAction
.
setFieldValue
(
'transactionProcesssId'
,
data
.
transactionProcesssId
)
console
.
log
(
data
)
addSchemaAction
.
setFieldValue
(
'isTacitlyApprove'
,
data
.
isTacitlyApprove
)
addSchemaAction
.
setFieldValue
(
'isTacitlyApprove'
,
data
.
isTacitlyApprove
)
setInitialValue
(
data
)
setInitialValue
(
data
)
}
}
...
...
src/pages/transaction/transactionRules/index.tsx
View file @
6cbd2b7c
...
@@ -28,14 +28,7 @@ const TransactionRules: React.FC<{}> = () => {
...
@@ -28,14 +28,7 @@ const TransactionRules: React.FC<{}> = () => {
})
})
})
})
}
}
// id
// name
// state
// 状态:1.有效 0.无效
// transactionProcess
// operationTime
const
columns
:
ColumnType
<
any
>
[]
=
[
const
columns
:
ColumnType
<
any
>
[]
=
[
{
{
title
:
'交易规则ID'
,
title
:
'交易规则ID'
,
...
...
src/pages/transaction/transactionRules/schema/index.tsx
View file @
6cbd2b7c
...
@@ -52,7 +52,6 @@ export const ruleDetailSchema: ISchema = padRequiredMessage({
...
@@ -52,7 +52,6 @@ export const ruleDetailSchema: ISchema = padRequiredMessage({
"transactionProcesssId"
:
{
"transactionProcesssId"
:
{
type
:
'string'
,
type
:
'string'
,
title
:
'流程选择'
,
title
:
'流程选择'
,
"x-component"
:
'SelectProcesss'
,
"x-component"
:
'SelectProcesss'
,
"x-mega-props"
:
{
"x-mega-props"
:
{
style
:
{
style
:
{
...
@@ -65,10 +64,9 @@ export const ruleDetailSchema: ISchema = padRequiredMessage({
...
@@ -65,10 +64,9 @@ export const ruleDetailSchema: ISchema = padRequiredMessage({
"x-rules"
:
[
"x-rules"
:
[
{
{
required
:
true
,
required
:
true
,
message
:
'请选择
收货方式
'
message
:
'请选择
流程配置
'
}
}
],
],
// required: true,
// required: true,
// "x-component": 'SearchSelect',
// "x-component": 'SearchSelect',
// "x-component-props": {
// "x-component-props": {
...
...
src/utils/regExp.ts
View file @
6cbd2b7c
import
{
values
}
from
'mobx'
;
/**
/**
* @param str:string 需要校验的字符串
* @param str:string 需要校验的字符串
* @param type:string 需要校验的类型
* @param type:string 需要校验的类型
...
@@ -42,3 +43,28 @@ export const checkRegExp = (str:string, type:string) => {
...
@@ -42,3 +43,28 @@ export const checkRegExp = (str:string, type:string) => {
return
true
;
return
true
;
}
}
}
}
/**
* 区别校验 汉字 和 字符 长度
* @param rule
* @param value 表单输入的值
* @param callback
* @param maxByte:number 最大字符数
*/
export
const
validatorByte
=
(
rule
,
value
,
callback
,
maxByte
:
number
)
=>
{
try
{
if
(
value
){
let
str
=
value
str
=
str
.
replace
(
/
[\u
4e00-
\u
9fa5
]
/g
,
'OO'
)
if
(
str
.
length
>
maxByte
)
throw
new
Error
(
`最多输入
${
maxByte
}
个字符,
${
Math
.
floor
(
maxByte
/
2
)}
个汉字`
);
else
callback
()
}
else
{
callback
()
}
}
catch
(
err
)
{
callback
(
err
)
}
}
\ No newline at end of file
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment