prize.vue 7.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246
  1. <template>
  2. <app-layout>
  3. <view class="no-content" v-if="!list || list.length==0">暂无记录</view>
  4. <view class="prize-bar dir-left-nowrap">
  5. <view @click="change(1)" class="box-grow-1" :class="type==1 ? 'activity':''">
  6. <text>进行中</text>
  7. </view>
  8. <view @click="change(2)" class="box-grow-1" :class="type==2 ? 'activity':''">
  9. <text>已中奖</text>
  10. </view>
  11. <view @click="change(3)" class="box-grow-1" :class="type==3 ? 'activity':''">
  12. <text>未中奖</text>
  13. </view>
  14. </view>
  15. <view class="prize-list">
  16. <view class="line" v-for="(v,k) in list" :key="k">
  17. <view class="dir-left-nowrap goods" @click="lotteryDetail(v.lottery_id)">
  18. <image class="box-grow-0" :src="v.goods.goodsWarehouse.cover_pic"></image>
  19. <view class="dir-top info">
  20. <view class="t-omit-three name">{{v.goods.goodsWarehouse.name}}</view>
  21. <view class="attr-text dir-left-wrap t-omit">
  22. <block v-for="(value,key) in v.attr_list" :key="key">
  23. <text>{{value.attr_group_name}}:{{value.attr_name}}</text>
  24. </block>
  25. </view>
  26. <view class="stock">共{{v.lottery.stock}}份</view>
  27. </view>
  28. </view>
  29. <view class="dir-left-nowrap cross-center end">
  30. <icon class="box-grow-0 icon-time" type></icon>
  31. <view class="box-grow-1">{{v.time}}</view>
  32. <view class="box-grow-0">
  33. <view class="prize-detail" @click="lotteryDetail(v.lottery_id)">查看详情</view>
  34. </view>
  35. </view>
  36. </view>
  37. <app-load-text v-if="load"></app-load-text>
  38. </view>
  39. <common-buttom status="prize"></common-buttom>
  40. </app-layout>
  41. </template>
  42. <script>
  43. import commonButtom from "../common-buttom.vue";
  44. export default {
  45. name: "prize",
  46. components: {commonButtom},
  47. data() {
  48. return {
  49. list: null,
  50. page: 1,
  51. type: 1,
  52. load: false,
  53. args: false,
  54. }
  55. },
  56. onLoad(options) { this.$commonLoad.onload(options);
  57. this.type = options.type ? options.type : 1;
  58. this.getSetting();
  59. this.loadData();
  60. },
  61. onReachBottom: function () {
  62. const self = this;
  63. if (self.args || self.load)
  64. return;
  65. self.load = true;
  66. let page = self.page + 1;
  67. self.$request({
  68. url: self.$api.lottery.prize,
  69. data: {
  70. page: page,
  71. type: self.type,
  72. }
  73. }).then(info => {
  74. if (info.code === 0) {
  75. [self.page, self.args, self.list] = [page, info.data.list.length === 0, self.list.concat(info.data.list)];
  76. }
  77. self.load = false;
  78. });
  79. },
  80. methods: {
  81. getSetting() {
  82. const self = this;
  83. self.$request({
  84. url: self.$api.lottery.setting,
  85. }).then(info => {
  86. if (info.code === 0) {
  87. uni.setNavigationBarTitle({
  88. title: info.data.setting.title,
  89. })
  90. }
  91. })
  92. },
  93. loadData() {
  94. const self = this;
  95. self.$showLoading({title: '加载中'});
  96. self.$request({
  97. url: self.$api.lottery.prize,
  98. data: {
  99. type: self.type
  100. }
  101. }).then(info => {
  102. self.$hideLoading();
  103. if (info.code === 0) {
  104. self.list = info.data.list;
  105. }
  106. }).catch(info => {
  107. self.$hideLoading();
  108. })
  109. },
  110. change(type) {
  111. [this.type, this.page, this.args] = [type, 1, false];
  112. this.loadData();
  113. },
  114. lotteryDetail(id) {
  115. uni.navigateTo({url: `/plugins/lottery/detail/detail?lottery_id=` + id});
  116. },
  117. }
  118. }
  119. </script>
  120. <style scoped lang="scss">
  121. .attr-text {
  122. color: #999999;
  123. font-size: #{28rpx};
  124. margin-top: #{14rpx};
  125. max-width: #{480rpx};
  126. text:after {
  127. content: ','
  128. }
  129. text:last-child:after {
  130. content: ''
  131. }
  132. }
  133. .no-content {
  134. color: #888;
  135. padding-top: #{200rpx};
  136. text-align: center;
  137. }
  138. .prize-bar {
  139. position: fixed;
  140. top: 0;
  141. left: 0;
  142. width: 100%;
  143. background: #fff;
  144. border-top: #{1rpx} solid #e3e3e3;
  145. border-bottom: #{1rpx} solid #e3e3e3;
  146. z-index: 999;
  147. view {
  148. color: #666666;
  149. text-align: center;
  150. text {
  151. height: #{90rpx};
  152. line-height: #{90rpx};
  153. border-bottom: #{4rpx} solid transparent;
  154. width: auto;
  155. display: inline-block;
  156. }
  157. }
  158. .activity {
  159. text {
  160. color: #ff4544;
  161. border-bottom-color: #ff4544;
  162. }
  163. }
  164. }
  165. .prize-list {
  166. //padding-bottom: #{96rpx};
  167. padding-top: #{92rpx};
  168. .line {
  169. margin-top: #{20rpx}
  170. }
  171. .goods {
  172. padding: #{24rpx};
  173. border-bottom: 1px solid #e2e2e2;
  174. background: #ffffff;
  175. image {
  176. display: block;
  177. width: #{160rpx};
  178. height: #{160rpx};
  179. }
  180. .info {
  181. font-size: #{28rpx};
  182. margin-left: #{24rpx};
  183. margin-top: #{16rpx};
  184. .name {
  185. color: #353535;
  186. }
  187. .stock {
  188. margin-top: #{10rpx};
  189. color: #999999;
  190. }
  191. }
  192. }
  193. }
  194. .prize-detail {
  195. height: #{46rpx};
  196. line-height: #{46rpx};
  197. width: #{148rpx};
  198. border-radius: #{24rpx};
  199. color: #FF4544;
  200. border: #{1px} solid #ff4544;
  201. background: #FFFFFF;
  202. font-size: #{28rpx};
  203. text-align: center;
  204. }
  205. .end {
  206. color: #999999;
  207. font-size: #{28rpx};
  208. height: #{72rpx};
  209. background: #FFFFFF;
  210. padding: 0 #{24rpx};
  211. .icon-time {
  212. background-repeat: no-repeat;
  213. background-size: 100% 100%;
  214. height: #{24rpx};
  215. width: #{24rpx};
  216. margin-right: #{12rpx};
  217. background-image: url("./../image/lottery_time.png");
  218. }
  219. }
  220. </style>