orderissuer.vue 9.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387
  1. <template>
  2. <view class="page">
  3. <!-- 公共组件-每个页面必须引入 -->
  4. <public-module></public-module>
  5. <view class="mx-3 mt-3">
  6. <!-- 账号密码登录 false代表账号密码登录 -->
  7. <view class="phone d-flex">
  8. <view class="title">电话号码</view>
  9. <input placeholder="请输入手机号" v-model="phone" maxlength="11" />
  10. </view>
  11. <view class="phone d-flex">
  12. <view class="title">真实姓名</view>
  13. <input placeholder="请输入姓名" v-model="name" />
  14. </view>
  15. <view class="phone d-flex">
  16. <view class="title">身份证号</view>
  17. <input placeholder="请输入身份证号" v-model="identity" />
  18. </view>
  19. <view class="password d-flex">
  20. <view class="title">密码</view>
  21. <input placeholder="请输入密码" v-model="password" :password='isHidePassword' maxlength="15"
  22. style="padding-right: 200rpx;" />
  23. <view class="d-flex a-center j-center yanzhengma">
  24. <view style="font-size: 40rpx;" class="icon iconfont"
  25. :class="isHidePassword?'icon-buxianshimima':'icon-xianshimima'"
  26. @tap="isHidePassword = !isHidePassword"></view>
  27. </view>
  28. </view>
  29. <view class="code d-flex">
  30. <view class="title">验证码</view>
  31. <input placeholder="请输入验证码" v-model="code" maxlength="5" style="padding-right: 200rpx;" />
  32. <view class="d-flex a-center j-center login-font-color yanzhengma" @tap="getCheckNum">
  33. <view class="d-flex a-center j-center"
  34. :class="!codetime?'yanzhengma1 main-text-color':'yanzhengma2'">
  35. {{!codetime?'获取验证码':codetime+' s'}}
  36. </view>
  37. </view>
  38. </view>
  39. <!-- 推荐信息 -->
  40. <template v-if="showRecommend">
  41. <view class="recommendInfo">
  42. <view class="d-flex">
  43. <view>
  44. <image src="/static/bigLogo.png"></image>
  45. </view>
  46. <view>
  47. <view><span class="text-muted mr-2">推荐人姓名</span> {{recommendername}}</view>
  48. <view><span class="text-muted mr-2">推荐人会员号</span> {{recommenderid}}</view>
  49. </view>
  50. </view>
  51. <view class="px-3 py-1 d-flex a-center j-center">请确认推荐人信息,注册后,推荐人将不可修改</view>
  52. </view>
  53. </template>
  54. <button class="my-3 mt-4 d-flex a-center j-center font-weight main-bg-color" :loading="loading"
  55. :class="{'main-bf-hover-color':disabled}" type="primary" @tap="submit" :disabled="disabled"
  56. style="letter-spacing: 20rpx;">注册</button>
  57. <!-- <view class="d-flex a-center j-center my-3">
  58. 已有帐号?<view class="main-text-color" @tap="navigate({url:'/pages/login/login'},'reLaunch')">去登录</view>
  59. </view> -->
  60. </view>
  61. </view>
  62. </template>
  63. <script>
  64. import {
  65. pathToBase64,
  66. base64ToPath
  67. } from '@/common/image-tools-base64.js';
  68. import {
  69. mapMutations
  70. } from "vuex"
  71. export default {
  72. data() {
  73. return {
  74. name: "",
  75. identity:'',
  76. phone: "",
  77. password: "",
  78. code: "",
  79. isHidePassword: true,
  80. disabled: true,
  81. loading: false,
  82. codetime: 0,
  83. showRecommend: false,
  84. recommendername: "",
  85. recommenderid: ""
  86. }
  87. },
  88. async onLoad(params) {
  89. // // #ifdef H5
  90. // document.getElementsByTagName('uni-page-head')[0].style.display = 'none'
  91. // // #endif
  92. if (params.id) {
  93. this.recommenderid = params.id;
  94. // 查询推荐人信息
  95. let res = await this.$http.get('/user/findById?id=' + params.id);
  96. if ((res.code == '200') && (res.data != null)) {
  97. this.recommendername = res.data.name;
  98. this.showRecommend = true;
  99. } else {
  100. uni.showToast({
  101. title: res.msg,
  102. icon: "success",
  103. duration: 2000
  104. });
  105. this.showRecommend = false;
  106. // if(this.$base.baseUrl.indexOf("test")>-1){
  107. // this.recommenderid="99140109M01D01001";
  108. // this.recommendername = "耿陈杰";
  109. // this.showRecommend = false;
  110. // }else{
  111. // this.recommenderid="99140109M03D01001";
  112. // this.recommendername = "掌柜老王";
  113. // this.showRecommend = false;
  114. // }
  115. }
  116. }
  117. // else{
  118. // if(this.$base.baseUrl.indexOf("test")>-1){
  119. // this.recommenderid="99140109M01D01001";
  120. // this.recommendername = "耿陈杰";
  121. // this.showRecommend = false;
  122. // }else{
  123. // this.recommenderid="99140109M03D01001";
  124. // this.recommendername = "掌柜老王";
  125. // this.showRecommend = false;
  126. // }
  127. // }
  128. },
  129. watch: {
  130. name() {
  131. this.OnBtnChange();
  132. },
  133. phone(val) {
  134. this.OnBtnChange();
  135. },
  136. password(val) {
  137. this.OnBtnChange();
  138. },
  139. code(val) {
  140. this.OnBtnChange();
  141. }
  142. },
  143. methods: {
  144. ...mapMutations(['setUserModules']),
  145. // 改变按钮状态
  146. OnBtnChange() {
  147. if (this.phone && this.password && this.code && this.name) {
  148. this.disabled = false;
  149. return;
  150. }
  151. this.disabled = true;
  152. },
  153. isPwdRules() {
  154. let mPattern = /^(?![0-9]+$)(?![a-zA-Z]+$)[0-9A-Za-z]{6,20}$/;
  155. return mPattern.test(this.password);
  156. },
  157. // 获取验证码
  158. async getCheckNum() {
  159. uni.hideKeyboard();
  160. if (this.codetime > 0) return;
  161. // 验证手机号合法性
  162. if (!this.phone) {
  163. return uni.showToast({
  164. title: '请输入手机号',
  165. icon: 'none'
  166. });
  167. }
  168. if (!this.$base.phoneRegular.test(this.phone)) {
  169. return uni.showToast({
  170. title: '请输入正确的手机号码',
  171. icon: 'none'
  172. });
  173. }
  174. // 请求服务器,发送验证码
  175. let res = await this.$http.get('/sendMsg', {
  176. phone: this.phone,
  177. type: "1"
  178. });
  179. // 请求失败处理
  180. if (res.code != 200) {
  181. return uni.showToast({
  182. title: res.data.msg,
  183. icon: "none"
  184. });
  185. } else {
  186. uni.showToast({
  187. title: "发送成功",
  188. icon: "none"
  189. });
  190. }
  191. // 发送成功,开启倒计时
  192. this.codetime = 60;
  193. let timer = setInterval(() => {
  194. this.codetime--;
  195. if (this.codetime < 1) {
  196. clearInterval(timer);
  197. this.codetime = 0;
  198. }
  199. }, 1000);
  200. },
  201. // 提交注册
  202. async submit() {
  203. if (!this.name) {
  204. return uni.showToast({
  205. title: '请输入姓名',
  206. icon: 'none'
  207. });
  208. }
  209. // 验证手机号合法性
  210. if (!this.$base.phoneRegular.test(this.phone)) {
  211. return uni.showToast({
  212. title: '请输入正确的手机号码',
  213. icon: 'none'
  214. });
  215. }
  216. // 验证密码合法性
  217. if (!this.$base.passwordRegular.test(this.password)) {
  218. return uni.showToast({
  219. title: '密码须6-15位数字与字母组合',
  220. icon: 'none'
  221. });
  222. }
  223. // 请求服务器,发送验证码
  224. let res = await this.$http.post('/user/agentRegist', {
  225. "name": this.name,
  226. "password": this.password,
  227. "mobile": this.phone,
  228. "mobileMsg": this.code,
  229. "identity":this.identity,
  230. "referrerId": this.recommenderid,
  231. "referrerName": this.recommendername,
  232. "flag": 2,
  233. });
  234. // 请求失败处理
  235. // var newPhone= "";
  236. // newPhone = this.phone;
  237. // this.password="";
  238. // this.phone="";
  239. // this.code="";
  240. // this.name="";
  241. if ((res.code == 200) && (!!res.data)) {
  242. // #ifndef H5
  243. this.setUserModules({
  244. title: "userLoginId",
  245. data: res.data
  246. })
  247. uni.showToast({
  248. title: '注册成功',
  249. icon: "success",
  250. duration: 2000
  251. });
  252. setTimeout(() => {
  253. return uni.reLaunch({
  254. url: "/pages/login/login"
  255. })
  256. }, 2000);
  257. // #endif
  258. // #ifdef H5
  259. setTimeout(() => {
  260. return uni.reLaunch({
  261. url: "/pages/register/registerSuccess?id=" + res.data + '&phone=' + this
  262. .phone
  263. })
  264. }, 2000);
  265. // #endif
  266. } else {
  267. uni.showToast({
  268. title: res.msg,
  269. icon: "none",
  270. duration: 2000
  271. });
  272. }
  273. // else{
  274. // uni.showToast({ title: '已注册,重复注册', icon:"success",duration:2000 });
  275. // }
  276. }
  277. }
  278. }
  279. </script>
  280. <style lang="scss" scoped>
  281. @import '@/style/mixin.scss';
  282. .idCardBefore {
  283. background: rgba($themeColor, 0.1) url('/static/image/user/identy2.png') center center no-repeat;
  284. background-size: auto 70%;
  285. padding: 10upx;
  286. }
  287. .page {
  288. background: #F5F5F5;
  289. height: 100vh;
  290. width: 100%;
  291. position: absolute;
  292. }
  293. .phone,
  294. .password,
  295. .code {
  296. position: relative;
  297. height: 90upx;
  298. display: flex;
  299. align-items: center;
  300. background-color: #FFFFFF;
  301. padding: 0 30upx;
  302. margin-bottom: 26upx;
  303. }
  304. .phone .title,
  305. .password .title,
  306. .code .title {
  307. width: 160upx;
  308. flex-shrink: 0;
  309. color: #666;
  310. }
  311. .phone input,
  312. .password input,
  313. .code input {
  314. width: 350upx;
  315. font-size: 28upx;
  316. }
  317. .yanzhengma {
  318. width: 150upx;
  319. position: absolute;
  320. right: 30upx;
  321. }
  322. .yanzhengma1 {
  323. font-size: 26upx;
  324. background: #FFFFFF;
  325. border-radius: 10rpx;
  326. width: 150rpx;
  327. padding: 5rpx 0;
  328. }
  329. .yanzhengma2 {
  330. background: #FFFFFF;
  331. font-size: 26upx;
  332. color: #B2B2B2;
  333. border-radius: 10rpx;
  334. width: 150rpx;
  335. padding: 5rpx 0;
  336. }
  337. .recommendInfo {
  338. background: #FFFFFF;
  339. }
  340. .recommendInfo>view:nth-of-type(1) {
  341. border-bottom: 1px solid #ddd;
  342. }
  343. .recommendInfo>view:nth-of-type(1)>view:nth-of-type(1) {
  344. width: 150upx;
  345. height: 150upx;
  346. border-radius: 50%;
  347. }
  348. .recommendInfo>view:nth-of-type(1)>view:nth-of-type(1)>image {
  349. width: 100%;
  350. height: 100%;
  351. }
  352. .recommendInfo>view:nth-of-type(1)>view:nth-of-type(2) {
  353. padding: 20upx;
  354. }
  355. .recommendInfo>view:nth-of-type(1)>view:nth-of-type(2)>view {
  356. height: 55upx;
  357. }
  358. .recommendInfo>view:nth-of-type(2) {
  359. line-height: 50upx;
  360. }
  361. </style>