select-popup.js 5.1 KB

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