C端小程序
Não pode escolher mais do que 25 tópicos Os tópicos devem começar com uma letra ou um número, podem incluir traços ('-') e podem ter até 35 caracteres.

85 linhas
1.7 KiB

  1. let format = require("../../../utils/util.js");
  2. let config = require("../../../config/config.js");
  3. let app = getApp();
  4. const Http = require("../../../utils/HttpBasics");
  5. //1535126400000
  6. Page({
  7. data: {
  8. tabs: [
  9. {
  10. key: 0,
  11. name: "未使用"
  12. },
  13. {
  14. key: 1,
  15. name: "已使用"
  16. },
  17. {
  18. key: 2,
  19. name: "已过期"
  20. },
  21. {
  22. key: 3,
  23. name: "已退款"
  24. }
  25. ],
  26. list: [],
  27. current: "",
  28. current_scroll: "1"
  29. },
  30. onLoad() {
  31. this.getList(0, 1);
  32. },
  33. //点击跳转到券详情页面
  34. gotouse: function(e) {
  35. console.log(e.currentTarget.dataset.quancode);
  36. console.log("点击跳转到券详情");
  37. wx.navigateTo({
  38. url: `/pages/couponorder/detail/index?quancode=${e.currentTarget.dataset.quancode}`,
  39. success: function(res){
  40. // success
  41. console.log("点击跳转到券详情页面")
  42. },
  43. fail: function() {
  44. // fail
  45. },
  46. complete: function() {
  47. // complete
  48. }
  49. })
  50. },
  51. getList(key, pageNum) {
  52. var that = this;
  53. Http.get({
  54. url: config.api.couponOrderList,
  55. data: {
  56. pageNum: pageNum,
  57. pageSize: 10,
  58. orderStatus: key
  59. }
  60. }).then(res => {
  61. console.log(res);
  62. res.data.list.map(file => {
  63. file.expiredTime = format.formatTime(
  64. file.expiredTime,
  65. "yyyy-MM-dddd hh:mm:ss"
  66. );
  67. });
  68. that.setData({
  69. list: res.data.list
  70. });
  71. });
  72. },
  73. handleChange({ detail }) {
  74. this.setData({
  75. current: detail.key
  76. });
  77. },
  78. handleChangeScroll({ detail }) {
  79. this.getList(detail.key);
  80. this.setData({
  81. current_scroll: detail.key
  82. });
  83. }
  84. });