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 8.2KB

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