OwnerInfoForm.vue 10 KB

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