重复用户添加

This commit is contained in:
yyy 2025-03-13 15:52:35 +08:00
parent bf8563de9b
commit 2cc8c4a26a

View File

@ -157,7 +157,8 @@
const tagVal = ref('') const tagVal = ref('')
const tagList = ref([]) const tagList = ref([])
const form = ref({ const form = ref({
name: '' name: '',
repeatConfirmationFlag: 0 // 0 1
}) })
const type = ref('add') const type = ref('add')
const errorType = ref('message') const errorType = ref('message')
@ -355,19 +356,47 @@
}) })
}) })
} }
// //
const onSubmit = async () => { const onSubmit = () => {
if (type.value == 'add') { if (type.value == 'add') {
await customerCreate(form.value) customerCreate(form.value).then(res => {
if (prePage().route == 'pages/customer/index') { if (prePage().route == 'pages/customer/index') {
prePage().$vm.isRefresh = true prePage().$vm.isRefresh = true
} }
uni.navigateBack() uni.navigateBack()
} else { }).catch(e => {
await customerUpdate(form.value) if (e.data.code == 200012) {
uni.navigateBack() uni.showModal({
title: '提示',
content: e.data.msg,
success: (res) => {
if (res.confirm) {
form.value.repeatConfirmationFlag = 1
onSubmit()
}
}
});
}
})
} else {
customerUpdate(form.value).then(res => {
uni.navigateBack()
}).catch(e => {
if (e.data.code == 200012) {
uni.showModal({
title: '提示',
content: e.data.msg,
success: (res) => {
if (res.confirm) {
form.value.repeatConfirmationFlag = 1
onSubmit()
}
}
});
}
})
} }
} }
</script> </script>