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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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