list.js 7.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208
  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_api_promotion_bargain = require("../../../sheep/api/promotion/bargain.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/trade/order.js");
  36. require("../../../sheep/api/promotion/coupon.js");
  37. require("../../../sheep/store/sys.js");
  38. require("../../../sheep/store/modal.js");
  39. require("../../../sheep/api/distri/share.js");
  40. require("../../../sheep/api/distri/team.js");
  41. require("../../../sheep/api/infra/file.js");
  42. require("../../../sheep/api/member/address.js");
  43. require("../../../sheep/api/member/point.js");
  44. require("../../../sheep/api/migration/app.js");
  45. require("../../../sheep/api/migration/chat.js");
  46. require("../../../sheep/api/migration/index.js");
  47. require("../../../sheep/api/migration/third.js");
  48. require("../../../sheep/api/pay/channel.js");
  49. require("../../../sheep/api/product/category.js");
  50. require("../../../sheep/api/product/comment.js");
  51. require("../../../sheep/api/product/favorite.js");
  52. require("../../../sheep/api/product/history.js");
  53. require("../../../sheep/api/product/spu.js");
  54. require("../../../sheep/api/promotion/activity.js");
  55. require("../../../sheep/api/promotion/article.js");
  56. require("../../../sheep/api/promotion/combination.js");
  57. require("../../../sheep/api/promotion/rewardActivity.js");
  58. require("../../../sheep/api/promotion/seckill.js");
  59. require("../../../sheep/api/system/area.js");
  60. require("../../../sheep/api/system/voice.js");
  61. require("../../../sheep/api/trade/afterSale.js");
  62. require("../../../sheep/api/trade/brokerage.js");
  63. require("../../../sheep/api/trade/config.js");
  64. require("../../../sheep/api/trade/delivery.js");
  65. require("../../../sheep/config/zIndex.js");
  66. require("../../../sheep/util/index.js");
  67. if (!Array) {
  68. const _easycom_s_count_down2 = common_vendor.resolveComponent("s-count-down");
  69. const _easycom_s_layout2 = common_vendor.resolveComponent("s-layout");
  70. (_easycom_s_count_down2 + _easycom_s_layout2)();
  71. }
  72. const _easycom_s_count_down = () => "../../../sheep/components/s-count-down/s-count-down.js";
  73. const _easycom_s_layout = () => "../../../sheep/components/s-layout/s-layout.js";
  74. if (!Math) {
  75. (_easycom_s_count_down + _easycom_s_layout)();
  76. }
  77. const _sfc_main = {
  78. __name: "list",
  79. setup(__props) {
  80. const state = common_vendor.reactive({
  81. navH: "",
  82. returnShow: true,
  83. // ========== 砍价记录概要的相关变量 ==========
  84. bargainTotal: 0,
  85. bargainSuccessList: [],
  86. // ========== 砍价活动的相关变量 ==========
  87. bargainList: [],
  88. page: 1,
  89. limit: 10,
  90. loading: false,
  91. loadend: false,
  92. bgColor: {
  93. "bgColor": "#E93323",
  94. "Color": "#fff",
  95. "width": "44rpx",
  96. "timeTxtwidth": "16rpx",
  97. "isDay": true
  98. },
  99. loadTitle: "加载更多"
  100. });
  101. async function getBargainHeader() {
  102. let {
  103. code,
  104. data
  105. } = await sheep_api_promotion_bargain.BargainApi.getBargainRecordSummary();
  106. if (code == 0) {
  107. state.bargainTotal = data.successUserCount;
  108. state.bargainSuccessList = data.successList;
  109. } else {
  110. state.$util.Tips({
  111. title: data
  112. });
  113. }
  114. }
  115. async function getBargainList() {
  116. if (state.loadend || state.loading) {
  117. return;
  118. }
  119. state.loading = true;
  120. state.loadTitle = "";
  121. let {
  122. data,
  123. code
  124. } = await sheep_api_promotion_bargain.BargainApi.getBargainActivityPage({
  125. pageNo: state.page,
  126. pageSize: state.limit
  127. });
  128. if (code == 0) {
  129. const list = data.list;
  130. common_vendor._.concat(state.bargainList, list);
  131. const loadend = list.length < state.limit;
  132. state.loadend = loadend;
  133. state.loading = false;
  134. state.loadTitle = loadend ? "已全部加载" : "加载更多";
  135. state.bargainList = data.list;
  136. state.page = state.page + 1;
  137. } else {
  138. state.loading = false;
  139. state.loadTitle = "加载更多";
  140. }
  141. }
  142. function openSubscribe(e) {
  143. console.log("跳转");
  144. console.log(e);
  145. sheep_index.sheep.$router.go(e);
  146. return;
  147. }
  148. common_vendor.onLoad(function() {
  149. getBargainHeader();
  150. getBargainList();
  151. });
  152. common_vendor.onReachBottom(() => {
  153. getBargainList();
  154. });
  155. return (_ctx, _cache) => {
  156. return common_vendor.e({
  157. a: common_vendor.f(state.bargainSuccessList, (item, index, i0) => {
  158. return {
  159. a: item.avatar,
  160. b: common_vendor.t(item.nickname),
  161. c: common_vendor.t(item.activityName),
  162. d: index
  163. };
  164. }),
  165. b: common_vendor.t(state.bargainTotal),
  166. c: common_vendor.f(state.bargainList, (item, index, i0) => {
  167. return common_vendor.e({
  168. a: item.picUrl,
  169. b: common_vendor.t(item.name),
  170. c: "7572db9c-1-" + i0 + ",7572db9c-0",
  171. d: common_vendor.p({
  172. tipText: " ",
  173. bgColor: state.bgColor,
  174. dayText: ":",
  175. hourText: ":",
  176. minuteText: ":",
  177. secondText: " ",
  178. datatime: item.endTime / 1e3,
  179. isDay: true
  180. }),
  181. e: item.stock === 0
  182. }, item.stock === 0 ? {
  183. f: common_vendor.o(($event) => openSubscribe("/pages/activity/goods_bargain_details/index?id=" + item.id + "&startBargainUid=" + _ctx.uid), index)
  184. } : {}, {
  185. g: common_vendor.t(common_vendor.unref(sheep_hooks_useGoods.fen2yuan)(item.bargainMinPrice)),
  186. h: item.stock > 0
  187. }, item.stock > 0 ? {} : {}, {
  188. i: item.stock === 0
  189. }, item.stock === 0 ? {} : {}, {
  190. j: common_vendor.o(($event) => openSubscribe("/pages/activity/bargain/detail?id=" + item.id), index),
  191. k: index
  192. });
  193. }),
  194. d: state.bargainList.length > 0
  195. }, state.bargainList.length > 0 ? {
  196. e: !_ctx.loading,
  197. f: common_vendor.t(state.loadTitle)
  198. } : {}, {
  199. g: common_vendor.p({
  200. navbar: "inner",
  201. title: "砍价列表"
  202. })
  203. });
  204. };
  205. }
  206. };
  207. const MiniProgramPage = /* @__PURE__ */ common_vendor._export_sfc(_sfc_main, [["__scopeId", "data-v-7572db9c"], ["__file", "D:/zx/mall-front-app/pages/activity/bargain/list.vue"]]);
  208. wx.createPage(MiniProgramPage);