index.vue 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352
  1. <template>
  2. <page :nav="false" title="参与记录" ref="pageRef" light nav-color="transparent">
  3. <view
  4. class="pagae-nav"
  5. :style="{ paddingTop: statusBarHeight + 'px', background: headerBg }"
  6. >
  7. <view class="flex-align-center relative" style="height: 80rpx">
  8. <text class="cuIcon-back back" @click.stop="back"></text>
  9. <view class="title line-ellipsis">参与记录</view>
  10. </view>
  11. </view>
  12. <view style="height: 40rpx"></view>
  13. <view class="roomList">
  14. <view
  15. v-for="(item, index) in tableData"
  16. @click="showDetail(item)"
  17. :key="index"
  18. class="roomItem"
  19. :class="{ grayscale: item.leftTime < 1 }"
  20. :style="{ backgroundImage: 'url(' + ossurl.welfare.roomBg + ')' }"
  21. >
  22. <view class="luckRoomGoodList">
  23. <swiper
  24. class="moli-swiper"
  25. :indicator-dots="false"
  26. circular="true"
  27. :autoplay="true"
  28. interval="5000"
  29. duration="500"
  30. >
  31. <swiper-item
  32. v-for="(obj, objIndex) in item.luckRoomGoodsList.slice(0, 3)"
  33. :key="index"
  34. >
  35. <image
  36. :key="objIndex"
  37. :src="obj.spu.cover"
  38. mode="aspectFit"
  39. class="item-cover"
  40. />
  41. </swiper-item>
  42. </swiper>
  43. </view>
  44. <view class="infoBox">
  45. <view class="roomName">
  46. {{ item.name }}
  47. </view>
  48. <view class="roomType">
  49. <image :src="TYPE_MAP[item.type].topFlag" class="flag-top" />
  50. <view class="luckSize">{{ item.goodsQuantity }}件赠品</view>
  51. </view>
  52. <view class="roomInfo">
  53. <view class="roomUser">
  54. <image :src="item.cover" mode="scaleToFill" class="icon" />
  55. <view class="nickname">
  56. {{ item.user.nickname }}
  57. </view>
  58. </view>
  59. <view class="roomUserAvatar">
  60. <view class="cu-avatar-group">
  61. <view
  62. class="cu-avatar radius sm"
  63. v-for="user of item.participatingList.slice(0, 5)"
  64. :key="user.userId"
  65. >
  66. <image :src="user.avatar" mode="scaleToFill" class="avatar" />
  67. </view>
  68. </view>
  69. </view>
  70. <view class="fire">
  71. <image :src="ossurl.welfare.fire" mode="scaleToFill" class="fireIcon" />
  72. {{ item.participatingList.length }}
  73. </view>
  74. </view>
  75. </view>
  76. <image
  77. v-if="item.officialFlag == 1"
  78. :src="ossurl.welfare.official"
  79. webp
  80. class="official"
  81. />
  82. <!-- <view class="btn-wrapper flex-align-center">
  83. <text class="color-white font2" v-if="item.myParticipatedFlag === 1">
  84. 已加入
  85. </text>
  86. <text class="font2" v-else>加入房间</text>
  87. </view> -->
  88. <image v-if="item.prizeMode === 1" :src="ossurl.welfare.must" class="must-flag" />
  89. </view>
  90. </view>
  91. <empty v-if="isEmpty" :top="200" light />
  92. </page>
  93. </template>
  94. <script>
  95. import empty from '@/components/empty'
  96. import pageMixin from './../../mixin/page'
  97. import resource from '@/utils/resource'
  98. import loginMixin from '@/mixin/login'
  99. import ossurl from '@/utils/ossurl'
  100. const TYPE_MAP = {
  101. COMMON: {
  102. itemClass: 'item1',
  103. topFlag: ossurl.welfare.welfareIcon,
  104. flag: resource.weal_room_flag1,
  105. btn: resource.weal_btn_1
  106. },
  107. PASSWORD: {
  108. itemClass: 'item2',
  109. topFlag: ossurl.welfare.passwordIcon,
  110. flag: resource.weal_room_flag2,
  111. btn: resource.weal_btn_2
  112. },
  113. ACHIEVEMENT: {
  114. itemClass: 'item3',
  115. topFlag: ossurl.welfare.achieveIcon,
  116. flag: resource.weal_room_flag3,
  117. btn: resource.weal_btn_3
  118. },
  119. EUROPEAN_GAS: {
  120. itemClass: 'item4',
  121. topFlag: ossurl.welfare.europeanIcon,
  122. flag: resource.weal_room_flag4,
  123. btn: resource.weal_btn_4
  124. }
  125. }
  126. export default {
  127. mixins: [pageMixin, loginMixin],
  128. components: { empty },
  129. data() {
  130. return {
  131. TYPE_MAP,
  132. resource,
  133. ossurl,
  134. scrollTop: 0
  135. }
  136. },
  137. computed: {
  138. itemWidth() {
  139. let width = this.$store.state.systemInfo.screenWidth
  140. width = (width - 28 - 20) / 3
  141. let height = (197 / 109) * width
  142. return { width, height }
  143. },
  144. statusBarHeight() {
  145. if (this.$store.state.systemInfo) {
  146. return this.$store.state.systemInfo.statusBarHeight
  147. }
  148. return 20
  149. },
  150. headerBg() {
  151. return this.scrollTop > 0 ? '#fff' : '#fff'
  152. }
  153. },
  154. onPageScroll(e) {
  155. this.scrollTop = e.scrollTop
  156. },
  157. mounted() {
  158. setTimeout(() => {
  159. this.refresh(true)
  160. }, 100)
  161. },
  162. onPullDownRefresh() {
  163. this.refresh()
  164. },
  165. onReachBottom() {
  166. this.loadMore()
  167. },
  168. methods: {
  169. init() {
  170. this.refresh()
  171. },
  172. async loadData(loading) {
  173. const res = await this.$service.weal.record(this.pageNum, this.pageSize, loading)
  174. return res
  175. },
  176. showDetail(item) {
  177. this.$router.push('weal_detail', { id: item.id })
  178. },
  179. back() {
  180. this.$router.back()
  181. }
  182. }
  183. }
  184. </script>
  185. <style></style>
  186. <style lang="scss" scoped>
  187. .pagae-nav {
  188. position: fixed;
  189. left: 0;
  190. top: 0;
  191. width: 100%;
  192. z-index: 100;
  193. align-items: center;
  194. .title {
  195. font-size: 32rpx;
  196. font-weight: bold;
  197. text-align: center;
  198. line-height: 72rpx;
  199. width: 500rpx;
  200. }
  201. .back {
  202. z-index: 1800;
  203. font-size: 32rpx;
  204. line-height: 32rpx;
  205. position: absolute;
  206. left: 20rpx;
  207. top: 24rpx;
  208. }
  209. }
  210. .roomList {
  211. padding: 0 20rpx;
  212. padding-top: 180rpx;
  213. .grayscale {
  214. filter: grayscale(1);
  215. }
  216. .roomItem {
  217. background-color: #fffdf6;
  218. background-size: auto 100%;
  219. background-position: right;
  220. background-repeat: no-repeat;
  221. padding: 20rpx;
  222. margin-bottom: 20rpx;
  223. border-radius: 20rpx;
  224. display: flex;
  225. width: 100%;
  226. position: relative;
  227. .must-flag {
  228. position: absolute;
  229. top: 0;
  230. left: 0;
  231. width: 102rpx;
  232. height: 102rpx;
  233. }
  234. .luckRoomGoodList {
  235. background-color: #fff;
  236. width: 160rpx;
  237. height: 160rpx;
  238. }
  239. .roomName {
  240. font-size: 28rpx;
  241. font-family: Source Han Sans, Source Han Sans;
  242. font-weight: 350;
  243. color: #000000;
  244. line-height: 40rpx;
  245. }
  246. .infoBox {
  247. flex: 1;
  248. }
  249. .item-cover {
  250. width: 164rpx;
  251. height: 164rpx;
  252. }
  253. .roomType {
  254. display: flex;
  255. align-items: center;
  256. padding: 14rpx 0 24rpx 0;
  257. .flag-top {
  258. width: 104rpx;
  259. height: 32rpx;
  260. }
  261. .luckSize {
  262. background: #fff3d5;
  263. font-size: 20rpx;
  264. font-family: Source Han Sans, Source Han Sans;
  265. font-weight: 350;
  266. color: #e8ad00;
  267. line-height: 28rpx;
  268. padding: 2rpx 24rpx;
  269. height: 32rpx;
  270. border-radius: 16rpx;
  271. margin-left: 20rpx;
  272. }
  273. }
  274. .roomInfo {
  275. display: flex;
  276. align-items: center;
  277. justify-content: space-between;
  278. }
  279. .roomUser {
  280. display: flex;
  281. align-items: center;
  282. font-size: 24rpx;
  283. font-family: Source Han Sans, Source Han Sans;
  284. font-weight: 300;
  285. color: #666666;
  286. width: 130rpx;
  287. .icon {
  288. width: 32rpx;
  289. min-width: 32rpx;
  290. height: 32rpx;
  291. border-radius: 50%;
  292. margin-right: 10rpx;
  293. }
  294. .nickname {
  295. width: 88rpx;
  296. text-overflow: ellipsis;
  297. overflow: hidden;
  298. white-space: nowrap;
  299. }
  300. }
  301. .roomUserAvatar {
  302. background: linear-gradient(90deg, #fff1e6 0%, #fff6cd 100%);
  303. border-radius: 24rpx;
  304. padding: 8rpx 16rpx;
  305. padding-left: 26rpx;
  306. .cu-avatar-group {
  307. padding: 0;
  308. }
  309. .avatar {
  310. width: 32rpx;
  311. height: 32rpx;
  312. border-radius: 50%;
  313. }
  314. .cu-avatar {
  315. width: 32rpx;
  316. height: 32rpx;
  317. border-radius: 50%;
  318. border: none;
  319. margin-left: -10rpx;
  320. }
  321. }
  322. .fire {
  323. display: flex;
  324. align-items: center;
  325. font-size: 24rpx;
  326. font-family: Arial, Arial;
  327. font-weight: 400;
  328. color: #000000;
  329. .fireIcon {
  330. width: 32rpx;
  331. height: 32rpx;
  332. }
  333. }
  334. .official {
  335. height: 34rpx;
  336. width: 86rpx;
  337. position: absolute;
  338. right: 0;
  339. top: 0;
  340. }
  341. }
  342. }
  343. </style>