fight-detail.vue 6.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229
  1. <template>
  2. <view class="fight-detail">
  3. <view class="row">
  4. <view class="fight-tip">
  5. <view class="success" v-if="success">恭喜您,拼团成功!</view>
  6. <view v-else>还差<text>1</text>人,赶快邀请好友来拼单吧!</view>
  7. </view>
  8. <!-- 成功 -->
  9. <template v-if="success">
  10. <user-list></user-list>
  11. </template>
  12. <!-- 等待完成 -->
  13. <template v-else>
  14. <!-- 倒计时 -->
  15. <countdown-box></countdown-box>
  16. </template>
  17. <!-- 操作 -->
  18. <view class="fight-control success" v-if="success">
  19. <view class="btn type1" @click="handleClick(1)">去首页逛逛</view>
  20. <view class="link" @click="handleClick(3)">查看订单详情 ></view>
  21. </view>
  22. <view class="fight-control" v-else>
  23. <button class="btn type1" @click="handleClick(2)">邀请好友拼单</button>
  24. <view class="btn type2" @click="handleClick(1)">去首页逛逛</view>
  25. </view>
  26. <!-- 商品 + 用户信息 -->
  27. <template v-if="!success">
  28. <view class="grid"></view>
  29. <!-- 拼单用户列表 -->
  30. <user-list></user-list>
  31. <view class="line"></view>
  32. <view class="goods-info">
  33. <image src="https://picsum.photos/100/100?random=3" class="cover"></image>
  34. <view class="title">肌本演绎360愉悦修护套组 PLUS 尊享版防晒修复 补水保湿</view>
  35. </view>
  36. </template>
  37. </view>
  38. </view>
  39. </template>
  40. <script>
  41. import UserList from './components/user-list.vue'
  42. import CountdownBox from './components/countdown-box.vue'
  43. export default {
  44. components: {
  45. UserList,
  46. CountdownBox
  47. },
  48. computed:{
  49. success(){
  50. return true
  51. }
  52. },
  53. data(){
  54. return{}
  55. },
  56. onShareTimeline(e) {
  57. // 加密参数
  58. const shareData = {
  59. type: 4,
  60. inviteUserId: this.userId
  61. }
  62. // 加密
  63. const state_str = encodeURIComponent(this.$crypto.encrypt(shareData))
  64. return {
  65. title: '哈喽,赶快来参团吧!这件商品拼团买更便宜~~',
  66. path: `pages/tabBar/index/index?state_str=${state_str}`,
  67. imageUrl: 'https://picsum.photos/400/400?random=3'
  68. }
  69. },
  70. onShareAppMessage(e) {
  71. // 加密参数
  72. const shareData = {
  73. type: 4,
  74. inviteUserId: this.userId
  75. }
  76. // 加密
  77. const state_str = encodeURIComponent(this.$crypto.encrypt(shareData))
  78. return {
  79. title: '哈喽,赶快来参团吧!这件商品拼团买更便宜~~',
  80. path: `pages/tabBar/index/index?state_str=${state_str}`,
  81. imageUrl: 'https://picsum.photos/400/400?random=3'
  82. }
  83. },
  84. methods:{
  85. handleClick(type){
  86. const clickFunc = {
  87. 1: this.toHome,
  88. 2: this.toShare,
  89. 3: this.toOrder
  90. }
  91. clickFunc[type].apply(this)
  92. },
  93. // 跳转首页
  94. toHome(){
  95. console.log('首页')
  96. },
  97. // 分享
  98. toShare(){
  99. console.log('分享')
  100. },
  101. // 跳转订单
  102. toOrder(){
  103. console.log('订单')
  104. }
  105. }
  106. }
  107. </script>
  108. <style lang="scss" scoped>
  109. /* scss中可以用mixin来扩展 */
  110. @mixin ellipsis($line: 1) {
  111. overflow: hidden;
  112. text-overflow: ellipsis;
  113. display: -webkit-box;
  114. -webkit-line-clamp: $line;
  115. -webkit-box-orient: vertical;
  116. }
  117. .flex-center-box {
  118. display: flex;
  119. justify-content: center;
  120. align-items: center;
  121. }
  122. .fight-detail {
  123. background: #f7f7f7;
  124. min-height: 100vh;
  125. .row{
  126. background: #fff;
  127. overflow: hidden;
  128. }
  129. .fight-tip {
  130. @extend .flex-center-box;
  131. margin-top: 70rpx;
  132. margin-bottom: 48rpx;
  133. font-size: 30rpx;
  134. font-weight: 400;
  135. color: #333333;
  136. text {
  137. color: #ff457b;
  138. }
  139. .success{
  140. font-size: 34rpx;
  141. color: #333333;
  142. font-weight: bold;
  143. }
  144. }
  145. .fight-control {
  146. display: flex;
  147. justify-content: center;
  148. align-items: center;
  149. flex-direction: column;
  150. margin-top: 48rpx;
  151. margin-bottom: 48rpx;
  152. .success{
  153. margin-bottom: 66rpx;
  154. }
  155. .link{
  156. margin-top: 24rpx;
  157. font-size: 26rpx;
  158. line-height: 38rpx;
  159. color: #999999;
  160. }
  161. .btn {
  162. @extend .flex-center-box;
  163. width: 600rpx;
  164. height: 90rpx;
  165. border-radius: 45rpx;
  166. box-sizing: border-box;
  167. font-size: 30rpx;
  168. &.type1 {
  169. color: #ffffff;
  170. background: linear-gradient(90deg, #fc32b4 0%, #f83c6c 100%);
  171. }
  172. &.type2 {
  173. margin-top: 24rpx;
  174. color: #ff457b;
  175. border: 1px solid #ff457b;
  176. }
  177. }
  178. }
  179. .grid {
  180. margin: 48rpx 0 48rpx;
  181. width: 750rpx;
  182. height: 20rpx;
  183. background: #f7f7f7;
  184. }
  185. .line {
  186. width: 702rpx;
  187. height: 1px;
  188. margin: 48rpx auto 48rpx auto;
  189. background: #e1e1e1;
  190. }
  191. .goods-info {
  192. @extend .flex-center-box;
  193. padding: 0 24rpx 48rpx;
  194. .cover {
  195. width: 80rpx;
  196. height: 80rpx;
  197. background: eee;
  198. border: 1rpx solid #e1e1e1;
  199. border-radius: 8rpx;
  200. border: 50%;
  201. }
  202. .title {
  203. flex: 1;
  204. margin-left: 24rpx;
  205. word-break: break-word;
  206. font-size: 26rpx;
  207. line-height: 1.6;
  208. color: #333333;
  209. text-align: justify;
  210. @include ellipsis(2);
  211. }
  212. }
  213. }
  214. </style>