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.

upload-card.vue 17KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695
  1. <template>
  2. <view class="picture-wrapper" @click="takePhotoMode('3')">
  3. <view class="bg">
  4. <view class="">
  5. <view class="name"> 行驶证主页 </view>
  6. <view class="value"> 上传行驶证的主页 </view>
  7. <view class="tip">
  8. <view class="tip-value"> 拍摄规范 </view>
  9. </view>
  10. </view>
  11. <image v-if="!form.licenseFrontUrl" class="icon" :src="`${$imgUrl}applyCard/car-zhu.png`">
  12. </image>
  13. <image v-else class="icon" :src="strReplace(form.licenseFrontUrl)"></image>
  14. </view>
  15. </view>
  16. <view class="picture-wrapper" @click="takePhotoMode('4')">
  17. <view class="bg">
  18. <view class="">
  19. <view class="name"> 行驶证副页 </view>
  20. <view class="value"> 上传行驶证的副页 </view>
  21. <view class="tip">
  22. <view class="tip-value"> 拍摄规范 </view>
  23. </view>
  24. </view>
  25. <image v-if="!form.licenseReverseUrl" class="icon" :src="`${$imgUrl}applyCard/car-fu.png`">
  26. </image>
  27. <image v-else class="icon" :src="strReplace(form.licenseReverseUrl)"></image>
  28. </view>
  29. </view>
  30. <view class="upload-box">
  31. <u-form :model="form" ref="myForm" :error-type="errorType">
  32. <view class="from">
  33. <view class="title"> 请填写注销原因 </view>
  34. <u-form-item prop="remark">
  35. <view class="from_item">
  36. <text><text style="color: red"></text>注销原因:</text>
  37. <view style="display: flex">
  38. <u-input v-model="form.ReasonCancellation" @click="showPicker()" class="input" disabled
  39. placeholder="请选择" />
  40. <u-icon name="arrow-right" style="margin-left: 10px;display: flex;"></u-icon>
  41. </view>
  42. </view>
  43. </u-form-item>
  44. </view>
  45. </u-form>
  46. <!-- <view v-if="form.cancelList">
  47. <view class="message">退款信息</view>
  48. <view class="list-item">
  49. <view>
  50. <view><text>姓名:</text><text>{{form.cancelList.cusName}}</text></view>
  51. <view><text>开户行:</text><text>{{bankData[form.cancelList.bankType]}}</text></view>
  52. <view><text>开户行支行:</text><text>{{form.cancelList.branchName}}</text></view>
  53. <view><text>银行卡号:</text><text>{{form.cancelList.bankCardId}}</text></view>
  54. </view>
  55. <view class="change" @click="next()">></view>
  56. </view>
  57. </view> -->
  58. <!-- <button class="submit" @click="next()" v-if="form.isShow">下一步</button> -->
  59. <button class="submit" @click="toPage()">注销</button>
  60. <view>
  61. <!-- 原因 -->
  62. <u-select v-model="show" mode="single-column" :list="list" @confirm="confirm"></u-select>
  63. </view>
  64. <view class="choice-takePhoto-wrap" v-if="state.isTakePhotoModeShow" @click="cancle">
  65. <view class="choice-takePhoto">
  66. <view @click.stop="takePhoto(state.choiceIndex)" style="border-radius: 20rpx 20rpx 0 0;">拍照</view>
  67. <view @click.stop="xiangce(state.choiceIndex)">从手机相册选择</view>
  68. <view @click.stop="cancle">取消</view>
  69. </view>
  70. </view>
  71. <viewfinder v-if="state.phoneType" :phoneType="state.phoneType" :images="state.images"
  72. :showStartPhoto="state.showImg" @confirmReturn="confirmReturn" @camera="camera"></viewfinder>
  73. </view>
  74. </template>
  75. <script lang="ts" setup>
  76. import {
  77. reactive,
  78. ref
  79. } from "vue";
  80. import {
  81. onLoad,
  82. onShow,
  83. onUnload,
  84. onReady,
  85. } from "@dcloudio/uni-app";
  86. import {
  87. navTo,
  88. msg, strReplace, uploadFile,
  89. chooseImageCompress
  90. } from "@/utils/utils";
  91. import {
  92. request, requestNew
  93. } from "@/utils/network/request.js";
  94. import {
  95. writeCardBack,
  96. cancelCancelApply, vehicleLicenseOcr
  97. } from "@/utils/network/api.js";
  98. import {
  99. stringToJson
  100. } from "@/utils/network/encryption.js";
  101. const bluetoothUtil = require("../../../static/etcUtil/index.js");
  102. import { getItem } from "@/utils/storage";
  103. import { bankData } from "@/subpackage/after-sale/js/bank.js";
  104. import viewfinder from "../../../components/viewfinder.vue"
  105. // 表单数据
  106. const form = reactive({
  107. userType: "",
  108. obuId: '',
  109. cardId: '',
  110. orderId: '',
  111. ReasonCancellation: "",
  112. equipmentState: '2',//无设备注销
  113. licenseFrontUrl: "", //行驶证正面
  114. licenseReverseUrl: "",//行驶证反面
  115. customerIdnum: "",
  116. mobile: "",
  117. isShow: true,//储值卡要去下一步填写信息,记账卡直接注销
  118. cancelList: "",
  119. });
  120. const state = reactive({
  121. phoneType: 0, // 1 身份证正面 2 身份证反面 3行驶证正面 4行驶证反面
  122. choiceIndex: 1, // 1 身份证正面 2 身份证反面
  123. isTakePhotoModeShow: false, //选择拍照方式是否出来
  124. changeColor: false,
  125. showImg: true,
  126. images: '',
  127. })
  128. const list = reactive([]);
  129. // 验证提示类型(toast要版本为1.3.5才支持)
  130. const errorType = ["border-bottom", "toast"];
  131. // 设置验证规则
  132. const myForm = ref(null);
  133. onReady(() => {
  134. });
  135. onShow(() => {
  136. uni.$once('list', (query) => {
  137. console.log("111", query)
  138. form.cancelList = query.item
  139. form.isShow = false
  140. })
  141. })
  142. onLoad((option) => {
  143. let options = JSON.parse(decodeURIComponent(option.params))
  144. form.obuId = options.obuId;
  145. form.cardId = options.cardId;
  146. form.orderId = options.orderId
  147. // form.equipmentState = options.equipmentState
  148. form.mobile = options.mobile
  149. form.customerIdnum = options.customerIdnum
  150. form.userType = options.userType
  151. if (form.cardId) {
  152. if (form.cardId.substring(8, 10) == "22") {
  153. form.isShow = true
  154. } else {
  155. form.isShow = false
  156. }
  157. }
  158. console.log("options.orderId", options, getItem('key')['LOGOFF'], "52011328220201990787".substring(8, 10))
  159. // 获取注销原因
  160. for (var k = 0; k < getItem('key')['LOGOFF'].length; k++) {
  161. var obj = {};
  162. obj['value'] = getItem('key')['LOGOFF'][k]['name']
  163. obj['label'] = getItem('key')['LOGOFF'][k]['name']
  164. list.push(obj)
  165. }
  166. console.log("list", list)
  167. /*监听蓝牙回调*/
  168. // uni.$on('bluetoothLink', function (status) {
  169. // queryCardSignCancellation(1, 1, 1).then((item : any) => {
  170. // console.log("item========", item)
  171. // if(item.signResult=='1'){
  172. // instructAction(item).then(value => {
  173. // console.log('orderStatus=======', value.orderStatus)
  174. // })
  175. // }else{
  176. // uni.showModal({
  177. // title: '提示',
  178. // content: item.reason,
  179. // success: function (res) {
  180. // if (res.confirm) {
  181. // console.log('用户点击确定');
  182. // } else if (res.cancel) {
  183. // console.log('用户点击取消');
  184. // }
  185. // }
  186. // });
  187. // }
  188. // })
  189. // })
  190. });
  191. onUnload(() => {
  192. /*移除监听*/
  193. uni.$off('bluetoothLink')
  194. });
  195. const show = ref(false);
  196. const showPicker = function () {
  197. show.value = true;
  198. };
  199. // 选择物流
  200. const confirm = (e) => {
  201. console.log(e);
  202. form.ReasonCancellation = e[0].value;
  203. };
  204. const toPage = () => {
  205. //参数说明
  206. let options = {};
  207. // if (form.equipmentState === '1') {
  208. // navTo("/pages/bluetooth/bluetooth?routeType=5");
  209. // } else {
  210. queryCardSignCancellation(2, 2, 0).then((item : any) => {
  211. // if(item.signResult=='1'){
  212. navTo(`/subpackage/after-sale/ETC-log-off/log-off-result?type=2`);
  213. // }else{
  214. // uni.showModal({
  215. // title: '提示',
  216. // content: item.reason,
  217. // success: function (res) {
  218. // if (res.confirm) {
  219. // console.log('用户点击确定');
  220. // } else if (res.cancel) {
  221. // console.log('用户点击取消');
  222. // }
  223. // }
  224. // });
  225. // }
  226. })
  227. // }
  228. };
  229. /*指令返回*/
  230. // const instructAction = (data) => {
  231. // let cmdArr = data.command.split(",");
  232. // console.log("cmdArr=========", cmdArr);
  233. // bluetoothUtil.transCmd(cmdArr, "10", function (res) {
  234. // console.log("透传");
  235. // console.log(res);
  236. // var arraylenth = res.length;
  237. // var status = res[arraylenth - 1].substring(
  238. // res[arraylenth - 1].length - 4,
  239. // res[arraylenth - 1].length
  240. // );
  241. // console.log("打印指令状态");
  242. // console.log(status);
  243. // var formes = {
  244. // command: data.command,
  245. // response: res.toString(),
  246. // cosRecordId: data.cosRecordId,
  247. // cardId: form.cardId,
  248. // cosType: 9 //1- 开卡. 2- 修改卡内信息 4- 卡签绑定 9- 销卡
  249. // };
  250. // const options = {
  251. // type: 2,
  252. // data: formes,
  253. // method: "POST",
  254. // showLoading: true,
  255. // };
  256. // return new Promise(async (resolve, reject) => {
  257. // const res = await request(writeCardBack, options);
  258. // const data = stringToJson(res.bizContent);
  259. // console.log('data--------------', data)
  260. // if (status === "9000") {
  261. // if (data.orderStatus === 1) {
  262. // instructAction(data)
  263. // } else {
  264. // navTo(`/subpackage/after-sale/ETC-log-off/log-off-result?type=1`);
  265. // }
  266. // resolve(data);
  267. // } else {
  268. // reject("指令执行失败!");
  269. // }
  270. // }).catch((error) => {
  271. // reject(error);
  272. // });
  273. // });
  274. // };
  275. //注销申请
  276. const queryCardSignCancellation = (hasCard, hasObu, cosProvider) => {
  277. if (!form.licenseFrontUrl) {
  278. msg("请上传行驶证的主页");
  279. return;
  280. }
  281. if (!form.licenseReverseUrl) {
  282. msg("请上传行驶证的副页");
  283. return;
  284. }
  285. if (!form.ReasonCancellation) {
  286. msg("请选择注销原因");
  287. return;
  288. }
  289. // if (form.orderId) {
  290. // var options = {
  291. // type: 2, //type: 2,JSON格式提交数据(默认表单形式提交)
  292. // data: {
  293. // hasCard: hasCard,
  294. // hasObu: hasObu,
  295. // cosProvider: cosProvider,
  296. // cardId: form.cardId, //卡号
  297. // obuId: form.obuId, //签号
  298. // serviceType: 3, //注销类型 1-卡注销,2-签注销,3-卡签注销
  299. // orderId: form.orderId, //订单编号
  300. // signReason: form.ReasonCancellation,
  301. // licenseFrontUrl: form.licenseFrontUrl,
  302. // licenseReverseUrl: form.licenseReverseUrl,
  303. // signId: form.cancelList.id
  304. // }, //请求参数
  305. // method: "POST", //提交方式(默认POST)
  306. // showLoading: true, //是否显示加载中(默认显示)
  307. // };
  308. // } else {
  309. var options = {
  310. type: 2, //type: 2,JSON格式提交数据(默认表单形式提交)
  311. data: {
  312. hasCard: hasCard,
  313. hasObu: hasObu,
  314. cosProvider: cosProvider,
  315. cardId: form.cardId, //卡号
  316. obuId: form.obuId, //签号
  317. serviceType: 3, //注销类型 1-卡注销,2-签注销,3-卡签注销
  318. signReason: form.ReasonCancellation,
  319. licenseFrontUrl: form.licenseFrontUrl,
  320. licenseReverseUrl: form.licenseReverseUrl,
  321. signId: form.cancelList.id,
  322. cancelImgUrl:"1" //要删掉
  323. }, //请求参数
  324. method: "POST", //提交方式(默认POST)
  325. showLoading: true, //是否显示加载中(默认显示)
  326. };
  327. // }
  328. console.log("options", options)
  329. return new Promise(async (resolve, reject) => {
  330. const res = await requestNew(cancelCancelApply, options);
  331. const data =res;
  332. console.log("注销申请此接口可能有问题", data)
  333. resolve(data);
  334. }).catch((error) => {
  335. reject(error);
  336. });
  337. }
  338. const next = () => {
  339. if (!form.licenseFrontUrl) {
  340. msg("请上传行驶证的主页");
  341. return;
  342. }
  343. if (!form.licenseReverseUrl) {
  344. msg("请上传行驶证的副页");
  345. return;
  346. }
  347. if (!form.ReasonCancellation) {
  348. msg("请选择注销原因");
  349. return;
  350. }
  351. navTo(`/subpackage/after-sale/ETC-log-off/refund-information-list?mobile=${form.mobile}&&customerIdnum=${form.customerIdnum}&&userType=${form.userType}`);
  352. }
  353. const xiangce = (val) => {
  354. console.log("val", val)
  355. if (state.choiceIndex == 3) {
  356. var imageType = 1;
  357. } else {
  358. var imageType = 2;
  359. }
  360. state.changeColor = true;
  361. chooseImageCompress((res)=>{
  362. state.images = res.tempFilePath?res.tempFilePath:res.tempFilePaths[0]
  363. state.showImg = false
  364. state.phoneType = state.choiceIndex
  365. state.isTakePhotoModeShow = false
  366. })
  367. }
  368. const takePhoto = (val) => {
  369. console.log("拍照", val)
  370. state.phoneType = val;
  371. state.showImg = true;
  372. }
  373. const confirmReturn = (val) => {
  374. if (state.choiceIndex == 3) {
  375. var imageType = 1;
  376. } else {
  377. var imageType = 2;
  378. }
  379. state.changeColor = true;
  380. state.phoneType = 0
  381. state.isTakePhotoModeShow = false
  382. uploadFile(val.tempImagePath, imageType, vehicleLicenseOcr).then((data) => {
  383. console.log('输出内容=====================', state.choiceIndex,data)
  384. if (state.choiceIndex === "3") {
  385. form.licenseFrontUrl = data.imageUrl;
  386. } else {
  387. form.licenseReverseUrl = data.imageUrl;
  388. console.log('=====================', state)
  389. }
  390. state.isTakePhotoModeShow = false
  391. })
  392. console.log("图片地址val", val.tempImagePath)
  393. }
  394. const takePhotoMode = (index) => {
  395. console.log("index", index)
  396. state.isTakePhotoModeShow = true
  397. state.choiceIndex = index
  398. }
  399. const cancle = () => {
  400. state.isTakePhotoModeShow = false
  401. }
  402. const camera = () => {
  403. state.phoneType = 0
  404. }
  405. </script>
  406. <style>
  407. page {
  408. width: 100%;
  409. height: 100%;
  410. background-color: #EEF7F7;
  411. }
  412. </style>
  413. <style lang="scss" scoped>
  414. .upload-box {
  415. width: 92%;
  416. margin: 30rpx auto;
  417. .head-tips {
  418. text-indent: 2rem;
  419. font-size: 26rpx;
  420. font-family: Microsoft YaHei;
  421. font-weight: 400;
  422. color: #666666;
  423. line-height: 50rpx;
  424. margin-bottom: 45rpx;
  425. text {
  426. color: #ff8000;
  427. }
  428. }
  429. .upload-card {
  430. margin-bottom: 70rpx;
  431. height: 260rpx;
  432. background: #ffffff;
  433. box-shadow: 0rpx 4rpx 13rpx 3rpx rgba(223, 223, 223, 0.8);
  434. border-radius: 20rpx;
  435. padding: 30rpx;
  436. display: flex;
  437. justify-content: space-between;
  438. .card-left {
  439. .item1 {
  440. font-size: 34rpx;
  441. font-family: Microsoft YaHei;
  442. font-weight: 400;
  443. color: #000000;
  444. margin-bottom: 30rpx;
  445. }
  446. .item2 {
  447. font-size: 24rpx;
  448. font-family: Microsoft YaHei;
  449. font-weight: 400;
  450. color: #999999;
  451. margin-bottom: 30rpx;
  452. }
  453. .item3 {
  454. width: 110rpx;
  455. height: 40rpx;
  456. background: #ecfbf8;
  457. border-radius: 6rpx;
  458. font-size: 20rpx;
  459. font-family: Microsoft YaHei;
  460. font-weight: 400;
  461. text-align: center;
  462. line-height: 40rpx;
  463. color: #0a8f8a;
  464. }
  465. }
  466. image {
  467. width: 295rpx;
  468. height: 188rpx;
  469. }
  470. }
  471. .from {
  472. background-color: #fff;
  473. margin-top: 30rpx;
  474. border-radius: 20rpx;
  475. padding: 10rpx 20rpx;
  476. box-sizing: border-box;
  477. ::v-deep .u-form-item {
  478. padding: 0;
  479. line-height: normal;
  480. .u-form-item__message {
  481. margin-bottom: 12rpx;
  482. }
  483. }
  484. .title {
  485. font-size: 30rpx;
  486. font-family: Microsoft YaHei;
  487. font-weight: 400;
  488. color: #000000;
  489. margin: 38rpx 0;
  490. }
  491. .from_item {
  492. display: flex;
  493. flex-wrap: nowrap;
  494. justify-content: space-between;
  495. align-items: center;
  496. height: 80rpx;
  497. border-bottom: 1rpx solid #dcdcdc;
  498. ::v-deep .input {
  499. text-align: right;
  500. flex: 1;
  501. input {
  502. text-align: right;
  503. }
  504. }
  505. }
  506. .from_item1 {
  507. display: flex;
  508. flex-wrap: nowrap;
  509. flex-direction: column;
  510. justify-content: space-between;
  511. padding: 30rpx;
  512. border-bottom: #dcdcdc 1px solid;
  513. input {
  514. text-align: right;
  515. }
  516. .textarea {
  517. background-color: #f1f1f1;
  518. width: 100%;
  519. border-radius: 20rpx;
  520. margin-top: 10rpx;
  521. text-indent: 1rem;
  522. height: 180rpx;
  523. padding: 20rpx;
  524. box-sizing: border-box;
  525. }
  526. }
  527. }
  528. .submit {
  529. height: 80rpx;
  530. background: linear-gradient(-90deg, #43a1e0 0%, #13e7c1 100%);
  531. border-radius: 40rpx;
  532. font-size: 32rpx;
  533. font-family: Microsoft YaHei;
  534. font-weight: 400;
  535. color: #ffffff;
  536. line-height: 80rpx;
  537. margin: 60rpx auto;
  538. }
  539. }
  540. .picture-wrapper {
  541. width: 92%;
  542. margin: 0 auto;
  543. margin-top: 40rpx;
  544. .bg {
  545. background: #ffffff;
  546. box-shadow: 0rpx 4rpx 13rpx 3rpx rgba(223, 223, 223, 0.8);
  547. border-radius: 20rpx;
  548. padding: 40rpx;
  549. display: flex;
  550. justify-content: space-between;
  551. .name {
  552. font-size: 34rpx;
  553. font-family: Microsoft YaHei;
  554. font-weight: 400;
  555. color: #000000;
  556. line-height: 34rpx;
  557. }
  558. .value {
  559. margin-top: 20rpx;
  560. font-size: 24rpx;
  561. font-family: Microsoft YaHei;
  562. font-weight: 400;
  563. color: #999999;
  564. line-height: 24rpx;
  565. }
  566. .tip {
  567. margin-top: 20rpx;
  568. text-align: center;
  569. width: 110rpx;
  570. height: 40rpx;
  571. background: rgba(33, 190, 177, 0.2);
  572. border-radius: 6rpx;
  573. .tip-value {
  574. font-size: 20rpx;
  575. font-family: Microsoft YaHei;
  576. font-weight: 400;
  577. color: #0a8f8a;
  578. line-height: 40rpx;
  579. opacity: 1;
  580. }
  581. }
  582. }
  583. .icon {
  584. width: 294rpx;
  585. height: 188rpx;
  586. }
  587. }
  588. .list-item {
  589. width: 100%;
  590. border-radius: 10rpx;
  591. margin: 0 auto;
  592. font-size: 28rpx;
  593. border: 1rpx solid #ccc;
  594. padding: 20rpx;
  595. box-sizing: border-box;
  596. background-color: white;
  597. margin-bottom: 28rpx;
  598. display: flex;
  599. align-items: center;
  600. justify-content: space-between;
  601. }
  602. .message {
  603. font-size: 32rpx;
  604. margin: 40rpx 0 20rpx 0;
  605. font-weight: bold;
  606. }
  607. .choice-takePhoto {
  608. position: absolute;
  609. bottom: 0;
  610. background-color: white;
  611. width: 100%;
  612. border-radius: 20rpx 20rpx 0 0;
  613. }
  614. .choice-takePhoto>view:first-child {
  615. text-align: center;
  616. height: 80rpx;
  617. line-height: 80rpx;
  618. border-bottom: 1rpx solid rgba(127, 127, 127, 0.3);
  619. background-color: white;
  620. }
  621. .choice-takePhoto>view:last-child {
  622. text-align: center;
  623. height: 80rpx;
  624. line-height: 80rpx;
  625. border-top: 6rpx solid rgba(127, 127, 127, 0.1);
  626. background-color: white;
  627. }
  628. .choice-takePhoto>view {
  629. text-align: center;
  630. height: 80rpx;
  631. line-height: 80rpx;
  632. background-color: white;
  633. }
  634. .choice-takePhoto-wrap {
  635. width: 100%;
  636. height: 100vh;
  637. background-color: rgba(127, 127, 127, 0.2);
  638. position: fixed;
  639. left: 0;
  640. top: 0;
  641. z-index: 11111;
  642. }
  643. </style>