You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

verification.vue 4.7KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224
  1. <template>
  2. <view class="formBox">
  3. <view class="from_item">
  4. <text class="label">手机号码</text>
  5. <input type="number" placeholder="请输入手机号码" v-model="model1.mobile" placeholder-style="color:#9a9a9a"
  6. maxlength="11">
  7. </view>
  8. <view class="from_item">
  9. <text class="label">验证码</text>
  10. <input type="text" placeholder="请输入验证码" v-model="model1.code" placeholder-style="color:#9a9a9a">
  11. <text class="btn" @click="getCode" v-if="waitTime==0">获取验证码</text>
  12. <text class="btn" v-else>{{waitTime}}</text>
  13. </view>
  14. <button class="submit" @click="submit">验证</button>
  15. </view>
  16. </template>
  17. <script setup lang="ts">
  18. import {
  19. reactive,
  20. ref
  21. } from "vue";
  22. import {
  23. navTo
  24. } from "@/utils/utils"
  25. import {
  26. onLoad
  27. } from "@dcloudio/uni-app";
  28. import {
  29. stringToJson
  30. } from "@/utils/network/encryption.js";
  31. import {
  32. request,requestNew
  33. } from "@/utils/network/request.js";
  34. import {
  35. sendMessage,
  36. relieveCarId
  37. } from "@/utils/network/api.js"
  38. const model1 = reactive({
  39. vehiclePlate: '',
  40. vehiclePlatecolor: '',
  41. openid: '',
  42. idcardFrontImgUrl: '',
  43. idcardBacktImgUrl: '',
  44. vehPosImgUrl: '',
  45. vehNegImgUrl: '',
  46. peopleVehicleImgUrl: '',
  47. commitmentUrl: '',
  48. mobile: '',
  49. code: '',
  50. proxyUrl: "", //委托书
  51. })
  52. let waitTime = ref(0)
  53. const getCode = () => {
  54. console.log(123);
  55. if (model1.mobile) {
  56. sendCodeApi()
  57. codeInterval()
  58. } else {
  59. uni.showToast({
  60. title: '请输入手机号',
  61. icon: 'none'
  62. });
  63. }
  64. }
  65. //倒计时函数
  66. const codeInterval = () => {
  67. waitTime.value = 60
  68. let timer = setInterval(() => {
  69. if (waitTime.value == 1) {
  70. clearInterval(timer)
  71. }
  72. waitTime.value -= 1
  73. }, 1000)
  74. }
  75. // 发送验证码
  76. const sendCodeApi = (type) => {
  77. //参数说明
  78. let options = {
  79. type: 2, //type: 2,JSON格式提交数据(默认表单形式提交)
  80. data: {
  81. mobile: model1.mobile
  82. }, //请求参数
  83. method: "POST", //提交方式(默认POST)
  84. showLoading: true, //是否显示加载中(默认显示)
  85. };
  86. //调用方式
  87. requestNew(sendMessage, options)
  88. .then((res) => {
  89. let data = res
  90. console.log(data, "#################");
  91. if (data.info == "成功.") {
  92. console.log('######################CCCCCCCCCCCCCCCCC');
  93. }
  94. })
  95. .catch((err) => {
  96. console.log(err);
  97. });
  98. }
  99. const submit = () => {
  100. console.log("111");
  101. console.log(model1);
  102. let options = {
  103. type: 2, //type: 2,JSON格式提交数据(默认表单形式提交)
  104. data: model1,
  105. method: "POST", //提交方式(默认POST)
  106. showLoading: true, //是否显示加载中(默认显示)
  107. };
  108. //调用方式
  109. request(relieveCarId, options)
  110. .then((res) => {
  111. stringToJson(res.bizContent)
  112. const data = stringToJson(res.bizContent);
  113. console.log(data, "数据");
  114. if (data.info == "成功.") {
  115. navTo(`/subpackage/after-sale/rescind-carId/result?carid=${model1.vehiclePlate}`)
  116. }
  117. })
  118. .catch((err) => {
  119. console.log(err);
  120. });
  121. }
  122. onLoad((option) => {
  123. console.log(option, "这是传过来的参数");
  124. console.log(JSON.parse(option.fromData), "这是传过来的参数");
  125. let data = JSON.parse(option.fromData)
  126. model1.vehiclePlate = data.vehiclePlate
  127. model1.vehiclePlatecolor = data.vehiclePlatecolor
  128. model1.openid = data.openid
  129. model1.idcardFrontImgUrl = data.idcardFrontImgUrl
  130. model1.idcardBacktImgUrl = data.idcardBacktImgUrl
  131. model1.vehPosImgUrl = data.vehPosImgUrl
  132. model1.vehNegImgUrl = data.vehNegImgUrl
  133. model1.peopleVehicleImgUrl = data.peopleVehicleImgUrl
  134. model1.commitmentUrl = data.commitmentUrl
  135. model1.proxyUrl = data.proxyUrl
  136. })
  137. </script>
  138. <style>
  139. page {
  140. width: 100%;
  141. height: 100%;
  142. }
  143. </style>
  144. <style lang="scss" scoped>
  145. .formBox {
  146. height: 90%;
  147. width: 100%;
  148. // background-color: red;
  149. .from_item {
  150. padding: 30rpx;
  151. padding-top: 60rpx;
  152. position: relative;
  153. .label {
  154. font-size: 28rpx;
  155. font-family: Microsoft YaHei;
  156. font-weight: 400;
  157. color: #777777;
  158. }
  159. input {
  160. font-size: 32rpx;
  161. font-family: Microsoft YaHei;
  162. font-weight: 400;
  163. color: #9a9a9a;
  164. line-height: 58rpx;
  165. border-bottom: 1rpx solid #DCDCDC;
  166. margin-top: 50rpx;
  167. padding-bottom: 10rpx;
  168. }
  169. .btn {
  170. position: absolute;
  171. right: 45rpx;
  172. bottom: 48rpx;
  173. background: transparent;
  174. font-size: 30rpx;
  175. color: #15E5C1;
  176. z-index: 999;
  177. }
  178. }
  179. .submit {
  180. background: linear-gradient(to left, #43A1E0 0%, #13E7C1 100%);
  181. width: 670rpx;
  182. height: 80rpx;
  183. line-height: 80rpx;
  184. color: #fff;
  185. border-radius: 100rpx;
  186. position: fixed;
  187. bottom: 100rpx;
  188. left: 50%;
  189. transform: translate(-50%);
  190. font-size: 32rpx;
  191. font-family: Microsoft YaHei;
  192. font-weight: 400;
  193. color: #FFFFFF;
  194. line-height: 80rpx;
  195. }
  196. }
  197. </style>