Você não pode selecionar mais de 25 tópicos Os tópicos devem começar com uma letra ou um número, podem incluir traços ('-') e podem ter até 35 caracteres.

base-change-people.vue 9.4KB

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