lookCard.vue 3.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142
  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. uni.hideLoading()
  88. uni.showToast({
  89. icon:"none",
  90. title: failres.errmsg,
  91. duration: 3000
  92. });
  93. }).then(res => {
  94. uni.hideLoading()
  95. uni.showToast({
  96. icon:"success",
  97. title: '识别成功!',
  98. duration: 2000
  99. });
  100. if(e.value[0]=='识别身份证号'){
  101. this.cardList[this.index].personNo=res.data.recPersonNo
  102. this.cardList[this.index].personNo1 = '*' + (this.cardList[this.index].personNo.substring(this.cardList[this.index].personNo.length - 4))
  103. }else if(e.value[0]=='识别银行卡号'){
  104. this.cardList[this.index].bankNo=res.data.bankNo
  105. this.cardList[this.index].bankNo1 = '*' + (this.cardList[this.index].bankNo.substring(this.cardList[this.index].bankNo.length - 4))
  106. }
  107. this.credentialsShow=true
  108. })
  109. }
  110. console.log(e)
  111. },
  112. }
  113. }
  114. </script>
  115. <style lang="scss" scoped>
  116. .finished{
  117. padding: 10rpx 14rpx;
  118. text-align: center;
  119. background: #112253;
  120. border-radius: 10rpx;
  121. font-size: 28rpx;
  122. font-weight: bold;
  123. color: #FFFFFF;
  124. }
  125. .unfinished{
  126. padding: 10rpx 14rpx;
  127. text-align: center;
  128. background: rgba(17, 34, 83, 0.3);
  129. border-radius: 10rpx;
  130. font-size: 28rpx;
  131. font-weight: bold;
  132. color: #FFFFFF;
  133. }
  134. </style>