team.js 7.2 KB

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