OwnerInfoForm.vue 10 KB

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