爱简收旧衣按件回收前端代码仓库
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.

103 lines
3.1 KiB

  1. "use strict";
  2. const common_vendor = require("../../common/vendor.js");
  3. const _sfc_main = {
  4. data() {
  5. return {
  6. tabActive: 0,
  7. teamList: [],
  8. teamList1: [],
  9. // 一级团队
  10. teamList2: []
  11. // 二级团队
  12. };
  13. },
  14. computed: {
  15. orderedCount() {
  16. return this.teamList.filter((item) => item.orders > 0).length;
  17. },
  18. notOrderedCount() {
  19. return this.teamList.filter((item) => item.orders == 0).length;
  20. }
  21. },
  22. watch: {
  23. tabActive(val) {
  24. this.teamList = val === 0 ? this.teamList1 : this.teamList2;
  25. }
  26. },
  27. mounted() {
  28. this.fetchTeamList(0);
  29. this.fetchTeamList(1);
  30. },
  31. methods: {
  32. goBack() {
  33. common_vendor.index.navigateBack();
  34. },
  35. fetchTeamList(state) {
  36. this.$api("getHanHaiMemberUser", { state }, (res) => {
  37. if (res && res.code === 200 && res.result && Array.isArray(res.result.records)) {
  38. const list = res.result.records.map((item) => {
  39. let days = 0;
  40. if (item.createTime) {
  41. const joinDate = new Date(item.createTime.replace(/-/g, "/"));
  42. const now = /* @__PURE__ */ new Date();
  43. days = Math.floor((now - joinDate) / (1e3 * 60 * 60 * 24));
  44. }
  45. return {
  46. avatar: item.headImage,
  47. name: item.nickName,
  48. days,
  49. orders: item.orderNum,
  50. amount: item.commission
  51. };
  52. });
  53. if (state === 0) {
  54. this.teamList1 = list;
  55. if (this.tabActive === 0)
  56. this.teamList = list;
  57. } else {
  58. this.teamList2 = list;
  59. if (this.tabActive === 1)
  60. this.teamList = list;
  61. }
  62. }
  63. });
  64. }
  65. }
  66. };
  67. if (!Array) {
  68. const _easycom_uni_icons2 = common_vendor.resolveComponent("uni-icons");
  69. _easycom_uni_icons2();
  70. }
  71. const _easycom_uni_icons = () => "../../uni_modules/uni-icons/components/uni-icons/uni-icons.js";
  72. if (!Math) {
  73. _easycom_uni_icons();
  74. }
  75. function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
  76. return {
  77. a: common_vendor.p({
  78. type: "left",
  79. size: "20"
  80. }),
  81. b: common_vendor.o((...args) => $options.goBack && $options.goBack(...args)),
  82. c: common_vendor.n($data.tabActive === 0 ? "active" : ""),
  83. d: common_vendor.o(($event) => $data.tabActive = 0),
  84. e: common_vendor.n($data.tabActive === 1 ? "active" : ""),
  85. f: common_vendor.o(($event) => $data.tabActive = 1),
  86. g: common_vendor.t($data.teamList.length),
  87. h: common_vendor.t($options.orderedCount),
  88. i: common_vendor.t($options.notOrderedCount),
  89. j: common_vendor.f($data.teamList, (item, idx, i0) => {
  90. return {
  91. a: item.avatar,
  92. b: common_vendor.t(item.name),
  93. c: common_vendor.t(item.days),
  94. d: common_vendor.t(item.orders),
  95. e: common_vendor.t(item.amount),
  96. f: idx
  97. };
  98. })
  99. };
  100. }
  101. const MiniProgramPage = /* @__PURE__ */ common_vendor._export_sfc(_sfc_main, [["render", _sfc_render], ["__scopeId", "data-v-f0795b19"]]);
  102. wx.createPage(MiniProgramPage);
  103. //# sourceMappingURL=../../../.sourcemap/mp-weixin/pages/subcomponent/promotion-team.js.map