Du kan inte välja fler än 25 ämnen Ämnen måste starta med en bokstav eller siffra, kan innehålla bindestreck ('-') och vara max 35 tecken långa.

deviceReceive.vue 3.9KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198
  1. <script setup>
  2. import {
  3. reactive
  4. } from "vue";
  5. import {
  6. onLoad
  7. } from '@dcloudio/uni-app';
  8. const tools = require("../../../static/etcUtil/tools.js");
  9. import {
  10. request
  11. } from "@/utils/network/request.js";
  12. import {
  13. stringToJson
  14. } from "@/utils/network/encryption.js";
  15. import * as IFCODE from "@/utils/network/api.js";
  16. const state = reactive({
  17. channelId: "",
  18. newCodeStatus: '获取验证码',
  19. newCodeBtnDisabled: false,
  20. codeInterval: 59,
  21. code: "", //短信验证码
  22. mobile: "15885137270", //手机号
  23. })
  24. onLoad((option) => {
  25. })
  26. //发送验证码
  27. const sendCodeToNewPhone = () => {
  28. if (state.newCodeBtnDisabled) {
  29. return;
  30. }
  31. if (!state.mobile) {
  32. tools.showToastAlert("手机号不能为空");
  33. return;
  34. }
  35. state.newCodeBtnDisabled = true;
  36. state.newCodeStatus = "正在发送";
  37. let second = state.codeInterval;
  38. let interval = setInterval(function() {
  39. if (second <= 0) {
  40. clearInterval(interval);
  41. state.newCodeStatus = '获取验证码';
  42. state.newCodeBtnDisabled = false;
  43. } else {
  44. state.newCodeStatus = second + ' s';
  45. second--;
  46. }
  47. }, 1000);
  48. // const options = {
  49. // type: 2,
  50. // data: {},
  51. // method: "POST",
  52. // showLoading: true,
  53. // };
  54. // request(IFCODE.gongWuCheLogin, options).then((res) => {
  55. // });
  56. }
  57. //确定认领
  58. const bindSubmit = () => {
  59. console.log("bindSubmit", state);
  60. }
  61. </script>
  62. <template>
  63. <view class="wrapper">
  64. <view class="mainView">
  65. <view class="li">
  66. <text>车牌号:</text>
  67. {{state.newCodeStatus}}
  68. </view>
  69. <view class="li">
  70. <text>车牌颜色:</text>
  71. {{state.newCodeStatus}}
  72. </view>
  73. <view class="li">
  74. <text>ETC卡号:</text>
  75. {{state.newCodeStatus}}
  76. </view>
  77. <view class="li">
  78. <text>卡版本号:</text>
  79. {{state.newCodeStatus}}
  80. </view>
  81. <view class="li">
  82. <text>OBU号:</text>
  83. {{state.newCodeStatus}}
  84. </view>
  85. <view class="li">
  86. <text>OBU版本号:</text>
  87. {{state.newCodeStatus}}
  88. </view>
  89. <view class="li phone">
  90. <text>手机号:</text>
  91. <input class="input" placeholder="手机号" v-model="state.mobile" type="number" maxlength="11"
  92. disabled="false" />
  93. <button class="right" @click="sendCodeToNewPhone"
  94. :disabled="state.newCodeBtnDisabled">{{state.newCodeStatus}}</button>
  95. </view>
  96. <view class="li">
  97. <text>验证码:</text>
  98. <input class="input" placeholder="请输入验证码" v-model="state.code" type="number" maxlength="6" />
  99. </view>
  100. <view class="li" style="border: none;">
  101. <text>推广码:</text>
  102. <input class="input" placeholder="请输入推广码" v-model="state.channelId" />
  103. </view>
  104. </view>
  105. <view class="comfirm_btn" @click="bindSubmit">确认领取</view>
  106. </view>
  107. </template>
  108. <style>
  109. page {
  110. background: #eef7f7;
  111. }
  112. </style>
  113. <style scoped>
  114. .li {
  115. padding: 25rpx 30rpx;
  116. border-bottom: 1px dashed #cccccc;
  117. color: #333333;
  118. display: flex;
  119. flex-direction: row;
  120. align-items: center;
  121. font-size: 32rpx;
  122. }
  123. .mainView {
  124. margin: 50rpx 40rpx;
  125. border-radius: 16rpx;
  126. box-shadow: 0rpx 6rpx 25rpx 0rpx rgba(0, 0, 0, 0.3);
  127. }
  128. .li>text {
  129. color: black;
  130. font-size: 30rpx;
  131. }
  132. .li input {
  133. font-size: 30rpx;
  134. }
  135. .phone input {
  136. flex: 1;
  137. }
  138. .comfirm_btn {
  139. width: calc(100% - 60rpx);
  140. margin-left: 30rpx;
  141. margin-top: 100rpx;
  142. height: 80rpx;
  143. border-radius: 40rpx;
  144. line-height: 80rpx;
  145. text-align: center;
  146. color: #fff;
  147. font-size: 32rpx;
  148. background: linear-gradient(to right, #13E7C1, #43A1E0);
  149. }
  150. .comfirm_btn:active {
  151. background: #43A1E0;
  152. }
  153. .right {
  154. /* width: calc(40% - 30rpx); */
  155. width: 180rpx;
  156. height: 60rpx;
  157. line-height: 60rpx;
  158. text-align: center;
  159. /* margin: 15rpx 30rpx; */
  160. background: linear-gradient(to right, #13E7C1, #43A1E0);
  161. color: #fff;
  162. border-radius: 8rpx;
  163. font-size: 24rpx;
  164. }
  165. .right::after{
  166. border: none;
  167. }
  168. .right[disabled] {
  169. background: #e7e7e7;
  170. color: #666;
  171. border: 1px solid #ccc;
  172. }
  173. </style>