Commit f0855a6f by 胡悦

提交

1 parent 1f07588e
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
* @Author: huyue * @Author: huyue
* @Date: 2024-04-07 14:54:28 * @Date: 2024-04-07 14:54:28
* @LastEditors: huyue * @LastEditors: huyue
* @LastEditTime: 2024-04-09 19:22:47 * @LastEditTime: 2024-04-09 20:18:12
--> -->
<template> <template>
<view class="information-entry"> <view class="information-entry">
...@@ -53,20 +53,22 @@ ...@@ -53,20 +53,22 @@
:popupH="820" :popupH="820"
> >
<view name="content"> <view name="content">
<view class="pop-tips" <view class="error-tip" v-if="errorTip">以下信息不能为空,请完善信息后保存</view>
<view class="pop-tips" v-else
>检测到“交车通知书”中未填写客户档案,请填写后再完成接待。</view >检测到“交车通知书”中未填写客户档案,请填写后再完成接待。</view
> >
<view class="form"> <view class="form" :key="f_key">
<template v-for="(i, index) in formObject"> <template v-for="(i, index) in formObject">
<view class="form-item" :key="index"> <view class="form-item" :key="index">
<view class="label">{{ i.label }}</view> <view class="label">{{ i.label }}</view>
<view :class="['value', {error:i.error}]"> <view :class="['value', {error: i.error}]">
<template v-if="i.type == 'input'"> <template v-if="i.type == 'input'">
<input <input
:type="i.inputType" :type="i.inputType"
:maxlength="i.maxlength" :maxlength="i.maxlength"
v-model="formData[i.key]" v-model="formData[i.key]"
class="input" class="input"
@blur="blur(i.key)"
/> />
</template> </template>
<template v-else> <template v-else>
...@@ -198,6 +200,8 @@ export default { ...@@ -198,6 +200,8 @@ export default {
employeeBoxVisible: false, employeeBoxVisible: false,
carlist: [], carlist: [],
employeeList: [], employeeList: [],
f_key: Date.now(),
errorTip: false
}; };
}, },
onLoad(options) { onLoad(options) {
...@@ -206,6 +210,8 @@ export default { ...@@ -206,6 +210,8 @@ export default {
title: text, title: text,
}); });
this.$store.dispatch("getCustomerInfo").then((customerInfo) => { this.$store.dispatch("getCustomerInfo").then((customerInfo) => {
console.log(customerInfo,' =======')
this.formData = customerInfo
this.isPass = Object.values(customerInfo).every((value) => !!value); this.isPass = Object.values(customerInfo).every((value) => !!value);
}); });
...@@ -268,12 +274,17 @@ export default { ...@@ -268,12 +274,17 @@ export default {
// this.messageBoxVisible = false; // this.messageBoxVisible = false;
try { try {
for(let i in this.formData) { for(let i in this.formData) {
if (!this.formData[i]) throw i if (!this.formData[i] && i != 'salesUuid') throw i
} }
} catch (error) { } catch (error) {
this.formData[i].error = true console.log(error)
this.formObject.find(item => item.key == error).error = true
console.log(this.formObject)
this.f_key = Date.now()
this.errorTip = true
// this.formObject[error].error = true
} }
this.stopAudio(); // this.stopAudio();
}, },
// 选择车型与销售 // 选择车型与销售
showPop(key) { showPop(key) {
...@@ -298,10 +309,19 @@ export default { ...@@ -298,10 +309,19 @@ export default {
} else this.formData.carModel = item.name; } else this.formData.carModel = item.name;
this.$store.dispatch("setCustomerInfo", this.formData); this.$store.dispatch("setCustomerInfo", this.formData);
console.log(this.formData) console.log(this.formData)
this.formObject.map(item => item.error = false)
this.f_key = Date.now()
this.errorTip = false
}, },
showPopup(e) { showPopup(e) {
this[e] = true; this[e] = true;
}, },
blur(popkey) {
console.log(popkey)
this.formObject.find(item => item.key == popkey).error = false
this.f_key = Date.now()
this.errorTip = false
}
}, },
}; };
</script> </script>
...@@ -401,6 +421,14 @@ export default { ...@@ -401,6 +421,14 @@ export default {
margin-top: 30rpx; margin-top: 30rpx;
text-align: center; text-align: center;
} }
.error-tip {
font-size: 28rpx;
padding: 32rpx 60rpx 24rpx;
margin-top: 30rpx;
text-align: center;
background-color: rgb(254, 237, 234);
color: #f45c3d;
}
.form { .form {
display: flex; display: flex;
flex-wrap: wrap; flex-wrap: wrap;
...@@ -435,6 +463,9 @@ export default { ...@@ -435,6 +463,9 @@ export default {
margin-left: 32rpx; margin-left: 32rpx;
box-sizing: border-box; box-sizing: border-box;
padding: 0 40rpx; padding: 0 40rpx;
&.error {
border: 2rpx solid #F24724;
}
.input, .input,
.select { .select {
width: 100%; width: 100%;
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!