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.

etc-log-off.vue 7.2KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375
  1. <template>
  2. <view class="oderPage">
  3. <u-form :model="form" ref="myForm" :error-type="errorType">
  4. <view class="from">
  5. <u-form-item prop="equipmentState">
  6. <view class="from_item">
  7. <text><text style="color: red">*</text>设备注销:</text>
  8. <radio-group @change="radioChange" class="radios">
  9. <block v-for="(item, index) in radiolist" :key="item.val">
  10. <view class="radio-box">
  11. <radio :value="item.val" :checked="form.equipmentState == item.val" color="#13e7c1"
  12. style="transform:scale(0.75)" />
  13. <view>{{item.name}}</view>
  14. </view>
  15. </block>
  16. </radio-group>
  17. </view>
  18. </u-form-item>
  19. <u-form-item prop="phone">
  20. <view class="from_item" style="background-color: #f7f7f7">
  21. <text><text style="color: red"></text>手机号:</text>
  22. <u-input v-model="form.mobile" class="input" />
  23. </view>
  24. </u-form-item>
  25. <u-form-item prop="code">
  26. <view class="from_item">
  27. <text><text style="color: red"></text>验证码:</text>
  28. <u-input v-model="form.code" placeholder="请输入验证码" class="input" type="number" />
  29. <view class="hint2">
  30. <view class="green">{{ codeDuration === 0 ? "" : codeDuration }}</view>
  31. <view class="grey" @click="getCode">{{
  32. codeDuration === 0 ? "发送验证码" : "秒后可重发"
  33. }}</view>
  34. </view>
  35. </view>
  36. </u-form-item>
  37. </view>
  38. </u-form>
  39. <button class="submit" @click="toPage()">下一步</button>
  40. </view>
  41. </template>
  42. <script setup lang="ts">
  43. import navBar from "./components/nav-bar.vue";
  44. import {
  45. checkStr
  46. } from "@/utils/utils";
  47. import {
  48. ref,
  49. reactive
  50. } from "vue";
  51. import {
  52. navTo
  53. } from "@/utils/utils";
  54. import {
  55. onReady,
  56. onLoad
  57. } from "@dcloudio/uni-app";
  58. import {
  59. request
  60. } from "@/utils/network/request.js";
  61. import {
  62. sendCode,
  63. checkCode
  64. } from "@/utils/network/api.js";
  65. import {
  66. msg
  67. } from "@/utils/utils";
  68. // 表单数据
  69. const form = reactive({
  70. equipmentState: 2,
  71. equipmentStateName: "否",
  72. mobile: "",
  73. code: '',
  74. type: undefined,
  75. customerIdnum: "",
  76. userType: ""
  77. });
  78. //入参
  79. const params = reactive({
  80. cardId: '',
  81. obuId: '',
  82. orderId: ''
  83. });
  84. // 验证规则
  85. const rules = {
  86. code: [{
  87. required: true,
  88. message: "请输入验证码",
  89. trigger: ["change", "blur"],
  90. }],
  91. };
  92. // 验证提示类型(toast要版本为1.3.5才支持)
  93. const errorType = ["toast"];
  94. // 单选数据列表
  95. const radiolist = reactive([{
  96. name: "连接设备注销",
  97. val: 1,
  98. },
  99. {
  100. name: "无设备注销",
  101. val: 2,
  102. },
  103. ]);
  104. // 设置验证规则
  105. const myForm = ref(null);
  106. //倒计时时常
  107. const codeDuration = ref(0);
  108. let interval = null;
  109. /* 验证码倒计时 */
  110. const codeInterval = () => {
  111. codeDuration.value = 60;
  112. interval = setInterval(() => {
  113. codeDuration.value--;
  114. if (codeDuration.value === 0) {
  115. if (interval) {
  116. clearInterval(interval);
  117. interval = null;
  118. }
  119. }
  120. }, 1000);
  121. };
  122. onReady(() => {
  123. myForm.value.setRules(rules);
  124. });
  125. onLoad((option) => {
  126. let options = JSON.parse(decodeURIComponent(option.params))
  127. console.log("options", options)
  128. form.mobile = options.mobile
  129. form.type = options.type
  130. params.cardId = options.cardId
  131. params.obuId = options.obuId
  132. params.orderId = options.orderId
  133. form.customerIdnum = options.customerIdnum
  134. form.userType = options.userType
  135. });
  136. const getCode = () => {
  137. if (codeDuration.value !== 0) {
  138. return;
  139. }
  140. const options = {
  141. type: 2,
  142. data: {
  143. mobile: form.mobile
  144. },
  145. method: "POST",
  146. showLoading: true,
  147. };
  148. request(sendCode, options)
  149. .then((res) => {
  150. codeInterval();
  151. msg("验证码发送成功!");
  152. })
  153. .catch((err) => {
  154. console.log(err);
  155. });
  156. }
  157. // 单选
  158. const radioChange = (e : any) => {
  159. form.equipmentState = e.detail.value
  160. console.log(form.equipmentState, "222");
  161. };
  162. //下一步
  163. const toPage = () => {
  164. myForm.value.validate((valid) => {
  165. console.log(valid);
  166. if (valid) {
  167. const options = {
  168. type: 2,
  169. data: {
  170. mobile: form.mobile,
  171. code: form.code
  172. },
  173. method: "POST",
  174. showLoading: true,
  175. };
  176. request(checkCode, options)
  177. .then(() => {
  178. let obj = {
  179. obuId: params.obuId,
  180. cardId: params.cardId,
  181. orderId: params.orderId,
  182. equipmentState: form.equipmentState,
  183. mobile: form.mobile,
  184. customerIdnum: form.customerIdnum,
  185. userType: form.userType
  186. }
  187. const paramss = encodeURIComponent(JSON.stringify(obj))
  188. navTo(
  189. `/subpackage/after-sale/ETC-log-off/upload-card?params=${paramss}`
  190. );
  191. })
  192. .catch((err) => {
  193. console.log(err);
  194. });
  195. } else {
  196. console.log("验证未通过");
  197. }
  198. });
  199. };
  200. </script>
  201. <style>
  202. page {
  203. width: 100%;
  204. height: 100%;
  205. display: flex;
  206. flex-direction: column;
  207. background-color: ##eef7f7;
  208. }
  209. </style>
  210. <style lang="scss" scoped>
  211. .radios {
  212. display: flex;
  213. }
  214. .radio-box {
  215. display: flex;
  216. align-items: center;
  217. padding-left: 40rpx;
  218. }
  219. .hint2 {
  220. display: flex;
  221. .green {
  222. font-size: 28rpx;
  223. color: #00b38b;
  224. }
  225. .grey {
  226. font-size: 24rpx;
  227. color: #000000;
  228. margin-left: 16rpx;
  229. }
  230. }
  231. .oderPage {
  232. flex: 1;
  233. width: 100%;
  234. .from1 {
  235. background-color: #fff;
  236. margin-top: 30rpx;
  237. padding: 0 30rpx;
  238. ::v-deep .uni-forms-item {
  239. border-bottom: 1rpx solid #ccc;
  240. padding: 15rpx 0;
  241. margin-bottom: 0;
  242. .uni-forms-item__label {
  243. font-size: 28rpx;
  244. height: 50rpx;
  245. }
  246. .uni-forms-item__content {
  247. display: flex;
  248. }
  249. .uni-easyinput__content-input {
  250. font-size: 28rpx;
  251. height: 50rpx;
  252. }
  253. }
  254. .btn {
  255. line-height: 38rpx;
  256. font-size: 24rpx;
  257. font-family: Microsoft YaHei;
  258. font-weight: 400;
  259. color: #ffffff;
  260. background: #00b38b;
  261. border-radius: 10rpx;
  262. padding: 10rpx 15rpx;
  263. }
  264. }
  265. .from {
  266. background-color: #fff;
  267. margin-top: 30rpx;
  268. padding: 0 30rpx;
  269. ::v-deep .u-form-item {
  270. padding: 0;
  271. line-height: normal;
  272. .u-form-item__message {
  273. margin-bottom: 12rpx;
  274. }
  275. }
  276. .from_item {
  277. display: flex;
  278. flex-wrap: nowrap;
  279. justify-content: space-between;
  280. align-items: center;
  281. height: 80rpx;
  282. border-bottom: 1rpx solid #dcdcdc;
  283. .btn {
  284. font-size: 24rpx;
  285. font-family: Microsoft YaHei;
  286. font-weight: 400;
  287. color: #ffffff;
  288. background: #00b38b;
  289. border-radius: 10rpx;
  290. padding: 10rpx 15rpx;
  291. }
  292. ::v-deep .input {
  293. text-align: left;
  294. flex: 1;
  295. background: transparent;
  296. input {
  297. text-align: left;
  298. }
  299. }
  300. }
  301. .from_item1 {
  302. display: flex;
  303. flex-wrap: nowrap;
  304. flex-direction: column;
  305. justify-content: space-between;
  306. padding: 30rpx;
  307. border-bottom: #dcdcdc 1px solid;
  308. input {
  309. text-align: right;
  310. }
  311. .textarea {
  312. background-color: #f1f1f1;
  313. width: 100%;
  314. border-radius: 20rpx;
  315. margin-top: 10rpx;
  316. text-indent: 1rem;
  317. height: 180rpx;
  318. padding: 20rpx;
  319. box-sizing: border-box;
  320. }
  321. }
  322. }
  323. }
  324. .submit {
  325. background: linear-gradient(to left, #43a1e0 0%, #13e7c1 100%);
  326. width: 670rpx;
  327. height: 80rpx;
  328. color: #fff;
  329. border-radius: 100rpx;
  330. position: fixed;
  331. left: 50%;
  332. transform: translate(-50%);
  333. bottom: 60rpx;
  334. font-size: 32rpx;
  335. }
  336. </style>