feat: 优化

This commit is contained in:
苟川东 2025-04-24 09:34:48 +08:00
parent 3ac24a2e28
commit e5fa269e08
11 changed files with 25 additions and 17 deletions

View File

@ -79,7 +79,7 @@ const acceptOrder = (index, id) => {
}); });
api.orderConfirm({type: 'accept', order_dispatch_id: id}).then(res => { api.orderConfirm({type: 'accept', order_dispatch_id: id}).then(res => {
uni.hideLoading(); helpers.delayHideLoading()
helpers.showToast('已接单') helpers.showToast('已接单')
data.list.splice(index, 1) data.list.splice(index, 1)
}).catch(() => {}) }).catch(() => {})
@ -104,7 +104,7 @@ const rejectOrder = (index, id) => {
title: '拒接中' title: '拒接中'
}); });
api.orderConfirm({type: 'reject', order_dispatch_id: id, reject_reason: res.content}).then(() => { api.orderConfirm({type: 'reject', order_dispatch_id: id, reject_reason: res.content}).then(() => {
uni.hideLoading(); helpers.delayHideLoading()
helpers.showToast('已拒接') helpers.showToast('已拒接')
data.list.splice(index, 1) data.list.splice(index, 1)
}).catch(() => {}) }).catch(() => {})
@ -149,7 +149,7 @@ const getList = () => {
data.list = data.list.concat(helpers.deepObj(res.data)) data.list = data.list.concat(helpers.deepObj(res.data))
} }
data.is_show_skeleton = false data.is_show_skeleton = false
uni.hideLoading(); helpers.delayHideLoading()
}).catch(() => {}).finally(() => { }).catch(() => {}).finally(() => {
setTimeout(() => { setTimeout(() => {
refreshComplete() refreshComplete()

View File

@ -89,7 +89,7 @@ const upload = () => {
console.log(e) console.log(e)
}, },
complete() { complete() {
uni.hideLoading(); helpers.delayHideLoading()
} }
}); });
}).catch(() => {}) }).catch(() => {})
@ -120,7 +120,7 @@ const submit = throttle(() => {
let imagesStr = (images.value).join(',') let imagesStr = (images.value).join(',')
api.arrivedOnSite({order_dispatch_id: id.value, images: imagesStr}).then(() => { api.arrivedOnSite({order_dispatch_id: id.value, images: imagesStr}).then(() => {
uni.hideLoading(); helpers.delayHideLoading()
uni.showToast({ uni.showToast({
title: '已上门', title: '已上门',
icon: "success" icon: "success"

View File

@ -138,7 +138,7 @@ const upload = (type) => {
console.log(e) console.log(e)
}, },
complete() { complete() {
uni.hideLoading(); helpers.delayHideLoading()
} }
}); });
}).catch(() => {}) }).catch(() => {})
@ -179,7 +179,7 @@ const submit = throttle(() => {
data.order_dispatch_id = id.value data.order_dispatch_id = id.value
api.completeService(data).then(() => { api.completeService(data).then(() => {
uni.hideLoading(); helpers.delayHideLoading()
uni.showToast({ uni.showToast({
title: '已完成服务', title: '已完成服务',
icon: "success" icon: "success"

View File

@ -272,7 +272,7 @@ const init = () => {
}); });
api.orderInfo({order_dispatch_id: id.value}).then(res => { api.orderInfo({order_dispatch_id: id.value}).then(res => {
data.value = res data.value = res
uni.hideLoading(); helpers.delayHideLoading()
}).catch(() => {}) }).catch(() => {})
} }

View File

@ -68,7 +68,7 @@ const submit = throttle(() => {
submitData.order_id = orderId.value submitData.order_id = orderId.value
api.createOrderAbnormal(submitData).then(() => { api.createOrderAbnormal(submitData).then(() => {
uni.hideLoading(); helpers.delayHideLoading()
uni.showToast({ uni.showToast({
title: '完成上报', title: '完成上报',
icon: "success" icon: "success"
@ -101,7 +101,7 @@ const init = () => {
}) })
} }
uni.hideLoading() helpers.delayHideLoading()
}).catch(() => {}) }).catch(() => {})
api.findExceptionTypeList().then(res => { api.findExceptionTypeList().then(res => {

View File

@ -47,7 +47,7 @@ const submit = throttle(() => {
title: '提交中' title: '提交中'
}); });
api.appointmentTime({order_dispatch_id: id.value, plan_time: data.value.plan_time}).then(() => { api.appointmentTime({order_dispatch_id: id.value, plan_time: data.value.plan_time}).then(() => {
uni.hideLoading(); helpers.delayHideLoading()
uni.showToast({ uni.showToast({
title: '预约成功', title: '预约成功',
icon: "success" icon: "success"

View File

@ -23,6 +23,7 @@ import {ref, reactive} from 'vue'
import {onLoad} from '@dcloudio/uni-app' import {onLoad} from '@dcloudio/uni-app'
import api from "../../api/api"; import api from "../../api/api";
import {throttle} from "../../utils/throttle"; import {throttle} from "../../utils/throttle";
import helpers from "../../utils/helpers";
// //
const submit = throttle(() => { const submit = throttle(() => {
@ -32,7 +33,7 @@ const submit = throttle(() => {
submitData.order_dispatch_id = orderDispatchId.value submitData.order_dispatch_id = orderDispatchId.value
api.saveWorkerRemark(submitData).then(() => { api.saveWorkerRemark(submitData).then(() => {
uni.hideLoading(); helpers.delayHideLoading()
uni.showToast({ uni.showToast({
title: '已保存', title: '已保存',
icon: "success" icon: "success"

View File

@ -80,7 +80,7 @@ const bindPhoneNumber = throttle((e) => {
helpers.jumpToPage('index','', 'switchTab') helpers.jumpToPage('index','', 'switchTab')
}, 1000) }, 1000)
}).catch(() => {}).finally(() => { }).catch(() => {}).finally(() => {
uni.hideLoading(); helpers.delayHideLoading()
}) })
}) })
@ -104,7 +104,7 @@ const login = throttle(() => {
}); });
if (!res.code) { if (!res.code) {
uni.hideLoading(); helpers.delayHideLoading()
return helpers.showToast('登录失败:' + res.errMsg) return helpers.showToast('登录失败:' + res.errMsg)
} }
@ -119,7 +119,7 @@ const login = throttle(() => {
vendorToken.value = err.data.vendor_token vendorToken.value = err.data.vendor_token
isLogin.value = true isLogin.value = true
}).finally(() => { }).finally(() => {
uni.hideLoading(); helpers.delayHideLoading()
}) })
} }
}); });

View File

@ -69,7 +69,7 @@ const logout = () => {
helpers.jumpToPage('login', '', 'reLaunch') helpers.jumpToPage('login', '', 'reLaunch')
}).catch(() => {}).finally(() => { }).catch(() => {}).finally(() => {
uni.hideLoading(); helpers.delayHideLoading()
}) })
} }
</script> </script>

View File

@ -191,7 +191,7 @@ const getList = () => {
data.list = data.list.concat(helpers.deepObj(res.data)) data.list = data.list.concat(helpers.deepObj(res.data))
} }
data.is_show_skeleton = false data.is_show_skeleton = false
uni.hideLoading(); helpers.delayHideLoading()
}).catch(() => {}) }).catch(() => {})
} }

View File

@ -165,5 +165,12 @@ class helpers {
} }
}); });
} }
static delayHideLoading (timeout = 200) {
setTimeout(() => {
uni.hideLoading()
}, timeout)
}
} }
export default helpers export default helpers