detail.js 12 KB

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