| | |
| | | <view class="item-info"> |
| | | <view class="info-name"> |
| | | <view class="name">{{item.facilityName}}</view> |
| | | <view class="btn" @click="handleQushui(item.id)">取水</view> |
| | | <view class="btn" v-if="item.state === 2" @click="handleQushui(item.id)">取水</view> |
| | | <view v-else>设备使用中...</view> |
| | | </view> |
| | | <view class="info-addr" @click="openMap(item.lat,item.lon)"> |
| | | <text class="addr-text">地址:{{item.address}}</text> |
| | |
| | | </view> |
| | | <uni-popup ref="qushuiDialog" type="dialog"> |
| | | <uni-popup-dialog type="info" cancelText="取消" confirmText="确认" title="请输入取水量" |
| | | before-close="true" |
| | | :before-close="true" |
| | | @confirm="dialogConfirm" |
| | | @close="dialogClose" |
| | | > |
| | | <view> |
| | | <input v-model="qushuiNum" type="number" placeholder="请输入取水量(L)" /> |
| | | <input v-model="qushuiNum" placeholder="请输入取水量(m³)" /> |
| | | </view> |
| | | </uni-popup-dialog> |
| | | </uni-popup> |
| | |
| | | const facilityId = ref() |
| | | const qushuiNum = ref() |
| | | |
| | | let timer = null |
| | | |
| | | const getFacitilyList = () => { |
| | | const data = { |
| | | longitude: userLocation.value?.lon, |
| | |
| | | facitilyList.value = res.data.list |
| | | } |
| | | }) |
| | | |
| | | // 重新挂在定时器 |
| | | clearInterval(timer) |
| | | timer = setInterval(() => { |
| | | getFacitilyList() |
| | | }, 10000) |
| | | } |
| | | |
| | | // 取水 |
| | |
| | | |
| | | // 确认 |
| | | const dialogConfirm = () => { |
| | | if(!qushuiNum.value) { |
| | | let reg = /^(0|([1-9][0-9]*))(\.[\d]+)?$/ |
| | | if(!reg.test(qushuiNum.value)) { |
| | | uni.showToast({ |
| | | title:'请输入取水量', |
| | | title:'取水量为大于零的数字', |
| | | icon:'none' |
| | | }) |
| | | return |
| | |
| | | icon:'success' |
| | | }) |
| | | dialogClose() |
| | | getFacitilyList() |
| | | }else{ |
| | | uni.showToast({ |
| | | title:res.msg, |