From 2cc8c4a26a697cca139b9e939a07ce4983a6051a Mon Sep 17 00:00:00 2001 From: yyy <2605810609@qq.com> Date: Thu, 13 Mar 2025 15:52:35 +0800 Subject: [PATCH] =?UTF-8?q?=E9=87=8D=E5=A4=8D=E7=94=A8=E6=88=B7=E6=B7=BB?= =?UTF-8?q?=E5=8A=A0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pages/components/pages/customer/add.vue | 55 +++++++++++++++++++------ 1 file changed, 42 insertions(+), 13 deletions(-) diff --git a/pages/components/pages/customer/add.vue b/pages/components/pages/customer/add.vue index 1fb96fb..acc0e27 100644 --- a/pages/components/pages/customer/add.vue +++ b/pages/components/pages/customer/add.vue @@ -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() + } + } + }); + } + }) + } }