companyIdentity.vue 11 KB

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