EnterpriseCertification.vue 22 KB

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