lookCard.vue 3.9 KB

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