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

122 lines
2.6 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: 200,
  25. }
  26. if (startTime && endTime) {
  27. data.serchStartDate = startTime
  28. data.serchEndDate = endTime
  29. }
  30. if (status || status === 0) {
  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. if (item.startDate && item.endDate) {
  43. item.appointTime = appointStart + ' - ' + appointEnd
  44. } else {
  45. item.appointTime = "暂无";
  46. }
  47. })
  48. that.setData({
  49. list: res.data.list,
  50. })
  51. }).catch(err => {
  52. console.log(err, 'err');
  53. })
  54. },
  55. setNav(e) {
  56. const id = e.currentTarget.dataset.id
  57. this.setData({
  58. currentID: id == this.data.currentID ? '' : id
  59. })
  60. console.log(this.data.currentID, 'currentID');
  61. },
  62. setType(e) {
  63. const type = e.currentTarget.dataset.type
  64. this.setData({
  65. currentID: '',
  66. })
  67. if (type === 'X') {
  68. this.getList(false)
  69. } else if (type === 'Y') {
  70. this.getList(0)
  71. } else {
  72. this.getList(type * 1)
  73. }
  74. },
  75. setStartTime(e) {
  76. console.log(e.detail.value, 'e');
  77. this.setData({
  78. startTime: e.detail.value
  79. })
  80. },
  81. setEndTime(e) {
  82. console.log(e.detail.value, 'e');
  83. this.setData({
  84. endTime: e.detail.value
  85. })
  86. },
  87. search() {
  88. if (this.data.startTime == '开始时间' || this.data.endTime == '结束时间') {
  89. return
  90. }
  91. const startTime = this.data.startTime + " 00:00:00"
  92. const endTime = this.data.endTime + " 23:59:59"
  93. this.getList(false, startTime, endTime)
  94. },
  95. goDetail(e) {
  96. const id = e.currentTarget.dataset.id
  97. tt.navigateTo({
  98. url: `/pages/appointDetail/appointDetail?id=${id}`,
  99. });
  100. },
  101. onShow() {
  102. this.getList()
  103. }
  104. })