Vous ne pouvez pas sélectionner plus de 25 sujets Les noms de sujets doivent commencer par une lettre ou un nombre, peuvent contenir des tirets ('-') et peuvent comporter jusqu'à 35 caractères.

etc-log-off.vue 6.9KB

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