index.js 2.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172
  1. let _Http = getApp().globalData.http;
  2. Component({
  3. properties: {
  4. callback: {
  5. type: Function
  6. },
  7. queryClient: {
  8. type: Function
  9. }
  10. },
  11. data: {
  12. queryShow: false,
  13. },
  14. methods: {
  15. /* 引入 */
  16. introduce(e) {
  17. let {
  18. item
  19. } = e.currentTarget.dataset,
  20. that = this;
  21. wx.showModal({
  22. title: '提示',
  23. content: `是否确定引入“${item.companyName}”信息`,
  24. complete: (res) => {
  25. if (res.confirm) {
  26. that.setData({
  27. queryShow: false,
  28. queryList: null
  29. })
  30. that.triggerEvent("callback", item)
  31. }
  32. }
  33. })
  34. },
  35. /* 工商查询 */
  36. queryClient(enterprisename) {
  37. _Http.basic({
  38. id: 20221208103601,
  39. content: {
  40. pageNumber: 1,
  41. pageTotal: 1,
  42. pageSize: 5,
  43. keyword: enterprisename,
  44. }
  45. }).then(res => {
  46. console.log("工商查询", res)
  47. if (!res.data[0]) return wx.showToast({
  48. title: '未查询到相关企业!',
  49. icon: "none"
  50. });
  51. this.setData({
  52. queryList: res.data.map(v => {
  53. for (const key in v) {
  54. if (v[key] == "-") v[key] = ''
  55. }
  56. return v
  57. }),
  58. queryShow: true
  59. })
  60. })
  61. },
  62. openQuery() {
  63. this.triggerEvent("queryClient")
  64. },
  65. onClose() {
  66. this.setData({
  67. queryShow: false
  68. })
  69. },
  70. }
  71. })