StepAppeal.vue 18 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508
  1. <template>
  2. <div>
  3. <template v-if="!showChooseAddress">
  4. <div class="f-main">
  5. <div class="content-top">
  6. <p>更换管理员</p>
  7. <!--<a href="javascript:void(0)" class="back" @click="jump('select')"><i class="el-icon-back"></i></a>-->
  8. </div>
  9. <div class="f-form">
  10. <div class="page-part">
  11. <mt-field placeholder="新管理员手机号"
  12. v-model="valid.mobile"
  13. :state="state.mobile"
  14. type="tel"
  15. @blur.native.capture="validateMobile"
  16. ></mt-field>
  17. </div>
  18. <div class="page-part">
  19. <mt-field auto-complete="off"
  20. placeholder="短信验证码"
  21. v-model="valid.code"
  22. :state="state.code"
  23. @blur.native.capture="validateCode">
  24. <span class="token" @click="getCheckCode" v-text="tokenText" v-if="state.mobile === 'success'">获取验证码</span>
  25. <span class="token-no" v-text="tokenText" v-if="state.mobile !== 'success'">获取验证码</span>
  26. </mt-field>
  27. </div>
  28. <div class="page-part">
  29. <mt-field placeholder="企业名称"
  30. v-model="valid.spaceName"
  31. :state="state.spaceName"
  32. @blur.native.capture="validateSpaceName"
  33. ></mt-field>
  34. </div>
  35. <div class="page-part">
  36. <mt-field placeholder="营业执照号"
  37. v-model="valid.businessCode"
  38. auto-complete="off"
  39. :state="state.businessCode"
  40. @blur.native.capture="validateBusinessCode"
  41. ></mt-field>
  42. </div>
  43. <div class="page-part">
  44. <a class="phone-btn-blank" title="上传营业执照扫描件" v-bind:class="{ correct: uploadFileChecked }">
  45. <i class="fa fa-picture-o fa-p"></i>
  46. <span class="upload">上传营业执照扫描件</span>
  47. <input type="file"
  48. class="form-control file-input"
  49. name="name"
  50. accept="image/jpeg,image/jpg,image/gif,image/bmp,image/png,.pdf"
  51. @change="upload"/>
  52. </a>
  53. <a class="thumbnail" v-if="valid.businessCodeImage !== ''"><img class="previewImg" alt="" :src="isPdf ? '/images/all/timg.png' : valid.businessCodeImage"></a>
  54. </div>
  55. <div class="page-part">
  56. <mt-field placeholder="法定代表人"
  57. v-model="valid.corporation"
  58. auto-complete="off"
  59. :state="state.corporation"
  60. @blur.native.capture="validateCorporation"
  61. ></mt-field>
  62. </div>
  63. <div class="page-part" style="position: relative">
  64. <!--// 注册地址-->
  65. <mt-field readonly aria-haspopup="true" aria-expanded="false"
  66. placeholder="注册地址"
  67. v-model="regAddress"
  68. @click.native="chooseAddress"></mt-field>
  69. <i class="fa fa-map-marker fa-p" v-show="regAddress.length === 0"></i>
  70. </div>
  71. <div class="page-part">
  72. <mt-field placeholder="申诉说明"
  73. type="textarea"
  74. rows="4"
  75. v-model="valid.description"
  76. @blur.native.capture="validateDescription"></mt-field>
  77. <p class="pwd">请描述您申诉的原因,并尽可能多地列举出证明此账号为您所有的证据</p>
  78. </div>
  79. <div class="page-part">
  80. <mt-field placeholder="姓名"
  81. v-model="valid.contactName"
  82. :state="state.contactName"
  83. @blur.native.capture="validateContactName"
  84. ></mt-field>
  85. </div>
  86. <div class="page-part">
  87. <mt-field placeholder="联系电话"
  88. v-model="valid.contactTel"
  89. :state="state.contactTel"
  90. type="tel"
  91. @blur.native.capture="validateContactTel"
  92. ></mt-field>
  93. </div>
  94. <div class="page-part">
  95. <mt-field placeholder="电子邮箱"
  96. v-model="valid.contactEmail"
  97. :state="state.contactEmail"
  98. type="email"
  99. @blur.native.capture="validateContactEmail"
  100. ></mt-field>
  101. </div>
  102. <div class="page-part">
  103. <mt-button size="large" type="primary" @click="sureAccount('last')">提 交</mt-button>
  104. </div>
  105. </div>
  106. </div>
  107. </template>
  108. <template v-else>
  109. <address-choose
  110. @getAddress="setAddress"
  111. @getProvince="setProvince"
  112. @getCity="setCity"
  113. @getArea="setArea"
  114. @getDetailAddress="setDetailAddress"
  115. @getPopAddress="setPopAddress"
  116. @showEvent="showAddress"
  117. :popAddress="popAddress"
  118. :regStreet="regStreet"
  119. :regProvince="regProvince"
  120. :regCity="regCity"
  121. :regDistrict="regDistrict"/>
  122. </template>
  123. </div>
  124. </template>
  125. <script>
  126. import addressChoose from '~components/mobile/enterpriseCertification/addressChoose.vue'
  127. export default {
  128. name: 'step-one',
  129. components: {
  130. addressChoose
  131. },
  132. data () {
  133. return {
  134. uploadFileChecked: false,
  135. isPdf: false,
  136. showChooseAddress: false,
  137. state: {
  138. mobile: 'error',
  139. code: 'error',
  140. spaceName: 'error',
  141. businessCode: 'error',
  142. businessCodeImage: 'error',
  143. corporation: 'error',
  144. description: 'error',
  145. contactName: 'error',
  146. contactTel: 'error',
  147. contactEmail: 'error'
  148. },
  149. valid: {
  150. mobile: '',
  151. code: '',
  152. spaceName: '',
  153. businessCode: '',
  154. businessCodeImage: '',
  155. corporation: '',
  156. description: '',
  157. contactName: '',
  158. contactTel: '',
  159. contactEmail: ''
  160. },
  161. tokenCode: '',
  162. tokenTime: 60,
  163. tokenText: '获取验证码',
  164. regAddress: '',
  165. regProvince: '',
  166. regCity: '',
  167. regDistrict: '',
  168. popAddress: '',
  169. regStreet: ''
  170. }
  171. },
  172. methods: {
  173. // 选择注册地址
  174. chooseAddress () {
  175. this.showChooseAddress = true
  176. },
  177. setAddress (detail) {
  178. this.regAddress = detail
  179. },
  180. setProvince (detail) {
  181. this.regProvince = detail
  182. },
  183. setCity (detail) {
  184. this.regCity = detail
  185. },
  186. setArea (detail) {
  187. this.regDistrict = detail
  188. },
  189. setDetailAddress (detail) {
  190. this.regStreet = detail
  191. },
  192. setPopAddress (detail) {
  193. this.popAddress = detail
  194. },
  195. showAddress (info) {
  196. this.showChooseAddress = info
  197. },
  198. jump (type) {
  199. this.$emit('stepEvent', type)
  200. },
  201. // 弹窗处理
  202. downToast (type) {
  203. this.$toast({
  204. message: type,
  205. iconClass: 'el-icon-warning'
  206. })
  207. },
  208. // 验证手机号
  209. validateMobile () {
  210. if (!this.valid.mobile) {
  211. this.downToast('请先填写手机号')
  212. this.state.mobile = 'error'
  213. } else {
  214. let reg = /^1[0-9]{10}$/
  215. if (!reg.test(this.valid.mobile)) {
  216. this.downToast('请填写正确的手机号')
  217. this.state.mobile = 'warning'
  218. } else {
  219. this.state.mobile = 'success'
  220. }
  221. }
  222. },
  223. // 验证正确的验证码
  224. validateCode () {
  225. if (!this.valid.code) {
  226. this.downToast('请先填写验证码')
  227. this.state.code = 'error'
  228. } else {
  229. if (!this.valid.mobile) {
  230. this.downToast('请先填写正确的手机号码')
  231. this.state.code = 'warning'
  232. } else {
  233. if (this.tokenCode) {
  234. let param = new FormData()
  235. param.append('mobile', this.valid.mobile)
  236. param.append('token', this.tokenCode)
  237. param.append('code', this.valid.code)
  238. let config = {
  239. headers: {'Content-Type': 'multipart/form-data'}
  240. }
  241. this.$http.post('/appeal/check/mobile', param, config)
  242. .then(response => {
  243. if (response.data.success) {
  244. this.state.code = 'success'
  245. } else {
  246. this.$toast({
  247. message: response.data.errMsg,
  248. iconClass: 'el-icon-error'
  249. })
  250. return Promise.reject(response.data)
  251. }
  252. }).catch(() => {
  253. this.downToast('请检查网络是否正常或联系服务商')
  254. })
  255. } else {
  256. this.downToast('请点击先获取验证码信息')
  257. this.state.code = 'warning'
  258. }
  259. }
  260. }
  261. },
  262. // 获取验证码
  263. getCheckCode () {
  264. if (this.tokenTime > 0 && this.tokenTime < 60) {
  265. this.downToast('请稍后再点击,我在倒计时')
  266. } else {
  267. if (this.state.mobile === 'success') {
  268. this.$indicator.open('获取中...')
  269. let _this = this
  270. this.$http.get('/appeal/check/mobile', {params: {mobile: this.valid.mobile}})
  271. .then(response => {
  272. this.$indicator.close()
  273. if (response.data) {
  274. this.tokenCode = response.data.content.token
  275. this.$toast({
  276. message: '验证码已经发送到您的手机,请注意查收',
  277. iconClass: 'el-icon-success'
  278. })
  279. this.tokenText = '已发送(' + this.tokenTime + 'S)'
  280. let setTime = setInterval(() => {
  281. _this.tokenTime--
  282. this.tokenText = '已发送(' + this.tokenTime + 'S)'
  283. if (this.tokenTime <= 0) {
  284. clearInterval(setTime)
  285. _this.tokenText = '获取验证码'
  286. _this.tokenTime = 60
  287. }
  288. }, 1000)
  289. }
  290. }).catch(() => {
  291. this.$indicator.close()
  292. this.downToast('请检查网络是否正常或联系服务商')
  293. })
  294. }
  295. }
  296. },
  297. // 验证企业名称
  298. validateSpaceName () {
  299. if (!this.valid.spaceName) {
  300. this.downToast('请填写企业名称')
  301. this.state.spaceName = 'error'
  302. } else {
  303. if (this.valid.spaceName.length >= 20) {
  304. this.state.spaceName = 'warning'
  305. this.downToast('请填写合适的企业名称,20个字符以内')
  306. } else {
  307. this.$http.get(`/api/userspace/checkSpaceName`, {params: {spaceName: this.valid.spaceName}})
  308. .then(response => {
  309. if (response.data.success) {
  310. console.log('enterpriseName', response.data)
  311. this.state.spaceName = 'warning'
  312. this.downToast('企业不存在,请确认。')
  313. } else {
  314. this.state.spaceName = 'success'
  315. }
  316. }).catch(err => {
  317. this.$indicator.close()
  318. this.downToast(err.errMsg)
  319. })
  320. }
  321. }
  322. },
  323. // 验证营业执照号
  324. validateBusinessCode () {
  325. let reg = /^[A-Za-z0-9]+$/
  326. if (!this.valid.businessCode) {
  327. this.downToast('请填写营业执照号')
  328. this.state.businessCode = 'error'
  329. } else {
  330. if (this.valid.businessCode.length >= 20) {
  331. this.downToast('输入长度过长,20个字符以内')
  332. this.state.businessCode = 'warning'
  333. } else {
  334. if (reg.test(this.valid.businessCode)) {
  335. this.state.businessCode = 'success'
  336. } else {
  337. this.downToast('营业执照号只能填写字母和数字的组合')
  338. this.state.businessCode = 'error'
  339. }
  340. }
  341. }
  342. },
  343. // 验证法定代表人
  344. validateCorporation () {
  345. if (!this.valid.corporation) {
  346. this.downToast('请填写法定代表人')
  347. this.state.description = 'error'
  348. } else {
  349. if (this.valid.corporation.length >= 20) {
  350. this.downToast('输入长度过长,20个字符以内')
  351. this.state.corporation = 'warning'
  352. } else {
  353. this.state.corporation = 'success'
  354. }
  355. }
  356. },
  357. // 上传营业执照扫描件
  358. upload (e) {
  359. let file = e.target.files[0]
  360. if (file) {
  361. if (file.size > 5 * 1024 * 1024) {
  362. this.uploadFileChecked = false
  363. this.downToast('文件大小不能超过5M')
  364. } else {
  365. this.$indicator.open('上传中...')
  366. let param = new FormData()
  367. param.append('image', file, file.name)
  368. let config = {
  369. headers: {'Content-Type': 'multipart/form-data'}
  370. }
  371. // 图片上传接口
  372. this.$http.post('/api/userspace/upload', param, config)
  373. .then(response => {
  374. this.$indicator.close()
  375. if (response.data.success) {
  376. let path = response.data.content
  377. if (path.slice(path.lastIndexOf('.')).toLowerCase() === '.pdf') {
  378. this.isPdf = true
  379. } else {
  380. this.isPdf = false
  381. }
  382. this.valid.businessCodeImage = response.data.content
  383. this.uploadFileChecked = true
  384. } else {
  385. this.uploadFileChecked = false
  386. return Promise.reject(response.data)
  387. }
  388. }).catch(err => {
  389. this.downToast(err.errMsg)
  390. this.uploadFileChecked = false
  391. })
  392. }
  393. } else {
  394. this.$indicator.close()
  395. }
  396. },
  397. // 申诉
  398. validateDescription () {
  399. if (!this.valid.description) {
  400. this.downToast('请填写申诉说明')
  401. this.state.description = 'error'
  402. } else {
  403. if (this.valid.description.length >= 100) {
  404. this.downToast('输入长度过长,100个字符以内')
  405. this.state.description = 'warning'
  406. } else {
  407. this.state.description = 'success'
  408. }
  409. }
  410. },
  411. // 验证姓名
  412. validateContactName () {
  413. if (!this.valid.contactName) {
  414. this.downToast('请填写您的姓名')
  415. this.state.contactName = 'error'
  416. } else {
  417. if (this.valid.contactName.length > 20) {
  418. this.downToast('输入长度过长,限定20个字符以内')
  419. this.state.contactName = 'warning'
  420. } else {
  421. this.state.contactName = 'success'
  422. }
  423. }
  424. },
  425. // 验证电话
  426. validateContactTel () {
  427. let reg = /^1[0-9]{10}$/
  428. if (!this.valid.contactTel) {
  429. this.downToast('请填写联系电话')
  430. this.state.contactTel = 'error'
  431. } else {
  432. if (!reg.test(this.valid.contactTel)) {
  433. this.downToast('请填写正确的联系电话')
  434. this.state.contactTel = 'warning'
  435. } else {
  436. this.state.contactTel = 'success'
  437. }
  438. }
  439. },
  440. // 验证邮箱
  441. validateContactEmail () {
  442. let reg = /^([\w-])+(\.\w+)*@([\w-])+((\.\w{2,3}){1,3})$/
  443. if (!this.valid.contactEmail) {
  444. this.downToast('请填写联系电子邮箱')
  445. this.state.contactEmail = 'error'
  446. } else {
  447. if (!reg.test(this.valid.contactEmail)) {
  448. this.downToast('请输入正确的邮箱地址格式')
  449. this.state.contactEmail = 'warning'
  450. } else {
  451. this.state.contactEmail = 'success'
  452. }
  453. }
  454. },
  455. sureAccount (type) {
  456. if (this.state.mobile !== 'success' ||
  457. this.state.code !== 'success' ||
  458. this.state.spaceName !== 'success' ||
  459. this.state.businessCode !== 'success' ||
  460. this.valid.businessCodeImage === '' ||
  461. this.regAddress === '' ||
  462. this.state.description !== 'success' ||
  463. this.state.contactName !== 'success' ||
  464. this.state.contactTel !== 'success' ||
  465. this.state.contactEmail !== 'success') {
  466. this.downToast('请确认填写部分是否有误')
  467. } else {
  468. this.$indicator.open('验证过程中...')
  469. let param = new FormData()
  470. param.append('mobile', this.valid.mobile)
  471. param.append('code', this.valid.code)
  472. param.append('spaceName', this.valid.spaceName)
  473. param.append('businessCode', this.valid.businessCode)
  474. param.append('businessCodeImage', this.valid.businessCodeImage)
  475. param.append('corporation', this.valid.corporation)
  476. param.append('regAddress', this.regAddress)
  477. param.append('regProvince', this.regProvince)
  478. param.append('regCity', this.regCity)
  479. param.append('regDistrict', this.regDistrict)
  480. param.append('regStreet', this.regStreet)
  481. param.append('description', this.valid.description)
  482. param.append('contactName', this.valid.contactName)
  483. param.append('contactTel', this.valid.contactTel)
  484. param.append('contactEmail', this.valid.contactEmail)
  485. param.append('token', this.tokenCode)
  486. param.append('appId', this.$store.state.option.appId)
  487. let config = {
  488. headers: {'Content-Type': 'multipart/form-data'}
  489. }
  490. this.$http.post('/appeal/changeAdmin', param, config)
  491. .then(response => {
  492. this.$indicator.close()
  493. if (response.data.success) {
  494. this.$emit('stepEvent', type)
  495. this.$emit('lastEvent', 'appeal')
  496. } else {
  497. this.downToast(response.data.errMsg)
  498. }
  499. }).catch(() => {
  500. this.$indicator.close()
  501. this.downToast('请检查网络是否正常或联系服务商')
  502. })
  503. }
  504. }
  505. }
  506. }
  507. </script>