Nelze vybrat více než 25 témat Téma musí začínat písmenem nebo číslem, může obsahovat pomlčky („-“) a může být dlouhé až 35 znaků.

upload-card.vue 8.4KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383
  1. <template>
  2. <view class="upload-box">
  3. <u-form :model="form" ref="myForm" :error-type="errorType">
  4. <view class="from">
  5. <view class="title"> 请填写注销原因 </view>
  6. <u-form-item prop="remark">
  7. <view class="from_item">
  8. <text><text style="color: red"></text>注销原因:</text>
  9. <view style="display: flex">
  10. <u-input v-model="form.ReasonCancellation" @click="showPicker()" class="input" disabled
  11. placeholder="请选择" />
  12. <u-icon name="arrow-right" style="margin-left: 10px;display: flex;"></u-icon>
  13. </view>
  14. </view>
  15. </u-form-item>
  16. </view>
  17. </u-form>
  18. <button class="submit" @click="toPage()">注销</button>
  19. <!-- 选择弹窗 -->
  20. <view>
  21. <!-- 原因 -->
  22. <u-select v-model="show" mode="single-column" :list="list" @confirm="confirm"></u-select>
  23. </view>
  24. </view>
  25. </template>
  26. <script lang="ts" setup>
  27. import {
  28. reactive,
  29. ref
  30. } from "vue";
  31. import {
  32. onLoad,
  33. onShow,
  34. onUnload,
  35. onReady,
  36. } from "@dcloudio/uni-app";
  37. import {
  38. navTo,
  39. checkStr
  40. } from "@/utils/utils";
  41. import {
  42. request
  43. } from "../../utils/network/request.js";
  44. import {
  45. writeCardBack,
  46. CardSignCancellation,
  47. confirmSignCancellation
  48. } from "../../utils/network/api.js";
  49. import {
  50. stringToJson
  51. } from "../../utils/network/encryption.js";
  52. const bluetoothUtil = require("../../static/etcUtil/index.js");
  53. // 表单数据
  54. const form = reactive({
  55. obuId: '',
  56. cardId: '',
  57. orderId: '',
  58. ReasonCancellation: "",
  59. equipmentState: ''
  60. });
  61. const list = reactive([{
  62. //原因
  63. value: "原因1",
  64. label: "原因1",
  65. },
  66. {
  67. value: "原因1",
  68. label: "原因1",
  69. },
  70. {
  71. value: "原因1",
  72. label: "原因1",
  73. },
  74. ]);
  75. // 验证提示类型(toast要版本为1.3.5才支持)
  76. const errorType = ["border-bottom", "toast"];
  77. // 设置验证规则
  78. const myForm = ref(null);
  79. onReady(() => {
  80. });
  81. onLoad((option) => {
  82. form.obuId = option.obuId;
  83. form.cardId = option.cardId;
  84. form.orderId = option.orderId
  85. form.equipmentState = option.equipmentState
  86. console.log('打印')
  87. console.log(form.equipmentState)
  88. /*监听蓝牙回调*/
  89. uni.$on('bluetoothLink', function(status) {
  90. queryCardSignCancellation(1, 1, 1).then((item: any) => {
  91. instructAction(item).then(value => {
  92. if (value.orderStatus === 1) {
  93. instructAction(item)
  94. } else {
  95. queryConfirmSignCancellation(0).then((val: any) => {
  96. console.log(val)
  97. navTo("/after-sale/ETC-log-off/log-off-result");
  98. })
  99. }
  100. })
  101. })
  102. })
  103. });
  104. onUnload(() => {
  105. /*移除监听*/
  106. uni.$off('bluetoothLink')
  107. });
  108. const show = ref(false);
  109. const showPicker = function() {
  110. show.value = true;
  111. };
  112. // 选择物流
  113. const confirm = (e) => {
  114. console.log(e);
  115. form.ReasonCancellation = e[0].value;
  116. };
  117. const toPage = () => {
  118. //参数说明
  119. let options = {};
  120. if (form.equipmentState === '1') {
  121. navTo("/pages/bluetooth/bluetooth?routeType=5");
  122. } else {
  123. queryCardSignCancellation(0, 0, 0).then((item: any) => {
  124. queryConfirmSignCancellation(0).then((val: any) => {
  125. console.log(val)
  126. navTo("/after-sale/ETC-log-off/log-off-result");
  127. })
  128. })
  129. }
  130. };
  131. /*指令返回*/
  132. const instructAction = (data) => {
  133. let cmdArr = data.command.split(",");
  134. console.log(cmdArr);
  135. bluetoothUtil.transCmd(cmdArr, "10", function(res) {
  136. console.log("透传");
  137. console.log(res);
  138. var arraylenth = res.length;
  139. var status = res[arraylenth - 1].substring(
  140. res[arraylenth - 1].length - 4,
  141. res[arraylenth - 1].length
  142. );
  143. console.log("打印指令状态");
  144. console.log(status);
  145. if (status === "9000") {
  146. var form = {
  147. command: data.command,
  148. response: res.toString(),
  149. cosRecordId: data.cosRecordId,
  150. cardId: form.cardId,
  151. cosType: 9 //1- 开卡. 2- 修改卡内信息 4- 卡签绑定 9- 销卡
  152. };
  153. const options = {
  154. type: 2,
  155. data: form,
  156. method: "POST",
  157. showLoading: true,
  158. };
  159. return new Promise(async (resolve, reject) => {
  160. const res = await request(writeCardBack, options);
  161. const data = stringToJson(res.bizContent);
  162. resolve(data);
  163. }).catch((error) => {
  164. reject(error);
  165. });
  166. }
  167. });
  168. };
  169. //注销申请
  170. const queryCardSignCancellation = (hasCard, hasObu, cosProvider) => {
  171. var options = {
  172. type: 2, //type: 2,JSON格式提交数据(默认表单形式提交)
  173. data: {
  174. hasCard: hasCard,
  175. hasObu: hasObu,
  176. cosProvider: cosProvider,
  177. cardId: form.cardId, //卡号
  178. obuId: form.obuId, //签号
  179. serviceType: "3", //注销类型 1-卡注销,2-签注销,3-卡签注销
  180. orderId: form.orderId, //订单编号
  181. ReasonCancellation: form.ReasonCancellation
  182. }, //请求参数
  183. method: "POST", //提交方式(默认POST)
  184. showLoading: true, //是否显示加载中(默认显示)
  185. };
  186. return new Promise(async (resolve, reject) => {
  187. const res = await request(CardSignCancellation, options);
  188. const data = stringToJson(res.bizContent);
  189. resolve(data);
  190. }).catch((error) => {
  191. reject(error);
  192. });
  193. }
  194. //注销确认
  195. const queryConfirmSignCancellation = (hasCard: any) => {
  196. return new Promise(async (resolve, reject) => {
  197. const res = await request(confirmSignCancellation, {
  198. type: 2,
  199. data: {
  200. hasCard: hasCard,
  201. orderId: form.orderId,
  202. cardId: form.cardId
  203. },
  204. method: "POST",
  205. showLoading: true,
  206. });
  207. const data = stringToJson(res.bizContent);
  208. resolve(data);
  209. }).catch((error) => {
  210. reject(error);
  211. });
  212. }
  213. </script>
  214. <style>
  215. page {
  216. width: 100%;
  217. height: 100%;
  218. background-color: #ffffff;
  219. }
  220. </style>
  221. <style lang="scss" scoped>
  222. .upload-box {
  223. // width: 100%;
  224. padding: 30rpx;
  225. .head-tips {
  226. text-indent: 2rem;
  227. font-size: 26rpx;
  228. font-family: Microsoft YaHei;
  229. font-weight: 400;
  230. color: #666666;
  231. line-height: 50rpx;
  232. margin-bottom: 45rpx;
  233. text {
  234. color: #ff8000;
  235. }
  236. }
  237. .upload-card {
  238. margin-bottom: 70rpx;
  239. height: 260rpx;
  240. background: #ffffff;
  241. box-shadow: 0rpx 4rpx 13rpx 3rpx rgba(223, 223, 223, 0.8);
  242. border-radius: 20rpx;
  243. padding: 30rpx;
  244. display: flex;
  245. justify-content: space-between;
  246. .card-left {
  247. .item1 {
  248. font-size: 34rpx;
  249. font-family: Microsoft YaHei;
  250. font-weight: 400;
  251. color: #000000;
  252. margin-bottom: 30rpx;
  253. }
  254. .item2 {
  255. font-size: 24rpx;
  256. font-family: Microsoft YaHei;
  257. font-weight: 400;
  258. color: #999999;
  259. margin-bottom: 30rpx;
  260. }
  261. .item3 {
  262. width: 110rpx;
  263. height: 40rpx;
  264. background: #ecfbf8;
  265. /* opacity: 0.2; */
  266. border-radius: 6rpx;
  267. font-size: 20rpx;
  268. font-family: Microsoft YaHei;
  269. font-weight: 400;
  270. text-align: center;
  271. line-height: 40rpx;
  272. color: #0a8f8a;
  273. }
  274. }
  275. image {
  276. width: 295rpx;
  277. height: 188rpx;
  278. }
  279. }
  280. .from {
  281. background-color: #fff;
  282. margin-top: 30rpx;
  283. // padding: 0 30rpx;
  284. ::v-deep .u-form-item {
  285. padding: 0;
  286. line-height: normal;
  287. .u-form-item__message {
  288. margin-bottom: 12rpx;
  289. }
  290. }
  291. .title {
  292. font-size: 30rpx;
  293. font-family: Microsoft YaHei;
  294. font-weight: 400;
  295. color: #000000;
  296. margin: 38rpx 0;
  297. }
  298. .from_item {
  299. display: flex;
  300. flex-wrap: nowrap;
  301. justify-content: space-between;
  302. align-items: center;
  303. height: 80rpx;
  304. border-bottom: 1rpx solid #dcdcdc;
  305. ::v-deep .input {
  306. text-align: right;
  307. flex: 1;
  308. input {
  309. text-align: right;
  310. }
  311. }
  312. }
  313. .from_item1 {
  314. display: flex;
  315. flex-wrap: nowrap;
  316. flex-direction: column;
  317. justify-content: space-between;
  318. padding: 30rpx;
  319. border-bottom: #dcdcdc 1px solid;
  320. input {
  321. text-align: right;
  322. }
  323. .textarea {
  324. background-color: #f1f1f1;
  325. width: 100%;
  326. border-radius: 20rpx;
  327. margin-top: 10rpx;
  328. text-indent: 1rem;
  329. height: 180rpx;
  330. padding: 20rpx;
  331. box-sizing: border-box;
  332. }
  333. }
  334. }
  335. .submit {
  336. height: 80rpx;
  337. background: linear-gradient(-90deg, #43a1e0 0%, #13e7c1 100%);
  338. border-radius: 40rpx;
  339. font-size: 32rpx;
  340. font-family: Microsoft YaHei;
  341. font-weight: 400;
  342. color: #ffffff;
  343. line-height: 80rpx;
  344. margin: 60rpx auto;
  345. }
  346. }
  347. </style>