You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

base-change-people.vue 6.7KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296
  1. <template>
  2. <view class="content">
  3. <view class="item-tips">
  4. <view class="picture-wrapper" @click="IdentityByOrc(1)">
  5. <view class="bg">
  6. <view class="">
  7. <view class="name"> 人像面 </view>
  8. <view class="value"> 上传身份证的人像面 </view>
  9. <view class="tip">
  10. <view class="tip-value"> 拍摄规范 </view>
  11. </view>
  12. </view>
  13. <image class="icon" :src="`${$imgUrl}applyCard/renxiang.png`" v-if="!state.imageUrl"></image>
  14. <image class="icon" :src="state.imageUrl" v-else></image>
  15. </view>
  16. </view>
  17. <view class="picture-wrapper" @click="IdentityByOrc(2)">
  18. <view class="bg">
  19. <view class="">
  20. <view class="name"> 国徽面 </view>
  21. <view class="value"> 上传身份证的国徽面 </view>
  22. <view class="tip">
  23. <view class="tip-value"> 拍摄规范 </view>
  24. </view>
  25. </view>
  26. <image class="icon" :src="`${$imgUrl}applyCard/guohui.png`" v-if="!state.imageUrl2"></image>
  27. <image class="icon" :src="state.imageUrl2" v-else></image>
  28. </view>
  29. </view>
  30. </view>
  31. <view class="shibie-wrapper">
  32. <view class="title"> 个人信息 </view>
  33. <view class="">
  34. <u-field required labelWidth="200" v-model="state.ocrData.name" input-align="right" label="姓名" disabled>
  35. </u-field>
  36. <u-field required labelWidth="200" v-model="state.ocrData.gender" input-align="right" label="性别" disabled>
  37. </u-field>
  38. <u-field required labelWidth="200" v-model="state.ocrData.idno" input-align="right" label="证件号" disabled>
  39. </u-field>
  40. <u-field required labelWidth="200" v-model="state.ocrData.address" input-align="right" label="地址" disabled>
  41. </u-field>
  42. <u-field required labelWidth="200" v-model="state.ocrData.termValidity" input-align="right"
  43. label="证件有效期" disabled>
  44. </u-field>
  45. <u-field required labelWidth="200" v-model="state.ocrData.phone" input-align="right" label="联系方式" disabled>
  46. </u-field>
  47. </view>
  48. </view>
  49. <view class="action">
  50. <button type="default" class="button" @click="savaHandle()">
  51. 确认下一步
  52. </button>
  53. </view>
  54. </view>
  55. </template>
  56. <script setup lang="ts">
  57. import {
  58. reactive
  59. } from "vue";
  60. import {
  61. navTo
  62. } from "@/utils/utils";
  63. import {
  64. etcOcrCard
  65. } from "@/utils/network/api.js";
  66. import {
  67. pathToBase64
  68. } from "@/utils/util/imageTool.js";
  69. import {
  70. stringToJson
  71. } from "@/utils/network/encryption";
  72. import {
  73. request
  74. } from "@/utils/network/request.js";
  75. const savaHandle = () => {
  76. console.log("执行点击事件");
  77. navTo("/subpackage/after-sale/replace-equipment/car-change");
  78. // uni.navigateTo({
  79. // url: '/pages/applyCard/car-release'
  80. // })
  81. };
  82. const tabChange = (val) => {
  83. if (val) {
  84. state.isMyPeopple = true;
  85. } else {
  86. state.isMyPeopple = false;
  87. }
  88. };
  89. const state = reactive({
  90. ocrData: {
  91. name: "",
  92. gender: "",
  93. idno: "",
  94. address: "",
  95. phone: "18225525252",
  96. termValidity: "",
  97. },
  98. isMyPeopple: true,
  99. buchongData: {
  100. conmpany: "李某一",
  101. type: "居民身份证",
  102. card: "23728347626342332",
  103. phone: "",
  104. },
  105. imageUrl: "",
  106. imageUrl2: "",
  107. });
  108. //orc身份证
  109. const IdentityByOrc = (imageType) => {
  110. uni.chooseImage({
  111. count: 1, //只能选取一张照片
  112. sizeType: ["original", "compressed"], //可以指定是原图还是压缩图,默认二者都有
  113. sourceType: ["camera", "album"], //从相册选择
  114. success: function(res) {
  115. if (imageType == 1) {
  116. state.imageUrl = res.tempFilePaths[0];
  117. } else {
  118. state.imageUrl2 = res.tempFilePaths[0];
  119. }
  120. pathToBase64(res.tempFilePaths[0])
  121. .then((path) => {
  122. var data = {
  123. source: "1",
  124. agencyId: "52010106004",
  125. imageType: imageType,
  126. fileName: res.tempFilePaths[0],
  127. imageBase64: path,
  128. };
  129. const options = {
  130. type: 2,
  131. data: data,
  132. method: "POST",
  133. showLoading: true,
  134. };
  135. request(etcOcrCard, options).then((res) => {
  136. const data = stringToJson(res.bizContent);
  137. console.log(data);
  138. if (imageType == 1) {
  139. state.ocrData.name = data.name;
  140. state.ocrData.gender = data.gender;
  141. state.ocrData.idno = data.idno;
  142. state.ocrData.address = data.address;
  143. } else {
  144. state.ocrData.termValidity = data.begindate + "-" + data
  145. .enddate;
  146. }
  147. });
  148. })
  149. .catch((error) => {});
  150. },
  151. });
  152. };
  153. </script>
  154. <style lang="scss" scoped>
  155. .content {
  156. padding: 50rpx 30rpx 50rpx 30rpx;
  157. .action {
  158. margin-top: 60rpx;
  159. padding-left: 20rpx;
  160. padding-right: 20rpx;
  161. padding-bottom: 30rpx;
  162. .button {
  163. height: 80rpx;
  164. background: linear-gradient(-90deg, #43a1e0 0%, #13e7c1 100%);
  165. border-radius: 40rpx;
  166. font-size: 32rpx;
  167. font-weight: 400;
  168. color: #ffffff;
  169. line-height: 80rpx;
  170. }
  171. }
  172. .item-tips {
  173. .title {
  174. font-size: 30rpx;
  175. font-family: Microsoft YaHei;
  176. font-weight: 400;
  177. color: #000000;
  178. line-height: 24rpx;
  179. }
  180. .tip {
  181. margin-top: 16rpx;
  182. font-size: 24rpx;
  183. font-family: Microsoft YaHei;
  184. font-weight: 400;
  185. color: #999999;
  186. line-height: 24rpx;
  187. }
  188. }
  189. .picture-wrapper {
  190. margin-top: 40rpx;
  191. .bg {
  192. background: #ffffff;
  193. box-shadow: 0rpx 4rpx 13rpx 3rpx rgba(223, 223, 223, 0.8);
  194. border-radius: 20rpx;
  195. padding: 40rpx;
  196. display: flex;
  197. // align-items: center;
  198. justify-content: space-between;
  199. .name {
  200. font-size: 34rpx;
  201. font-family: Microsoft YaHei;
  202. font-weight: 400;
  203. color: #000000;
  204. line-height: 34rpx;
  205. }
  206. .value {
  207. margin-top: 20rpx;
  208. font-size: 24rpx;
  209. font-family: Microsoft YaHei;
  210. font-weight: 400;
  211. color: #999999;
  212. line-height: 24rpx;
  213. }
  214. .tip {
  215. margin-top: 20rpx;
  216. text-align: center;
  217. width: 110rpx;
  218. height: 40rpx;
  219. background: rgba(33, 190, 177, 0.2);
  220. border-radius: 6rpx;
  221. .tip-value {
  222. font-size: 20rpx;
  223. font-family: Microsoft YaHei;
  224. font-weight: 400;
  225. color: #0a8f8a;
  226. line-height: 40rpx;
  227. opacity: 1;
  228. }
  229. }
  230. }
  231. .icon {
  232. width: 294rpx;
  233. height: 188rpx;
  234. }
  235. }
  236. .shibie-wrapper {
  237. margin-top: 60rpx;
  238. .title {
  239. font-size: 30rpx;
  240. font-family: Microsoft YaHei;
  241. font-weight: 400;
  242. color: #000000;
  243. line-height: 30rpx;
  244. }
  245. ::v-deep .u-flex {
  246. width: 100%;
  247. }
  248. ::v-deep .u-field {
  249. border-bottom: 1rpx solid #DCDCDC;
  250. }
  251. }
  252. .buchong-wrapper {
  253. margin-top: 60rpx;
  254. .title {
  255. font-size: 30rpx;
  256. font-family: Microsoft YaHei;
  257. font-weight: 400;
  258. color: #000000;
  259. line-height: 30rpx;
  260. }
  261. }
  262. .green-tip {
  263. margin-top: 50rpx;
  264. font-size: 24rpx;
  265. font-family: Microsoft YaHei;
  266. font-weight: 400;
  267. color: #00b38b;
  268. line-height: 24rpx;
  269. margin-bottom: 60rpx;
  270. }
  271. }
  272. </style>