Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wx-school-app-public
Project
Overview
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
姜雷
wx-school-app-public
Commits
11e46672
Commit
11e46672
authored
Apr 22, 2019
by
姜雷
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
调整支付逻辑
parent
e0526383
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
41 additions
and
32 deletions
+41
-32
index.tsx
src/pages/index/index.tsx
+5
-3
pay.tsx
src/pages/pay/pay.tsx
+31
-23
prepayConfig.ts
src/store/rootReducers/prepayConfig.ts
+3
-6
Device.ts
src/types/Device/Device.ts
+2
-0
No files found.
src/pages/index/index.tsx
View file @
11e46672
...
@@ -64,6 +64,8 @@ class Index extends Component {
...
@@ -64,6 +64,8 @@ class Index extends Component {
this
.
loginHandle
().
then
(()
=>
{
this
.
loginHandle
().
then
(()
=>
{
const
{
userinfo
}
=
this
.
props
;
const
{
userinfo
}
=
this
.
props
;
let
queryArr
=
Object
.
keys
(
this
.
$router
.
params
);
let
queryArr
=
Object
.
keys
(
this
.
$router
.
params
);
console
.
log
(
this
.
$router
.
params
);
let
scene
:
string
=
queryArr
.
length
>
0
?
queryArr
[
0
]
:
''
;
let
scene
:
string
=
queryArr
.
length
>
0
?
queryArr
[
0
]
:
''
;
console
.
log
(
'scene:'
,
scene
);
console
.
log
(
'scene:'
,
scene
);
...
@@ -138,13 +140,13 @@ class Index extends Component {
...
@@ -138,13 +140,13 @@ class Index extends Component {
})
})
.
then
(
res
=>
{
.
then
(
res
=>
{
console
.
log
(
res
);
console
.
log
(
res
);
const
{
deviceInfoResponse
,
prepayConfigs
}
=
res
.
data
;
const
{
deviceInfoResponse
,
prepayConfigs
}
=
res
;
if
(
deviceInfoResponse
.
isUsed
)
{
if
(
deviceInfoResponse
.
isUsed
)
{
console
.
log
(
'设备使用中'
);
console
.
log
(
'设备使用中'
);
return
;
return
;
}
}
updateDeviceData
(
deviceInfoResponse
);
deviceInfoResponse
&&
updateDeviceData
(
deviceInfoResponse
);
updatePayData
(
prepayConfigs
);
prepayConfigs
&&
updatePayData
(
prepayConfigs
);
Taro
.
navigateTo
({
Taro
.
navigateTo
({
url
:
'/pages/pay/pay'
,
url
:
'/pages/pay/pay'
,
});
});
...
...
src/pages/pay/pay.tsx
View file @
11e46672
...
@@ -10,7 +10,7 @@ import AES from 'crypto-js/aes';
...
@@ -10,7 +10,7 @@ import AES from 'crypto-js/aes';
import
Utf8
from
'crypto-js/enc-utf8'
;
import
Utf8
from
'crypto-js/enc-utf8'
;
import
ECBmode
from
'crypto-js/mode-ecb'
;
import
ECBmode
from
'crypto-js/mode-ecb'
;
import
PaddingPkcs7
from
'crypto-js/pad-pkcs7'
;
import
PaddingPkcs7
from
'crypto-js/pad-pkcs7'
;
import
{
paySuccess
}
from
'../../api/Order/paySuccess'
;
//
import { paySuccess } from '../../api/Order/paySuccess';
type
PageStateProps
=
{
type
PageStateProps
=
{
device
:
Device
;
device
:
Device
;
...
@@ -62,13 +62,13 @@ class Pay extends Component {
...
@@ -62,13 +62,13 @@ class Pay extends Component {
getPayOrder
({
getPayOrder
({
equipmentNum
:
device
.
code
,
equipmentNum
:
device
.
code
,
equipmentPos
:
device
.
position
,
equipmentPos
:
device
.
position
,
payType
:
''
,
payType
:
'
2
'
,
serviceId
:
0
,
serviceId
:
device
.
serviceId
,
smaproCustomerId
:
customerId
,
smaproCustomerId
:
customerId
,
smaproPrepayConfigId
:
payId
,
smaproPrepayConfigId
:
payId
,
})
})
.
then
(
res
=>
{
.
then
(
res
=>
{
const
{
payStr
,
outTradeNo
}
=
res
;
const
{
payStr
}
=
res
;
const
key
=
customerId
.
toString
().
padEnd
(
16
,
'0'
);
const
key
=
customerId
.
toString
().
padEnd
(
16
,
'0'
);
const
payData
=
JSON
.
parse
(
const
payData
=
JSON
.
parse
(
AES
.
decrypt
(
payStr
,
Utf8
.
parse
(
key
),
{
AES
.
decrypt
(
payStr
,
Utf8
.
parse
(
key
),
{
...
@@ -85,11 +85,21 @@ class Pay extends Component {
...
@@ -85,11 +85,21 @@ class Pay extends Component {
paySign
:
payData
.
msg
.
paySign
,
paySign
:
payData
.
msg
.
paySign
,
}).
then
(
res
=>
{
}).
then
(
res
=>
{
console
.
log
(
res
);
console
.
log
(
res
);
paySuccess
({
orderId
:
outTradeNo
});
// paySuccess({ orderId: outTradeNo });
Taro
.
showLoading
({
// Taro.showLoading({
title
:
'设备连接中'
,
// title: '设备连接中',
// mask: true,
// });
Taro
.
showToast
({
title
:
'支付成功!'
,
icon
:
'success'
,
mask
:
true
,
mask
:
true
,
});
});
setTimeout
(()
=>
{
Taro
.
navigateTo
({
url
:
'/pages/index/index?'
,
// 需要问号不然回到首页可以取到业务参数
});
},
2000
);
});
});
})
})
.
catch
(
err
=>
{
.
catch
(
err
=>
{
...
@@ -115,15 +125,11 @@ class Pay extends Component {
...
@@ -115,15 +125,11 @@ class Pay extends Component {
<
View
className=
'Pay-info'
>
<
View
className=
'Pay-info'
>
<
View
className=
'Pay-info-item'
>
<
View
className=
'Pay-info-item'
>
<
Text
>
服务类型
</
Text
>
<
Text
>
服务类型
</
Text
>
<
Text
>
<
Text
>
{
device
.
serviceName
?
device
.
serviceName
:
''
}
</
Text
>
{
prepayConfig
&&
prepayConfig
.
length
?
prepayConfig
[
0
].
serviceName
:
''
}
</
Text
>
</
View
>
</
View
>
<
View
className=
'Pay-info-item'
>
<
View
className=
'Pay-info-item'
>
<
Text
>
设备编号
</
Text
>
<
Text
>
设备编号
</
Text
>
<
Text
>
{
device
.
code
}
</
Text
>
<
Text
>
{
device
.
code
?
device
.
code
:
''
}
</
Text
>
</
View
>
</
View
>
<
View
className=
'Pay-info-item'
>
<
View
className=
'Pay-info-item'
>
<
Text
>
设备位置
</
Text
>
<
Text
>
设备位置
</
Text
>
...
@@ -153,16 +159,18 @@ class Pay extends Component {
...
@@ -153,16 +159,18 @@ class Pay extends Component {
温馨提示:如本次预付款未全部使用,系统将在使用结束后半小时内自动退还剩余金额,请留意查收!
温馨提示:如本次预付款未全部使用,系统将在使用结束后半小时内自动退还剩余金额,请留意查收!
</
View
>
</
View
>
<
View
className=
'Pay-money'
>
<
View
className=
'Pay-money'
>
{
prepayConfig
.
map
(
payConfig
=>
(
{
prepayConfig
&&
<
View
prepayConfig
.
length
&&
key=
{
payConfig
.
id
}
prepayConfig
.
map
(
payConfig
=>
(
className=
{
`Pay-money-item ${
<
View
payConfig.id == payId ? 'seleted' : ''
key=
{
payConfig
.
id
}
}`
}
className=
{
`Pay-money-item ${
onClick=
{
()
=>
this
.
selectPayConfig
(
payConfig
.
id
)
}
>
payConfig.id == payId ? 'seleted' : ''
{
payConfig
.
prepayMoney
}
元
}`
}
</
View
>
onClick=
{
()
=>
this
.
selectPayConfig
(
payConfig
.
id
)
}
>
))
}
{
payConfig
.
prepayMoney
}
元
</
View
>
))
}
{
/* <View className='Pay-money-item'>1.00元</View>
{
/* <View className='Pay-money-item'>1.00元</View>
<View className='Pay-money-item'>2.00元</View>
<View className='Pay-money-item'>2.00元</View>
<View className='Pay-money-item'>5.00元</View>
<View className='Pay-money-item'>5.00元</View>
...
...
src/store/rootReducers/prepayConfig.ts
View file @
11e46672
...
@@ -4,7 +4,7 @@ import { PrepayConfig } from '../../types/Order/Order';
...
@@ -4,7 +4,7 @@ import { PrepayConfig } from '../../types/Order/Order';
export
const
INITIAL_STATE
=
[];
export
const
INITIAL_STATE
=
[];
export
const
updatePayData
=
(
entity
:
PrepayConfig
[]):
Action
=>
({
export
const
updatePayData
=
(
entity
:
PrepayConfig
[]):
Action
=>
({
type
:
'UPDATE_
DEVICE
_DATA'
,
type
:
'UPDATE_
PAY
_DATA'
,
payload
:
entity
,
payload
:
entity
,
});
});
...
@@ -13,11 +13,8 @@ export default function prepayConfig(
...
@@ -13,11 +13,8 @@ export default function prepayConfig(
actions
:
Action
,
actions
:
Action
,
):
PrepayConfig
[]
{
):
PrepayConfig
[]
{
switch
(
actions
.
type
)
{
switch
(
actions
.
type
)
{
case
'UPDATE_DEVICE_DATA'
:
case
'UPDATE_PAY_DATA'
:
return
{
return
[...
state
,
...
actions
.
payload
];
...
state
,
...
actions
.
payload
,
};
default
:
default
:
return
state
;
return
state
;
}
}
...
...
src/types/Device/Device.ts
View file @
11e46672
...
@@ -12,4 +12,6 @@ export type Device = {
...
@@ -12,4 +12,6 @@ export type Device = {
position
:
string
;
position
:
string
;
positionId
:
string
;
positionId
:
string
;
rates
:
Rate
[];
rates
:
Rate
[];
serviceId
:
number
;
serviceName
:
string
;
};
};
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