index.vue 6.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255
  1. <template>
  2. <view>
  3. <!-- 状态栏高度 -->
  4. <view :style="{ height: `${statusBarHeight}px`, backgroundColor: '#FF6702' }"></view>
  5. <!-- 导航栏 -->
  6. <view :style="{ height: `${navigationBarHeight}rpx`,lineHeight: `${navigationBarHeight}rpx`}" class="order-nav">
  7. <view class="back-button" @tap="handBack()"></view>
  8. 成为骑手
  9. </view>
  10. <!-- <form @submit="formSubmit"> -->
  11. <view style="background-color: #fff;padding: 21rpx 0 86rpx 39rpx;">
  12. <view class="item-box">
  13. <view class="title" style="width: 147rpx;">姓名</view>
  14. <input class="uni-input" v-model="name" focus placeholder="请输入你的姓名" />
  15. </view>
  16. <view class="item-box">
  17. <view class="title" style="width: 147rpx;">手机号</view>
  18. <input type='number' class="uni-input" v-model="phone" focus placeholder="请输入你的手机号" />
  19. </view>
  20. <view class="item-box">
  21. <view class="title" style="width: 147rpx;">短信验证</view>
  22. <input type='number' class="uni-input" maxlength="6" v-model="bindingCaptcha" focus placeholder="请输入验证码" />
  23. <button class="code" :class="disabled === true ? 'on' : ''" :disabled='disabled' @click="code">
  24. {{ text }}
  25. </button>
  26. </view>
  27. <view class="item-box" style="justify-content: space-between;">
  28. <view class="title">是否有过配送经验</view>
  29. <switch :value="isSwitch" :checked="isSwitch" color="#12CA00" style="transform:scale(0.7)" />
  30. </view>
  31. <view class="item-box" style="border: none;padding: 0;">
  32. <view class="title">配送职责(可多选)</view>
  33. </view>
  34. <view class="item-box" style="border-bottom: none;">
  35. <checkbox-group name="checkbox" style="margin-top: 38rpx;">
  36. <label style="margin-left: 96rpx">
  37. <checkbox class="mycheck" :value="1" :checked="checkbox1" /> <text style="margin-left: 10rpx"> 骑手</text>
  38. </label>
  39. <label style="margin-left: 96rpx">
  40. <checkbox class="mycheck" :value="2" :checked="checkbox2" /> <text style="margin-left: 10rpx"> 快递员</text>
  41. </label>
  42. </checkbox-group>
  43. </view>
  44. </view>
  45. <view style="padding: 0 96rpx;margin: 96rpx 0 20rpx 0;">
  46. <label class="radio">
  47. <radio value="isAgree" @tap="isAgree = !isAgree" :checked="isAgree" />我已阅读相关条款
  48. </label>
  49. </view>
  50. <view style="padding: 0 96rpx;">
  51. <button class="sub" @tap="formSubmit">提交</button>
  52. </view>
  53. <!-- </form> -->
  54. </view>
  55. </template>
  56. <script>
  57. import {
  58. registerVerify,
  59. } from '@/api/api.js';
  60. import {
  61. Debounce
  62. } from '@/utils/validate.js'
  63. var statusBarHeight = uni.getSystemInfoSync().statusBarHeight + 'px';
  64. let app = getApp();
  65. export default {
  66. data() {
  67. return {
  68. checkbox1: true,
  69. checkbox2: false,
  70. statusBarHeight: app.globalData.statusBarHeight,
  71. navigationBarHeight: 112,
  72. isAgree: false,
  73. isSwitch: false,
  74. name: '',
  75. phone: '',
  76. bindingCaptcha: '',
  77. disabled: false,
  78. text: '发送验证码',
  79. nums: 60,
  80. timer: '',
  81. }
  82. },
  83. methods: {
  84. onVerify() {
  85. let that = this;
  86. if (!that.name) return that.$util.Tips({
  87. title: '请填写姓名!'
  88. });
  89. if (!that.phone) return that.$util.Tips({
  90. title: '请填写手机号码!'
  91. });
  92. if (!(/^1(3|4|5|7|8|9|6)\d{9}$/i.test(that.phone))) return that.$util.Tips({
  93. title: '请输入正确的手机号码!'
  94. });
  95. if (!that.bindingCaptcha) return that.$util.Tips({
  96. title: '请填写验证码!'
  97. });
  98. if (!that.checkbox1 && !that.checkbox2) return that.$util.Tips({
  99. title: '请选择配送职责!'
  100. });
  101. if (!that.isAgree) return that.$util.Tips({
  102. title: '请勾选相关条款!'
  103. });
  104. return true;
  105. },
  106. handBack() {
  107. uni.navigateBack({
  108. delta: 1
  109. })
  110. },
  111. /**
  112. * 发送验证码
  113. *
  114. */
  115. code: Debounce(function() {
  116. this.nums = 60;
  117. uni.showLoading({
  118. title: '加载中',
  119. mask: true
  120. });
  121. let that = this;
  122. if (!that.phone) return that.$util.Tips({
  123. title: '请填写手机号码!'
  124. });
  125. if (!(/^1(3|4|5|7|8|9|6)\d{9}$/i.test(that.phone))) return that.$util.Tips({
  126. title: '请输入正确的手机号码!'
  127. });
  128. // registerVerify().then(res => {
  129. // that.$util.Tips({
  130. // title: res.message
  131. // });
  132. // that.timer = setInterval(that.getTimes, 1000);
  133. // that.disabled = true;
  134. uni.hideLoading();
  135. // })
  136. }),
  137. getTimes() {
  138. this.nums = this.nums - 1;
  139. this.text = "剩余 " + this.nums + "s";
  140. if (this.nums < 0) {
  141. clearInterval(this.timer);
  142. }
  143. this.text = "剩余 " + this.nums + "s";
  144. if (this.text < "剩余 " + 0 + "s") {
  145. this.disabled = false;
  146. this.text = "重新获取";
  147. }
  148. },
  149. checkboxChange(e) {
  150. console.log(e)
  151. },
  152. formSubmit: function() {
  153. if (this.onVerify()) {
  154. const params = {
  155. checkbox1: this.checkbox1, // 骑手
  156. checkbox2: this.checkbox2, // 快递员
  157. isSwitch: this.isSwitch, // 是否有配送经验
  158. name: this.name, // 姓名
  159. phone: this.phone, // 电话
  160. bindingCaptcha: this.bindingCaptcha // 验证码
  161. }
  162. console.log(params)
  163. }
  164. }
  165. },
  166. onLoad(options) {},
  167. mounted() {
  168. },
  169. }
  170. </script>
  171. <style scoped lang="scss">
  172. /* 可以使用 !important 来确保样式覆盖 */
  173. uni-checkbox .uni-checkbox-input {
  174. border-radius: 5rpx !important;
  175. }
  176. .item-box {
  177. display: flex;
  178. align-items: center;
  179. border-bottom: 3rpx solid #D7D8DD;
  180. margin-bottom: 21rpx;
  181. padding-bottom: 21rpx;
  182. margin-right: 38rpx;
  183. .title {
  184. font-weight: 600;
  185. font-size: 27rpx;
  186. color: #141414;
  187. }
  188. input {
  189. flex: 1;
  190. }
  191. }
  192. .code {
  193. padding: 13rpx 23rpx;
  194. font-weight: 400;
  195. font-size: 21rpx;
  196. color: #FFFFFF;
  197. background-color: $bg-color-primary;
  198. }
  199. .code.on {
  200. color: #b9b9bc !important;
  201. }
  202. .sub {
  203. width: 100%;
  204. background-color: #FF6702;
  205. font-weight: 600;
  206. font-size: 35rpx;
  207. color: #FFFFFF;
  208. padding: 25rpx 0;
  209. }
  210. .order-nav {
  211. font-weight: 500;
  212. font-size: 35rpx;
  213. color: #FFFFFF;
  214. position: relative;
  215. background-color: #FF6702;
  216. display: flex;
  217. align-items: center;
  218. justify-content: center;
  219. .back-button {
  220. position: absolute;
  221. left: 20rpx;
  222. }
  223. }
  224. .back-button {
  225. width: 30rpx;
  226. height: 30rpx;
  227. border-right: 4rpx solid #fff;
  228. border-bottom: 4rpx solid #fff;
  229. transform: rotate(135deg);
  230. margin-left: 10rpx;
  231. display: inline-block;
  232. position: relative;
  233. }
  234. </style>