EnterpriseCertification.vue 21 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579
  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 prop="businessImage" 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="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">关闭</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. </div>
  153. </div>
  154. </template>
  155. <script>
  156. export default {
  157. name: 'enterpriseCertification',
  158. data () {
  159. // 企业认证第一步
  160. var validateSpaceName = (rule, value, callback) => {
  161. if (value === '') {
  162. callback(new Error('请填写正确的企业名称'))
  163. this.spaceNameChecked = false
  164. this.isSpaceNameValid = false
  165. } else {
  166. if (this.enterprise.spaceName !== '') {
  167. if (value.length > 20) {
  168. callback(new Error('输入长度过长,20个字符以内'))
  169. } else {
  170. this.$http.get(`/api/userspace/name/valid`, {params: {spaceName: this.enterprise.spaceName}})
  171. .then(response => {
  172. if (!response.data.content.isValid) {
  173. this.spaceNameChecked = true
  174. this.isSpaceNameValid = false
  175. } else {
  176. this.spaceNameChecked = false
  177. this.isSpaceNameValid = true
  178. return Promise.reject(response.data)
  179. }
  180. }).catch(err => {
  181. // console.log(err)
  182. this.$message.error(err.errMsg)
  183. })
  184. }
  185. }
  186. callback()
  187. }
  188. }
  189. var validateBusinessCode = (rule, value, callback) => {
  190. if (value === '') {
  191. callback(new Error('请填写正确的营业执照号'))
  192. this.businessCodeChecked = false
  193. this.isBusinessCodeValid = false
  194. } else {
  195. if (this.enterprise.businessCode !== '') {
  196. if (value.length > 20) {
  197. callback(new Error('输入长度过长,20个字符以内'))
  198. } else {
  199. this.$http.get(`/api/userspace/businessCode/valid`, {params: {businessCode: this.enterprise.businessCode}})
  200. .then(response => {
  201. if (!response.data.content.isValid) {
  202. this.businessCodeChecked = true
  203. this.isBusinessCodeValid = false
  204. } else {
  205. this.businessCodeChecked = false
  206. this.isBusinessCodeValid = true
  207. return Promise.reject(response.data)
  208. }
  209. }).catch(err => {
  210. // console.log(err)
  211. this.$message.error(err.errMsg)
  212. })
  213. }
  214. }
  215. callback()
  216. }
  217. }
  218. var validateCorporation = (rule, value, callback) => {
  219. if (value === '') {
  220. callback(new Error('请填写正确的法定代表人'))
  221. this.corporationChecked = false
  222. } else {
  223. if (this.enterprise.corporation !== '') {
  224. if (value.length > 20) {
  225. callback(new Error('输入长度过长,20个字符以内'))
  226. } else {
  227. this.corporationChecked = true
  228. }
  229. }
  230. callback()
  231. }
  232. }
  233. return {
  234. enterpriseRegister: true,
  235. enterprise: {
  236. spaceName: '',
  237. businessCode: '',
  238. corporation: '',
  239. regAddress: '',
  240. businessCodeImage: ''
  241. },
  242. checked: true,
  243. showAddressBox: false,
  244. isShowAddressBox: false,
  245. isSpaceNameValid: false,
  246. isBusinessCodeValid: false,
  247. spaceNameChecked: false,
  248. businessCodeChecked: false,
  249. corporationChecked: false,
  250. uploadFileChecked: false,
  251. addressCheck: false,
  252. allCityData: {},
  253. cityData: {
  254. province: [],
  255. city: [],
  256. district: []
  257. },
  258. address: {
  259. regProvince: '',
  260. regCity: '',
  261. regDistrict: '',
  262. regStreet: ''
  263. },
  264. // 企业认证第一步
  265. rules: {
  266. spaceName: [
  267. {validator: validateSpaceName, trigger: 'blur'}
  268. ],
  269. businessCode: [
  270. {validator: validateBusinessCode, trigger: 'blur'}
  271. ],
  272. corporation: [
  273. {validator: validateCorporation, trigger: 'blur'}
  274. ]
  275. }
  276. }
  277. },
  278. computed: {
  279. logged () {
  280. return this.$store.state.option.isLogin.logged
  281. }
  282. },
  283. mounted () {
  284. // 验证是否登录
  285. this.$nextTick(() => {
  286. this.isLogin()
  287. // 刷新统计信息
  288. setInterval(() => {
  289. this.isLogin()
  290. }, 10000)
  291. })
  292. // 获取城市地址
  293. this.$http.get('/data/city.json').then(response => {
  294. this.allCityData = response.data
  295. for (let province in response.data) {
  296. this.cityData.province.push(province)
  297. }
  298. })
  299. },
  300. methods: {
  301. // 我同意是否被选中
  302. checkboxIsChecked () {
  303. this.checked = !this.checked
  304. },
  305. // 判断用户是否登录
  306. isLogin () {
  307. if (!this.logged) {
  308. // console.log(this.logged)
  309. // 未登录跳到登录页面
  310. // window.location.href = '/'
  311. }
  312. },
  313. // 上传营业执照扫描件
  314. upload (e) {
  315. let file = e.target.files[0]
  316. if (file.size > 5 * 1024 * 1024) {
  317. this.uploadFileChecked = false
  318. } else {
  319. let param = new FormData()
  320. param.append('image', file, file.name)
  321. let config = {
  322. headers: {'Content-Type': 'multipart/form-data'}
  323. }
  324. // 图片上传接口
  325. this.$http.post('/api/userspace/upload', param, config)
  326. .then(response => {
  327. this.enterprise.businessCodeImage = response.data.content
  328. this.uploadFileChecked = true
  329. }, err => {
  330. console.log(err)
  331. this.uploadFileChecked = false
  332. })
  333. }
  334. },
  335. // 地址选择
  336. onHideBox: function () {
  337. this.onHideAddress()
  338. },
  339. onHideAddress () {
  340. if (!this.isShowAddressBox && !this.isClickInputAddress) {
  341. this.showAddressBox = false
  342. }
  343. this.isClickInputAddress = false
  344. },
  345. onShowAddress () {
  346. if (this.showAddressBox) {
  347. this.onHideAddress()
  348. } else {
  349. this.showAddressBox = true
  350. this.isClickInputAddress = true
  351. }
  352. },
  353. getCity (province) {
  354. this.cityData.city = []
  355. this.address.regCity = ''
  356. this.cityData.district = []
  357. this.address.regDistrict = ''
  358. this.address.regProvince = province
  359. for (let item in this.allCityData[province]) {
  360. this.cityData.city.push(item)
  361. }
  362. },
  363. getDistrict (city) {
  364. this.address.regCity = city
  365. this.address.regDistrict = ''
  366. this.cityData.district = this.allCityData[this.address.regProvince][city]
  367. },
  368. chooseDistrict (district) {
  369. this.address.regDistrict = district
  370. },
  371. submitAddress () {
  372. if (this.address.regDistrict !== '' && this.address.regCity !== '' && this.address.regProvince !== '') {
  373. if (this.address.regStreet !== '') {
  374. this.enterprise.regAddress = this.address.regProvince + this.address.regCity + this.address.regDistrict + this.address.regStreet
  375. this.showAddressBox = false
  376. this.addressCheck = true
  377. } else {
  378. this.$message.error('请输入详细地址')
  379. this.addressCheck = false
  380. }
  381. } else {
  382. this.$message.error('请输入省、市、区')
  383. this.addressCheck = false
  384. }
  385. },
  386. // 提交表单
  387. submitForm () {
  388. if (this.checked && this.spaceNameChecked && this.businessCodeChecked && this.corporationChecked && this.uploadFileChecked && this.addressCheck) {
  389. let param = new FormData()
  390. param.append('spaceName', this.enterprise.spaceName)
  391. param.append('businessCode', this.enterprise.businessCode)
  392. param.append('corporation', this.enterprise.corporation)
  393. param.append('regAddress', this.enterprise.regAddress)
  394. param.append('regProvince', this.address.regProvince)
  395. param.append('regCity', this.address.regCity)
  396. param.append('regDistrict', this.address.regDistrict)
  397. param.append('regStreet', this.address.regStreet)
  398. param.append('businessCodeImage', this.enterprise.businessCodeImage)
  399. let config = {
  400. headers: {'Content-Type': 'multipart/form-data'}
  401. }
  402. this.$http.post('/valid/userspace/submit', param, config)
  403. .then(response => {
  404. if (response.data.success) {
  405. this.enterpriseRegister = false
  406. } else {
  407. this.enterpriseRegister = true
  408. return Promise.reject(response.data)
  409. }
  410. }).catch(err => {
  411. this.$message.error(err.errMsg)
  412. })
  413. }
  414. }
  415. }
  416. }
  417. </script>
  418. <style lang="scss" scoped>
  419. .certification {
  420. margin: 0 auto;
  421. width: 100%;
  422. background: #eee;
  423. .container{
  424. padding-top: 50px;
  425. margin: 0 auto;
  426. width: 980px;
  427. text-align: center;
  428. .content{
  429. padding: 0 50px;
  430. margin: 50px auto 0;
  431. width: 100%;
  432. text-align: center;
  433. background: #fff;
  434. .content-top{
  435. height: 80px;
  436. line-height: 80px;
  437. h3{
  438. margin-bottom: 0;
  439. font-family: 'SimHei';
  440. font-size: 24px;
  441. color: #000;
  442. border-bottom: 1px solid #dcdcdc;
  443. }
  444. .step{
  445. position: relative;
  446. margin-top: 10px;
  447. img{
  448. width: 315px;
  449. height: 46px;
  450. }
  451. .step-item{
  452. position: absolute;
  453. top: 45px;
  454. left: 265px;
  455. span{
  456. margin-right: 85px;
  457. font-size: 14px;
  458. color: #b4b4b4;
  459. }
  460. span.active {
  461. color: #0076ad;
  462. }
  463. }
  464. }
  465. }
  466. form {
  467. padding-bottom: 44px;
  468. margin-top: 152px;
  469. input{
  470. padding: 0 0 0 18px;
  471. width: 360px;
  472. height: 44px;
  473. line-height: 44px;
  474. font-size: 14px;
  475. color: #000;
  476. border-radius: 0;
  477. }
  478. .padding55 input{
  479. padding-left: 55px;
  480. }
  481. .padding45 input{
  482. padding-left: 45px;
  483. }
  484. span.tip{
  485. position: absolute;
  486. top: 0;
  487. right: -238px;
  488. font-size: 13px;
  489. color: #8c8c8c;
  490. a{
  491. font-size: 13px;
  492. color: #0076ad;
  493. }
  494. }
  495. i{
  496. position: absolute;
  497. top: 13px;
  498. left: 20px;
  499. font-size: 20px;
  500. color: #a0a0a0;
  501. }
  502. input[type='checkbox']{
  503. margin: 0 14px 0 55px;
  504. float: left;
  505. width: 16px;
  506. height: 16px;
  507. }
  508. span.agree{
  509. float: left;
  510. margin: 1px 0 0 10px;
  511. font-size: 14px;
  512. color: #8b8b8b;
  513. a{
  514. color: #0076ad;
  515. }
  516. }
  517. .form-group.agree{
  518. margin: 20px auto 0 !important;
  519. }
  520. .btn {
  521. margin: 34px 0 16px 0;
  522. width: 360px;
  523. height: 44px;
  524. line-height: 44px;
  525. font-size: 16px;
  526. color: #fff;
  527. background: #0076AD;
  528. border-radius: 3px;
  529. }
  530. }
  531. .content-bottom{
  532. margin-top: 155px;
  533. padding-bottom: 50px;
  534. p{
  535. font-size: 24px;
  536. color: #323232;
  537. img{
  538. margin-right: 20px;
  539. width: 30px;
  540. height: 28px;
  541. }
  542. }
  543. p.pass{
  544. font-size: 24px;
  545. color: #e77405;
  546. img{
  547. height: 30px;
  548. }
  549. }
  550. p.passed {
  551. color: #2ab300;
  552. img{
  553. height: 30px;
  554. }
  555. }
  556. span{
  557. display: inline-block;
  558. margin: 15px 0 140px 0;
  559. font-size: 14px;
  560. color: #8b8b8b;
  561. }
  562. .close-btn{
  563. margin: 0 auto;
  564. width: 200px;
  565. height: 36px;
  566. line-height: 36px;
  567. font-size: 14px;
  568. text-align: center;
  569. color: #323232;
  570. border: 1px solid #d2d2d2;
  571. border-radius: 3px;
  572. cursor: pointer ;
  573. }
  574. }
  575. }
  576. }
  577. }
  578. </style>