抖音b端
Ви не можете вибрати більше 25 тем Теми мають розпочинатися з літери або цифри, можуть містити дефіси (-) і не повинні перевищувати 35 символів.

117 рядки
2.6 KiB

  1. // c:\Users\Holy-Knight-IX\Desktop\Working Space\4.TikTok-MiniPro\ttb\pages\appointDetail\appointDetail.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. id: "",
  10. detail: null
  11. },
  12. onLoad(options) {
  13. console.log(options, 'options');
  14. if (options.id) {
  15. this.setData({
  16. id: options.id
  17. })
  18. this.getDetail(options.id)
  19. }
  20. },
  21. getDetail(id) {
  22. const that = this
  23. const data = {
  24. id
  25. }
  26. HttpBasics.get({
  27. url: config.api.appointDetail,
  28. data
  29. })
  30. .then(res => {
  31. console.log(res, 'res');
  32. const appointStart = util.timestampToTime(res.data.startDate, 'YYYY-MM-DD hh:mm:ss')
  33. const appointEnd = util.timestampToTime(res.data.endDate, 'hh:mm:ss')
  34. res.data.appointTime = appointStart + ' - ' + appointEnd
  35. that.setData({
  36. detail: res.data
  37. })
  38. }).catch(err => {
  39. console.log(err, 'err');
  40. })
  41. },
  42. back() {
  43. tt.navigateBack();
  44. },
  45. cancel() {
  46. const that = this
  47. tt.showModal({
  48. title: "提示",
  49. content: "是否与用户取得联系并取消预约?",
  50. showCancel: true,
  51. confirmText: "确认取消",
  52. confirmColor: "#52a0fd",
  53. cancelText: "返回",
  54. success(res) {
  55. if (res.confirm) {
  56. that.goChange(that.data.id, 0)
  57. }
  58. if (res.cancel) {
  59. return
  60. }
  61. }
  62. });
  63. },
  64. confirm() {
  65. const that = this
  66. tt.showModal({
  67. title: "提示",
  68. content: "是否与用户取得联系并完成预约?",
  69. showCancel: true,
  70. confirmText: "确认完成",
  71. confirmColor: "#52a0fd",
  72. cancelText: "关闭",
  73. success(res) {
  74. if (res.confirm) {
  75. that.goChange(that.data.id, 5)
  76. }
  77. if (res.cancel) {
  78. return
  79. }
  80. }
  81. });
  82. },
  83. goChange(id, status) {
  84. const data = {
  85. id,
  86. status
  87. }
  88. HttpBasics.post({
  89. url: config.api.appointConfirm,
  90. data
  91. })
  92. .then(res => {
  93. console.log(res, 'res');
  94. tt.showToast({
  95. title: status == 5 ? '确认成功!' : '取消成功!',
  96. icon: "success",
  97. duration: 2000
  98. });
  99. setTimeout(() => {
  100. tt.navigateBack();
  101. }, 2000);
  102. }).catch(err => {
  103. console.log(err, 'err');
  104. tt.showToast({
  105. title: err.message,
  106. icon: "none"
  107. });
  108. })
  109. }
  110. })