123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699 |
- <template>
- <view class="picture-wrapper" @click="takePhotoMode('3')">
- <view class="bg">
- <view class="">
- <view class="name"> 行驶证主页 </view>
- <view class="value"> 上传行驶证的主页 </view>
- <view class="tip">
- <view class="tip-value"> 拍摄规范 </view>
- </view>
- </view>
-
- <image v-if="!form.licenseFrontUrl" class="icon" :src="`${$imgUrl}applyCard/car-zhu.png`">
- </image>
- <image v-else class="icon" :src="strReplace(form.licenseFrontUrl)"></image>
- </view>
- </view>
- <view class="picture-wrapper" @click="takePhotoMode('4')">
- <view class="bg">
- <view class="">
- <view class="name"> 行驶证副页 </view>
- <view class="value"> 上传行驶证的副页 </view>
- <view class="tip">
- <view class="tip-value"> 拍摄规范 </view>
- </view>
- </view>
- <image v-if="!form.licenseReverseUrl" class="icon" :src="`${$imgUrl}applyCard/car-fu.png`">
- </image>
- <image v-else class="icon" :src="strReplace(form.licenseReverseUrl)"></image>
- </view>
- </view>
- <view class="upload-box">
- <u-form :model="form" ref="myForm" :error-type="errorType">
- <view class="from">
- <view class="title"> 请填写注销原因 </view>
- <u-form-item prop="remark">
- <view class="from_item">
- <text><text style="color: red"></text>注销原因:</text>
- <view style="display: flex">
- <u-input v-model="form.ReasonCancellation" @click="showPicker()" class="input" disabled
- placeholder="请选择" />
- <u-icon name="arrow-right" style="margin-left: 10px;display: flex;"></u-icon>
- </view>
- </view>
- </u-form-item>
- </view>
- </u-form>
- <view v-if="form.cancelList">
- <view class="message">退款信息</view>
- <view class="list-item">
- <view>
- <view><text>姓名:</text><text>{{form.cancelList.cusName}}</text></view>
- <view><text>开户行:</text><text>{{bankData[form.cancelList.bankType]}}</text></view>
- <view><text>开户行支行:</text><text>{{form.cancelList.branchName}}</text></view>
- <view><text>银行卡号:</text><text>{{form.cancelList.bankCardId}}</text></view>
- </view>
-
- <view class="change" @click="next()">></view>
-
- </view>
- </view>
-
- <button class="submit" @click="next()" v-if="form.isShow">下一步</button>
- <button class="submit" @click="toPage()" v-else>注销</button>
- <view>
- <!-- 原因 -->
- <u-select v-model="show" mode="single-column" :list="list" @confirm="confirm"></u-select>
- </view>
- <view class="choice-takePhoto-wrap" v-if="state.isTakePhotoModeShow" @click="cancle">
- <view class="choice-takePhoto">
- <view @click.stop="takePhoto(state.choiceIndex)" style="border-radius: 20rpx 20rpx 0 0;">拍照</view>
- <view @click.stop="xiangce(state.choiceIndex)">从手机相册选择</view>
- <view @click.stop="cancle">取消</view>
- </view>
- </view>
- <viewfinder v-if="state.phoneType" :phoneType="state.phoneType" :images="state.images"
- :showStartPhoto="state.showImg" @confirmReturn="confirmReturn" @camera="camera"></viewfinder>
- </view>
- </template>
-
- <script lang="ts" setup>
- import {
- reactive,
- ref
- } from "vue";
- import {
- onLoad,
- onShow,
- onUnload,
- onReady,
- } from "@dcloudio/uni-app";
- import {
- navTo,
- checkStr,
- msg, strReplace, uploadFile, compressImage
- } from "@/utils/utils";
- import {
- request
- } from "@/utils/network/request.js";
- import {
- writeCardBack,
- CardSignCancellation, etcCarOcrCard
- } from "@/utils/network/api.js";
- import {
- stringToJson
- } from "@/utils/network/encryption.js";
- const bluetoothUtil = require("../../../static/etcUtil/index.js");
- import { getItem } from "@/utils/storage";
- import { bankData } from "@/datas/bank.js";
- import viewfinder from "../../../components/viewfinder.vue"
- // 表单数据
- const form = reactive({
- userType: "",
- obuId: '',
- cardId: '',
- orderId: '',
- ReasonCancellation: "",
- equipmentState: '',
- licenseFrontUrl: "", //行驶证正面
- licenseReverseUrl: "",//行驶证反面
- customerIdnum: "",
- mobile: "",
- isShow: true,//储值卡要去下一步填写信息,记账卡直接注销
- cancelList: "",
- });
- const state = reactive({
- phoneType: 0, // 1 身份证正面 2 身份证反面 3行驶证正面 4行驶证反面
- choiceIndex: 1, // 1 身份证正面 2 身份证反面
- isTakePhotoModeShow: false, //选择拍照方式是否出来
- changeColor: false,
- showImg: true,
- images: '',
- })
- const list = reactive([]);
-
- // 验证提示类型(toast要版本为1.3.5才支持)
- const errorType = ["border-bottom", "toast"];
-
- // 设置验证规则
- const myForm = ref(null);
-
- onReady(() => {
-
- });
- onShow(() => {
- uni.$once('list', (query) => {
- console.log("111", query)
- form.cancelList = query.item
- form.isShow = false
- })
- })
- onLoad((option) => {
- let options = JSON.parse(decodeURIComponent(option.params))
- form.obuId = options.obuId;
- form.cardId = options.cardId;
- form.orderId = options.orderId
- form.equipmentState = options.equipmentState
- form.mobile = options.mobile
- form.customerIdnum = options.customerIdnum
- form.userType = options.userType
- if (form.cardId) {
- if (form.cardId.substring(8, 10) == "22") {
- form.isShow = true
- } else {
- form.isShow = false
- }
- }
-
- console.log("options.orderId", options, getItem('key')['LOGOFF'], "52011328220201990787".substring(8, 10))
- // 获取注销原因
- for (var k = 0; k < getItem('key')['LOGOFF'].length; k++) {
- var obj = {};
- obj['value'] = getItem('key')['LOGOFF'][k]['name']
- obj['label'] = getItem('key')['LOGOFF'][k]['name']
- list.push(obj)
- }
- console.log("list", list)
- /*监听蓝牙回调*/
- uni.$on('bluetoothLink', function (status) {
- queryCardSignCancellation(1, 1, 1).then((item : any) => {
- console.log("item========", item)
- instructAction(item).then(value => {
- console.log('orderStatus=======', value.orderStatus)
-
- })
- })
- })
- });
- onUnload(() => {
- /*移除监听*/
- uni.$off('bluetoothLink')
-
-
- });
- const show = ref(false);
-
- const showPicker = function () {
- show.value = true;
-
- };
- // 选择物流
- const confirm = (e) => {
- console.log(e);
- form.ReasonCancellation = e[0].value;
- };
-
- const toPage = () => {
- //参数说明
- let options = {};
- if (form.equipmentState === '1') {
- navTo("/pages/bluetooth/bluetooth?routeType=5");
-
- } else {
- queryCardSignCancellation(2, 2, 0).then((item : any) => {
- navTo(`/subpackage/after-sale/ETC-log-off/log-off-result?type=2`);
- })
- }
- };
-
- /*指令返回*/
- const instructAction = (data) => {
-
- let cmdArr = data.command.split(",");
- console.log("cmdArr=========", cmdArr);
- bluetoothUtil.transCmd(cmdArr, "10", function (res) {
- console.log("透传");
- console.log(res);
- var arraylenth = res.length;
- var status = res[arraylenth - 1].substring(
- res[arraylenth - 1].length - 4,
- res[arraylenth - 1].length
- );
- console.log("打印指令状态");
- console.log(status);
- var formes = {
- command: data.command,
- response: res.toString(),
- cosRecordId: data.cosRecordId,
- cardId: form.cardId,
- cosType: 9 //1- 开卡. 2- 修改卡内信息 4- 卡签绑定 9- 销卡
- };
- const options = {
- type: 2,
- data: formes,
- method: "POST",
- showLoading: true,
- };
- return new Promise(async (resolve, reject) => {
- const res = await request(writeCardBack, options);
- const data = stringToJson(res.bizContent);
- console.log('data--------------', data)
- if (status === "9000") {
- if (data.orderStatus === 1) {
- instructAction(data)
- } else {
- navTo(`/subpackage/after-sale/ETC-log-off/log-off-result?type=1`);
- }
- resolve(data);
- } else {
- reject("指令执行失败!");
- }
- }).catch((error) => {
- reject(error);
- });
- });
- };
-
- //注销申请
- const queryCardSignCancellation = (hasCard, hasObu, cosProvider) => {
- if (!form.licenseFrontUrl) {
- msg("请上传行驶证的主页");
- return;
- }
- if (!form.licenseReverseUrl) {
- msg("请上传行驶证的副页");
- return;
- }
- if (!form.ReasonCancellation) {
- msg("请选择注销原因");
- return;
- }
- if (form.orderId) {
- var options = {
- type: 2, //type: 2,JSON格式提交数据(默认表单形式提交)
- data: {
- hasCard: hasCard,
- hasObu: hasObu,
- cosProvider: cosProvider,
- cardId: form.cardId, //卡号
- obuId: form.obuId, //签号
- serviceType: 3, //注销类型 1-卡注销,2-签注销,3-卡签注销
- orderId: form.orderId, //订单编号
- signReason: form.ReasonCancellation,
- licenseFrontUrl: form.licenseFrontUrl,
- licenseReverseUrl: form.licenseReverseUrl,
- signId: form.cancelList.id
- }, //请求参数
- method: "POST", //提交方式(默认POST)
- showLoading: true, //是否显示加载中(默认显示)
- };
- } else {
- var options = {
- type: 2, //type: 2,JSON格式提交数据(默认表单形式提交)
- data: {
- hasCard: hasCard,
- hasObu: hasObu,
- cosProvider: cosProvider,
- cardId: form.cardId, //卡号
- obuId: form.obuId, //签号
- serviceType: 3, //注销类型 1-卡注销,2-签注销,3-卡签注销
- signReason: form.ReasonCancellation,
- licenseFrontUrl: form.licenseFrontUrl,
- licenseReverseUrl: form.licenseReverseUrl,
- signId: form.cancelList.id
- }, //请求参数
- method: "POST", //提交方式(默认POST)
- showLoading: true, //是否显示加载中(默认显示)
- };
- }
- console.log("options", options)
- return new Promise(async (resolve, reject) => {
- const res = await request(CardSignCancellation, options);
- const data = stringToJson(res.bizContent);
- console.log("注销申请此接口可能有问题", data)
- resolve(data);
- }).catch((error) => {
- reject(error);
- });
- }
- const next = () => {
- if (!form.licenseFrontUrl) {
- msg("请上传行驶证的主页");
- return;
- }
- if (!form.licenseReverseUrl) {
- msg("请上传行驶证的副页");
- return;
- }
- if (!form.ReasonCancellation) {
- msg("请选择注销原因");
- return;
- }
- navTo(`/subpackage/after-sale/ETC-log-off/refund-information-list?mobile=${form.mobile}&&customerIdnum=${form.customerIdnum}&&userType=${form.userType}`);
- }
- const xiangce = (val) => {
- console.log("val", val)
- if (state.choiceIndex == 3) {
- var imageType = 1;
- } else {
- var imageType = 2;
- }
- state.changeColor = true;
- uni.chooseImage({
- count: 1, //只能选取一张照片
- sizeType: ["original", "compressed"], //可以指定是原图还是压缩图,默认二者都有
- sourceType: ["album"], //从相册选择
- success: function (res) {
- console.log("tempFilePaths[0].startsWith('file://')", res.tempFilePaths[0], res.tempFilePaths[0].startsWith('file://'))
- compressImage(res.tempFilePaths[0], (res) => {
- console.log("过来了", res)
- if (state.choiceIndex == 3) {
- form.licenseFrontUrl = res.tempFilePath;
- } else {
- form.licenseReverseUrl = res.tempFilePath;
- }
- state.phoneType = state.choiceIndex
- state.showImg = false
- state.isTakePhotoModeShow = false
- })
- },
- })
- }
- const takePhoto = (val) => {
- console.log("拍照", val)
- state.phoneType = val;
- state.showImg = true;
- }
- const confirmReturn = (val) => {
- if (state.choiceIndex == 3) {
- var imageType = 1;
- } else {
- var imageType = 2;
- }
- state.changeColor = true;
- state.phoneType = 0
- state.isTakePhotoModeShow = false
- uploadFile(val.tempImagePath, imageType, etcCarOcrCard).then((data) => {
- // uploadFile(val.tempImagePath, state.choiceIndex, ocrAllQuery).then((data) => {
- console.log('输出内容=====================', state.choiceIndex)
- if (state.choiceIndex === "3") {
- form.licenseFrontUrl = data.imageUrl;
- } else {
- form.licenseReverseUrl = data.imageUrl;
- console.log('=====================', state.form.vehNegImgUrl, state)
- }
- state.isTakePhotoModeShow = false
- })
- console.log("图片地址val", val.tempImagePath)
- }
- const takePhotoMode = (index) => {
- console.log("index", index)
- state.isTakePhotoModeShow = true
- state.choiceIndex = index
- }
- const cancle = () => {
- state.isTakePhotoModeShow = false
- }
- const camera = () => {
- state.phoneType = 0
- }
- </script>
-
- <style>
- page {
- width: 100%;
- height: 100%;
- background-color: #EEF7F7;
- }
- </style>
- <style lang="scss" scoped>
- .upload-box {
- width: 92%;
- margin: 30rpx auto;
-
- .head-tips {
- text-indent: 2rem;
- font-size: 26rpx;
- font-family: Microsoft YaHei;
- font-weight: 400;
- color: #666666;
- line-height: 50rpx;
- margin-bottom: 45rpx;
-
- text {
- color: #ff8000;
- }
- }
-
- .upload-card {
- margin-bottom: 70rpx;
- height: 260rpx;
- background: #ffffff;
- box-shadow: 0rpx 4rpx 13rpx 3rpx rgba(223, 223, 223, 0.8);
- border-radius: 20rpx;
- padding: 30rpx;
- display: flex;
- justify-content: space-between;
-
- .card-left {
- .item1 {
- font-size: 34rpx;
- font-family: Microsoft YaHei;
- font-weight: 400;
- color: #000000;
- margin-bottom: 30rpx;
- }
-
- .item2 {
- font-size: 24rpx;
- font-family: Microsoft YaHei;
- font-weight: 400;
- color: #999999;
- margin-bottom: 30rpx;
- }
-
- .item3 {
- width: 110rpx;
- height: 40rpx;
- background: #ecfbf8;
- border-radius: 6rpx;
- font-size: 20rpx;
- font-family: Microsoft YaHei;
- font-weight: 400;
- text-align: center;
- line-height: 40rpx;
- color: #0a8f8a;
- }
- }
-
- image {
- width: 295rpx;
- height: 188rpx;
- }
- }
-
- .from {
- background-color: #fff;
- margin-top: 30rpx;
- border-radius: 20rpx;
- padding: 10rpx 20rpx;
- box-sizing: border-box;
-
- ::v-deep .u-form-item {
- padding: 0;
- line-height: normal;
-
- .u-form-item__message {
- margin-bottom: 12rpx;
- }
- }
-
- .title {
- font-size: 30rpx;
- font-family: Microsoft YaHei;
- font-weight: 400;
- color: #000000;
- margin: 38rpx 0;
- }
-
- .from_item {
- display: flex;
- flex-wrap: nowrap;
- justify-content: space-between;
- align-items: center;
- height: 80rpx;
- border-bottom: 1rpx solid #dcdcdc;
-
- ::v-deep .input {
- text-align: right;
- flex: 1;
-
- input {
- text-align: right;
- }
- }
- }
-
- .from_item1 {
- display: flex;
- flex-wrap: nowrap;
- flex-direction: column;
- justify-content: space-between;
- padding: 30rpx;
- border-bottom: #dcdcdc 1px solid;
-
- input {
- text-align: right;
- }
-
- .textarea {
- background-color: #f1f1f1;
- width: 100%;
- border-radius: 20rpx;
- margin-top: 10rpx;
- text-indent: 1rem;
- height: 180rpx;
- padding: 20rpx;
- box-sizing: border-box;
- }
- }
- }
-
- .submit {
- height: 80rpx;
- background: linear-gradient(-90deg, #43a1e0 0%, #13e7c1 100%);
- border-radius: 40rpx;
- font-size: 32rpx;
- font-family: Microsoft YaHei;
- font-weight: 400;
- color: #ffffff;
- line-height: 80rpx;
- margin: 60rpx auto;
- }
- }
-
- .picture-wrapper {
- width: 92%;
- margin: 0 auto;
- margin-top: 40rpx;
-
- .bg {
- background: #ffffff;
- box-shadow: 0rpx 4rpx 13rpx 3rpx rgba(223, 223, 223, 0.8);
- border-radius: 20rpx;
- padding: 40rpx;
- display: flex;
- justify-content: space-between;
-
- .name {
- font-size: 34rpx;
- font-family: Microsoft YaHei;
- font-weight: 400;
- color: #000000;
- line-height: 34rpx;
- }
-
- .value {
- margin-top: 20rpx;
- font-size: 24rpx;
- font-family: Microsoft YaHei;
- font-weight: 400;
- color: #999999;
- line-height: 24rpx;
- }
-
- .tip {
- margin-top: 20rpx;
- text-align: center;
- width: 110rpx;
- height: 40rpx;
- background: rgba(33, 190, 177, 0.2);
- border-radius: 6rpx;
-
- .tip-value {
- font-size: 20rpx;
- font-family: Microsoft YaHei;
- font-weight: 400;
- color: #0a8f8a;
- line-height: 40rpx;
- opacity: 1;
- }
- }
- }
-
- .icon {
- width: 294rpx;
- height: 188rpx;
- }
- }
-
- .list-item {
- width: 100%;
- border-radius: 10rpx;
- margin: 0 auto;
- font-size: 28rpx;
- border: 1rpx solid #ccc;
- padding: 20rpx;
- box-sizing: border-box;
- background-color: white;
- margin-bottom: 28rpx;
- display: flex;
- align-items: center;
- justify-content: space-between;
- }
-
- .message {
- font-size: 32rpx;
- margin: 40rpx 0 20rpx 0;
- font-weight: bold;
- }
-
- .change {
- // display: flex;
- // text-align: center;
- // justify-content: flex-end;
- // width: 100%;
- }
-
- // .change>view {
- // height: 60rpx;
- // background: linear-gradient(-90deg, #43a1e0 0%, #13e7c1 100%);
- // border-radius: 40rpx;
- // font-size: 32rpx;
- // font-family: Microsoft YaHei;
- // color: #ffffff;
- // line-height: 60rpx;
- // width: 25%;
- // }
-
- .choice-takePhoto {
- position: absolute;
- bottom: 0;
- background-color: white;
- width: 100%;
- border-radius: 20rpx 20rpx 0 0;
- }
-
- .choice-takePhoto>view:first-child {
- text-align: center;
- height: 80rpx;
- line-height: 80rpx;
- border-bottom: 1rpx solid rgba(127, 127, 127, 0.3);
- background-color: white;
- }
-
- .choice-takePhoto>view:last-child {
- text-align: center;
- height: 80rpx;
- line-height: 80rpx;
- border-top: 6rpx solid rgba(127, 127, 127, 0.1);
- background-color: white;
- }
-
- .choice-takePhoto>view {
- text-align: center;
- height: 80rpx;
- line-height: 80rpx;
- background-color: white;
- }
-
- .choice-takePhoto-wrap {
- width: 100%;
- height: 100vh;
- background-color: rgba(127, 127, 127, 0.2);
- position: fixed;
- left: 0;
- top: 0;
- z-index: 11111;
- }
- </style>
|