order.js 6.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186
  1. "use strict";
  2. const common_vendor = require("../../common/vendor.js");
  3. const sheep_index = require("../../sheep/index.js");
  4. const sheep_util_index = require("../../sheep/util/index.js");
  5. const sheep_api_trade_brokerage = require("../../sheep/api/trade/brokerage.js");
  6. const sheep_hooks_useGoods = require("../../sheep/hooks/useGoods.js");
  7. require("../../sheep/url/index.js");
  8. require("../../sheep/store/index.js");
  9. require("../../sheep/store/app.js");
  10. require("../../sheep/api/promotion/diy.js");
  11. require("../../sheep/request/index.js");
  12. require("../../sheep/config/index.js");
  13. require("../../sheep/platform/index.js");
  14. require("../../sheep/platform/provider/wechat/index.js");
  15. require("../../sheep/platform/provider/wechat/miniProgram.js");
  16. require("../../sheep/api/member/auth.js");
  17. require("../../sheep/api/member/social.js");
  18. require("../../sheep/api/member/user.js");
  19. require("../../sheep/platform/provider/apple/index.js");
  20. require("../../sheep/platform/share.js");
  21. require("../../sheep/router/index.js");
  22. require("../../sheep/hooks/useModal.js");
  23. require("../../sheep/helper/index.js");
  24. require("../../sheep/helper/test.js");
  25. require("../../sheep/helper/digit.js");
  26. require("../../sheep/helper/throttle.js");
  27. require("../../sheep/platform/pay.js");
  28. require("../../sheep/api/pay/order.js");
  29. require("../../sheep/store/user.js");
  30. require("../../sheep/store/cart.js");
  31. require("../../sheep/api/trade/cart.js");
  32. require("../../sheep/api/pay/wallet.js");
  33. require("../../sheep/api/trade/order.js");
  34. require("../../sheep/api/promotion/coupon.js");
  35. require("../../sheep/store/sys.js");
  36. require("../../sheep/store/modal.js");
  37. require("../../sheep/config/zIndex.js");
  38. if (!Array) {
  39. const _easycom_su_tabs2 = common_vendor.resolveComponent("su-tabs");
  40. const _easycom_su_sticky2 = common_vendor.resolveComponent("su-sticky");
  41. const _easycom_s_empty2 = common_vendor.resolveComponent("s-empty");
  42. const _easycom_uni_load_more2 = common_vendor.resolveComponent("uni-load-more");
  43. const _easycom_s_layout2 = common_vendor.resolveComponent("s-layout");
  44. (_easycom_su_tabs2 + _easycom_su_sticky2 + _easycom_s_empty2 + _easycom_uni_load_more2 + _easycom_s_layout2)();
  45. }
  46. const _easycom_su_tabs = () => "../../sheep/ui/su-tabs/su-tabs.js";
  47. const _easycom_su_sticky = () => "../../sheep/ui/su-sticky/su-sticky.js";
  48. const _easycom_s_empty = () => "../../sheep/components/s-empty/s-empty.js";
  49. const _easycom_uni_load_more = () => "../../uni_modules/uni-load-more/components/uni-load-more/uni-load-more.js";
  50. const _easycom_s_layout = () => "../../sheep/components/s-layout/s-layout.js";
  51. if (!Math) {
  52. (_easycom_su_tabs + _easycom_su_sticky + _easycom_s_empty + _easycom_uni_load_more + _easycom_s_layout)();
  53. }
  54. const _sfc_main = {
  55. __name: "order",
  56. setup(__props) {
  57. common_vendor.useCssVars((_ctx) => ({
  58. "83224c2e": common_vendor.unref(headerBg)
  59. }));
  60. const statusBarHeight = sheep_index.sheep.$platform.device.statusBarHeight * 2;
  61. const headerBg = sheep_index.sheep.$url.css("/static/img/shop/user/withdraw_bg.png");
  62. common_vendor.onPageScroll((e) => {
  63. state.scrollTop = e.scrollTop <= 100;
  64. });
  65. const state = common_vendor.reactive({
  66. totals: 0,
  67. // 累计推广订单(单)
  68. scrollTop: false,
  69. currentTab: 0,
  70. loadStatus: "",
  71. pagination: {
  72. list: [],
  73. total: 0,
  74. pageNo: 1,
  75. pageSize: 1
  76. }
  77. });
  78. const tabMaps = [
  79. {
  80. name: "全部",
  81. value: "all"
  82. },
  83. {
  84. name: "待结算",
  85. value: "0"
  86. // 待结算
  87. },
  88. {
  89. name: "已结算",
  90. value: "1"
  91. // 已结算
  92. }
  93. ];
  94. function onTabsChange(e) {
  95. sheep_util_index.resetPagination(state.pagination);
  96. state.currentTab = e.index;
  97. getOrderList();
  98. }
  99. async function getOrderList() {
  100. state.loadStatus = "loading";
  101. let { code, data } = await sheep_api_trade_brokerage.BrokerageApi.getBrokerageRecordPage({
  102. pageSize: state.pagination.pageSize,
  103. pageNo: state.pagination.pageSize,
  104. bizType: 1,
  105. // 获得推广佣金
  106. status: state.currentTab > 0 ? state.currentTab : void 0
  107. });
  108. if (code !== 0) {
  109. return;
  110. }
  111. state.pagination.list = common_vendor._.concat(state.pagination.list, data.list);
  112. state.pagination.total = data.total;
  113. state.loadStatus = state.pagination.list.length < state.pagination.total ? "more" : "noMore";
  114. if (state.currentTab === 0) {
  115. state.totals = data.total;
  116. }
  117. }
  118. common_vendor.onLoad(() => {
  119. getOrderList();
  120. });
  121. function loadMore() {
  122. if (state.loadStatus === "noMore") {
  123. return;
  124. }
  125. state.pagination.pageNo++;
  126. getOrderList();
  127. }
  128. common_vendor.onReachBottom(() => {
  129. loadMore();
  130. });
  131. return (_ctx, _cache) => {
  132. return common_vendor.e({
  133. a: common_vendor.t(state.totals),
  134. b: common_vendor.s({
  135. marginTop: "-" + Number(statusBarHeight + 88) + "rpx",
  136. paddingTop: Number(statusBarHeight + 108) + "rpx"
  137. }),
  138. c: common_vendor.o(onTabsChange),
  139. d: common_vendor.p({
  140. list: tabMaps,
  141. scrollable: false,
  142. current: state.currentTab
  143. }),
  144. e: common_vendor.p({
  145. bgColor: "#fff"
  146. }),
  147. f: common_vendor.f(state.pagination.list, (item, k0, i0) => {
  148. return {
  149. a: common_vendor.t(item.bizId),
  150. b: common_vendor.t(item.status === 0 ? "待结算" : item.status === 1 ? "已结算" : "已取消"),
  151. c: common_vendor.t(common_vendor.unref(sheep_hooks_useGoods.fen2yuan)(item.price)),
  152. d: common_vendor.t(item.title),
  153. e: common_vendor.t(common_vendor.unref(sheep_index.sheep).$helper.timeFormat(item.createTime, "yyyy-mm-dd hh:MM:ss")),
  154. f: item
  155. };
  156. }),
  157. g: state.pagination.total === 0
  158. }, state.pagination.total === 0 ? {
  159. h: common_vendor.p({
  160. icon: "/static/order-empty.png",
  161. text: "暂无订单"
  162. })
  163. } : {}, {
  164. i: state.pagination.total > 0
  165. }, state.pagination.total > 0 ? {
  166. j: common_vendor.o(loadMore),
  167. k: common_vendor.p({
  168. status: state.loadStatus,
  169. ["content-text"]: {
  170. contentdown: "上拉加载更多"
  171. }
  172. })
  173. } : {}, {
  174. l: common_vendor.n(state.scrollTop ? "order-warp" : ""),
  175. m: common_vendor.s(_ctx.__cssVars()),
  176. n: 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-3971f30d"], ["__file", "/Users/RuHu.Xu/Desktop/mall-newfeifan-zx-app/pages/commission/order.vue"]]);
  185. _sfc_main.__runtimeHooks = 1;
  186. wx.createPage(MiniProgramPage);