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
8f4476f4
Commit
8f4476f4
authored
Sep 22, 2020
by
前端-钟卫鹏
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix:新增交易规则
parent
d2ce1e22
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
48 additions
and
23 deletions
+48
-23
setPrice.tsx
src/pages/commodity/products/addChannelItem/setPrice.tsx
+1
-0
basicInfoForm.tsx
...ages/commodity/products/addProductsItem/basicInfoForm.tsx
+1
-1
productAttributeForm.tsx
...mmodity/products/addProductsItem/productAttributeForm.tsx
+18
-2
directChannel.tsx
src/pages/commodity/products/directChannel.tsx
+5
-5
modifyDirectChannel.tsx
src/pages/commodity/products/modifyDirectChannel.tsx
+10
-4
addRule.tsx
src/pages/transaction/transactionRules/addRule.tsx
+0
-1
RuleSetting.tsx
...s/transaction/transactionRules/components/RuleSetting.tsx
+1
-1
index.tsx
src/pages/transaction/transactionRules/effects/index.tsx
+12
-9
No files found.
src/pages/commodity/products/addChannelItem/setPrice.tsx
View file @
8f4476f4
...
...
@@ -259,6 +259,7 @@ const SetPrice:React.FC<IProps> = (props) => {
let
_data
=
selectData
.
map
(
item
=>
{
let
price
=
priceTableData
.
filter
(
_i
=>
_i
.
id
===
item
.
id
)[
0
][
'单价'
]
delete
item
.
id
return
{...
item
,
unitPrice
:
price
}
})
...
...
src/pages/commodity/products/addProductsItem/basicInfoForm.tsx
View file @
8f4476f4
...
...
@@ -125,7 +125,7 @@ const BasicInfoForm: React.FC<Iprops> = (props) => {
}
const
handleBrandSearch
=
(
value
?:
any
)
=>
{
// end value
PublicApi
.
getProductSelectGetSelectBrand
({
name
:
value
}).
then
(
res
=>
{
PublicApi
.
getProductSelectGetSelectBrand
({
name
:
value
||
''
}).
then
(
res
=>
{
if
(
res
.
code
===
1000
)
setBrandData
(
res
.
data
)
})
...
...
src/pages/commodity/products/addProductsItem/productAttributeForm.tsx
View file @
8f4476f4
...
...
@@ -166,6 +166,20 @@ const ProductAttributeForm: React.FC<Iprops> = (props) => {
_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
(
<>
{
...
...
@@ -238,13 +252,15 @@ const ProductAttributeForm: React.FC<Iprops> = (props) => {
rules=
{
attrItem
.
isEmpty
&&
[{
required
:
true
,
message
:
'此项为必填项'
},{
validator
:
validatorByte
}]
}
>
<
TextArea
disabled=
{
_isDisabled
}
onChange=
{
(
v
)
=>
onChange
(
v
,
attrItem
)
}
maxLength=
{
5
0
}
placeholder=
"最多输入
50个字符
"
maxLength=
{
6
0
}
placeholder=
"最多输入
60个字符,30个汉字
"
rows=
{
4
}
/>
</
Form
.
Item
>
...
...
src/pages/commodity/products/directChannel.tsx
View file @
8f4476f4
...
...
@@ -244,12 +244,12 @@ const DirectChannel: React.FC<{}> = () => {
// 判断所选商品 priceType, source, status一致
const
judgeType
=
()
=>
{
let
sourceArr
=
Array
.
from
(
new
Set
(
selectRow
.
map
((
item
:
any
)
=>
item
.
channelCommodity
.
source
)))
//
let sourceArr = Array.from(new Set(selectRow.map((item:any) => item.channelCommodity.source)))
let
priceTypeArr
=
Array
.
from
(
new
Set
(
selectRow
.
map
((
item
:
any
)
=>
item
.
channelCommodity
.
commodity
.
priceType
)))
let
statusArr
=
Array
.
from
(
new
Set
(
selectRow
.
map
((
item
:
any
)
=>
item
.
status
)))
return
{
isPassJudge
:
sourceArr
.
length
===
1
&&
priceTypeArr
.
length
===
1
&&
statusArr
.
length
===
1
,
source
:
sourceArr
,
return
{
isPassJudge
:
priceTypeArr
.
length
===
1
&&
statusArr
.
length
===
1
,
//
source: sourceArr,
priceType
:
priceTypeArr
}
}
...
...
@@ -262,7 +262,7 @@ const DirectChannel: React.FC<{}> = () => {
if
(
_judge
.
isPassJudge
){
setUpDownModal
(
true
)
// 获取渠道商品批量上架商城
PublicApi
.
getProductChannelCommodityGetShopBatch
({
priceType
:
_judge
.
priceType
[
0
]
,
source
:
_judge
.
source
[
0
]
}).
then
(
res
=>
{
PublicApi
.
getProductChannelCommodityGetShopBatch
({
priceType
:
_judge
.
priceType
[
0
]}).
then
(
res
=>
{
const
{
data
}
=
res
setShopsBatchOption
(
data
)
setCheckedValues
([])
...
...
src/pages/commodity/products/modifyDirectChannel.tsx
View file @
8f4476f4
...
...
@@ -55,6 +55,7 @@ const ModifyDirectChannel:React.FC<{}> = () => {
const
[
ladderPrice
,
setLadderPrice
]
=
useState
(
false
)
const
[
submitParams
,
setSubmitParams
]
=
useState
<
any
>
()
const
flagRef
=
useRef
(
false
)
// 价格数据是否被模态框替换
useEffect
(()
=>
{
...
...
@@ -87,7 +88,7 @@ const ModifyDirectChannel:React.FC<{}> = () => {
// 获取商品规格列表
const
fetchSpecData
=
()
=>
{
PublicApi
.
getProductChannelCommodityGetCommodityUnitPriceByChannel
({
id
:
history
.
location
.
query
.
commodityI
d
}).
then
(
res
=>
{
PublicApi
.
getProductChannelCommodityGetCommodityUnitPriceByChannel
({
id
:
history
.
location
.
query
.
i
d
}).
then
(
res
=>
{
const
{
data
}
=
res
setOriginTableData
(
data
)
if
(
data
.
length
>
0
)
...
...
@@ -186,7 +187,7 @@ const ModifyDirectChannel:React.FC<{}> = () => {
return
(
<>
<
Button
type=
'link'
onClick=
{
()
=>
clickSetPrice
(
record
)
}
>
{
priceType
===
3
?
'设置积分'
:
'设置价格'
}
</
Button
>
<
Button
type=
'link'
onClick=
{
()
=>
clickDelete
(
record
)
}
>
删除
</
Button
>
{
channelDetails
.
status
!==
6
&&
<
Button
type=
'link'
onClick=
{
()
=>
clickDelete
(
record
)
}
>
删除
</
Button
>
}
</>
)
}
...
...
@@ -195,12 +196,13 @@ const ModifyDirectChannel:React.FC<{}> = () => {
if
(
!
noModal
){
setPriceTableData
(
selectSpecRow
)
setVisibleAddSpec
(
false
)
flagRef
.
current
=
true
}
}
const
handleCancelAddSpec
=
()
=>
{
setVisibleAddSpec
(
false
)
setSelectedSpecRowKeys
([])
//
setSelectedSpecRowKeys([])
}
const
clickSetPrice
=
(
record
:
any
)
=>
{
...
...
@@ -268,6 +270,7 @@ const ModifyDirectChannel:React.FC<{}> = () => {
let
_temp
:
any
=
{}
_temp
.
unitPrice
=
item
[
'单价'
]
_temp
.
goods
=
{
id
:
item
[
'goodsId'
]
}
_temp
.
id
=
item
[
'id'
]
// 移除item行数据的多余字段 余下属性
delete
item
.
goodsId
delete
item
[
'索引'
]
...
...
@@ -290,12 +293,15 @@ const ModifyDirectChannel:React.FC<{}> = () => {
})
setSubmitParams
(
_data
)
console
.
log
(
priceTableData
,
_priceTableData
,
_data
,
'params'
)
//
console.log(priceTableData, _priceTableData, _data, 'params')
}
const
clickDelete
=
(
record
:
any
)
=>
{
setPriceTableData
(
priceTableData
=>
[...
priceTableData
].
filter
(
item
=>
item
.
id
!=
record
.
id
))
setSelectedSpecRowKeys
(
selectedSpecRowKeys
=>
[...
selectedSpecRowKeys
].
filter
(
item
=>
item
!=
record
.
id
))
if
(
!
flagRef
.
current
){
PublicApi
.
postProductChannelCommodityDeleteChannelCommodityPrice
({
id
:
record
.
id
})
}
}
const
changeLadderPrice
=
(
e
:
any
)
=>
{
...
...
src/pages/transaction/transactionRules/addRule.tsx
View file @
8f4476f4
...
...
@@ -28,7 +28,6 @@ const AddRule:React.FC<{}> = (props) => {
values
.
products
=
values
.
products
.
map
(
item
=>
({
productId
:
item
.
id
,
productName
:
item
.
name
,
category
:
item
.
customerCategoryName
,
productPrice
:
item
.
priceType
,
brand
:
item
.
brandName
}))
values
.
isElectronicContract
=
values
.
isElectronicContract
?
1
:
0
const
params
=
omit
(
values
,
[
'state'
])
// 移除不需要的字段
console
.
log
(
values
,
params
,
'values'
)
await
PublicApi
.
postOrderTradingRulesAdd
(
params
)
setTimeout
(()
=>
{
history
.
goBack
(
-
1
)
...
...
src/pages/transaction/transactionRules/components/RuleSetting.tsx
View file @
8f4476f4
...
...
@@ -41,7 +41,7 @@ const RuleSetting:React.FC<RuleSettingProps> = (props) => {
}
=
usePageStatus
()
const
initValue
=
useInitValue
(
PublicApi
.
getOrderTradingRulesDetails
)
//
useUnitPreview(initValue, addSchemaAction)
useUnitPreview
(
initValue
,
addSchemaAction
)
const
fetchProductList
=
async
(
params
)
=>
{
const
shopIds
=
addSchemaAction
.
getFieldValue
(
'shopIds'
)
...
...
src/pages/transaction/transactionRules/effects/index.tsx
View file @
8f4476f4
...
...
@@ -21,14 +21,16 @@ export const createAddContractTemplateEffect = (context: ISchemaFormActions) =>
export
const
useUnitPreview
=
(
initValue
,
context
)
=>
{
useEffect
(()
=>
{
if
(
initValue
)
{
context
.
setFieldState
(
'inventory'
,
state
=>
{
if
(
!
state
.
props
[
'x-props'
])
{
state
.
props
[
'x-props'
]
=
{}
}
state
.
props
[
'x-props'
].
addonAfter
=
<
div
style=
{
{
marginLeft
:
4
}
}
>
{
initValue
.
unit
}
</
div
>
})
context
.
setFieldValue
(
'itemNo'
,
initValue
.
itemNo
)
}
context
.
setFieldValue
(
'isElectronicContract'
,
initValue
?.
isElectronicContract
?
true
:
false
)
// console.log(initValue, 'init')
// if (initValue) {
// context.setFieldState('inventory', state => {
// if (!state.props['x-props']) {
// state.props['x-props'] = {}
// }
// state.props['x-props'].addonAfter = <div style={{marginLeft: 4}}>{initValue.unit}</div>
// })
// context.setFieldValue('itemNo', initValue.itemNo)
// }
},
[
initValue
])
}
\ 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