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
7b375380
Commit
7b375380
authored
Dec 30, 2020
by
GuanHua
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix: 解决订单电子合同问题和商品详情购买数量小数时加减问题
parent
3587c772
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
51 additions
and
15 deletions
+51
-15
index.tsx
src/components/InputNumber/index.tsx
+35
-2
index.tsx
src/pages/lxMall/order/address/index.tsx
+9
-9
index.tsx
src/pages/lxMall/order/contract/index.tsx
+1
-1
index.tsx
src/pages/lxMall/order/payway/index.tsx
+6
-3
No files found.
src/components/InputNumber/index.tsx
View file @
7b375380
...
...
@@ -35,17 +35,50 @@ const InputNumber: React.FC<InputNumberPropsType> = (props) => {
const
handleReduce
=
(
e
)
=>
{
e
.
stopPropagation
()
if
(
value
>
minCount
)
{
onChange
(
Number
(
value
)
-
1
,
'click'
)
onChange
(
accSub
(
value
,
1
)
,
'click'
)
}
}
const
handleAdd
=
(
e
)
=>
{
e
.
stopPropagation
()
if
(
value
<
maxCount
)
{
onChange
(
Number
(
value
)
+
1
,
'click'
)
onChange
(
accAdd
(
value
,
1
)
,
'click'
)
}
}
const
accAdd
=
(
num1
,
num2
)
=>
{
let
r1
,
r2
try
{
r1
=
num1
.
toString
().
split
(
'.'
)[
1
].
length
;
}
catch
(
e
){
r1
=
0
;
}
try
{
r2
=
num2
.
toString
().
split
(
"."
)[
1
].
length
;
}
catch
(
e
){
r2
=
0
;
}
const
m
=
Math
.
pow
(
10
,
Math
.
max
(
r1
,
r2
));
return
Math
.
round
(
num1
*
m
+
num2
*
m
)
/
m
;
}
const
accSub
=
(
num1
,
num2
)
=>
{
let
r1
,
r2
;
try
{
r1
=
num1
.
toString
().
split
(
'.'
)[
1
].
length
;
}
catch
(
e
){
r1
=
0
;
}
try
{
r2
=
num2
.
toString
().
split
(
"."
)[
1
].
length
;
}
catch
(
e
){
r2
=
0
;
}
const
m
=
Math
.
pow
(
10
,
Math
.
max
(
r1
,
r2
));
const
n
=
(
r1
>=
r2
)
?
r1
:
r2
;
return
(
Math
.
round
(
num1
*
m
-
num2
*
m
)
/
m
).
toFixed
(
n
);
}
const
handleChange
=
(
e
)
=>
{
const
{
value
}
=
e
.
target
;
const
reg
=
/^
\d
*
([
.
]?\d{0,3})
$/
...
...
src/pages/lxMall/order/address/index.tsx
View file @
7b375380
...
...
@@ -24,11 +24,11 @@ const Address: React.FC<AddressPropsType> = (props) => {
},
[])
const
fetchAddressList
=
(
init
=
false
)
=>
{
let
param
=
{
const
param
:
any
=
{
current
:
1
,
pageSize
:
50
}
//@ts-ignore
PublicApi
.
getLogisticsReceiverAddressPage
(
param
).
then
(
res
=>
{
if
(
res
.
code
===
1000
)
{
setAddressList
(
res
.
data
?.
data
)
...
...
@@ -41,14 +41,14 @@ const Address: React.FC<AddressPropsType> = (props) => {
const
initDefaultAddress
=
async
(
addressList
:
GetLogisticsReceiverAddressPageResponseDetail
[])
=>
{
let
selectItem
for
(
le
t
item
of
addressList
)
{
for
(
cons
t
item
of
addressList
)
{
if
(
item
.
isDefault
===
1
)
{
selectItem
=
item
}
}
if
(
selectItem
)
{
setSelectKey
(
selectItem
.
id
)
le
t
res
=
await
PublicApi
.
getLogisticsReceiverAddressGet
({
id
:
selectItem
.
id
})
cons
t
res
=
await
PublicApi
.
getLogisticsReceiverAddressGet
({
id
:
selectItem
.
id
})
onChange
(
Object
.
assign
(
selectItem
,
res
.
data
))
}
}
...
...
@@ -56,13 +56,13 @@ const Address: React.FC<AddressPropsType> = (props) => {
const
handleSelect
=
async
(
e
:
any
)
=>
{
setSelectKey
(
e
.
target
.
value
)
let
selectItem
for
(
le
t
item
of
addressList
)
{
for
(
cons
t
item
of
addressList
)
{
if
(
item
.
id
===
e
.
target
.
value
)
{
selectItem
=
item
}
}
if
(
selectItem
)
{
le
t
res
=
await
PublicApi
.
getLogisticsReceiverAddressGet
({
id
:
selectItem
.
id
})
cons
t
res
=
await
PublicApi
.
getLogisticsReceiverAddressGet
({
id
:
selectItem
.
id
})
onChange
(
Object
.
assign
(
selectItem
,
res
.
data
))
}
}
...
...
@@ -91,11 +91,11 @@ const Address: React.FC<AddressPropsType> = (props) => {
}
const
handleSetDefaultAddress
=
async
(
addressItem
:
GetLogisticsReceiverAddressPageResponseDetail
)
=>
{
// eslint-disable-next-line @typescript-eslint/ban-ts-ignore
//@ts-ignore
le
t
addressDetailRes
=
await
PublicApi
.
getLogisticsReceiverAddressGet
({
id
:
addressItem
.
id
})
le
t
param
:
GetLogisticsReceiverAddressGetResponse
=
addressDetailRes
.
data
cons
t
addressDetailRes
=
await
PublicApi
.
getLogisticsReceiverAddressGet
({
id
:
addressItem
.
id
})
cons
t
param
:
GetLogisticsReceiverAddressGetResponse
=
addressDetailRes
.
data
param
.
isDefault
=
1
//@ts-ignore
PublicApi
.
postLogisticsReceiverAddressUpdate
(
param
).
then
(
res
=>
{
if
(
res
.
code
===
1000
)
{
fetchAddressList
()
...
...
src/pages/lxMall/order/contract/index.tsx
View file @
7b375380
...
...
@@ -26,7 +26,7 @@ const Contract: React.FC<ContractPropsType> = (props) => {
<
span
>
我同意签订:
</
span
>
</
Checkbox
>
{
contractInfo
&&
<
a
href=
{
contractInfo
?.
contractUrl
}
download
target=
"_blank"
className=
{
styles
.
checkbox_contract_text
}
>
《
{
contractInfo
?.
contractName
}
》
</
a
>
contractInfo
&&
<
a
href=
{
contractInfo
?.
contractUrl
}
download
rel=
"noreferrer"
target=
"_blank"
className=
{
styles
.
checkbox_contract_text
}
>
《
{
contractInfo
?.
contractName
}
》
</
a
>
}
</
div
>
</
div
>
...
...
src/pages/lxMall/order/payway/index.tsx
View file @
7b375380
...
...
@@ -33,8 +33,10 @@ const PayWay: React.FC<PayWayProps> = (props) => {
}
useEffect
(()
=>
{
fetchCreditInfo
()
},
[])
if
(
expand
)
{
fetchCreditInfo
()
}
},
[
expand
])
useEffect
(()
=>
{
if
(
payWayList
&&
payWayList
.
length
===
1
)
{
...
...
@@ -49,9 +51,10 @@ const PayWay: React.FC<PayWayProps> = (props) => {
}
PublicApi
.
getPayCreditGetCredit
(
param
).
then
(
res
=>
{
message
.
destroy
()
if
(
res
.
code
===
1000
)
{
setCreditInfo
(
res
.
data
)
}
else
{
message
.
destroy
()
}
})
}
...
...
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