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.

336 lines
8.1 KiB

  1. var app = getApp();
  2. const config = require('../../config/config.js')
  3. const util = require('../../utils/util.js')
  4. const Http = require('../../utils/HttpBasics.js')
  5. Page({
  6. data: {
  7. data: {
  8. list: []
  9. }, //数据
  10. crollTop: 0,
  11. scrollHeight: 0,
  12. house_type: 0, //户型
  13. house_style: 0, //风格
  14. house_area: 0, //面积
  15. flagdate: null,
  16. list: [],
  17. tabTxt: [{
  18. title: '全部',
  19. idss: 0
  20. },
  21. {
  22. title: '日期',
  23. idss: 1
  24. },
  25. // {
  26. // title: '类型',
  27. // idss: 2
  28. // },
  29. {
  30. title: '状态',
  31. idss: 3
  32. },
  33. // {
  34. // title: '来源',
  35. // idss: 4
  36. // }
  37. ],
  38. showList: null,
  39. loading: "",
  40. tab: [true, true, true, true, true],
  41. disabled: false, //加载更多按钮状态
  42. page: 1, //当前页码
  43. hasMore: false, //加载更多按钮
  44. moreTxt: '点击加载更多',
  45. dataNull: true,
  46. status: '',
  47. type: '',
  48. source: '',
  49. date: "",
  50. date2: "",
  51. idss: 0,
  52. subsidy: '',
  53. pageNum: 1, //第几页
  54. height: null,
  55. statustypes: [
  56. {
  57. name: '审核中',
  58. status: 0,
  59. id: 0
  60. },
  61. {
  62. name: '审核通过',
  63. status: 1,
  64. id: 1
  65. },
  66. {
  67. name: '审核驳回',
  68. status: 2,
  69. id:2
  70. },
  71. {
  72. name: '已退单',
  73. status: 3,
  74. id:3
  75. }
  76. ],
  77. starttime: null,
  78. endtime: null,
  79. billTypeValue: null,
  80. paramData: null,
  81. topData: null
  82. },
  83. /**
  84. * 生命周期函数--监听页面加载
  85. */
  86. onLoad: function (options) {
  87. this.setData({
  88. paramData:options
  89. });
  90. },
  91. // 选项卡
  92. filterTab: function (e) {
  93. let that = this;
  94. console.log(e);
  95. that.setData({
  96. loading: ""
  97. })
  98. that.setData({
  99. idss: e.target.dataset.idss || e.currentTarget.dataset.idss,
  100. pageNum: 1
  101. })
  102. if (e.currentTarget.dataset.idss === 0) {
  103. this.setData({
  104. source: '',
  105. type: '',
  106. status: '',
  107. date: '',
  108. date2: ''
  109. })
  110. this.getList(1)
  111. this.getTotleData()
  112. }
  113. var data = [true, true, true, true, true],
  114. index = e.currentTarget.dataset.index;
  115. data[index] = !that.data.tab[index];
  116. that.setData({
  117. tab: data
  118. })
  119. },
  120. bindDateChange1: function (e) {
  121. if (new Date(e.detail.value).getTime() > new Date(this.data.date2).getTime()) {
  122. wx.showToast({
  123. title: '抱歉,开始日期不能大于结束日期',
  124. icon: 'none',
  125. duration: 2000,
  126. mask: false
  127. });
  128. return;
  129. }
  130. this.setData({
  131. date: e.detail.value,
  132. })
  133. },
  134. bindDateChange2: function (e) {
  135. if (new Date(e.detail.value).getTime() < new Date(this.data.date).getTime()) {
  136. wx.showToast({
  137. title: '抱歉,结束日期不能小于开始日期',
  138. icon: 'none',
  139. duration: 2000,
  140. mask: false
  141. });
  142. return;
  143. }
  144. this.setData({
  145. date2: e.detail.value
  146. })
  147. },
  148. search(e) {
  149. console.log(e.currentTarget.dataset.ids)
  150. let type = e.currentTarget.dataset.ids;
  151. if (type == 0) {
  152. this.setData({
  153. source: '',
  154. type: '',
  155. status: '',
  156. date: '',
  157. date2: ''
  158. })
  159. } else if (type == 1) {
  160. if (!this.data.date) {
  161. wx.showToast({
  162. title: '抱歉请选择开始日期',
  163. icon: 'none',
  164. duration: 2000,
  165. mask: false
  166. });
  167. return;
  168. } else if (!this.data.date2) {
  169. wx.showToast({
  170. title: '抱歉请选择结束日期',
  171. icon: 'none',
  172. duration: 2000,
  173. mask: false
  174. });
  175. return;
  176. }
  177. } else if (type == 2) {
  178. this.setData({
  179. type: e.currentTarget.dataset.id
  180. })
  181. } else if (type == 3) {
  182. console.log(e.currentTarget.dataset.id)
  183. this.setData({
  184. status: e.currentTarget.dataset.id
  185. })
  186. } else if (type == 4) {
  187. this.setData({
  188. source: e.currentTarget.dataset.id
  189. })
  190. }
  191. var data = [true, true, true, true, true];
  192. this.setData({
  193. tab: data
  194. })
  195. this.getList(1)
  196. this.getTotleData()
  197. },
  198. onShow() {
  199. this.getList(1)
  200. this.getTotleData()
  201. },
  202. formatData(data) {
  203. let arr = [];
  204. data.map((item, index) => {
  205. let a = {};
  206. a.value = [item];
  207. a.dateR = item.createDate01;
  208. let indexSt = 0;
  209. let haveIf = false;
  210. console.log(item, this.data.auditWayOptions, 1111)
  211. console.log(item.sourceStr, item.typeStr, item.statusStr, 222)
  212. arr.map((item01, index01) => {
  213. if (item.id == item01.id) {
  214. indexSt = index01;
  215. haveIf = true;
  216. }
  217. })
  218. if (haveIf && (new Date(item.createDate)).valueOf() >= (new Date(this.data.date + ' 00:00:00')).valueOf() && (new Date(item.createDate)).valueOf() <= (new Date(this.data.date2 + ' 23:59:59')).valueOf()) {
  219. arr[indexSt].value.push(item)
  220. } else if ((new Date(item.createDate)).valueOf() >= (new Date(this.data.date + ' 00:00:00')).valueOf() && (new Date(item.createDate)).valueOf() <= (new Date(this.data.date2 + ' 23:59:59')).valueOf()) {
  221. arr.push(a)
  222. }
  223. })
  224. this.setData({
  225. allBillList: arr
  226. })
  227. console.log(arr, 888888888888)
  228. },
  229. getTotleData() {
  230. let _this = this;
  231. Http.get({
  232. url: config.api.fflineRecordStatistics,
  233. data: {
  234. createDateBegin: this.data.date ? this.data.date + " 00:00:00" : '',
  235. createDateEnd: this.data.date2 ? this.data.date2 + " 23:59:59" : '',
  236. auditStatus: this.data.status,
  237. }
  238. })
  239. .then(res => {
  240. _this.setData({
  241. topData: res.data
  242. })
  243. wx.stopPullDownRefresh();
  244. })
  245. .catch(err => {
  246. wx.stopPullDownRefresh();
  247. wx.showToast({
  248. title: err.message,
  249. icon: 'none',
  250. duration: 2000,
  251. mask: false
  252. });
  253. });
  254. },
  255. getList: function (page) {
  256. let _this = this;
  257. Http.get({
  258. url: config.api.offlineRecordList,
  259. data: {
  260. pageNum: page,
  261. pageSize: 10,
  262. createDateBegin: this.data.date ? this.data.date + " 00:00:00" : '',
  263. createDateEnd: this.data.date2 ? this.data.date2 + " 23:59:59" : '',
  264. auditStatus: this.data.status
  265. }
  266. })
  267. .then(res => {
  268. wx.stopPullDownRefresh();
  269. let data = res.data.list;
  270. let allBillList = [];
  271. if (page == 1) {
  272. allBillList = res.data.list;
  273. } else {
  274. allBillList = _this.data.allBillList;
  275. }
  276. allBillList.map((item, index) => {
  277. let haveIf = false;
  278. item.startDate = util.formatTime(item.createDate, 'yyyy-MM-dddd hh:mm:ss')
  279. item.statusStr = this.data.statustypes.find(e => e.status === item.auditStatus)?.name
  280. })
  281. if (res.data.pages <= page) {
  282. _this.setData({
  283. allBillList,
  284. pageNum: res.data.pages - 1,
  285. content: '已经加载全部数据!'
  286. })
  287. } else {
  288. _this.setData({
  289. allBillList,
  290. loading: false,
  291. content: '小主,我在玩命加载中...'
  292. })
  293. }
  294. })
  295. .catch(err => {
  296. wx.stopPullDownRefresh();
  297. wx.showToast({
  298. title: err.message,
  299. icon: 'none',
  300. duration: 2000,
  301. mask: false
  302. });
  303. });
  304. },
  305. onPullDownRefresh: function (e) {
  306. let that = this;
  307. that.setData({
  308. pageNum: 1,
  309. list: []
  310. });
  311. that.getList(1);
  312. this.getTotleData()
  313. },
  314. onReachBottom() {
  315. var that = this;
  316. that.data.pageNum++;
  317. that.setData({
  318. pageNum: that.data.pageNum,
  319. loading: true
  320. });
  321. that.getList(that.data.pageNum);
  322. this.getTotleData()
  323. },
  324. viewDetail(e) {
  325. let id = e.currentTarget.dataset.id
  326. let flag = e.currentTarget.dataset.flag
  327. wx.navigateTo({
  328. url: `/pages/activityCashDetails/activityCashDetails?id=${id}&auditStatus=${flag}`,
  329. })
  330. },
  331. submit() {
  332. wx.navigateTo({
  333. url: `/pages/activityCashDetails/activityCashDetails?tag=add&activityId=${this.data.paramData.id}`,
  334. })
  335. }
  336. });