lucky-code.vue 5.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179
  1. <template>
  2. <app-layout>
  3. <view v-if="award.status==3 || award.status==4" class="dir-left-nowrap cross-center lucky-head">
  4. <image class="lucky-logo" src="./../image/lottery-code.png"></image>
  5. <image class="box-grow-0 lucky-user-ok" :src="award.user.userInfo.avatar"></image>
  6. <view class="box-grow-1 lucky-name">{{award.user.nickname}}</view>
  7. <view class="dir-top-nowrap box-grow-0 main-right lucky-right">
  8. <view class="main-right">{{award.lucky_code}}</view>
  9. <view class="main-right lucky-text">获赠幸运码</view>
  10. </view>
  11. </view>
  12. <view class="lucky-center">
  13. <view class="main-center cross-center lucky-code">
  14. <block v-if="award.status==3 || award.status==4">其他</block>
  15. <block wx:else>持有</block>
  16. <text>{{num}}个幸运码</text>
  17. </view>
  18. <view class="lucky-info">
  19. <view v-if="own.status==1 || own.status==2" class="dir-left-nowrap cross-center lucky-parent-list">
  20. <image class="box-grow-0" :src="own.user.userInfo.avatar"></image>
  21. <view class="box-grow-1 lucky-name">{{own.user.nickname}}</view>
  22. <view class="dir-top-nowrap box-grow-0 main-right lucky-right">
  23. <view class="main-right">{{own.lucky_code}}</view>
  24. <view class="main-right lucky-text">幸运码</view>
  25. </view>
  26. </view>
  27. <block v-for="(v,k) in parent" :key="k">
  28. <view class="dir-left-nowrap cross-center lucky-parent-list">
  29. <image class="box-grow-0" :src="v.childUser.userInfo.avatar"></image>
  30. <view class="box-grow-1 lucky-name">{{v.childUser.nickname}}</view>
  31. <view class="dir-top-nowrap box-grow-0 main-right lucky-right">
  32. <view class="main-right">{{v.lucky_code}}</view>
  33. <view class="main-right lucky-text">获赠幸运码</view>
  34. </view>
  35. </view>
  36. </block>
  37. <view v-if="parent.length>=9 && !args" class="lucky-more" @click="more">
  38. 加载更多
  39. </view>
  40. </view>
  41. </view>
  42. </app-layout>
  43. </template>
  44. <script>
  45. export default {
  46. name: "lucky-code",
  47. components: {},
  48. data() {
  49. return {
  50. lottery_id: '',
  51. award: null,
  52. num: 0,
  53. own: null,
  54. page: 1,
  55. parent: null,
  56. }
  57. },
  58. onLoad: function (options) {
  59. const self = this;
  60. self.lottery_id = options.lottery_id;
  61. self.$showLoading({title: '加载中'});
  62. self.$request({
  63. url: self.$api.lottery.code,
  64. data: {
  65. lottery_id: self.lottery_id,
  66. }
  67. }).then(info => {
  68. self.$hideLoading();
  69. if (info.code === 0) {
  70. [self.award, self.num, self.own, self.parent] = [info.data.award, info.data.num, info.data.own, info.data.parent];
  71. }
  72. }).catch(e => {
  73. self.$hideLoading();
  74. })
  75. },
  76. methods: {
  77. more: function () {
  78. const self = this;
  79. if (self.args || self.load) return
  80. self.load = true;
  81. let page = self.page + 1;
  82. self.$request({
  83. url: self.$api.lottery.code,
  84. data: {
  85. page: page,
  86. lottery_id: self.lottery_id,
  87. }
  88. }).then(info => {
  89. if (info.code === 0) {
  90. [self.page, self.args, self.parent] = [page, info.data.parent.length === 0, self.parent.concat(info.data.parent)];
  91. }
  92. self.load = false;
  93. })
  94. }
  95. }
  96. }
  97. </script>
  98. <style scoped lang="scss">
  99. .lucky-head {
  100. border: #{1rpx} solid #ff4544;
  101. position: relative;
  102. background: #ffffff;
  103. margin: #{40rpx} #{24rpx} #{16rpx};
  104. border-radius: #{16rpx};
  105. height: #{140rpx};
  106. .lucky-logo {
  107. position: absolute;
  108. top: 0;
  109. left: 0;
  110. width: #{84rpx};
  111. height: #{84rpx};
  112. }
  113. .lucky-user-ok {
  114. display: block;
  115. width: #{64rpx};
  116. height: #{64rpx};
  117. margin-left: #{40rpx};
  118. border-radius: 50%;
  119. }
  120. }
  121. .lucky-center {
  122. font-size: #{28rpx};
  123. color: #353535;
  124. background: #ffffff;
  125. margin: #{24rpx} #{24rpx} 0;
  126. border-radius: #{16rpx};
  127. .lucky-code {
  128. height: #{88rpx};
  129. border-bottom: #{1rpx} solid #e2e2e2;
  130. }
  131. .lucky-info {
  132. padding: #{16rpx} 0;
  133. .lucky-parent-list {
  134. padding: #{16rpx} 0;
  135. image {
  136. display: block;
  137. width: #{64rpx};
  138. height: #{64rpx};
  139. margin-left: #{40rpx};
  140. border-radius: 50%;
  141. }
  142. }
  143. }
  144. }
  145. .lucky-name {
  146. margin: 0 #{32rpx};
  147. color: #353535;
  148. }
  149. .lucky-right {
  150. margin-right: #{40rpx};
  151. color:#353535;
  152. .lucky-text {
  153. color: #999999;
  154. font-size: #{22rpx};
  155. }
  156. }
  157. .lucky-more {
  158. font-size: #{24rpx};
  159. color: #999999;
  160. padding: #{16rpx} 0;
  161. text-align: center;
  162. }
  163. </style>