多租户商城-商户小程序端
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.

334 lines
7.6 KiB

3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
  1. <!-- 注册 -->
  2. <template>
  3. <view class="container flex-items-plus flex-column">
  4. <global-loading />
  5. <view class="login-logoBox">
  6. <image class="login-logo" src="https://wechat.hnthee.com/ceres-local-file/image/logo_wechat.png"></image>
  7. </view>
  8. <view class="mar-top-50">
  9. <view class="iphoneNum-box flex-row-plus flex-items">
  10. <view>
  11. <image class="loginIcon" src="https://ceres.zkthink.com/static/images/phone.png"></image>
  12. </view>
  13. <view style="margin-left: 40rpx;">
  14. <input v-model="phone" class="iphoneNum-inputbox" placeholder-class="iphoneNum-input" type="number"
  15. maxlength="11" :placeholder="$t('common.searchproduct_hint')" />
  16. </view>
  17. </view>
  18. <view class="flex-row-plus mar-top-20">
  19. <view class="code-box">
  20. <view>
  21. <image class="loginIcon" src="https://ceres.zkthink.com/static/images/code.png"></image>
  22. </view>
  23. <view style="margin-left: 40rpx;">
  24. <input v-model="RegisterQuery.code" :maxlength="4" class="codeNum-inputbox" placeholder-class="codeNum-input"
  25. :placeholder="$t('common.enterverificationcode')" />
  26. </view>
  27. </view>
  28. <view :class="disabled === true ? 'on' : ''" :disabled="disabled" class="getcode" @click="codede">
  29. {{text}}
  30. </view>
  31. </view>
  32. </view>
  33. <view class="registerBut" @click="onregister">{{$t('page.register')}}</view>
  34. <view class="flex-row-plus mar-top-30">
  35. <text class="font-color-C5AA7B">{{$t('client.alreadyhasaccount')}}</text>
  36. <view class="font-color-47A7EE" @click="gologin">{{$t('client.tologin')}}</view>
  37. </view>
  38. <view class="agreement">
  39. <image v-if="!agreement" src="https://ceres.zkthink.com/static/root/none.png" mode="" @click="agreement=true"></image>
  40. <image v-else src="https://ceres.zkthink.com/static/root/solid.png" mode="" @click="agreement=false"></image>
  41. <text class="font-color-999">{{$t('client.registermeansagree')}}</text><br/>
  42. <text class="font-color-C5AA7B" @click="protocol('app_user_agreement')">{{$t('client.appuserservice')}}</text>{{$t('common.and')}}
  43. <text class="font-color-C5AA7B" @click="protocol('app_privacy_agreement')">{{$t('client.appsafeservice')}}</text>
  44. </view>
  45. </view>
  46. </template>
  47. <script>
  48. import sendVerifyCode from "@/mixins/SendVerifyCode";
  49. const NET = require('../../utils/request')
  50. const API = require('../../config/api')
  51. export default {
  52. data() {
  53. return {
  54. getCodeisWaiting: false,
  55. // 注册
  56. phone: '',
  57. RegisterQuery: {
  58. account: "",
  59. code: "",
  60. },
  61. // 获取验证码
  62. VerifyQuery: {
  63. phone: "",
  64. type: ""
  65. },
  66. agreement: false
  67. }
  68. },
  69. mixins: [sendVerifyCode],
  70. onLoad() {
  71. },
  72. methods: {
  73. // 注册账号
  74. getRegister() {
  75. let phoneCodeVerification = /^1(3\d|4[5-9]|5[0-35-9]|6[2567]|7[0-8]|8\d|9[0-35-9])\d{8}$/;
  76. if (this.phone == '') {
  77. uni.showToast({
  78. title: '请输入手机号!',
  79. duration: 2000,
  80. icon: 'none'
  81. });
  82. } else if (!phoneCodeVerification.test(this.phone)) {
  83. uni.showToast({
  84. title: '请输入正确的手机号!',
  85. duration: 2000,
  86. icon: 'none'
  87. });
  88. } else if (this.RegisterQuery.code == '') {
  89. uni.showToast({
  90. title: '请获取验证码!',
  91. duration: 2000,
  92. icon: 'none'
  93. });
  94. } else if(!this.agreement){
  95. uni.showToast({
  96. title: '请先阅读并同意《用户服务协议和个人隐私协议》',
  97. duration: 2000,
  98. icon: 'none'
  99. });
  100. } else {
  101. // uni.showLoading({
  102. // mask: true,
  103. // title: '正在注册...',
  104. // duration: 2000,
  105. // })
  106. NET.request(API.Login, {
  107. type: 1,
  108. phone: this.phone,
  109. verificationCode: this.RegisterQuery.code,
  110. }, 'POST').then(res => {
  111. uni.hideLoading()
  112. uni.showToast({
  113. title: '注册成功!',
  114. duration: 2000,
  115. icon: 'none'
  116. });
  117. const item = res.data
  118. uni.setStorageSync('storage_key', item);
  119. setTimeout(function() {
  120. uni.switchTab({
  121. url: '../../pages/tabbar/user/index'
  122. })
  123. }, 600)
  124. // uni.navigateTo({
  125. // url: 'accountLogin'
  126. // })
  127. }).catch(res => {
  128. uni.showToast({
  129. title: res.data.message,
  130. duration: 2000,
  131. icon: 'none',
  132. });
  133. })
  134. }
  135. },
  136. // 获取验证码
  137. getVerify() {
  138. let phoneCodeVerification = /^1(3\d|4[5-9]|5[0-35-9]|6[2567]|7[0-8]|8\d|9[0-35-9])\d{8}$/;
  139. if (this.phone == '') {
  140. uni.showToast({
  141. title: '请输入手机号!',
  142. duration: 2000,
  143. icon: 'none'
  144. });
  145. } else if (!phoneCodeVerification.test(this.phone)) {
  146. uni.showToast({
  147. title: '请输入正确的手机号!',
  148. duration: 2000,
  149. icon: 'none'
  150. });
  151. } else {
  152. this.VerifyQuery.phone = this.phone
  153. NET.request(API.Verify, {
  154. phone: this.VerifyQuery.phone,
  155. }, 'GET').then(res => {
  156. this.sendCode()
  157. }).catch(res => {
  158. uni.showToast({
  159. title: res.data.message,
  160. icon: 'none',
  161. duration: 1000
  162. });
  163. })
  164. }
  165. },
  166. // 注册
  167. onregister() {
  168. this.getRegister()
  169. },
  170. // 获取验证码
  171. codede() {
  172. this.getVerify()
  173. },
  174. getCode() {
  175. uni.hideKeyboard()
  176. if (this.getCodeisWaiting) {
  177. return;
  178. }
  179. if (this.phone == "" || this.phone == null) {
  180. uni.showToast({
  181. title: '手机号不能为空',
  182. icon: 'none'
  183. })
  184. return false;
  185. } else if (!(/^1(3\d|4[5-9]|5[0-35-9]|6[2567]|7[0-8]|8\d|9[0-35-9])\d{8}$/.test(this.phone))) {
  186. uni.showToast({
  187. title: '输入的手机号错误',
  188. icon: 'none'
  189. })
  190. return false;
  191. }
  192. this.getCodeisWaiting = true;
  193. },
  194. // 跳转登录
  195. gologin() {
  196. uni.navigateTo({
  197. url: 'login'
  198. })
  199. },
  200. // 多商户用户协议
  201. protocol(type) {
  202. uni.navigateTo({
  203. url: 'protocol?type=' + type
  204. })
  205. },
  206. }
  207. }
  208. </script>
  209. <style lang="scss" scoped>
  210. .container {
  211. background-color: #FFFFFF;
  212. height: 100vh;
  213. .login-logoBox {
  214. margin-top: -200rpx;
  215. .login-logo {
  216. width: 518rpx;
  217. height: 100rpx;
  218. }
  219. }
  220. .iphoneNum-box {
  221. border-bottom: 1rpx solid #F3F4F5;
  222. height: 100rpx;
  223. width: 600rpx;
  224. .loginIcon {
  225. width: 40rpx;
  226. height: 53rpx;
  227. }
  228. input {
  229. font-size: 28rpx;
  230. }
  231. .iphoneNum-input {
  232. color: #999999;
  233. font-size: 28rpx;
  234. font-weight: 400;
  235. }
  236. .iphoneNum-inputbox {
  237. width: 400rpx;
  238. }
  239. }
  240. .code-box {
  241. border-bottom: 1rpx solid #F3F4F5;
  242. height: 100rpx;
  243. width: 350rpx;
  244. display: flex;
  245. flex-direction: row;
  246. justify-content: space-between;
  247. align-items: center;
  248. .loginIcon {
  249. width: 44rpx;
  250. height: 50rpx;
  251. }
  252. input {
  253. font-size: 28rpx;
  254. }
  255. .code-lab {
  256. width: 200rpx;
  257. }
  258. .codeNum-input {
  259. color: #999999;
  260. font-size: 28rpx;
  261. font-weight: 400;
  262. width: 300rpx;
  263. }
  264. .codeNum-inputbox {
  265. width: 300rpx;
  266. }
  267. }
  268. .getcode {
  269. background-color: #C5AA7B;
  270. height: 100rpx;
  271. width: 230rpx;
  272. display: flex;
  273. flex-direction: row;
  274. justify-content: center;
  275. align-items: center;
  276. margin-left: 20rpx;
  277. color: #FFFFFF;
  278. }
  279. .getcodeActive {
  280. background-color: #DDDDDD;
  281. height: 100rpx;
  282. width: 220rpx;
  283. border-radius: 44rpx;
  284. display: flex;
  285. flex-direction: row;
  286. justify-content: center;
  287. align-items: center;
  288. margin-left: 20rpx;
  289. color: #333333;
  290. }
  291. .registerBut {
  292. background: #333333;
  293. color: #FFFFFF;
  294. height: 88rpx;
  295. width: 600rpx;
  296. text-align: center;
  297. line-height: 88rpx;
  298. margin-top: 140rpx;
  299. }
  300. .agreement {
  301. margin: 100rpx 50rpx;
  302. line-height: 50rpx;
  303. image{
  304. width: 34rpx;
  305. height: 34rpx;
  306. margin-right: 15upx;
  307. }
  308. }
  309. }
  310. </style>