Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wx-school-app
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
Commits
e2bcb4f2
Commit
e2bcb4f2
authored
Jul 26, 2019
by
姜雷
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
添加预约前检查阈值
parent
c04e761c
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
51 additions
and
38 deletions
+51
-38
shower.ts
src/api/shower.ts
+1
-1
ShowerAppointment.tsx
src/pages/Shower/ShowerAppointment.tsx
+48
-35
AppointermentEquipment.tsx
...ponents/AppointermentEquipment/AppointermentEquipment.tsx
+2
-2
No files found.
src/api/shower.ts
View file @
e2bcb4f2
...
...
@@ -123,7 +123,7 @@ export type AppointDeviceResponse = {
// allowEmptyValue: false
// 设备位置
operationMode
:
number
;
operationMode
:
OperationMode
;
// allowEmptyValue: false
// 设备计费模式
};
...
...
src/pages/Shower/ShowerAppointment.tsx
View file @
e2bcb4f2
...
...
@@ -7,6 +7,7 @@ import {
getAppointmentDevice
,
appointingEquipment
,
ShowerUseType
,
OperationMode
,
}
from
'@/api/shower'
;
import
{
useSelector
}
from
'@tarojs/redux'
;
import
{
Customer
}
from
'@/types/Customer/Customer'
;
...
...
@@ -21,7 +22,8 @@ function ShowerAppointment() {
(
state
:
{
userinfo
:
Customer
})
=>
state
.
userinfo
,
);
const
showerControlConfig
=
useSelector
(
(
state
:
{
showerState
:
ShowerState
})
=>
state
.
showerState
,
(
state
:
{
showerState
:
ShowerState
})
=>
state
.
showerState
.
controllerConfigs
,
);
const
[
showState
,
setShowState
]
=
useState
(
1
);
const
search
=
useInputValue
(
''
);
...
...
@@ -44,32 +46,44 @@ function ShowerAppointment() {
const
searchEquipment
=
()
=>
{
setSearchString
(
search
.
value
);
};
const
appointingStart
=
(
deviceCode
:
string
)
=>
{
// Taro.showModal({
// title: '',
// content: '',
// }).then(res => {
// if(res.confirm){
const
appointingStart
=
(
deviceCode
:
string
,
operationMode
:
number
)
=>
{
const
thresholdValue
=
showerControlConfig
.
thresholdValue
;
let
aimiItem
=
showerControlConfig
.
balances
.
find
(
item
=>
item
.
serviceId
===
'0'
,
);
let
aimi
=
aimiItem
?
aimiItem
.
amount
:
0
;
let
beanItem
=
showerControlConfig
.
balances
.
find
(
item
=>
item
.
serviceId
===
'1'
,
);
let
bean
=
beanItem
?
beanItem
.
amount
:
0
;
let
money
=
operationMode
===
OperationMode
.
onlyAimi
?
aimi
:
aimi
+
bean
;
// }
// })
appointingEquipment
({
account
:
userInfo
.
customerId
.
toString
(),
phone
:
userInfo
.
customerPhone
,
userId
:
userInfo
.
customerId
,
userName
:
userInfo
.
customerName
,
deviceCode
:
deviceCode
,
})
.
then
(
res
=>
{
console
.
log
(
res
);
Taro
.
showToast
({
title
:
res
.
msg
,
});
})
.
catch
(
err
=>
{
console
.
log
(
err
);
if
(
money
<
thresholdValue
)
{
let
text
=
showerControlConfig
.
appointmentThresholdPrompt
;
Taro
.
showModal
({
title
:
'提示'
,
content
:
text
,
}).
then
(
res
=>
{
if
(
res
.
confirm
)
{
appointingEquipment
({
account
:
userInfo
.
customerId
.
toString
(),
phone
:
userInfo
.
customerPhone
,
userId
:
userInfo
.
customerId
,
userName
:
userInfo
.
customerName
,
deviceCode
:
deviceCode
,
})
.
then
(
res
=>
{
console
.
log
(
res
);
Taro
.
showToast
({
title
:
res
.
msg
,
});
})
.
catch
(
err
=>
{
console
.
log
(
err
);
});
}
});
}
};
const
goBluetoothShower
=
()
=>
{
Taro
.
navigateTo
({
...
...
@@ -93,9 +107,9 @@ function ShowerAppointment() {
</
Text
>
</
View
>
)
}
{
showState
==
1
&&
showerControlConfig
.
controllerConfigs
.
balances
.
length
&&
(
{
showState
==
1
&&
showerControlConfig
.
balances
.
length
&&
(
<
View
className=
'ShowerAppointment-Account'
>
{
showerControlConfig
.
controllerConfigs
.
balances
.
map
(
item
=>
(
{
showerControlConfig
.
balances
.
map
(
item
=>
(
<
View
className=
'ShowerAppointment-Account-item'
>
<
Text
className=
'name'
>
{
item
.
serviceName
}
</
Text
>
<
Text
>
{
item
.
amount
.
toFixed
(
2
)
}
</
Text
>
...
...
@@ -118,14 +132,13 @@ function ShowerAppointment() {
))
}
</
View
>
)
}
{
showState
==
1
&&
showerControlConfig
.
controllerConfigs
.
useType
===
ShowerUseType
.
mix
&&
(
<
View
className=
'ShowerAppointment-ToggleBtn'
onClick=
{
goBluetoothShower
}
>
自助洗浴
</
View
>
)
}
{
showState
==
1
&&
showerControlConfig
.
useType
===
ShowerUseType
.
mix
&&
(
<
View
className=
'ShowerAppointment-ToggleBtn'
onClick=
{
goBluetoothShower
}
>
自助洗浴
</
View
>
)
}
{
showState
==
2
&&
(
<
ScrollView
className=
'ShowerAppointment-AppointmentList'
...
...
src/pages/Shower/components/AppointermentEquipment/AppointermentEquipment.tsx
View file @
e2bcb4f2
...
...
@@ -5,12 +5,12 @@ import DisabledIcon from '@/images/shower/ic_jinyuyue@2x.png';
type
PageOwnProps
=
{
data
:
AppointDeviceResponse
;
appointingStart
:
(
deviceCode
:
string
)
=>
void
;
appointingStart
:
(
deviceCode
:
string
,
operationMode
:
number
)
=>
void
;
};
const
AppointermentEquipment
=
(
props
:
PageOwnProps
)
=>
{
const
{
data
,
appointingStart
}
=
props
;
const
clickHandle
=
()
=>
{
appointingStart
&&
appointingStart
(
data
.
code
);
appointingStart
&&
appointingStart
(
data
.
code
,
data
.
operationMode
);
};
return
(
<
View
...
...
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