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

opening-account-people.vue 25KB

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