ndpjjgcx.js 4.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207
  1. // pages/minePages/ndpjjgcx/ndpjjgcx.js
  2. import {
  3. xcxGetCompanyList,
  4. } from "../../../apis/index"
  5. import {
  6. annualEvaluationResults,
  7. } from "../../../apis/smzc"
  8. Page({
  9. /**
  10. * 页面的初始数据
  11. */
  12. data: {
  13. enterpriceTypeShow: false,
  14. enterPriceList: [],
  15. enterPrice: {},
  16. startDate: "",
  17. endDate: "",
  18. resultList: []
  19. },
  20. /**
  21. * 生命周期函数--监听页面加载
  22. */
  23. onLoad(options) {
  24. let that = this
  25. that.init()
  26. },
  27. init() {
  28. let that = this
  29. let date = new Date()
  30. let y = date.getFullYear()
  31. let m = date.getMonth() + 1
  32. m = m < 10 ? '0' + m : m
  33. let d = date.getDate()
  34. d = d < 10 ? '0' + d : d
  35. let start = `${y-1}`
  36. let end = `${y}`
  37. that.setData({
  38. startDate: start,
  39. endDate: end
  40. })
  41. that.cx()
  42. },
  43. selectEnterprice() {
  44. let that = this
  45. wx.showLoading({
  46. title: '正在获取企业信息',
  47. })
  48. that.setData({
  49. enterpriceTypeShow: true
  50. })
  51. xcxGetCompanyList({
  52. xm: wx.getStorageSync('USERINFO').name,
  53. sfzjhm: wx.getStorageSync('USERINFO').idcard
  54. }).then(res => {
  55. wx.hideLoading()
  56. if (res.code == 200) {
  57. that.setData({
  58. enterPriceList: res.list
  59. })
  60. } else {
  61. wx.showToast({
  62. title: res.msg || res.message,
  63. icon: "none",
  64. duration: 5000
  65. })
  66. }
  67. })
  68. },
  69. selectedEnterprice(e) {
  70. let that = this
  71. let item = e.currentTarget.dataset.item
  72. that.setData({
  73. enterpriceTypeShow: false,
  74. enterPrice: item
  75. })
  76. that.cx()
  77. },
  78. close() {
  79. let that = this
  80. that.setData({
  81. enterpriceTypeShow: false
  82. })
  83. },
  84. seleDate(e) {
  85. let that = this
  86. let type = e.currentTarget.dataset.type
  87. if (type == 0) {
  88. that.setData({
  89. startDate: e.detail.value
  90. })
  91. } else if (type == 1) {
  92. that.setData({
  93. endDate: e.detail.value
  94. })
  95. }
  96. that.cx()
  97. },
  98. async cx() {
  99. let that = this
  100. let enterprice = that.data.enterPrice
  101. if (enterprice.djxh) {
  102. let s = that.data.startDate.split('-')[0]
  103. let e = that.data.endDate.split('-')[0]
  104. let num = e - s
  105. that.setData({
  106. resultList: []
  107. })
  108. for (let i = 0; i < num + 1; i++) {
  109. await that.getResult(Number(s) + i)
  110. }
  111. }
  112. },
  113. getResult(e) {
  114. return new Promise((resolve, reject) => {
  115. wx.showLoading({
  116. title: '正在查询...',
  117. })
  118. let that = this
  119. let resultList = that.data.resultList
  120. let form = {
  121. annReqVO: {
  122. djxh: that.data.enterPrice.djxh,
  123. pjnd: String(e)
  124. },
  125. headVo: {
  126. jqbh: null,
  127. sjjg: "16109970500",
  128. sjry: "96109970015",
  129. }
  130. }
  131. annualEvaluationResults(form).then(res => {
  132. wx.hideLoading()
  133. if (res.code == 200) {
  134. resultList = [...resultList, res.data]
  135. that.setData({
  136. resultList: resultList
  137. })
  138. } else {
  139. wx.showToast({
  140. title: res.msg || res.message,
  141. icon: "none",
  142. duration: 3000
  143. })
  144. }
  145. resolve(true)
  146. })
  147. })
  148. },
  149. /**
  150. * 生命周期函数--监听页面初次渲染完成
  151. */
  152. onReady() {
  153. },
  154. /**
  155. * 生命周期函数--监听页面显示
  156. */
  157. onShow() {
  158. },
  159. /**
  160. * 生命周期函数--监听页面隐藏
  161. */
  162. onHide() {
  163. },
  164. /**
  165. * 生命周期函数--监听页面卸载
  166. */
  167. onUnload() {
  168. },
  169. /**
  170. * 页面相关事件处理函数--监听用户下拉动作
  171. */
  172. onPullDownRefresh() {
  173. },
  174. /**
  175. * 页面上拉触底事件的处理函数
  176. */
  177. onReachBottom() {
  178. },
  179. /**
  180. * 用户点击右上角分享
  181. */
  182. onShareAppMessage() {
  183. }
  184. })