|
|
@@ -6,7 +6,7 @@
|
|
|
</view>
|
|
|
<view class="device-header_fun">
|
|
|
<view class="device-header_func-tag" v-for="f in state.device.functionList" :key="f" style="margin-right: 10px;">
|
|
|
- <uv-tags :text="f" size="mini" plain plainFill bgColor="#19A497" color="white"> </uv-tags>
|
|
|
+ <uv-tags :text="f" size="mini" plain plainFill bgColor="#19A497" color="white"></uv-tags>
|
|
|
</view>
|
|
|
</view>
|
|
|
<view class="device-header_fun">
|
|
|
@@ -21,19 +21,19 @@
|
|
|
</view>
|
|
|
|
|
|
<view class=device-body_guide>
|
|
|
- <view>●点击上方【启动】按钮启动设备;
|
|
|
+ <view>●点击上方【启动设备】按钮启动设备;
|
|
|
</view>
|
|
|
<view>●设备启动后,请在设备功能面板按下功能按键以选择服务项目;
|
|
|
</view>
|
|
|
- <view>●洗车过程中再次按下功能按键可以暂停次功能,暂停过程中将停止计费,如需恢复请再次按下功能按键;
|
|
|
+ <view>●洗车过程中再次按下功能按键可以暂停功能,暂停过程中将停止计费,如需恢复请再次按下功能按键;
|
|
|
</view>
|
|
|
- <view>●洗车结束后,请按下结算按键或小程序【结束】按钮,设备停止运行之后将结束计费;
|
|
|
+ <view>●洗车结束后,请按下结算按键或小程序【停止设备】按钮,设备停止运行之后将结束计费;
|
|
|
</view>
|
|
|
<view>●请在洗车完成后尽快将车辆驶离工位以方便后续用户,谢谢配合。
|
|
|
</view>
|
|
|
|
|
|
</view>
|
|
|
-<!-- <view class="device-body_ops-time">{{ state.time }}</view>-->
|
|
|
+ <!-- <view class="device-body_ops-time">{{ state.time }}</view>-->
|
|
|
</view>
|
|
|
</view>
|
|
|
</template>
|
|
|
@@ -46,9 +46,9 @@ import {get, post} from "@/utils/https";
|
|
|
|
|
|
const initState = () => ({
|
|
|
device: {
|
|
|
- functions:[],
|
|
|
- deviceName:'',
|
|
|
- state:''
|
|
|
+ functions: [],
|
|
|
+ deviceName: '',
|
|
|
+ state: ''
|
|
|
},
|
|
|
time: "00:00:00",
|
|
|
start: new Date()
|
|
|
@@ -60,17 +60,17 @@ onHide(() => {
|
|
|
Object.assign(state, initState());
|
|
|
})
|
|
|
|
|
|
-onLoad((options:any) => {
|
|
|
+onLoad((options: any) => {
|
|
|
console.log("device onLoad>>>>", options)
|
|
|
let id = options?.shortId;
|
|
|
if (!id) {
|
|
|
let query = decodeURIComponent(options.q);
|
|
|
let scanTime = options.scancode_time;
|
|
|
- console.log(query,scanTime)
|
|
|
- if(query){
|
|
|
- id = query.split("#")[1]
|
|
|
- }else{
|
|
|
- return;
|
|
|
+ console.log(query, scanTime)
|
|
|
+ if (query) {
|
|
|
+ id = query.split("#")[1]
|
|
|
+ } else {
|
|
|
+ return;
|
|
|
}
|
|
|
}
|
|
|
state.device = getApp<any>().globalData.last.device;
|
|
|
@@ -80,18 +80,18 @@ onLoad((options:any) => {
|
|
|
|
|
|
const loadDeviceDetail = (id: number) => {
|
|
|
get(`/wash-device/queryDevice/${id}`).then((res: any) => {
|
|
|
- if(res.currentUserId && res.currentUserId!=getApp<any>().globalData.user.id){
|
|
|
+ if (res.currentUserId && res.currentUserId != getApp<any>().globalData.user.id) {
|
|
|
uni.showToast({
|
|
|
- title:'设备已被占用',
|
|
|
- icon:'error'
|
|
|
+ title: '设备已被占用',
|
|
|
+ icon: 'error'
|
|
|
})
|
|
|
- setTimeout(()=>{
|
|
|
+ setTimeout(() => {
|
|
|
uni.redirectTo({
|
|
|
- url:'/pages/index/index'
|
|
|
+ url: '/pages/index/index'
|
|
|
})
|
|
|
- },2000)
|
|
|
+ }, 2000)
|
|
|
}
|
|
|
- res.functionList = res.funcs.split("|")||[]
|
|
|
+ res.functionList = res.funcs?.split("|") || []
|
|
|
state.device = res;
|
|
|
}).catch(e => {
|
|
|
console.error(e)
|
|
|
@@ -103,31 +103,40 @@ const handleNavigateBack = () => {
|
|
|
uni.navigateBack();
|
|
|
}
|
|
|
|
|
|
-const debounceStartStopDevice = debounce(()=>{
|
|
|
+const debounceStartStopDevice = debounce(() => {
|
|
|
handleClickDevice();
|
|
|
-},600)
|
|
|
+}, 600)
|
|
|
|
|
|
const handleClickDevice = () => {
|
|
|
- if(state.device?.state==='idle'){
|
|
|
- uni.showLoading({
|
|
|
- title: "启动中",
|
|
|
- mask: true,
|
|
|
- });
|
|
|
- post(`/wash-device/startDevice/${state.device.shortId}`).then((res:any)=>{
|
|
|
- uni.hideLoading();
|
|
|
- uni.showToast({
|
|
|
- title:'设备启动成功'
|
|
|
- })
|
|
|
- })
|
|
|
- }else{
|
|
|
- uni.showLoading({
|
|
|
- title: "停止中",
|
|
|
- mask: true,
|
|
|
- });
|
|
|
- post(`/wash-device/stopDevice/${state.device.shortId}`).then((res:any)=>{
|
|
|
- uni.hideLoading()
|
|
|
- })
|
|
|
+ uni.showModal({
|
|
|
+ title: '提示',
|
|
|
+ content: state.device?.state === 'idle' ? '确定启动设备开始洗车吗?' : '确定停止设备终止本次服务吗?',
|
|
|
+ success: (res) => {
|
|
|
+ if (res.confirm) {
|
|
|
+ if (state.device?.state === 'idle') {
|
|
|
+ uni.showLoading({
|
|
|
+ title: "启动中",
|
|
|
+ mask: true,
|
|
|
+ });
|
|
|
+ post(`/wash-device/startDevice/${state.device.shortId}`).then((res: any) => {
|
|
|
+ uni.hideLoading();
|
|
|
+ uni.showToast({
|
|
|
+ title: '设备启动成功'
|
|
|
+ })
|
|
|
+ })
|
|
|
+ } else {
|
|
|
+ uni.showLoading({
|
|
|
+ title: "停止中",
|
|
|
+ mask: true,
|
|
|
+ });
|
|
|
+ post(`/wash-device/stopDevice/${state.device.shortId}`).then((res: any) => {
|
|
|
+ uni.hideLoading()
|
|
|
+ })
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|
|
|
+ });
|
|
|
+
|
|
|
}
|
|
|
|
|
|
const countTime = () => {
|
|
|
@@ -173,7 +182,7 @@ const countTime = () => {
|
|
|
margin: 10rpx 0;
|
|
|
display: inline-flex;
|
|
|
|
|
|
- &-tag{
|
|
|
+ &-tag {
|
|
|
margin-right: 10px;
|
|
|
}
|
|
|
}
|
|
|
@@ -203,7 +212,7 @@ const countTime = () => {
|
|
|
font-weight: 500;
|
|
|
}
|
|
|
|
|
|
- &_guide{
|
|
|
+ &_guide {
|
|
|
width: 80%;
|
|
|
margin-top: 40px;
|
|
|
font-size: 14px;
|