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.

342 lines
8.4 KiB

  1. var app = getApp();
  2. const config = require('../../config/config.js')
  3. const util = require('../../utils/util.js')
  4. const Http = require('../../utils/http.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. typeid: '1',
  18. tabTxt: [{
  19. title: '类型',
  20. idss: 2
  21. },
  22. {
  23. title: '日期',
  24. idss: 1
  25. },
  26. {
  27. title: '状态',
  28. idss: 3
  29. }
  30. ],
  31. showList: null,
  32. loading: "",
  33. tab: [true, true, true],
  34. disabled: false, //加载更多按钮状态
  35. page: 1, //当前页码
  36. hasMore: false, //加载更多按钮
  37. moreTxt: '点击加载更多',
  38. dataNull: true,
  39. date: null,
  40. date2: null,
  41. idss: 0,
  42. pageIndex: 2, //第几页
  43. height: null,
  44. billtypes: [{
  45. name: '租金',
  46. billTypeValue: '1',
  47. id: "1"
  48. },
  49. {
  50. name: '营业管理费',
  51. billTypeValue: '12',
  52. id: "12"
  53. },
  54. {
  55. name: '商业管理费',
  56. billTypeValue: '11',
  57. id: "11"
  58. },
  59. {
  60. name: '租赁押金',
  61. billTypeValue: '2',
  62. id: "2"
  63. },
  64. {
  65. name: '物业费',
  66. billTypeValue: '3',
  67. id: "3"
  68. },
  69. {
  70. name: '物业押金',
  71. billTypeValue: '4',
  72. id: "4"
  73. },
  74. {
  75. name: '水电空调费',
  76. billTypeValue: '5',
  77. id: "5"
  78. },
  79. {
  80. name: '其他费用',
  81. billTypeValue: '7',
  82. id: "7"
  83. },
  84. {
  85. name: '其他押金',
  86. billTypeValue: '8',
  87. id: "8"
  88. },
  89. {
  90. name: '结算单',
  91. billTypeValue: '10',
  92. id: "10"
  93. },
  94. ],
  95. statustypes: [{
  96. name: '未到期',
  97. status: "4",
  98. id: "4"
  99. },
  100. {
  101. name: '待缴',
  102. status: "2",
  103. id: '2'
  104. },
  105. {
  106. name: '欠缴',
  107. status: "1",
  108. id: "1"
  109. },
  110. {
  111. name: '待清算',
  112. status: "7",
  113. id: "7"
  114. },
  115. {
  116. name: '已结清',
  117. status: "3",
  118. id: "3"
  119. },
  120. ],
  121. starttime: null,
  122. endtime: null,
  123. billTypeValue: '1',
  124. status: null,
  125. allBillList: [],
  126. oweBillList: [],
  127. nearBillList: []
  128. },
  129. // 选项卡
  130. filterTab: function (e) {
  131. let that = this;
  132. console.log(e);
  133. that.setData({
  134. loading: ""
  135. })
  136. that.setData({
  137. idss: e.currentTarget.dataset.index,
  138. pageIndex: 2
  139. })
  140. var data = [true, true, true],
  141. index = e.currentTarget.dataset.index;
  142. /**
  143. * index == 0
  144. * 显示全部
  145. */
  146. if (index == 1) {
  147. data[index] = !that.data.tab[index];
  148. let date = new Date;
  149. let year = date.getFullYear();
  150. var month = '';
  151. if (date.getMonth() + 1 < 10) {
  152. var month = '0' + (date.getMonth() + 1);
  153. } else {
  154. var month = date.getMonth() + 1;
  155. }
  156. that.setData({
  157. date: year + '-' + month,
  158. date2: year + '-' + month,
  159. tab: data
  160. })
  161. } else {
  162. data[index] = !that.data.tab[index];
  163. that.setData({
  164. tab: data
  165. })
  166. }
  167. },
  168. bindDateChange1: function (e) {
  169. this.setData({
  170. date: e.detail.value,
  171. })
  172. },
  173. bindDateChange2: function (e) {
  174. this.setData({
  175. date2: e.detail.value
  176. })
  177. },
  178. search: function (e) {
  179. let that = this;
  180. let billTypeValue = e.target.dataset.billtypevalue;
  181. let status = e.target.dataset.status;
  182. if (billTypeValue) {
  183. this.setData({
  184. billTypeValue: e.target.dataset.billtypevalue ? e.target.dataset.billtypevalue : ''
  185. })
  186. }
  187. if (e.target.dataset.id) {
  188. that.setData({
  189. typeid: e.target.dataset.id
  190. })
  191. } else if (e.target.dataset.id1) {
  192. that.setData({
  193. typeid1: e.target.dataset.id1
  194. })
  195. }
  196. var data = [true, true, true],
  197. index = e.currentTarget.dataset.index;
  198. /**
  199. * 点击过查询
  200. */
  201. if (e.currentTarget.dataset.index == 'dateindex1') {
  202. data[index] = !that.data.tab[index];
  203. that.setData({
  204. tab: data,
  205. flagdate: "flagdate"
  206. });
  207. that.getList(that.data.date, that.data.date2, that.data.billTypeValue, status, 1);
  208. } else {
  209. data[index] = !that.data.tab[index];
  210. that.setData({
  211. tab: data
  212. });
  213. if (that.data.flagdate == 'flagdate') {
  214. that.getList(that.data.date, that.data.date2, that.data.billTypeValue, status, 1);
  215. } else {
  216. that.getList(null, null, that.data.billTypeValue, status, 1);
  217. }
  218. }
  219. },
  220. goUploading(e) {
  221. let item = e.currentTarget.dataset.data
  222. console.log(item)
  223. let id = e.currentTarget.dataset.id
  224. wx.navigateTo({
  225. url: `/pages/bill/voucher/voucher?id=${id}&billTypeValue=${this.data.billTypeValue}&newPrice=${item.needPay}`,
  226. })
  227. },
  228. /**
  229. * gotolook点击查看
  230. */
  231. gotolook: function (e) {
  232. var billTypeValue = e.currentTarget.dataset.data.billType;
  233. let billId = e.currentTarget.dataset.data.billId;
  234. wx.navigateTo({
  235. url: `/pages/bill/billdetail/index?billTypeValue=${billTypeValue}&billId=${billId}`,
  236. })
  237. },
  238. goPay(e) {
  239. var billTypeValue = e.currentTarget.dataset.data.billType;
  240. let billId = e.currentTarget.dataset.data.billId;
  241. wx.navigateTo({
  242. url: `/pages/bill/pay/index?billTypeValue=${billTypeValue}&billId=${billId}`,
  243. })
  244. },
  245. gotolook02(e) {
  246. console.log(e, 333)
  247. let receivePay = e.currentTarget.dataset.data.receivePay;
  248. let status = e.currentTarget.dataset.data.status;
  249. let id = e.currentTarget.dataset.data.id;
  250. var settle_number = e.currentTarget.dataset.data.settle_number;
  251. var billTypeValue = e.currentTarget.dataset.data.billTypeValue;
  252. var freeze = e.currentTarget.dataset.data.freeze;
  253. let owe = e.currentTarget.dataset.data.owe;
  254. let merchantId = e.currentTarget.dataset.data.merchantId
  255. wx.navigateTo({
  256. url: `/pages/bill/billdetail/index?receivePay=${receivePay}&status=${status}&id=${id}&settle_number=${settle_number}&billTypeValue=${billTypeValue}&freeze=${freeze}&owe=${owe}&merchantId=${merchantId}`,
  257. })
  258. },
  259. onShow() {
  260. let that = this;
  261. //获取完整的日期
  262. let date = new Date;
  263. let year = date.getFullYear();
  264. let month = date.getMonth() + 1;
  265. that.setData({
  266. pageIndex: 2,
  267. date: year + '-' + month,
  268. date2: year + '-' + month,
  269. })
  270. that.getList(null, null, that.data.billTypeValue, null, 1);
  271. // wx.showLoading({
  272. // title: '加载中...',
  273. // })
  274. setTimeout(function () {
  275. wx.hideLoading();
  276. }, 1500)
  277. },
  278. getList: function (starttime, endtime, billTypeValue, status, pageIndex) {
  279. let that = this;
  280. that.setData({
  281. starttime01: starttime || null,
  282. endtime01: endtime || null,
  283. billTypeValue01: billTypeValue || null,
  284. status01: status || null
  285. })
  286. Http.getRequest(config.api.notifyList, app.globalData.token, '', {}, (res) => {
  287. if (res.data && res.data && res.data.length >= 0) {
  288. res.data.map(file => {
  289. file.starttime = file.starttime ? util.formatTime(Number(file.starttime), "yyyy.MM.dd ") : '';
  290. file.endtime = file.starttime ? util.formatTime(Number(file.endtime), "yyyy.MM.dd ") : '';
  291. })
  292. that.setData({
  293. allBillList: res.data,
  294. })
  295. }
  296. })
  297. Http.getRequest(config.api.nearBillList, app.globalData.token, '', {}, (res) => {
  298. if (res.data && res.data && res.data.length >= 0) {
  299. res.data.map(file => {
  300. file.starttime = file.starttime ? util.formatTime(Number(file.starttime), "yyyy.MM.dd ") : '';
  301. file.endtime = file.starttime ? util.formatTime(Number(file.endtime), "yyyy.MM.dd ") : '';
  302. })
  303. that.setData({
  304. nearBillList: res.data,
  305. })
  306. }
  307. })
  308. Http.getRequest(config.api.oweBillList, app.globalData.token, '', {}, (res) => {
  309. if (res.data && res.data && res.data.length >= 0) {
  310. res.data.map(file => {
  311. file.starttime = file.starttime ? util.formatTime(Number(file.starttime), "yyyy.MM.dd ") : '';
  312. file.endtime = file.starttime ? util.formatTime(Number(file.endtime), "yyyy.MM.dd ") : '';
  313. })
  314. that.setData({
  315. oweBillList: res.data,
  316. })
  317. }
  318. })
  319. },
  320. gosearch() {
  321. wx.navigateTo({
  322. url: `/pages/bill/query/index`,
  323. })
  324. },
  325. onReachBottom() {
  326. let that = this;
  327. let pageIndex = that.data.pageIndex++;
  328. that.getList(that.data.starttime01, that.data.endtime01, that.data.billTypeValue01, that.data.status01, pageIndex);
  329. }
  330. });