You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

1036 lines
26 KiB

  1. const config = require('../../../../config/config.js')
  2. const Http = require('../../../../utils/HttpBasics.js')
  3. const util = require('../../../../utils/util.js')
  4. const app = getApp();
  5. Page({
  6. /**
  7. * 页面的初始数据
  8. */
  9. data: {
  10. id: '',//
  11. organizationType: "",//2企业 /4个人
  12. idDocType: 1,
  13. certificateIndex: 0, //证件下标
  14. // certificateType: null, //证件类型
  15. businessLicenseInfo: {
  16. license_copy_info: { ///营业执照
  17. url: "",
  18. media_id: ""
  19. },
  20. license_number: "", //营业执照注册号
  21. license_address: "", //注册地址
  22. period_type: "1", //1=定期 2=长期
  23. period_begin: "", //有效期限开始日期
  24. period_end: "", //有效期限结束日期,长期直接传“长期”
  25. merchant_name: "", //商户名称
  26. legal_person: "", //经营者/法人姓名
  27. },
  28. idCardInfo: { //身份证类型
  29. id_card_copy_info: { //身份证人像照片
  30. url: "",
  31. media_id: ""
  32. },
  33. id_card_national_info: { //身份证国徽照片
  34. url: "",
  35. media_id: ""
  36. },
  37. id_card_name: "", //身份证姓名
  38. id_card_number: "", //身份证号码
  39. id_card_address: "", //身份证居住地址
  40. card_period_type: "1", // 1=定期 2=长期
  41. card_period_begin: "", //身份证有效期开始时间
  42. card_period_end: "", //身份证有效期结束时间
  43. },
  44. idDocInfo: { //非身份证国徽照片
  45. id_doc_copy_info: { //证件正面照片
  46. url: "",
  47. media_id: ""
  48. },
  49. id_doc_copy_back_info: { //证件反面照片 护照可不填
  50. url: "",
  51. media_id: ""
  52. },
  53. id_doc_name: "", //证件姓名
  54. id_doc_number: "", //证件号码
  55. id_doc_address: "", //证件居住地址
  56. doc_period_type: "1", //1=定期 2=长期
  57. doc_period_begin: "", //证件有效期开始时间
  58. doc_period_end: "" //证件有效期结束时间
  59. },
  60. licenseSite: "", //营业执照注册地址
  61. licenseEffectiveIdentityType: 1, ///身份证有效期类型
  62. licenseEffectiveBusiness: "", //执照生效日期
  63. licenseLoseBusiness: "", //执照失效日期
  64. licenseEffectiveIdentity: "", //身份证生效日期
  65. licenseLoseIdentity: "", //身份证失效日期
  66. picturesUrl: "", //营业执照
  67. identityZUrl: "",
  68. identityFUrl: "",
  69. owner: 1, //主体为企业时,必传,其他不传 1是 0否
  70. earningsindex: 1,
  71. earningsList: [{
  72. id: 0,
  73. name: "否"
  74. },
  75. {
  76. id: 1,
  77. name: "是"
  78. }
  79. ],
  80. uboInfoList: [{
  81. ubo_id_doc_index: "0",//类型下标
  82. ubo_id_doc_type: 1, //证件类型
  83. ubo_id_doc_copy_info: { //证件正面照片
  84. url: "",
  85. media_id: ""
  86. },
  87. ubo_id_doc_copy_back_info: { //证件反面照片(护照不传)
  88. url: "",
  89. media_id: ""
  90. },
  91. ubo_id_doc_name: "", //证件姓名
  92. ubo_id_doc_number: "", //证件号码
  93. ubo_id_doc_address: "", //证件地址
  94. doc_period_type: "1", //1=定期 2=长期
  95. ubo_period_begin: "", //证件有效期开始时间
  96. ubo_period_end: "" //证件有效期结束时间
  97. },],
  98. certificateLsit: [{
  99. id: 1,
  100. name: "中国大陆居民-身份证"
  101. },
  102. {
  103. id: 2,
  104. name: "其他国家或地区居民-护照"
  105. },
  106. {
  107. id: 3,
  108. name: "中国香港居民--来往内地通行证"
  109. },
  110. {
  111. id: 4,
  112. name: "中国澳门居民--来往内地通行证"
  113. },
  114. {
  115. id: 5,
  116. name: "中国台湾居民--来往内地通行证"
  117. },
  118. {
  119. id: 6,
  120. name: "外国人居留证"
  121. },
  122. {
  123. id: 7,
  124. name: "港澳居民证"
  125. },
  126. {
  127. id: 8,
  128. name: "台湾居民证"
  129. },
  130. ],
  131. // 激活图片预览
  132. active1: false,
  133. active2: false,
  134. active3: false
  135. },
  136. getReceiverApply() {
  137. wx.showLoading({
  138. title: '加载中...',
  139. })
  140. Http.get({
  141. url: config.api.getReceiverApply,
  142. data: {
  143. merchantId: app.globalData.merchant.merchant_id
  144. }
  145. }).then(res => {
  146. if (res.data && res.data.organizationType) {
  147. this.setData({
  148. organizationType: res.data.organizationType
  149. })
  150. }
  151. if (res.data && res.data.id) {
  152. this.setData({
  153. id: res.data.id
  154. })
  155. }
  156. if (res.data && res.data.owner || res.data.owner == 0) {
  157. let index1 = null
  158. this.data.earningsList.map((item, index) => {
  159. if (res.data.owner == item.id) {
  160. index1 = index
  161. }
  162. })
  163. console.log(index1)
  164. this.setData({
  165. owner: res.data.owner,
  166. earningsindex: index1
  167. })
  168. }
  169. if (res.data && res.data.idDocType) {
  170. this.setData({
  171. idDocType: res.data.idDocType
  172. })
  173. }
  174. if (res.data && res.data.businessLicenseInfo) {
  175. this.setData({
  176. businessLicenseInfo: JSON.parse(res.data.businessLicenseInfo)
  177. })
  178. }
  179. if (res.data && res.data.idDocType == 1 && res.data.idCardInfo) {
  180. this.setData({
  181. idCardInfo: JSON.parse(res.data.idCardInfo)
  182. })
  183. } else if (res.data && res.data.idDocInfo) {
  184. this.setData({
  185. idDocInfo: JSON.parse(res.data.idDocInfo)
  186. })
  187. }
  188. if (res.data.organizationType == 2 && res.data.uboInfoList && res.data.uboInfoList != "[]") {
  189. this.setData({
  190. uboInfoList: JSON.parse(res.data.uboInfoList)
  191. })
  192. }
  193. // parame = {
  194. // id: this.data.id,
  195. // organizationType: this.data.organizationType,
  196. // owner: this.data.owner,
  197. // idDocType: this.data.idDocType,
  198. // businessLicenseInfo: JSON.stringify(this.data.businessLicenseInfo),
  199. // // uboInfoList: JSON.stringify(this.data.uboInfoList),
  200. // }
  201. // if (this.data.idDocType == 1) {
  202. // parame.idCardInfo = JSON.stringify(this.data.idCardInfo)
  203. // } else {
  204. // parame.idDocInfo = JSON.stringify(this.data.idDocInfo)
  205. // }
  206. wx.hideLoading();
  207. }).catch(err => {
  208. wx.hideLoading();
  209. wx.showToast({
  210. title: err.message,
  211. icon: "none",
  212. duration: 2000
  213. })
  214. })
  215. },
  216. normalImage(e) {
  217. let type = e.currentTarget.dataset.type
  218. if (type == 1) {
  219. this.setData({
  220. active1: false
  221. })
  222. } else if (type == 2) {
  223. this.setData({
  224. active2: false
  225. })
  226. } else if (type == 3) {
  227. this.setData({
  228. active3: false
  229. })
  230. }
  231. console.log('normalImage');
  232. },
  233. previewImage(e) {
  234. let type = e.currentTarget.dataset.type
  235. if (type == 1) {
  236. this.setData({
  237. active1: true
  238. })
  239. } else if (type == 2) {
  240. this.setData({
  241. active2: true
  242. })
  243. } else if (type == 3) {
  244. this.setData({
  245. active3: true
  246. })
  247. }
  248. console.log('previewImage');
  249. },
  250. save(e) {
  251. let flag = e.currentTarget.dataset.flag
  252. let errMeg = "";
  253. let errFlag = false;
  254. if (!this.data.businessLicenseInfo.license_copy_info.url) {
  255. errMeg = '请上传营业执照'
  256. errFlag = true
  257. } else if (!this.data.businessLicenseInfo.license_number) {
  258. errMeg = '请填写注册号'
  259. errFlag = true
  260. } else if (!this.data.businessLicenseInfo.license_address) {
  261. errMeg = '请填写执照注册地址'
  262. errFlag = true
  263. } else if (!this.data.businessLicenseInfo.merchant_name) {
  264. errMeg = '请填写商户名称'
  265. errFlag = true
  266. } else if (!this.data.businessLicenseInfo.legal_person) {
  267. errMeg = '请填写经营者姓名'
  268. errFlag = true
  269. } else if (this.data.idDocType == 1) {
  270. if (!this.data.idCardInfo.id_card_copy_info.url) {
  271. errMeg = "请上传身份证正面照"
  272. errFlag = true
  273. } else if (!this.data.idCardInfo.id_card_national_info.url) {
  274. errMeg = "请上传身份证反面照"
  275. errFlag = true
  276. } else if (!this.data.idCardInfo.id_card_name) {
  277. errMeg = "请填写身份证姓名"
  278. errFlag = true
  279. } else if (!this.data.idCardInfo.id_card_number) {
  280. errMeg = "请填写身份证号码"
  281. errFlag = true
  282. } else if (!this.data.idCardInfo.id_card_address) {
  283. errMeg = "请填写身份证居住地址"
  284. errFlag = true
  285. }
  286. } else if (this.data.idDocType == 2) {
  287. if (!this.data.idDocInfo.id_doc_copy_info.url) {
  288. errMeg = "请上传证件正面照"
  289. errFlag = true
  290. } else if (!this.data.idDocInfo.id_doc_name) {
  291. errMeg = "请输入证件名称"
  292. errFlag = true
  293. } else if (!this.data.idDocInfo.id_doc_number) {
  294. errMeg = "请输入证件号码"
  295. errFlag = true
  296. } else if (!this.data.idDocInfo.id_doc_address) {
  297. errMeg = "请输入证件居住地"
  298. errFlag = true
  299. }
  300. } else {
  301. if (!this.data.idDocInfo.id_doc_copy_info.url) {
  302. errMeg = "请上传证件正面照"
  303. errFlag = true
  304. } else if (!this.data.idDocInfo.id_doc_copy_back_info.url) {
  305. errMeg = "请上传证件反面照"
  306. errFlag = true
  307. } else if (!this.data.idDocInfo.id_doc_name) {
  308. errMeg = "请输入证件名称"
  309. errFlag = true
  310. } else if (!this.data.idDocInfo.id_doc_number) {
  311. errMeg = "请输入证件号码"
  312. errFlag = true
  313. } else if (!this.data.idDocInfo.id_doc_address) {
  314. errMeg = "请输入证件居住地"
  315. errFlag = true
  316. }
  317. }
  318. if (this.data.owner == 0) {
  319. this.data.uboInfoList.map(item => {
  320. if (!item.ubo_id_doc_copy_info.url) {
  321. errMeg = "请上传受益人正面正件照"
  322. errFlag = true
  323. } else if (!item.ubo_id_doc_copy_back_info.url) {
  324. errMeg = "请上传受益人反面正件照"
  325. errFlag = true
  326. } else if (!item.ubo_id_doc_name) {
  327. errMeg = "请输入受益人证件姓名"
  328. errFlag = true
  329. } else if (!item.ubo_id_doc_number) {
  330. errMeg = "请输入受益人证件证件号码"
  331. errFlag = true
  332. } else if (!item.ubo_id_doc_address) {
  333. errMeg = "请输入受益人证件居住地"
  334. errFlag = true
  335. }
  336. })
  337. }
  338. if (errFlag) {
  339. wx.showToast({
  340. title: errMeg,
  341. icon: "none",
  342. duration: 2000
  343. })
  344. return
  345. }
  346. if (this.data.businessLicenseInfo.period_type == 2) {
  347. let tempBus = this.data.businessLicenseInfo
  348. tempBus.period_end = "长期"
  349. this.setData({
  350. businessLicenseInfo: tempBus
  351. })
  352. }
  353. if (this.data.idCardInfo.card_period_type == 2 && this.data.idDocType == 1) {
  354. let tempBus = this.data.idCardInfo
  355. tempBus.card_period_end = "长期"
  356. this.setData({
  357. idCardInfo: tempBus
  358. })
  359. }
  360. if (this.data.idDocInfo.doc_period_type == 2 && this.data.idDocType != 1) {
  361. let tempBus = this.data.idDocInfo
  362. tempBus.doc_period_end = "长期"
  363. this.setData({
  364. idDocInfo: tempBus
  365. })
  366. }
  367. if (this.data.owner == 0) {
  368. let tempBus = this.data.uboInfoList
  369. tempBus.map(item => {
  370. if (item.doc_period_type == 2) {
  371. item.ubo_period_end == "长期"
  372. }
  373. })
  374. this.setData({
  375. uboInfoList: tempBus
  376. })
  377. }
  378. let parame = "";
  379. if (this.data.organizationType == 4) {//个人
  380. parame = {
  381. id: this.data.id,
  382. organizationType: this.data.organizationType,
  383. owner: this.data.owner,
  384. idDocType: this.data.idDocType,
  385. businessLicenseInfo: JSON.stringify(this.data.businessLicenseInfo),
  386. // uboInfoList: JSON.stringify(this.data.uboInfoList),
  387. }
  388. if (this.data.idDocType == 1) {
  389. parame.idCardInfo = JSON.stringify(this.data.idCardInfo)
  390. } else {
  391. parame.idDocInfo = JSON.stringify(this.data.idDocInfo)
  392. }
  393. } else {//企业
  394. parame = {
  395. id: this.data.id,
  396. organizationType: this.data.organizationType,
  397. owner: this.data.owner,
  398. idDocType: this.data.idDocType,
  399. businessLicenseInfo: JSON.stringify(this.data.businessLicenseInfo),
  400. uboInfoList: JSON.stringify(this.data.uboInfoList),
  401. }
  402. if (this.data.idDocType == 1) {
  403. parame.idCardInfo = JSON.stringify(this.data.idCardInfo)
  404. } else {
  405. parame.idDocInfo = JSON.stringify(this.data.idDocInfo)
  406. }
  407. }
  408. console.log(parame, "parame")
  409. Http.post({
  410. url: config.api.receiverAdd,
  411. data: parame
  412. }).then(res => {
  413. console.log(res, "res")
  414. if (flag == "save") {
  415. wx.reLaunch({
  416. url: '/pages/warehouse/warehouse',
  417. })
  418. } else if (flag == "next") {
  419. wx.navigateTo({
  420. url: '/pages/warehouse/detail/manageFirm/manageFirm',
  421. })
  422. }
  423. }).catch(err => {
  424. wx.showToast({
  425. title: err.message,
  426. icon: "none",
  427. duration: 2000
  428. })
  429. })
  430. },
  431. setUboInfoListItem(e) {
  432. let value = e.detail.value
  433. let index = e.currentTarget.dataset.index
  434. let flag = e.currentTarget.dataset.flag
  435. let tempObj = this.data.uboInfoList
  436. tempObj[index][flag] = value
  437. this.setData({
  438. uboInfoList: tempObj
  439. })
  440. console.log(this.data.uboInfoList)
  441. },
  442. setCardName(e) {
  443. let value = e.detail.value.trim()
  444. let tempObj = this.data.idCardInfo
  445. tempObj.id_card_name = value
  446. this.setData({
  447. idCardInfo: tempObj
  448. })
  449. },
  450. setBocName(e) {
  451. let value = e.detail.value
  452. let tempObj = this.data.idDocInfo
  453. tempObj.id_doc_name = value
  454. this.setData({
  455. idDocInfo: tempObj
  456. })
  457. },
  458. setCardNum(e) {
  459. let value = e.detail.value.trim()
  460. let tempObj = this.data.idCardInfo
  461. tempObj.id_card_number = value
  462. this.setData({
  463. idCardInfo: tempObj
  464. })
  465. },
  466. setBocNum(e) {
  467. let value = e.detail.value
  468. let tempObj = this.data.idDocInfo
  469. tempObj.id_doc_number = value
  470. this.setData({
  471. idDocInfo: tempObj
  472. })
  473. },
  474. setCardAddress(e) {
  475. let value = e.detail.value.trim()
  476. let tempObj = this.data.idCardInfo
  477. tempObj.id_card_address = value
  478. this.setData({
  479. idCardInfo: tempObj
  480. })
  481. },
  482. setBocAddress(e) {
  483. let value = e.detail.value
  484. let tempObj = this.data.idDocInfo
  485. tempObj.id_doc_address = value
  486. this.setData({
  487. idDocInfo: tempObj
  488. })
  489. },
  490. setLicenserNum(e) {
  491. let value = e.detail.value.trim()
  492. let tempObj = this.data.businessLicenseInfo
  493. tempObj.license_number = value
  494. this.setData({
  495. businessLicenseInfo: tempObj
  496. })
  497. },
  498. setLicenseSite(e) {
  499. let value = e.detail.value.trim()
  500. let tempObj = this.data.businessLicenseInfo
  501. tempObj.license_address = value
  502. this.setData({
  503. businessLicenseInfo: tempObj
  504. })
  505. },
  506. setCommercialName(e) {
  507. let value = e.detail.value.trim()
  508. let tempObj = this.data.businessLicenseInfo
  509. tempObj.merchant_name = value
  510. this.setData({
  511. businessLicenseInfo: tempObj
  512. })
  513. },
  514. setManageName(e) {
  515. let value = e.detail.value.trim()
  516. let tempObj = this.data.businessLicenseInfo
  517. tempObj.legal_person = value
  518. this.setData({
  519. businessLicenseInfo: tempObj
  520. })
  521. },
  522. setPeriodType(e) {
  523. let value = e.currentTarget.dataset.index
  524. let tempObj = this.data.businessLicenseInfo
  525. tempObj.period_type = value
  526. this.setData({
  527. businessLicenseInfo: tempObj
  528. })
  529. },
  530. setlicenseEffectiveIdentityType(e) {
  531. let tempObj = this.data.idCardInfo
  532. let index = e.currentTarget.dataset.index
  533. tempObj.card_period_type = index
  534. this.setData({
  535. idCardInfo: tempObj
  536. })
  537. },
  538. setlicenseEffectiveIdentityTypeBoc(e) {
  539. let tempObj = this.data.idDocInfo
  540. let index = e.currentTarget.dataset.index
  541. tempObj.doc_period_type = index
  542. this.setData({
  543. idDocInfo: tempObj
  544. })
  545. },
  546. setlicenseEffectiveIdentityTypeS(e) {
  547. let index = e.currentTarget.dataset.index
  548. let id = e.currentTarget.dataset.id
  549. let tempObj = this.data.uboInfoList
  550. tempObj[index].doc_period_type = id
  551. this.setData({
  552. uboInfoList: tempObj
  553. })
  554. },
  555. bindDateChange1: function (e) {
  556. // this.setData({
  557. // licenseEffectiveBusiness: e.detail.value,
  558. // })
  559. let value = e.detail.value
  560. let tempObj = this.data.businessLicenseInfo
  561. tempObj.period_begin = value
  562. this.setData({
  563. businessLicenseInfo: tempObj
  564. })
  565. },
  566. bindDateChange2: function (e) {
  567. let value = e.detail.value
  568. let tempObj = this.data.businessLicenseInfo
  569. tempObj.period_end = value
  570. this.setData({
  571. businessLicenseInfo: tempObj
  572. })
  573. },
  574. bindDateChange3: function (e) {
  575. let id = this.data.certificateLsit[e.detail.value].id
  576. this.setData({
  577. certificateIndex: e.detail.value,
  578. idDocType: id
  579. })
  580. console.log(id)
  581. },
  582. bindDateChange4: function (e) {
  583. let tempObj = this.data.idCardInfo
  584. tempObj.card_period_begin = e.detail.value
  585. this.setData({
  586. idCardInfo: tempObj,
  587. })
  588. },
  589. bindDateChangeBoc4: function (e) {
  590. let tempObj = this.data.idDocInfo
  591. tempObj.doc_period_begin = e.detail.value
  592. this.setData({
  593. idDocInfo: tempObj,
  594. })
  595. },
  596. bindDateChange5: function (e) {
  597. let tempObj = this.data.idCardInfo
  598. tempObj.card_period_end = e.detail.value
  599. this.setData({
  600. idCardInfo: tempObj,
  601. })
  602. },
  603. bindDateChangeBoc5: function (e) {
  604. let tempObj = this.data.idDocInfo
  605. tempObj.doc_period_end = e.detail.value
  606. this.setData({
  607. idDocInfo: tempObj,
  608. })
  609. },
  610. bindDateChange6: function (e) {
  611. let id = this.data.earningsList[e.detail.value].id
  612. console.log(id)
  613. this.setData({
  614. earningsindex: e.detail.value,
  615. owner: id,
  616. })
  617. },
  618. beneficiaryCertificate(e) {
  619. let id = this.data.certificateLsit[e.detail.value].id
  620. let index = e.currentTarget.dataset.index;
  621. let tempArr = this.data.uboInfoList
  622. tempArr[index].ubo_id_doc_type = id
  623. tempArr[index].ubo_id_doc_index = e.detail.value
  624. this.setData({
  625. uboInfoList: tempArr,
  626. })
  627. console.log(this.data.uboInfoList)
  628. },
  629. upPictures() {
  630. let that = this;
  631. wx.chooseImage({
  632. success(res) {
  633. const tempFilePaths = res.tempFilePaths
  634. wx.uploadFile({
  635. url: config.api.merchantUpload, // 仅为示例,非真实的接口地址
  636. filePath: tempFilePaths[0],
  637. name: 'file',
  638. header: {
  639. 'token': app.globalData.token
  640. },
  641. success(res) {
  642. let tempObj = that.data.businessLicenseInfo
  643. tempObj.license_copy_info = JSON.parse(res.data).data
  644. that.setData({
  645. // picturesUrl: JSON.parse(res.data).data.url
  646. businessLicenseInfo: tempObj
  647. })
  648. console.log(that.data.businessLicenseInfo, "businessLicenseInfo")
  649. // do something
  650. },
  651. })
  652. }
  653. })
  654. },
  655. delPicturesUrl() {
  656. let tempObj = this.data.businessLicenseInfo
  657. tempObj.license_copy_info.url = ""
  658. this.setData({
  659. businessLicenseInfo: tempObj
  660. })
  661. },
  662. beneficiaryUpIdentityZ(e) {
  663. let that = this;
  664. let index = e.currentTarget.dataset.index
  665. let tempObj = that.data.uboInfoList
  666. wx.chooseImage({
  667. success(res) {
  668. const tempFilePaths = res.tempFilePaths
  669. wx.uploadFile({
  670. url: config.api.merchantUpload, // 仅为示例,非真实的接口地址
  671. filePath: tempFilePaths[0],
  672. name: 'file',
  673. header: {
  674. 'token': app.globalData.token
  675. },
  676. success(res) {
  677. tempObj[index].ubo_id_doc_copy_info = JSON.parse(res.data).data
  678. that.setData({
  679. // picturesUrl: JSON.parse(res.data).data.url
  680. uboInfoList: tempObj
  681. })
  682. console.log(that.data.owner, that.data.organizationType)
  683. // do something
  684. }
  685. })
  686. }
  687. })
  688. },
  689. beneficiaryUpIdentityF(e) {
  690. let that = this
  691. let index = e.currentTarget.dataset.index
  692. let tempObj = that.data.uboInfoList
  693. wx.chooseImage({
  694. success(res) {
  695. const tempFilePaths = res.tempFilePaths
  696. wx.uploadFile({
  697. url: config.api.merchantUpload, // 仅为示例,非真实的接口地址
  698. filePath: tempFilePaths[0],
  699. name: 'file',
  700. header: {
  701. 'token': app.globalData.token
  702. },
  703. success(res) {
  704. const data = res.data
  705. tempObj[index].ubo_id_doc_copy_back_info = JSON.parse(res.data).data
  706. that.setData({
  707. uboInfoList: tempObj
  708. })
  709. // do something
  710. }
  711. })
  712. }
  713. })
  714. },
  715. delIdentityZUrl() {
  716. let tempObj = this.data.idCardInfo
  717. tempObj.id_card_copy_info.url = "",
  718. this.setData({
  719. idCardInfo: tempObj,
  720. })
  721. },
  722. delIdentityZUrlRest() {
  723. let tempObj = this.data.idDocInfo
  724. tempObj.id_doc_copy_info.url = "",
  725. this.setData({
  726. idDocInfo: tempObj,
  727. })
  728. },
  729. upIdentityZ() { //身份证正面照片
  730. let that = this;
  731. let tempObj = that.data.idCardInfo
  732. wx.chooseImage({
  733. success(res) {
  734. const tempFilePaths = res.tempFilePaths
  735. wx.uploadFile({
  736. url: config.api.merchantUpload, // 仅为示例,非真实的接口地址
  737. filePath: tempFilePaths[0],
  738. name: 'file',
  739. header: {
  740. 'token': app.globalData.token
  741. },
  742. success(res) {
  743. const data = res.data
  744. tempObj.id_card_copy_info = JSON.parse(res.data).data
  745. that.setData({
  746. idCardInfo: tempObj
  747. })
  748. // do something
  749. }
  750. })
  751. }
  752. })
  753. },
  754. upIdentityZRest() { //身份证正面照片
  755. let that = this;
  756. let tempObj = that.data.idDocInfo
  757. wx.chooseImage({
  758. success(res) {
  759. const tempFilePaths = res.tempFilePaths
  760. wx.uploadFile({
  761. url: config.api.merchantUpload, // 仅为示例,非真实的接口地址
  762. filePath: tempFilePaths[0],
  763. name: 'file',
  764. header: {
  765. 'token': app.globalData.token
  766. },
  767. success(res) {
  768. const data = res.data
  769. tempObj.id_doc_copy_info = JSON.parse(res.data).data
  770. that.setData({
  771. idDocInfo: tempObj
  772. })
  773. // do something
  774. }
  775. })
  776. }
  777. })
  778. },
  779. delIdentityZUrlS(e) {
  780. let index = e.currentTarget.dataset.index
  781. let tempObj = this.data.uboInfoList
  782. tempObj[index].ubo_id_doc_copy_info.url = ""
  783. this.setData({
  784. uboInfoList: tempObj
  785. })
  786. },
  787. delIdentityFUrlS(e) {
  788. let index = e.currentTarget.dataset.index
  789. let tempObj = this.data.uboInfoList
  790. tempObj[index].ubo_id_doc_copy_back_info.url = ""
  791. this.setData({
  792. uboInfoList: tempObj
  793. })
  794. },
  795. delIdentityFUrl() {
  796. let tempObj = this.data.idCardInfo
  797. tempObj.id_card_national_info.url = "",
  798. this.setData({
  799. idCardInfo: tempObj,
  800. })
  801. },
  802. delIdentityFUrlRest() {
  803. let tempObj = this.data.idDocInfo
  804. tempObj.id_doc_copy_back_info.url = "",
  805. this.setData({
  806. idDocInfo: tempObj,
  807. })
  808. },
  809. upIdentityF() {
  810. let that = this;
  811. let tempObj = that.data.idCardInfo
  812. wx.chooseImage({
  813. success(res) {
  814. const tempFilePaths = res.tempFilePaths
  815. wx.uploadFile({
  816. url: config.api.merchantUpload, // 仅为示例,非真实的接口地址
  817. filePath: tempFilePaths[0],
  818. name: 'file',
  819. header: {
  820. 'token': app.globalData.token
  821. },
  822. success(res) {
  823. const data = res.data
  824. tempObj.id_card_national_info = JSON.parse(res.data).data
  825. that.setData({
  826. idCardInfo: tempObj
  827. })
  828. // do something
  829. }
  830. })
  831. }
  832. })
  833. },
  834. upIdentityFRest() {
  835. let that = this;
  836. let tempObj = that.data.idDocInfo
  837. wx.chooseImage({
  838. success(res) {
  839. const tempFilePaths = res.tempFilePaths
  840. wx.uploadFile({
  841. url: config.api.merchantUpload, // 仅为示例,非真实的接口地址
  842. filePath: tempFilePaths[0],
  843. name: 'file',
  844. header: {
  845. 'token': app.globalData.token
  846. },
  847. success(res) {
  848. const data = res.data
  849. tempObj.id_doc_copy_back_info = JSON.parse(res.data).data
  850. that.setData({
  851. idDocInfo: tempObj
  852. })
  853. // do something
  854. }
  855. })
  856. }
  857. })
  858. },
  859. /**
  860. * 生命周期函数--监听页面加载
  861. */
  862. onLoad: function (options) {
  863. this.getReceiverApply()
  864. let that = this;
  865. //获取完整的日期
  866. let date = new Date;
  867. let year = date.getFullYear();
  868. let month = date.getMonth() + 1;
  869. let day = date.getDate();
  870. let tempObj = that.data.businessLicenseInfo;
  871. let tempObjCard = that.data.idCardInfo;
  872. let tempObjBoc = that.data.idDocInfo;
  873. let tempObjUbo = that.data.uboInfoList;
  874. if (month < 10) {
  875. month = "0" + month
  876. }
  877. if (day < 10) {
  878. day = "0" + day
  879. }
  880. tempObj.period_begin = year + '-' + month + '-' + day
  881. tempObj.period_end = year + '-' + month + '-' + day
  882. tempObjCard.card_period_begin = year + '-' + month + '-' + day
  883. tempObjCard.card_period_end = year + '-' + month + '-' + day
  884. tempObjBoc.doc_period_begin = year + '-' + month + '-' + day
  885. tempObjBoc.doc_period_end = year + '-' + month + '-' + day
  886. tempObjUbo.map(item => {
  887. item.ubo_period_begin = year + '-' + month + '-' + day
  888. item.ubo_period_end = year + '-' + month + '-' + day
  889. })
  890. that.setData({
  891. // licenseEffectiveBusiness: year + '-' + month + '-' + day,
  892. licenseEffectiveIdentity: year + '-' + month + '-' + day,
  893. // licenseLoseBusiness: year + '-' + month + '-' + day,
  894. licenseLoseIdentity: year + '-' + month + '-' + day,
  895. businessLicenseInfo: tempObj,
  896. idCardInfo: tempObjCard,
  897. idDocInfo: tempObjBoc,
  898. uboInfoList: tempObjUbo
  899. })
  900. },
  901. /**
  902. * 生命周期函数--监听页面初次渲染完成
  903. */
  904. onReady: function () {
  905. },
  906. /**
  907. * 生命周期函数--监听页面显示
  908. */
  909. onShow: function () {
  910. },
  911. /**
  912. * 生命周期函数--监听页面隐藏
  913. */
  914. onHide: function () {
  915. },
  916. /**
  917. * 生命周期函数--监听页面卸载
  918. */
  919. onUnload: function () {
  920. },
  921. /**
  922. * 页面相关事件处理函数--监听用户下拉动作
  923. */
  924. onPullDownRefresh: function () {
  925. },
  926. /**
  927. * 页面上拉触底事件的处理函数
  928. */
  929. onReachBottom: function () {
  930. },
  931. /**
  932. * 用户点击右上角分享
  933. */
  934. onShareAppMessage: function () {
  935. }
  936. })