detail.js 11 KB

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