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

upload-card.vue 17KB

1年前
1年前
1年前
1年前
1年前
1年前
1年前
1年前
1年前
1年前
1年前
1年前
1年前
1年前
1年前
1年前
1年前
1年前
1年前
1年前
1年前
1年前
1年前
1年前
1年前
1年前
1年前
1年前
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699
  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()" v-else>注销</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. checkStr,
  89. msg, strReplace, uploadFile, compressImage
  90. } from "@/utils/utils";
  91. import {
  92. request
  93. } from "@/utils/network/request.js";
  94. import {
  95. writeCardBack,
  96. CardSignCancellation, etcCarOcrCard
  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 "@/datas/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: '',
  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. instructAction(item).then(value => {
  172. console.log('orderStatus=======', value.orderStatus)
  173. })
  174. })
  175. })
  176. });
  177. onUnload(() => {
  178. /*移除监听*/
  179. uni.$off('bluetoothLink')
  180. });
  181. const show = ref(false);
  182. const showPicker = function () {
  183. show.value = true;
  184. };
  185. // 选择物流
  186. const confirm = (e) => {
  187. console.log(e);
  188. form.ReasonCancellation = e[0].value;
  189. };
  190. const toPage = () => {
  191. //参数说明
  192. let options = {};
  193. if (form.equipmentState === '1') {
  194. navTo("/pages/bluetooth/bluetooth?routeType=5");
  195. } else {
  196. queryCardSignCancellation(2, 2, 0).then((item : any) => {
  197. navTo(`/subpackage/after-sale/ETC-log-off/log-off-result?type=2`);
  198. })
  199. }
  200. };
  201. /*指令返回*/
  202. const instructAction = (data) => {
  203. let cmdArr = data.command.split(",");
  204. console.log("cmdArr=========", cmdArr);
  205. bluetoothUtil.transCmd(cmdArr, "10", function (res) {
  206. console.log("透传");
  207. console.log(res);
  208. var arraylenth = res.length;
  209. var status = res[arraylenth - 1].substring(
  210. res[arraylenth - 1].length - 4,
  211. res[arraylenth - 1].length
  212. );
  213. console.log("打印指令状态");
  214. console.log(status);
  215. var formes = {
  216. command: data.command,
  217. response: res.toString(),
  218. cosRecordId: data.cosRecordId,
  219. cardId: form.cardId,
  220. cosType: 9 //1- 开卡. 2- 修改卡内信息 4- 卡签绑定 9- 销卡
  221. };
  222. const options = {
  223. type: 2,
  224. data: formes,
  225. method: "POST",
  226. showLoading: true,
  227. };
  228. return new Promise(async (resolve, reject) => {
  229. const res = await request(writeCardBack, options);
  230. const data = stringToJson(res.bizContent);
  231. console.log('data--------------', data)
  232. if (status === "9000") {
  233. if (data.orderStatus === 1) {
  234. instructAction(data)
  235. } else {
  236. navTo(`/subpackage/after-sale/ETC-log-off/log-off-result?type=1`);
  237. }
  238. resolve(data);
  239. } else {
  240. reject("指令执行失败!");
  241. }
  242. }).catch((error) => {
  243. reject(error);
  244. });
  245. });
  246. };
  247. //注销申请
  248. const queryCardSignCancellation = (hasCard, hasObu, cosProvider) => {
  249. if (!form.licenseFrontUrl) {
  250. msg("请上传行驶证的主页");
  251. return;
  252. }
  253. if (!form.licenseReverseUrl) {
  254. msg("请上传行驶证的副页");
  255. return;
  256. }
  257. if (!form.ReasonCancellation) {
  258. msg("请选择注销原因");
  259. return;
  260. }
  261. if (form.orderId) {
  262. var options = {
  263. type: 2, //type: 2,JSON格式提交数据(默认表单形式提交)
  264. data: {
  265. hasCard: hasCard,
  266. hasObu: hasObu,
  267. cosProvider: cosProvider,
  268. cardId: form.cardId, //卡号
  269. obuId: form.obuId, //签号
  270. serviceType: 3, //注销类型 1-卡注销,2-签注销,3-卡签注销
  271. orderId: form.orderId, //订单编号
  272. signReason: form.ReasonCancellation,
  273. licenseFrontUrl: form.licenseFrontUrl,
  274. licenseReverseUrl: form.licenseReverseUrl,
  275. signId: form.cancelList.id
  276. }, //请求参数
  277. method: "POST", //提交方式(默认POST)
  278. showLoading: true, //是否显示加载中(默认显示)
  279. };
  280. } else {
  281. var options = {
  282. type: 2, //type: 2,JSON格式提交数据(默认表单形式提交)
  283. data: {
  284. hasCard: hasCard,
  285. hasObu: hasObu,
  286. cosProvider: cosProvider,
  287. cardId: form.cardId, //卡号
  288. obuId: form.obuId, //签号
  289. serviceType: 3, //注销类型 1-卡注销,2-签注销,3-卡签注销
  290. signReason: form.ReasonCancellation,
  291. licenseFrontUrl: form.licenseFrontUrl,
  292. licenseReverseUrl: form.licenseReverseUrl,
  293. signId: form.cancelList.id
  294. }, //请求参数
  295. method: "POST", //提交方式(默认POST)
  296. showLoading: true, //是否显示加载中(默认显示)
  297. };
  298. }
  299. console.log("options", options)
  300. return new Promise(async (resolve, reject) => {
  301. const res = await request(CardSignCancellation, options);
  302. const data = stringToJson(res.bizContent);
  303. console.log("注销申请此接口可能有问题", data)
  304. resolve(data);
  305. }).catch((error) => {
  306. reject(error);
  307. });
  308. }
  309. const next = () => {
  310. if (!form.licenseFrontUrl) {
  311. msg("请上传行驶证的主页");
  312. return;
  313. }
  314. if (!form.licenseReverseUrl) {
  315. msg("请上传行驶证的副页");
  316. return;
  317. }
  318. if (!form.ReasonCancellation) {
  319. msg("请选择注销原因");
  320. return;
  321. }
  322. navTo(`/subpackage/after-sale/ETC-log-off/refund-information-list?mobile=${form.mobile}&&customerIdnum=${form.customerIdnum}&&userType=${form.userType}`);
  323. }
  324. const xiangce = (val) => {
  325. console.log("val", val)
  326. if (state.choiceIndex == 3) {
  327. var imageType = 1;
  328. } else {
  329. var imageType = 2;
  330. }
  331. state.changeColor = true;
  332. uni.chooseImage({
  333. count: 1, //只能选取一张照片
  334. sizeType: ["original", "compressed"], //可以指定是原图还是压缩图,默认二者都有
  335. sourceType: ["album"], //从相册选择
  336. success: function (res) {
  337. console.log("tempFilePaths[0].startsWith('file://')", res.tempFilePaths[0], res.tempFilePaths[0].startsWith('file://'))
  338. compressImage(res.tempFilePaths[0], (res) => {
  339. console.log("过来了", res)
  340. if (state.choiceIndex == 3) {
  341. form.licenseFrontUrl = res.tempFilePath;
  342. } else {
  343. form.licenseReverseUrl = res.tempFilePath;
  344. }
  345. state.phoneType = state.choiceIndex
  346. state.showImg = false
  347. state.isTakePhotoModeShow = false
  348. })
  349. },
  350. })
  351. }
  352. const takePhoto = (val) => {
  353. console.log("拍照", val)
  354. state.phoneType = val;
  355. state.showImg = true;
  356. }
  357. const confirmReturn = (val) => {
  358. if (state.choiceIndex == 3) {
  359. var imageType = 1;
  360. } else {
  361. var imageType = 2;
  362. }
  363. state.changeColor = true;
  364. state.phoneType = 0
  365. state.isTakePhotoModeShow = false
  366. uploadFile(val.tempImagePath, imageType, etcCarOcrCard).then((data) => {
  367. // uploadFile(val.tempImagePath, state.choiceIndex, ocrAllQuery).then((data) => {
  368. console.log('输出内容=====================', state.choiceIndex)
  369. if (state.choiceIndex === "3") {
  370. form.licenseFrontUrl = data.imageUrl;
  371. } else {
  372. form.licenseReverseUrl = data.imageUrl;
  373. console.log('=====================', state.form.vehNegImgUrl, state)
  374. }
  375. state.isTakePhotoModeShow = false
  376. })
  377. console.log("图片地址val", val.tempImagePath)
  378. }
  379. const takePhotoMode = (index) => {
  380. console.log("index", index)
  381. state.isTakePhotoModeShow = true
  382. state.choiceIndex = index
  383. }
  384. const cancle = () => {
  385. state.isTakePhotoModeShow = false
  386. }
  387. const camera = () => {
  388. state.phoneType = 0
  389. }
  390. </script>
  391. <style>
  392. page {
  393. width: 100%;
  394. height: 100%;
  395. background-color: #EEF7F7;
  396. }
  397. </style>
  398. <style lang="scss" scoped>
  399. .upload-box {
  400. width: 92%;
  401. margin: 30rpx auto;
  402. .head-tips {
  403. text-indent: 2rem;
  404. font-size: 26rpx;
  405. font-family: Microsoft YaHei;
  406. font-weight: 400;
  407. color: #666666;
  408. line-height: 50rpx;
  409. margin-bottom: 45rpx;
  410. text {
  411. color: #ff8000;
  412. }
  413. }
  414. .upload-card {
  415. margin-bottom: 70rpx;
  416. height: 260rpx;
  417. background: #ffffff;
  418. box-shadow: 0rpx 4rpx 13rpx 3rpx rgba(223, 223, 223, 0.8);
  419. border-radius: 20rpx;
  420. padding: 30rpx;
  421. display: flex;
  422. justify-content: space-between;
  423. .card-left {
  424. .item1 {
  425. font-size: 34rpx;
  426. font-family: Microsoft YaHei;
  427. font-weight: 400;
  428. color: #000000;
  429. margin-bottom: 30rpx;
  430. }
  431. .item2 {
  432. font-size: 24rpx;
  433. font-family: Microsoft YaHei;
  434. font-weight: 400;
  435. color: #999999;
  436. margin-bottom: 30rpx;
  437. }
  438. .item3 {
  439. width: 110rpx;
  440. height: 40rpx;
  441. background: #ecfbf8;
  442. border-radius: 6rpx;
  443. font-size: 20rpx;
  444. font-family: Microsoft YaHei;
  445. font-weight: 400;
  446. text-align: center;
  447. line-height: 40rpx;
  448. color: #0a8f8a;
  449. }
  450. }
  451. image {
  452. width: 295rpx;
  453. height: 188rpx;
  454. }
  455. }
  456. .from {
  457. background-color: #fff;
  458. margin-top: 30rpx;
  459. border-radius: 20rpx;
  460. padding: 10rpx 20rpx;
  461. box-sizing: border-box;
  462. ::v-deep .u-form-item {
  463. padding: 0;
  464. line-height: normal;
  465. .u-form-item__message {
  466. margin-bottom: 12rpx;
  467. }
  468. }
  469. .title {
  470. font-size: 30rpx;
  471. font-family: Microsoft YaHei;
  472. font-weight: 400;
  473. color: #000000;
  474. margin: 38rpx 0;
  475. }
  476. .from_item {
  477. display: flex;
  478. flex-wrap: nowrap;
  479. justify-content: space-between;
  480. align-items: center;
  481. height: 80rpx;
  482. border-bottom: 1rpx solid #dcdcdc;
  483. ::v-deep .input {
  484. text-align: right;
  485. flex: 1;
  486. input {
  487. text-align: right;
  488. }
  489. }
  490. }
  491. .from_item1 {
  492. display: flex;
  493. flex-wrap: nowrap;
  494. flex-direction: column;
  495. justify-content: space-between;
  496. padding: 30rpx;
  497. border-bottom: #dcdcdc 1px solid;
  498. input {
  499. text-align: right;
  500. }
  501. .textarea {
  502. background-color: #f1f1f1;
  503. width: 100%;
  504. border-radius: 20rpx;
  505. margin-top: 10rpx;
  506. text-indent: 1rem;
  507. height: 180rpx;
  508. padding: 20rpx;
  509. box-sizing: border-box;
  510. }
  511. }
  512. }
  513. .submit {
  514. height: 80rpx;
  515. background: linear-gradient(-90deg, #43a1e0 0%, #13e7c1 100%);
  516. border-radius: 40rpx;
  517. font-size: 32rpx;
  518. font-family: Microsoft YaHei;
  519. font-weight: 400;
  520. color: #ffffff;
  521. line-height: 80rpx;
  522. margin: 60rpx auto;
  523. }
  524. }
  525. .picture-wrapper {
  526. width: 92%;
  527. margin: 0 auto;
  528. margin-top: 40rpx;
  529. .bg {
  530. background: #ffffff;
  531. box-shadow: 0rpx 4rpx 13rpx 3rpx rgba(223, 223, 223, 0.8);
  532. border-radius: 20rpx;
  533. padding: 40rpx;
  534. display: flex;
  535. justify-content: space-between;
  536. .name {
  537. font-size: 34rpx;
  538. font-family: Microsoft YaHei;
  539. font-weight: 400;
  540. color: #000000;
  541. line-height: 34rpx;
  542. }
  543. .value {
  544. margin-top: 20rpx;
  545. font-size: 24rpx;
  546. font-family: Microsoft YaHei;
  547. font-weight: 400;
  548. color: #999999;
  549. line-height: 24rpx;
  550. }
  551. .tip {
  552. margin-top: 20rpx;
  553. text-align: center;
  554. width: 110rpx;
  555. height: 40rpx;
  556. background: rgba(33, 190, 177, 0.2);
  557. border-radius: 6rpx;
  558. .tip-value {
  559. font-size: 20rpx;
  560. font-family: Microsoft YaHei;
  561. font-weight: 400;
  562. color: #0a8f8a;
  563. line-height: 40rpx;
  564. opacity: 1;
  565. }
  566. }
  567. }
  568. .icon {
  569. width: 294rpx;
  570. height: 188rpx;
  571. }
  572. }
  573. .list-item {
  574. width: 100%;
  575. border-radius: 10rpx;
  576. margin: 0 auto;
  577. font-size: 28rpx;
  578. border: 1rpx solid #ccc;
  579. padding: 20rpx;
  580. box-sizing: border-box;
  581. background-color: white;
  582. margin-bottom: 28rpx;
  583. display: flex;
  584. align-items: center;
  585. justify-content: space-between;
  586. }
  587. .message {
  588. font-size: 32rpx;
  589. margin: 40rpx 0 20rpx 0;
  590. font-weight: bold;
  591. }
  592. .change {
  593. // display: flex;
  594. // text-align: center;
  595. // justify-content: flex-end;
  596. // width: 100%;
  597. }
  598. // .change>view {
  599. // height: 60rpx;
  600. // background: linear-gradient(-90deg, #43a1e0 0%, #13e7c1 100%);
  601. // border-radius: 40rpx;
  602. // font-size: 32rpx;
  603. // font-family: Microsoft YaHei;
  604. // color: #ffffff;
  605. // line-height: 60rpx;
  606. // width: 25%;
  607. // }
  608. .choice-takePhoto {
  609. position: absolute;
  610. bottom: 0;
  611. background-color: white;
  612. width: 100%;
  613. border-radius: 20rpx 20rpx 0 0;
  614. }
  615. .choice-takePhoto>view:first-child {
  616. text-align: center;
  617. height: 80rpx;
  618. line-height: 80rpx;
  619. border-bottom: 1rpx solid rgba(127, 127, 127, 0.3);
  620. background-color: white;
  621. }
  622. .choice-takePhoto>view:last-child {
  623. text-align: center;
  624. height: 80rpx;
  625. line-height: 80rpx;
  626. border-top: 6rpx solid rgba(127, 127, 127, 0.1);
  627. background-color: white;
  628. }
  629. .choice-takePhoto>view {
  630. text-align: center;
  631. height: 80rpx;
  632. line-height: 80rpx;
  633. background-color: white;
  634. }
  635. .choice-takePhoto-wrap {
  636. width: 100%;
  637. height: 100vh;
  638. background-color: rgba(127, 127, 127, 0.2);
  639. position: fixed;
  640. left: 0;
  641. top: 0;
  642. z-index: 11111;
  643. }
  644. </style>