index.vue 8.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289
  1. <template>
  2. <div :class="mobile ? 'companyVerifyInputMobile' : 'companyVerifyInput'">
  3. <div class="titleArea">
  4. <p>企业认证</p>
  5. </div>
  6. <div class="bodyArea">
  7. <div class="selectList">
  8. <div class="topTips">
  9. <p>认证优势:</p>
  10. <p>·同方向同时5次的预约机会(未认证企业只有1次)</p>
  11. <p>·能预约全部展示的优质开发者</p>
  12. <p>·全国最大中高端程序员共享工作台,独享展示标签</p>
  13. <p>·提升企业技术水平公信力,提高约单转化率</p>
  14. <!--<p>·认证需完善企业信息并支付认证费用58元</p>-->
  15. </div>
  16. <div class="inputArea">
  17. <div class="inputBox" v-for="item in inputList" :key="item.name">
  18. <p class="name">{{item.title}}</p>
  19. <input type="text" placeholder="请输入" v-model="item.value">
  20. </div>
  21. </div>
  22. <div class="uploadFile">
  23. <p class="name">请上传 <span>加盖公章</span> 的营业执照</p>
  24. <div class="uploadArea">
  25. <el-upload
  26. v-loading="uploading"
  27. class="avatar-uploader"
  28. action="#"
  29. :show-file-list="false"
  30. :multiple="false"
  31. accept="image/png, image/jpeg"
  32. :before-upload="handleFileChange"
  33. >
  34. <i v-if="imageUrl" class="el-icon-delete avatar-uploader-icon" @click.stop="handleDeleteFile"></i>
  35. <img v-if="imageUrl" :src="imageUrl" class="avatar"/>
  36. <div v-else class="noneImage">
  37. <i class="el-icon-plus avatar-uploader-icon"></i>
  38. <span class="title">上传照片</span>
  39. </div>
  40. </el-upload>
  41. <p class="tipps">
  42. (图片大小最大2M)
  43. </p>
  44. </div>
  45. </div>
  46. </div>
  47. <div class="submitButton">
  48. <div class="left"></div>
  49. <div class="right" @click="submitForm" :class="isSubmit ? '' : 'noSubmit' ">
  50. <p>{{calcBtnWord}}</p>
  51. </div>
  52. </div>
  53. </div>
  54. </div>
  55. </template>
  56. <script>
  57. export default {
  58. name: 'companyVerifyInput',
  59. data() {
  60. return {
  61. typeList: [],
  62. inputList: [
  63. { name: 'name', title: '企业名称', value: '' },
  64. { name: 'register_number', title: '工商执照注册号/统一社会信用代码', value: '' },
  65. { name: 'phone', title: '联系方式', value: '' },
  66. ],
  67. imageUrl: '',
  68. dataInfo: {},
  69. uploading: false,
  70. loadingStatus: null,
  71. getTimes: 30
  72. }
  73. },
  74. asyncData({ app }) {
  75. return {
  76. mobile: app.$deviceType.isMobile(),
  77. }
  78. },
  79. computed: {
  80. isSubmit() {
  81. const { verify_status } = this.dataInfo || {}
  82. if ([ 1, 2 ].indexOf(Number(verify_status)) !== -1) {
  83. return false
  84. }
  85. return true
  86. },
  87. calcBtnWord() {
  88. let { verify_status } = this.dataInfo || {}
  89. verify_status = Number(verify_status || 0)
  90. if (verify_status === 0) {
  91. return '立即认证'
  92. } else if (verify_status === 1) {
  93. return '审核中'
  94. } else if (verify_status === 2) {
  95. return '认证通过'
  96. } else if (verify_status === 3) {
  97. return '立即认证'
  98. }
  99. }
  100. },
  101. async created() {
  102. },
  103. async mounted() {
  104. await this.needLogin()
  105. this.getInfo()
  106. },
  107. methods: {
  108. /** 获取展示状态 */
  109. getInfo(isRefresh=false) {
  110. this.$axios.get('/api/remote/get_company_verify_info_for_apply').then(res => {
  111. if (res.data.status === 1) {
  112. this.dataInfo = res.data.data
  113. // status: "0" 未认证 1认证中 2已成功 3被拒绝
  114. this.inputList.forEach(item => {
  115. let value = this.dataInfo[ item.name ]
  116. if (value) {
  117. item.value = value
  118. }
  119. })
  120. const {need_pay, verify_status} = res.data.data
  121. if (res.data.data && (Number(need_pay) !== 1 || verify_status) && isRefresh) {
  122. this.$message.success("您已提交企业认证,请耐心等待审核结果!")
  123. clearInterval(this.interval)
  124. this.loadingStatus && this.loadingStatus.close()
  125. }
  126. this.inputList = [ ...this.inputList ]
  127. this.imageUrl = this.dataInfo.photo_url || ''
  128. console.log('ist', this.inputList)
  129. }
  130. })
  131. },
  132. /** 提交 **/
  133. submitForm() {
  134. //认证中 已认证 不能再次提交
  135. if (!this.isSubmit) {
  136. this.$message.warning('你已提交企业认证信息,修改请联系客服')
  137. return
  138. }
  139. let p = {
  140. name: '',
  141. register_number: '',
  142. phone: '',
  143. photo_url: ''
  144. }
  145. p.photo_url = this.imageUrl
  146. this.inputList.forEach(item => {
  147. p[ item.name ] = item.value
  148. })
  149. if (!p.name) {
  150. this.$message.warning('请输入企业名称');
  151. return;
  152. }
  153. if (!p.register_number) {
  154. this.$message.warning('请输入工商执照注册号');
  155. return;
  156. }
  157. if (!p.phone) {
  158. this.$message.warning('请输入手机号码');
  159. return;
  160. }
  161. if (!p.photo_url) {
  162. this.$message.warning('请上传加盖公章的营业执照');
  163. return;
  164. }
  165. this.$axios.post('/api/remote/save_company_verify_apply', p).then(res => {
  166. let data = res.data
  167. if (data.status === 1) {
  168. //跳转到支付58元钱,之后提交
  169. if (Number(this.dataInfo.need_pay) === 1) {
  170. this.$message.success('提交成功,正在跳转...')
  171. let appUrl = "proginn://pay?product_type=5&product_id=0"
  172. let url = '/pay?product_type=5'
  173. if (!this.$deviceType.app) {
  174. window.open(url, '_black')
  175. } else {
  176. console.log('跳转到移动端支付...', url)
  177. location.href = appUrl
  178. }
  179. setTimeout(()=>{
  180. this.loadingStatus = this.$loading({ fullscreen: true, text: '正在查询支付状态...' });
  181. this.getPayStatus()
  182. }, 1500)
  183. } else {
  184. this.$message.success('您已提交企业认证,请耐心等待审核结果!')
  185. setTimeout(() => {
  186. if (this.$deviceType.app) {
  187. history.back()
  188. } else {
  189. location.href = '/wo/work_todo'
  190. }
  191. }, 1000)
  192. }
  193. } else {
  194. this.$message.error('提交失败')
  195. }
  196. }).catch(e => {
  197. console.log(e)
  198. this.$message.error('提交失败')
  199. })
  200. },
  201. handleFileChange(file) {
  202. const isLt2M = file.size / 1024 / 1024 < 2;
  203. if (!isLt2M) {
  204. this.$message.error('上传图片大小不能超过 2MB!');
  205. return
  206. }
  207. const formData = new FormData();
  208. formData.append("file", file);
  209. formData.append("original_filename", file.name);
  210. this.uploading = true;
  211. this.$axios
  212. .$post(`/upload_image`, formData, {
  213. headers: { "Content-Type": "multipart/form-data" }
  214. })
  215. .then(res => {
  216. console.log(res)
  217. this.imageUrl = res.filename
  218. }).catch((e)=>{
  219. this.$message.error("上传失败:" + e.message)
  220. })
  221. .finally(() => {
  222. this.uploading = false;
  223. });
  224. },
  225. handleDeleteFile() {
  226. this.imageUrl = ''
  227. },
  228. async getPayStatus() {
  229. let maxTime = 30
  230. this.interval = setInterval(()=>{
  231. this.getInfo(true)
  232. maxTime--
  233. if (maxTime < 0) {
  234. this.loadingStatus && this.loadingStatus.close()
  235. this.$message.error("支付结果查询超时,请刷新页面或重试。")
  236. clearInterval(this.interval)
  237. return
  238. }
  239. }, 3000)
  240. }
  241. },
  242. }
  243. </script>
  244. <style lang="scss" scoped>
  245. @import '../../../assets/css/otherpage/companyVerifyInput.scss';
  246. </style>
  247. <style lang="scss">
  248. @import '../../../assets/css/scssCommon.scss';
  249. .el-upload {
  250. width: 184px;
  251. height: 136px;
  252. border: 1px dashed #409eff;
  253. border-radius: 6px;
  254. cursor: pointer;
  255. position: relative;
  256. overflow: hidden;
  257. img {
  258. width: 100%;
  259. height: auto;
  260. object-fit: contain;
  261. object-position: top left;
  262. }
  263. &:hover {
  264. border-color: #409eff;
  265. .el-icon-delete {
  266. display: block;
  267. }
  268. }
  269. }
  270. .companyVerifyInputMobile {
  271. .el-upload {
  272. width: pxtovw(184);
  273. height: pxtovw(136);
  274. border: pxtovw(1) dashed #409eff;
  275. border-radius: pxtovw(6);
  276. }
  277. }
  278. </style>