lookCard.vue 4.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150
  1. <template>
  2. <view>
  3. <view v-for='(item,index) in cardList' class="">
  4. <view style='margin:10px;' class='flex justify-space-between'>
  5. <view>{{item.certificateName}}</view>
  6. <view class="flex">
  7. <view v-if='item.personNo'>({{item.personNo1}})</view>
  8. <view style='margin:0 10rpx;' class='finished' v-if='item.personNo' @click='clip(0,item)'>
  9. 复制号码
  10. </view>
  11. <text v-if='item.bankNo'>({{item.bankNo1}})</text>
  12. <view class='finished' v-if='item.bankNo' @click='clip(1,item)' >
  13. 复制号码
  14. </view>
  15. <view :class='countdownTime==0?"finished":"unfinished"' @click='imageOCR(item,index)'>{{text}}</view>
  16. </view>
  17. </view>
  18. <view style='text-align:center;' class="">
  19. <image style='width:96%;height:190px;border-radius:20rpx;' :src="item.certificateImage" mode="aspectFill"></image>
  20. </view>
  21. </view>
  22. <u-toast ref="uToast"></u-toast>
  23. <u-picker @cancel='show=false' @confirm='pickerConfirm' title='识别类型' :show="show" :columns="columns"></u-picker>
  24. </view>
  25. </template>
  26. <script>
  27. export default {
  28. data() {
  29. return {
  30. cardList:[],
  31. show:false,
  32. countdownTime:0,
  33. currectData:{},
  34. index:0,
  35. columns: [
  36. ['识别身份证号', '识别银行卡号']
  37. ],
  38. text:'识别号码'
  39. }
  40. },
  41. onLoad(options) {
  42. console.log(11111)
  43. this.cardList=JSON.parse(options.dataList);
  44. console.log(this.cardList,11111111)
  45. },
  46. methods: {
  47. clip(status, item) {
  48. uni.setClipboardData({
  49. data: status == 1 ? item.bankNo : item.personNo, // e是你要保存的内容
  50. success: function() {
  51. uni.showToast({
  52. title: '复制成功',
  53. icon: 'none'
  54. })
  55. }
  56. })
  57. },
  58. imageOCR(item,index){
  59. this.currectData=item
  60. this.index=index
  61. this.show=true
  62. },
  63. getCountdownTime() {
  64. this.countdownTime = 60
  65. let timer = setInterval(() => {
  66. this.countdownTime--;
  67. this.text='识别号码('+this.countdownTime+'s)'
  68. if (this.countdownTime < 1) {
  69. clearInterval(timer)
  70. this.countdownTime = 0
  71. this.text='识别号码'
  72. }
  73. }, 1000)
  74. },
  75. pickerConfirm(e){
  76. this.show=false
  77. if(this.countdownTime==0){
  78. this.getCountdownTime()
  79. uni.showLoading({
  80. title: '数据加载中',
  81. mask:true
  82. })
  83. var type='',type1=''
  84. if(e.value[0]=='识别身份证号'){
  85. type='admin.unimall.certificateManagementInfo'
  86. type1='personShibie'
  87. }else if(e.value[0]=='识别银行卡号'){
  88. type='admin.unimall.certificateManagementInfo'
  89. type1='bankShibie'
  90. }
  91. this.$request.baseRequest(type, type1,{certificateImage:this.currectData.certificateImage}, failres => {
  92. console.log('res+++++', failres.errmsg)
  93. uni.hideLoading()
  94. uni.showToast({
  95. icon:"none",
  96. title: failres.errmsg,
  97. duration: 3000
  98. });
  99. }).then(res => {
  100. uni.hideLoading()
  101. uni.showToast({
  102. icon:"success",
  103. title: '识别成功!',
  104. duration: 2000
  105. });
  106. if(e.value[0]=='识别身份证号'){
  107. this.cardList[this.index].personNo=res.data.recPersonNo
  108. this.cardList[this.index].personNo1 = '*' + (this.cardList[this.index].personNo.substring(this.cardList[this.index].personNo.length - 4))
  109. }else if(e.value[0]=='识别银行卡号'){
  110. this.cardList[this.index].bankNo=res.data.bankNo
  111. this.cardList[this.index].bankNo1 = '*' + (this.cardList[this.index].bankNo.substring(this.cardList[this.index].bankNo.length - 4))
  112. }
  113. this.credentialsShow=true
  114. })
  115. }
  116. console.log(e)
  117. },
  118. }
  119. }
  120. </script>
  121. <style lang="scss" scoped>
  122. .finished{
  123. padding: 10rpx 14rpx;
  124. text-align: center;
  125. background: #112253;
  126. border-radius: 10rpx;
  127. font-size: 28rpx;
  128. font-weight: bold;
  129. color: #FFFFFF;
  130. }
  131. .unfinished{
  132. padding: 10rpx 14rpx;
  133. text-align: center;
  134. background: rgba(17, 34, 83, 0.3);
  135. border-radius: 10rpx;
  136. font-size: 28rpx;
  137. font-weight: bold;
  138. color: #FFFFFF;
  139. }
  140. </style>