選択できるのは25トピックまでです。 トピックは、先頭が英数字で、英数字とダッシュ('-')を使用した35文字以内のものにしてください。

567 行
14 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. billTypesObj: {
  8. name: '',
  9. id: ''
  10. },
  11. data: {
  12. list: []
  13. }, //数据
  14. crollTop: 0,
  15. scrollHeight: 0,
  16. house_type: 0, //户型
  17. house_style: 0, //风格
  18. house_area: 0, //面积
  19. flagdate: null,
  20. list: [],
  21. typeid: '1',
  22. tabTxt: [{
  23. title: '类型',
  24. idss: 2
  25. },
  26. {
  27. title: '日期',
  28. idss: 1
  29. },
  30. {
  31. title: '状态',
  32. idss: 3
  33. }
  34. ],
  35. showList: null,
  36. loading: "",
  37. tab: [true, true, true],
  38. disabled: false, //加载更多按钮状态
  39. page: 1, //当前页码
  40. hasMore: false, //加载更多按钮
  41. moreTxt: '点击加载更多',
  42. dataNull: true,
  43. date: null,
  44. date2: null,
  45. date3: null,
  46. date4: null,
  47. starttime: null,
  48. endtime: null,
  49. idss: 0,
  50. pageIndex: 2, //第几页
  51. height: null,
  52. billtypes: [{
  53. name: '租金',
  54. billTypeValue: '1',
  55. id: "1"
  56. },
  57. {
  58. name: '营业管理费',
  59. billTypeValue: '12',
  60. id: "12"
  61. },
  62. {
  63. name: '商业管理费',
  64. billTypeValue: '11',
  65. id: "11"
  66. },
  67. {
  68. name: '租赁押金',
  69. billTypeValue: '2',
  70. id: "2"
  71. },
  72. {
  73. name: '物业费',
  74. billTypeValue: '3',
  75. id: "3"
  76. },
  77. {
  78. name: '物业押金',
  79. billTypeValue: '4',
  80. id: "4"
  81. },
  82. {
  83. name: '水电空调费',
  84. billTypeValue: '5',
  85. id: "5"
  86. },
  87. {
  88. name: '其他费用',
  89. billTypeValue: '7',
  90. id: "7"
  91. },
  92. {
  93. name: '其他押金',
  94. billTypeValue: '8',
  95. id: "8"
  96. },
  97. {
  98. name: '结算单',
  99. billTypeValue: '10',
  100. id: "10"
  101. },
  102. ],
  103. statustypes: [{
  104. name: '未到期',
  105. status: "4",
  106. id: "4"
  107. },
  108. {
  109. name: '待缴',
  110. status: "2",
  111. id: '2'
  112. },
  113. {
  114. name: '欠缴',
  115. status: "1",
  116. id: "1"
  117. },
  118. {
  119. name: '待清算',
  120. status: "7",
  121. id: "7"
  122. },
  123. {
  124. name: '已结清',
  125. status: "3",
  126. id: "3"
  127. },
  128. ],
  129. starttime: null,
  130. endtime: null,
  131. billTypeValue: '1',
  132. status: null,
  133. allBillList: [],
  134. oweBillList: [],
  135. nearBillList: [],
  136. mallBillSum: {},
  137. mallRent: {},
  138. mallSales: {},
  139. billRemark: ''
  140. },
  141. // 选项卡
  142. filterTab: function (e) {
  143. let that = this;
  144. console.log(e);
  145. that.setData({
  146. loading: ""
  147. })
  148. that.setData({
  149. idss: e.currentTarget.dataset.index,
  150. pageIndex: 2
  151. })
  152. var data = [true, true, true],
  153. index = e.currentTarget.dataset.index;
  154. /**
  155. * index == 0
  156. * 显示全部
  157. */
  158. if (index == 1) {
  159. data[index] = !that.data.tab[index];
  160. let date = new Date;
  161. let year = date.getFullYear();
  162. var month = '';
  163. if (date.getMonth() + 1 < 10) {
  164. var month = '0' + (date.getMonth() + 1);
  165. } else {
  166. var month = date.getMonth() + 1;
  167. }
  168. that.setData({
  169. date: year + '-' + month,
  170. date2: year + '-' + month,
  171. tab: data
  172. })
  173. } else {
  174. data[index] = !that.data.tab[index];
  175. that.setData({
  176. tab: data
  177. })
  178. }
  179. },
  180. bindPickerChange: function (e) {
  181. this.setData({
  182. billTypesObj: this.data.billtypes[e.detail.value]
  183. })
  184. },
  185. bindDateChange1: function (e) {
  186. this.setData({
  187. date: e.detail.value,
  188. })
  189. this.getmallBillSum()
  190. },
  191. bindDateChange2: function (e) {
  192. this.setData({
  193. date2: e.detail.value
  194. })
  195. this.getmallBillSum()
  196. },
  197. bindDateChange3: function (e) {
  198. this.setData({
  199. date3: e.detail.value,
  200. })
  201. this.getmallSales()
  202. },
  203. bindDateChange4: function (e) {
  204. this.setData({
  205. date4: e.detail.value
  206. })
  207. this.getmallSales()
  208. },
  209. endtimeChange: function (e) {
  210. this.setData({
  211. endtime: e.detail.value,
  212. })
  213. },
  214. starttimeChange: function (e) {
  215. this.setData({
  216. starttime: e.detail.value
  217. })
  218. },
  219. search: function (e) {
  220. let that = this;
  221. let billTypeValue = e.target.dataset.billtypevalue;
  222. let status = e.target.dataset.status;
  223. if (billTypeValue) {
  224. this.setData({
  225. billTypeValue: e.target.dataset.billtypevalue ? e.target.dataset.billtypevalue : ''
  226. })
  227. }
  228. if (e.target.dataset.id) {
  229. that.setData({
  230. typeid: e.target.dataset.id
  231. })
  232. } else if (e.target.dataset.id1) {
  233. that.setData({
  234. typeid1: e.target.dataset.id1
  235. })
  236. }
  237. var data = [true, true, true],
  238. index = e.currentTarget.dataset.index;
  239. /**
  240. * 点击过查询
  241. */
  242. if (e.currentTarget.dataset.index == 'dateindex1') {
  243. data[index] = !that.data.tab[index];
  244. that.setData({
  245. tab: data,
  246. flagdate: "flagdate"
  247. });
  248. that.getList(that.data.date, that.data.date2, that.data.billTypeValue, status, 1);
  249. } else {
  250. data[index] = !that.data.tab[index];
  251. that.setData({
  252. tab: data
  253. });
  254. if (that.data.flagdate == 'flagdate') {
  255. that.getList(that.data.date, that.data.date2, that.data.billTypeValue, status, 1);
  256. } else {
  257. that.getList(null, null, that.data.billTypeValue, status, 1);
  258. }
  259. }
  260. },
  261. goUploading(e) {
  262. let item = e.currentTarget.dataset.data
  263. console.log(item)
  264. let id = e.currentTarget.dataset.id
  265. wx.navigateTo({
  266. url: `/pages/bill/voucher/voucher?id=${id}&billTypeValue=${this.data.billTypeValue}&newPrice=${item.needPay}`,
  267. })
  268. },
  269. /**
  270. * gotolook点击查看
  271. */
  272. gotolook: function (e) {
  273. var billTypeValue = e.currentTarget.dataset.data.billType;
  274. let billId = e.currentTarget.dataset.data.billId;
  275. wx.navigateTo({
  276. url: `/pages/bill/billdetail/index?billTypeValue=${billTypeValue}&billId=${billId}&flag=mall`,
  277. })
  278. },
  279. gotoDetail: function (e) {
  280. var name = e.currentTarget.dataset.name;
  281. let scale = e.currentTarget.dataset.scale;
  282. wx.navigateTo({
  283. url: `/pages/bill/querySg/index?name=${name}&scale=${scale}`,
  284. })
  285. },
  286. gotoDetailDate: function (e) {
  287. wx.navigateTo({
  288. url: `/pages/bill/querySg/index?date=${this.data.date}&date2=${this.data.date2}`,
  289. })
  290. },
  291. goPay(e) {
  292. var billTypeValue = e.currentTarget.dataset.data.billType;
  293. let billId = e.currentTarget.dataset.data.billId;
  294. wx.navigateTo({
  295. url: `/pages/bill/pay/index?billTypeValue=${billTypeValue}&billId=${billId}`,
  296. })
  297. },
  298. gotolook02(e) {
  299. console.log(e, 333)
  300. let receivePay = e.currentTarget.dataset.data.receivePay;
  301. let status = e.currentTarget.dataset.data.status;
  302. let id = e.currentTarget.dataset.data.id;
  303. var settle_number = e.currentTarget.dataset.data.settle_number;
  304. var billTypeValue = e.currentTarget.dataset.data.billTypeValue;
  305. var freeze = e.currentTarget.dataset.data.freeze;
  306. let owe = e.currentTarget.dataset.data.owe;
  307. let merchantId = e.currentTarget.dataset.data.merchantId
  308. wx.navigateTo({
  309. url: `/pages/bill/billdetail/index?receivePay=${receivePay}&status=${status}&id=${id}&settle_number=${settle_number}&billTypeValue=${billTypeValue}&freeze=${freeze}&owe=${owe}&merchantId=${merchantId}`,
  310. })
  311. },
  312. onShow() {
  313. let that = this;
  314. //获取完整的日期
  315. let date = new Date;
  316. let year = date.getFullYear();
  317. let month = date.getMonth() + 1;
  318. let day = date.getDay();
  319. that.setData({
  320. pageIndex: 2,
  321. date: year + '-' + month + '-' + '1',
  322. date2: year + '-' + month + '-' + day,
  323. date3: year + '-' + month + '-' + '1',
  324. date4: year + '-' + month + '-' + day,
  325. starttime: year + '-' + month + '-' + day,
  326. endtime: year + '-' + month + '-' + day,
  327. })
  328. that.getList(null, null, that.data.billTypeValue, null, 1);
  329. // wx.showLoading({
  330. // title: '加载中...',
  331. // })
  332. setTimeout(function () {
  333. wx.hideLoading();
  334. }, 1500)
  335. },
  336. getmallBillSum() {
  337. Http.getRequest(config.api.mallBillSum, app.globalData.token, '', {
  338. startTime: this.data.date,
  339. endTime: this.data.date2
  340. }, (res) => {
  341. if (res.data && res.data) {
  342. this.setData({
  343. mallBillSum: res.data,
  344. })
  345. }
  346. })
  347. },
  348. getmallSales() {
  349. Http.getRequest(config.api.mallSales, app.globalData.token, '', {
  350. startTime: this.data.date3,
  351. endTime: this.data.date4
  352. }, (res) => {
  353. if (res.data && res.data) {
  354. this.setData({
  355. mallSales: res.data,
  356. })
  357. }
  358. })
  359. },
  360. getList: function (starttime, endtime, billTypeValue, status, pageIndex) {
  361. let that = this;
  362. that.setData({
  363. starttime01: starttime || null,
  364. endtime01: endtime || null,
  365. billTypeValue01: billTypeValue || null,
  366. status01: status || null
  367. })
  368. Http.getRequest(config.api.menus, app.globalData.token, '', {}, (res) => {
  369. if (res.data && res.data) {
  370. let m = []
  371. res.data.forEach(ele => {
  372. m.push(ele.permissionId)
  373. });
  374. that.setData({
  375. menus: m,
  376. })
  377. }
  378. })
  379. Http.getRequest(config.api.mallNotifyList, app.globalData.token, '', {}, (res) => {
  380. if (res.data && res.data && res.data.length >= 0) {
  381. res.data.map(file => {
  382. file.starttime = file.starttime ? util.formatTime(Number(file.starttime), "yyyy.MM.dd ") : '';
  383. file.endtime = file.starttime ? util.formatTime(Number(file.endtime), "yyyy.MM.dd ") : '';
  384. })
  385. that.setData({
  386. allBillList: res.data,
  387. })
  388. }
  389. })
  390. Http.getRequest(config.api.mallNearBillHot, app.globalData.token, '', {}, (res) => {
  391. if (res.data && res.data && res.data.length >= 0) {
  392. res.data.map(file => {
  393. file.minBeginTime = file.minBeginTime ? util.formatTime(Number(file.minBeginTime), "yyyy.MM.dd ") : '';
  394. })
  395. that.setData({
  396. nearBillList: res.data,
  397. })
  398. }
  399. })
  400. Http.getRequest(config.api.mallOweBillHot, app.globalData.token, '', {}, (res) => {
  401. if (res.data && res.data && res.data.length >= 0) {
  402. res.data.map(file => {
  403. file.minBeginTime = file.minBeginTime ? util.formatTime(Number(file.minBeginTime), "yyyy.MM.dd ") : '';
  404. })
  405. that.setData({
  406. oweBillList: res.data,
  407. })
  408. }
  409. })
  410. this.getmallBillSum()
  411. Http.getRequest(config.api.mallRent, app.globalData.token, '', {}, (res) => {
  412. if (res.data && res.data) {
  413. res.data.notRentTotalRate = (100 - res.data.rentTotalRate).toFixed(2)
  414. that.setData({
  415. mallRent: res.data,
  416. })
  417. }
  418. })
  419. this.getmallSales()
  420. Http.getRequest(config.api.mallBillDailyTypes, app.globalData.token, '', {}, (res) => {
  421. // let arr = []
  422. // for (let key in res.data) {
  423. // let val = res.data[key];
  424. // arr.push({id: key, name: val})
  425. // }
  426. this.setData({
  427. billTypes: res.data
  428. })
  429. })
  430. },
  431. inputauditRemark(e) {
  432. this.setData({
  433. billRemark: e.detail.value
  434. })
  435. },
  436. confirm() {
  437. Http.postRequest(config.api.billDailyAdd, app.globalData.token, '', {
  438. type: this.data.billTypesObj.id,
  439. starttime: this.data.starttime + ' 00:00:00',
  440. endtime: this.data.endtime + ' 23:59:59',
  441. billRemark: this.data.billRemark
  442. }, (res) => {
  443. // let arr = []
  444. // for (let key in res.data) {
  445. // let val = res.data[key];
  446. // arr.push({id: key, name: val})
  447. // }
  448. this.setData({
  449. billTypes: res.data
  450. })
  451. })
  452. },
  453. gosearch() {
  454. wx.navigateTo({
  455. url: `/pages/bill/querySg/index`,
  456. })
  457. },
  458. goAdd() {
  459. wx.navigateTo({
  460. url: `/pages/bill/meter/meter`,
  461. })
  462. },
  463. onReachBottom() {
  464. let that = this;
  465. let pageIndex = that.data.pageIndex++;
  466. that.getList(that.data.starttime01, that.data.endtime01, that.data.billTypeValue01, that.data.status01, pageIndex);
  467. }
  468. });
  469. // const config = require('../../config/config.js')
  470. // const extConfig = wx.getExtConfigSync ? wx.getExtConfigSync() : {}
  471. // let weappId = extConfig.weappId;
  472. // Page({
  473. // /**
  474. // * 页面的初始数据
  475. // */
  476. // data: {
  477. // src: config.weapp.dataTowerUrl
  478. // },
  479. // /**
  480. // * 生命周期函数--监听页面加载
  481. // */
  482. // onLoad: function(options) {
  483. // console.log(options);
  484. // this.setData({
  485. // openId: options.superopenId,
  486. // phone: options.phone,
  487. // weappId: weappId ? weappId : "wx9ff823abeef23b94"
  488. // })
  489. // },
  490. // /**
  491. // * 生命周期函数--监听页面初次渲染完成
  492. // */
  493. // onReady: function() {
  494. // },
  495. // /**
  496. // * 生命周期函数--监听页面显示
  497. // */
  498. // onShow: function() {
  499. // console.log(`${this.data.src}/#/home?openId=${this.data.openId}&phone=${this.data.phone}&from=xiaochengxu&tenantId=${this.data.weappId}`)
  500. // },
  501. // /**
  502. // * 生命周期函数--监听页面隐藏
  503. // */
  504. // onHide: function() {
  505. // },
  506. // /**
  507. // * 生命周期函数--监听页面卸载
  508. // */
  509. // onUnload: function() {
  510. // },
  511. // /**
  512. // * 页面相关事件处理函数--监听用户下拉动作
  513. // */
  514. // onPullDownRefresh: function() {
  515. // },
  516. // /**
  517. // * 页面上拉触底事件的处理函数
  518. // */
  519. // onReachBottom: function() {
  520. // },
  521. // /**
  522. // * 用户点击右上角分享
  523. // */
  524. // onShareAppMessage: function(res) {
  525. // let _this = this;
  526. // return {
  527. // title: '商管操作台',
  528. // path: 'pages/index/index',
  529. // success: function(res) {
  530. // // 转发成功
  531. // },
  532. // fail: function(res) {
  533. // // 转发失败
  534. // }
  535. // }
  536. // },
  537. // })