checkImageInfo.vue 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468
  1. <template>
  2. <view class="z-index center" v-if="show" @tap.stop.prevent @touchmove.stop.prevent @click.stop.prevent>
  3. <view class="popContent " @tap.stop.prevent @touchmove.stop.prevent @click.stop.prevent>
  4. <view class="popHeader center">信息校验</view>
  5. <view class="popBody">
  6. <!-- <view class="icon iconfont icon-fanzhuanshunshizhen lRotate center" @click.stop.prevent="rotatefront">
  7. </view>
  8. <view v-if="img.length==2" class="icon iconfont icon-fanzhuanshunshizhen lRotate1 center"
  9. @click.stop.prevent="rotatefront1">
  10. </view> -->
  11. <view class="imgOcr dis j-s a-c">
  12. <image class="obverseimg" src="/static/carfront.png" @click="obverse_btn" mode="">
  13. <image class="obverseimg" src="/static/carfront.png" @click="obverse_btn" mode="">
  14. </view>
  15. <template v-if="checkType == '2'">
  16. <view class="line d-flex a-center">
  17. <view class="line_title">车牌号</view>
  18. <view class="line_info d-flex flex-1">
  19. <input class="input" type="text" placeholder-style="font-size:28upx; color:#999"
  20. placeholder="请输入车牌号" @input="upperCaseType('licenseNo')" v-model="checkInfo.licenseNo"
  21. maxlength="8" />
  22. </view>
  23. </view>
  24. <view class="line d-flex a-center">
  25. <view class="line_title">发动机号</view>
  26. <view class="line_info d-flex flex-1">
  27. <input class="input" type="text" placeholder-style="font-size:28upx; color:#999"
  28. @input="upperCaseType('engineNo')" placeholder="请输入发动机号" v-model="checkInfo.engineNo" />
  29. </view>
  30. </view>
  31. <view class="line d-flex a-center">
  32. <view class="line_title">车架号</view>
  33. <view class="line_info d-flex flex-1">
  34. <input class="input" type="text" placeholder-style="font-size:28upx; color:#999"
  35. placeholder="请输入车架号" @input="upperCaseType('vinNo')" v-model="checkInfo.vinNo"
  36. maxlength="17" />
  37. </view>
  38. </view>
  39. <view class="line d-flex a-center">
  40. <view class="line_title">注册日期</view>
  41. <view class="line_info d-flex flex-1">
  42. <picker mode="date" :value="checkInfo.registerDate" :start="startDate" :end="endDate"
  43. @change="bindDateChange($event,'registerDate')">
  44. <view :class="!checkInfo.registerDate?'':'active'" class="registerDate d-flex a-center">
  45. {{!checkInfo.registerDate?"请选择日期":checkInfo.registerDate}}
  46. </view>
  47. </picker>
  48. </view>
  49. </view>
  50. <view class="line d-flex a-center">
  51. <view class="line_title">发证日期</view>
  52. <view class="line_info d-flex flex-1">
  53. <picker mode="date" :value="checkInfo.issueDate" :start="checkInfo.registerDate"
  54. :end="endDate" @change="bindDateChange($event,'issueDate')">
  55. <view :class="!checkInfo.issueDate?'':'active'" class="registerDate d-flex a-center">
  56. {{!checkInfo.issueDate?"请选择日期":checkInfo.issueDate}}
  57. </view>
  58. </picker>
  59. </view>
  60. </view>
  61. </template>
  62. <template v-if="checkType == '1'">
  63. <view class="line d-flex a-center">
  64. <view class="line_title">姓名</view>
  65. <view class="line_info d-flex flex-1">
  66. <input type="text" placeholder-style="font-size:28upx; color:#999" placeholder="请输入姓名"
  67. v-model="checkInfo.name" />
  68. </view>
  69. </view>
  70. <view class="line d-flex a-center">
  71. <view class="line_title">证件号</view>
  72. <view class="line_info d-flex flex-1">
  73. <input type="text" placeholder-style="font-size:28upx; color:#999" placeholder="请输入证件号"
  74. v-model="checkInfo.identifyNumber" />
  75. </view>
  76. </view>
  77. <view class="line d-flex a-center" style="height: 100upx;">
  78. <view class="line_title">地址</view>
  79. <view class="line_info d-flex d-flex flex-1">
  80. <textarea class="d-flex flex-1"
  81. style="font-size: 28upx;width: 330upx;height: 60upx;min-height: 80upx;"
  82. v-model="checkInfo.addr" placeholder-style="font-size:28upx; color:#999"
  83. placeholder="请输入地址" />
  84. </view>
  85. </view>
  86. <view class="line d-flex a-center">
  87. <view class="line_title">有效期起期</view>
  88. <view class="line_info d-flex flex-1">
  89. <input type="text" placeholder-style="font-size:28upx; color:#999" placeholder="请输入有效期起期"
  90. v-model="checkInfo.identifyValidDate" />
  91. </view>
  92. </view>
  93. <view class="line d-flex a-center">
  94. <view class="line_title">有效期止期</view>
  95. <view class="line_info d-flex flex-1">
  96. <input type="text" placeholder-style="font-size:28upx; color:#999" placeholder="请输入有效期止期"
  97. v-model="checkInfo.identifyValidEndDate" />
  98. </view>
  99. </view>
  100. </template>
  101. </view>
  102. <view class="popBottom center d-flex">
  103. <view class="d-flex a-center j-center flex-1" style="border-right: 5upx solid #FAFAFA;"
  104. @tap="checkInfoCancel">取消</view>
  105. <view class="d-flex a-center j-center flex-1" @tap="checkInfoSubmit">确定</view>
  106. </view>
  107. </view>
  108. </view>
  109. </template>
  110. <script>
  111. export default {
  112. name: 'checkImageInfo', //插件名称
  113. props: {
  114. show: {
  115. type: Boolean,
  116. required: true,
  117. default: false
  118. },
  119. img: Array,
  120. checkType: {
  121. type: Number,
  122. required: true,
  123. default: 1,
  124. },
  125. checkInfo: {
  126. type: Object,
  127. required: true,
  128. default: () => {
  129. return {};
  130. }
  131. },
  132. items: ['选项卡1', '选项卡2', '选项卡3'],
  133. current: 0,
  134. colorIndex: 0,
  135. activeColor: '#007aff',
  136. styleType: 'button'
  137. },
  138. computed: {
  139. startDate() {
  140. return this.getDate('start');
  141. },
  142. endDate() {
  143. return this.getDate('end');
  144. }
  145. },
  146. data() {
  147. return {
  148. deg: 0, //旋转角度
  149. scale: 1 //缩放比例
  150. };
  151. },
  152. methods: {
  153. //转变大写(车型/车架号/发动机号)
  154. upperCaseType(type) {
  155. this.checkInfo[type] = this.checkInfo[type].toUpperCase();
  156. },
  157. checkInfoCancel() {
  158. this.deg = 0; //旋转角度
  159. this.scale = 1; //缩放比例
  160. this.$emit('cancel')
  161. },
  162. //日期(可以选择20年以内的时间)
  163. getDate(type) {
  164. const date = new Date();
  165. let year = date.getFullYear();
  166. let month = date.getMonth() + 1;
  167. let day = date.getDate();
  168. if (type === 'start') {
  169. year = year - 20;
  170. } else if (type === 'end') {}
  171. month = month > 9 ? month : '0' + month;;
  172. day = day > 9 ? day : '0' + day;
  173. return `${year}-${month}-${day}`;
  174. },
  175. bindDateChange(e, type) { //日期赋值
  176. if ((type == 'issueDate') && (!this.checkInfo.registerDate)) {
  177. return uni.showToast({
  178. title: '请先输入注册日期',
  179. icon: "none"
  180. });
  181. }
  182. this.checkInfo[type] = e.detail.value;
  183. },
  184. //比例变化
  185. onScale(e) {
  186. },
  187. //移动变化
  188. movableChange(e) {
  189. //console.log(e);
  190. /* if(this.old.scale <= 1){
  191. this.swiper=false;
  192. }else if(e.detail.x===0){
  193. this.swiper=false;
  194. } */
  195. },
  196. arr() {
  197. console.log(1)
  198. },
  199. //旋转
  200. rotatefront(e) {
  201. this.deg = this.deg == 270 ? 0 : this.deg + 90;
  202. },
  203. //关闭
  204. checkInfoSubmit() {
  205. if ((this.checkType == 2) && !this.checkCarInfo()) {
  206. return false;
  207. }
  208. if ((this.checkType == 1) && !this.checkPersonInfo()) {
  209. return false;
  210. }
  211. this.deg = 0; //旋转角度
  212. this.scale = 1; //缩放比例
  213. var params = {
  214. checkType: this.checkType,
  215. checkInfo: this.checkInfo
  216. }
  217. this.$emit('close', params)
  218. },
  219. //验证车架号
  220. isFrameno(str) {
  221. let mPattern = /^([0-9A-Z]){17}$/;
  222. return mPattern.test(str);
  223. },
  224. isLicense(str) {
  225. let mPattern =
  226. /^(([京津沪渝冀豫云辽黑湘皖鲁新苏浙赣鄂桂甘晋蒙陕吉闽贵粤青藏川宁琼使领][A-Z](([0-9]{5}[DF])|([DF]([A-HJ-NP-Z0-9])[0-9]{4})))|([京津沪渝冀豫云辽黑湘皖鲁新苏浙赣鄂桂甘晋蒙陕吉闽贵粤青藏川宁琼使领][A-Z][A-HJ-NP-Z0-9]{4}[A-HJ-NP-Z0-9挂学警港澳使领]))$/;
  227. return mPattern.test(str);
  228. },
  229. //校验车辆信息
  230. checkCarInfo() {
  231. if (!this.isLicense(this.checkInfo.licenseNo.trim())) {
  232. uni.showToast({
  233. title: '车牌号有误',
  234. icon: "none"
  235. });
  236. return false;
  237. }
  238. if (!this.checkInfo.engineNo.trim()) {
  239. uni.showToast({
  240. title: '发动机号有误',
  241. icon: "none"
  242. });
  243. return false;
  244. }
  245. if (!this.isFrameno(this.checkInfo.vinNo.trim())) {
  246. uni.showToast({
  247. title: '车架号有误',
  248. icon: "none"
  249. });
  250. return false;
  251. }
  252. if (!this.checkInfo.registerDate.trim()) {
  253. uni.showToast({
  254. title: '注册日期有误',
  255. icon: "none"
  256. });
  257. return false;
  258. }
  259. if (!this.checkInfo.issueDate.trim()) {
  260. uni.showToast({
  261. title: '发证日期有误',
  262. icon: "none"
  263. });
  264. return false;
  265. }
  266. return true;
  267. },
  268. // 身份证验证
  269. isIdCard(str) {
  270. return /^[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]$/;
  271. },
  272. //校验人员信息
  273. checkPersonInfo() {
  274. if (!this.checkInfo.name.trim()) {
  275. uni.showToast({
  276. title: '姓名不能为空',
  277. icon: "none"
  278. });
  279. return false;
  280. }
  281. if (!this.isIdCard(this.checkInfo.identifyNumber.trim())) {
  282. uni.showToast({
  283. title: '身份证号有误',
  284. icon: "none"
  285. });
  286. return false;
  287. }
  288. if (!this.checkInfo.addr.trim()) {
  289. uni.showToast({
  290. title: '地址不能为空',
  291. icon: "none"
  292. });
  293. return false;
  294. }
  295. return true;
  296. }
  297. }
  298. };
  299. </script>
  300. <!--使用scss,只在本组件生效-->
  301. <style lang="scss" scoped>
  302. /* 弹出框样式Start */
  303. .z-index {
  304. position: fixed;
  305. left: 0;
  306. top: 0;
  307. right: 0;
  308. bottom: 0;
  309. background-color: #000;
  310. background: rgba(0, 0, 0, 0.3);
  311. z-index: 999;
  312. .popContent {
  313. position: relative;
  314. z-index: 1000;
  315. width: 670upx;
  316. background: #FFFFFF;
  317. border-radius: 10upx;
  318. height: auto;
  319. padding-bottom: 50px;
  320. .popHeader {
  321. font-weight: bold;
  322. font-size: 32upx;
  323. height: 80upx;
  324. }
  325. .popBody {
  326. position: relative;
  327. width: 100%;
  328. background-color: #FAFAFA;
  329. padding: 10upx 20upx;
  330. box-sizing: border-box;
  331. .lRotate {
  332. color: #FFFFFF;
  333. font-size: 36upx;
  334. font-weight: bold;
  335. position: absolute;
  336. right: 20upx;
  337. top: 280upx;
  338. z-index: 1001;
  339. height: 60upx;
  340. width: 60upx;
  341. background-color: #000;
  342. }
  343. .lRotate1 {
  344. color: #FFFFFF;
  345. font-size: 36upx;
  346. font-weight: bold;
  347. position: absolute;
  348. right: 20upx;
  349. top: 620upx;
  350. z-index: 1001;
  351. height: 60upx;
  352. width: 60upx;
  353. background-color: #000;
  354. }
  355. .marea {
  356. height: 330upx;
  357. width: 100%;
  358. margin-bottom: 10upx;
  359. overflow: hidden;
  360. .mview {
  361. width: 100%;
  362. height: auto;
  363. .image {
  364. width: 100%;
  365. height: 176px;
  366. }
  367. }
  368. }
  369. .line {
  370. height: 70upx;
  371. width: 100%;
  372. background: #FFF;
  373. border-top: 5upx solid #FAFAFA;
  374. .line_title {
  375. width: 80px;
  376. flex-shrink: 0;
  377. padding: 0upx 10upx;
  378. font-weight: bold;
  379. }
  380. .line_info {
  381. padding: 0upx 20upx;
  382. .registerDate {
  383. color: #999;
  384. min-width: 300upx;
  385. height: 70upx;
  386. }
  387. .registerDate.active {
  388. font-size: 28upx;
  389. color: #000;
  390. min-width: 300upx;
  391. height: 70upx;
  392. }
  393. .input {
  394. font-size: 28upx;
  395. }
  396. }
  397. }
  398. }
  399. .popBottom {
  400. position: absolute;
  401. box-sizing: border-box;
  402. bottom: 0;
  403. width: 100%;
  404. height: 100upx;
  405. color: #3e5cd7;
  406. border-top: 1px solid #f6f6f6;
  407. font-weight: 700;
  408. view {
  409. font-size: 32upx;
  410. }
  411. }
  412. }
  413. }
  414. /* 盒子内容居中 */
  415. .center {
  416. display: flex;
  417. justify-content: center;
  418. align-items: center;
  419. }
  420. .uni-common-mt {
  421. margin-top: 30px;
  422. }
  423. .uni-padding-wrap {
  424. // width: 750rpx;
  425. padding: 0px 30px;
  426. }
  427. .imgOcr {
  428. background-color: #FFF;
  429. .obverseimg {
  430. width: 50%;
  431. height: 150px;
  432. }
  433. }
  434. /* 弹出框样式End */
  435. </style>