EnterpriseCertification.vue 22 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629
  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.usoftchina.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.usoftchina.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 && !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. this.$message.error('文件大小不能超过5M')
  340. } else {
  341. let param = new FormData()
  342. param.append('image', file, file.name)
  343. let config = {
  344. headers: {'Content-Type': 'multipart/form-data'}
  345. }
  346. // 图片上传接口
  347. this.$http.post('/api/userspace/upload', param, config)
  348. .then(response => {
  349. this.isShowLoading = false
  350. let path = response.data.content
  351. if (path.slice(path.lastIndexOf('.')).toLowerCase() === '.pdf') {
  352. this.isPdf = true
  353. } else {
  354. this.isPdf = false
  355. }
  356. this.enterprise.businessCodeImage = response.data.content
  357. this.uploadFileChecked = true
  358. }, err => {
  359. this.isShowLoading = false
  360. console.log(err)
  361. this.uploadFileChecked = false
  362. })
  363. }
  364. } else {
  365. this.isShowLoading = false
  366. }
  367. },
  368. // 地址选择
  369. onHideBox: function () {
  370. this.onHideAddress()
  371. },
  372. onHideAddress () {
  373. if (!this.isShowAddressBox && !this.isClickInputAddress) {
  374. this.showAddressBox = false
  375. }
  376. this.isClickInputAddress = false
  377. },
  378. onShowAddress () {
  379. if (this.showAddressBox) {
  380. this.onHideAddress()
  381. } else {
  382. this.showAddressBox = true
  383. this.isClickInputAddress = true
  384. }
  385. },
  386. getCity (province) {
  387. this.cityData.city = []
  388. this.address.regCity = ''
  389. this.cityData.district = []
  390. this.address.regDistrict = ''
  391. this.address.regProvince = province
  392. for (let item in this.allCityData[province]) {
  393. this.cityData.city.push(item)
  394. }
  395. },
  396. getDistrict (city) {
  397. this.address.regCity = city
  398. this.address.regDistrict = ''
  399. this.cityData.district = this.allCityData[this.address.regProvince][city]
  400. },
  401. chooseDistrict (district) {
  402. this.address.regDistrict = district
  403. },
  404. submitAddress () {
  405. if (this.address.regDistrict !== '' && this.address.regCity !== '' && this.address.regProvince !== '') {
  406. if (this.address.regStreet) {
  407. let reg = /^(?=.*([\w\u4e00-\u9fa5]+)).*$/
  408. if (!reg.test(this.address.regStreet)) {
  409. this.addressCheck = false
  410. this.$message.error('请输入详细地址')
  411. } else {
  412. this.enterprise.regAddress = this.address.regProvince + this.address.regCity + this.address.regDistrict + this.address.regStreet
  413. this.showAddressBox = false
  414. this.addressCheck = true
  415. }
  416. } else {
  417. this.$message.error('请输入详细地址')
  418. this.addressCheck = false
  419. }
  420. } else {
  421. this.$message.error('请输入省、市、区')
  422. this.addressCheck = false
  423. }
  424. },
  425. // 提交表单
  426. submitForm () {
  427. if (this.checked && this.spaceNameChecked && this.businessCodeChecked && this.corporationChecked && this.uploadFileChecked && this.addressCheck) {
  428. this.isShowLoading = true
  429. let param = new FormData()
  430. param.append('spaceName', this.enterprise.spaceName)
  431. param.append('businessCode', this.enterprise.businessCode)
  432. param.append('corporation', this.enterprise.corporation)
  433. param.append('regAddress', this.enterprise.regAddress)
  434. param.append('regProvince', this.address.regProvince)
  435. param.append('regCity', this.address.regCity)
  436. param.append('regDistrict', this.address.regDistrict)
  437. param.append('regStreet', this.address.regStreet)
  438. param.append('businessCodeImage', this.enterprise.businessCodeImage)
  439. let config = {
  440. headers: {'Content-Type': 'multipart/form-data'}
  441. }
  442. this.$http.post('/valid/userspace/submit', param, config)
  443. .then(response => {
  444. this.isShowLoading = false
  445. if (response.data.success) {
  446. this.enterpriseRegister = false
  447. } else {
  448. this.enterpriseRegister = true
  449. return Promise.reject(response.data)
  450. }
  451. }).catch(err => {
  452. this.$message.error(err.errMsg)
  453. this.isShowLoading = false
  454. })
  455. }
  456. },
  457. // 跳转至个人中心页面
  458. goCloudCenter () {
  459. if (this.$route.query.returnURL) {
  460. window.location.href = decodeURIComponent(this.$route.query.returnURL)
  461. } else {
  462. this.$router.push('/cloudcenter')
  463. }
  464. }
  465. }
  466. }
  467. </script>
  468. <style lang="scss" scoped>
  469. .certification {
  470. margin: 0 auto;
  471. width: 100%;
  472. background: #eee;
  473. .container{
  474. padding-top: 50px;
  475. margin: 0 auto;
  476. width: 980px;
  477. text-align: center;
  478. .content{
  479. padding: 0 50px;
  480. margin: 50px auto 0;
  481. width: 100%;
  482. text-align: center;
  483. background: #fff;
  484. .content-top{
  485. height: 80px;
  486. line-height: 80px;
  487. h3{
  488. margin-bottom: 0;
  489. font-family: 'SimHei';
  490. font-size: 24px;
  491. color: #000;
  492. border-bottom: 1px solid #dcdcdc;
  493. }
  494. .step{
  495. position: relative;
  496. margin-top: 10px;
  497. img{
  498. width: 315px;
  499. height: 46px;
  500. }
  501. .step-item{
  502. position: absolute;
  503. top: 45px;
  504. left: 265px;
  505. span{
  506. margin-right: 85px;
  507. font-size: 14px;
  508. color: #b4b4b4;
  509. }
  510. span.active {
  511. color: #0076ad;
  512. }
  513. }
  514. }
  515. }
  516. form {
  517. padding-bottom: 44px;
  518. margin-top: 152px;
  519. input{
  520. padding: 0 0 0 18px;
  521. width: 360px;
  522. height: 44px;
  523. line-height: 44px;
  524. font-size: 14px;
  525. color: #000;
  526. border-radius: 0;
  527. }
  528. .padding55 input{
  529. padding-left: 55px;
  530. }
  531. .padding45 input{
  532. padding-left: 45px;
  533. }
  534. span.tip{
  535. position: absolute;
  536. top: 0;
  537. right: -238px;
  538. font-size: 13px;
  539. color: #8c8c8c;
  540. a{
  541. font-size: 13px;
  542. color: #0076ad;
  543. }
  544. }
  545. i{
  546. position: absolute;
  547. top: 13px;
  548. left: 20px;
  549. font-size: 20px;
  550. color: #a0a0a0;
  551. }
  552. input[type='checkbox']{
  553. margin: 0 14px 0 55px;
  554. float: left;
  555. width: 16px;
  556. height: 16px;
  557. }
  558. span.agree{
  559. float: left;
  560. margin: 1px 0 0 10px;
  561. font-size: 14px;
  562. color: #8b8b8b;
  563. a{
  564. color: #0076ad;
  565. }
  566. }
  567. .form-group.agree{
  568. margin: 20px auto 0 !important;
  569. }
  570. .btn {
  571. margin: 34px 0 16px 0;
  572. width: 360px;
  573. height: 44px;
  574. line-height: 44px;
  575. font-size: 16px;
  576. color: #fff;
  577. background: #0076AD;
  578. border-radius: 3px;
  579. }
  580. }
  581. .content-bottom{
  582. margin-top: 155px;
  583. padding-bottom: 50px;
  584. p{
  585. font-size: 24px;
  586. color: #323232;
  587. img{
  588. margin-right: 20px;
  589. width: 30px;
  590. height: 28px;
  591. }
  592. }
  593. p.pass{
  594. font-size: 24px;
  595. color: #e77405;
  596. img{
  597. height: 30px;
  598. }
  599. }
  600. p.passed {
  601. color: #2ab300;
  602. img{
  603. height: 30px;
  604. }
  605. }
  606. span{
  607. display: inline-block;
  608. margin: 15px 0 140px 0;
  609. font-size: 14px;
  610. color: #8b8b8b;
  611. }
  612. .close-btn{
  613. margin: 0 auto;
  614. width: 200px;
  615. height: 36px;
  616. line-height: 36px;
  617. font-size: 14px;
  618. text-align: center;
  619. color: #323232;
  620. border: 1px solid #d2d2d2;
  621. border-radius: 3px;
  622. cursor: pointer ;
  623. }
  624. }
  625. }
  626. }
  627. }
  628. </style>