register.php 4.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143
  1. <?php
  2. use common\helpers\Html;
  3. use yii\helpers\Url;
  4. use common\helpers\ArrayHelper;
  5. use yii\widgets\ActiveForm;
  6. $this->title = '商家入驻';
  7. ?>
  8. <style>
  9. .register-box {
  10. width: 360px;
  11. margin: 7% auto;
  12. }
  13. .register-logo {
  14. font-size: 35px;
  15. text-align: center;
  16. margin-bottom: 25px;
  17. font-weight: 300;
  18. }
  19. .register-box-body {
  20. background: #fff;
  21. padding: 20px;
  22. border-top: 0;
  23. color: #666;
  24. }
  25. </style>
  26. <body class="register-page">
  27. <div class="register-box">
  28. <div class="register-logo">
  29. <?= Html::a(Html::encode($this->title),
  30. ['/']); ?>
  31. </div>
  32. <div class="register-box-body">
  33. <p class="login-box-msg">商家入驻</p>
  34. <?php $form = ActiveForm::begin([
  35. 'id' => 'register-form',
  36. ]); ?>
  37. <?= $form->field($model, 'title')->textInput(['placeholder' => '店铺名称'])->label(false); ?>
  38. <?= $form->field($model, 'cate_id')->widget(common\widgets\cascader\Cascader::class, [
  39. 'data' => $merchantCate,
  40. 'options' => [
  41. 'style' => 'width:100%',
  42. 'placeholder' => '请选择主营行业',
  43. ]
  44. ])->label(false); ?>
  45. <?= $form->field($model, 'auth_role_id')->dropDownList(ArrayHelper::merge(['' => '请选择开店套餐'], $authRoleEnter))->label(false); ?>
  46. <?= $form->field($model, 'mobile')->textInput(['placeholder' => '手机号码', 'id' => 'mobile'])->label(false); ?>
  47. <?= $form->field($model, 'code', [
  48. 'template' => "
  49. <div class='input-group'>
  50. {input}
  51. <span class='input-group-btn'>
  52. <button type='button' class='btn btn-white btn-flat'>获取验证码</button>
  53. </span>
  54. </div>\n{hint}\n{error}",
  55. ])->textInput(['placeholder' => '验证码'])->label(false); ?>
  56. <?= $form->field($model, 'username')->textInput(['placeholder' => '用户名'])->label(false); ?>
  57. <?= $form->field($model, 'password')->passwordInput(['placeholder' => '用户密码'])->label(false); ?>
  58. <?= $form->field($model, 're_pass')->passwordInput(['placeholder' => '确认密码'])->label(false); ?>
  59. <div class="form-group field-signupform-rememberme has-error">
  60. <input type="hidden" name="SignUpForm[rememberMe]" value="0">
  61. <label>
  62. <input type="checkbox" id="signupform-rememberme" name="SignUpForm[rememberMe]" value="1">
  63. <?= '我同意' . \yii\helpers\Html::a('《' . $registerProtocolTitle . '》', ['register-protocol'], [
  64. 'target' => '_blank',
  65. 'class' => 'blue'
  66. ])?>
  67. </label>
  68. <div class="help-block"><?= $model->getFirstError('rememberMe')?></div>
  69. </div>
  70. <div class="form-group">
  71. <?= Html::submitButton('马上注册', ['class' => 'btn btn-primary btn-block']) ?>
  72. </div>
  73. <?php ActiveForm::end(); ?>
  74. <div class="social-auth-links text-center">已有账号?<?= Html::a('立即登录', ['login'], [
  75. 'class' => 'blue'
  76. ]); ?></div>
  77. <div class="social-auth-links text-center">
  78. <p><?= Html::encode(Yii::$app->services->config->backendConfig('web_copyright')); ?></p>
  79. </div>
  80. </div>
  81. <!-- /.form-box -->
  82. </div>
  83. </body>
  84. <script>
  85. var time = 0;
  86. $('.btn-flat').click(function () {
  87. var mobile = $('#mobile').val();
  88. if (mobile.length === 0) {
  89. rfMsg('请输入手机号码');
  90. return;
  91. }
  92. if (mobile.length !== 11) {
  93. rfMsg('请输入正确的手机号码');
  94. return;
  95. }
  96. if (time <= 0) {
  97. $.ajax({
  98. type: "post",
  99. url: "<?= Url::to(['sms-code'])?>",
  100. dataType: "json",
  101. data: {mobile: mobile, usage: 'merchant-register'},
  102. success: function (result) {
  103. if (parseInt(result.code) === 200) {
  104. if (result.data.code) {
  105. rfMsg('你的验证码为: ' + result.data.code);
  106. }
  107. } else {
  108. rfMsg(result.message);
  109. }
  110. }
  111. });
  112. time = 60;
  113. getRandomCode();
  114. }
  115. })
  116. //倒计时
  117. function getRandomCode() {
  118. if (time === 0) {
  119. $('.btn-flat').text('获取验证码');
  120. return;
  121. } else {
  122. time--;
  123. $('.btn-flat').text('剩余' + time + "秒");
  124. }
  125. setTimeout(function() {
  126. getRandomCode();
  127. },1000);
  128. }
  129. </script>
粤ICP备19079148号