Commit b6e72412 by 姜雷

Merge branch 'develop' into test

parents 552ce249 18f04098
{
"name": "wx-school-app",
"version": "1.0.9",
"version": "1.0.10",
"private": true,
"description": "",
"scripts": {
......
......@@ -123,7 +123,7 @@ export type AppointDeviceResponse = {
// allowEmptyValue: false
// 设备位置
operationMode: number;
operationMode: OperationMode;
// allowEmptyValue: false
// 设备计费模式
};
......
......@@ -193,7 +193,7 @@ class Home extends Component {
}
goShower = () => {
const { userinfo } = this.props;
const { userinfo, updateShowerControlConfig } = this.props;
getShowerController({
campusId: userinfo.areaId,
customerId: userinfo.customerId,
......
......@@ -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,17 +46,12 @@ function ShowerAppointment() {
const searchEquipment = () => {
setSearchString(search.value);
};
const appointingStart = (deviceCode: string) => {
// Taro.showModal({
// title: '',
// content: '',
// }).then(res => {
// if(res.confirm){
// }
// })
appointingEquipment({
const appointingEquipmentHandle = (deviceCode: string) => {
Taro.showLoading({
title: '',
mask: true,
});
return appointingEquipment({
account: userInfo.customerId.toString(),
phone: userInfo.customerPhone,
userId: userInfo.customerId,
......@@ -68,9 +65,42 @@ function ShowerAppointment() {
});
})
.catch(err => {
Taro.hideLoading();
console.log(err);
});
};
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;
if (money < thresholdValue) {
let i = 0;
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) {
appointingEquipmentHandle(deviceCode);
}
});
} else {
appointingEquipmentHandle(deviceCode);
}
};
const goBluetoothShower = () => {
Taro.navigateTo({
url: '/pages/Shower/Shower',
......@@ -93,9 +123,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 +148,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'
......
......@@ -56,5 +56,11 @@
color: #6180f4;
background-color: #fafafe;
border-radius: 0 0 16px 16px;
text:last-child{
display: inline-block;
margin-left: 20px;
width: 300px;
text-align: left;
}
}
}
......@@ -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
......
......@@ -31,7 +31,10 @@ const useAppointRecordsList = (
};
const fetchMoreList = () => {
Taro.showLoading();
Taro.showLoading({
title: '',
mask: true,
});
fetchList(pageNum + 1)
.then(res => {
Taro.hideLoading();
......
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