index.vue 7.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249
  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. <el-upload
  25. v-loading="uploading"
  26. class="avatar-uploader"
  27. action="#"
  28. :show-file-list="false"
  29. :multiple="false"
  30. accept="image/png, image/jpeg"
  31. :before-upload="handleFileChange"
  32. >
  33. <i v-if="imageUrl" class="el-icon-delete avatar-uploader-icon" @click.stop="handleDeleteFile"></i>
  34. <img v-if="imageUrl" :src="imageUrl" class="avatar"/>
  35. <div v-else class="noneImage">
  36. <i class="el-icon-plus avatar-uploader-icon"></i>
  37. <span class="title">上传照片</span>
  38. </div>
  39. </el-upload>
  40. </div>
  41. </div>
  42. <div class="submitButton">
  43. <div class="left"></div>
  44. <div class="right" @click="submitForm" :class="isSubmit ? '' : 'noSubmit' ">
  45. <p>{{calcBtnWord}}</p>
  46. </div>
  47. </div>
  48. </div>
  49. </div>
  50. </template>
  51. <script>
  52. export default {
  53. name: 'companyVerifyInput',
  54. data() {
  55. return {
  56. typeList: [],
  57. inputList: [
  58. { name: 'name', title: '企业名称', value: '' },
  59. { name: 'register_number', title: '工商执照注册号/统一社会信用代码', value: '' },
  60. { name: 'phone', title: '联系方式', value: '' },
  61. ],
  62. imageUrl: '',
  63. dataInfo: {},
  64. uploading: false
  65. }
  66. },
  67. asyncData({ app }) {
  68. return {
  69. mobile: app.$deviceType.isMobile(),
  70. }
  71. },
  72. computed: {
  73. isSubmit() {
  74. const { status } = this.dataInfo || {}
  75. if ([ 1, 2 ].indexOf(Number(status)) !== -1) {
  76. return false
  77. }
  78. return true
  79. },
  80. calcBtnWord() {
  81. let { status } = this.dataInfo || {}
  82. status = Number(status || 0)
  83. if (status === 0) {
  84. return '立即认证'
  85. } else if (status === 1) {
  86. return '审核中'
  87. } else if (status === 2) {
  88. return '认证通过'
  89. } else if (status === 3) {
  90. return '立即认证'
  91. }
  92. }
  93. },
  94. async created() {
  95. },
  96. async mounted() {
  97. await this.needLogin()
  98. this.getInfo()
  99. },
  100. methods: {
  101. /** 获取展示状态 */
  102. getInfo() {
  103. this.$axios.get('/api/remote/get_company_verify_info_for_apply').then(res => {
  104. if (res.data.status === 1) {
  105. this.dataInfo = res.data.data
  106. // status: "0" 未认证 1认证中 2已成功 3被拒绝
  107. this.inputList.forEach(item => {
  108. let value = this.dataInfo[ item.name ]
  109. if (value) {
  110. item.value = value
  111. }
  112. })
  113. this.inputList = [ ...this.inputList ]
  114. this.imageUrl = this.dataInfo.photo_url || ''
  115. console.log('ist', this.inputList)
  116. }
  117. })
  118. },
  119. /** 提交 **/
  120. submitForm() {
  121. //认证中 已认证 不能再次提交
  122. if (!this.isSubmit) {
  123. return
  124. }
  125. let p = {
  126. name: '',
  127. register_number: '',
  128. phone: '',
  129. photo_url: ''
  130. }
  131. p.photo_url = this.imageUrl
  132. this.inputList.forEach(item => {
  133. p[ item.name ] = item.value
  134. })
  135. if (!p.name) {
  136. this.$message.warning('请输入企业名称');
  137. return;
  138. }
  139. if (!p.register_number) {
  140. this.$message.warning('请输入工商执照注册号');
  141. return;
  142. }
  143. if (!p.phone) {
  144. this.$message.warning('请输入手机号码');
  145. return;
  146. }
  147. if (!p.photo_url) {
  148. this.$message.warning('请上传加盖公章的营业执照');
  149. return;
  150. }
  151. this.$axios.post('/api/remote/save_company_verify_apply', p).then(res => {
  152. let data = res.data
  153. if (data.status === 1) {
  154. //跳转到支付58元钱,之后提交
  155. if (Number(this.dataInfo.need_pay) === 1) {
  156. let appUrl = "proginn://pay?product_type=5"
  157. let url = '/pay?product_type=5'
  158. if (!this.$deviceType.app) {
  159. window.open(url, '_black')
  160. } else {
  161. location.href = appUrl
  162. }
  163. } else {
  164. this.$message.success('您已提交企业认证,请耐心等待审核结果!')
  165. setTimeout(() => {
  166. if (this.$deviceType.app) {
  167. history.back()
  168. } else {
  169. location.href = '/wo/work_todo'
  170. }
  171. }, 1000)
  172. }
  173. } else {
  174. this.$message.error('提交失败')
  175. }
  176. }).catch(e => {
  177. console.log(e)
  178. this.$message.error('提交失败')
  179. })
  180. },
  181. handleFileChange(file) {
  182. const formData = new FormData();
  183. formData.append("file", file);
  184. formData.append("original_filename", file.name);
  185. this.uploading = true;
  186. this.$axios
  187. .$post(`/upload_image`, formData, {
  188. headers: { "Content-Type": "multipart/form-data" }
  189. })
  190. .then(res => {
  191. console.log(res)
  192. this.imageUrl = res.filename
  193. })
  194. .finally(() => {
  195. this.uploading = false;
  196. });
  197. },
  198. handleDeleteFile() {
  199. this.imageUrl = ''
  200. }
  201. },
  202. }
  203. </script>
  204. <style lang="scss" scoped>
  205. @import '../../../assets/css/otherpage/companyVerifyInput.scss';
  206. </style>
  207. <style lang="scss">
  208. @import '../../../assets/css/scssCommon.scss';
  209. .el-upload {
  210. width: 184px;
  211. height: 136px;
  212. border: 1px dashed #409eff;
  213. border-radius: 6px;
  214. cursor: pointer;
  215. position: relative;
  216. overflow: hidden;
  217. img {
  218. width: 100%;
  219. height: auto;
  220. object-fit: contain;
  221. object-position: top left;
  222. }
  223. &:hover {
  224. border-color: #409eff;
  225. .el-icon-delete {
  226. display: block;
  227. }
  228. }
  229. }
  230. .companyVerifyInputMobile {
  231. .el-upload {
  232. width: pxtovw(184);
  233. height: pxtovw(136);
  234. border: pxtovw(1) dashed #409eff;
  235. border-radius: pxtovw(6);
  236. }
  237. }
  238. </style>