您最多选择25个主题 主题必须以字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符

opening-account-people.vue 25KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895
  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. pathToBase64
  238. } from "@/utils/image-tools/index.js";
  239. import {
  240. reactive,
  241. ref,
  242. } from "vue";
  243. import {
  244. msg,
  245. checkStr,
  246. strReplace
  247. } from "@/utils/utils";
  248. import {
  249. onLoad,
  250. onPageScroll,
  251. } from "@dcloudio/uni-app";
  252. import {
  253. etcOcrCard,
  254. etcUserCardInfoSubmit,
  255. fileUpload,
  256. register,
  257. envs,
  258. getUserMsg
  259. } from "@/utils/network/api.js";
  260. import {
  261. request
  262. } from "@/utils/network/request.js";
  263. import {
  264. stringToJson
  265. } from "@/utils/network/encryption";
  266. import {
  267. setItem,
  268. getItem,
  269. } from "@/utils/storage";
  270. import {
  271. getCodeName
  272. } from "@/datas/queryKey.js";
  273. import navBar from "@/components/nav-bar/nav-bar2.vue";
  274. const scrollTop = ref(0)
  275. const state = reactive({
  276. showImg: true,
  277. isMy: "",//自己办理 他人办理
  278. phoneType: 0, // 1 身份证正面 2 身份证反面 3行驶证正面 4行驶证反面
  279. choiceIndex: 1, // 1 身份证正面 2 身份证反面
  280. isTakePhotoModeShow: false, //选择拍照方式是否出来
  281. images: '',
  282. genderList: [{
  283. value: '男',
  284. label: '男'
  285. },
  286. {
  287. value: '女',
  288. label: '女'
  289. }
  290. ],
  291. form: {
  292. orderId: "", //订单ID
  293. userName: "", //开户人姓名
  294. userIdType: "101", //用户证件类型 101//身份证
  295. userIdNum: "", //用户证件号码
  296. userPosImgUrl: "", //身份证正面
  297. userNegImgUrl: "", //身份证反面
  298. tel: "", //开户人手机号
  299. address: "", //开户人地址
  300. sceneType: "", //用户协议支撑服务场景(发行服务机构和用户签订的协议)
  301. channelId: "", //渠道id
  302. gender: "",
  303. customerIdVld: "",
  304. agentName: "",
  305. agentGender: "",
  306. agentTel: '',
  307. agentPhone: "",
  308. agentIdType: "101",
  309. agentIdNum: "",
  310. agentPosImgUrl: "",
  311. agentNegImgUrl: "",
  312. proxyUrl: "",
  313. agentAddress: "",
  314. agentIdVld: '',
  315. opId: '',
  316. orderSource: 'WECHAT',
  317. },
  318. genderShow: false,
  319. orderId: "",
  320. vehiclePlateColor: undefined,
  321. isMyPeopple: true,
  322. isSign: '',
  323. type: 1,
  324. isEnableOther: true, //小程序是否支持他人办理
  325. isEnableBook: true, //他人办理时是否上传委托书
  326. isEnableInfo: true, //小程序信息带出
  327. isEnableOCRData: true, //允许修改OCR识别出来的数据
  328. });
  329. const userGenderAction = () => {
  330. state.genderShow = true;
  331. };
  332. const genderSelectConfirm = (e) => {
  333. state.form.gender = ''
  334. e.map((val, index) => {
  335. state.form.gender = val.label;
  336. })
  337. };
  338. const camera = () => {
  339. state.phoneType = 0
  340. }
  341. const savaHandle = () => {
  342. if (!checkStr(state.form.userIdNum, 'card')) {
  343. msg('请输入正确身份证');
  344. return;
  345. }
  346. if (!checkStr(state.form.tel, 'mobile')) {
  347. msg('请输入正确手机号');
  348. return;
  349. }
  350. //如果未登录||新用户
  351. if (!getItem('openId')) {
  352. let data = {
  353. userType: "PERSONAL",
  354. idNum: state.form.userIdNum,
  355. idType: state.form.userIdType,
  356. mobile: state.form.tel,
  357. userName: state.form.userName,
  358. gender: state.form.gender == '男' ? 'MALE' : 'FEMALE',
  359. certifyChannel: "BAIDUOCR",
  360. address: state.form.address,
  361. agentIdNum: state.form.agentIdNum,
  362. agentIdType: state.form.agentIdType,
  363. agentName: state.form.agentName,
  364. department: "",
  365. userIdImgUrl: state.form.userPosImgUrl,
  366. userIdImgBase64: "",
  367. }
  368. const options = {
  369. type: 2,
  370. data: data,
  371. method: "POST",
  372. showLoading: true,
  373. };
  374. request(register, options).then((res) => {
  375. let result = stringToJson(res.bizContent);
  376. if (result.accessToken && result.openId) {
  377. setItem('token', result.accessToken)
  378. setItem('openId', result.openId)
  379. state.form.opId = result.openId;
  380. let data = state.form;
  381. const options = {
  382. type: 2,
  383. data: data,
  384. method: "POST",
  385. showLoading: true,
  386. };
  387. request(etcUserCardInfoSubmit, options).then((res) => {
  388. // let result = stringToJson(res.bizContent);
  389. console.log(res);
  390. uni.redirectTo({
  391. url: `/subpackage/orders/car-release?orderId=${state.orderId}&vehiclePlateColor=${state.vehiclePlateColor}&type=${state.type}&isSign=${state.isSign}`,
  392. });
  393. });
  394. }
  395. })
  396. } else {
  397. // 已经登录
  398. let data = state.form;
  399. const options = {
  400. type: 2,
  401. data: data,
  402. method: "POST",
  403. showLoading: true,
  404. };
  405. request(etcUserCardInfoSubmit, options).then((res) => {
  406. // let result = stringToJson(res.bizContent);
  407. console.log(res);
  408. uni.redirectTo({
  409. url: `/subpackage/orders/car-release?orderId=${state.orderId}&vehiclePlateColor=${state.vehiclePlateColor}&type=${state.type}&isSign=${state.isSign}`,
  410. });
  411. });
  412. }
  413. };
  414. const cardFileImageUpdate = () => {
  415. uni.chooseImage({
  416. count: 1, //只能选取一张照片
  417. sizeType: ["original", "compressed"], //可以指定是原图还是压缩图,默认二者都有
  418. sourceType: ["camera", "album"], //从相册选择
  419. success: function (res) {
  420. pathToBase64(res.tempFilePaths[0])
  421. .then((path) => {
  422. var data = {
  423. fileBase64: path,
  424. };
  425. const options = {
  426. type: 2,
  427. data: data,
  428. method: "POST",
  429. showLoading: true,
  430. };
  431. request(fileUpload, options).then((res) => {
  432. const data = stringToJson(res.bizContent);
  433. console.log(data);
  434. state.form.proxyUrl = data.data.url;
  435. });
  436. })
  437. .catch((error) => { });
  438. },
  439. });
  440. };
  441. //tab切换
  442. const tabChange = (val : any) => {
  443. state.isTakePhotoModeShow = false
  444. if (val) {
  445. state.isMyPeopple = true;
  446. } else {
  447. state.isMyPeopple = false;
  448. }
  449. state.form = {
  450. orderId: state.orderId, //订单ID
  451. userName: "", //开户人姓名
  452. userIdType: "101", //用户证件类型 101//身份证
  453. userIdNum: "", //用户证件号码
  454. userPosImgUrl: "", //身份证正面
  455. userNegImgUrl: "", //身份证反面
  456. tel: "", //开户人手机号
  457. address: "", //开户人地址
  458. sceneType: "", //用户协议支撑服务场景(发行服务机构和用户签订的协议)
  459. channelId: "", //渠道id
  460. gender: "",
  461. customerIdVld: "",
  462. agentName: "",
  463. agentGender: "",
  464. agentTel: '',
  465. agentPhone: "",
  466. agentIdType: "101",
  467. agentIdNum: "",
  468. agentPosImgUrl: "",
  469. agentNegImgUrl: "",
  470. proxyUrl: "",
  471. agentAddress: "",
  472. agentIdVld: '',
  473. };
  474. };
  475. onLoad((option : any) => {
  476. state.form.orderId = option.orderId;
  477. state.orderId = option.orderId;
  478. state.vehiclePlateColor = option.vehiclePlateColor;
  479. state.form.opId = getItem('openId') ? getItem('openId') : '';
  480. state.isSign = option.isSign;
  481. state.type = option.type;
  482. //state.fromOrder = option.fromOrder //是否来自订单-修改资料
  483. getGlobalParam(); //全局配置数据
  484. console.log("option", option)
  485. });
  486. //监听页面滚动
  487. onPageScroll((e) => {
  488. scrollTop.value = e.scrollTop;
  489. });
  490. const replaceInput = (event) => {
  491. console.log("event", event)
  492. const screeningStr = /[^\u4E00-\u9FA5]/g; //想禁止什么类型,在这里替换正则就可以了
  493. if (screeningStr.test(event)) {
  494. setTimeout(() => {
  495. state.form.userName = event.replace(screeningStr, '');
  496. }, 100)
  497. } else {
  498. setTimeout(() => {
  499. state.form.userName = event;
  500. }, 100)
  501. }
  502. console.log("event.replace(screeningStr, '')", event.replace(screeningStr, ''), event, state.form.userName)
  503. }
  504. const getGlobalParam = () => {
  505. const data = getItem('globalParam')
  506. console.log("全局配置数据", getCodeName('IS_ENABLE', data.miniSupportOther), getCodeName('IS_ENABLE', data.otherUploadProxy), getCodeName('IS_ENABLE', data.miniInfoShow), getCodeName('IS_ENABLE', data.changeOCRData))
  507. // 小程序是否支持他人办理
  508. if (getCodeName('IS_ENABLE', data.miniSupportOther) == '启用') {
  509. state.isEnableOther = true;
  510. } else {
  511. state.isEnableOther = false;
  512. }
  513. // 他人办理时是否上传委托书
  514. if (getCodeName('IS_ENABLE', data.otherUploadProxy) == '启用') {
  515. state.isEnableBook = true;
  516. } else {
  517. state.isEnableBook = false;
  518. }
  519. // 小程序信息带出
  520. if (getCodeName('IS_ENABLE', data.miniInfoShow) == '启用') {
  521. state.isEnableInfo = true;
  522. uni.showModal({
  523. // title: '提示',
  524. content: '是否允许带出用户信息',
  525. success: function (res) {
  526. if (res.confirm) {
  527. console.log('用户点击确定');
  528. queryUserMsg() //通过opneId查询用户信息
  529. } else if (res.cancel) {
  530. console.log('用户点击取消');
  531. }
  532. }
  533. });
  534. } else {
  535. state.isEnableInfo = false;
  536. }
  537. // 允许修改OCR识别出来的数据
  538. if (getCodeName('IS_ENABLE', data.changeOCRData) == '启用') {
  539. state.isEnableOCRData = false;
  540. } else {
  541. state.isEnableOCRData = true;
  542. }
  543. }
  544. // 通过opneId查询用户信息
  545. const queryUserMsg = () => {
  546. const options = {
  547. type: 2,
  548. data: {
  549. "openId": getItem('openId')
  550. },
  551. method: "POST",
  552. showLoading: true,
  553. };
  554. request(getUserMsg, options).then((res) => {
  555. console.log("通过opneId查询用户信息", stringToJson(res.bizContent))
  556. const data = stringToJson(res.bizContent);
  557. state.form.userPosImgUrl = data.customerPosImgUrl;
  558. state.form.userNegImgUrl = data.customerNegImgUrl;
  559. state.form.userName = data.customerName;
  560. state.form.userIdNum = data.customerIdNum;
  561. state.form.address = data.customerAddress;
  562. state.form.tel = data.customerTel;
  563. })
  564. }
  565. const takePhotoMode = (index, isMy) => {
  566. console.log("index", index, isMy)
  567. state.isTakePhotoModeShow = true
  568. state.choiceIndex = index
  569. state.isMy = isMy
  570. }
  571. const xiangce = (val) => {
  572. console.log("val", val)
  573. var imageType = val;
  574. uni.chooseImage({
  575. count: 1, //只能选取一张照片
  576. sizeType: ["original", "compressed"], //可以指定是原图还是压缩图,默认二者都有
  577. sourceType: ["album"], //从相册选择
  578. success: function (res) {
  579. state.showImg = false
  580. state.images = res.tempFilePaths[0]
  581. state.phoneType = state.choiceIndex
  582. state.isTakePhotoModeShow = false
  583. console.log("tempFilePaths[0].startsWith('file://')", res.tempFilePaths[0], res.tempFilePaths[0].startsWith('file://'))
  584. },
  585. })
  586. }
  587. const takePhoto = (val) => {
  588. state.showImg = true
  589. console.log("拍照", val)
  590. state.phoneType = val;
  591. }
  592. const confirmReturn = (val) => {
  593. state.phoneType = 0
  594. state.isTakePhotoModeShow = false
  595. var imageType = state.choiceIndex;
  596. console.log("图片地址val", val.tempImagePath)
  597. uni.uploadFile({
  598. url: 'https://qtzl.etcjz.cn/minIo/upload', //仅为示例,非真实的接口地址
  599. filePath: val.tempImagePath,
  600. name: 'file',
  601. formData: {
  602. 'user': 'test',
  603. "bucket": 'default-bucket'
  604. },
  605. success: (uploadFileRes) => {
  606. let uploadFileImage = 'http://100.64.2.113:9000' + '/default-bucket/' + JSON.parse(uploadFileRes.data).data.ossFilePath
  607. console.log("111", JSON.parse(uploadFileRes.data).data.ossFilePath);
  608. var data = {
  609. source: "1",
  610. agencyId: "52010106004",
  611. imageType: imageType,
  612. fileName: val.tempImagePath,
  613. url: uploadFileImage
  614. };
  615. const options = {
  616. type: 2,
  617. data: data,
  618. method: "POST",
  619. showLoading: true,
  620. };
  621. console.log('输出内容=====123')
  622. request(etcOcrCard, options).then((res) => {
  623. const data = stringToJson(res.bizContent);
  624. if (state.isMy == "my") {
  625. if (state.choiceIndex == "1") {
  626. state.form.userName = data.name;
  627. state.form.gender = data.gender;
  628. state.form.userIdNum = data.idno;
  629. state.form.userPosImgUrl = data.imageUrl;
  630. state.form.address = data.address;
  631. } else {
  632. state.form.customerIdVld = data.enddate;
  633. state.form.userNegImgUrl = data.imageUrl;
  634. }
  635. state.isTakePhotoModeShow = false
  636. } else {
  637. if (state.choiceIndex == "1") {
  638. state.form.agentName = data.name;
  639. state.form.agentGender = data.gender;
  640. state.form.agentIdNum = data.idno;
  641. state.form.agentPosImgUrl = data.imageUrl;
  642. state.form.agentAddress = data.address;
  643. } else {
  644. console.log("state.isMy", state.isMy, state.choiceIndex, state.choiceIndex == "1", data)
  645. state.form.agentIdVld = data.enddate;
  646. state.form.agentNegImgUrl = data.imageUrl;
  647. }
  648. state.isTakePhotoModeShow = false
  649. }
  650. });
  651. }
  652. });
  653. }
  654. const cancle = () => {
  655. state.isTakePhotoModeShow = false
  656. }
  657. </script>
  658. <style lang="scss" scoped>
  659. .title {
  660. font-size: 35rpx;
  661. font-family: Microsoft YaHei;
  662. font-weight: 400;
  663. color: #000000;
  664. line-height: 80rpx;
  665. margin-bottom: 10rpx;
  666. }
  667. .content-wrap {
  668. position: relative;
  669. margin-top: -50rpx;
  670. padding: 0rpx 30rpx;
  671. display: flex;
  672. .big {
  673. font-size: 30rpx;
  674. font-family: Microsoft YaHei;
  675. font-weight: 400;
  676. color: #333333;
  677. line-height: 24rpx;
  678. }
  679. .nomal {
  680. font-size: 26rpx;
  681. font-family: Microsoft YaHei;
  682. font-weight: 400;
  683. color: #666666;
  684. line-height: 24rpx;
  685. }
  686. .tip {
  687. margin-top: -5px;
  688. width: 117rpx;
  689. height: 16rpx;
  690. background: #00b38b;
  691. opacity: 0.3;
  692. }
  693. }
  694. .content {
  695. padding: 50rpx 30rpx 50rpx 30rpx;
  696. .action {
  697. padding-left: 20rpx;
  698. padding-right: 20rpx;
  699. padding-bottom: 30rpx;
  700. .button {
  701. height: 80rpx;
  702. background: linear-gradient(-90deg, #43a1e0 0%, #13e7c1 100%);
  703. border-radius: 40rpx;
  704. font-size: 32rpx;
  705. font-weight: 400;
  706. color: #ffffff;
  707. line-height: 80rpx;
  708. }
  709. }
  710. .item-tips {
  711. .title {
  712. font-size: 30rpx;
  713. font-family: Microsoft YaHei;
  714. font-weight: 400;
  715. color: #000000;
  716. line-height: 24rpx;
  717. }
  718. .tip {
  719. margin-top: 16rpx;
  720. font-size: 24rpx;
  721. font-family: Microsoft YaHei;
  722. font-weight: 400;
  723. color: #999999;
  724. line-height: 24rpx;
  725. }
  726. }
  727. .picture-wrapper {
  728. margin-top: 40rpx;
  729. .bg {
  730. background: #ffffff;
  731. box-shadow: 0rpx 4rpx 13rpx 3rpx rgba(223, 223, 223, 0.8);
  732. border-radius: 20rpx;
  733. padding: 40rpx;
  734. display: flex;
  735. // align-items: center;
  736. justify-content: space-between;
  737. .name {
  738. font-size: 34rpx;
  739. font-family: Microsoft YaHei;
  740. font-weight: 400;
  741. color: #000000;
  742. line-height: 34rpx;
  743. }
  744. .value {
  745. margin-top: 20rpx;
  746. font-size: 24rpx;
  747. font-family: Microsoft YaHei;
  748. font-weight: 400;
  749. color: #999999;
  750. line-height: 24rpx;
  751. }
  752. .tip {
  753. margin-top: 20rpx;
  754. text-align: center;
  755. width: 110rpx;
  756. height: 40rpx;
  757. background: rgba(33, 190, 177, 0.2);
  758. border-radius: 6rpx;
  759. .tip-value {
  760. font-size: 20rpx;
  761. font-family: Microsoft YaHei;
  762. font-weight: 400;
  763. color: #0a8f8a;
  764. line-height: 40rpx;
  765. opacity: 1;
  766. }
  767. }
  768. }
  769. .icon {
  770. width: 294rpx;
  771. height: 188rpx;
  772. }
  773. }
  774. .shibie-wrapper {
  775. margin-top: 60rpx;
  776. .title {
  777. font-size: 30rpx;
  778. font-family: Microsoft YaHei;
  779. font-weight: 400;
  780. color: #000000;
  781. line-height: 30rpx;
  782. }
  783. }
  784. .buchong-wrapper {
  785. margin-top: 60rpx;
  786. .title {
  787. font-size: 30rpx;
  788. font-family: Microsoft YaHei;
  789. font-weight: 400;
  790. color: #000000;
  791. line-height: 30rpx;
  792. }
  793. }
  794. .green-tip {
  795. margin-top: 50rpx;
  796. font-size: 24rpx;
  797. font-family: Microsoft YaHei;
  798. font-weight: 400;
  799. color: #00b38b;
  800. line-height: 24rpx;
  801. margin-bottom: 60rpx;
  802. }
  803. }
  804. .choice-takePhoto {
  805. position: absolute;
  806. bottom: 0;
  807. background-color: white;
  808. width: 100%;
  809. border-radius: 20rpx 20rpx 0 0;
  810. }
  811. .choice-takePhoto>view:first-child {
  812. text-align: center;
  813. height: 80rpx;
  814. line-height: 80rpx;
  815. border-bottom: 1rpx solid rgba(127, 127, 127, 0.3);
  816. background-color: white;
  817. }
  818. .choice-takePhoto>view:last-child {
  819. text-align: center;
  820. height: 80rpx;
  821. line-height: 80rpx;
  822. border-top: 6rpx solid rgba(127, 127, 127, 0.1);
  823. background-color: white;
  824. }
  825. .choice-takePhoto>view {
  826. text-align: center;
  827. height: 80rpx;
  828. line-height: 80rpx;
  829. background-color: white;
  830. }
  831. .choice-takePhoto-wrap {
  832. width: 100%;
  833. height: 100vh;
  834. background-color: rgba(127, 127, 127, 0.2);
  835. position: fixed;
  836. left: 0;
  837. top: 0;
  838. z-index: 11111;
  839. }
  840. </style>