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
d6b5dfab
Commit
d6b5dfab
authored
Aug 05, 2019
by
姜雷
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
修改部分BUG
parent
41897cdc
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
60 additions
and
38 deletions
+60
-38
Shower.tsx
src/pages/Shower/Shower.tsx
+1
-1
ShowerAppointment.tsx
src/pages/Shower/ShowerAppointment.tsx
+50
-33
AppointermentCard.tsx
...Shower/components/AppointermentCard/AppointermentCard.tsx
+2
-2
AppointermentEquipment.tsx
...ponents/AppointermentEquipment/AppointermentEquipment.tsx
+7
-2
No files found.
src/pages/Shower/Shower.tsx
View file @
d6b5dfab
...
@@ -812,7 +812,7 @@ class Shower extends Component {
...
@@ -812,7 +812,7 @@ class Shower extends Component {
});
});
}
}
goAppointShower
()
{
goAppointShower
()
{
Taro
.
navigate
To
({
Taro
.
redirect
To
({
url
:
'/pages/Shower/ShowerAppointment'
,
url
:
'/pages/Shower/ShowerAppointment'
,
});
});
}
}
...
...
src/pages/Shower/ShowerAppointment.tsx
View file @
d6b5dfab
import
'./ShowerAppointment.scss'
;
import
'./ShowerAppointment.scss'
;
import
{
View
,
Input
,
Text
,
Image
,
ScrollView
}
from
'@tarojs/components'
;
import
{
View
,
Input
,
Text
,
ScrollView
}
from
'@tarojs/components'
;
import
Taro
,
{
useState
,
useReducer
,
useEffect
}
from
'@tarojs/taro'
;
import
Taro
,
{
useState
}
from
'@tarojs/taro'
;
import
AppointermentCard
from
'./components/AppointermentCard/AppointermentCard'
;
import
AppointermentCard
from
'./components/AppointermentCard/AppointermentCard'
;
import
useInputValue
from
'@/hooks/useInputValue'
;
import
useInputValue
from
'@/hooks/useInputValue'
;
import
{
import
{
getAppointmentDevice
,
appointingEquipment
,
appointingEquipment
,
ShowerUseType
,
ShowerUseType
,
OperationMode
,
OperationMode
,
...
@@ -69,50 +68,68 @@ function ShowerAppointment() {
...
@@ -69,50 +68,68 @@ function ShowerAppointment() {
console
.
log
(
err
);
console
.
log
(
err
);
});
});
};
};
const
appointingStart
=
(
deviceCode
:
string
,
operationMode
:
number
)
=>
{
const
appointingStart
=
(
deviceCode
:
string
,
operationMode
:
number
,
location
:
string
,
)
=>
{
const
thresholdValue
=
showerControlConfig
.
thresholdValue
;
const
thresholdValue
=
showerControlConfig
.
thresholdValue
;
let
aimiItem
=
showerControlConfig
.
balances
.
find
(
if
(
showerControlConfig
.
balances
.
length
)
{
item
=>
item
.
serviceId
===
'0'
,
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
;
if
(
money
<
thresholdValue
)
{
let
i
=
0
;
let
text
=
showerControlConfig
.
appointmentThresholdPrompt
.
replace
(
/
\{\}
/g
,
()
=>
{
return
i
++
==
0
?
aimi
.
toFixed
(
2
)
:
bean
.
toFixed
(
2
);
},
);
);
Taro
.
showModal
({
let
aimi
=
aimiItem
?
aimiItem
.
amount
:
0
;
title
:
'提示'
,
let
beanItem
=
showerControlConfig
.
balances
.
find
(
content
:
text
,
item
=>
item
.
serviceId
===
'1'
,
}).
then
(
res
=>
{
);
if
(
res
.
confirm
)
{
let
bean
=
beanItem
?
beanItem
.
amount
:
0
;
appointingEquipmentHandle
(
deviceCode
);
let
money
=
operationMode
===
OperationMode
.
onlyAimi
?
aimi
:
aimi
+
bean
;
}
});
if
(
money
<
thresholdValue
)
{
}
else
{
let
i
=
0
;
appointingEquipmentHandle
(
deviceCode
);
let
text
=
showerControlConfig
.
appointmentThresholdPrompt
.
replace
(
/
\{\}
/g
,
()
=>
{
return
i
++
==
0
?
aimi
.
toFixed
(
2
)
:
bean
.
toFixed
(
2
);
},
);
Taro
.
showModal
({
title
:
'提示'
,
content
:
text
,
}).
then
(
res
=>
{
if
(
res
.
confirm
)
{
beforeStartCheckHandle
(
deviceCode
,
location
);
}
});
return
;
}
}
}
beforeStartCheckHandle
(
deviceCode
,
location
);
};
};
const
goBluetoothShower
=
()
=>
{
const
goBluetoothShower
=
()
=>
{
Taro
.
navigate
To
({
Taro
.
redirect
To
({
url
:
'/pages/Shower/Shower'
,
url
:
'/pages/Shower/Shower'
,
});
});
};
};
const
beforeStartCheckHandle
=
(
deviceCode
:
string
,
location
:
string
)
=>
{
let
minData
=
appointableData
.
duration
/
60
;
let
hourData
=
appointableData
.
punishment
/
3600
;
Taro
.
showModal
({
title
:
'提示'
,
content
:
`确认是否预约
${
deviceCode
}
(
${
location
}
)预约后请在
${
minData
}
分钟内激活设备使用,否则将会在
${
hourData
}
小时内无法预约设备,`
,
}).
then
(
res
=>
{
if
(
res
.
confirm
)
{
appointingEquipmentHandle
(
deviceCode
);
}
});
};
return
(
return
(
<
View
className=
'ShowerAppointment'
>
<
View
className=
'ShowerAppointment'
>
{
showState
==
1
&&
(
{
showState
==
1
&&
(
<
View
className=
'ShowerAppointment-Searchbox'
>
<
View
className=
'ShowerAppointment-Searchbox'
>
<
Input
<
Input
placeholder=
'请输入要
少
选的设备位置'
placeholder=
'请输入要
筛
选的设备位置'
value=
{
search
.
value
}
value=
{
search
.
value
}
onInput=
{
e
=>
search
.
onChange
(
e
)
}
onInput=
{
e
=>
search
.
onChange
(
e
)
}
/>
/>
...
...
src/pages/Shower/components/AppointermentCard/AppointermentCard.tsx
View file @
d6b5dfab
...
@@ -29,10 +29,10 @@ const AppointermentCard = (props: PageOwnProps) => {
...
@@ -29,10 +29,10 @@ const AppointermentCard = (props: PageOwnProps) => {
</
View
>
</
View
>
<
View
className=
'AppointermentCard-Time'
>
<
View
className=
'AppointermentCard-Time'
>
<
Text
>
预约失效时间:
</
Text
>
<
Text
>
预约失效时间:
</
Text
>
<
Text
>
2019-15-24 12:45:31
</
Text
>
<
Text
>
{
data
.
expireTime
?
data
.
expireTime
:
''
}
</
Text
>
{
/* <Text>{data.expireTime ? data.expireTime : ''}</Text> */
}
{
/* <Text>{data.expireTime ? data.expireTime : ''}</Text> */
}
</
View
>
</
View
>
{
data
.
status
===
5
&&
(
{
(
data
.
status
===
5
||
data
.
status
===
8
)
&&
(
<
Image
className=
'AppointermentCard-Dis-Icon'
src=
{
DisabledIcon
}
/>
<
Image
className=
'AppointermentCard-Dis-Icon'
src=
{
DisabledIcon
}
/>
)
}
)
}
</
View
>
</
View
>
...
...
src/pages/Shower/components/AppointermentEquipment/AppointermentEquipment.tsx
View file @
d6b5dfab
...
@@ -5,12 +5,17 @@ import DisabledIcon from '@/images/shower/ic_jinyuyue@2x.png';
...
@@ -5,12 +5,17 @@ import DisabledIcon from '@/images/shower/ic_jinyuyue@2x.png';
type
PageOwnProps
=
{
type
PageOwnProps
=
{
data
:
AppointDeviceResponse
;
data
:
AppointDeviceResponse
;
appointingStart
:
(
deviceCode
:
string
,
operationMode
:
number
)
=>
void
;
appointingStart
:
(
deviceCode
:
string
,
operationMode
:
number
,
location
:
string
,
)
=>
void
;
};
};
const
AppointermentEquipment
=
(
props
:
PageOwnProps
)
=>
{
const
AppointermentEquipment
=
(
props
:
PageOwnProps
)
=>
{
const
{
data
,
appointingStart
}
=
props
;
const
{
data
,
appointingStart
}
=
props
;
const
clickHandle
=
()
=>
{
const
clickHandle
=
()
=>
{
appointingStart
&&
appointingStart
(
data
.
code
,
data
.
operationMode
);
appointingStart
&&
appointingStart
(
data
.
code
,
data
.
operationMode
,
data
.
location
);
};
};
return
(
return
(
<
View
<
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