重复用户添加

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 tagList = ref([])
const form = ref({
name: ''
name: '',
repeatConfirmationFlag: 0 // 0 1
})
const type = ref('add')
const errorType = ref('message')
@ -355,19 +356,47 @@
})
})
}
//
const onSubmit = async () => {
if (type.value == 'add') {
await customerCreate(form.value)
if (prePage().route == 'pages/customer/index') {
prePage().$vm.isRefresh = true
}
uni.navigateBack()
} else {
await customerUpdate(form.value)
uni.navigateBack()
}
//
const onSubmit = () => {
if (type.value == 'add') {
customerCreate(form.value).then(res => {
if (prePage().route == 'pages/customer/index') {
prePage().$vm.isRefresh = true
}
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()
}
}
});
}
})
} 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>