Commit 41897cdc by 姜雷

添加洗浴切换按钮

parent 18f04098
.Shower { .Shower {
padding-top: 126px; padding-top: 126px;
.showAppoint {
position: absolute;
box-sizing: border-box;
text-align: right;
right: 0;
top: 30px;
width: 60px;
height: 160px;
color: #fff;
background-color: #474747;
padding: 20px 15px 0;
line-height: 30px;
border-radius: 16px 0 0 16px;
}
.equipment-info-box { .equipment-info-box {
width: 630px; width: 630px;
height: 572px; height: 572px;
......
...@@ -14,6 +14,8 @@ import { ...@@ -14,6 +14,8 @@ import {
fetchUsingShowerInfo, fetchUsingShowerInfo,
getShowerController, getShowerController,
OperationMode, OperationMode,
ControllerResponse,
ShowerUseType,
} from '@/api/shower'; } from '@/api/shower';
import { connect, useSelector } from '@tarojs/redux'; import { connect, useSelector } from '@tarojs/redux';
import { Customer } from '@/types/Customer/Customer'; import { Customer } from '@/types/Customer/Customer';
...@@ -43,6 +45,7 @@ type DeviceInfo = { ...@@ -43,6 +45,7 @@ type DeviceInfo = {
type PageStateProps = { type PageStateProps = {
userinfo: Customer; userinfo: Customer;
bluetoothDevice: BluetoothDevice; bluetoothDevice: BluetoothDevice;
showerControlConfig: ControllerResponse;
}; };
type PageDispatchProps = { type PageDispatchProps = {
updateBluetoothDevice: (entity: BluetoothDevice) => void; updateBluetoothDevice: (entity: BluetoothDevice) => void;
...@@ -56,6 +59,7 @@ type PageState = { ...@@ -56,6 +59,7 @@ type PageState = {
sockedDone: boolean; sockedDone: boolean;
deviceDone: boolean; deviceDone: boolean;
showerState: boolean; showerState: boolean;
showAppoint: boolean;
}; };
const StopCode = 1000; const StopCode = 1000;
...@@ -68,9 +72,10 @@ let timer: NodeJS.Timeout | null = null; ...@@ -68,9 +72,10 @@ let timer: NodeJS.Timeout | null = null;
let reConnectting: boolean = false; let reConnectting: boolean = false;
let socketTask: Taro.SocketTask | null = null; let socketTask: Taro.SocketTask | null = null;
@connect( @connect(
({ userinfo, Shower }) => ({ ({ userinfo, Shower, showerState }) => ({
userinfo, userinfo,
bluetoothDevice: Shower, bluetoothDevice: Shower,
showerControlConfig: showerState.controllerConfigs,
}), }),
dispatch => ({ dispatch => ({
updateBluetoothDevice(data: BluetoothDevice) { updateBluetoothDevice(data: BluetoothDevice) {
...@@ -99,15 +104,23 @@ class Shower extends Component { ...@@ -99,15 +104,23 @@ class Shower extends Component {
writeId: '', writeId: '',
readId: '', readId: '',
}, },
showAppoint: false,
}; };
} }
onShareAppMessage = shareHandle; onShareAppMessage = shareHandle;
componentWillMount() { componentWillMount() {
// useType;
this.openBluetooth(); this.openBluetooth();
this.connectDeviceSocket(); this.connectDeviceSocket();
this.checkUsingDevice(); this.checkUsingDevice();
const { showerControlConfig } = this.props;
if (showerControlConfig.useType === ShowerUseType.mix) {
this.setState({
showAppoint: true,
});
}
} }
componentWillUnmount() { componentWillUnmount() {
...@@ -798,12 +811,17 @@ class Shower extends Component { ...@@ -798,12 +811,17 @@ class Shower extends Component {
this.closeBluetoothConnection(); this.closeBluetoothConnection();
}); });
} }
goAppointShower() {
Taro.navigateTo({
url: '/pages/Shower/ShowerAppointment',
});
}
render() { render() {
const { const {
bluetoothDevice: { code, position }, bluetoothDevice: { code, position },
} = this.props; } = this.props;
const { showerState } = this.state; const { showerState, showAppoint } = this.state;
const payOrderState = useSelector( const payOrderState = useSelector(
(state: { orderState: PayOrderState }) => (state: { orderState: PayOrderState }) =>
state.orderState.waitPayOrderState, state.orderState.waitPayOrderState,
...@@ -812,7 +830,11 @@ class Shower extends Component { ...@@ -812,7 +830,11 @@ class Shower extends Component {
return ( return (
<View className='Shower'> <View className='Shower'>
<WaitPayOrderComponent /> <WaitPayOrderComponent />
{showAppoint && (
<View className='showAppoint' onClick={this.goAppointShower}>
预约洗浴
</View>
)}
<View className={payOrderState ? 'blur' : ''}> <View className={payOrderState ? 'blur' : ''}>
<View className='equipment-info-box'> <View className='equipment-info-box'>
<View className='equipment-info'> <View className='equipment-info'>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment