detail.vue 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371
  1. <!-- 拼团详情 -->
  2. <template>
  3. <view class="page_box">
  4. <!-- 商品卡片 -->
  5. <view class="head_box">
  6. <view class="goods-card u-p-x-20 u-p-y-40" v-if="grouponDetail.id">
  7. <shopro-mini-card
  8. :title="grouponDetail.goods.title"
  9. :image="grouponDetail.goods.image"
  10. :subtitle="grouponDetail.goods.subtitle"
  11. :price="grouponDetail.goods.groupon_price"
  12. :originPrice="grouponDetail.goods.original_price"
  13. >
  14. <template #describe>
  15. <view class="u-flex u-m-b-20">
  16. <view class="sell-box">
  17. <text class=" hot-icon iconfont icon-icon-test"></text>
  18. <text class="sell-num">已拼{{ grouponDetail.goods.sales }}件</text>
  19. </view>
  20. <text class="group-num">{{ grouponDetail.num || 0 }}人团</text>
  21. </view>
  22. </template>
  23. </shopro-mini-card>
  24. </view>
  25. </view>
  26. <view class="content_box">
  27. <view class="u-flex-col u-row-between group-box">
  28. <!-- 拼团成功 -->
  29. <view class="u-flex u-row-center u-col-center" v-if="grouponDetail.status === 'finish' || grouponDetail.status === 'finish-fictitious'">
  30. <view class="tip-box u-flex" v-if="grouponDetail.my">
  31. <view class="u-iconfont uicon-checkmark-circle-fill u-m-r-10" style="color:#42B111;font-size:34rpx ;"></view>
  32. <text>恭喜您~拼团成功!</text>
  33. </view>
  34. <view class="tip-box u-flex" v-else>
  35. <view class="u-iconfont uicon-close-circle-fill u-m-r-10" style="color:#E1212B;font-size:34rpx ;"></view>
  36. <text>对不起~您来晚了,该团已满</text>
  37. </view>
  38. </view>
  39. <!-- 拼团失败-->
  40. <view class="u-flex u-row-center u-col-center" v-if="grouponDetail.status === 'invalid'">
  41. <view class="tip-box u-flex">
  42. <view class="u-iconfont uicon-close-circle-fill u-m-r-10" style="color:#E1212B;font-size:34rpx ;"></view>
  43. <text>{{ grouponDetail.my ? '对不起~拼团已过期!已全额退款' : '对不起~拼团已过期!您来晚了~' }}</text>
  44. </view>
  45. </view>
  46. <!-- 拼团中 -->
  47. <view class="title-box u-flex u-row-center u-col-center" v-if="grouponDetail.status === 'ing'">
  48. <!-- 活动结束 -->
  49. <view class="" v-if="grouponDetail.activity_status === 'ended'">
  50. <view class="tip-box u-flex u-col-center">
  51. <view class="u-iconfont uicon-close-circle-fill u-m-r-10" style="color:#E1212B;font-size:34rpx ;"></view>
  52. <text>对不起~拼团活动已结束!您来晚了~</text>
  53. </view>
  54. </view>
  55. <view v-else class="u-flex u-col-center">
  56. <view class="title-text">
  57. 待成团,还差
  58. <text class="group-num">{{ grouponDetail.num - grouponDetail.current_num }}</text>
  59. 人拼团成功
  60. </view>
  61. <view class="count-down u-flex" v-if="time">
  62. <text class="count-down-tip">倒计时</text>
  63. <view class="time-box u-flex">
  64. <view class="count-text">{{ time.h || '00' }}</view>
  65. :
  66. <view class="count-text">{{ time.m || '00' }}</view>
  67. :
  68. <view class="count-text">{{ time.s || '00' }}</view>
  69. </view>
  70. </view>
  71. </view>
  72. </view>
  73. <!-- 拼团人 -->
  74. <view class="group-people u-flex u-row-center">
  75. <view class="img-box" v-for="(team, index) in grouponDetail.groupon_log" :key="team.user_avatar">
  76. <view class="tag" v-if="index == 0">团长</view>
  77. <image class="avatar" :class="{ leader: index == 0 }" :src="team.user_avatar" mode="aspectFill"></image>
  78. </view>
  79. <view class="img-box" v-for="(base, index) in surplusNum" :key="base" v-if="index < 100">
  80. <image class="avatar" :src="$IMG_URL + '/imgs/group/base_group_avatar.png'" mode="aspectFill"></image>
  81. </view>
  82. </view>
  83. <!-- 底部按钮 -->
  84. <view class="btn-box u-flex u-row-center u-col-center">
  85. <!-- 拼团中 -->
  86. <view v-if="grouponDetail.status === 'ing'">
  87. <block v-if="grouponDetail.activity_status === 'ended'">
  88. <button class="u-reset-button btn2" v-if="grouponDetail.my" @tap.stop="jump('/pages/order/detail', { id: grouponDetail.my.order_id })">查看订单</button>
  89. </block>
  90. <block v-else>
  91. <button class="u-reset-button btn1" v-if="grouponDetail.my" @tap="showShare = true">邀请好友参团</button>
  92. <button class="u-reset-button btn1" v-else @tap="showSku = true">立即参团</button>
  93. </block>
  94. </view>
  95. <!-- 拼团成功/失败-->
  96. <view v-if="grouponDetail.status === 'finish' || grouponDetail.status === 'finish-fictitious' || grouponDetail.status === 'invalid'">
  97. <button class="u-reset-button btn2" v-if="grouponDetail.my" @tap.stop="jump('/pages/order/detail', { id: grouponDetail.my.order_id })">查看订单</button>
  98. <button class="u-reset-button btn1" v-else @tap="jump('/pages/goods/detail', { id: grouponDetail.goods_id })">我要开团</button>
  99. </view>
  100. </view>
  101. </view>
  102. <!-- 玩法 -->
  103. <view v-if="activity && activity.id" class="groupon-play u-flex u-row-between u-col-center" @tap="jump('/pages/public/richtext', { id: activity.richtext_id })">
  104. <text class="title">玩法</text>
  105. <view class="u-flex u-col-center">
  106. <view class="description u-ellipsis-1">{{ activity.richtext_title || '开团/参团·邀请好友·人满发货(不满退款' }}</view>
  107. <view class="u-iconfont uicon-arrow-right u-m-r-10" style="color:#999;font-size:28rpx ;"></view>
  108. </view>
  109. </view>
  110. </view>
  111. <!-- 邀请好友 -->
  112. <shopro-share v-model="showShare" :posterInfo="grouponDetail" :posterType="'groupon'"></shopro-share>
  113. <!-- 规格弹窗 -->
  114. <shopro-sku
  115. v-if="grouponDetail.goods"
  116. v-model="showSku"
  117. :activityRules="{ status: grouponDetail.status }"
  118. :goodsInfo="grouponDetail.goods"
  119. :grouponId="grouponDetail.id"
  120. buyType="buy"
  121. grouponBuyType="groupon"
  122. ></shopro-sku>
  123. <!-- 登录提示 -->
  124. <shopro-auth-modal></shopro-auth-modal>
  125. </view>
  126. </template>
  127. <script>
  128. let timer = null;
  129. import share from '@/shopro/share';
  130. export default {
  131. components: {},
  132. data() {
  133. return {
  134. time: 0,
  135. grouponDetail: {},
  136. showShare: false,
  137. showSku: false,
  138. activity: {},
  139. surplusNum: 0 //剩余拼团人数、
  140. };
  141. },
  142. computed: {},
  143. onLoad() {
  144. this.getGrouponDetail();
  145. },
  146. onPullDownRefresh() {
  147. this.getGrouponDetail();
  148. },
  149. onHide() {
  150. clearInterval(timer);
  151. timer = null;
  152. },
  153. onUnload() {
  154. share.setShareInfo();
  155. },
  156. methods: {
  157. // 路由跳转
  158. jump(path, parmas) {
  159. this.$Router.push({
  160. path: path,
  161. query: parmas
  162. });
  163. },
  164. // 倒计时
  165. countDown(t) {
  166. const that = this;
  167. timer = setInterval(() => {
  168. if (t > 0) {
  169. that.time = that.$tools.format(t);
  170. t--;
  171. } else {
  172. clearInterval(timer);
  173. that.time = false;
  174. }
  175. }, 1000);
  176. },
  177. // 拼团详情
  178. getGrouponDetail() {
  179. let that = this;
  180. that.$http('goods.grouponDetail', {
  181. id: that.$Route.query.id
  182. }).then(res => {
  183. uni.stopPullDownRefresh();
  184. that.grouponDetail = res.data;
  185. that.activity = res.data.activity;
  186. if (that.activity) {
  187. that.activity.richtext_id = parseInt(that.activity.richtext_id);
  188. }
  189. that.surplusNum = res.data.num - res.data.current_num;
  190. let newTime = new Date().getTime();
  191. let endTime = res.data.expiretime * 1000;
  192. let t = endTime - newTime;
  193. that.countDown(t / 1000);
  194. // 设置分享信息
  195. share.setShareInfo({
  196. title: that.grouponDetail.goods.title,
  197. desc: that.grouponDetail.goods.subtitle,
  198. image: that.grouponDetail.goods.image,
  199. params: {
  200. page: 3,
  201. pageId: that.$Route.query.id
  202. }
  203. });
  204. });
  205. }
  206. }
  207. };
  208. </script>
  209. <style lang="scss">
  210. // 商品卡片
  211. .head_box {
  212. background: url($IMG_URL+'/imgs/group/group_detail_bg.png') no-repeat;
  213. background-size: 100% 316rpx;
  214. padding: 60rpx 20rpx 20rpx;
  215. .goods-card {
  216. background-color: #fff;
  217. border-radius: 20rpx;
  218. .group-num {
  219. font-size: 24rpx;
  220. font-weight: 400;
  221. color: rgba(153, 153, 153, 1);
  222. margin-left: 30rpx;
  223. }
  224. .sell-box {
  225. line-height: 32rpx;
  226. background: rgba(255, 224, 226, 0.3);
  227. border-radius: 16rpx;
  228. padding: 0 10rpx;
  229. .hot-icon {
  230. font-size: 26rpx;
  231. color: #e1212b;
  232. margin-right: 8rpx;
  233. }
  234. .sell-num {
  235. font-size: 20rpx;
  236. color: #f7979c;
  237. }
  238. }
  239. }
  240. }
  241. // 拼团人
  242. .group-box {
  243. background: #fff;
  244. padding: 40rpx 0;
  245. min-height: 370rpx;
  246. justify-content: center;
  247. .tip-box {
  248. font-size: 28rpx;
  249. font-weight: bold;
  250. }
  251. .title-box {
  252. font-size: 26rpx;
  253. font-weight: bold;
  254. color: #333;
  255. .group-num {
  256. color: #f8002c;
  257. }
  258. .count-down-tip {
  259. font-size: 24rpx;
  260. padding-left: 10rpx;
  261. }
  262. .time-box {
  263. font-size: 18rpx;
  264. .count-text {
  265. display: inline-block;
  266. background-color: #383a46;
  267. color: #fff;
  268. font-size: 18rpx;
  269. border-radius: 2rpx;
  270. padding: 0 5rpx;
  271. height: 28rpx;
  272. text-align: center;
  273. line-height: 28rpx;
  274. margin: 0 6rpx;
  275. }
  276. }
  277. }
  278. .group-people {
  279. flex-wrap: wrap;
  280. padding: 50rpx;
  281. .img-box {
  282. position: relative;
  283. margin-right: 30rpx;
  284. &:nth-child(6n) {
  285. margin-right: 0;
  286. }
  287. .tag {
  288. position: absolute;
  289. line-height: 36rpx;
  290. background: linear-gradient(132deg, rgba(243, 223, 177, 1), rgba(243, 223, 177, 1), rgba(236, 190, 96, 1));
  291. border-radius: 14rpx;
  292. padding: 0 10rpx;
  293. white-space: nowrap;
  294. font-size: 24rpx;
  295. color: #784f06;
  296. z-index: 2;
  297. top: -20rpx;
  298. left: 50%;
  299. transform: translateX(-50%);
  300. }
  301. .avatar {
  302. width: 80rpx;
  303. height: 80rpx;
  304. border-radius: 50%;
  305. background: #ccc;
  306. }
  307. .leader {
  308. border: 4rpx solid rgba(237, 195, 108, 1);
  309. }
  310. }
  311. }
  312. .btn-box {
  313. width: 750rpx;
  314. .btn1 {
  315. width: 690rpx;
  316. line-height: 70rpx;
  317. background: linear-gradient(90deg, rgba(254, 131, 42, 1), rgba(255, 102, 0, 1));
  318. box-shadow: 0px 7rpx 6rpx 0px rgba(255, 104, 4, 0.22);
  319. border-radius: 35rpx;
  320. font-size: 28rpx;
  321. font-weight: 500;
  322. color: rgba(255, 255, 255, 1);
  323. }
  324. .btn2 {
  325. width: 690rpx;
  326. line-height: 70rpx;
  327. border: 1rpx solid rgba(223, 223, 223, 1);
  328. border-radius: 35rpx;
  329. font-size: 28rpx;
  330. font-weight: 500;
  331. color: rgba(153, 153, 153, 1);
  332. }
  333. }
  334. }
  335. .groupon-play {
  336. height: 94rpx;
  337. border-top: 1rpx solid rgba(#dfdfdf, 0.5);
  338. padding: 0 20rpx;
  339. background: #fff;
  340. .title {
  341. font-size: 28rpx;
  342. color: #999;
  343. }
  344. .description {
  345. font-size: 28rpx;
  346. text-align: right;
  347. }
  348. }
  349. </style>