yonganCode.vue 4.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225
  1. <template>
  2. <view class="page">
  3. <!-- 公共组件-每个页面必须引入 -->
  4. <public-module></public-module>
  5. <view class="mx-3 mt-3">
  6. <view class="phone d-flex">
  7. <view class="title">电话号码</view>
  8. <input placeholder="请输入手机号" v-model="mobile" maxlength="11" disabled />
  9. </view>
  10. <view class="code d-flex">
  11. <view class="title">验证码</view>
  12. <input placeholder="请输入验证码" v-model="code" maxlength="6" style="padding-right: 200rpx;"
  13. @input="OnBtnChange" />
  14. <view class="d-flex a-center j-center login-font-color yanzhengma" @tap="getCheckNum">
  15. <view class="d-flex a-center j-center"
  16. :class="!codetime?'yanzhengma1 main-text-color':'yanzhengma2'">
  17. {{!codetime?'获取验证码':codetime+' s'}}
  18. </view>
  19. </view>
  20. </view>
  21. <button class="my-3 mt-4 d-flex a-center j-center font-weight main-bg-color" :loading="loading"
  22. :class="{'main-bf-hover-color':disabled}" type="primary" @tap="submit" :disabled="disabled"
  23. style="letter-spacing: 20rpx;">提交</button>
  24. </view>
  25. </view>
  26. </template>
  27. <script>
  28. import {
  29. pathToBase64,
  30. base64ToPath
  31. } from '@/common/image-tools-base64.js';
  32. import {
  33. mapMutations
  34. } from "vuex"
  35. export default {
  36. data() {
  37. return {
  38. mobile: "",
  39. code: "",
  40. disabled: true,
  41. loading: false,
  42. codetime: 0,
  43. showRecommend: false,
  44. recommendername: "",
  45. recommenderid: "",
  46. companyId: null, //子订单号
  47. }
  48. },
  49. async onLoad(params) {
  50. if (!!params.companyId) {
  51. this.companyId =String(params.companyId);
  52. this.mobile = params.mobile;
  53. }
  54. },
  55. methods: {
  56. ...mapMutations(['setUserModules']),
  57. // 改变按钮状态
  58. OnBtnChange() {
  59. if (this.code) {
  60. this.disabled = false;
  61. return;
  62. }
  63. this.disabled = true;
  64. },
  65. // 获取验证码
  66. async getCheckNum() {
  67. if (this.codetime > 0) return;
  68. // 请求服务器,发送验证码
  69. let params = {
  70. companyId: this.companyId,
  71. }
  72. let res = await this.$http.post('/order/yongAn/getMessage', params);
  73. // 请求失败处理
  74. if (res.code == '200') {
  75. uni.showToast({
  76. title: "发送成功",
  77. icon: "none"
  78. });
  79. } else {
  80. uni.showToast({
  81. title: res.msg,
  82. icon: "none"
  83. });
  84. }
  85. // 发送成功,开启倒计时
  86. this.codetime = 60;
  87. let timer = setInterval(() => {
  88. this.codetime--;
  89. if (this.codetime < 1) {
  90. clearInterval(timer);
  91. this.codetime = 0;
  92. }
  93. }, 1000);
  94. },
  95. async submit() {
  96. let params1 = {
  97. companyId: this.companyId,
  98. verificationCode: this.code,
  99. }
  100. let res = await this.$http.post('/order/yongAn/getPayUrl', params1);
  101. if (res.code == '200') {
  102. uni.showToast({
  103. icon: "none",
  104. title: '支付成功,请等待跳转支付页面',
  105. duration: 1500
  106. })
  107. //#ifdef APP-PLUS
  108. uni.navigateTo({
  109. url: '/pages/carInsure1/zhifu1?url=' + res.msg
  110. })
  111. //#endif
  112. //#ifdef H5
  113. window.location.href = res.msg;
  114. //#endif
  115. } else {
  116. //#ifdef APP-PLUS
  117. return uni.showToast({
  118. icon: "none",
  119. title: res.msg,
  120. duration: 1500
  121. })
  122. //#endif
  123. }
  124. }
  125. }
  126. }
  127. </script>
  128. <style lang="scss" scoped>
  129. @import '@/style/mixin.scss';
  130. .idCardBefore {
  131. background: rgba($themeColor, 0.1) url('/static/image/user/identy2.png') center center no-repeat;
  132. background-size: auto 70%;
  133. padding: 10upx;
  134. }
  135. .page {
  136. background: #F5F5F5;
  137. height: 100vh;
  138. width: 100%;
  139. position: absolute;
  140. }
  141. .phone,
  142. .password,
  143. .code {
  144. position: relative;
  145. height: 90upx;
  146. display: flex;
  147. align-items: center;
  148. background-color: #FFFFFF;
  149. padding: 0 30upx;
  150. margin-bottom: 26upx;
  151. }
  152. .phone .title,
  153. .password .title,
  154. .code .title {
  155. width: 160upx;
  156. flex-shrink: 0;
  157. color: #666;
  158. }
  159. .phone input,
  160. .password input,
  161. .code input {
  162. width: 350upx;
  163. font-size: 28upx;
  164. }
  165. .yanzhengma {
  166. width: 150upx;
  167. position: absolute;
  168. right: 30upx;
  169. }
  170. .yanzhengma1 {
  171. font-size: 26upx;
  172. background: #FFFFFF;
  173. border-radius: 10rpx;
  174. width: 150rpx;
  175. padding: 5rpx 0;
  176. }
  177. .yanzhengma2 {
  178. background: #FFFFFF;
  179. font-size: 26upx;
  180. color: #B2B2B2;
  181. border-radius: 10rpx;
  182. width: 150rpx;
  183. padding: 5rpx 0;
  184. }
  185. .recommendInfo {
  186. background: #FFFFFF;
  187. }
  188. .recommendInfo>view:nth-of-type(1) {
  189. border-bottom: 1px solid #ddd;
  190. }
  191. .recommendInfo>view:nth-of-type(1)>view:nth-of-type(1) {
  192. width: 150upx;
  193. height: 150upx;
  194. border-radius: 50%;
  195. }
  196. .recommendInfo>view:nth-of-type(1)>view:nth-of-type(1)>image {
  197. width: 100%;
  198. height: 100%;
  199. }
  200. .recommendInfo>view:nth-of-type(1)>view:nth-of-type(2) {
  201. padding: 20upx;
  202. }
  203. .recommendInfo>view:nth-of-type(1)>view:nth-of-type(2)>view {
  204. height: 55upx;
  205. }
  206. .recommendInfo>view:nth-of-type(2) {
  207. line-height: 50upx;
  208. }
  209. </style>