order.js 7.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189
  1. "use strict";
  2. const common_vendor = require("../../../common/vendor.js");
  3. const sheep_index = require("../../../sheep/index.js");
  4. const sheep_hooks_useGoods = require("../../../sheep/hooks/useGoods.js");
  5. const sheep_util_index = require("../../../sheep/util/index.js");
  6. const sheep_api_promotion_combination = require("../../../sheep/api/promotion/combination.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_s_goods_item2 = common_vendor.resolveComponent("s-goods-item");
  43. const _easycom_uni_load_more2 = common_vendor.resolveComponent("uni-load-more");
  44. const _easycom_s_layout2 = common_vendor.resolveComponent("s-layout");
  45. (_easycom_su_tabs2 + _easycom_su_sticky2 + _easycom_s_empty2 + _easycom_s_goods_item2 + _easycom_uni_load_more2 + _easycom_s_layout2)();
  46. }
  47. const _easycom_su_tabs = () => "../../../sheep/ui/su-tabs/su-tabs.js";
  48. const _easycom_su_sticky = () => "../../../sheep/ui/su-sticky/su-sticky.js";
  49. const _easycom_s_empty = () => "../../../sheep/components/s-empty/s-empty.js";
  50. const _easycom_s_goods_item = () => "../../../sheep/components/s-goods-item/s-goods-item.js";
  51. const _easycom_uni_load_more = () => "../../../uni_modules/uni-load-more/components/uni-load-more/uni-load-more.js";
  52. const _easycom_s_layout = () => "../../../sheep/components/s-layout/s-layout.js";
  53. if (!Math) {
  54. (_easycom_su_tabs + _easycom_su_sticky + _easycom_s_empty + _easycom_s_goods_item + _easycom_uni_load_more + _easycom_s_layout)();
  55. }
  56. const _sfc_main = {
  57. __name: "order",
  58. setup(__props) {
  59. const state = common_vendor.reactive({
  60. currentTab: 0,
  61. pagination: {
  62. list: [],
  63. total: 0,
  64. pageNo: 1,
  65. pageSize: 5
  66. },
  67. loadStatus: "",
  68. deleteOrderId: 0
  69. });
  70. const tabMaps = [
  71. {
  72. name: "全部"
  73. },
  74. {
  75. name: "进行中",
  76. value: 0
  77. },
  78. {
  79. name: "拼团成功",
  80. value: 1
  81. },
  82. {
  83. name: "拼团失败",
  84. value: 2
  85. }
  86. ];
  87. function onTabsChange(e) {
  88. sheep_util_index.resetPagination(state.pagination);
  89. state.currentTab = e.index;
  90. getGrouponList();
  91. }
  92. async function getGrouponList() {
  93. state.loadStatus = "loading";
  94. const { code, data } = await sheep_api_promotion_combination.CombinationApi.getCombinationRecordPage({
  95. pageNo: state.pagination.pageNo,
  96. pageSize: state.pagination.pageSize,
  97. status: tabMaps[state.currentTab].value
  98. });
  99. if (code !== 0) {
  100. return;
  101. }
  102. state.pagination.list = common_vendor._.concat(state.pagination.list, data.list);
  103. state.pagination.total = data.total;
  104. state.loadStatus = state.pagination.list.length < state.pagination.total ? "more" : "noMore";
  105. }
  106. common_vendor.onLoad((options) => {
  107. if (options.type) {
  108. state.currentTab = options.type;
  109. }
  110. getGrouponList();
  111. });
  112. function loadMore() {
  113. if (state.loadStatus === "noMore") {
  114. return;
  115. }
  116. state.pagination.pageNo++;
  117. getGrouponList();
  118. }
  119. common_vendor.onReachBottom(() => {
  120. loadMore();
  121. });
  122. common_vendor.onPullDownRefresh(() => {
  123. getGrouponList();
  124. setTimeout(function() {
  125. common_vendor.index.stopPullDownRefresh();
  126. }, 800);
  127. });
  128. return (_ctx, _cache) => {
  129. return common_vendor.e({
  130. a: common_vendor.o(onTabsChange),
  131. b: common_vendor.p({
  132. list: tabMaps,
  133. scrollable: false,
  134. current: state.currentTab
  135. }),
  136. c: common_vendor.p({
  137. bgColor: "#fff"
  138. }),
  139. d: state.pagination.total === 0
  140. }, state.pagination.total === 0 ? {
  141. e: common_vendor.p({
  142. icon: "/static/goods-empty.png"
  143. })
  144. } : {}, {
  145. f: state.pagination.total > 0
  146. }, state.pagination.total > 0 ? {
  147. g: common_vendor.f(state.pagination.list, (record, k0, i0) => {
  148. return {
  149. a: common_vendor.t(record.id),
  150. b: common_vendor.t(tabMaps.find((item) => item.value === record.status).name),
  151. c: common_vendor.n(common_vendor.unref(sheep_hooks_useGoods.formatOrderColor)(record)),
  152. d: common_vendor.t(record.userSize),
  153. e: "5be50f68-4-" + i0 + ",5be50f68-0",
  154. f: common_vendor.p({
  155. img: record.picUrl,
  156. title: record.spuName,
  157. price: record.combinationPrice
  158. }),
  159. g: common_vendor.o(($event) => common_vendor.unref(sheep_index.sheep).$router.go("/pages/order/detail", {
  160. id: record.orderId
  161. }), record.id),
  162. h: common_vendor.t(record.status === 0 ? "邀请拼团" : "拼团详情"),
  163. i: record.status === 0 ? 1 : "",
  164. j: common_vendor.o(($event) => common_vendor.unref(sheep_index.sheep).$router.go("/pages/activity/groupon/detail", {
  165. id: record.id
  166. }), record.id),
  167. k: record.id
  168. };
  169. })
  170. } : {}, {
  171. h: state.pagination.total > 0
  172. }, state.pagination.total > 0 ? {
  173. i: common_vendor.o(loadMore),
  174. j: common_vendor.p({
  175. status: state.loadStatus,
  176. ["content-text"]: {
  177. contentdown: "上拉加载更多"
  178. }
  179. })
  180. } : {}, {
  181. k: common_vendor.p({
  182. title: "我的拼团"
  183. })
  184. });
  185. };
  186. }
  187. };
  188. const MiniProgramPage = /* @__PURE__ */ common_vendor._export_sfc(_sfc_main, [["__scopeId", "data-v-5be50f68"], ["__file", "/Users/RuHu.Xu/Desktop/mall-newfeifan-zx-app/pages/activity/groupon/order.vue"]]);
  189. wx.createPage(MiniProgramPage);