InsuredInfoForm.vue 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310
  1. <template>
  2. <view class="">
  3. <u--form labelPosition="left" :model="insuredPersonInfo" :rules="insuredRules" ref="insuredForm" labelWidth="80"
  4. errorType="message">
  5. <u-form-item label="姓名" prop="name" borderBottom>
  6. <u-input v-model="insuredPersonInfo.name" border="none" clearable placeholder="请输入姓名"
  7. placeholderStyle="text-align:right;"></u-input>
  8. </u-form-item>
  9. <u-form-item label="车主类型" borderBottom @click="propertyShow=true">
  10. <u-input v-model="insuredPersonInfos.property" border="none" clearable placeholder=""
  11. placeholderStyle="text-align:right;" suffixIcon='arrow-down'
  12. suffixIconStyle="color:#333;font-size:30rpx" style="pointer-events: none"></u-input>
  13. </u-form-item>
  14. <u-form-item label="证件类型" borderBottom>
  15. <u-input v-model="insuredPersonInfos.identifyType" border="none" clearable placeholder=""
  16. placeholderStyle="text-align:right;" suffixIcon='arrow-down'
  17. suffixIconStyle="color:#333;font-size:30rpx" style="pointer-events: none"></u-input>
  18. </u-form-item>
  19. <u-form-item v-if="insuredPersonInfo.property==1" label="证件号" prop="identifyNumber" borderBottom>
  20. <u-input v-model="insuredPersonInfo.identifyNumber" border="none" maxlength="18" clearable
  21. placeholder="请输入证件号" placeholderStyle="text-align:right;"></u-input>
  22. </u-form-item>
  23. <u-form-item v-if="insuredPersonInfo.property==2" label="社会信用代码" prop="organizationCode" borderBottom
  24. labelWidth="120">
  25. <u-input v-model="insuredPersonInfo.organizationCode" border="none" clearable maxlength="18"
  26. placeholder="请输入社会信用代码" placeholderStyle="text-align:right;"></u-input>
  27. </u-form-item>
  28. <u-form-item v-if="insuredPersonInfo.property==2" label="注册资金" borderBottom>
  29. <u--input v-model="insuredPersonInfo.registeredCapital" border="none" clearable placeholder="请输入注册资金"
  30. placeholderStyle="text-align:right;">
  31. </u--input>
  32. <view class="suffixClass">
  33. 万元
  34. </view>
  35. </u-form-item>
  36. <u-form-item label="手机号" prop="mobile" borderBottom>
  37. <u-input v-model="insuredPersonInfo.mobile" border="none" clearable placeholder="请输入手机号" maxlength="11"
  38. placeholderStyle="text-align:right;"></u-input>
  39. </u-form-item>
  40. <u-form-item v-if="insuredPersonInfo.property==2" label="车主座机" borderBottom>
  41. <u-input v-model="insuredPersonInfo.tel" border="none" clearable placeholder="请输入车主座机"
  42. placeholderStyle="text-align:right;"></u-input>
  43. </u-form-item>
  44. <u-form-item v-if="insuredPersonInfo.property==2" label="车主联系人" borderBottom>
  45. <u-input v-model="insuredPersonInfo.legalPerson" border="none" clearable placeholder="请输入车主联系人"
  46. placeholderStyle="text-align:right;"></u-input>
  47. </u-form-item>
  48. <u-form-item v-if="insuredPersonInfo.property==0" label="联系人证件号码" borderBottom labelWidth="120">
  49. <u-input v-model="insuredPersonInfo.leaderIdentifyNumber" border="none" clearable
  50. placeholder="请输入联系人证件号码" placeholderStyle="text-align:right;"></u-input>
  51. </u-form-item>
  52. <u-form-item label="联系人有效期止期" v-if="insuredPersonInfo.property==2" prop="leaderOtherEffectiveDate"
  53. borderBottom labelWidth="150" @click="leaderOtherEffectiveDateShow = true; ">
  54. <u--input v-model="insuredPersonInfo.leaderOtherEffectiveDate" disabled disabledColor="#ffffff"
  55. clearable suffixIcon='calendar' suffixIconStyle="color:#333;font-size:40rpx" placeholder="选择有效期止期"
  56. placeholderStyle="text-align:right;" border="none" style="pointer-events: none"></u--input>
  57. </u-form-item>
  58. <u-form-item label="省市区" v-if="insuredPersonInfo.property==2" borderBottom @click="addressPickershow=true">
  59. <u-input v-model="insuredPersonInfos.fullAddress" border="none" clearable placeholder="请选择省市区"
  60. placeholderStyle="text-align:right;" suffixIcon='arrow-down'
  61. suffixIconStyle="color:#333;font-size:30rpx" style="pointer-events: none"></u-input>
  62. </u-form-item>
  63. <u-form-item label="地址" prop="addr" borderBottom>
  64. <u--textarea v-model="insuredPersonInfo.addr" border="none" placeholder="请输入地址"
  65. autoHeight></u--textarea>
  66. </u-form-item>
  67. <u-form-item label="证件起期" prop="identifyValidDate" borderBottom @click="identifyValidDateShow = true; ">
  68. <u--input v-model="insuredPersonInfo.identifyValidDate" disabled disabledColor="#ffffff" clearable
  69. suffixIcon='calendar' suffixIconStyle="color:#333;font-size:40rpx" placeholder="请选择证件起期 "
  70. placeholderStyle="text-align:right;" border="none" style="pointer-events: none"></u--input>
  71. </u-form-item>
  72. <u-form-item label="证件止期" prop="identifyValidEndDate" @click="identifyValidEndDateShow = true; ">
  73. <u--input v-model="insuredPersonInfo.identifyValidEndDate" disabled disabledColor="#ffffff" clearable
  74. suffixIcon='calendar' suffixIconStyle="color:#333;font-size:40rpx;margin-right:20px"
  75. placeholder="请选择证件止期 " placeholderStyle="text-align:right;" border="none"
  76. style="pointer-events: none">
  77. </u--input>
  78. <u-checkbox-group v-model="ownerlongTerm" iconPlacement="right" @change="ownerlongTermChange">
  79. <u-checkbox activeColor="#FDE935" iconColor="#333" labelSize="15px" shape="circle" label="长期有效"
  80. name="长期有效"></u-checkbox>
  81. </u-checkbox-group>
  82. </u-form-item>
  83. </u--form>
  84. <!-- 车主类型 -->
  85. <u-picker :show="propertyShow" :columns="propertylist" keyName="label" @cancel="propertyShow=false"
  86. @confirm="propertyConfirm($event,'property','propertyShow')" @close="propertyShow=false"
  87. :closeOnClickOverlay="true"></u-picker>
  88. <u-datetime-picker :show="identifyValidDateShow" v-model="identifyValidDatevalue" mode="date"
  89. :formatter="formatter" @cancel="identifyValidDateShow=false" @close="identifyValidDateShow=false"
  90. :closeOnClickOverlay="true" @confirm="identifyValidDateconfirm" confirmText="确定"></u-datetime-picker>
  91. <u-datetime-picker :show="identifyValidEndDateShow" mode="date" v-model="identifyValidEndDatevalue"
  92. :formatter="formatter" @cancel="identifyValidEndDateShow=false" @confirm="identifyValidEndDateconfirm"
  93. :closeOnClickOverlay="true" @close="identifyValidEndDateShow=false" confirmText="确定"></u-datetime-picker>
  94. <!-- 有效期止期 -->
  95. <u-datetime-picker :show="leaderOtherEffectiveDateShow" v-model="leaderOtherEffectiveDatevalue" mode="date"
  96. :formatter="formatter" @cancel="leaderOtherEffectiveDateShow=false"
  97. @close="leaderOtherEffectiveDateShow=false" :closeOnClickOverlay="true"
  98. @confirm="leaderOtherEffectiveDateconfirm" confirmText="确定"></u-datetime-picker>
  99. <!-- 身份证止期 -->
  100. <!-- 省市区组件 -->
  101. <uni-areaCascadePicker :show="addressPickershow" @confirm="addressConfirm" @close="addressPickershow=false"
  102. @cancel="addressPickershow=false"></uni-areaCascadePicker>
  103. </view>
  104. </template>
  105. <script>
  106. var dateTime = new Date();
  107. let Year = dateTime.getFullYear();
  108. let Month = Number(dateTime.getMonth() + 1);
  109. export default {
  110. props: {
  111. insuredPersonInfo: Object,
  112. insuredPersonInfos: Object,
  113. },
  114. data() {
  115. return {
  116. leaderOtherEffectiveDatevalue: Number(new Date()),
  117. identifyValidDatevalue: Number(new Date()), //证件起期
  118. identifyValidEndDatevalue: Number(new Date()), //证件止期
  119. propertyShow: false, //证件类型
  120. identifyValidDateShow: false, //证件起期
  121. identifyValidEndDateShow: false, //证件止期
  122. leaderOtherEffectiveDateShow: false, //有效期止期
  123. addressPickershow: false, //省市区
  124. ownerlongTerm: [], //车主长期
  125. propertylist: [
  126. [{
  127. label: "个人",
  128. value: "1",
  129. }, {
  130. label: "法人",
  131. value: "2",
  132. }]
  133. ],
  134. insuredRules: {
  135. name: [{
  136. required: true,
  137. message: '请输入车主姓名',
  138. trigger: ['blur', 'change'],
  139. },
  140. {
  141. minLength: 2,
  142. maxLength: 5,
  143. message: '车主姓名长度在 {minLength} 到 {maxLength} 个字符',
  144. },
  145. {
  146. pattern: /^([\u4e00-\u9fa5]{1,6}|[a-zA-Z\.\s]{1,6})$/,
  147. message: '请输入正确的车主姓名',
  148. }
  149. ],
  150. organizationCode: [{
  151. required: true,
  152. message: '请输入统一社会信用代码',
  153. trigger: ['blur', 'change'],
  154. }],
  155. identifyNumber: [{
  156. required: true,
  157. message: '请输入车主证件号',
  158. trigger: ['blur', 'change'],
  159. },
  160. {
  161. pattern: /^[1-9]\d{5}(18|19|([23]\d))\d{2}((0[1-9])|(10|11|12))(([0-2][1-9])|10|20|30|31)\d{3}[0-9Xx]$/,
  162. message: '请输入正确的车主证件号',
  163. }
  164. ],
  165. mobile: [{
  166. required: true,
  167. message: '请输入车主手机号',
  168. trigger: ['blur', 'change'],
  169. },
  170. {
  171. pattern: /^1[3-9]\d{9}$/,
  172. message: '请输入正确的手机号',
  173. }
  174. ],
  175. addr: [{
  176. required: true,
  177. message: '请输入车主地址',
  178. trigger: ['blur', 'change'],
  179. },
  180. {
  181. minLength: 8,
  182. maxLength: 40,
  183. message: '车主地址长度在 {minLength} 到 {maxLength} 个字符',
  184. },
  185. ],
  186. identifyValidDate: [{
  187. required: true,
  188. message: '请选择身份证起期',
  189. trigger: ['blur', 'change'],
  190. }, {
  191. pattern: /^\d{4}-\d{2}-\d{2}$/,
  192. message: '身份证起期格式错误',
  193. }],
  194. identifyValidEndDate: [{
  195. required: true,
  196. message: '请选择身份证止期',
  197. trigger: ['blur', 'change'],
  198. }, {
  199. pattern: /^\d{4}-\d{2}-\d{2}$/,
  200. message: '身份证止期格式错误',
  201. }]
  202. },
  203. }
  204. },
  205. methods: {
  206. //省市区选择回调
  207. addressConfirm(value) {
  208. if (value) {
  209. this.insuredPersonInfos.fullAddress = value.fullAddress;
  210. this.insuredPersonInfo.provinceCode = value.codes[0];
  211. this.insuredPersonInfo.cityCode = value.codes[1];
  212. this.insuredPersonInfo.countyCode = value.codes[2];
  213. }
  214. this.addressPickershow = false;
  215. },
  216. propertyConfirm(value, name, showName) {
  217. this.insuredPersonInfo[name] = value.value[0].value;
  218. this.insuredPersonInfos[name] = value.value[0].label;
  219. this[showName] = false;
  220. if (value.value[0].value == '1') { //个人
  221. this.insuredPersonInfos.identifyType = "身份证";
  222. this.insuredPersonInfo.identifyType = "01";
  223. } else {
  224. this.insuredPersonInfos.identifyType = "营业执照";
  225. this.insuredPersonInfo.identifyType = "10";
  226. }
  227. },
  228. ownerlongTermChange(e) {
  229. if (e.length) {
  230. this.insuredPersonInfo.identifyValidEndDate = '9999-12-31';
  231. } else {
  232. this.insuredPersonInfo.identifyValidEndDate = '';
  233. }
  234. },
  235. identifyValidDateconfirm(e) {
  236. this.insuredPersonInfo.identifyValidDate = uni.$u.timeFormat(e.value, 'yyyy-mm-dd');
  237. this.identifyValidDateShow = false;
  238. },
  239. identifyValidEndDateconfirm(e) {
  240. this.insuredPersonInfo.identifyValidEndDate = uni.$u.timeFormat(e.value, 'yyyy-mm-dd');
  241. this.identifyValidEndDateShow = false;
  242. },
  243. leaderOtherEffectiveDateconfirm(e) {
  244. this.ownerInfo.leaderOtherEffectiveDate = uni.$u.timeFormat(e.value, 'yyyy-mm-dd');
  245. this.leaderOtherEffectiveDateShow = false;
  246. },
  247. formatter(type, value) {
  248. if (type === 'year') {
  249. return `${value}年`
  250. }
  251. if (type === 'month') {
  252. return `${value}月`
  253. }
  254. if (type === 'day') {
  255. return `${value}日`
  256. }
  257. return value
  258. },
  259. validate(callback) {
  260. this.$refs.insuredForm.setRules(this.insuredRules)
  261. this.$refs.insuredForm.validate().then(res => {
  262. callback(res)
  263. }).catch(errors => {
  264. callback(errors)
  265. })
  266. }
  267. },
  268. }
  269. </script>
  270. <style scoped lang="scss">
  271. ::v-deep {
  272. .u-textarea {
  273. text-align: right;
  274. padding: 0;
  275. color: #303133;
  276. }
  277. .uni-textarea-placeholder {
  278. color: grey !important;
  279. text-align: right;
  280. }
  281. }
  282. /* 添加样式 */
  283. .search {
  284. width: 112rpx;
  285. height: 60rpx;
  286. background: #FDE935;
  287. border-radius: 100rpx 100rpx 100rpx 100rpx;
  288. }
  289. .suffixClass {
  290. margin-left: 10rpx;
  291. font-size: 30rpx;
  292. }
  293. </style>