select-popup.js 6.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179
  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/api/index.js");
  7. require("../../../sheep/api/distri/score.js");
  8. require("../../../sheep/request/index.js");
  9. require("../../../sheep/config/index.js");
  10. require("../../../sheep/store/index.js");
  11. require("../../../sheep/store/app.js");
  12. require("../../../sheep/api/promotion/diy.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/api/member/signin.js");
  27. require("../../../sheep/helper/throttle.js");
  28. require("../../../sheep/url/index.js");
  29. require("../../../sheep/platform/pay.js");
  30. require("../../../sheep/api/pay/order.js");
  31. require("../../../sheep/store/user.js");
  32. require("../../../sheep/store/cart.js");
  33. require("../../../sheep/api/trade/cart.js");
  34. require("../../../sheep/api/pay/wallet.js");
  35. require("../../../sheep/api/promotion/coupon.js");
  36. require("../../../sheep/store/sys.js");
  37. require("../../../sheep/store/modal.js");
  38. require("../../../sheep/api/distri/share.js");
  39. require("../../../sheep/api/distri/team.js");
  40. require("../../../sheep/api/infra/file.js");
  41. require("../../../sheep/api/member/address.js");
  42. require("../../../sheep/api/member/point.js");
  43. require("../../../sheep/api/migration/app.js");
  44. require("../../../sheep/api/migration/chat.js");
  45. require("../../../sheep/api/migration/index.js");
  46. require("../../../sheep/api/migration/third.js");
  47. require("../../../sheep/api/pay/channel.js");
  48. require("../../../sheep/api/product/category.js");
  49. require("../../../sheep/api/product/comment.js");
  50. require("../../../sheep/api/product/favorite.js");
  51. require("../../../sheep/api/product/spu.js");
  52. require("../../../sheep/api/promotion/activity.js");
  53. require("../../../sheep/api/promotion/article.js");
  54. require("../../../sheep/api/promotion/bargain.js");
  55. require("../../../sheep/api/promotion/combination.js");
  56. require("../../../sheep/api/promotion/rewardActivity.js");
  57. require("../../../sheep/api/promotion/seckill.js");
  58. require("../../../sheep/api/system/area.js");
  59. require("../../../sheep/api/system/voice.js");
  60. require("../../../sheep/api/trade/afterSale.js");
  61. require("../../../sheep/api/trade/brokerage.js");
  62. require("../../../sheep/api/trade/config.js");
  63. require("../../../sheep/api/trade/delivery.js");
  64. require("../../../sheep/config/zIndex.js");
  65. if (!Array) {
  66. const _easycom_uni_load_more2 = common_vendor.resolveComponent("uni-load-more");
  67. const _easycom_su_popup2 = common_vendor.resolveComponent("su-popup");
  68. (_easycom_uni_load_more2 + _easycom_su_popup2)();
  69. }
  70. const _easycom_uni_load_more = () => "../../../uni_modules/uni-load-more/components/uni-load-more/uni-load-more.js";
  71. const _easycom_su_popup = () => "../../../sheep/ui/su-popup/su-popup.js";
  72. if (!Math) {
  73. (GoodsItem + OrderItem + _easycom_uni_load_more + _easycom_su_popup)();
  74. }
  75. const GoodsItem = () => "./goods.js";
  76. const OrderItem = () => "./order.js";
  77. const _sfc_main = {
  78. __name: "select-popup",
  79. props: {
  80. mode: {
  81. type: String,
  82. default: "goods"
  83. },
  84. show: {
  85. type: Boolean,
  86. default: false
  87. }
  88. },
  89. emits: ["select", "close"],
  90. setup(__props, { emit: __emit }) {
  91. const emits = __emit;
  92. const props = __props;
  93. common_vendor.watch(
  94. () => props.mode,
  95. () => {
  96. state.pagination.data = [];
  97. if (props.mode) {
  98. getList(state.pagination.page);
  99. }
  100. }
  101. );
  102. const state = common_vendor.reactive({
  103. loadStatus: "",
  104. pagination: {
  105. data: [],
  106. current_page: 1,
  107. total: 1,
  108. last_page: 1
  109. }
  110. });
  111. async function getList(page, list_rows = 5) {
  112. state.loadStatus = "loading";
  113. const res = props.mode == "goods" ? await sheep_api_product_history.SpuHistoryApi.getBrowseHistoryPage({
  114. page,
  115. list_rows
  116. }) : await sheep_api_trade_order.OrderApi.getOrderPage({
  117. page,
  118. list_rows
  119. });
  120. let orderList = common_vendor._.concat(state.pagination.data, res.data.data);
  121. state.pagination = {
  122. ...res.data,
  123. data: orderList
  124. };
  125. if (state.pagination.current_page < state.pagination.last_page) {
  126. state.loadStatus = "more";
  127. } else {
  128. state.loadStatus = "noMore";
  129. }
  130. }
  131. function loadmore() {
  132. if (state.loadStatus !== "noMore") {
  133. getList(state.pagination.current_page + 1);
  134. }
  135. }
  136. return (_ctx, _cache) => {
  137. return {
  138. a: common_vendor.t(__props.mode == "goods" ? "我的浏览" : "我的订单"),
  139. b: common_vendor.f(state.pagination.data, (item, k0, i0) => {
  140. return common_vendor.e(__props.mode == "goods" ? {
  141. a: "878522b0-1-" + i0 + ",878522b0-0",
  142. b: common_vendor.p({
  143. goodsData: item.goods
  144. })
  145. } : {}, __props.mode == "order" ? {
  146. c: "878522b0-2-" + i0 + ",878522b0-0",
  147. d: common_vendor.p({
  148. orderData: item
  149. })
  150. } : {}, {
  151. e: item,
  152. f: common_vendor.o(($event) => emits("select", {
  153. type: __props.mode,
  154. data: item
  155. }), item)
  156. });
  157. }),
  158. c: __props.mode == "goods",
  159. d: __props.mode == "order",
  160. e: common_vendor.p({
  161. status: state.loadStatus,
  162. ["content-text"]: {
  163. contentdown: "上拉加载更多"
  164. }
  165. }),
  166. f: common_vendor.o(loadmore),
  167. g: common_vendor.o(($event) => emits("close")),
  168. h: common_vendor.p({
  169. show: __props.show,
  170. showClose: true,
  171. round: "10",
  172. backgroundColor: "#eee"
  173. })
  174. };
  175. };
  176. }
  177. };
  178. 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"]]);
  179. wx.createComponent(Component);