工行这里学车报名流程h5
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.

222 lines
5.6 KiB

1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
  1. <template>
  2. <view class="main">
  3. <view class="redTps">
  4. 请填写报名学员的手机号该手机号作为学员唯一报名手机号一经确定不可更改
  5. </view>
  6. <view class="content">
  7. <view class="logo">
  8. <image src="../../static/images/logo.png" mode=""></image>
  9. </view>
  10. <view class="form">
  11. <view class="form_item">
  12. <input type="number" value="" v-model="params.phone" placeholder="请输入手机号"/>
  13. </view>
  14. <view class="form_item">
  15. <view class="inputBox">
  16. <input type="number" value="" v-model="params.code" placeholder="请输入验证码"/>
  17. </view>
  18. <view class="verificationCode" @click="goSms">{{codeText}}</view>
  19. </view>
  20. </view>
  21. <view class="btn" @click="gologin">确定</view>
  22. <view class="radioWrap">
  23. <view>
  24. <u-checkbox-group :wrap='true'>
  25. <u-checkbox v-model="isCheck" shape="circle" label-size="24rpx">
  26. 我已阅读并同意 <text
  27. @click.stop="$goPage('/pages/application/privacyAgreement/privacyAgreement?type=2')">用户协议</text>
  28. <text
  29. @click.stop="$goPage('/pages/application/privacyAgreement/privacyAgreement?type=1')">隐私协议</text>
  30. </u-checkbox>
  31. </u-checkbox-group>
  32. </view>
  33. </view>
  34. </view>
  35. </view>
  36. </template>
  37. <script>
  38. import indexApi from '@/api/index.js'
  39. export default {
  40. data() {
  41. return {
  42. isCheck: false,
  43. codeText: '获取验证码',
  44. params: {},
  45. showBtnOn: false
  46. }
  47. },
  48. methods: {
  49. //发送短信
  50. async goSms() {
  51. const {
  52. params
  53. } = this
  54. const reg = /^(0|86|17951)?(1[0-9])[0-9]{9}$/;
  55. console.log('666')
  56. // const reg = /^[1][3,4,5,6,7,8,9][0-9]{9}$/;
  57. if (!params.phone) return this.$u.toast('请输入手机号');
  58. if (!reg.test(params.phone)) return this.$u.toast('手机号格式有误');
  59. if (this.showBtnOn) return
  60. const [message, data] = await indexApi.getLoginRegistCode({
  61. codeType: 1,
  62. phone: params.phone,
  63. })
  64. console.log(data)
  65. if (data.code != 0) return this.$u.toast(data.message);
  66. // this.data = data
  67. // 获取验证码
  68. var time = 60;
  69. var timer = setInterval(() => {
  70. time--;
  71. this.codeText = time + "秒重发"
  72. this.showBtnOn = true;
  73. if (time == 0) {
  74. clearInterval(timer);
  75. this.codeText = "获取验证码";
  76. this.showBtnOn = false;
  77. }
  78. }, 1000);
  79. },
  80. // 验证码登录
  81. async gologin() {
  82. const {
  83. params
  84. } = this
  85. const reg = /^(0|86|17951)?(1[0-9])[0-9]{9}$/;
  86. if (!params.phone) return uni.$u.toast('请输入手机号');
  87. if (!reg.test(params.phone)) return uni.$u.toast('手机号格式有误');
  88. if (!params.code) return uni.$u.toast('请输入验证码');
  89. if (!this.isCheck) return uni.$u.toast('请勾选用户协议');
  90. const [err, data] = await indexApi.loginSMS({
  91. personnelType: 1,
  92. username: params.phone,
  93. code: params.code,
  94. loginType: 1,
  95. })
  96. if (data.code != 0) return uni.$u.toast(data.message);
  97. uni.setStorageSync('Authorization', data.data.token);
  98. uni.setStorageSync('studentId', data.data.studentId);
  99. await this.getOwnerAccountBase()
  100. this.createTrainingApplySimpleFn()
  101. },
  102. //获取用户信息
  103. async getOwnerAccountBase() {
  104. const [err, data] = await indexApi.getOwnerAccountBase();
  105. if (data.code != 0) return uni.$u.toast(data.message);
  106. uni.setStorageSync('userInfo', data.data);
  107. },
  108. // 第一步先报名
  109. async createTrainingApplySimpleFn() {
  110. let trainingSchoolId = this.$store.state.currentSchool.trainingSchoolId
  111. let trainingClassId = this.$store.state.classChooseItem.trainingClassId
  112. const [nulls, res] = await indexApi.createTrainingApplySimple({trainingSchoolId, trainingClassId})
  113. if(res.code==0) {
  114. this.$goPage('/pages/application/fillRegistInfo?trainingApplyId='+ res.data)
  115. }else if(res.code==502) {
  116. // 已经报名过这个学校了 存在未支付订单
  117. this.$u.toast(res.message)
  118. this.$goPage('/pages/application/fillRegistInfo?trainingApplyId='+ res.data)
  119. }
  120. }
  121. }
  122. }
  123. </script>
  124. <style lang="scss" scoped>
  125. .main {
  126. background: #fff;
  127. height: 100vh;
  128. }
  129. .redTps {
  130. width: 100%;
  131. background: #FCEAEA;
  132. font-size: 28rpx;
  133. color: #E63633;
  134. padding: 24rpx 32rpx;
  135. }
  136. .radioWrap {
  137. display: flex;
  138. justify-content: flex-start;
  139. align-items: center;
  140. /deep/.radio-btn {
  141. margin-right: -9rpx !important;
  142. }
  143. radio {
  144. zoom: .8;
  145. }
  146. view:nth-child(2) {
  147. font-size: 24rpx;
  148. color: #bfbfbf;
  149. }
  150. text {
  151. color: #218DFF;
  152. }
  153. }
  154. .content {
  155. width: 100%;
  156. padding: 16% 32rpx 0 32rpx;
  157. .logo {
  158. width: 100rpx;
  159. height: 100rpx;
  160. margin: 0 auto;
  161. }
  162. .form {
  163. padding: 100rpx 0 40rpx 0;
  164. .form_item {
  165. display: flex;
  166. align-items: center;
  167. justify-content: space-between;
  168. height: 112rpx;
  169. font-size: 32rpx;
  170. line-height: 112rpx;
  171. border-bottom: 1rpx solid #E8E9EC;
  172. input {
  173. display: block;
  174. width: 100%;
  175. height: 100%;
  176. font-size: 32rpx;
  177. color: #333;
  178. }
  179. .verificationCode {
  180. font-size: 28rpx;
  181. color: #1989FA;
  182. position: relative;
  183. padding: 0 0 0 24rpx;
  184. &::before {
  185. content: '';
  186. position: absolute;
  187. left: 0;
  188. top: 50%;
  189. transform: translateY(-50%);
  190. width: 2rpx;
  191. height: 40rpx;
  192. background-color: #E8E9EC;
  193. }
  194. }
  195. }
  196. }
  197. .btn {
  198. height: 96rpx;
  199. background: linear-gradient(180deg, #3593FB 0%, #53D3E5 100%);
  200. border-radius: 50rpx;
  201. font-size: 36rpx;
  202. color: #fff;
  203. text-align: center;
  204. line-height: 96rpx;
  205. margin-bottom: 40rpx;
  206. }
  207. }
  208. </style>