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 7.6KB

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