Você não pode selecionar mais de 25 tópicos Os tópicos devem começar com uma letra ou um número, podem incluir traços ('-') e podem ter até 35 caracteres.

verification.vue 5.9KB

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