lookCard.vue 4.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158
  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 @click="click(item)" 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 :immediateChange ="true" @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. click(item){
  48. console.log(111111111)
  49. uni.previewImage({
  50. current: 0, // 当前显示图片的索引值
  51. urls: [item], // 需要预览的图片列表,photoList要求必须是数组
  52. loop:true, // 是否可循环预览
  53. })
  54. },
  55. clip(status, item) {
  56. uni.setClipboardData({
  57. data: status == 1 ? item.bankNo : item.personNo, // e是你要保存的内容
  58. success: function() {
  59. uni.showToast({
  60. title: '复制成功',
  61. icon: 'none'
  62. })
  63. }
  64. })
  65. },
  66. imageOCR(item,index){
  67. this.currectData=item
  68. this.index=index
  69. this.show=true
  70. },
  71. getCountdownTime() {
  72. this.countdownTime = 60
  73. let timer = setInterval(() => {
  74. this.countdownTime--;
  75. this.text='识别号码('+this.countdownTime+'s)'
  76. if (this.countdownTime < 1) {
  77. clearInterval(timer)
  78. this.countdownTime = 0
  79. this.text='识别号码'
  80. }
  81. }, 1000)
  82. },
  83. pickerConfirm(e){
  84. this.show=false
  85. if(this.countdownTime==0){
  86. this.getCountdownTime()
  87. uni.showLoading({
  88. title: '数据加载中',
  89. mask:true
  90. })
  91. var type='',type1=''
  92. if(e.value[0]=='识别身份证号'){
  93. type='admin.unimall.certificateManagementInfo'
  94. type1='personShibie'
  95. }else if(e.value[0]=='识别银行卡号'){
  96. type='admin.unimall.certificateManagementInfo'
  97. type1='bankShibie'
  98. }
  99. this.$request.baseRequest(type, type1,{certificateImage:this.currectData.certificateImage}, failres => {
  100. console.log('res+++++', failres.errmsg)
  101. uni.hideLoading()
  102. uni.showToast({
  103. icon:"none",
  104. title: failres.errmsg,
  105. duration: 3000
  106. });
  107. }).then(res => {
  108. uni.hideLoading()
  109. uni.showToast({
  110. icon:"success",
  111. title: '识别成功!',
  112. duration: 2000
  113. });
  114. if(e.value[0]=='识别身份证号'){
  115. this.cardList[this.index].personNo=res.data.recPersonNo
  116. this.cardList[this.index].personNo1 = '*' + (this.cardList[this.index].personNo.substring(this.cardList[this.index].personNo.length - 4))
  117. }else if(e.value[0]=='识别银行卡号'){
  118. this.cardList[this.index].bankNo=res.data.bankNo
  119. this.cardList[this.index].bankNo1 = '*' + (this.cardList[this.index].bankNo.substring(this.cardList[this.index].bankNo.length - 4))
  120. }
  121. this.credentialsShow=true
  122. })
  123. }
  124. console.log(e)
  125. },
  126. }
  127. }
  128. </script>
  129. <style lang="scss" scoped>
  130. .finished{
  131. padding: 10rpx 14rpx;
  132. text-align: center;
  133. background: #112253;
  134. border-radius: 10rpx;
  135. font-size: 28rpx;
  136. font-weight: bold;
  137. color: #FFFFFF;
  138. }
  139. .unfinished{
  140. padding: 10rpx 14rpx;
  141. text-align: center;
  142. background: rgba(17, 34, 83, 0.3);
  143. border-radius: 10rpx;
  144. font-size: 28rpx;
  145. font-weight: bold;
  146. color: #FFFFFF;
  147. }
  148. </style>