diff --git a/src/pages/work/accounts/accountDealRecord/addEdit.vue b/src/pages/work/accounts/accountDealRecord/addEdit.vue index 1715861..938b107 100644 --- a/src/pages/work/accounts/accountDealRecord/addEdit.vue +++ b/src/pages/work/accounts/accountDealRecord/addEdit.vue @@ -9,58 +9,58 @@ {{ title}} - + inputAlign="left" :customStyle="getInputStyle('typeName')"> + inputAlign="left" :customStyle="getInputStyle('tempDebitTypeName')"> + inputAlign="left" :customStyle="getInputStyle('accountName')"> + inputAlign="left" :customStyle="getInputStyle('dealTypeName')"> + inputAlign="left" :customStyle="getInputStyle('createTime')"> + inputAlign="left" :customStyle="getInputStyle('amount')"> + inputAlign="left" :customStyle="getInputStyle('dealCategoryName')"> + inputAlign="left" :customStyle="getInputStyle('childCategoryName')"> @@ -68,7 +68,7 @@ + inputAlign="left" :customStyle="getInputStyle('locationAddress')"> {{ form.locationName }} 经纬度:{{ form.longitude }},{{ form.latitude }} @@ -154,6 +154,19 @@ const inputBaseStyle = { width: '100%', boxSizing: 'border-box' } +const errorFields = ref([]) +const inputErrorStyle = { + background: '#fef0f0', + border: '2rpx solid #f56c6c', + borderRadius: '8rpx', + padding: '0 24rpx', + height: '68rpx', + width: '100%', + boxSizing: 'border-box' +} +const getInputStyle = (field) => { + return errorFields.value.includes(field) ? inputErrorStyle : inputBaseStyle +} const data = reactive({ form: { id: null, @@ -673,7 +686,8 @@ onLoad((option) => { form.value.childCategory = form.value.dealCategory form.value.childCategoryName = form.value.dealCategory } - proxy.$refs['uForm'].validate().then(() => { + errorFields.value = [] + proxy.$refs['uForm'].validate().then(() => { if (form.value.id != null) { if(flag.value==null){ updateAccountDealRecord(form.value).then(res => { @@ -702,6 +716,11 @@ onLoad((option) => { }) }) } + }).catch(errors => { + if (errors && errors.length > 0) { + errorFields.value = errors.map(err => err.field) + } + proxy.$modal.msgError('请填写完整信息') }) } diff --git a/src/pages/work/accounts/creditTransferRecord/addEdit.vue b/src/pages/work/accounts/creditTransferRecord/addEdit.vue index a09d508..d3e72d6 100644 --- a/src/pages/work/accounts/creditTransferRecord/addEdit.vue +++ b/src/pages/work/accounts/creditTransferRecord/addEdit.vue @@ -11,36 +11,36 @@ {{ title}} - + inputAlign="left" :customStyle="getInputStyle('outAccountName')"> + inputAlign="left" :customStyle="getInputStyle('inAccountName')"> - + + inputAlign="left" :customStyle="getInputStyle('amount')"> + inputAlign="left" :customStyle="getInputStyle('dealTypeName')"> @@ -131,6 +131,19 @@ const inputBaseStyle = { width: '100%', boxSizing: 'border-box' } +const errorFields = ref([]) +const inputErrorStyle = { + background: '#fef0f0', + border: '2rpx solid #f56c6c', + borderRadius: '8rpx', + padding: '0 24rpx', + height: '68rpx', + width: '100%', + boxSizing: 'border-box' +} +const getInputStyle = (field) => { + return errorFields.value.includes(field) ? inputErrorStyle : inputBaseStyle +} const data = reactive({ form: { @@ -299,7 +312,8 @@ function handleCreditCard() { datePickShow.value = false } function submit() { - proxy.$refs['uForm'].validate().then(() => { + errorFields.value = [] + proxy.$refs['uForm'].validate().then(() => { if (form.value.id != null) { updateAccountsTransferRecord(form.value).then(res => { proxy.$refs['uToast'].show({ @@ -317,6 +331,11 @@ function handleCreditCard() { }) }) } + }).catch(errors => { + if (errors && errors.length > 0) { + errorFields.value = errors.map(err => err.field) + } + proxy.$modal.msgError('请填写完整信息') }) } diff --git a/src/pages/work/accounts/debitTransferRecord/addEdit.vue b/src/pages/work/accounts/debitTransferRecord/addEdit.vue index c934343..9d51c0a 100644 --- a/src/pages/work/accounts/debitTransferRecord/addEdit.vue +++ b/src/pages/work/accounts/debitTransferRecord/addEdit.vue @@ -9,31 +9,31 @@ {{ title }} - + inputAlign="left" :customStyle="getInputStyle('outAccountName')"> + inputAlign="left" :customStyle="getInputStyle('inAccountName')"> - + + inputAlign="left" :customStyle="getInputStyle('amount')"> { + return errorFields.value.includes(field) ? inputErrorStyle : inputBaseStyle +} const data = reactive({ form: { @@ -233,7 +246,8 @@ function handleInAccount() { datePickShow.value = false } function submit() { - proxy.$refs['uForm'].validate().then(() => { + errorFields.value = [] + proxy.$refs['uForm'].validate().then(() => { if (form.value.id != null) { updateAccountsTransferRecord(form.value).then(res => { proxy.$refs['uToast'].show({ @@ -251,6 +265,11 @@ function handleInAccount() { }) }) } + }).catch(errors => { + if (errors && errors.length > 0) { + errorFields.value = errors.map(err => err.field) + } + proxy.$modal.msgError('请填写完整信息') }) } diff --git a/src/pages/work/accounts/investAccountDeal/addEdit.vue b/src/pages/work/accounts/investAccountDeal/addEdit.vue index ba031b0..81d3bef 100644 --- a/src/pages/work/accounts/investAccountDeal/addEdit.vue +++ b/src/pages/work/accounts/investAccountDeal/addEdit.vue @@ -9,39 +9,39 @@ {{ title}} - + inputAlign="left" :customStyle="getInputStyle('accountName')"> - + + inputAlign="left" :customStyle="getInputStyle('amount')"> + inputAlign="left" :customStyle="getInputStyle('closedPosition')"> + inputAlign="left" :customStyle="getInputStyle('commission')"> { + return errorFields.value.includes(field) ? inputErrorStyle : inputBaseStyle +} const data = reactive({ form: { @@ -293,7 +306,8 @@ onLoad((option) => { datePickShow.value = false } function submit() { - proxy.$refs['uForm'].validate().then(() => { + errorFields.value = [] + proxy.$refs['uForm'].validate().then(() => { //如果是期货,给备注 if (accountType.value == '1') { form.value.remark = '平仓盈亏' + form.value.closedPosition + ',手续费' + form.value.commission @@ -323,6 +337,11 @@ onLoad((option) => { }) }) } + }).catch(errors => { + if (errors && errors.length > 0) { + errorFields.value = errors.map(err => err.field) + } + proxy.$modal.msgError('请填写完整信息') }) } diff --git a/src/pages/work/accounts/investTransferRecord/addEdit.vue b/src/pages/work/accounts/investTransferRecord/addEdit.vue index 8c77253..0549d1f 100644 --- a/src/pages/work/accounts/investTransferRecord/addEdit.vue +++ b/src/pages/work/accounts/investTransferRecord/addEdit.vue @@ -11,31 +11,31 @@ {{ title}} - + inputAlign="left" :customStyle="getInputStyle('inAccountName')"> + inputAlign="left" :customStyle="getInputStyle('dealTypeName')"> - + + inputAlign="left" :customStyle="getInputStyle('amount')"> @@ -93,6 +93,19 @@ const inputBaseStyle = { width: '100%', boxSizing: 'border-box' } +const errorFields = ref([]) +const inputErrorStyle = { + background: '#fef0f0', + border: '2rpx solid #f56c6c', + borderRadius: '8rpx', + padding: '0 24rpx', + height: '68rpx', + width: '100%', + boxSizing: 'border-box' +} +const getInputStyle = (field) => { + return errorFields.value.includes(field) ? inputErrorStyle : inputBaseStyle +} const data = reactive({ form: { @@ -237,7 +250,8 @@ onLoad((option) => { datePickShow.value = false } function submit() { - proxy.$refs['uForm'].validate().then(() => { + errorFields.value = [] + proxy.$refs['uForm'].validate().then(() => { if (form.value.id != null) { if(flag.value==null){ updateAccountsTransferRecord(form.value).then(res => { @@ -266,6 +280,11 @@ onLoad((option) => { }) }) } + }).catch(errors => { + if (errors && errors.length > 0) { + errorFields.value = errors.map(err => err.field) + } + proxy.$modal.msgError('请填写完整信息') }) } diff --git a/src/pages/work/accounts/lendTransferRecord/addEdit.vue b/src/pages/work/accounts/lendTransferRecord/addEdit.vue index 4896186..1351720 100644 --- a/src/pages/work/accounts/lendTransferRecord/addEdit.vue +++ b/src/pages/work/accounts/lendTransferRecord/addEdit.vue @@ -9,42 +9,42 @@ {{ title}} - + inputAlign="left" :customStyle="getInputStyle('outAccountName')"> + inputAlign="left" :customStyle="getInputStyle('inAccountName')"> + inputAlign="left" :customStyle="getInputStyle('dealTypeName')"> - + + inputAlign="left" :customStyle="getInputStyle('amount')"> + inputAlign="left" :customStyle="getInputStyle('commission')"> { + return errorFields.value.includes(field) ? inputErrorStyle : inputBaseStyle +} const data = reactive({ form: { @@ -309,7 +322,8 @@ function handleInAccount() { datePickShow.value = false } function submit() { - proxy.$refs['uForm'].validate().then(() => { + errorFields.value = [] + proxy.$refs['uForm'].validate().then(() => { if (form.value.id != null) { updateAccountsTransferRecord(form.value).then(res => { proxy.$refs['uToast'].show({ @@ -327,6 +341,11 @@ function handleInAccount() { }) }) } + }).catch(errors => { + if (errors && errors.length > 0) { + errorFields.value = errors.map(err => err.field) + } + proxy.$modal.msgError('请填写完整信息') }) } diff --git a/src/pages/work/accounts/posTransferRecord/addEdit.vue b/src/pages/work/accounts/posTransferRecord/addEdit.vue index 6c81829..3f9c928 100644 --- a/src/pages/work/accounts/posTransferRecord/addEdit.vue +++ b/src/pages/work/accounts/posTransferRecord/addEdit.vue @@ -11,18 +11,18 @@ {{ title}} - + inputAlign="left" :customStyle="getInputStyle('posName')"> + inputAlign="left" :customStyle="getInputStyle('rate')">