externalRegistered.vue 9.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417
  1. <template>
  2. <view class="container">
  3. <view class="container_text">
  4. <image class="banner-img" src="/static/img/logo.png" mode="scaleToFill"></image>
  5. </view>
  6. <view class="loginTitle"><text>注册</text></view>
  7. <view class="login_text">
  8. <view class="login_input flex">
  9. <view class="login_img">
  10. <image src="/static/icon/phone.png"></image>
  11. </view>
  12. <view class="login_name"><input class="uni-input" type="text" v-model="phone" focus
  13. placeholder="请输入手机号" /></view>
  14. </view>
  15. <view class="login_input flex">
  16. <view class="login_img">
  17. <image src="/static/icon/pread.png"></image>
  18. </view>
  19. <view class="login_name"><input class="uni-input" type="text" v-model="register" focus
  20. placeholder="请输入推荐人id" :disabled="isregister" /></view>
  21. </view>
  22. <view class="login_input flex">
  23. <view class="login_img">
  24. <image src="/static/icon/psw.png"></image>
  25. </view>
  26. <view class="login_name"><input class="uni-input" type="password" v-model="password" focus
  27. placeholder="请输入密码" /></view>
  28. </view>
  29. <view class="login_input flex">
  30. <view class="login_img">
  31. <image src="/static/icon/psw.png"></image>
  32. </view>
  33. <view class="login_name"><input class="uni-input" type="password" v-model="repassword" focus
  34. placeholder="请重复输入密码" /></view>
  35. </view>
  36. <view class="login_input flex">
  37. <view class="login_img">
  38. <image src="/static/icon/code.png"></image>
  39. </view>
  40. <view class="login_name flex">
  41. <input class="uni-input width" v-model="code" focus placeholder="请输入验证码" />
  42. <view class="code" @click="verification">{{ countDown == 0 ? '验证码' : countDown }}</view>
  43. </view>
  44. </view>
  45. <!-- <view class="login_input flex">
  46. <view class="login_img"><image src="/static/icon/dw.png"></image></view>
  47. <picker v-if="!isparent_area" @change="bindParentArea" :value="parent_area" :range="parent_areas" class="uni-input">
  48. <view class="placeholder" v-if="parent_area === ''">请选择区域</view>
  49. <text>{{ parent_area }}</text>
  50. </picker>
  51. <view class="login_name" v-else><input class="uni-input" type="text" v-model="parent_area" focus disabled /></view>
  52. </view> -->
  53. <!-- <view class="login_input flex">
  54. <view class="login_img"><image src="/static/icon/dw.png"></image></view>
  55. <picker @change="bindPayType" :value="pay_type" :range="pay_types" class="uni-input">
  56. <view class="placeholder" v-if="pay_type === ''">请选择支付方式</view>
  57. <text>{{ pay_type }}</text>
  58. </picker>
  59. </view> -->
  60. <!-- <view class="login_input flex">
  61. <view class="login_img"><image src="/static/icon/jft.png"></image></view>
  62. <view class="uni-input" style="color: #999;">
  63. 是否使用积分抵扣
  64. <image src="../../static/icon/noselect.png" mode="" v-if="!isSelsect" @click="jfdk(1)"></image>
  65. <image src="../../static/icon/select.png" mode="" v-if="isSelsect" @click="jfdk(0)"></image>
  66. </view>
  67. </view> -->
  68. <view><button type="green" @click="getRegister" class="uni-button uni-button-green">注册账号</button></view>
  69. </view>
  70. </view>
  71. </template>
  72. <script>
  73. import {
  74. register,
  75. getUserInfo,
  76. verify
  77. } from '@/api/login.js';
  78. export default {
  79. data() {
  80. return {
  81. phone: '', //用户
  82. password: '', //密码
  83. repassword: '',
  84. //这里需要推荐人的id
  85. register: '',
  86. // invitation: '', //接点人id
  87. code: '', //验证码
  88. time: '', //保存倒计时对象
  89. countDown: 0, //倒计时
  90. // parent_area: '',//区域
  91. // parent_areas: ['A','B','C'],//区域列表
  92. // pay_type: '',
  93. // pay_types: ['余额','佣金'],
  94. // isSelsect: false,
  95. isregister: false
  96. // isparent_area: false,
  97. };
  98. },
  99. onLoad(option) {
  100. if (option.id) {
  101. console.log(option.id,'id')
  102. this.register = option.id
  103. console.log(this.register,'this')
  104. this.register = true;
  105. }
  106. // this.getRegister()
  107. // if(option.area){
  108. // this.parent_area = option.area
  109. // this.isparent_area = true
  110. // }
  111. // 获取扫码邀请人id
  112. // this.invitation = uni.getStorageSync('spread')||'';
  113. },
  114. watch: {
  115. // 监听倒计时
  116. countDown(i) {
  117. if (i == 0) {
  118. clearInterval(this.time);
  119. }
  120. }
  121. },
  122. methods: {
  123. //选择是否积分抵扣
  124. jfdk(index) {
  125. if (index == 1) {
  126. this.isSelsect = true
  127. } else {
  128. this.isSelsect = false
  129. }
  130. },
  131. //选择区域
  132. bindParentArea(e) {
  133. console.log(e.detail.value)
  134. this.parent_area = this.parent_areas[e.detail.value]
  135. },
  136. //选择值支付方式
  137. bindPayType(e) {
  138. console.log(e)
  139. if (e.detail.value) {
  140. this.pay_type = this.pay_types[e.detail.value]
  141. } else if (e.detail.value == 0) {
  142. this.pay_type = this.pay_types[e.detail.value]
  143. }
  144. },
  145. // 注册
  146. getRegister() {
  147. let obj = this;
  148. if (obj.phone == '') {
  149. obj.$api.msg('请输入手机号');
  150. return;
  151. }
  152. if (obj.password == '') {
  153. obj.$api.msg('请输入密码');
  154. return;
  155. }
  156. if (obj.repassword == '') {
  157. obj.$api.msg('请再次输入密码');
  158. return;
  159. }
  160. if (obj.repassword != obj.password) {
  161. obj.$api.msg('两次密码不正确');
  162. return;
  163. }
  164. if (obj.code == '') {
  165. obj.$api.msg('请输入验证吗');
  166. return;
  167. }
  168. // if(obj.parent_area == '') {
  169. // obj.$api.msg('请选择区域');
  170. // return;
  171. // }
  172. // if(obj.pay_type == '') {
  173. // obj.$api.msg('请选择支付方式');
  174. // return;
  175. // }
  176. // let paytype = ''
  177. // if(obj.pay_type == '微信') {
  178. // paytype = 'weixin'
  179. // }else if(obj.pay_type == '余额') {
  180. // paytype = 'yue'
  181. // }else if(obj.pay_type == '佣金') {
  182. // paytype = 'brokerage'
  183. // }
  184. register({
  185. account: obj.phone, //账号
  186. captcha: obj.code, //验证码
  187. password: obj.password, //密码
  188. // parent: obj.invitation,//接点人uid
  189. register: obj.register, //推荐人id
  190. // parent_area: obj.parent_area,//区域
  191. // pay_type: paytype,
  192. // use_integral: obj.isSelsect ? '1':'0',
  193. from: 'APP'
  194. }).then(function(e) {
  195. console.log(e, '1111');
  196. uni.showToast({
  197. title: '注册成功',
  198. duration: 2000,
  199. position: 'top'
  200. });
  201. // setTimeout(function () {
  202. // uni.navigateTo({
  203. // url: '/pages/user/user'
  204. // });
  205. // },1000)
  206. setTimeout(() => {
  207. uni.switchTab({
  208. url: '/pages/index/index'
  209. },1000);
  210. })
  211. }).catch(err => {
  212. console.log(err)
  213. })
  214. },
  215. //发送验证码
  216. verification() {
  217. let obj = this;
  218. if (this.phone == '') {
  219. this.$api.msg('请输入电话号码');
  220. return;
  221. }
  222. if (this.phone.length < 11) {
  223. this.$api.msg('请输入正确的手机号');
  224. return;
  225. }
  226. // 判断是否在倒计时
  227. if (obj.countDown > 0) {
  228. return false;
  229. } else {
  230. obj.countDown = 60;
  231. obj.time = setInterval(() => {
  232. obj.countDown--;
  233. }, 1000);
  234. //调用验证码接口
  235. verify({
  236. phone: obj.phone,
  237. type: 'register'
  238. })
  239. .then(({
  240. data
  241. }) => {})
  242. .catch(err => {
  243. console.log(err);
  244. });
  245. }
  246. },
  247. login() {
  248. //返回登录
  249. uni.navigateTo({
  250. url: '/pages/public/login'
  251. });
  252. }
  253. }
  254. };
  255. </script>
  256. <style lang="scss">
  257. page {
  258. height: 100%;
  259. }
  260. .container {
  261. width: 100%;
  262. height: 100%;
  263. background-size: 100%;
  264. background-color: #fff;
  265. }
  266. .container_text {
  267. width: 100%;
  268. height: 500rpx;
  269. top: 0rpx;
  270. // background-color: #FF4343;
  271. .banner-img {
  272. width: 100%;
  273. height: 100%;
  274. }
  275. }
  276. .login_text {
  277. margin: auto 30rpx;
  278. position: relative;
  279. padding: 100rpx 102rpx;
  280. background-color: #ffffff;
  281. // margin-top: -180rpx;
  282. border-radius: 20rpx;
  283. .login_input {
  284. border-bottom: 1px solid #f0f0f0;
  285. margin-bottom: 65rpx;
  286. .login_img image {
  287. height: 35rpx;
  288. width: 29rpx;
  289. margin-right: 20rpx;
  290. }
  291. .uni-input {
  292. text-align: left;
  293. width: 470rpx;
  294. font-size: 28rpx !important;
  295. position: relative;
  296. image {
  297. width: 30rpx;
  298. height: 30rpx;
  299. position: absolute;
  300. right: 0;
  301. }
  302. }
  303. .login_name {
  304. color: #333333;
  305. }
  306. }
  307. .other {
  308. margin-top: 60rpx;
  309. .fenge {
  310. width: 30%;
  311. height: 2rpx;
  312. background-color: #eeeeee;
  313. }
  314. .qita {
  315. font-size: 28rpx;
  316. color: #999999;
  317. }
  318. }
  319. .weixin {
  320. width: 75rpx;
  321. height: 75rpx;
  322. margin: 25rpx auto;
  323. }
  324. .weixin image {
  325. width: 100%;
  326. height: 100%;
  327. }
  328. .weixin_text {
  329. text-align: center;
  330. font-size: 28rpx;
  331. color: #999999;
  332. }
  333. .forget {
  334. font-size: 28rpx;
  335. width: 100%;
  336. text-align: right;
  337. color: #999999;
  338. }
  339. .uni-button-green {
  340. color: #ffffff;
  341. background-color: $base-color;
  342. margin: 40rpx 10rpx;
  343. border-radius: 10rpx;
  344. }
  345. .uni-button-green-plain {
  346. border: 1px solid $base-color;
  347. margin: 40rpx 10rpx;
  348. border-radius: 50rpx;
  349. color: $base-color;
  350. background-color: #ffffff;
  351. }
  352. .uni-button {
  353. height: 85rpx;
  354. line-height: 85rpx;
  355. }
  356. }
  357. .loginTitle {
  358. position: absolute;
  359. top: 250rpx;
  360. width: 100%;
  361. text-align: center;
  362. color: white;
  363. font-size: 40rpx;
  364. }
  365. .forget {
  366. width: 100rpx;
  367. font-size: 24rpx;
  368. color: #ffffff;
  369. margin: 0px auto;
  370. border-bottom: 1px solid #ffffff;
  371. }
  372. .width {
  373. width: 325rpx !important;
  374. }
  375. .code {
  376. color: $base-color;
  377. font-size: 23rpx;
  378. border-left: 1px solid #eeeeee;
  379. width: 150rpx;
  380. flex-shrink: 0;
  381. text-align: center;
  382. }
  383. uni-button {
  384. height: 80rpx !important;
  385. line-height: 80rpx !important;
  386. }
  387. </style>