lookCard.vue 4.5 KB

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