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.

170 lines
3.7 KiB

2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
  1. <template>
  2. <view class="app-container">
  3. <view class="login-content">
  4. <view class="login-font">
  5. <image style="width: 364rpx;height: 200rpx;" src="/static/login/merchant-copy.png" alt="" />
  6. </view>
  7. <view class="login-main">
  8. <view class="login-item">
  9. <input type="tel" class="log-phone" placeholder="请输入手机号" v-model="phone" />
  10. </view>
  11. <view class="login-item">
  12. <input type="number" class="log-phone log-code" placeholder="请输入验证码" v-model="sms_code" />
  13. <view class="getCode" @click="getCode">
  14. 获取验证码
  15. </view>
  16. </view>
  17. <view class="login-btn">
  18. <button size="default" type="default" @click="btnLogin"
  19. style="color:#ffffff;backgroundColor:#F52F3E;borderColor:#F52F3EF;border-radius: 50rpx;height: 88rpx;line-height: 88rpx;">登录</button>
  20. </view>
  21. <view class="login-sign">
  22. <u-radio-group v-model="value">
  23. <u-radio labelSize="13" size="20" label="我同意"></u-radio>
  24. </u-radio-group>
  25. <view class="log-link" @click="handlerApply">
  26. 排队支付商户用户服务协议
  27. </view>
  28. <view class="log-link" @click="handlerProtect">
  29. 隐私保护协议
  30. </view>
  31. </view>
  32. </view>
  33. </view>
  34. <u-toast ref="uToast"></u-toast>
  35. <u-modal :show="show" @confirm="confirm" :title="title" :content='content'></u-modal>
  36. </view>
  37. </template>
  38. <script>
  39. import {
  40. publicSendSms,
  41. merchantSmsLogin
  42. } from '../../common/api.js'
  43. import md5 from 'js-md5'
  44. export default {
  45. data() {
  46. return {
  47. phone: '',
  48. sms_code: '',
  49. bgColor: '#bgColor',
  50. value: 1,
  51. show: false,
  52. title: '',
  53. content: ''
  54. };
  55. },
  56. methods: {
  57. getCode() {
  58. let phone = this.phone
  59. let nonce_str = md5(Math.random() + '');
  60. let sign = md5(md5(phone) + md5(nonce_str) + nonce_str)
  61. publicSendSms({
  62. phone,
  63. nonce_str,
  64. sign,
  65. type: 1
  66. }).then(() => {
  67. this.$refs.uToast.show({
  68. message: '短信已发送'
  69. })
  70. })
  71. },
  72. handlerApply() {
  73. this.show = true;
  74. this.title = '排队支付商户用户服务协议';
  75. this.content = '排队支付商户用户服务协议';
  76. },
  77. handlerProtect() {
  78. this.show = true;
  79. this.title = '隐私保护协议';
  80. this.content = '隐私保护协议';
  81. },
  82. confirm() {
  83. this.show = false;
  84. },
  85. btnLogin() {
  86. merchantSmsLogin({
  87. phone: this.phone,
  88. sms_code: this.sms_code
  89. }).then(data => {
  90. uni.setStorageSync('merchant_token', data.token)
  91. uni.navigateTo({
  92. url: '/pages/merchant-index/index'
  93. });
  94. })
  95. }
  96. }
  97. }
  98. </script>
  99. <style lang="scss">
  100. .login-content {
  101. width: 100%;
  102. height: 1600rpx;
  103. padding-left: 30rpx;
  104. padding-right: 30rpx;
  105. background: url(../../static/login/merchant-bg.png) no-repeat center center;
  106. background-size: cover;
  107. box-sizing: border-box;
  108. .login-font {
  109. width: 364rpx;
  110. height: 200rpx;
  111. padding-top: 80rpx;
  112. }
  113. .login-main {
  114. margin-top: 120rpx;
  115. .login-item {
  116. position: relative;
  117. margin-top: 40rpx;
  118. .log-phone {
  119. width: 100%;
  120. height: 88rpx;
  121. line-height: 88rpx;
  122. padding-left: 50rpx;
  123. border-radius: 44rpx;
  124. border: none;
  125. box-sizing: border-box;
  126. background-color: #fff;
  127. font-size: 16px;
  128. color: #454545;
  129. }
  130. .getCode {
  131. position: absolute;
  132. right: 50rpx;
  133. top: 30rpx;
  134. font-size: 12px;
  135. color: #454545;
  136. cursor: pointer;
  137. }
  138. }
  139. .login-btn {
  140. margin-top: 80rpx;
  141. }
  142. .login-sign {
  143. display: flex;
  144. justify-content: flex-start;
  145. margin-top: 30rpx;
  146. padding-left: 20rpx;
  147. .u-radio-group {
  148. flex-grow: 0;
  149. margin-right: 60rpx;
  150. }
  151. .log-link {
  152. height: 40rpx;
  153. line-height: 40rpx;
  154. font-size: 12px;
  155. }
  156. }
  157. }
  158. }
  159. </style>