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
shenshaokai
jinfa-platform
Commits
4b2c926e
Commit
4b2c926e
authored
Mar 31, 2022
by
前端-钟卫鹏
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix: 处理订单新增模块修改地址不选街道传参异常
parent
ee4925a6
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
28 additions
and
11 deletions
+28
-11
index.tsx
...seOrder/orderCollectB2b/components/addressModal/index.tsx
+7
-3
index.tsx
...eOrder/orderCollectCash/components/addressModal/index.tsx
+6
-2
index.tsx
...seOrder/orderCollectSrm/components/addressModal/index.tsx
+7
-3
index.tsx
...on/saleOrder/agentOrder/components/addressModal/index.tsx
+8
-3
No files found.
src/pages/transaction/purchaseOrder/orderCollectB2b/components/addressModal/index.tsx
View file @
4b2c926e
import
React
,
{
useMemo
}
from
'react'
import
React
,
{
useMemo
,
useRef
}
from
'react'
import
ModalForm
from
'@/components/ModalForm'
import
{
createFormActions
}
from
'@formily/antd'
import
addressSchema
from
'./schema'
...
...
@@ -31,6 +31,7 @@ const fetchTelCode = async () => {
const
AddressModal
:
React
.
FC
<
AddressModalProps
>
=
(
props
)
=>
{
const
{
mode
,
formInitValue
}
=
props
const
selfInitValue
=
useMemo
(()
=>
mode
===
'add'
?
null
:
formInitValue
,
[
mode
,
formInitValue
])
const
changDistrict
=
useRef
<
boolean
>
(
false
)
// 由于默认是number类型, 但switch组件只接收boolean
if
(
selfInitValue
)
{
selfInitValue
.
isDefault
=
!!
selfInitValue
.
isDefault
...
...
@@ -55,7 +56,8 @@ const AddressModal:React.FC<AddressModalProps> = (props) => {
const
provinceName
=
obj_provinceCode
?
obj_provinceCode
[
'title'
]
:
value
.
provinceName
const
cityName
=
obj_cityCode
?
obj_cityCode
[
'title'
]
:
value
.
cityName
const
districtName
=
obj_districtCode
?
obj_districtCode
[
'title'
]
:
value
.
districtName
const
streetName
=
obj_streetCode
?
obj_streetCode
[
'title'
]
:
value
.
streetName
const
streetName
=
changDistrict
.
current
?
(
obj_streetCode
?
obj_streetCode
[
'title'
]
:
obj_streetCode
)
:
value
.
streetName
const
streetCode
=
changDistrict
.
current
?
(
obj_streetCode
?
obj_streetCode
[
'value'
]
:
obj_streetCode
)
:
value
.
streetCode
const
params
=
{
...
value
,
...
...
@@ -63,7 +65,8 @@ const AddressModal:React.FC<AddressModalProps> = (props) => {
provinceName
,
cityName
,
districtName
,
streetName
streetName
,
streetCode
}
const
fn
=
mode
===
'edit'
?
postLogisticsReceiverAddressUpdate
:
postLogisticsReceiverAddressAdd
await
fn
(
params
)
...
...
@@ -116,6 +119,7 @@ const AddressModal:React.FC<AddressModalProps> = (props) => {
// 街道/乡/镇
$
(
'onFieldValueChange'
,
'districtCode'
).
subscribe
(({
value
})
=>
{
if
(
value
)
{
changDistrict
.
current
=
true
ctx
.
setFieldValue
(
'streetCode'
,
null
)
renderSelectOption
(
'streetCode'
,
ctx
,
{
pcode
:
value
})
}
...
...
src/pages/transaction/purchaseOrder/orderCollectCash/components/addressModal/index.tsx
View file @
4b2c926e
...
...
@@ -31,6 +31,7 @@ const fetchTelCode = async () => {
const
AddressModal
:
React
.
FC
<
AddressModalProps
>
=
(
props
)
=>
{
const
{
mode
,
formInitValue
}
=
props
const
selfInitValue
=
useMemo
(()
=>
mode
===
'add'
?
null
:
formInitValue
,
[
mode
,
formInitValue
])
const
changDistrict
=
useRef
<
boolean
>
(
false
)
// 由于默认是number类型, 但switch组件只接收boolean
if
(
selfInitValue
)
{
selfInitValue
.
isDefault
=
!!
selfInitValue
.
isDefault
...
...
@@ -55,7 +56,8 @@ const AddressModal:React.FC<AddressModalProps> = (props) => {
const
provinceName
=
obj_provinceCode
?
obj_provinceCode
[
'title'
]
:
value
.
provinceName
const
cityName
=
obj_cityCode
?
obj_cityCode
[
'title'
]
:
value
.
cityName
const
districtName
=
obj_districtCode
?
obj_districtCode
[
'title'
]
:
value
.
districtName
const
streetName
=
obj_streetCode
?
obj_streetCode
[
'title'
]
:
value
.
streetName
const
streetName
=
changDistrict
.
current
?
(
obj_streetCode
?
obj_streetCode
[
'title'
]
:
obj_streetCode
)
:
value
.
streetName
const
streetCode
=
changDistrict
.
current
?
(
obj_streetCode
?
obj_streetCode
[
'value'
]
:
obj_streetCode
)
:
value
.
streetCode
const
params
=
{
...
value
,
...
...
@@ -63,7 +65,8 @@ const AddressModal:React.FC<AddressModalProps> = (props) => {
provinceName
,
cityName
,
districtName
,
streetName
streetName
,
streetCode
}
const
fn
=
mode
===
'edit'
?
postLogisticsReceiverAddressUpdate
:
postLogisticsReceiverAddressAdd
...
...
@@ -117,6 +120,7 @@ const AddressModal:React.FC<AddressModalProps> = (props) => {
// 街道/乡/镇
$
(
'onFieldValueChange'
,
'districtCode'
).
subscribe
(({
value
})
=>
{
if
(
value
)
{
changDistrict
.
current
=
true
ctx
.
setFieldValue
(
'streetCode'
,
null
)
renderSelectOption
(
'streetCode'
,
ctx
,
{
pcode
:
value
})
}
...
...
src/pages/transaction/purchaseOrder/orderCollectSrm/components/addressModal/index.tsx
View file @
4b2c926e
import
React
,
{
useMemo
}
from
'react'
import
React
,
{
useMemo
,
useRef
}
from
'react'
import
ModalForm
from
'@/components/ModalForm'
import
{
createFormActions
}
from
'@formily/antd'
import
addressSchema
from
'./schema'
...
...
@@ -31,6 +31,7 @@ const fetchTelCode = async () => {
const
AddressModal
:
React
.
FC
<
AddressModalProps
>
=
(
props
)
=>
{
const
{
mode
,
formInitValue
}
=
props
const
selfInitValue
=
useMemo
(()
=>
mode
===
'add'
?
null
:
formInitValue
,
[
mode
,
formInitValue
])
const
changDistrict
=
useRef
<
boolean
>
(
false
)
// 由于默认是number类型, 但switch组件只接收boolean
if
(
selfInitValue
)
{
selfInitValue
.
isDefault
=
!!
selfInitValue
.
isDefault
...
...
@@ -55,7 +56,8 @@ const AddressModal:React.FC<AddressModalProps> = (props) => {
const
provinceName
=
obj_provinceCode
?
obj_provinceCode
[
'title'
]
:
value
.
provinceName
const
cityName
=
obj_cityCode
?
obj_cityCode
[
'title'
]
:
value
.
cityName
const
districtName
=
obj_districtCode
?
obj_districtCode
[
'title'
]
:
value
.
districtName
const
streetName
=
obj_streetCode
?
obj_streetCode
[
'title'
]
:
value
.
streetName
const
streetName
=
changDistrict
.
current
?
(
obj_streetCode
?
obj_streetCode
[
'title'
]
:
obj_streetCode
)
:
value
.
streetName
const
streetCode
=
changDistrict
.
current
?
(
obj_streetCode
?
obj_streetCode
[
'value'
]
:
obj_streetCode
)
:
value
.
streetCode
const
params
=
{
...
value
,
...
...
@@ -63,7 +65,8 @@ const AddressModal:React.FC<AddressModalProps> = (props) => {
provinceName
,
cityName
,
districtName
,
streetName
streetName
,
streetCode
}
const
fn
=
mode
===
'edit'
?
postLogisticsReceiverAddressUpdate
:
postLogisticsReceiverAddressAdd
await
fn
(
params
)
...
...
@@ -116,6 +119,7 @@ const AddressModal:React.FC<AddressModalProps> = (props) => {
// 街道/乡/镇
$
(
'onFieldValueChange'
,
'districtCode'
).
subscribe
(({
value
})
=>
{
if
(
value
)
{
changDistrict
.
current
=
true
ctx
.
setFieldValue
(
'streetCode'
,
null
)
renderSelectOption
(
'streetCode'
,
ctx
,
{
pcode
:
value
})
}
...
...
src/pages/transaction/saleOrder/agentOrder/components/addressModal/index.tsx
View file @
4b2c926e
import
React
,
{
useMemo
}
from
'react'
import
React
,
{
useMemo
,
useRef
}
from
'react'
import
ModalForm
from
'@/components/ModalForm'
import
{
createFormActions
}
from
'@formily/antd'
import
addressSchema
from
'./schema'
...
...
@@ -35,13 +35,16 @@ const fetchTelCode = async () => {
const
AddressModal
:
React
.
FC
<
AddressModalProps
>
=
(
props
)
=>
{
const
{
mode
,
formInitValue
,
ctx
}
=
props
const
selfInitValue
=
useMemo
(()
=>
mode
===
'add'
?
null
:
formInitValue
,
[
mode
,
formInitValue
])
const
changDistrict
=
useRef
<
boolean
>
(
false
)
// 由于默认是number类型, 但switch组件只接收boolean
if
(
selfInitValue
)
{
selfInitValue
.
isDefault
=
!!
selfInitValue
.
isDefault
}
const
resetForm
=
()
=>
{
addressSchemaAction
.
reset
({
validate
:
false
})
}
const
handleConfirm
=
()
=>
{
if
(
mode
===
'preview'
)
{
props
.
currentRef
.
current
.
setVisible
(
false
)
...
...
@@ -59,7 +62,8 @@ const AddressModal:React.FC<AddressModalProps> = (props) => {
const
provinceName
=
obj_provinceCode
?
obj_provinceCode
[
'title'
]
:
value
.
provinceName
const
cityName
=
obj_cityCode
?
obj_cityCode
[
'title'
]
:
value
.
cityName
const
districtName
=
obj_districtCode
?
obj_districtCode
[
'title'
]
:
value
.
districtName
const
streetName
=
obj_streetCode
?
obj_streetCode
[
'title'
]
:
value
.
streetName
const
streetName
=
changDistrict
.
current
?
(
obj_streetCode
?
obj_streetCode
[
'title'
]
:
obj_streetCode
)
:
value
.
streetName
const
streetCode
=
changDistrict
.
current
?
(
obj_streetCode
?
obj_streetCode
[
'value'
]
:
obj_streetCode
)
:
value
.
streetCode
const
roleId
=
ctx
.
getFieldValue
(
'buyerRoleId'
)
const
memberId
=
ctx
.
getFieldValue
(
'buyerMemberId'
)
...
...
@@ -72,6 +76,7 @@ const AddressModal:React.FC<AddressModalProps> = (props) => {
cityName
,
districtName
,
streetName
,
streetCode
,
roleId
,
memberId
}
...
...
@@ -131,7 +136,7 @@ const AddressModal:React.FC<AddressModalProps> = (props) => {
// 街道/乡/镇
$
(
'onFieldValueChange'
,
'districtCode'
).
subscribe
(({
value
})
=>
{
if
(
value
)
{
c
onsole
.
log
(
value
)
c
hangDistrict
.
current
=
true
ctx
.
setFieldValue
(
'streetCode'
,
null
)
renderSelectOption
(
'streetCode'
,
ctx
,
{
pcode
:
value
})
}
...
...
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