select-popup.js 5.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149
  1. "use strict";
  2. const common_vendor = require("../../../common/vendor.js");
  3. require("../../../sheep/index.js");
  4. const sheep_api_trade_order = require("../../../sheep/api/trade/order.js");
  5. const sheep_api_product_history = require("../../../sheep/api/product/history.js");
  6. require("../../../sheep/url/index.js");
  7. require("../../../sheep/store/index.js");
  8. require("../../../sheep/store/app.js");
  9. require("../../../sheep/api/promotion/diy.js");
  10. require("../../../sheep/request/index.js");
  11. require("../../../sheep/config/index.js");
  12. require("../../../sheep/platform/index.js");
  13. require("../../../sheep/platform/provider/wechat/index.js");
  14. require("../../../sheep/platform/provider/wechat/miniProgram.js");
  15. require("../../../sheep/api/member/auth.js");
  16. require("../../../sheep/api/member/social.js");
  17. require("../../../sheep/api/member/user.js");
  18. require("../../../sheep/platform/provider/apple/index.js");
  19. require("../../../sheep/platform/share.js");
  20. require("../../../sheep/router/index.js");
  21. require("../../../sheep/hooks/useModal.js");
  22. require("../../../sheep/helper/index.js");
  23. require("../../../sheep/helper/test.js");
  24. require("../../../sheep/helper/digit.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/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_uni_load_more2 = common_vendor.resolveComponent("uni-load-more");
  38. const _easycom_su_popup2 = common_vendor.resolveComponent("su-popup");
  39. (_easycom_uni_load_more2 + _easycom_su_popup2)();
  40. }
  41. const _easycom_uni_load_more = () => "../../../uni_modules/uni-load-more/components/uni-load-more/uni-load-more.js";
  42. const _easycom_su_popup = () => "../../../sheep/ui/su-popup/su-popup.js";
  43. if (!Math) {
  44. (GoodsItem + OrderItem + _easycom_uni_load_more + _easycom_su_popup)();
  45. }
  46. const GoodsItem = () => "./goods.js";
  47. const OrderItem = () => "./order.js";
  48. const _sfc_main = {
  49. __name: "select-popup",
  50. props: {
  51. mode: {
  52. type: String,
  53. default: "goods"
  54. },
  55. show: {
  56. type: Boolean,
  57. default: false
  58. }
  59. },
  60. emits: ["select", "close"],
  61. setup(__props, { emit: emits }) {
  62. const props = __props;
  63. common_vendor.watch(
  64. () => props.mode,
  65. () => {
  66. state.pagination.data = [];
  67. if (props.mode) {
  68. getList(state.pagination.page);
  69. }
  70. }
  71. );
  72. const state = common_vendor.reactive({
  73. loadStatus: "",
  74. pagination: {
  75. data: [],
  76. current_page: 1,
  77. total: 1,
  78. last_page: 1
  79. }
  80. });
  81. async function getList(page, list_rows = 5) {
  82. state.loadStatus = "loading";
  83. const res = props.mode == "goods" ? await sheep_api_product_history.SpuHistoryApi.getBrowseHistoryPage({
  84. page,
  85. list_rows
  86. }) : await sheep_api_trade_order.OrderApi.getOrderPage({
  87. page,
  88. list_rows
  89. });
  90. let orderList = common_vendor._.concat(state.pagination.data, res.data.data);
  91. state.pagination = {
  92. ...res.data,
  93. data: orderList
  94. };
  95. if (state.pagination.current_page < state.pagination.last_page) {
  96. state.loadStatus = "more";
  97. } else {
  98. state.loadStatus = "noMore";
  99. }
  100. }
  101. function loadmore() {
  102. if (state.loadStatus !== "noMore") {
  103. getList(state.pagination.current_page + 1);
  104. }
  105. }
  106. return (_ctx, _cache) => {
  107. return {
  108. a: common_vendor.t(__props.mode == "goods" ? "我的浏览" : "我的订单"),
  109. b: common_vendor.f(state.pagination.data, (item, k0, i0) => {
  110. return common_vendor.e(__props.mode == "goods" ? {
  111. a: "878522b0-1-" + i0 + ",878522b0-0",
  112. b: common_vendor.p({
  113. goodsData: item.goods
  114. })
  115. } : {}, __props.mode == "order" ? {
  116. c: "878522b0-2-" + i0 + ",878522b0-0",
  117. d: common_vendor.p({
  118. orderData: item
  119. })
  120. } : {}, {
  121. e: item,
  122. f: common_vendor.o(($event) => emits("select", {
  123. type: __props.mode,
  124. data: item
  125. }), item)
  126. });
  127. }),
  128. c: __props.mode == "goods",
  129. d: __props.mode == "order",
  130. e: common_vendor.p({
  131. status: state.loadStatus,
  132. ["content-text"]: {
  133. contentdown: "上拉加载更多"
  134. }
  135. }),
  136. f: common_vendor.o(loadmore),
  137. g: common_vendor.o(($event) => emits("close")),
  138. h: common_vendor.p({
  139. show: __props.show,
  140. showClose: true,
  141. round: "10",
  142. backgroundColor: "#eee"
  143. })
  144. };
  145. };
  146. }
  147. };
  148. const Component = /* @__PURE__ */ common_vendor._export_sfc(_sfc_main, [["__scopeId", "data-v-878522b0"], ["__file", "/Users/RuHu.Xu/Desktop/mall-newfeifan-zx-app/pages/chat/components/select-popup.vue"]]);
  149. wx.createComponent(Component);