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.

opening-account-people.vue 24KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849
  1. <template>
  2. <navBar title="ETC开户新办申请-个人" :scrollTop="scrollTop"></navBar>
  3. <navBgCar></navBgCar>
  4. <view class="content-wrap">
  5. <view @click="tabChange(true)">
  6. <view :class="state.isMyPeopple ? 'big' : 'nomal'"> 本人车辆 </view>
  7. <view :class="state.isMyPeopple ? 'tip' : ''"> </view>
  8. </view>
  9. <view @click="tabChange(false)" style="margin-left: 60rpx" class="" v-if="state.isEnableOther">
  10. <view :class="state.isMyPeopple ? 'nomal' : 'big'"> 他人车辆 </view>
  11. <view :class="state.isMyPeopple ? '' : 'tip'"> </view>
  12. </view>
  13. </view>
  14. <view v-if="state.isMyPeopple" class="content">
  15. <view class="item-tips">
  16. <view class="title"> 上传后请核对识别信息 </view>
  17. <view class="tip"> 如有错误请及时手动修改 </view>
  18. </view>
  19. <view class="picture-wrapper" @click="takePhotoMode('1','my')">
  20. <view class="bg">
  21. <view class="">
  22. <view class="name"> 人像面 </view>
  23. <view class="value"> 上传身份证的人像面 </view>
  24. <view class="tip">
  25. <view class="tip-value"> 拍摄规范 </view>
  26. </view>
  27. </view>
  28. <image v-if="!state.form.userPosImgUrl" class="icon" :src="`${$imgUrl}applyCard/renxiang.png`">
  29. </image>
  30. <image v-else class="icon" :src="strReplace(state.form.userPosImgUrl)"></image>
  31. </view>
  32. </view>
  33. <view class="picture-wrapper" @click="takePhotoMode('2','my')">
  34. <view class="bg">
  35. <view class="">
  36. <view class="name"> 国徽面 </view>
  37. <view class="value"> 上传身份证的国徽面 </view>
  38. <view class="tip">
  39. <view class="tip-value"> 拍摄规范 </view>
  40. </view>
  41. </view>
  42. <image v-if="!state.form.userNegImgUrl" class="icon" :src="`${$imgUrl}applyCard/guohui.png`">
  43. </image>
  44. <image v-else class="icon" :src="strReplace(state.form.userNegImgUrl)"></image>
  45. </view>
  46. </view>
  47. <view class="shibie-wrapper">
  48. <view class="title"> 识别内容如下 </view>
  49. <u-form label-width="230" :model="state.form" ref="uForm">
  50. <u-form-item label="姓名">
  51. <u-input v-model="state.form.userName" placeholder='请输入姓名' :disabled="state.isEnableOCRData"
  52. maxlength="20" @input="replaceInput" />
  53. </u-form-item>
  54. <!-- <u-form-item label="性别">
  55. <u-input placeholder='请选择性别' v-model="state.form.gender" @click="userGenderAction()"
  56. type="select" />
  57. </u-form-item> -->
  58. <u-form-item label="身份证号">
  59. <u-input placeholder='请输入身份证' type="idcard" v-model="state.form.userIdNum"
  60. :disabled="state.isEnableOCRData" maxlength="18" />
  61. </u-form-item>
  62. <u-form-item label="地址">
  63. <u-input placeholder='请输入地址' height='38' type='textarea' :autoHeight='true'
  64. v-model="state.form.address" :disabled="state.isEnableOCRData" maxlength="100" />
  65. </u-form-item>
  66. <!-- <u-form-item label="证件有效期">
  67. <u-input v-model="state.form.begindate" type="select" />
  68. </u-form-item> -->
  69. <u-form-item label="联系方式">
  70. <u-input placeholder='请输入联系方式' type="number" v-model="state.form.tel" maxlength="11" />
  71. </u-form-item>
  72. </u-form>
  73. </view>
  74. <view class="green-tip">
  75. 如识别信息有误,请手动修改,确认无误后,点击下一步!
  76. </view>
  77. <view class="action">
  78. <button type="default" class="button" @click="savaHandle()">
  79. 下一步
  80. </button>
  81. </view>
  82. </view>
  83. <view v-else class="content">
  84. <view class="title"> 车主信息 </view>
  85. <view class="item-tips">
  86. <view class="title"> 上传后请核对识别信息 </view>
  87. <view class="tip"> 如有错误请及时手动修改 </view>
  88. </view>
  89. <view class="picture-wrapper" @click="takePhotoMode('1','my')">
  90. <view class="bg">
  91. <view class="">
  92. <view class="name"> 人像面 </view>
  93. <view class="value"> 上传身份证的人像面 </view>
  94. <view class="tip">
  95. <view class="tip-value"> 拍摄规范 </view>
  96. </view>
  97. </view>
  98. <image v-if="!state.form.userPosImgUrl" class="icon" :src="`${$imgUrl}applyCard/renxiang.png`">
  99. </image>
  100. <image v-else class="icon" :src="strReplace(state.form.userPosImgUrl)"></image>
  101. </view>
  102. </view>
  103. <view class="picture-wrapper" @click="takePhotoMode('2','my')">
  104. <view class="bg">
  105. <view class="">
  106. <view class="name"> 国徽面 </view>
  107. <view class="value"> 上传身份证的国徽面 </view>
  108. <view class="tip">
  109. <view class="tip-value"> 拍摄规范 </view>
  110. </view>
  111. </view>
  112. <image v-if="!state.form.userNegImgUrl" class="icon" :src="`${$imgUrl}applyCard/guohui.png`">
  113. </image>
  114. <image v-else class="icon" :src="strReplace(state.form.userNegImgUrl)"></image>
  115. </view>
  116. </view>
  117. <view class="shibie-wrapper">
  118. <view class="title"> 识别内容如下 </view>
  119. <u-form label-width="200" :model="state.form" ref="uForm">
  120. <u-form-item label="姓名">
  121. <u-input inputAlign="right" placeholder='请输入姓名' v-model="state.form.userName"
  122. :disabled="state.isEnableOCRData" maxlength="20" />
  123. </u-form-item>
  124. <!-- <u-form-item label="性别">
  125. <u-input inputAlign="right" placeholder='请选择性别' v-model="state.form.gender" type="select" />
  126. </u-form-item> -->
  127. <u-form-item label="身份证号">
  128. <u-input inputAlign="right" placeholder='请输入身份证号' v-model="state.form.userIdNum"
  129. :disabled="state.isEnableOCRData" type="idcard" />
  130. </u-form-item>
  131. <!-- <u-form-item label="">
  132. <u-input v-model="state.form.userIdNum" />
  133. </u-form-item> -->
  134. <!-- <u-form-item label="证件有效期">
  135. <u-input v-model="state.form.begindate" type="select" />
  136. </u-form-item> -->
  137. <u-form-item label="联系方式">
  138. <u-input inputAlign="right" placeholder='请输入联系方式' v-model="state.form.tel" maxlength="11" />
  139. </u-form-item>
  140. </u-form>
  141. </view>
  142. <view style="margin-top: 30rpx" class="title"> 代办人信息 </view>
  143. <view class="item-tips">
  144. <view class="title"> 上传后请核对识别信息 </view>
  145. <view class="tip"> 如有错误请及时手动修改 </view>
  146. </view>
  147. <view class="picture-wrapper" @click="takePhotoMode('1','other')">
  148. <view class="bg">
  149. <view class="">
  150. <view class="name"> 人像面 </view>
  151. <view class="value"> 上传身份证的人像面 </view>
  152. <view class="tip">
  153. <view class="tip-value"> 拍摄规范 </view>
  154. </view>
  155. </view>
  156. <image v-if="!state.form.agentPosImgUrl" class="icon" :src="`${$imgUrl}applyCard/renxiang.png`">
  157. </image>
  158. <image v-else class="icon" :src="strReplace(state.form.agentPosImgUrl)"></image>
  159. </view>
  160. </view>
  161. <view class="picture-wrapper" @click="takePhotoMode('2','other')">
  162. <view class="bg">
  163. <view class="">
  164. <view class="name"> 国徽面 </view>
  165. <view class="value"> 上传身份证的国徽面 </view>
  166. <view class="tip">
  167. <view class="tip-value"> 拍摄规范 </view>
  168. </view>
  169. </view>
  170. <image v-if="!state.form.agentNegImgUrl" class="icon" :src="`${$imgUrl}applyCard/guohui.png`">
  171. </image>
  172. <image v-else class="icon" :src="strReplace(state.form.agentNegImgUrl)"></image>
  173. </view>
  174. </view>
  175. <view class="picture-wrapper" @click="cardFileImageUpdate()" v-if='state.isEnableBook'>
  176. <view class="bg">
  177. <view class="">
  178. <view class="name"> 委托书 </view>
  179. <view class="value"> 上传文字清晰的委托书 </view>
  180. <view class="tip">
  181. <view class="tip-value"> 拍摄规范 </view>
  182. </view>
  183. </view>
  184. <image v-if="!state.form.proxyUrl" class="icon" :src="`${$imgUrl}applyCard/weituoshu.png`">
  185. </image>
  186. <image v-else class="icon" :src="strReplace(state.form.proxyUrl)"></image>
  187. </view>
  188. </view>
  189. <view class="shibie-wrapper">
  190. <view class="title"> 识别内容如下 </view>
  191. <u-form label-width="200" :model="state.form" ref="uForm">
  192. <u-form-item label="经办人姓名">
  193. <u-input inputAlign="right" placeholder='请输入经办人姓名' v-model="state.form.agentName"
  194. :disabled="state.isEnableOCRData" maxlength="20" />
  195. </u-form-item>
  196. <!-- <u-form-item label="性别">
  197. <u-input v-model="state.form.agentGender" type="select" />
  198. </u-form-item> -->
  199. <u-form-item label="身份证号">
  200. <u-input inputAlign="right" placeholder='请输入身份证号' v-model="state.form.agentIdNum"
  201. :disabled="state.isEnableOCRData" maxlength="18" type="idcard" />
  202. </u-form-item>
  203. <!-- <u-form-item label="证件有效期">
  204. <u-input v-model="state.form.begindate" type="select" />
  205. </u-form-item> -->
  206. <u-form-item label="联系方式">
  207. <u-input inputAlign="right" placeholder='请输入联系方式' v-model="state.form.agentTel" type="number"
  208. maxlength="11" />
  209. </u-form-item>
  210. </u-form>
  211. </view>
  212. <view class="green-tip">
  213. 如识别信息有误,请手动修改,确认无误后,点击下一步!
  214. </view>
  215. <view class="action">
  216. <button type="default" class="button" @click="savaHandle()">
  217. 下一步
  218. </button>
  219. </view>
  220. </view>
  221. <u-select mode="single-column" :list="state.genderList" v-model="state.genderShow" @confirm="genderSelectConfirm">
  222. </u-select>
  223. <view class="choice-takePhoto-wrap" v-if="state.isTakePhotoModeShow" @click="cancle">
  224. <view class="choice-takePhoto">
  225. <view @click.stop="takePhoto(state.choiceIndex)" style="border-radius: 20rpx 20rpx 0 0;">拍照</view>
  226. <view @click.stop="xiangce(state.choiceIndex)">从手机相册选择</view>
  227. <view @click.stop="cancle">取消</view>
  228. </view>
  229. </view>
  230. <viewfinder v-if="state.phoneType" :phoneType="state.phoneType" :images="state.images"
  231. :showStartPhoto="state.showImg" @confirmReturn="confirmReturn" @camera="camera"></viewfinder>
  232. </template>
  233. <script setup lang="ts">
  234. import viewfinder from "../../components/viewfinder.vue"
  235. import navBgCar from "./components/nav-bg-car3";
  236. import {
  237. reactive,
  238. ref,
  239. } from "vue";
  240. import {
  241. msg,
  242. checkStr,
  243. strReplace,
  244. uploadFile
  245. } from "@/utils/utils";
  246. import {
  247. onLoad,
  248. onPageScroll,
  249. } from "@dcloudio/uni-app";
  250. import {
  251. etcOcrCard,
  252. etcUserCardInfoSubmit,
  253. fileUpload,
  254. register,
  255. envs,
  256. getUserMsg,
  257. ocrAllQuery
  258. } from "@/utils/network/api.js";
  259. import {
  260. request
  261. } from "@/utils/network/request.js";
  262. import {
  263. stringToJson
  264. } from "@/utils/network/encryption";
  265. import {
  266. setItem,
  267. getItem,
  268. } from "@/utils/storage";
  269. import {
  270. getCodeName
  271. } from "@/datas/queryKey.js";
  272. import navBar from "@/components/nav-bar/nav-bar2.vue";
  273. const scrollTop = ref(0)
  274. const state = reactive({
  275. showImg: true,
  276. isMy: "",//自己办理 他人办理
  277. phoneType: 0, // 1 身份证正面 2 身份证反面 3行驶证正面 4行驶证反面
  278. choiceIndex: 1, // 1 身份证正面 2 身份证反面
  279. isTakePhotoModeShow: false, //选择拍照方式是否出来
  280. images: '',
  281. genderList: [{
  282. value: '男',
  283. label: '男'
  284. },
  285. {
  286. value: '女',
  287. label: '女'
  288. }
  289. ],
  290. form: {
  291. orderId: "", //订单ID
  292. userName: "", //开户人姓名
  293. userIdType: "101", //用户证件类型 101//身份证
  294. userIdNum: "", //用户证件号码
  295. userPosImgUrl: "", //身份证正面
  296. userNegImgUrl: "", //身份证反面
  297. tel: "", //开户人手机号
  298. address: "", //开户人地址
  299. sceneType: "", //用户协议支撑服务场景(发行服务机构和用户签订的协议)
  300. channelId: "", //渠道id
  301. gender: "",
  302. customerIdVld: "",
  303. agentName: "",
  304. agentGender: "",
  305. agentTel: '',
  306. agentPhone: "",
  307. agentIdType: "101",
  308. agentIdNum: "",
  309. agentPosImgUrl: "",
  310. agentNegImgUrl: "",
  311. proxyUrl: "",
  312. agentAddress: "",
  313. agentIdVld: '',
  314. opId: '',
  315. orderSource: 'WECHAT',
  316. },
  317. genderShow: false,
  318. orderId: "",
  319. vehiclePlateColor: undefined,
  320. isMyPeopple: true,
  321. isSign: '',
  322. type: 1,
  323. isEnableOther: true, //小程序是否支持他人办理
  324. isEnableBook: true, //他人办理时是否上传委托书
  325. isEnableInfo: true, //小程序信息带出
  326. isEnableOCRData: true, //允许修改OCR识别出来的数据
  327. });
  328. const userGenderAction = () => {
  329. state.genderShow = true;
  330. };
  331. const genderSelectConfirm = (e) => {
  332. state.form.gender = ''
  333. e.map((val, index) => {
  334. state.form.gender = val.label;
  335. })
  336. };
  337. const camera = () => {
  338. state.phoneType = 0
  339. }
  340. const savaHandle = () => {
  341. if (!checkStr(state.form.userIdNum, 'card')) {
  342. msg('请输入正确身份证');
  343. return;
  344. }
  345. if (!checkStr(state.form.tel, 'mobile')) {
  346. msg('请输入正确手机号');
  347. return;
  348. }
  349. //如果未登录||新用户
  350. if (!getItem('openId')) {
  351. let data = {
  352. userType: "PERSONAL",
  353. idNum: state.form.userIdNum,
  354. idType: state.form.userIdType,
  355. mobile: state.form.tel,
  356. userName: state.form.userName,
  357. gender: state.form.gender == '男' ? 'MALE' : 'FEMALE',
  358. certifyChannel: "BAIDUOCR",
  359. address: state.form.address,
  360. agentIdNum: state.form.agentIdNum,
  361. agentIdType: state.form.agentIdType,
  362. agentName: state.form.agentName,
  363. department: "",
  364. userIdImgUrl: state.form.userPosImgUrl,
  365. userIdImgBase64: "",
  366. }
  367. const options = {
  368. type: 2,
  369. data: data,
  370. method: "POST",
  371. showLoading: true,
  372. };
  373. request(register, options).then((res) => {
  374. let result = stringToJson(res.bizContent);
  375. if (result.accessToken && result.openId) {
  376. setItem('token', result.accessToken)
  377. setItem('openId', result.openId)
  378. state.form.opId = result.openId;
  379. let data = state.form;
  380. const options = {
  381. type: 2,
  382. data: data,
  383. method: "POST",
  384. showLoading: true,
  385. };
  386. request(etcUserCardInfoSubmit, options).then((res) => {
  387. // let result = stringToJson(res.bizContent);
  388. console.log(res);
  389. uni.redirectTo({
  390. url: `/subpackage/orders/car-release?orderId=${state.orderId}&vehiclePlateColor=${state.vehiclePlateColor}&type=${state.type}&isSign=${state.isSign}`,
  391. });
  392. });
  393. }
  394. })
  395. } else {
  396. // 已经登录
  397. let data = state.form;
  398. const options = {
  399. type: 2,
  400. data: data,
  401. method: "POST",
  402. showLoading: true,
  403. };
  404. request(etcUserCardInfoSubmit, options).then((res) => {
  405. // let result = stringToJson(res.bizContent);
  406. console.log(res);
  407. uni.redirectTo({
  408. url: `/subpackage/orders/car-release?orderId=${state.orderId}&vehiclePlateColor=${state.vehiclePlateColor}&type=${state.type}&isSign=${state.isSign}`,
  409. });
  410. });
  411. }
  412. };
  413. const cardFileImageUpdate = () => {
  414. uni.chooseImage({
  415. count: 1, //只能选取一张照片
  416. sizeType: ["original", "compressed"], //可以指定是原图还是压缩图,默认二者都有
  417. sourceType: ["camera", "album"], //从相册选择
  418. success: function (res) {
  419. uploadFile(res.tempFilePaths[0], "", "").then((data) => {
  420. state.form.proxyUrl = data;
  421. })
  422. },
  423. });
  424. };
  425. //tab切换
  426. const tabChange = (val : any) => {
  427. state.isTakePhotoModeShow = false
  428. if (val) {
  429. state.isMyPeopple = true;
  430. } else {
  431. state.isMyPeopple = false;
  432. }
  433. state.form = {
  434. orderId: state.orderId, //订单ID
  435. userName: "", //开户人姓名
  436. userIdType: "101", //用户证件类型 101//身份证
  437. userIdNum: "", //用户证件号码
  438. userPosImgUrl: "", //身份证正面
  439. userNegImgUrl: "", //身份证反面
  440. tel: "", //开户人手机号
  441. address: "", //开户人地址
  442. sceneType: "", //用户协议支撑服务场景(发行服务机构和用户签订的协议)
  443. channelId: "", //渠道id
  444. gender: "",
  445. customerIdVld: "",
  446. agentName: "",
  447. agentGender: "",
  448. agentTel: '',
  449. agentPhone: "",
  450. agentIdType: "101",
  451. agentIdNum: "",
  452. agentPosImgUrl: "",
  453. agentNegImgUrl: "",
  454. proxyUrl: "",
  455. agentAddress: "",
  456. agentIdVld: '',
  457. };
  458. };
  459. onLoad((option : any) => {
  460. state.form.orderId = option.orderId;
  461. state.orderId = option.orderId;
  462. state.vehiclePlateColor = option.vehiclePlateColor;
  463. state.form.opId = getItem('openId') ? getItem('openId') : '';
  464. state.isSign = option.isSign;
  465. state.type = option.type;
  466. //state.fromOrder = option.fromOrder //是否来自订单-修改资料
  467. getGlobalParam(); //全局配置数据
  468. console.log("option", option)
  469. });
  470. //监听页面滚动
  471. onPageScroll((e) => {
  472. scrollTop.value = e.scrollTop;
  473. });
  474. const replaceInput = (event) => {
  475. console.log("event", event)
  476. const screeningStr = /[^\u4E00-\u9FA5]/g; //想禁止什么类型,在这里替换正则就可以了
  477. if (screeningStr.test(event)) {
  478. setTimeout(() => {
  479. state.form.userName = event.replace(screeningStr, '');
  480. }, 100)
  481. } else {
  482. setTimeout(() => {
  483. state.form.userName = event;
  484. }, 100)
  485. }
  486. console.log("event.replace(screeningStr, '')", event.replace(screeningStr, ''), event, state.form.userName)
  487. }
  488. const getGlobalParam = () => {
  489. const data = getItem('globalParam')
  490. console.log("全局配置数据", getCodeName('IS_ENABLE', data.miniSupportOther), getCodeName('IS_ENABLE', data.otherUploadProxy), getCodeName('IS_ENABLE', data.miniInfoShow), getCodeName('IS_ENABLE', data.changeOCRData))
  491. // 小程序是否支持他人办理
  492. if (getCodeName('IS_ENABLE', data.miniSupportOther) == '启用') {
  493. state.isEnableOther = true;
  494. } else {
  495. state.isEnableOther = false;
  496. }
  497. // 他人办理时是否上传委托书
  498. if (getCodeName('IS_ENABLE', data.otherUploadProxy) == '启用') {
  499. state.isEnableBook = true;
  500. } else {
  501. state.isEnableBook = false;
  502. }
  503. // 小程序信息带出
  504. if (getCodeName('IS_ENABLE', data.miniInfoShow) == '启用') {
  505. state.isEnableInfo = true;
  506. uni.showModal({
  507. // title: '提示',
  508. content: '是否允许带出用户信息',
  509. success: function (res) {
  510. if (res.confirm) {
  511. console.log('用户点击确定');
  512. queryUserMsg() //通过opneId查询用户信息
  513. } else if (res.cancel) {
  514. console.log('用户点击取消');
  515. }
  516. }
  517. });
  518. } else {
  519. state.isEnableInfo = false;
  520. }
  521. // 允许修改OCR识别出来的数据
  522. if (getCodeName('IS_ENABLE', data.changeOCRData) == '启用') {
  523. state.isEnableOCRData = false;
  524. } else {
  525. state.isEnableOCRData = true;
  526. }
  527. }
  528. // 通过opneId查询用户信息
  529. const queryUserMsg = () => {
  530. const options = {
  531. type: 2,
  532. data: {
  533. "openId": getItem('openId')
  534. },
  535. method: "POST",
  536. showLoading: true,
  537. };
  538. request(getUserMsg, options).then((res) => {
  539. console.log("通过opneId查询用户信息", stringToJson(res.bizContent))
  540. const data = stringToJson(res.bizContent);
  541. state.form.userPosImgUrl = data.customerPosImgUrl;
  542. state.form.userNegImgUrl = data.customerNegImgUrl;
  543. state.form.userName = data.customerName;
  544. state.form.userIdNum = data.customerIdNum;
  545. state.form.address = data.customerAddress;
  546. state.form.tel = data.customerTel;
  547. })
  548. }
  549. const takePhotoMode = (index, isMy) => {
  550. console.log("index", index, isMy)
  551. state.isTakePhotoModeShow = true
  552. state.choiceIndex = index
  553. state.isMy = isMy
  554. }
  555. const xiangce = (val) => {
  556. console.log("val", val)
  557. var imageType = val;
  558. uni.chooseImage({
  559. count: 1, //只能选取一张照片
  560. sizeType: ["original", "compressed"], //可以指定是原图还是压缩图,默认二者都有
  561. sourceType: ["album"], //从相册选择
  562. success: function (res) {
  563. state.showImg = false
  564. state.images = res.tempFilePaths[0]
  565. state.phoneType = state.choiceIndex
  566. state.isTakePhotoModeShow = false
  567. console.log("tempFilePaths[0].startsWith('file://')", res.tempFilePaths[0], res.tempFilePaths[0].startsWith('file://'))
  568. },
  569. })
  570. }
  571. const takePhoto = (val) => {
  572. state.showImg = true
  573. console.log("拍照", val)
  574. state.phoneType = val;
  575. }
  576. const confirmReturn = (val) => {
  577. console.log("图片地址val", val)
  578. state.phoneType = 0
  579. state.isTakePhotoModeShow = false
  580. var imageType = state.choiceIndex;
  581. // uploadFile(val.tempImagePath, imageType, ocrAllQuery).then((data) => {
  582. uploadFile(val.tempImagePath, imageType, etcOcrCard).then((data) => {
  583. console.log("身份证上传", data)
  584. if (state.isMy == "my") {
  585. if (state.choiceIndex == "1") {
  586. state.form.userName = data.name;
  587. state.form.gender = data.gender;
  588. state.form.userIdNum = data.idno;
  589. state.form.userPosImgUrl = data.imageUrl;
  590. state.form.address = data.address;
  591. } else {
  592. state.form.customerIdVld = data.enddate;
  593. state.form.userNegImgUrl = data.imageUrl;
  594. }
  595. state.isTakePhotoModeShow = false
  596. } else {
  597. if (state.choiceIndex == "1") {
  598. state.form.agentName = data.name;
  599. state.form.agentGender = data.gender;
  600. state.form.agentIdNum = data.idno;
  601. state.form.agentPosImgUrl = data.imageUrl;
  602. state.form.agentAddress = data.address;
  603. } else {
  604. console.log("state.isMy", state.isMy, state.choiceIndex, state.choiceIndex == "1", data)
  605. state.form.agentIdVld = data.enddate;
  606. state.form.agentNegImgUrl = data.imageUrl;
  607. }
  608. state.isTakePhotoModeShow = false
  609. }
  610. })
  611. }
  612. const cancle = () => {
  613. state.isTakePhotoModeShow = false
  614. }
  615. </script>
  616. <style lang="scss" scoped>
  617. .title {
  618. font-size: 35rpx;
  619. font-family: Microsoft YaHei;
  620. font-weight: 400;
  621. color: #000000;
  622. line-height: 80rpx;
  623. margin-bottom: 10rpx;
  624. }
  625. .content-wrap {
  626. position: relative;
  627. margin-top: -50rpx;
  628. padding: 0rpx 30rpx;
  629. display: flex;
  630. .big {
  631. font-size: 30rpx;
  632. font-family: Microsoft YaHei;
  633. font-weight: 400;
  634. color: #333333;
  635. line-height: 24rpx;
  636. }
  637. .nomal {
  638. font-size: 26rpx;
  639. font-family: Microsoft YaHei;
  640. font-weight: 400;
  641. color: #666666;
  642. line-height: 24rpx;
  643. }
  644. .tip {
  645. margin-top: -5px;
  646. width: 117rpx;
  647. height: 16rpx;
  648. background: #00b38b;
  649. opacity: 0.3;
  650. }
  651. }
  652. .content {
  653. padding: 50rpx 30rpx 50rpx 30rpx;
  654. .action {
  655. padding-left: 20rpx;
  656. padding-right: 20rpx;
  657. padding-bottom: 30rpx;
  658. .button {
  659. height: 80rpx;
  660. background: linear-gradient(-90deg, #43a1e0 0%, #13e7c1 100%);
  661. border-radius: 40rpx;
  662. font-size: 32rpx;
  663. font-weight: 400;
  664. color: #ffffff;
  665. line-height: 80rpx;
  666. }
  667. }
  668. .item-tips {
  669. .title {
  670. font-size: 30rpx;
  671. font-family: Microsoft YaHei;
  672. font-weight: 400;
  673. color: #000000;
  674. line-height: 24rpx;
  675. }
  676. .tip {
  677. margin-top: 16rpx;
  678. font-size: 24rpx;
  679. font-family: Microsoft YaHei;
  680. font-weight: 400;
  681. color: #999999;
  682. line-height: 24rpx;
  683. }
  684. }
  685. .picture-wrapper {
  686. margin-top: 40rpx;
  687. .bg {
  688. background: #ffffff;
  689. box-shadow: 0rpx 4rpx 13rpx 3rpx rgba(223, 223, 223, 0.8);
  690. border-radius: 20rpx;
  691. padding: 40rpx;
  692. display: flex;
  693. // align-items: center;
  694. justify-content: space-between;
  695. .name {
  696. font-size: 34rpx;
  697. font-family: Microsoft YaHei;
  698. font-weight: 400;
  699. color: #000000;
  700. line-height: 34rpx;
  701. }
  702. .value {
  703. margin-top: 20rpx;
  704. font-size: 24rpx;
  705. font-family: Microsoft YaHei;
  706. font-weight: 400;
  707. color: #999999;
  708. line-height: 24rpx;
  709. }
  710. .tip {
  711. margin-top: 20rpx;
  712. text-align: center;
  713. width: 110rpx;
  714. height: 40rpx;
  715. background: rgba(33, 190, 177, 0.2);
  716. border-radius: 6rpx;
  717. .tip-value {
  718. font-size: 20rpx;
  719. font-family: Microsoft YaHei;
  720. font-weight: 400;
  721. color: #0a8f8a;
  722. line-height: 40rpx;
  723. opacity: 1;
  724. }
  725. }
  726. }
  727. .icon {
  728. width: 294rpx;
  729. height: 188rpx;
  730. }
  731. }
  732. .shibie-wrapper {
  733. margin-top: 60rpx;
  734. .title {
  735. font-size: 30rpx;
  736. font-family: Microsoft YaHei;
  737. font-weight: 400;
  738. color: #000000;
  739. line-height: 30rpx;
  740. }
  741. }
  742. .buchong-wrapper {
  743. margin-top: 60rpx;
  744. .title {
  745. font-size: 30rpx;
  746. font-family: Microsoft YaHei;
  747. font-weight: 400;
  748. color: #000000;
  749. line-height: 30rpx;
  750. }
  751. }
  752. .green-tip {
  753. margin-top: 50rpx;
  754. font-size: 24rpx;
  755. font-family: Microsoft YaHei;
  756. font-weight: 400;
  757. color: #00b38b;
  758. line-height: 24rpx;
  759. margin-bottom: 60rpx;
  760. }
  761. }
  762. .choice-takePhoto {
  763. position: absolute;
  764. bottom: 0;
  765. background-color: white;
  766. width: 100%;
  767. border-radius: 20rpx 20rpx 0 0;
  768. }
  769. .choice-takePhoto>view:first-child {
  770. text-align: center;
  771. height: 80rpx;
  772. line-height: 80rpx;
  773. border-bottom: 1rpx solid rgba(127, 127, 127, 0.3);
  774. background-color: white;
  775. }
  776. .choice-takePhoto>view:last-child {
  777. text-align: center;
  778. height: 80rpx;
  779. line-height: 80rpx;
  780. border-top: 6rpx solid rgba(127, 127, 127, 0.1);
  781. background-color: white;
  782. }
  783. .choice-takePhoto>view {
  784. text-align: center;
  785. height: 80rpx;
  786. line-height: 80rpx;
  787. background-color: white;
  788. }
  789. .choice-takePhoto-wrap {
  790. width: 100%;
  791. height: 100vh;
  792. background-color: rgba(127, 127, 127, 0.2);
  793. position: fixed;
  794. left: 0;
  795. top: 0;
  796. z-index: 11111;
  797. }
  798. </style>