companyIdentity.vue 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399
  1. <template>
  2. <view class="center">
  3. <view class="top">
  4. <text @click='consent' v-bind:class="switchs1">公司</text>
  5. <text @click='consent' v-bind:class="switchs2">个人</text>
  6. </view>
  7. <view v-if="consentStatus == true">
  8. <!-- 公司营业执照上传 -->
  9. <view v-if="license1 != ''">
  10. <upload class="upload" ref="upload" :action="action" :max-size="maxSize" :max-count="1"
  11. :size-type="['compressed']" @on-success="getImgUrl" @on-error="onError" @on-remove="onRemove"
  12. @on-uploaded="isAdd = true" :before-upload="filterFileType" :options="uploadOptions"
  13. :custom="uploadCustom" @on-progress="onProgress"></upload>
  14. </view>
  15. <view class="c-row b-b">
  16. <text class="tit">公司名称</text>
  17. <view class="con-list">
  18. <input placeholder="请填写公司名称" name="input" v-model="identityAuthenticationInfo.compName"></input>
  19. </view>
  20. </view>
  21. <view class="c-row b-b">
  22. <text class="tit">纳税人识别号</text>
  23. <view class="con-list">
  24. <input placeholder="请填写纳税人识别号" name="input"
  25. v-model="identityAuthenticationInfo.payTaxesCard"></input>
  26. </view>
  27. </view>
  28. </view>
  29. <view v-else>
  30. <view>
  31. <!-- 个人身份证正面 -->
  32. <upload class="upload" ref="upload" :action="action" :max-size="maxSize" :max-count="1"
  33. :size-type="['compressed']" @on-success="getImgUrl1" @on-error="onError" @on-remove="onRemove"
  34. @on-uploaded="isAdd = true" :before-upload="filterFileType" :options="uploadOptions1"
  35. :custom="uploadCustom1" @on-progress="onProgress"></upload>
  36. <!-- 个人身份证反面 -->
  37. <upload class="upload" ref="upload" :action="action" :max-size="maxSize" :max-count="1"
  38. :size-type="['compressed']" @on-success="getImgUrl2" @on-error="onError" @on-remove="onRemove"
  39. @on-uploaded="isAdd = true" :before-upload="filterFileType" :options="uploadOptions2"
  40. :custom="uploadCustom2" @on-progress="onProgress"></upload>
  41. </view>
  42. <view class="c-row b-b">
  43. <text class="tit">姓名</text>
  44. <view class="con-list">
  45. <input placeholder="请填写姓名" name="input" v-model="identityAuthenticationInfo.customerName"></input>
  46. </view>
  47. </view>
  48. <view class="c-row b-b">
  49. <text class="tit">身份证号</text>
  50. <view class="con-list">
  51. <input placeholder="请填写身份证号" name="input"
  52. v-model="identityAuthenticationInfo.customerNumberCard"></input>
  53. </view>
  54. </view>
  55. </view>
  56. <button class="btns btn" @click="jumpUrl">下一步</button>
  57. </view>
  58. </template>
  59. <script>
  60. import upload from '@/components/upload.vue';
  61. import {
  62. mapState
  63. } from 'vuex';
  64. export default {
  65. components: {
  66. upload
  67. },
  68. name: "buy",
  69. data() {
  70. return {
  71. action: this.$uploadUrl,
  72. maxSize: 5 * 1024 * 1024, //限制文件大小 5M
  73. btnLoading: false, //防止重复点击
  74. isAdd: true,
  75. imgUrls: [],
  76. uploadCustom: true,
  77. uploadCustom1: true,
  78. uploadCustom2:true,
  79. uploadOptions: {
  80. "text": "上传营业执照",
  81. "bgc": ""
  82. },
  83. uploadOptions1: {
  84. "text": "上传身份证头像页",
  85. "bgc": "https://taohaoliang.oss-cn-beijing.aliyuncs.com/app/tmp/identityup%282%29.png"
  86. },
  87. uploadOptions2: {
  88. "text": "上传身份证国徽页",
  89. "bgc": "https://taohaoliang.oss-cn-beijing.aliyuncs.com/app/tmp/identitylow%282%29.png"
  90. },
  91. tupian: "",
  92. inputContent: null,
  93. customerPhone: '',
  94. consentStatus: true,
  95. consentStatus1: false,
  96. codestatus: false,
  97. verifyCode: null,
  98. inputStatus: 'none',
  99. sendText: '获取验证码',
  100. platform: '',
  101. sendDisabled: false,
  102. license1: "../../static/img/authentication/business@3x.png",
  103. switchs1: "switchs1",
  104. switchs2: "switchs2",
  105. id: [],
  106. id1: "../../static/img/authentication/identityup(3).png",
  107. id2: "../../static/img/authentication/identitylow(3).png",
  108. identityImgs1: {},
  109. identityAuthenticationInfo: {},
  110. tempFilePaths: [],
  111. businessLicenseAddressUrl: "",
  112. certificates: true,
  113. };
  114. },
  115. computed: {
  116. ...mapState(['hasLogin', 'userInfo'])
  117. },
  118. methods: {
  119. filterFileType(index, lists) {
  120. if (lists[index].fileType != 'jpg' && lists[index].fileType != 'png' && lists[index].fileType != 'gif') {
  121. lists.splice(index, 1);
  122. // 当前文件不支持
  123. uni.showModal({
  124. title: '暂不支持当前图片类型',
  125. showCancel: false
  126. });
  127. } else {
  128. this.isAdd = false;
  129. }
  130. },
  131. // 营业执照上传
  132. getImgUrl(res) {
  133. console.log(res)
  134. console.log('------------res-----------')
  135. this.imgUrls.push(res);
  136. this.identityAuthenticationInfo.businessLicenseAddressUrl = res
  137. },
  138. // 身份证正面
  139. getImgUrl1(res) {
  140. console.log(res)
  141. let that = this
  142. that.id[0] = res
  143. that.id1 = res
  144. that.identityImgs1.personImg = res
  145. that.$api.doRequest('get', '/driverViewInfo/personShibie', that
  146. .identityImgs1).then(res => {
  147. if (res.data.data.recPerson != null) {
  148. if (res.data.data.recPerson != "") {
  149. that.$set(that.identityAuthenticationInfo,
  150. 'customerName', res.data.data.recPerson)
  151. }
  152. }
  153. if (res.data.data.recPersonNo != null) {
  154. if (res.data.data.recPersonNo != "") {
  155. that.$set(that.identityAuthenticationInfo,
  156. 'customerNumberCard', res.data.data
  157. .recPersonNo)
  158. }
  159. }
  160. }).catch(res => {
  161. uni.showToast({
  162. title: res.data.message,
  163. icon: 'none',
  164. duration: 2000
  165. })
  166. })
  167. },
  168. // 身份证反面
  169. getImgUrl2(res) {
  170. console.log(res)
  171. let that = this
  172. that.id[1] = res
  173. that.id2 = res
  174. that.identityImgs1.personImg = res
  175. that.$api.doRequest('get', '/driverViewInfo/personShibie', that
  176. .identityImgs1).then(res => {
  177. if (res.data.data.recPerson != null) {
  178. if (res.data.data.recPerson != "") {
  179. that.$set(that.identityAuthenticationInfo,
  180. 'customerName', res.data.data.recPerson)
  181. }
  182. }
  183. if (res.data.data.recPersonNo != null) {
  184. if (res.data.data.recPersonNo != "") {
  185. that.$set(that.identityAuthenticationInfo,
  186. 'customerNumberCard', res.data.data
  187. .recPersonNo)
  188. }
  189. }
  190. }).catch(res => {
  191. uni.showToast({
  192. title: res.data.message,
  193. icon: 'none',
  194. duration: 2000
  195. })
  196. })
  197. },
  198. onError(error) {
  199. alert(error)
  200. console.log('------------error-----------')
  201. console.log(error)
  202. },
  203. onProgress(e) {
  204. console.log(e)
  205. },
  206. onRemove(index) {
  207. this.imgUrls.splice(index, 1);
  208. },
  209. jumpUrl() {
  210. if (this.consentStatus) {
  211. if (!this.identityAuthenticationInfo.compName) {
  212. this.$api.msg('公司名称不能为空')
  213. return
  214. }
  215. if (this.identityAuthenticationInfo.compName.length < 2 || this.identityAuthenticationInfo.compName
  216. .length > 25) {
  217. this.$api.msg('公司名称输入错误')
  218. return
  219. }
  220. if (!this.identityAuthenticationInfo.payTaxesCard) {
  221. this.$api.msg('纳税人识别号不能为空')
  222. return
  223. }
  224. if (this.identityAuthenticationInfo.payTaxesCard.length < 15 || this.identityAuthenticationInfo
  225. .payTaxesCard.length > 20) {
  226. this.$api.msg('纳税人识别号输入错误')
  227. return
  228. }
  229. if (this.identityAuthenticationInfo.businessLicenseAddressUrl == "" || this.identityAuthenticationInfo
  230. .businessLicenseAddressUrl == null) {
  231. this.$api.msg('请上传营业执照')
  232. return
  233. }
  234. this.identityAuthenticationInfo.customerTypeFlag = "2"
  235. this.identityAuthenticationInfo.customerType = "企业"
  236. var model = JSON.stringify(this.identityAuthenticationInfo);
  237. uni.navigateTo({
  238. url: `/pageD/identity/companyIdentityTwo?identityAuthenticationInfo=` + model,
  239. })
  240. } else if (this.consentStatus1) {
  241. this.identityAuthenticationInfo.cardAddressUrl = this.id.toString()
  242. if (this.id[0] == '' || this.id[0] == null) {
  243. this.$api.msg('请上传身份证正面')
  244. return
  245. }
  246. if (this.id[1] == '' || this.id[1] == null) {
  247. this.$api.msg('请上传身份证反面')
  248. return
  249. }
  250. if (!this.identityAuthenticationInfo.customerName) {
  251. this.$api.msg('姓名不能为空')
  252. return
  253. }
  254. if (this.identityAuthenticationInfo.customerName.length < 2 || this.identityAuthenticationInfo
  255. .customerName.length > 10) {
  256. this.$api.msg('姓名输入错误')
  257. return
  258. }
  259. if (!this.identityAuthenticationInfo.customerNumberCard) {
  260. this.$api.msg('身份证号不能为空')
  261. return
  262. }
  263. if (this.identityAuthenticationInfo.customerNumberCard.length != 18) {
  264. this.$api.msg('身份证号输入错误')
  265. return
  266. }
  267. this.identityAuthenticationInfo.customerTypeFlag = "1"
  268. this.identityAuthenticationInfo.customerType = "个人"
  269. var model = JSON.stringify(this.identityAuthenticationInfo);
  270. uni.navigateTo({
  271. url: `/pageD/identity/companyIdentityThree?identityAuthenticationInfo=` + model,
  272. })
  273. }
  274. },
  275. consent() {
  276. if (this.consentStatus == false && this.consentStatus1 == true) {
  277. this.consentStatus = true
  278. this.consentStatus1 = false
  279. this.switchs1 = "switchs1"
  280. this.switchs2 = "switchs2"
  281. } else if (this.consentStatus == true && this.consentStatus1 == false) {
  282. this.consentStatus = false
  283. this.consentStatus1 = true
  284. this.switchs1 = "switchs2"
  285. this.switchs2 = "switchs1"
  286. }
  287. },
  288. phoneinput(e) {
  289. if (e.detail.value.length == 11) {
  290. this.codestatus = true
  291. }
  292. },
  293. verifyCodeInput(e) {
  294. this.verifyCode = e.detail.value
  295. },
  296. cancel() {
  297. this.inputShow = false
  298. this.inputStatus = 'none'
  299. this.isPhone = false
  300. },
  301. },
  302. }
  303. </script>
  304. <style>
  305. .center {
  306. padding: 10px 20px;
  307. }
  308. .c-row {
  309. display: -webkit-box;
  310. display: -webkit-flex;
  311. display: flex;
  312. -webkit-box-align: center;
  313. -webkit-align-items: center;
  314. align-items: center;
  315. padding: 20rpx 30rpx;
  316. position: relative;
  317. }
  318. .con-list {
  319. -webkit-box-flex: 1;
  320. -webkit-flex: 1;
  321. flex: 1;
  322. display: -webkit-box;
  323. display: -webkit-flex;
  324. display: flex;
  325. -webkit-box-orient: vertical;
  326. -webkit-box-direction: normal;
  327. -webkit-flex-direction: column;
  328. flex-direction: column;
  329. color: #303133;
  330. line-height: 40rpx;
  331. text-align: right;
  332. padding-right: 20rpx;
  333. font-size: 14px;
  334. }
  335. .uni-navigator {
  336. display: inline-block;
  337. color: #22C572;
  338. }
  339. .getcode.active {
  340. background: #22C572;
  341. color: #fff;
  342. }
  343. .btn {
  344. margin-top: 10px;
  345. background-color: #FFFFFF;
  346. border-radius: 25px;
  347. border: none;
  348. }
  349. .btns {
  350. background-color: #22C572;
  351. color: white;
  352. }
  353. .switchs1 {
  354. font-size: 20px;
  355. font-weight: 700;
  356. margin-right: 16px;
  357. }
  358. .switchs2 {
  359. font-size: 20px;
  360. margin-right: 16px;
  361. }
  362. .picture {
  363. width: 100%;
  364. height: 220px;
  365. text-align: center;
  366. margin-top: 10px;
  367. }
  368. .words {
  369. font-size: 18px;
  370. font-weight: 600;
  371. color: #617E8B;
  372. }
  373. .floats {
  374. position: relative;
  375. top: -150px;
  376. text-align: center;
  377. }
  378. .upload {
  379. margin: 20rpx 0;
  380. }
  381. </style>