detail.js 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272
  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_hooks_useModal = require("../../../sheep/hooks/useModal.js");
  6. const sheep_api_promotion_combination = require("../../../sheep/api/promotion/combination.js");
  7. require("../../../sheep/url/index.js");
  8. require("../../../sheep/store/index.js");
  9. require("../../../sheep/store/app.js");
  10. require("../../../sheep/api/promotion/diy.js");
  11. require("../../../sheep/request/index.js");
  12. require("../../../sheep/config/index.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/helper/throttle.js");
  23. require("../../../sheep/platform/pay.js");
  24. require("../../../sheep/helper/index.js");
  25. require("../../../sheep/helper/test.js");
  26. require("../../../sheep/helper/digit.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/trade/order.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. require("../../../sheep/util/index.js");
  38. if (!Array) {
  39. const _easycom_s_goods_item2 = common_vendor.resolveComponent("s-goods-item");
  40. const _easycom_s_select_groupon_sku2 = common_vendor.resolveComponent("s-select-groupon-sku");
  41. const _easycom_s_empty2 = common_vendor.resolveComponent("s-empty");
  42. const _easycom_s_layout2 = common_vendor.resolveComponent("s-layout");
  43. (_easycom_s_goods_item2 + _easycom_s_select_groupon_sku2 + _easycom_s_empty2 + _easycom_s_layout2)();
  44. }
  45. const _easycom_s_goods_item = () => "../../../sheep/components/s-goods-item/s-goods-item.js";
  46. const _easycom_s_select_groupon_sku = () => "../../../sheep/components/s-select-groupon-sku/s-select-groupon-sku.js";
  47. const _easycom_s_empty = () => "../../../sheep/components/s-empty/s-empty.js";
  48. const _easycom_s_layout = () => "../../../sheep/components/s-layout/s-layout.js";
  49. if (!Math) {
  50. (_easycom_s_goods_item + _easycom_s_select_groupon_sku + _easycom_s_empty + _easycom_s_layout)();
  51. }
  52. const _sfc_main = {
  53. __name: "detail",
  54. setup(__props) {
  55. common_vendor.useCssVars((_ctx) => ({
  56. "37930634": common_vendor.unref(headerBg)
  57. }));
  58. const headerBg = sheep_index.sheep.$url.css("/static/img/shop/user/withdraw_bg.png");
  59. const statusBarHeight = sheep_index.sheep.$platform.device.statusBarHeight * 2;
  60. const state = common_vendor.reactive({
  61. data: {},
  62. // 拼团详情
  63. loading: true,
  64. grouponAction: "create",
  65. showSelectSku: false,
  66. grouponNum: 0,
  67. number: 0,
  68. activity: {},
  69. combinationHeadId: null
  70. // 拼团团长编号
  71. });
  72. const shareInfo = common_vendor.computed(() => {
  73. var _a, _b, _c;
  74. if (common_vendor.lodashExports.isEmpty(state.data))
  75. return {};
  76. return sheep_index.sheep.$platform.share.getShareInfo(
  77. {
  78. title: state.data.headRecord.spuName,
  79. image: sheep_index.sheep.$url.cdn(state.data.headRecord.picUrl),
  80. desc: (_a = state.data.goods) == null ? void 0 : _a.subtitle,
  81. params: {
  82. page: "5",
  83. query: state.data.id
  84. }
  85. },
  86. {
  87. type: "groupon",
  88. // 邀请拼团海报
  89. title: state.data.headRecord.spuName,
  90. // 商品标题
  91. image: sheep_index.sheep.$url.cdn(state.data.headRecord.picUrl),
  92. // 商品主图
  93. price: (_b = state.data.goods) == null ? void 0 : _b.price,
  94. // 商品价格
  95. original_price: (_c = state.data.goods) == null ? void 0 : _c.original_price
  96. // 商品原价
  97. }
  98. );
  99. });
  100. function onDetail(orderId) {
  101. sheep_index.sheep.$router.go("/pages/order/detail", {
  102. id: orderId
  103. });
  104. }
  105. function onCreateGroupon() {
  106. state.grouponAction = "create";
  107. state.grouponId = 0;
  108. state.showSelectSku = true;
  109. }
  110. function onSkuChange(e) {
  111. state.selectedSkuPrice = e;
  112. }
  113. function onJoinGroupon() {
  114. state.grouponAction = "join";
  115. state.grouponId = state.data.activityId;
  116. state.combinationHeadId = state.data.id;
  117. state.grouponNum = state.data.num;
  118. state.showSelectSku = true;
  119. }
  120. function onBuy(sku) {
  121. sheep_index.sheep.$router.go("/pages/order/confirm", {
  122. data: JSON.stringify({
  123. order_type: "goods",
  124. combinationActivityId: state.data.activity.id,
  125. combinationHeadId: state.combinationHeadId,
  126. items: [
  127. {
  128. skuId: sku.id,
  129. count: sku.count
  130. }
  131. ]
  132. })
  133. });
  134. }
  135. const endTime = common_vendor.computed(() => {
  136. return sheep_hooks_useGoods.useDurationTime(state.data.headRecord.expireTime);
  137. });
  138. async function getGrouponDetail(id) {
  139. const { code, data } = await sheep_api_promotion_combination.CombinationApi.getCombinationRecordDetail(id);
  140. if (code === 0) {
  141. state.data = data;
  142. const remainNumber = Number(state.data.headRecord.userSize - state.data.headRecord.userCount);
  143. state.remainNumber = remainNumber > 0 ? remainNumber : 0;
  144. const { data: activity } = await sheep_api_promotion_combination.CombinationApi.getCombinationActivity(data.headRecord.activityId);
  145. state.activity = activity;
  146. } else {
  147. state.data = null;
  148. }
  149. state.loading = false;
  150. }
  151. function onShare() {
  152. sheep_hooks_useModal.showShareModal();
  153. }
  154. common_vendor.onLoad((options) => {
  155. getGrouponDetail(options.id);
  156. });
  157. return (_ctx, _cache) => {
  158. return common_vendor.e({
  159. a: state.loading
  160. }, state.loading ? {} : {}, {
  161. b: state.data && !state.loading
  162. }, state.data && !state.loading ? common_vendor.e({
  163. c: state.data.headRecord
  164. }, state.data.headRecord ? {
  165. d: common_vendor.t(state.data.headRecord.userSize),
  166. e: common_vendor.t(state.data.headRecord.userCount),
  167. f: common_vendor.o(($event) => common_vendor.unref(sheep_index.sheep).$router.go("/pages/goods/groupon", {
  168. id: state.data.headRecord.activityId
  169. })),
  170. g: common_vendor.s({
  171. top: Number(statusBarHeight + 108) + "rpx"
  172. }),
  173. h: common_vendor.p({
  174. img: state.data.headRecord.picUrl,
  175. title: state.data.headRecord.spuName,
  176. price: state.data.headRecord.combinationPrice,
  177. priceColor: "#E1212B"
  178. }),
  179. i: common_vendor.s({
  180. marginTop: "-" + Number(statusBarHeight + 88) + "rpx",
  181. paddingTop: Number(statusBarHeight + 108) + "rpx"
  182. })
  183. } : {}, {
  184. j: state.data.headRecord.status === 1
  185. }, state.data.headRecord.status === 1 ? common_vendor.e({
  186. k: state.data.orderId
  187. }, state.data.orderId ? {} : {}) : {}, {
  188. l: state.data.headRecord.status === 2
  189. }, state.data.headRecord.status === 2 ? {
  190. m: common_vendor.t(state.data.orderId ? "拼团超时,已自动退款" : "该团已解散")
  191. } : {}, {
  192. n: state.data.headRecord.status === 0
  193. }, state.data.headRecord.status === 0 ? common_vendor.e({
  194. o: state.data.headRecord.expireTime <= (/* @__PURE__ */ new Date()).getTime()
  195. }, state.data.headRecord.expireTime <= (/* @__PURE__ */ new Date()).getTime() ? {} : {
  196. p: common_vendor.t(state.data.headRecord.userSize - state.data.headRecord.userCount),
  197. q: common_vendor.t(common_vendor.unref(endTime).h),
  198. r: common_vendor.t(common_vendor.unref(endTime).m),
  199. s: common_vendor.t(common_vendor.unref(endTime).s)
  200. }) : {}, {
  201. t: common_vendor.unref(sheep_index.sheep).$url.cdn(state.data.headRecord.avatar),
  202. v: common_vendor.f(state.data.memberRecords, (item, k0, i0) => {
  203. return common_vendor.e({
  204. a: common_vendor.unref(sheep_index.sheep).$url.cdn(item.avatar),
  205. b: item.is_leader == "1"
  206. }, item.is_leader == "1" ? {} : {}, {
  207. c: item.id
  208. });
  209. }),
  210. w: common_vendor.f(state.remainNumber, (item, k0, i0) => {
  211. return {
  212. a: item
  213. };
  214. }),
  215. x: common_vendor.unref(sheep_index.sheep).$url.static("/static/img/shop/avatar/unknown.png"),
  216. y: state.data.headRecord.status === 1 || state.data.headRecord.status === 2
  217. }, state.data.headRecord.status === 1 || state.data.headRecord.status === 2 ? common_vendor.e({
  218. z: state.data.orderId
  219. }, state.data.orderId ? {
  220. A: common_vendor.o(($event) => onDetail(state.data.orderId))
  221. } : {
  222. B: common_vendor.o(onCreateGroupon)
  223. }) : {}, {
  224. C: state.data.headRecord.status === 0
  225. }, state.data.headRecord.status === 0 ? common_vendor.e({
  226. D: state.data.headRecord.expireTime <= (/* @__PURE__ */ new Date()).getTime()
  227. }, state.data.headRecord.expireTime <= (/* @__PURE__ */ new Date()).getTime() ? common_vendor.e({
  228. E: state.data.orderId
  229. }, state.data.orderId ? {
  230. F: common_vendor.o(($event) => onDetail(state.data.orderId))
  231. } : {
  232. G: common_vendor.o(($event) => onDetail(state.data.orderId))
  233. }) : common_vendor.e({
  234. H: state.data.orderId
  235. }, state.data.orderId ? {
  236. I: common_vendor.unref(endTime).ms <= 0,
  237. J: common_vendor.o(onShare)
  238. } : {
  239. K: common_vendor.unref(endTime).ms <= 0,
  240. L: common_vendor.o(($event) => onJoinGroupon())
  241. })) : {}, {
  242. M: state.data.goods
  243. }, state.data.goods ? {
  244. N: common_vendor.o(onBuy),
  245. O: common_vendor.o(onSkuChange),
  246. P: common_vendor.o(($event) => state.showSelectSku = false),
  247. Q: common_vendor.p({
  248. show: state.showSelectSku,
  249. goodsInfo: state.data.goods,
  250. grouponAction: state.grouponAction,
  251. grouponNum: state.grouponNum
  252. })
  253. } : {}) : {}, {
  254. R: !state.data && !state.loading
  255. }, !state.data && !state.loading ? {
  256. S: common_vendor.p({
  257. icon: "/static/goods-empty.png"
  258. })
  259. } : {}, {
  260. T: common_vendor.s(_ctx.__cssVars()),
  261. U: common_vendor.p({
  262. title: "拼团详情",
  263. navbar: state.data && !state.loading ? "inner" : "normal",
  264. onShareAppMessage: common_vendor.unref(shareInfo)
  265. })
  266. });
  267. };
  268. }
  269. };
  270. const MiniProgramPage = /* @__PURE__ */ common_vendor._export_sfc(_sfc_main, [["__scopeId", "data-v-f4b0e588"], ["__file", "/Users/RuHu.Xu/Desktop/mall-newfeifan-zx-app/pages/activity/groupon/detail.vue"]]);
  271. _sfc_main.__runtimeHooks = 2;
  272. wx.createPage(MiniProgramPage);