detail.js 5.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142
  1. "use strict";
  2. const common_vendor = require("../../../common/vendor.js");
  3. require("../../../sheep/index.js");
  4. const sheep_api_promotion_bargain = require("../../../sheep/api/promotion/bargain.js");
  5. require("../../../sheep/url/index.js");
  6. require("../../../sheep/store/index.js");
  7. require("../../../sheep/store/app.js");
  8. require("../../../sheep/api/promotion/diy.js");
  9. require("../../../sheep/request/index.js");
  10. require("../../../sheep/config/index.js");
  11. require("../../../sheep/platform/index.js");
  12. require("../../../sheep/platform/provider/wechat/index.js");
  13. require("../../../sheep/platform/provider/wechat/miniProgram.js");
  14. require("../../../sheep/api/member/auth.js");
  15. require("../../../sheep/api/member/social.js");
  16. require("../../../sheep/api/member/user.js");
  17. require("../../../sheep/platform/provider/apple/index.js");
  18. require("../../../sheep/platform/share.js");
  19. require("../../../sheep/router/index.js");
  20. require("../../../sheep/hooks/useModal.js");
  21. require("../../../sheep/helper/index.js");
  22. require("../../../sheep/helper/test.js");
  23. require("../../../sheep/helper/digit.js");
  24. require("../../../sheep/helper/throttle.js");
  25. require("../../../sheep/platform/pay.js");
  26. require("../../../sheep/api/pay/order.js");
  27. require("../../../sheep/store/user.js");
  28. require("../../../sheep/store/cart.js");
  29. require("../../../sheep/api/trade/cart.js");
  30. require("../../../sheep/api/pay/wallet.js");
  31. require("../../../sheep/api/trade/order.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_s_count_down2 = common_vendor.resolveComponent("s-count-down");
  38. const _easycom_s_layout2 = common_vendor.resolveComponent("s-layout");
  39. (_easycom_s_count_down2 + _easycom_s_layout2)();
  40. }
  41. const _easycom_s_count_down = () => "../../../sheep/components/s-count-down/s-count-down.js";
  42. const _easycom_s_layout = () => "../../../sheep/components/s-layout/s-layout.js";
  43. if (!Math) {
  44. (_easycom_s_count_down + _easycom_s_layout)();
  45. }
  46. const _sfc_main = {
  47. __name: "detail",
  48. setup(__props) {
  49. const state = common_vendor.reactive({
  50. id: "",
  51. buyPrice: "",
  52. bargainInfo: {},
  53. bgColor: {
  54. "bgColor": "#333333",
  55. "Color": "#fff",
  56. "width": "44rpx",
  57. "timeTxtwidth": "16rpx",
  58. "isDay": true
  59. },
  60. bargainUserHelpList: [],
  61. couponsHidden: true
  62. });
  63. async function getBargainDetails() {
  64. let {
  65. data,
  66. code
  67. } = await sheep_api_promotion_bargain.BargainApi.getBargainActivityDetail({
  68. id: state.id
  69. });
  70. if (code == 0) {
  71. state.bargainInfo = data;
  72. state.buyPrice = state.bargainInfo.bargainFirstPrice;
  73. }
  74. }
  75. common_vendor.onLoad(function(options) {
  76. if (options.hasOwnProperty("id")) {
  77. options.id ? state.id = options.id : state.id = "";
  78. }
  79. getBargainDetails();
  80. });
  81. function fen2yuan(price) {
  82. return (price / 100).toFixed(2);
  83. }
  84. return (_ctx, _cache) => {
  85. return common_vendor.e({
  86. a: state.bargainInfo.picUrl,
  87. b: common_vendor.t(state.bargainInfo.name),
  88. c: common_vendor.t(fen2yuan(state.bargainInfo.bargainMinPrice)),
  89. d: common_vendor.t(state.bargainInfo.stock),
  90. e: common_vendor.t(state.bargainInfo.unitName),
  91. f: common_vendor.t(fen2yuan(state.buyPrice)),
  92. g: state.bargainInfo.endTime > (/* @__PURE__ */ new Date()).getTime() && state.bargainInfo.stock > 0
  93. }, state.bargainInfo.endTime > (/* @__PURE__ */ new Date()).getTime() && state.bargainInfo.stock > 0 ? {
  94. h: common_vendor.p({
  95. tipText: " ",
  96. bgColor: state.bgColor,
  97. dayText: ":",
  98. hourText: ":",
  99. minuteText: ":",
  100. secondText: " ",
  101. datatime: state.bargainInfo.endTime / 1e3,
  102. isDay: true
  103. })
  104. } : state.bargainInfo.endTime <= (/* @__PURE__ */ new Date()).getTime() ? {
  105. j: common_vendor.o((...args) => _ctx.currentBargainUser && _ctx.currentBargainUser(...args))
  106. } : state.bargainInfo.stock <= 0 ? {
  107. l: common_vendor.o((...args) => _ctx.currentBargainUser && _ctx.currentBargainUser(...args))
  108. } : {}, {
  109. i: state.bargainInfo.endTime <= (/* @__PURE__ */ new Date()).getTime(),
  110. k: state.bargainInfo.stock <= 0,
  111. m: common_vendor.o((...args) => _ctx.goProduct && _ctx.goProduct(...args)),
  112. n: state.bargainUserHelpList.length > 0
  113. }, state.bargainUserHelpList.length > 0 ? common_vendor.e({
  114. o: _ctx.index < 3 || !state.couponsHidden
  115. }, _ctx.index < 3 || !state.couponsHidden ? {
  116. p: common_vendor.f(state.bargainUserHelpList, (item, index, i0) => {
  117. return {
  118. a: item.avatar,
  119. b: common_vendor.t(item.nickname),
  120. c: common_vendor.t(_ctx.formatDate(item.createTime)),
  121. d: common_vendor.t(fen2yuan(item.reducePrice)),
  122. e: index
  123. };
  124. })
  125. } : {}, {
  126. q: state.bargainUserHelpList.length > 3
  127. }, state.bargainUserHelpList.length > 3 ? {
  128. r: common_vendor.t(state.couponsHidden ? "展开更多" : "关闭展开"),
  129. s: common_vendor.n(state.couponsHidden ? "icon-xiangxia" : "icon-xiangshang"),
  130. t: common_vendor.o((...args) => _ctx.openTap && _ctx.openTap(...args))
  131. } : {}) : {}, {
  132. v: state.bargainUserHelpList.length === 0
  133. }, state.bargainUserHelpList.length === 0 ? {} : {}, {
  134. w: common_vendor.p({
  135. title: "砍价详情"
  136. })
  137. });
  138. };
  139. }
  140. };
  141. const MiniProgramPage = /* @__PURE__ */ common_vendor._export_sfc(_sfc_main, [["__scopeId", "data-v-6d33792e"], ["__file", "/Users/RuHu.Xu/Desktop/mall-newfeifan-zx-app/pages/activity/bargain/detail.vue"]]);
  142. wx.createPage(MiniProgramPage);