InsuredInfoForm.vue 12 KB

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