EnterpriseCertification.vue 22 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624
  1. <template>
  2. <div class="certification" @click="onHideBox">
  3. <div class="container">
  4. <div class="content" v-show="enterpriseRegister">
  5. <div class="content-top">
  6. <h3>企业认证</h3>
  7. <div class="step">
  8. <img src="/images/all/step01.png" alt=""/>
  9. <div class="step-item"><span class="active">认证申请</span><span>等待审核</span><span>审核结果</span></div>
  10. </div>
  11. </div>
  12. <div>
  13. <el-form :model="enterprise" :rules="rules" ref="enterprise" label-width="100px" class="demo-ruleForm">
  14. <el-form-item prop="spaceName">
  15. <el-input type="text"
  16. v-model="enterprise.spaceName"
  17. v-bind:class="{ active: isSpaceNameValid }"
  18. auto-complete="off"
  19. placeholder="企业名称"
  20. ></el-input>
  21. <span class="tip exist" v-show="isSpaceNameValid">该企业已被认证,请确认。<a href="https://www.ubtob.com/contact">仍有问题?</a></span>
  22. </el-form-item>
  23. <el-form-item prop="businessCode">
  24. <el-input type="text"
  25. v-model="enterprise.businessCode"
  26. v-bind:class="{ active: isBusinessCodeValid }"
  27. auto-complete="off"
  28. placeholder="营业执照号"></el-input>
  29. <span class="tip exist" v-show="isBusinessCodeValid">该企业已被认证,请确认。<a href="https://www.ubtob.com/contact">仍有问题?</a></span>
  30. </el-form-item>
  31. <el-form-item class="padding55">
  32. <a class="x-btn-blank" title="上传营业执照扫描件" v-bind:class="{ correct: uploadFileChecked }">
  33. <i class="fa fa-picture-o"></i>
  34. <span class="upload">上传营业执照扫描件</span>
  35. <input type="file"
  36. class="form-control file-input"
  37. name="name"
  38. accept="image/jpeg,image/jpg,image/gif,image/bmp,image/png,.pdf"
  39. @change="upload"/>
  40. </a>
  41. <a class="thumbnail" v-if="enterprise.businessCodeImage !== ''"><img class="previewImg" alt="" :src="isPdf?'/images/all/timg.png':enterprise.businessCodeImage"></a>
  42. </el-form-item>
  43. <el-form-item prop="corporation">
  44. <el-input v-model="enterprise.corporation" placeholder="法定代表人"></el-input>
  45. </el-form-item>
  46. <el-form-item prop="regAddress" class="padding45">
  47. <input type="text" readonly aria-haspopup="true" aria-expanded="false"
  48. @click="onShowAddress"
  49. v-model="enterprise.regAddress"
  50. v-bind:class="{ correct: addressCheck }"
  51. class="form-control"
  52. name="name"
  53. placeholder="注册地址"/>
  54. <i class="fa fa-map-marker"></i>
  55. <div v-show="showAddressBox"
  56. @mouseenter="isShowAddressBox = true"
  57. @mouseleave="isShowAddressBox = false"
  58. style="display: block;" class="dropdown-menu x-union-menu" aria-labelledby="address">
  59. <div class="x-union-header">
  60. <div>省份</div>
  61. <div>城市</div>
  62. <div>县区</div>
  63. <div class="x-item-ext">详细地址</div>
  64. </div>
  65. <div class="x-union-list">
  66. <ul class="list-unstyled">
  67. <li v-for="province in cityData.province"
  68. :class="province == address.regProvince ? 'active' : ''"
  69. v-text="province"
  70. @click="getCity(province)"></li>
  71. </ul>
  72. <ul class="list-unstyled">
  73. <li v-for="city in cityData.city"
  74. :class="city == address.regCity ? 'active' : ''"
  75. v-text="city"
  76. @click="getDistrict(city)"></li>
  77. </ul>
  78. <ul class="list-unstyled">
  79. <li v-for="district in cityData.district"
  80. v-text="district"
  81. :class="district == address.regDistrict ? 'active' : ''"
  82. @click="chooseDistrict(district)"></li>
  83. </ul>
  84. <div class="x-item-ext">
  85. <div class="form-group">
  86. <div class="col-sm-12">
  87. <textarea id="street"
  88. name="street"
  89. rows="4"
  90. v-model="address.regStreet"
  91. class="form-control x-input"
  92. placeholder="xx路xx大厦xx栋xx楼xx室"></textarea>
  93. </div>
  94. </div>
  95. <div class="text-right">
  96. <a class="register-btn btn-submit" @click="submitAddress">确定</a>
  97. <a @click="showAddressBox = false" class="register-btn btn-console">取消</a>
  98. </div>
  99. </div>
  100. </div>
  101. </div>
  102. </el-form-item>
  103. <el-form-item>
  104. <a class="btn finish"
  105. :disabled="!checked || !spaceNameChecked || !businessCodeChecked || !corporationChecked || !uploadFileChecked || !addressCheck"
  106. @click="submitForm">提交</a>
  107. </el-form-item>
  108. <el-form-item>
  109. <el-checkbox name="type" v-model="checked" @click="checkboxIsChecked"></el-checkbox>
  110. <span class="agree">我已阅读并同意 <a href="/common/agreement">《优软云服务条款》</a></span>
  111. </el-form-item>
  112. </el-form>
  113. </div>
  114. </div>
  115. <div class="content" v-show="!enterpriseRegister">
  116. <div class="content-top">
  117. <h3>企业认证</h3>
  118. <div class="step">
  119. <img src="/images/all/step02.png" alt=""/>
  120. <div class="step-item"><span class="active">认证申请</span><span class="active">等待审核</span><span>审核结果</span></div>
  121. </div>
  122. </div>
  123. <div class="content-bottom">
  124. <p><img src="/images/all/await.png" alt=""/>企业认证申请已提交,等待审核中</p>
  125. <span>我们会在1个工作日内审核您的资料,请耐心等待...</span>
  126. <div class="close-btn" @click="goCloudCenter">关闭</div>
  127. </div>
  128. </div>
  129. <div class="content" style="display: none;">
  130. <div class="content-top">
  131. <h3>企业认证</h3>
  132. <div class="step">
  133. <img src="/images/all/step03.png" alt=""/>
  134. <div class="step-item"><span class="active">认证申请</span><span class="active">等待审核</span><span class="active">审核结果</span></div>
  135. </div>
  136. </div>
  137. <div class="content-bottom">
  138. <p class="pass"><img src="/images/all/times.png" alt=""/>审核不通过</p>
  139. <span>原因:您上传的营业执由于被多个帐号认证,请勿重复提交!</span>
  140. <div class="close-btn">重新认证</div>
  141. </div>
  142. </div>
  143. <div class="content" style="display: none;">
  144. <div class="content-top">
  145. <h3>企业认证</h3>
  146. <div class="step">
  147. <img src="/images/all/step03.png" alt=""/>
  148. <div class="step-item"><span class="active">认证申请</span><span class="active">等待审核</span><span class="active">审核结果</span></div>
  149. </div>
  150. </div>
  151. <div class="content-bottom">
  152. <p class="passed"><img src="/images/all/pass.png" alt=""/>审核通过</p>
  153. <span>恭喜您,您提交的企业认证申请通过审核了!</span>
  154. <div class="close-btn">关闭</div>
  155. </div>
  156. </div>
  157. <loading v-show="isShowLoading"/>
  158. </div>
  159. </div>
  160. </template>
  161. <script>
  162. import Loading from '~components/common/loading/Loading.vue'
  163. export default {
  164. name: 'enterpriseCertification',
  165. components: {
  166. Loading
  167. },
  168. data () {
  169. // 企业认证第一步
  170. var validateSpaceName = (rule, value, callback) => {
  171. if (value === '') {
  172. callback(new Error('请填写正确的企业名称'))
  173. this.spaceNameChecked = false
  174. this.isSpaceNameValid = false
  175. } else {
  176. if (this.enterprise.spaceName !== '') {
  177. if (value.length > 20) {
  178. callback(new Error('输入长度过长,20个字符以内'))
  179. } else {
  180. this.$http.get(`/api/userspace/name/valid`, {params: {spaceName: this.enterprise.spaceName}})
  181. .then(response => {
  182. if (!response.data.content.isValid) {
  183. this.spaceNameChecked = true
  184. this.isSpaceNameValid = false
  185. } else {
  186. this.spaceNameChecked = false
  187. this.isSpaceNameValid = true
  188. return Promise.reject(response.data)
  189. }
  190. }).catch(err => {
  191. // console.log(err)
  192. this.$message.error(err.errMsg)
  193. })
  194. }
  195. }
  196. callback()
  197. }
  198. }
  199. var validateBusinessCode = (rule, value, callback) => {
  200. if (value === '') {
  201. callback(new Error('请填写正确的营业执照号'))
  202. this.businessCodeChecked = false
  203. this.isBusinessCodeValid = false
  204. } else {
  205. if (this.enterprise.businessCode !== '') {
  206. let reg = /^[A-Za-z0-9]+$/
  207. if (reg.test(value)) {
  208. if (value.length > 20) {
  209. callback(new Error('输入长度过长,20个字符以内'))
  210. } else {
  211. this.$http.get(`/api/userspace/businessCode/valid`, {params: {businessCode: this.enterprise.businessCode}})
  212. .then(response => {
  213. if (!response.data.content.isValid) {
  214. this.businessCodeChecked = true
  215. this.isBusinessCodeValid = false
  216. } else {
  217. this.businessCodeChecked = false
  218. this.isBusinessCodeValid = true
  219. return Promise.reject(response.data)
  220. }
  221. }).catch(err => {
  222. // console.log(err)
  223. this.$message.error(err.errMsg)
  224. })
  225. }
  226. } else {
  227. callback(new Error('请填写正确的营业执照号'))
  228. this.businessCodeChecked = false
  229. this.isBusinessCodeValid = false
  230. }
  231. }
  232. callback()
  233. }
  234. }
  235. var validateCorporation = (rule, value, callback) => {
  236. if (value === '') {
  237. callback(new Error('请填写正确的法定代表人'))
  238. this.corporationChecked = false
  239. } else {
  240. if (this.enterprise.corporation !== '') {
  241. if (value.length > 20) {
  242. callback(new Error('输入长度过长,20个字符以内'))
  243. } else {
  244. this.corporationChecked = true
  245. }
  246. }
  247. callback()
  248. }
  249. }
  250. return {
  251. isShowLoading: false,
  252. isPdf: false,
  253. enterpriseRegister: true,
  254. enterprise: {
  255. spaceName: '',
  256. businessCode: '',
  257. corporation: '',
  258. regAddress: '',
  259. businessCodeImage: ''
  260. },
  261. checked: true,
  262. showAddressBox: false,
  263. isShowAddressBox: false,
  264. isSpaceNameValid: false,
  265. isBusinessCodeValid: false,
  266. spaceNameChecked: false,
  267. businessCodeChecked: false,
  268. corporationChecked: false,
  269. uploadFileChecked: false,
  270. addressCheck: false,
  271. allCityData: {},
  272. cityData: {
  273. province: [],
  274. city: [],
  275. district: []
  276. },
  277. address: {
  278. regProvince: '',
  279. regCity: '',
  280. regDistrict: '',
  281. regStreet: ''
  282. },
  283. // 企业认证第一步
  284. rules: {
  285. spaceName: [
  286. {validator: validateSpaceName, trigger: 'blur'}
  287. ],
  288. businessCode: [
  289. {validator: validateBusinessCode, trigger: 'blur'}
  290. ],
  291. corporation: [
  292. {validator: validateCorporation, trigger: 'blur'}
  293. ]
  294. }
  295. }
  296. },
  297. computed: {
  298. logged () {
  299. return this.$store.state.option.isLogin.data.content
  300. }
  301. },
  302. mounted () {
  303. // 验证是否登录
  304. this.$nextTick(() => {
  305. this.isLogin()
  306. // 刷新统计信息
  307. setInterval(() => {
  308. this.isLogin()
  309. }, 10000)
  310. })
  311. // 获取城市地址
  312. this.$http.get('/data/city.json').then(response => {
  313. this.allCityData = response.data
  314. for (let province in response.data) {
  315. this.cityData.province.push(province)
  316. }
  317. })
  318. },
  319. methods: {
  320. // 我同意是否被选中
  321. checkboxIsChecked () {
  322. this.checked = !this.checked
  323. },
  324. // 判断用户是否登录
  325. isLogin () {
  326. if (!this.logged.isLogin) {
  327. // 未登录跳到登录页面
  328. window.location.href = '/'
  329. }
  330. },
  331. // 上传营业执照扫描件
  332. upload (e) {
  333. this.isShowLoading = true
  334. let file = e.target.files[0]
  335. if (file) {
  336. if (file.size > 5 * 1024 * 1024) {
  337. this.uploadFileChecked = false
  338. this.isShowLoading = false
  339. } else {
  340. let param = new FormData()
  341. param.append('image', file, file.name)
  342. let config = {
  343. headers: {'Content-Type': 'multipart/form-data'}
  344. }
  345. // 图片上传接口
  346. this.$http.post('/api/userspace/upload', param, config)
  347. .then(response => {
  348. this.isShowLoading = false
  349. let path = response.data.content
  350. if (path.slice(path.lastIndexOf('.')).toLowerCase() === '.pdf') {
  351. this.isPdf = true
  352. } else {
  353. this.isPdf = false
  354. }
  355. this.enterprise.businessCodeImage = response.data.content
  356. this.uploadFileChecked = true
  357. }, err => {
  358. this.isShowLoading = false
  359. console.log(err)
  360. this.uploadFileChecked = false
  361. })
  362. }
  363. } else {
  364. this.isShowLoading = false
  365. }
  366. },
  367. // 地址选择
  368. onHideBox: function () {
  369. this.onHideAddress()
  370. },
  371. onHideAddress () {
  372. if (!this.isShowAddressBox && !this.isClickInputAddress) {
  373. this.showAddressBox = false
  374. }
  375. this.isClickInputAddress = false
  376. },
  377. onShowAddress () {
  378. if (this.showAddressBox) {
  379. this.onHideAddress()
  380. } else {
  381. this.showAddressBox = true
  382. this.isClickInputAddress = true
  383. }
  384. },
  385. getCity (province) {
  386. this.cityData.city = []
  387. this.address.regCity = ''
  388. this.cityData.district = []
  389. this.address.regDistrict = ''
  390. this.address.regProvince = province
  391. for (let item in this.allCityData[province]) {
  392. this.cityData.city.push(item)
  393. }
  394. },
  395. getDistrict (city) {
  396. this.address.regCity = city
  397. this.address.regDistrict = ''
  398. this.cityData.district = this.allCityData[this.address.regProvince][city]
  399. },
  400. chooseDistrict (district) {
  401. this.address.regDistrict = district
  402. },
  403. submitAddress () {
  404. if (this.address.regDistrict !== '' && this.address.regCity !== '' && this.address.regProvince !== '') {
  405. if (this.address.regStreet) {
  406. let reg = /^(?=.*([\w\u4e00-\u9fa5]+)).*$/
  407. if (!reg.test(this.address.regStreet)) {
  408. this.addressCheck = false
  409. this.$message.error('请输入详细地址')
  410. } else {
  411. this.enterprise.regAddress = this.address.regProvince + this.address.regCity + this.address.regDistrict + this.address.regStreet
  412. this.showAddressBox = false
  413. this.addressCheck = true
  414. }
  415. } else {
  416. this.$message.error('请输入详细地址')
  417. this.addressCheck = false
  418. }
  419. } else {
  420. this.$message.error('请输入省、市、区')
  421. this.addressCheck = false
  422. }
  423. },
  424. // 提交表单
  425. submitForm () {
  426. if (this.checked && this.spaceNameChecked && this.businessCodeChecked && this.corporationChecked && this.uploadFileChecked && this.addressCheck) {
  427. this.isShowLoading = true
  428. let param = new FormData()
  429. param.append('spaceName', this.enterprise.spaceName)
  430. param.append('businessCode', this.enterprise.businessCode)
  431. param.append('corporation', this.enterprise.corporation)
  432. param.append('regAddress', this.enterprise.regAddress)
  433. param.append('regProvince', this.address.regProvince)
  434. param.append('regCity', this.address.regCity)
  435. param.append('regDistrict', this.address.regDistrict)
  436. param.append('regStreet', this.address.regStreet)
  437. param.append('businessCodeImage', this.enterprise.businessCodeImage)
  438. let config = {
  439. headers: {'Content-Type': 'multipart/form-data'}
  440. }
  441. this.$http.post('/valid/userspace/submit', param, config)
  442. .then(response => {
  443. this.isShowLoading = false
  444. if (response.data.success) {
  445. this.enterpriseRegister = false
  446. } else {
  447. this.enterpriseRegister = true
  448. return Promise.reject(response.data)
  449. }
  450. }).catch(err => {
  451. this.$message.error(err.errMsg)
  452. this.isShowLoading = false
  453. })
  454. }
  455. },
  456. // 跳转至个人中心页面
  457. goCloudCenter () {
  458. window.location.href = '/cloudcenter'
  459. }
  460. }
  461. }
  462. </script>
  463. <style lang="scss" scoped>
  464. .certification {
  465. margin: 0 auto;
  466. width: 100%;
  467. background: #eee;
  468. .container{
  469. padding-top: 50px;
  470. margin: 0 auto;
  471. width: 980px;
  472. text-align: center;
  473. .content{
  474. padding: 0 50px;
  475. margin: 50px auto 0;
  476. width: 100%;
  477. text-align: center;
  478. background: #fff;
  479. .content-top{
  480. height: 80px;
  481. line-height: 80px;
  482. h3{
  483. margin-bottom: 0;
  484. font-family: 'SimHei';
  485. font-size: 24px;
  486. color: #000;
  487. border-bottom: 1px solid #dcdcdc;
  488. }
  489. .step{
  490. position: relative;
  491. margin-top: 10px;
  492. img{
  493. width: 315px;
  494. height: 46px;
  495. }
  496. .step-item{
  497. position: absolute;
  498. top: 45px;
  499. left: 265px;
  500. span{
  501. margin-right: 85px;
  502. font-size: 14px;
  503. color: #b4b4b4;
  504. }
  505. span.active {
  506. color: #0076ad;
  507. }
  508. }
  509. }
  510. }
  511. form {
  512. padding-bottom: 44px;
  513. margin-top: 152px;
  514. input{
  515. padding: 0 0 0 18px;
  516. width: 360px;
  517. height: 44px;
  518. line-height: 44px;
  519. font-size: 14px;
  520. color: #000;
  521. border-radius: 0;
  522. }
  523. .padding55 input{
  524. padding-left: 55px;
  525. }
  526. .padding45 input{
  527. padding-left: 45px;
  528. }
  529. span.tip{
  530. position: absolute;
  531. top: 0;
  532. right: -238px;
  533. font-size: 13px;
  534. color: #8c8c8c;
  535. a{
  536. font-size: 13px;
  537. color: #0076ad;
  538. }
  539. }
  540. i{
  541. position: absolute;
  542. top: 13px;
  543. left: 20px;
  544. font-size: 20px;
  545. color: #a0a0a0;
  546. }
  547. input[type='checkbox']{
  548. margin: 0 14px 0 55px;
  549. float: left;
  550. width: 16px;
  551. height: 16px;
  552. }
  553. span.agree{
  554. float: left;
  555. margin: 1px 0 0 10px;
  556. font-size: 14px;
  557. color: #8b8b8b;
  558. a{
  559. color: #0076ad;
  560. }
  561. }
  562. .form-group.agree{
  563. margin: 20px auto 0 !important;
  564. }
  565. .btn {
  566. margin: 34px 0 16px 0;
  567. width: 360px;
  568. height: 44px;
  569. line-height: 44px;
  570. font-size: 16px;
  571. color: #fff;
  572. background: #0076AD;
  573. border-radius: 3px;
  574. }
  575. }
  576. .content-bottom{
  577. margin-top: 155px;
  578. padding-bottom: 50px;
  579. p{
  580. font-size: 24px;
  581. color: #323232;
  582. img{
  583. margin-right: 20px;
  584. width: 30px;
  585. height: 28px;
  586. }
  587. }
  588. p.pass{
  589. font-size: 24px;
  590. color: #e77405;
  591. img{
  592. height: 30px;
  593. }
  594. }
  595. p.passed {
  596. color: #2ab300;
  597. img{
  598. height: 30px;
  599. }
  600. }
  601. span{
  602. display: inline-block;
  603. margin: 15px 0 140px 0;
  604. font-size: 14px;
  605. color: #8b8b8b;
  606. }
  607. .close-btn{
  608. margin: 0 auto;
  609. width: 200px;
  610. height: 36px;
  611. line-height: 36px;
  612. font-size: 14px;
  613. text-align: center;
  614. color: #323232;
  615. border: 1px solid #d2d2d2;
  616. border-radius: 3px;
  617. cursor: pointer ;
  618. }
  619. }
  620. }
  621. }
  622. }
  623. </style>