From 2b0b0d6f72ab780435076face39dc3609e224ce2 Mon Sep 17 00:00:00 2001 From: liugongyu <290219706@qq.com> Date: Mon, 20 Mar 2023 15:47:56 +0800 Subject: [PATCH] 个人发票 手机号必填 --- pages/addTitle/addTitle.vue | 46 ++++++++++++++++++++++++++++++++++++++++++++-- pages/companyMsg/companyMsg.vue | 9 +++++++++ pages/editTitle/editTitle.vue | 27 ++++++++++++++++++++++++--- pages/invoiceTitle/invoiceTitle.vue | 2 +- 4 files changed, 78 insertions(+), 6 deletions(-) diff --git a/pages/addTitle/addTitle.vue b/pages/addTitle/addTitle.vue index af7865c..18b1a78 100644 --- a/pages/addTitle/addTitle.vue +++ b/pages/addTitle/addTitle.vue @@ -23,6 +23,10 @@ + + + + @@ -49,8 +53,8 @@ - - + + @@ -105,6 +109,7 @@ export default { current: 0, baseFormDataPerson: { invoicetitle: '', + telphone: '', email: '', remark: '', }, @@ -130,6 +135,12 @@ export default { }] }, + telphone: { + rules: [{ + required: true, + errorMessage: '手机号不能为空' + },] + }, email: { rules: [{ required: true, @@ -146,6 +157,12 @@ export default { errorMessage: '发票抬头不能为空' }] }, + telphone: { + rules: [{ + required: true, + errorMessage: '手机号不能为空' + },] + }, userId: { rules: [{ required: true, @@ -187,6 +204,18 @@ export default { submit() { console.log() if(this.current==0){ + + if (this.baseFormDataPerson.phone) { + const reg = /^[1][3,4,5,6,7,8,9][0-9]{9}$/; + if (!reg.test(this.baseFormDataPerson.phone)) { + uni.showToast({ + icon: 'none', + title: `手机号输入不正确` + }) + return + } + } + this.$refs['baseFormPerson'].validate().then(res => { console.log('success', res); @@ -197,6 +226,7 @@ export default { remark: this.baseFormDataPerson.remark, isDefault: '1',// 是否默认客户抬头信息,1表示是默认抬头信息,0不是默认抬头信息(默认0) invoiceType: '0', // 发票类型(个人、公司),0 表示个人,1表示公司 + phone: this.baseFormDataPerson.phone, }; uni.request({ url: insertCustInvoiceInfo, @@ -232,6 +262,18 @@ export default { }) } if(this.current==1){ + + if (this.baseFormData.telphone) { + const reg = /^[1][3,4,5,6,7,8,9][0-9]{9}$/; + if (!reg.test(this.baseFormData.telphone)) { + uni.showToast({ + icon: 'none', + title: `手机号输入不正确` + }) + return + } + } + this.$refs['baseForm'].validate().then(res => { console.log('success', res); let insertCustInvoiceInfo = this.$common.insertCustInvoiceInfo; diff --git a/pages/companyMsg/companyMsg.vue b/pages/companyMsg/companyMsg.vue index 2e52c77..243938a 100644 --- a/pages/companyMsg/companyMsg.vue +++ b/pages/companyMsg/companyMsg.vue @@ -58,6 +58,15 @@ {{titleIfo.taxid}} + + + * + 手机号: + + + {{titleIfo.phone}} + + * diff --git a/pages/editTitle/editTitle.vue b/pages/editTitle/editTitle.vue index 8aaaa21..0867b8a 100644 --- a/pages/editTitle/editTitle.vue +++ b/pages/editTitle/editTitle.vue @@ -22,6 +22,10 @@ + + + + @@ -48,7 +52,7 @@ - + @@ -108,6 +112,7 @@ export default { invoicetitle: '', email: '', remark: '', + phone:'' }, baseFormData: { invoicetitle: '', @@ -138,6 +143,15 @@ export default { },] }, + phone: { + rules: [{ + required: true, + errorMessage: '手机号不能为空' + },] + }, + + + }, // 校验规则 rules: { @@ -165,6 +179,12 @@ export default { errorMessage: '邮寄地址不能为空' },] }, + phone: { + rules: [{ + required: true, + errorMessage: '手机号不能为空' + },] + }, }, }; }, @@ -177,6 +197,7 @@ export default { this.baseFormDataPerson.invoicetitle = this.titleIfo.name this.baseFormDataPerson.email = this.titleIfo.email this.baseFormDataPerson.remark = this.titleIfo.remark + this.baseFormDataPerson.phone = this.titleIfo.phone }else{ this.current = 1 @@ -219,8 +240,8 @@ export default { email: this.baseFormDataPerson.email, remark: this.baseFormDataPerson.remark, invoiceType:'0', - isDefault:this.titleIfo.isDefault - + isDefault:this.titleIfo.isDefault, + phone:this.baseFormDataPerson.phone }; uni.request({ url: updateCustInvoiceInfo, diff --git a/pages/invoiceTitle/invoiceTitle.vue b/pages/invoiceTitle/invoiceTitle.vue index 724cfa1..f536fb9 100644 --- a/pages/invoiceTitle/invoiceTitle.vue +++ b/pages/invoiceTitle/invoiceTitle.vue @@ -182,7 +182,7 @@ export default { uni.setStorageSync('useTitleIfo',val) let i = JSON.parse(val) uni.navigateTo({ - url: '../billing/billing?invoiceType='+i.invoiceType+'&email='+i.email+'&name='+i.name+'&remark='+i.remark + url: '../billing/billing?invoiceType='+i.invoiceType+'&email='+i.email+'&name='+i.name+'&remark='+i.remark+'&phone='+i.phone }); } }, -- libgit2 0.21.4