抖音b端
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.

107 lines
2.4 KiB

  1. // c:\Users\Holy-Knight-IX\Desktop\Working Space\4.TikTok-MiniPro\ttb\pages\Appointment\appointment\appointment.js
  2. const config = require('../../config/config.js')
  3. const Http = require('../../utils/http.js')
  4. const HttpBasics = require('../../utils/HttpBasics.js')
  5. const util = require('../../utils/util')
  6. var app = getApp()
  7. Page({
  8. data: {
  9. currentID: "",
  10. pickedTime: "",
  11. startTime: "开始时间",
  12. endTime: "结束时间",
  13. pageNum: 1,
  14. status: 0,
  15. list: []
  16. },
  17. onLoad(options) {
  18. this.getList()
  19. },
  20. getList(status, startTime, endTime) {
  21. const that = this
  22. const data = {
  23. pageNum: this.data.pageNum,
  24. pageSize: 20,
  25. }
  26. if (startTime && endTime) {
  27. data.serchStartDate = startTime
  28. data.serchEndDate = endTime
  29. }
  30. if (status) {
  31. data.status = status
  32. }
  33. HttpBasics.get({
  34. url: config.api.appointmentList,
  35. data
  36. })
  37. .then(res => {
  38. console.log(res, 'res');
  39. res.data.list.forEach(item => {
  40. const appointStart = util.timestampToTime(item.startDate, 'YYYY-MM-DD hh:mm:ss')
  41. const appointEnd = util.timestampToTime(item.endDate, 'hh:mm:ss')
  42. item.appointTime = appointStart + ' - ' + appointEnd
  43. })
  44. that.setData({
  45. list: res.data.list,
  46. })
  47. }).catch(err => {
  48. console.log(err, 'err');
  49. })
  50. },
  51. setNav(e) {
  52. const id = e.currentTarget.dataset.id
  53. this.setData({
  54. currentID: id == this.data.currentID ? '' : id
  55. })
  56. console.log(this.data.currentID, 'currentID');
  57. },
  58. setType(e) {
  59. const type = e.currentTarget.dataset.type * 1
  60. this.setData({
  61. currentID: '',
  62. })
  63. this.getList(type)
  64. },
  65. setStartTime(e) {
  66. console.log(e.detail.value, 'e');
  67. this.setData({
  68. startTime: e.detail.value
  69. })
  70. },
  71. setEndTime(e) {
  72. console.log(e.detail.value, 'e');
  73. this.setData({
  74. endTime: e.detail.value
  75. })
  76. },
  77. search() {
  78. if (this.data.startTime == '开始时间' || this.data.endTime == '结束时间') {
  79. return
  80. }
  81. const startTime = this.data.startTime + " 00:00:00"
  82. const endTime = this.data.endTime + " 23:59:59"
  83. this.getList(false, startTime, endTime)
  84. },
  85. goDetail(e) {
  86. const id = e.currentTarget.dataset.id
  87. tt.navigateTo({
  88. url: `/pages/appointDetail/appointDetail?id=${id}`,
  89. });
  90. },
  91. onShow() {
  92. this.getList()
  93. }
  94. })