index.vue 21 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809
  1. <template>
  2. <div class="login-container">
  3. <el-row>
  4. <el-col :xs="24" :sm="24" :md="24" :lg="24" :xl="24" class="flex1">
  5. <div v-if="checked == 0" class="overcicle">
  6. <el-form
  7. ref="loginForm"
  8. :model="loginForm"
  9. :rules="loginRules"
  10. class="login-form"
  11. auto-complete="on"
  12. label-position="left"
  13. >
  14. <div class="title-container">
  15. <p class="title">业务管理员注册</p>
  16. </div>
  17. <el-form-item prop="name">
  18. <span class="svg-container"> 姓名 </span>
  19. <el-input
  20. ref="name"
  21. v-model="loginForm.realName"
  22. placeholder="输入业务员真实姓名"
  23. name="name"
  24. type="text"
  25. tabindex="1"
  26. />
  27. </el-form-item>
  28. <el-form-item prop="username">
  29. <span class="svg-container"> 登录账号 </span>
  30. <el-input
  31. ref="username"
  32. v-model="loginForm.account"
  33. placeholder="输入账户名称"
  34. name="username"
  35. type="text"
  36. tabindex="2"
  37. />
  38. </el-form-item>
  39. <el-form-item prop="password">
  40. <span class="svg-container"> 登录密码 </span>
  41. <el-input
  42. ref="password"
  43. v-model="loginForm.password"
  44. placeholder="至少6位数的字母数字组合"
  45. name="password"
  46. :type="passwordType"
  47. tabindex="2"
  48. show-password
  49. />
  50. </el-form-item>
  51. <el-form-item prop="surepsd">
  52. <span class="svg-container"> 确认密码 </span>
  53. <el-input
  54. :key="passwordType"
  55. ref="password"
  56. v-model="loginForm.surepsd"
  57. :type="passwordType"
  58. placeholder="至少6位数的字母数字组合"
  59. name="password"
  60. auto-complete="on"
  61. show-password
  62. tabindex="3"
  63. />
  64. </el-form-item>
  65. <el-form-item prop="mobile">
  66. <span class="svg-container"> 联系电话 </span>
  67. <el-input
  68. ref="mobile"
  69. v-model="loginForm.mobile"
  70. type="text"
  71. placeholder="请输入业务员联系电话"
  72. name="mobile"
  73. tabindex="5"
  74. onkeyup="value=value.replace(/^\D*(\d*(?:\.\d{0,2})?).*$/g, '$1')"
  75. />
  76. </el-form-item>
  77. <el-button
  78. :loading="loading"
  79. type="primary"
  80. class="loginbtn"
  81. @click.native.prevent="handleLogin(loginForm)"
  82. >注册账号
  83. </el-button>
  84. <div class="registerbtn flex3">
  85. <div class="forgect">
  86. <p class="asp">已有账号?</p>
  87. </div>
  88. <div class="forgect" @click="backLogin()">
  89. <p class="nes">马上登录</p>
  90. </div>
  91. </div>
  92. </el-form>
  93. </div>
  94. <!-- 供货商注册 -->
  95. <div
  96. v-if="checked == 1 && !showNext"
  97. style="margin-top: 670px"
  98. class="overcicle"
  99. >
  100. <el-form
  101. ref="providerForm"
  102. :model="providerForm"
  103. :rules="loginRules"
  104. class="login-form"
  105. auto-complete="on"
  106. label-position="left"
  107. >
  108. <div class="title-container">
  109. <p class="title">供货商注册</p>
  110. </div>
  111. <el-form-item prop="name">
  112. <span class="svg-container"> 供货商 </span>
  113. <el-input
  114. ref="name"
  115. v-model="providerForm.name"
  116. placeholder="输入供货商名称"
  117. name="name"
  118. type="text"
  119. tabindex="1"
  120. />
  121. </el-form-item>
  122. <el-form-item prop="username">
  123. <span class="svg-container"> 统一社会信用代码 </span>
  124. <el-input
  125. ref="username"
  126. v-model="providerForm.socialCode"
  127. placeholder="输入统一社会信用代码"
  128. name="username"
  129. type="text"
  130. tabindex="2"
  131. />
  132. </el-form-item>
  133. <el-form-item prop="username">
  134. <span class="svg-container"> 法人姓名 </span>
  135. <el-input
  136. ref="password"
  137. v-model="providerForm.legalPerson"
  138. placeholder="输入法人的真实姓名"
  139. name="password"
  140. type="passwordType"
  141. tabindex="3"
  142. />
  143. </el-form-item>
  144. <el-form-item prop="username">
  145. <span class="svg-container"> 联系人 </span>
  146. <el-input
  147. ref="password"
  148. v-model="providerForm.contacts"
  149. placeholder="输入联系人的真实姓名"
  150. name="password"
  151. type="passwordType"
  152. tabindex="3"
  153. />
  154. </el-form-item>
  155. <el-form-item prop="mobile">
  156. <span class="svg-container"> 联系电话 </span>
  157. <el-input
  158. ref="mobile"
  159. v-model="providerForm.contactsMobile"
  160. type="text"
  161. placeholder="请输入业务员联系电话"
  162. name="mobile"
  163. tabindex="5"
  164. onkeyup="value=value.replace(/^\D*(\d*(?:\.\d{0,2})?).*$/g, '$1')"
  165. />
  166. </el-form-item>
  167. <el-form-item prop="username">
  168. <span class="svg-container"> 登录账号 </span>
  169. <el-input
  170. ref="username"
  171. v-model="providerForm.account"
  172. placeholder="输入账号名称"
  173. name="username"
  174. type="text"
  175. tabindex="2"
  176. />
  177. </el-form-item>
  178. <el-form-item prop="password">
  179. <span class="svg-container"> 登录密码 </span>
  180. <el-input
  181. :key="passwordType"
  182. ref="password"
  183. v-model="providerForm.password"
  184. :type="passwordType"
  185. placeholder="至少6位数的字母数字组合"
  186. name="password"
  187. tabindex="4"
  188. auto-complete="on"
  189. show-password
  190. />
  191. </el-form-item>
  192. <el-form-item prop="surepsd">
  193. <span class="svg-container"> 确认密码 </span>
  194. <el-input
  195. :key="passwordType"
  196. ref="password"
  197. v-model="providerForm.surepsd"
  198. :type="passwordType"
  199. placeholder="至少6位数的字母数字组合"
  200. name="password"
  201. auto-complete="on"
  202. show-password
  203. tabindex="3"
  204. />
  205. </el-form-item>
  206. <!-- 供应商上传身份证图片 -->
  207. <div class="choosepic">
  208. <el-form-item
  209. style="background-color: transparent; margin: 0; padding: 0"
  210. >
  211. <span
  212. class="svg-container"
  213. style="
  214. background-color: transparent;
  215. margin: 0;
  216. padding: 0;
  217. margin-top: 5px;
  218. "
  219. >
  220. 认证照片
  221. </span>
  222. <div class="boximg">
  223. <el-upload
  224. action="https://api.xrongm.com/api/File"
  225. list-type="picture-card"
  226. :on-success="handleAvatarSuccess"
  227. >
  228. <i class="el-icon-plus" />
  229. </el-upload>
  230. <el-dialog :visible.sync="dialogVisible">
  231. <img width="100%" :src="providerForm.identifyPics" alt="" />
  232. </el-dialog>
  233. <!-- <FileUpload
  234. v-model="providerForm.identifyPics"
  235. accept=".jpg, .jpeg, .png, .pdf"
  236. /> -->
  237. </div>
  238. <p class="usa">*注意上传法人手持身份证半身照</p>
  239. </el-form-item>
  240. </div>
  241. <!-- 供应商上传委托书图片 -->
  242. <div class="choosepic">
  243. <el-form-item
  244. style="background-color: transparent; margin: 0; padding: 0"
  245. >
  246. <span
  247. class="svg-container"
  248. style="background-color: transparent; margin: 0; padding: 0"
  249. >
  250. 授权委托书
  251. </span>
  252. <span
  253. class="svg-container"
  254. style="float: right"
  255. @click="download"
  256. >
  257. 点击获取授权委托书
  258. </span>
  259. <div class="boximg">
  260. <el-upload
  261. action="https://api.xrongm.com/api/File"
  262. list-type="picture-card"
  263. :on-success="handleSuccess"
  264. >
  265. <i class="el-icon-plus" />
  266. </el-upload>
  267. <el-dialog :visible.sync="dialogVisible">
  268. <img width="100%" :src="providerForm.proxyFile" alt="" />
  269. </el-dialog>
  270. <!-- <FileUpload
  271. v-model="providerForm.proxyFile"
  272. accept=".jpg, .jpeg, .png, .pdf"
  273. /> -->
  274. </div>
  275. <p class="usa">*注意上传法人签署的授权委托书</p>
  276. </el-form-item>
  277. </div>
  278. <el-button
  279. :loading="loading"
  280. type="primary"
  281. class="loginbtn"
  282. @click.native.prevent="handleLogin(providerForm)"
  283. >注册账号
  284. </el-button>
  285. <div class="registerbtn flex3">
  286. <div class="forgect">
  287. <p class="asp">已有账号?</p>
  288. </div>
  289. <div class="forgect" @click="backLogin()">
  290. <p class="nes">马上登录</p>
  291. </div>
  292. </div>
  293. </el-form>
  294. </div>
  295. </el-col>
  296. </el-row>
  297. </div>
  298. </template>
  299. <script>
  300. let that;
  301. import { validUsername } from "@/utils/validate";
  302. import logo from "/src/assets/img/logo.png";
  303. import upself from "/src/assets/img/upuer.png";
  304. import upweituo from "/src/assets/img/upattor.png";
  305. import request from "@/utils/request";
  306. export default {
  307. name: "Login",
  308. data() {
  309. const validatename = (rule, value, callback) => {
  310. if (value.length == 0) {
  311. callback(new Error("请输入业务员真实姓名"));
  312. } else {
  313. callback();
  314. }
  315. };
  316. const validateUsername = (rule, value, callback) => {
  317. if (!validUsername(value)) {
  318. callback(new Error("请输入账户名称"));
  319. } else {
  320. callback();
  321. }
  322. };
  323. const validatePassword = (rule, value, callback) => {
  324. if (value.length < 6) {
  325. callback(new Error("请输入大于6位数密码"));
  326. } else {
  327. callback();
  328. }
  329. };
  330. const validatemobile = (rule, value, callback) => {
  331. if (value.length == 0) {
  332. callback(new Error("请输入电话号码"));
  333. } else {
  334. callback();
  335. }
  336. };
  337. return {
  338. dialogVisible: false,
  339. disabled: false,
  340. upself: upself,
  341. upweituo: upweituo,
  342. fit: "cover",
  343. imageUrl: "",
  344. // 业务管理员数据
  345. loginForm: {
  346. realName: "",
  347. account: "",
  348. password: "",
  349. surepsd: "",
  350. mobile: "",
  351. },
  352. /* 供应商数据 */
  353. providerForm: {
  354. account: "",
  355. password: "",
  356. surepsd: "",
  357. name: "",
  358. socialCode: "",
  359. legalPerson: "",
  360. contacts: "",
  361. contactsMobile: "",
  362. identifyPics: [],
  363. proxyFile: [],
  364. },
  365. /* 供应商上传身份证图片用数组保存 */
  366. identifyPicsArray: [],
  367. /* 供应商上传委托书图片用数组保存 */
  368. proxyFileArray: [],
  369. loginRules: {
  370. realName: [
  371. {
  372. required: true,
  373. trigger: "blur",
  374. validator: validatename,
  375. },
  376. ],
  377. account: [
  378. {
  379. required: true,
  380. trigger: "blur",
  381. validator: validateUsername,
  382. },
  383. ],
  384. password: [
  385. {
  386. required: true,
  387. trigger: "blur",
  388. validator: validatePassword,
  389. },
  390. ],
  391. mobile: [
  392. {
  393. required: true,
  394. trigger: "blur",
  395. validator: validatemobile,
  396. },
  397. ],
  398. },
  399. loading: false,
  400. passwordType: "password",
  401. redirect: undefined,
  402. src: logo,
  403. checked: 0,
  404. showNext: false,
  405. };
  406. },
  407. watch: {
  408. $route: {
  409. handler: function (route) {
  410. this.redirect = route.query && route.query.redirect;
  411. },
  412. immediate: true,
  413. },
  414. },
  415. mounted() {
  416. that = this;
  417. this.checked = this.$route.query.checked;
  418. },
  419. methods: {
  420. nextStep() {
  421. this.showNext = true;
  422. },
  423. /* 供应商上传身份证图片上传成功 */
  424. handleAvatarSuccess(res) {
  425. //解构
  426. let { file } = res.data;
  427. this.identifyPicsArray.push(file);
  428. this.providerForm.identifyPics = this.identifyPicsArray;
  429. },
  430. /* 供应商上传委托书图片上传成功 */
  431. handleSuccess(res) {
  432. //解构
  433. let { file } = res.data;
  434. this.proxyFileArray.push(file);
  435. this.providerForm.proxyFile = this.proxyFileArray;
  436. },
  437. handlePictureCardPreview(file) {
  438. console.log(file, 88);
  439. this.imageUrl = file.url;
  440. },
  441. backLogin() {
  442. this.$router.replace({
  443. path: "/login",
  444. query: {},
  445. });
  446. },
  447. /* 供应商注册发送请求 */
  448. handleLogin(form) {
  449. if(form==this.loginForm){
  450. if(this.loginForm.account.length<5||this.loginForm.account.length>20){
  451. this.$message({
  452. type:'error',
  453. message:'账号必须5~20位'
  454. })
  455. }else if(this.loginForm.password.length<6){
  456. this.$message({
  457. type: "error",
  458. message: "密码至少六位!",
  459. });
  460. }else if(this.loginForm.password !== this.loginForm.surepsd){
  461. this.$message({
  462. type: "error",
  463. message: "密码和确认密码不一致",
  464. });
  465. }else if(this.loginForm.mobile.length!==11){
  466. this.$message({
  467. type:'error',
  468. message:'电话号码必须11位'
  469. })
  470. }else{
  471. this.$request({
  472. url: "/api/Account/register",
  473. method: "post",
  474. data: form,
  475. }).then((res) => {
  476. if (res.code === 200) {
  477. this.$message({
  478. type: "success",
  479. message: "业务员注册成功",
  480. });
  481. this.$router.push({
  482. path: "/login",
  483. });
  484. }
  485. });
  486. }
  487. }else{
  488. if(this.providerForm.account.length<5||this.providerForm.account.length>20){
  489. this.$message({
  490. type:'error',
  491. message:'账号必须5~20位'
  492. })
  493. }else if(this.providerForm.password !== this.providerForm.surepsd){
  494. this.$message({
  495. type: "error",
  496. message: "密码和确认密码不一致",
  497. });
  498. }else if(this.providerForm.password.length<6){
  499. this.$message({
  500. type: "error",
  501. message: "密码至少六位!",
  502. });
  503. }else if(this.providerForm.contactsMobile.length!==11){
  504. this.$message({
  505. type:'error',
  506. message:'电话号码必须11位'
  507. })
  508. }else{
  509. this.$request({
  510. url: "/api/Supplier/register",
  511. method: "post",
  512. data: form,
  513. }).then((res) => {
  514. if (res.code === 200) {
  515. this.$message({
  516. type: "success",
  517. message: "供应商注册成功",
  518. });
  519. this.$router.push({
  520. path: "/login",
  521. });
  522. }
  523. });
  524. }
  525. }
  526. },
  527. // 下载委托书模板
  528. download() {
  529. this.$request({
  530. url: "/api/Setting/attorney",
  531. method: "get",
  532. }).then((res) => {
  533. console.log(res);
  534. if (res.code === 200) {
  535. let url = res.data;
  536. window.open(url);
  537. }
  538. });
  539. },
  540. },
  541. };
  542. </script>
  543. <style lang="scss" >
  544. $bg: #f6f6f6;
  545. $light_gray: #bebdbb;
  546. $cursor: #bebdbb;
  547. @supports (-webkit-mask: none) and (not (cater-color: $cursor)) {
  548. .login-container .el-input input {
  549. color: $cursor;
  550. }
  551. }
  552. /* reset element-ui css */
  553. .login-container {
  554. overflow: auto;
  555. background: url("../../assets/img/registerbg.png") no-repeat;
  556. background-size: 100%;
  557. .el-input {
  558. display: inline-block;
  559. height: 47px;
  560. width: 70%;
  561. background-color: #f6f6f6;
  562. input {
  563. background: #f6f6f6;
  564. border: 0px;
  565. -webkit-appearance: none;
  566. border-radius: 0px;
  567. padding: 12px 5px 12px 15px;
  568. color: $light_gray;
  569. height: 47px;
  570. caret-color: $cursor;
  571. &:-webkit-autofill {
  572. box-shadow: 0 0 0px 1000px $bg inset !important;
  573. -webkit-text-fill-color: $cursor !important;
  574. }
  575. }
  576. }
  577. .el-input .el-input__inner {
  578. color: #030303;
  579. }
  580. .el-form-item {
  581. border: 1px solid rgba(255, 255, 255, 0.1);
  582. background: #f6f6f6;
  583. border-radius: 5px;
  584. color: #454545;
  585. }
  586. }
  587. </style>
  588. <style lang="scss" scoped>
  589. $bg: #2d3a4b;
  590. $dark_gray: #f6f6f6;
  591. $light_gray: #eee;
  592. .login-container {
  593. height: 100%;
  594. width: 100%;
  595. // background-color: $bg;
  596. // overflow: hidden;
  597. .login-form {
  598. position: relative;
  599. width: 470px;
  600. max-width: 100%;
  601. padding: 0 35px 0;
  602. margin: 0 auto;
  603. // overflow: hidden;
  604. }
  605. .tips {
  606. font-size: 14px;
  607. color: #fff;
  608. margin-bottom: 10px;
  609. span {
  610. &:first-of-type {
  611. margin-right: 16px;
  612. }
  613. }
  614. }
  615. .svg-container {
  616. padding: 6px 5px 6px 15px;
  617. color: #1f242a;
  618. vertical-align: middle;
  619. // width: 30px;
  620. display: inline-block;
  621. }
  622. .title-container {
  623. position: relative;
  624. .title {
  625. font-size: 48px;
  626. color: #1f242a;
  627. margin: 0px auto 40px auto;
  628. text-align: center;
  629. font-weight: bold;
  630. }
  631. }
  632. .show-pwd {
  633. position: absolute;
  634. right: 10px;
  635. top: 7px;
  636. font-size: 16px;
  637. color: $dark_gray;
  638. cursor: pointer;
  639. user-select: none;
  640. }
  641. }
  642. .el-row {
  643. height: 100%;
  644. }
  645. .el-col {
  646. height: 100%;
  647. }
  648. .business {
  649. width: 305px;
  650. height: 90px;
  651. display: flex;
  652. align-items: center;
  653. justify-content: center;
  654. text-align: center;
  655. // background-color: #D8AB5A;
  656. border-raotherdius: 20rpx;
  657. color: #ffffff;
  658. margin-top: 57rpx;
  659. }
  660. .business {
  661. width: 305rpx;
  662. height: 90rpx;
  663. display: flex;
  664. align-items: center;
  665. justify-content: center;
  666. text-align: center;
  667. // background-color: #D8AB5A;
  668. border-raotherdius: 20rpx;
  669. color: #ffffff;
  670. margin-top: 57rpx;
  671. // line-height: 110rpx;
  672. }
  673. .bnesper {
  674. background-size: 100%;
  675. background-image: url("../../assets/img/loginbtn4.png");
  676. background-repeat: no-repeat;
  677. padding-top: 10rpx;
  678. color: #fff1d8;
  679. .asp {
  680. padding-bottom: 5px;
  681. }
  682. }
  683. .applyper {
  684. background-image: url("../../assets/img/loginbt1.png");
  685. background-repeat: no-repeat;
  686. background-size: 100%;
  687. padding-top: 10rpx;
  688. color: #fff1d8;
  689. .asp {
  690. padding-bottom: 5px;
  691. }
  692. }
  693. .actapp {
  694. background-image: url("../../assets/img/loginbtn3.png");
  695. background-repeat: no-repeat;
  696. background-size: 100%;
  697. color: #d05c39;
  698. margin-bottom: 80rpx;
  699. .as {
  700. padding-bottom: 20px;
  701. }
  702. // line-height: 180rpx;
  703. }
  704. .actbnes {
  705. background-image: url("../../assets/img/loginbt2.png");
  706. background-repeat: no-repeat;
  707. background-size: 100%;
  708. color: #d05c39;
  709. .asp {
  710. padding-bottom: 20px;
  711. }
  712. }
  713. .loginbtn {
  714. width: 100%;
  715. margin-top: 30px;
  716. background: linear-gradient(to right, #ffe1ad, #d07539);
  717. border: none;
  718. height: 56px;
  719. border-radius: 10px;
  720. font-size: 18px;
  721. }
  722. .registerbtn {
  723. margin-top: 0px;
  724. margin-bottom: 30px;
  725. font-size: 16px;
  726. .forgect {
  727. cursor: pointer;
  728. }
  729. .nes {
  730. color: #d05c39;
  731. }
  732. }
  733. .boximg {
  734. width: 100%;
  735. height: 100%;
  736. border-radius: 10px;
  737. background-color: #f6f6f6;
  738. display: flex;
  739. align-items: center;
  740. justify-content: center;
  741. image {
  742. width: 290px;
  743. height: 150px;
  744. }
  745. }
  746. .choosepic {
  747. .el-form-item__content {
  748. }
  749. }
  750. .usa {
  751. color: #d05c39;
  752. text-align: center;
  753. padding: 0 !important;
  754. margin: 0;
  755. }
  756. .overcicle {
  757. border: 1px solid #ffe2ae;
  758. padding-top: 50px;
  759. box-sizing: border-box;
  760. }
  761. </style>