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

422 lines
9.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
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
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. <!-- 注册 -->
  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="http://36.138.125.206:8081/ceres-local-file/image/logo_wechat.png"></image>
  7. </view>-->
  8. <view
  9. class="login-title"
  10. :style="{'top': topHeight + 'px'}"
  11. >
  12. <view class="login-top-info">
  13. <view class="backBox">
  14. <image
  15. src="http://36.138.125.206:8081/ceres-local-file/image/title_black_back.png"
  16. class="back"
  17. @click="back"
  18. ></image>
  19. </view>
  20. <view class="fs32 font-color-252744">{{$t('page.register')}}</view>
  21. </view>
  22. </view>
  23. <image class="login-top" src="http://36.138.125.206:8081/ceres-local-file/image/login_top.png"/>
  24. <image class="login-bottom" src="http://36.138.125.206:8081/ceres-local-file/image/login_bottom.png"/>
  25. <view style="margin-top: 200rpx">
  26. <view class="iphoneNum-box flex-row-plus flex-items">
  27. <view>
  28. <image class="loginIcon" src="http://36.138.125.206:8081/ceres-local-file/image/login_phone_label.png"></image>
  29. </view>
  30. <view style="margin-left: 20rpx;">
  31. <input v-model="phone" class="iphoneNum-inputbox" placeholder-class="iphoneNum-input" type="number"
  32. maxlength="11" :placeholder="$t('common.entermobilephone')" />
  33. </view>
  34. </view>
  35. <view class="flex-row-plus mar-top-30">
  36. <view class="code-box">
  37. <view>
  38. <image class="loginIcon" src="http://36.138.125.206:8081/ceres-local-file/image/login_psd_label.png"></image>
  39. </view>
  40. <view style="margin-left: 20rpx;">
  41. <input v-model="RegisterQuery.code" :maxlength="4" class="codeNum-inputbox" placeholder-class="codeNum-input"
  42. :placeholder="$t('common.enterverificationcode')" />
  43. </view>
  44. <view :class="disabled === true ? 'on' : ''" :disabled="disabled" class="getcode" @click="codede">
  45. {{text}}
  46. </view>
  47. </view>
  48. </view>
  49. </view>
  50. <view class="registerBut" @click="onregister">{{$t('page.register')}}</view>
  51. <view class="flex-row-plus mar-top-30">
  52. <text class="fs28 font-color-252744">{{$t('client.alreadyhasaccount')}}</text>
  53. <view class="fs28 font-color-f5be51" @click="gologin">{{$t('client.tologin')}}</view>
  54. </view>
  55. <view class="agreement">
  56. <view style="display: flex;align-items: center">
  57. <image v-if="!agreement" src="http://36.138.125.206:8081/ceres-local-file/image/icon_cart_select_normal.png" mode="" @click="agreement=true"></image>
  58. <image v-else src="http://36.138.125.206:8081/ceres-local-file/image/icon_cart_select_active.png" mode="" @click="agreement=false"></image>
  59. <text class="fs28 font-color-595B6B">{{$t('client.registermeansagree')}}</text><br/>
  60. </view>
  61. <view style="margin-top: 10rpx">
  62. <text class="fs28 font-color-f5be51" @click="protocol('app_user_agreement')">{{$t('client.appuserservice')}}</text>{{$t('common.and')}}
  63. <text class="fs28 font-color-f5be51" @click="protocol('app_privacy_agreement')">{{$t('client.appsafeservice')}}</text>
  64. </view>
  65. </view>
  66. </view>
  67. </template>
  68. <script>
  69. import sendVerifyCode from "@/mixins/SendVerifyCode";
  70. const NET = require('../../utils/request')
  71. const API = require('../../config/api')
  72. export default {
  73. data() {
  74. return {
  75. getCodeisWaiting: false,
  76. // 注册
  77. phone: '',
  78. RegisterQuery: {
  79. account: "",
  80. code: "",
  81. },
  82. // 获取验证码
  83. VerifyQuery: {
  84. phone: "",
  85. type: ""
  86. },
  87. agreement: false,
  88. topHeight: 10,
  89. }
  90. },
  91. mixins: [sendVerifyCode],
  92. onLoad() {
  93. // #ifdef MP-WEIXIN || MP-BAIDU || MP-TOUTIAO || MP-QQ
  94. let menuButtonInfo = uni.getMenuButtonBoundingClientRect()
  95. this.topHeight = menuButtonInfo.top
  96. // #endif
  97. // #ifdef APP
  98. this.topHeight = 50
  99. // #endif
  100. },
  101. methods: {
  102. // 注册账号
  103. getRegister() {
  104. 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}$/;
  105. if (this.phone == '') {
  106. uni.showToast({
  107. title: '请输入手机号!',
  108. duration: 2000,
  109. icon: 'none'
  110. });
  111. } else if (!phoneCodeVerification.test(this.phone)) {
  112. uni.showToast({
  113. title: '请输入正确的手机号!',
  114. duration: 2000,
  115. icon: 'none'
  116. });
  117. } else if (this.RegisterQuery.code == '') {
  118. uni.showToast({
  119. title: '请获取验证码!',
  120. duration: 2000,
  121. icon: 'none'
  122. });
  123. } else if(!this.agreement){
  124. uni.showToast({
  125. title: '请先阅读并同意《用户服务协议和个人隐私协议》',
  126. duration: 2000,
  127. icon: 'none'
  128. });
  129. } else {
  130. // uni.showLoading({
  131. // mask: true,
  132. // title: '正在注册...',
  133. // duration: 2000,
  134. // })
  135. NET.request(API.Login, {
  136. type: 1,
  137. phone: this.phone,
  138. verificationCode: this.RegisterQuery.code,
  139. }, 'POST').then(res => {
  140. uni.hideLoading()
  141. uni.showToast({
  142. title: '注册成功!',
  143. duration: 2000,
  144. icon: 'none'
  145. });
  146. const item = res.data
  147. uni.setStorageSync('storage_key', item);
  148. setTimeout(function() {
  149. uni.switchTab({
  150. url: '../../pages/tabbar/user/index'
  151. })
  152. }, 600)
  153. // uni.navigateTo({
  154. // url: 'accountLogin'
  155. // })
  156. }).catch(res => {
  157. uni.showToast({
  158. title: res.data.message,
  159. duration: 2000,
  160. icon: 'none',
  161. });
  162. })
  163. }
  164. },
  165. // 获取验证码
  166. getVerify() {
  167. 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}$/;
  168. if (this.phone == '') {
  169. uni.showToast({
  170. title: '请输入手机号!',
  171. duration: 2000,
  172. icon: 'none'
  173. });
  174. } else if (!phoneCodeVerification.test(this.phone)) {
  175. uni.showToast({
  176. title: '请输入正确的手机号!',
  177. duration: 2000,
  178. icon: 'none'
  179. });
  180. } else {
  181. this.VerifyQuery.phone = this.phone
  182. NET.request(API.Verify, {
  183. phone: this.VerifyQuery.phone,
  184. }, 'GET').then(res => {
  185. this.sendCode()
  186. }).catch(res => {
  187. uni.showToast({
  188. title: res.data.message,
  189. icon: 'none',
  190. duration: 1000
  191. });
  192. })
  193. }
  194. },
  195. // 注册
  196. onregister() {
  197. this.getRegister()
  198. },
  199. // 获取验证码
  200. codede() {
  201. this.getVerify()
  202. },
  203. getCode() {
  204. uni.hideKeyboard()
  205. if (this.getCodeisWaiting) {
  206. return;
  207. }
  208. if (this.phone == "" || this.phone == null) {
  209. uni.showToast({
  210. title: '手机号不能为空',
  211. icon: 'none'
  212. })
  213. return false;
  214. } 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))) {
  215. uni.showToast({
  216. title: '输入的手机号错误',
  217. icon: 'none'
  218. })
  219. return false;
  220. }
  221. this.getCodeisWaiting = true;
  222. },
  223. // 跳转登录
  224. gologin() {
  225. uni.navigateTo({
  226. url: 'login'
  227. })
  228. },
  229. // 多商户用户协议
  230. protocol(type) {
  231. uni.navigateTo({
  232. url: 'protocol?type=' + type
  233. })
  234. },
  235. // 返回上一级
  236. back() {
  237. uni.navigateBack()
  238. }
  239. }
  240. }
  241. </script>
  242. <style lang="scss" scoped>
  243. .container {
  244. background-color: #FFFFFF;
  245. height: 100vh;
  246. .login-logoBox {
  247. margin-top: -200rpx;
  248. .login-logo {
  249. width: 518rpx;
  250. height: 100rpx;
  251. }
  252. }
  253. .iphoneNum-box {
  254. display: flex;
  255. align-items: center;
  256. height: 98rpx;
  257. width: 620rpx;
  258. background: #f2f2f6;
  259. border-radius: 50rpx;
  260. .loginIcon {
  261. width: 44rpx;
  262. height: 44rpx;
  263. margin-left: 47rpx;
  264. margin-top: 10rpx;
  265. }
  266. input {
  267. font-size: 28rpx;
  268. }
  269. .iphoneNum-input {
  270. color: #BCBDC6;
  271. font-size: 28rpx;
  272. font-weight: 400;
  273. }
  274. .iphoneNum-inputbox {
  275. width: 400rpx;
  276. }
  277. }
  278. .code-box {
  279. display: flex;
  280. height: 98rpx;
  281. width: 620rpx;
  282. background: #f2f2f6;
  283. border-radius: 50rpx;
  284. flex-direction: row;
  285. justify-content: space-between;
  286. align-items: center;
  287. .loginIcon {
  288. width: 44rpx;
  289. height: 44rpx;
  290. margin-top: 10rpx;
  291. margin-left: 47rpx;
  292. }
  293. input {
  294. font-size: 28rpx;
  295. }
  296. .code-lab {
  297. width: 200rpx;
  298. }
  299. .codeNum-input {
  300. color: #BCBDC6;
  301. font-size: 28rpx;
  302. font-weight: 400;
  303. width: 300rpx;
  304. }
  305. .codeNum-inputbox {
  306. width: 300rpx;
  307. }
  308. }
  309. .getcode {
  310. //background-color: #C5AA7B;
  311. height: 100rpx;
  312. width: 230rpx;
  313. display: flex;
  314. flex-direction: row;
  315. justify-content: center;
  316. align-items: center;
  317. margin-left: 20rpx;
  318. color: #252744;
  319. }
  320. .getcodeActive {
  321. background-color: #DDDDDD;
  322. height: 100rpx;
  323. width: 220rpx;
  324. border-radius: 44rpx;
  325. display: flex;
  326. flex-direction: row;
  327. justify-content: center;
  328. align-items: center;
  329. margin-left: 20rpx;
  330. color: #333333;
  331. }
  332. .registerBut {
  333. background: #252744;
  334. color: #FFFFFF;
  335. border-radius: 50rpx;
  336. height: 98rpx;
  337. width: 620rpx;
  338. text-align: center;
  339. line-height: 98rpx;
  340. margin-top: 90rpx;
  341. font-size: 32rpx;
  342. }
  343. .agreement {
  344. margin: 120rpx 50rpx;
  345. line-height: 50rpx;
  346. image{
  347. width: 40rpx;
  348. height: 40rpx;
  349. margin-right: 15upx;
  350. }
  351. }
  352. }
  353. .login-title {
  354. width: 100%;
  355. position: fixed;
  356. z-index: 99;
  357. left: 0;
  358. .login-top-info {
  359. position: relative;
  360. width: 100%;
  361. height: 60rpx;
  362. display: flex;
  363. align-items: center;
  364. justify-content: center;
  365. }
  366. .backBox {
  367. position: absolute;
  368. left: 10rpx;
  369. top: 0rpx;
  370. .back {
  371. width: 20rpx;
  372. height: 34rpx;
  373. padding: 15rpx 10rpx;
  374. }
  375. }
  376. }
  377. .login-top{
  378. width: 325rpx;
  379. height: 263rpx;
  380. position: fixed;
  381. top: 0;
  382. right: 0;
  383. }
  384. .login-bottom{
  385. width: 646rpx;
  386. height: 376rpx;
  387. position: fixed;
  388. bottom: 0;
  389. left: 0;
  390. }
  391. </style>