team.js 7.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185
  1. "use strict";
  2. const common_vendor = require("../../common/vendor.js");
  3. const sheep_index = require("../../sheep/index.js");
  4. const sheep_api_trade_brokerage = require("../../sheep/api/trade/brokerage.js");
  5. require("../../sheep/url/index.js");
  6. require("../../sheep/store/index.js");
  7. require("../../sheep/store/app.js");
  8. require("../../sheep/api/promotion/diy.js");
  9. require("../../sheep/request/index.js");
  10. require("../../sheep/config/index.js");
  11. require("../../sheep/platform/index.js");
  12. require("../../sheep/platform/provider/wechat/index.js");
  13. require("../../sheep/platform/provider/wechat/miniProgram.js");
  14. require("../../sheep/api/member/auth.js");
  15. require("../../sheep/api/member/social.js");
  16. require("../../sheep/api/member/user.js");
  17. require("../../sheep/platform/provider/apple/index.js");
  18. require("../../sheep/platform/share.js");
  19. require("../../sheep/router/index.js");
  20. require("../../sheep/hooks/useModal.js");
  21. require("../../sheep/helper/index.js");
  22. require("../../sheep/helper/test.js");
  23. require("../../sheep/helper/digit.js");
  24. require("../../sheep/helper/throttle.js");
  25. require("../../sheep/platform/pay.js");
  26. require("../../sheep/api/pay/order.js");
  27. require("../../sheep/store/user.js");
  28. require("../../sheep/store/cart.js");
  29. require("../../sheep/api/trade/cart.js");
  30. require("../../sheep/api/pay/wallet.js");
  31. require("../../sheep/api/trade/order.js");
  32. require("../../sheep/api/promotion/coupon.js");
  33. require("../../sheep/store/sys.js");
  34. require("../../sheep/store/modal.js");
  35. require("../../sheep/config/zIndex.js");
  36. if (!Array) {
  37. const _easycom_s_layout2 = common_vendor.resolveComponent("s-layout");
  38. _easycom_s_layout2();
  39. }
  40. const _easycom_s_layout = () => "../../sheep/components/s-layout/s-layout.js";
  41. if (!Math) {
  42. _easycom_s_layout();
  43. }
  44. const _sfc_main = {
  45. __name: "team",
  46. setup(__props) {
  47. common_vendor.useCssVars((_ctx) => ({
  48. "768616fe": common_vendor.unref(headerBg)
  49. }));
  50. sheep_index.sheep.$platform.device.statusBarHeight * 2;
  51. common_vendor.computed(() => sheep_index.sheep.$store("user").userInfo);
  52. const headerBg = sheep_index.sheep.$url.css("/static/img/shop/user/withdraw_bg.png");
  53. common_vendor.onPageScroll((e) => {
  54. state.scrollTop = e.scrollTop <= 100;
  55. });
  56. let sort = common_vendor.ref();
  57. const state = common_vendor.reactive({
  58. summary: {},
  59. pagination: {
  60. pageNo: 1,
  61. pageSize: 8,
  62. list: [],
  63. total: 0
  64. },
  65. loadStatus: "",
  66. // ↓ 新 ui 逻辑
  67. level: 1,
  68. nickname: common_vendor.ref(""),
  69. sortKey: "",
  70. isAsc: ""
  71. });
  72. function submitForm() {
  73. state.pagination.list = [];
  74. getTeamList();
  75. }
  76. async function getTeamList() {
  77. state.loadStatus = "loading";
  78. let { code, data } = await sheep_api_trade_brokerage.BrokerageApi.getBrokerageUserChildSummaryPage({
  79. pageNo: state.pagination.pageNo,
  80. pageSize: state.pagination.pageSize,
  81. level: state.level,
  82. "sortingField.order": state.isAsc,
  83. "sortingField.field": state.sortKey,
  84. nickname: state.nickname
  85. });
  86. if (code !== 0) {
  87. return;
  88. }
  89. state.pagination.list = common_vendor._.concat(state.pagination.list, data.list);
  90. state.pagination.total = data.total;
  91. state.loadStatus = state.pagination.list.length < state.pagination.total ? "more" : "noMore";
  92. }
  93. function setType(e) {
  94. state.pagination.list = [];
  95. state.level = e + "";
  96. getTeamList();
  97. }
  98. function setSort(sortKey, isAsc) {
  99. state.pagination.list = [];
  100. sort = sortKey + isAsc.toUpperCase();
  101. state.isAsc = isAsc;
  102. state.sortKey = sortKey;
  103. getTeamList();
  104. }
  105. common_vendor.onLoad(async () => {
  106. await getTeamList();
  107. let { data } = await sheep_api_trade_brokerage.BrokerageApi.getBrokerageUserSummary();
  108. state.summary = data;
  109. });
  110. function loadMore() {
  111. if (state.loadStatus === "noMore") {
  112. return;
  113. }
  114. state.pagination.pageNo++;
  115. getTeamList();
  116. }
  117. common_vendor.onReachBottom(() => {
  118. loadMore();
  119. });
  120. return (_ctx, _cache) => {
  121. return common_vendor.e({
  122. a: common_vendor.t(state.summary.firstBrokerageUserCount + state.summary.secondBrokerageUserCount || 0),
  123. b: common_vendor.t(state.summary.firstBrokerageUserCount || 0),
  124. c: common_vendor.n(state.level == 1 ? "item on" : "item"),
  125. d: common_vendor.o(($event) => setType(1)),
  126. e: common_vendor.t(state.summary.secondBrokerageUserCount || 0),
  127. f: common_vendor.n(state.level == 2 ? "item on" : "item"),
  128. g: common_vendor.o(($event) => setType(2)),
  129. h: common_vendor.o(submitForm),
  130. i: state.nickname,
  131. j: common_vendor.o(($event) => state.nickname = $event.detail.value),
  132. k: common_vendor.o(submitForm),
  133. l: common_vendor.unref(sort) === "userCountDESC"
  134. }, common_vendor.unref(sort) === "userCountDESC" ? {
  135. m: common_vendor.o(($event) => setSort("userCount", "asc"))
  136. } : common_vendor.unref(sort) === "userCountASC" ? {
  137. o: common_vendor.o(($event) => setSort("userCount", "desc"))
  138. } : {
  139. p: common_vendor.o(($event) => setSort("userCount", "desc"))
  140. }, {
  141. n: common_vendor.unref(sort) === "userCountASC",
  142. q: common_vendor.unref(sort) === "priceDESC"
  143. }, common_vendor.unref(sort) === "priceDESC" ? {
  144. r: common_vendor.o(($event) => setSort("price", "asc"))
  145. } : common_vendor.unref(sort) === "priceASC" ? {
  146. t: common_vendor.o(($event) => setSort("price", "desc"))
  147. } : {
  148. v: common_vendor.o(($event) => setSort("price", "desc"))
  149. }, {
  150. s: common_vendor.unref(sort) === "priceASC",
  151. w: common_vendor.unref(sort) === "orderCountDESC"
  152. }, common_vendor.unref(sort) === "orderCountDESC" ? {
  153. x: common_vendor.o(($event) => setSort("orderCount", "asc"))
  154. } : common_vendor.unref(sort) === "orderCountASC" ? {
  155. z: common_vendor.o(($event) => setSort("orderCount", "desc"))
  156. } : {
  157. A: common_vendor.o(($event) => setSort("orderCount", "desc"))
  158. }, {
  159. y: common_vendor.unref(sort) === "orderCountASC",
  160. B: common_vendor.f(state.pagination.list, (item, index, i0) => {
  161. return {
  162. a: item.avatar,
  163. b: common_vendor.t(item.nickname),
  164. c: common_vendor.t(common_vendor.unref(sheep_index.sheep).$helper.timeFormat(item.brokerageTime, "yyyy-mm-dd hh:MM:ss")),
  165. d: common_vendor.t(item.brokerageUserCount || 0),
  166. e: common_vendor.t(item.orderCount || 0),
  167. f: common_vendor.t(item.brokeragePrice || 0),
  168. g: index
  169. };
  170. }),
  171. C: state.pagination.list.length === 0
  172. }, state.pagination.list.length === 0 ? {} : {}, {
  173. D: common_vendor.n(state.scrollTop ? "team-wrap" : ""),
  174. E: common_vendor.s(_ctx.__cssVars()),
  175. F: common_vendor.p({
  176. title: "我的团队",
  177. navbar: "inner"
  178. })
  179. });
  180. };
  181. }
  182. };
  183. const MiniProgramPage = /* @__PURE__ */ common_vendor._export_sfc(_sfc_main, [["__scopeId", "data-v-42603af6"], ["__file", "/Users/RuHu.Xu/Desktop/mall-newfeifan-zx-app/pages/commission/team.vue"]]);
  184. _sfc_main.__runtimeHooks = 1;
  185. wx.createPage(MiniProgramPage);