Nevar pievienot vairāk kā 25 tēmas Tēmai ir jāsākas ar burtu vai ciparu, tā var saturēt domu zīmes ('-') un var būt līdz 35 simboliem gara.

upload-card.vue 8.6KB

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