orderissuer.vue 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472
  1. <template>
  2. <view class="page">
  3. <!-- 公共组件-每个页面必须引入 -->
  4. <public-module></public-module>
  5. <view class="dis j-end a-c">
  6. <image src="../../static/image/login/3.png" mode=""
  7. style="height:260px;width: calc(100% - 16px);margin-top: 120px;">
  8. </image>
  9. </view>
  10. <view class="input-data1">
  11. <u-tabs :list="list" :is-scroll="true" :current="current" @change="change"
  12. style="background: transparent;margin-bottom: 10px;"></u-tabs>
  13. <view class="input-data">
  14. <view class="phone d-flex">
  15. <image src="../../static/image/login/shoujihao.png" mode="" style="width: 18px;height: 18px;">
  16. </image>
  17. <input placeholder="请输入手机号" v-model="phone" maxlength="11" />
  18. </view>
  19. <view class="phone d-flex">
  20. <image src="../../static/image/login/name.png" mode="" style="width: 18px;height: 18px;">
  21. </image>
  22. <input placeholder="请输入姓名" v-model="name" />
  23. </view>
  24. <view class="password d-flex">
  25. <image src="../../static/image/login/mima.png" mode="" style="width: 18px;height: 18px;">
  26. </image>
  27. <input placeholder="请输入密码" v-model="password" :password='isHidePassword' maxlength="15"
  28. style="padding-right: 200rpx;" />
  29. <view class=" position-absolute top-0 right-0 d-flex a-center j-center"
  30. style="width: 200rpx;height: 100%;">
  31. <image
  32. :src="isHidePassword?'../../static/image/login/biyan.png':'../../static/image/login/zhengyan.png'"
  33. @tap="isHidePassword = !isHidePassword" mode="" style="width: 18px;height: 18px;">
  34. </view>
  35. </view>
  36. <view class="code d-flex">
  37. <image src="../../static/image/login/yanzhengma.png" mode="" style="width: 18px;height: 18px;">
  38. </image>
  39. <input placeholder="请输入验证码" v-model="code" maxlength="4" style="padding-right: 200rpx;" />
  40. <view class="d-flex a-center j-center login-font-color yanzhengma" @tap="getCheckNum">
  41. <view class="d-flex a-center j-center"
  42. :class="!codetime?'yanzhengma1 text-color':'yanzhengma2'">
  43. {{!codetime?'获取验证码':codetime+' s'}}
  44. </view>
  45. </view>
  46. </view>
  47. </view>
  48. <view class="mx-3 mt-3" v-if="showRecommend">
  49. <view class=" mas-title dis j-start a-c">
  50. <image src="../../static/image/login/1.png" mode=""
  51. style="width: 18px;height: 18px;margin-right: 10px;">
  52. </image>
  53. <text>请确认推荐人信息,注册后,推荐人将不可修改</text>
  54. </view>
  55. <view class="recommendInfo">
  56. <view class="dis a-c j-start">
  57. <image src="/static/bigLogo.png" style="width: 21px;height: 20px;"></image>
  58. <text style="color: rgba(35,40,50,0.8);">推荐人姓名:</text>
  59. <text style="color: #232832;">{{recommendername}}</text>
  60. </view>
  61. <view class="dis a-c">
  62. <text style="color: rgba(35,40,50,0.8);">推荐人会员号:</text>
  63. <text style="color: #232832;">{{recommenderid}}</text>
  64. </view>
  65. </view>
  66. <view class="mt-2 left-0 right-0 dis a-c j-start text-light-muted" style="bottom:30rpx">
  67. <u-checkbox v-model="checked"></u-checkbox>
  68. 我已确认并同意<view> <text @tap="nav('/pages/register/xieyi')" style="color: #0052FF;">个人信息授权示范性条款</text>
  69. </view>
  70. </view>
  71. <button class="my-3 mt-4 d-flex a-center j-center font-weight bg-color" :loading="loading"
  72. :class="{'bg-hover-color':disabled}" type="primary" @tap="submit" :disabled="disabled"
  73. style="letter-spacing: 20rpx;">注册</button>
  74. </view>
  75. </view>
  76. <u-toast ref="uToast" />
  77. </view>
  78. </template>
  79. <script>
  80. import {
  81. pathToBase64,
  82. base64ToPath
  83. } from '@/common/image-tools-base64.js';
  84. import {
  85. mapMutations
  86. } from "vuex"
  87. export default {
  88. data() {
  89. return {
  90. list: [{
  91. name: '出单员注册'
  92. }],
  93. current: 0,
  94. name: "",
  95. identity: '',
  96. phone: "",
  97. password: "",
  98. code: "",
  99. isHidePassword: true,
  100. disabled: true,
  101. loading: false,
  102. codetime: 0,
  103. showRecommend: false,
  104. recommendername: "",
  105. recommenderid: "",
  106. checked: false
  107. }
  108. },
  109. async onLoad(params) {
  110. // // #ifdef H5
  111. // document.getElementsByTagName('uni-page-head')[0].style.display = 'none'
  112. // // #endif
  113. if (params.id) {
  114. this.recommenderid = params.id;
  115. // 查询推荐人信息
  116. let res = await this.$http.get('/user/findById?id=' + params.id);
  117. if ((res.code == '200') && (res.data != null)) {
  118. this.recommendername = res.data.name;
  119. this.showRecommend = true;
  120. } else {
  121. uni.showToast({
  122. title: res.msg,
  123. icon: "success",
  124. duration: 2000
  125. });
  126. this.showRecommend = false;
  127. // if(this.$base.baseUrl.indexOf("test")>-1){
  128. // this.recommenderid="99140109M01D01001";
  129. // this.recommendername = "耿陈杰";
  130. // this.showRecommend = false;
  131. // }else{
  132. // this.recommenderid="99140109M03D01001";
  133. // this.recommendername = "掌柜老王";
  134. // this.showRecommend = false;
  135. // }
  136. }
  137. }
  138. // else{
  139. // if(this.$base.baseUrl.indexOf("test")>-1){
  140. // this.recommenderid="99140109M01D01001";
  141. // this.recommendername = "耿陈杰";
  142. // this.showRecommend = false;
  143. // }else{
  144. // this.recommenderid="99140109M03D01001";
  145. // this.recommendername = "掌柜老王";
  146. // this.showRecommend = false;
  147. // }
  148. // }
  149. },
  150. watch: {
  151. name() {
  152. this.OnBtnChange();
  153. },
  154. phone(val) {
  155. this.OnBtnChange();
  156. },
  157. password(val) {
  158. this.OnBtnChange();
  159. },
  160. code(val) {
  161. this.OnBtnChange();
  162. }
  163. },
  164. methods: {
  165. ...mapMutations(['setUserModules']),
  166. change(index) {
  167. this.current = index;
  168. },
  169. // 改变按钮状态
  170. OnBtnChange() {
  171. if (this.phone && this.password && this.code && this.name) {
  172. this.disabled = false;
  173. return;
  174. }
  175. this.disabled = true;
  176. },
  177. nav(url) {
  178. uni.navigateTo({
  179. url: url
  180. });
  181. },
  182. isPwdRules() {
  183. let mPattern = /^(?![0-9]+$)(?![a-zA-Z]+$)[0-9A-Za-z]{6,20}$/;
  184. return mPattern.test(this.password);
  185. },
  186. // 获取验证码
  187. async getCheckNum() {
  188. uni.hideKeyboard();
  189. if (this.codetime > 0) return;
  190. // 验证手机号合法性
  191. if (!this.phone) {
  192. return uni.showToast({
  193. title: '请输入手机号',
  194. icon: 'none'
  195. });
  196. }
  197. if (!this.$base.phoneRegular.test(this.phone)) {
  198. return uni.showToast({
  199. title: '请输入正确的手机号码',
  200. icon: 'none'
  201. });
  202. }
  203. // 请求服务器,发送验证码
  204. let res = await this.$http.get('/sendMsg', {
  205. phone: this.phone,
  206. type: "1"
  207. });
  208. // 请求失败处理
  209. if (res.code != 200) {
  210. return uni.showToast({
  211. title: res.data.msg,
  212. icon: "none"
  213. });
  214. } else {
  215. uni.showToast({
  216. title: "发送成功",
  217. icon: "none"
  218. });
  219. }
  220. // 发送成功,开启倒计时
  221. this.codetime = 60;
  222. let timer = setInterval(() => {
  223. this.codetime--;
  224. if (this.codetime < 1) {
  225. clearInterval(timer);
  226. this.codetime = 0;
  227. }
  228. }, 1000);
  229. },
  230. // 提交注册
  231. async submit() {
  232. if (!this.name) {
  233. return uni.showToast({
  234. title: '请输入姓名',
  235. icon: 'none'
  236. });
  237. }
  238. // 验证手机号合法性
  239. if (!this.$base.phoneRegular.test(this.phone)) {
  240. return uni.showToast({
  241. title: '请输入正确的手机号码',
  242. icon: 'none'
  243. });
  244. }
  245. // 验证密码合法性
  246. if (!this.$base.passwordRegular.test(this.password)) {
  247. return uni.showToast({
  248. title: '密码须6-15位数字与字母组合',
  249. icon: 'none'
  250. });
  251. }
  252. if (!this.checked) {
  253. return this.$refs.uToast.show({
  254. title: '请阅读后勾选并同意《个人信息授权示范性条款》',
  255. type: 'default',
  256. })
  257. }
  258. // 请求服务器,发送验证码
  259. let res = await this.$http.post('/userAgent/agentRegist', {
  260. "name": this.name,
  261. "password": this.password,
  262. "mobile": this.phone,
  263. "mobileMsg": this.code,
  264. "referrerId": this.recommenderid,
  265. "referrerName": this.recommendername,
  266. "flag": 2,
  267. });
  268. // 请求失败处理
  269. // var newPhone= "";
  270. // newPhone = this.phone;
  271. // this.password="";
  272. // this.phone="";
  273. // this.code="";
  274. // this.name="";
  275. if ((res.code == 200) && (!!res.data)) {
  276. // #ifndef H5
  277. this.setUserModules({
  278. title: "userLoginId",
  279. data: res.data
  280. })
  281. uni.showToast({
  282. title: '注册成功',
  283. icon: "success",
  284. duration: 2000
  285. });
  286. setTimeout(() => {
  287. return uni.reLaunch({
  288. url: "/pages/login/login"
  289. })
  290. }, 2000);
  291. // #endif
  292. // #ifdef H5
  293. setTimeout(() => {
  294. return uni.reLaunch({
  295. url: "/pages/register/registerSuccess?id=" + res.data + '&phone=' +
  296. this
  297. .phone
  298. })
  299. }, 2000);
  300. // #endif
  301. } else {
  302. uni.showToast({
  303. title: res.msg,
  304. icon: "none",
  305. duration: 2000
  306. });
  307. }
  308. // else{
  309. // uni.showToast({ title: '已注册,重复注册', icon:"success",duration:2000 });
  310. // }
  311. }
  312. }
  313. }
  314. </script>
  315. <style lang="scss" scoped>
  316. @import '@/style/mixin.scss';
  317. /deep/ {
  318. .u-tab-bar {
  319. background: linear-gradient(90deg, #0052FF 0%, rgba(0, 82, 255, 0) 100%) !important;
  320. border-radius: 4px 4px 4px 4px;
  321. }
  322. }
  323. .text-color {
  324. color: #0052FF;
  325. }
  326. .bg-color {
  327. background-color: #0052FF;
  328. border-radius: 20px;
  329. }
  330. .bg-hover-color {
  331. background-color: #0052FF;
  332. opacity: 0.65;
  333. border-radius: 20px;
  334. }
  335. .mas-title {
  336. width: 100%;
  337. height: 34px;
  338. background: rgba(0, 82, 255, 0.1);
  339. border-radius: 6px;
  340. padding: 6px;
  341. margin-bottom: 15px;
  342. }
  343. .input-data1 {
  344. position: relative;
  345. margin-top: -140px;
  346. }
  347. .input-data {
  348. width: calc(100% - 32px);
  349. height: auto;
  350. background: #FFFFFF;
  351. box-shadow: 0px 4px 10px 0px #DAE3F4;
  352. border-radius: 6px;
  353. margin: auto;
  354. padding: 0 10px;
  355. z-index: 999;
  356. }
  357. .page {
  358. background: #F8FAFE;
  359. height: 100vh;
  360. width: 100%;
  361. position: absolute;
  362. }
  363. .phone,
  364. .password,
  365. .code {
  366. position: relative;
  367. height: 95rpx;
  368. display: flex;
  369. align-items: center;
  370. border-bottom: 1px solid #f2f2f2;
  371. }
  372. .phone .title,
  373. .password .title,
  374. .code .title {
  375. width: 160upx;
  376. flex-shrink: 0;
  377. color: #666;
  378. }
  379. .phone input,
  380. .password input,
  381. .code input {
  382. width: 350upx;
  383. font-size: 28upx;
  384. margin-left: 13px;
  385. }
  386. .yanzhengma {
  387. width: 150upx;
  388. position: absolute;
  389. right: 30upx;
  390. }
  391. .yanzhengma1 {
  392. font-size: 26upx;
  393. background: #FFFFFF;
  394. border-radius: 10rpx;
  395. width: 150rpx;
  396. padding: 5rpx 0;
  397. }
  398. .yanzhengma2 {
  399. background: #FFFFFF;
  400. font-size: 26upx;
  401. color: #B2B2B2;
  402. border-radius: 10rpx;
  403. width: 150rpx;
  404. padding: 5rpx 0;
  405. }
  406. .recommendInfo {
  407. background: #FFFFFF;
  408. width: 100%;
  409. height: 72;
  410. background: #FFFFFF;
  411. border-radius: 6px;
  412. border: 1px solid #0052FF;
  413. padding: 0 10px;
  414. >view {
  415. padding: 6px;
  416. font-size: 13px;
  417. }
  418. >view:nth-child(1) {
  419. border-bottom: 1px solid #f2f2f2;
  420. }
  421. }
  422. .recommendInfo>view:nth-of-type(1)>view:nth-of-type(1) {
  423. width: 150upx;
  424. height: 150upx;
  425. border-radius: 50%;
  426. }
  427. .recommendInfo>view:nth-of-type(1)>view:nth-of-type(1)>image {
  428. width: 100%;
  429. height: 100%;
  430. }
  431. .recommendInfo>view:nth-of-type(1)>view:nth-of-type(2) {
  432. padding: 20upx;
  433. }
  434. .recommendInfo>view:nth-of-type(1)>view:nth-of-type(2)>view {
  435. height: 55upx;
  436. }
  437. .recommendInfo>view:nth-of-type(2) {
  438. line-height: 50upx;
  439. }
  440. </style>