red_list.vue 6.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252
  1. <template>
  2. <view class="page">
  3. <view class="whb-list" v-if="dataList.length">
  4. <view class="whb-item" v-for="item in dataList" :key="item.id">
  5. <view class="whb-item-header">
  6. <image class="user-img" :src="staticPhoto + item.user_info.face"/>
  7. </view>
  8. <view class="whb-item-center">
  9. <view class="name">{{item.user_info.nickname}}</view>
  10. <view class="title">{{item.msg}}</view>
  11. <view class="whb-kai1" @tap="openRedEnvelope(item)">
  12. </view>
  13. </view>
  14. </view>
  15. </view>
  16. <view v-else class="whb-none">
  17. <image src="/static/theme/default/no-get.png"></image>
  18. <view>暂时没有未领红包</view>
  19. <view>超过10分钟未领完的红包在此展示</view>
  20. </view>
  21. <!-- 红包弹窗 -->
  22. <view class="windows" :class="windowsState">
  23. <!-- 遮罩层 -->
  24. <view class="mask" @touchmove.stop.prevent="discard" @tap="closeRedEnvelope"></view>
  25. <view class="layer" @touchmove.stop.prevent="discard">
  26. <view class="open-redenvelope">
  27. <view class="top">
  28. <view class="close-btn">
  29. <view class="icon close" @tap="closeRedEnvelope"></view>
  30. </view>
  31. <image :src="staticPhoto+redenvelopeData.user_info.face" :lazy-load="true"></image>
  32. </view>
  33. <view class="from">来自{{redenvelopeData.user_info.nickname}}的红包</view>
  34. <view class="blessing">{{redenvelopeData.msg}}</view>
  35. <view class="money" @tap="getHongBao(redenvelopeData)">
  36. <image :class="luckbtn" src="/static/theme/default/my/red_2.png" style="width: 180upx; height: 180upx;"></image>
  37. </view>
  38. <view class="showDetails" @tap="toDetails(redenvelopeData.id)">
  39. 查看领取详情
  40. <view class="icon to"></view>
  41. </view>
  42. </view>
  43. </view>
  44. </view>
  45. </view>
  46. </template>
  47. <script>
  48. import _hook from '../../../common/_hook';
  49. import _data from '../../../common/_data';
  50. import _get from '../../../common/_get';
  51. export default {
  52. data () {
  53. return {
  54. list_id: '',
  55. dataList: [
  56. ],
  57. redenvelopeData: {
  58. user_info:{
  59. }
  60. },
  61. luckbtn: '',
  62. windowsState:''
  63. }
  64. },
  65. onShow () {
  66. let _this = this;
  67. _hook.routeSonHook();
  68. _this.getRedList();
  69. },
  70. computed:{
  71. staticPhoto(){
  72. return _data.staticPhoto();
  73. }
  74. },
  75. onLoad (options) {
  76. if ('list_id' in options) {
  77. this.list_id = options.list_id
  78. }
  79. },
  80. methods: {
  81. getRedList(){
  82. let _this = this;
  83. _get.getExpireBigRed({ list_id: this.list_id }, function (res) {
  84. _this.dataList = res
  85. })
  86. },
  87. discard () {
  88. return;
  89. },
  90. myPhoto(info) {
  91. return info.user_info.photo;
  92. },
  93. getHongBao(params){
  94. params.rid = params.id;
  95. let _this = this;
  96. _this.luckbtn = "luckbtn";
  97. uni.showLoading({
  98. title: '加载中...'
  99. });
  100. _get.getHongBao(params, function (ret) {
  101. uni.$emit('data_user_info', ret);
  102. _data.data('user_info', ret);
  103. setTimeout(function () {
  104. uni.hideLoading();
  105. _this.luckbtn = "";
  106. _this.closeRedEnvelope();
  107. _this.toDetails(params.rid);
  108. }, 1000)
  109. }, function (ret) {
  110. setTimeout(function () {
  111. uni.hideLoading();
  112. _this.luckbtn = "";
  113. _this.closeRedEnvelope();
  114. _this.toDetails(params.rid);
  115. }, 1000);
  116. });
  117. },
  118. // 打开红包
  119. openRedEnvelope (bigRed) {
  120. //判断有无领取
  121. // if (this.receive_list.indexOf(msg.content.rid) >= 0) {
  122. // this.toDetails(msg.content.rid);
  123. // return true;
  124. // }
  125. this.windowsState = 'show';
  126. this.redenvelopeData = bigRed
  127. return true;
  128. },
  129. //领取详情
  130. toDetails (rid) {
  131. uni.navigateTo({
  132. url: '../message/details?rid=' + rid + '&list_id=' + this.list_id
  133. })
  134. },
  135. // 关闭红包弹窗
  136. closeRedEnvelope () {
  137. this.windowsState = 'hide';
  138. setTimeout(() => {
  139. this.windowsState = '';
  140. }, 200)
  141. },
  142. }
  143. }
  144. </script>
  145. <style lang="scss">
  146. @import "@/static/css/chat/style.scss";
  147. .luckbtn {
  148. -webkit-transform: rotateY(360deg);
  149. animation: rotation 0.4s linear infinite;
  150. -moz-animation: rotation 0.4s linear infinite;
  151. -webkit-animation: rotation 0.4s linear infinite;
  152. -o-animation: rotation 0.4s linear infinite;
  153. }
  154. @-webkit-keyframes rotation {
  155. from {
  156. -webkit-transform: rotateY(0deg);
  157. }
  158. to {
  159. -webkit-transform: rotateY(360deg);
  160. }
  161. }
  162. .whb-list {
  163. display: flex;
  164. justify-content: space-between;
  165. padding: 40upx;
  166. flex-wrap: wrap;
  167. }
  168. .whb-list .whb-item {
  169. width: 48%;
  170. height: 440upx;
  171. margin: 20upx 0;
  172. display: flex;
  173. flex-direction: column;
  174. background: #c40b00;
  175. border-radius: 30upx 30upx 40upx 40upx;
  176. overflow: hidden;
  177. }
  178. .user-img{
  179. width: 100upx;
  180. height: 100upx;
  181. border-radius: 10px;
  182. position: absolute;
  183. bottom: 0;
  184. transform: translateY(50%);
  185. border: 8upx solid #000;
  186. background: chartreuse;
  187. }
  188. .whb-item-header {
  189. display: flex;
  190. justify-content: center;
  191. height: 30%;
  192. background: navajowhite;
  193. position: relative;
  194. border-radius: 0 0 120upx 120upx;
  195. }
  196. .whb-item-center {
  197. display: flex;
  198. height: 70%;
  199. flex-direction: column;
  200. align-items: center;
  201. background: #c40b00;
  202. padding-top: 50upx;
  203. border-radius: 0 0 40upx 40upx;
  204. }
  205. .whb-item-center .name{
  206. font-size: 36upx;
  207. font-weight: bold;
  208. color:#ffffff;
  209. }
  210. .whb-item-center .title{
  211. font-size: 26upx;
  212. color:#ffffff;
  213. }
  214. .whb-kai1{
  215. background: coral;
  216. border: 6upx solid cornflowerblue;
  217. width: 100upx;
  218. height: 100upx;
  219. border-radius: 10px;
  220. display: flex;
  221. align-items: center;
  222. justify-content: center;
  223. margin-top: 10upx;
  224. font-size: 32upx;
  225. color:#ffffff;
  226. font-weight: bold;
  227. }
  228. .whb-none{
  229. display: flex;
  230. justify-content: center;
  231. align-items: center;
  232. flex-direction: column;
  233. height: 1000rpx;
  234. }
  235. .whb-none image{
  236. width: 50px;
  237. height: 60px;
  238. padding: 20px;
  239. }
  240. .page{
  241. height: 100%;
  242. }
  243. </style>