register.vue 6.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283
  1. <template>
  2. <view class="content">
  3. <view class="headbox">
  4. <text class="headtitle" v-if="checked==1">供货商注册</text>
  5. <text class="headtitle" v-if="checked==0">业务管理员注册</text>
  6. <view class="logobox">
  7. <image src="../../static/img/logo.png" mode="aspectFill"></image>
  8. </view>
  9. </view>
  10. <view class="acountbox" v-if="checked==1">
  11. <view class="inacount">
  12. <text class="acoutitle">账号</text>
  13. <input type="text" v-model="form.account" class="checkword" placeholder="请输入您的账号"
  14. placeholder-style="font-size:30rpx;color:#BEBDBB" />
  15. </view>
  16. <view class="inacount">
  17. <text class="acoutitle">密码</text>
  18. <input type="text" v-model="form.password" :password="true" class="checkword" placeholder="至少6位数的字母数字组合"
  19. placeholder-style="font-size:30rpx;color:#BEBDBB" />
  20. </view>
  21. <view class="inacount">
  22. <text class="acoutitle">确认密码</text>
  23. <input type="text" v-model="form.surepwd" :password="true" class="checkword" placeholder="至少6位数的字母数字组合"
  24. placeholder-style="font-size:30rpx;color:#BEBDBB" />
  25. </view>
  26. </view>
  27. <view class="acountbox" v-if="checked==0">
  28. <view class="inacount">
  29. <text class="acoutitle">姓名</text>
  30. <input type="text" v-model="form.realName" class="checkword" placeholder="输入业务员真实姓名"
  31. placeholder-style="font-size:30rpx;color:#BEBDBB" />
  32. </view>
  33. <view class="inacount">
  34. <text class="acoutitle">账号</text>
  35. <input type="text" v-model="form.account" class="checkword" placeholder="请输入您的账号"
  36. placeholder-style="font-size:30rpx;color:#BEBDBB" />
  37. </view>
  38. <view class="inacount">
  39. <text class="acoutitle">密码</text>
  40. <input type="text" v-model="form.password" :password="true" class="checkword" placeholder="至少6位数的字母数字组合"
  41. placeholder-style="font-size:30rpx;color:#BEBDBB" />
  42. </view>
  43. <view class="inacount">
  44. <text class="acoutitle">确认密码</text>
  45. <input type="text" v-model="form.surepwd" :password="true" class="checkword" placeholder="至少6位数的字母数字组合"
  46. placeholder-style="font-size:30rpx;color:#BEBDBB" />
  47. </view>
  48. <view class="inacount">
  49. <text class="acoutitle">联系电话</text>
  50. <input type="text" v-model="form.mobile" class="checkword" placeholder="请输入业务员联系电话"
  51. placeholder-style="font-size:30rpx;color:#BEBDBB" />
  52. </view>
  53. </view>
  54. <view class="logininbtn" @click="submiitForm">
  55. <text>注册账号</text>
  56. </view>
  57. <view class="acountall"><text>已有账户?</text><text style="color: #D05C39;padding-left: 10rpx;padding-right: 43rpx;"
  58. @click="loginIn">马上登录</text></view>
  59. <view class="flex1 checkag">
  60. <u-checkbox-group @change="checkboxChange">
  61. <u-checkbox name="gou" activeColor="#D8AB5A" :size="20">
  62. </u-checkbox>
  63. </u-checkbox-group>
  64. <text>我已阅读并同意</text><text style="color: #D05C39;" @click="moveAgreement">用户协议</text><text>和</text><text style="color: #D05C39;" @click="privacyPolicy">隐私政策</text>
  65. </view>
  66. </view>
  67. </template>
  68. <script>
  69. export default {
  70. data() {
  71. return {
  72. checked: 0,
  73. gou: false,
  74. form: {
  75. account: '',
  76. acountname: '',
  77. password: '',
  78. surepwd: '',
  79. mobile: ''
  80. },
  81. }
  82. },
  83. onLoad(o) {
  84. if (o.checked) {
  85. this.checked = o.checked
  86. }
  87. if (o.form) {
  88. let form = JSON.parse(o.form)
  89. this.form = Object.assign(this.form, form);
  90. this.checked = form.checked
  91. }
  92. },
  93. methods: {
  94. checkboxChange(n) {
  95. if (n.length > 0) {
  96. this.gou = true
  97. } else {
  98. this.gou = false
  99. }
  100. },
  101. submiitForm() {
  102. if (!this.gou) {
  103. this.$toast("清先阅读用户协议和隐私协议")
  104. return
  105. }
  106. let form = this.form
  107. if(this.checked==1){
  108. if(this.form.name.length==0){
  109. this.$toast("请输入您的账号")
  110. return
  111. }
  112. if(this.form.name.password==0){
  113. this.$toast("请输入至少6位数的字母数字组合的密码")
  114. return
  115. }
  116. if(this.form.password!=this.form.surepwd){
  117. this.$toast("两次密码输入不一样")
  118. return
  119. }
  120. }else if(this.checked==0){
  121. if(this.form.realName.length==0){
  122. this.$toast("请输业务员真实姓名")
  123. return
  124. }
  125. if(this.form.account.length==0){
  126. this.$toast("请输入您的账号")
  127. return
  128. }
  129. if(this.form.mobile.length==0){
  130. this.$toast("请输入业务员联系电话")
  131. return
  132. }
  133. if(this.form.password!=this.form.surepwd){
  134. this.$toast("两次密码输入不一样")
  135. return
  136. }
  137. }
  138. this.$load("加载中")
  139. if (this.checked == 0) {
  140. uni.$u.http.post('/api/Account/register',
  141. form, {
  142. custom: {
  143. auth: true
  144. }
  145. }).then((res) => {
  146. uni.hideLoading()
  147. this.$toast("注册成功")
  148. setTimeout(() => {
  149. uni.navigateTo({
  150. url: "/pages/login/login"
  151. })
  152. }, 1000)
  153. }).catch((err) => {
  154. uni.hideLoading()
  155. this.$toast(err.msg)
  156. })
  157. } else if (this.checked == 1) {
  158. uni.$u.http.post('/api/Supplier/register',
  159. form, {
  160. custom: {
  161. auth: true
  162. }
  163. }).then((res) => {
  164. uni.hideLoading()
  165. this.$toast("注册成功")
  166. setTimeout(() => {
  167. uni.navigateTo({
  168. url: "/pages/login/login"
  169. })
  170. }, 1000)
  171. }).catch((err) => {
  172. uni.hideLoading()
  173. this.$toast(err.msg)
  174. })
  175. }
  176. },
  177. moveAgreement(){
  178. uni.navigateTo({
  179. url:"/pages/bsinessadmin/useragreement"
  180. })
  181. },
  182. privacyPolicy(){
  183. uni.navigateTo({
  184. url:"/pages/bsinessadmin/privacypolicy"
  185. })
  186. },
  187. loginIn() {
  188. uni.navigateTo({
  189. url: "/pages/login/login"
  190. })
  191. }
  192. }
  193. }
  194. </script>
  195. <style lang="scss" scoped>
  196. .content {
  197. padding: 0 30rpx;
  198. box-sizing: border-box;
  199. }
  200. .headbox {
  201. display: flex;
  202. justify-content: space-between;
  203. align-items: flex-end;
  204. }
  205. .headtitle {
  206. font-size: 60rpx;
  207. font-weight: 600;
  208. padding-bottom: 36rpx;
  209. }
  210. .logobox {
  211. width: 269rpx;
  212. height: 191rpx;
  213. image {
  214. width: 100%;
  215. height: 100%;
  216. }
  217. }
  218. .acountbox {
  219. .inacount {
  220. flex: 1;
  221. display: flex;
  222. padding: 35rpx 20rpx;
  223. box-sizing: border-box;
  224. // width: 606rpx;
  225. margin-top: 40rpx;
  226. background-color: #F6F6F6;
  227. border-radius: 20rpx;
  228. font-size: 30rpx;
  229. color: #1F242A;
  230. input {
  231. width: 360rpx;
  232. }
  233. }
  234. .acoutitle {
  235. font-weight: 600;
  236. }
  237. .checkword {
  238. padding-left: 20rpx;
  239. color: #1F242A;
  240. font-size: 30rpx;
  241. }
  242. }
  243. .logininbtn {
  244. box-sizing: border-box;
  245. margin-top: 80rpx;
  246. // width: 606rpx;
  247. border-radius: 20rpx;
  248. background: linear-gradient(to right, #FFE1AD, #D07539);
  249. height: 100rpx;
  250. text-align: center;
  251. color: #fff;
  252. line-height: 100rpx;
  253. }
  254. .acountall {
  255. display: flex;
  256. justify-content: flex-end;
  257. margin-top: 30rpx;
  258. font-size: 24rpx;
  259. }
  260. .checkag {
  261. margin-top: 200rpx;
  262. font-size: 28rpx;
  263. padding-bottom: 130rpx;
  264. }
  265. </style>