fuli.vue 5.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272
  1. <template>
  2. <view>
  3. <view class="shaixuan flex justify-center">
  4. <view class="shaixuan-box flex justify-between">
  5. <view class="shaixuan-box-item" style="width:90%;">
  6. <!-- <scroll-view scroll-x="true" style="width: 100%;white-space:nowrap;">
  7. <text class="" style="margin-right: 20rpx;" v-for="(item,index) in fuliList" :key="index">
  8. <text v-if="item.se==true">{{item.value}}</text>
  9. </text>
  10. </scroll-view> -->
  11. </view>
  12. <image @click="show = true" style="width: 35rpx;height: 35rpx;" src="../../static/images/select.png" mode=""></image>
  13. </view>
  14. </view>
  15. <view style="margin-top: 20upx;">
  16. <homeuserList @click="clickItems" :types="true" :list="lists"></homeuserList>
  17. </view>
  18. <empty v-if="lists.length==0" content="暂无数据"></empty>
  19. <!-- 侧边福利筛选弹窗 -->
  20. <u-popup v-model="show" mode="right" width="60%">
  21. <view class="fuli flex justify-center flex-wrap">
  22. <view class="fuli-box flex justify-between flex-wrap">
  23. <view class="fuli-box-item" @click="selectFuli(item,index)" :class="{activeFuli:item.se==true}" v-for="(item,index) in fuliList" :key="index">
  24. {{item.value}}
  25. </view>
  26. <view class="fuli-box-item" style="height: 0 !important;padding:0rpx !important;">
  27. </view>
  28. </view>
  29. <view class="fuli-box flex justify-between" style="margin-top: 100rpx;">
  30. <view class="btn1 flex justify-center align-center" @click="close()">
  31. 重置
  32. </view>
  33. <view class="btn2 flex justify-center align-center" @click="submit()">
  34. 确认
  35. </view>
  36. </view>
  37. </view>
  38. </u-popup>
  39. </view>
  40. </template>
  41. <script>
  42. import homeuserList from '../../components/home-list/homeuserList.vue'
  43. import empty from '@/components/empty.vue'
  44. export default {
  45. components: {
  46. homeuserList,
  47. empty
  48. },
  49. data() {
  50. return {
  51. show:false,
  52. lists: [],
  53. page: 1,
  54. limit: 10,
  55. fuliList:[],
  56. current:-1,
  57. selectList:[],
  58. }
  59. },
  60. onLoad() {
  61. this.getuserList(2)
  62. //项目福利
  63. this.getFuLi();
  64. },
  65. onReachBottom() {
  66. if (this.lists.length == this.count) {
  67. uni.showToast({
  68. title: '已经到底了',
  69. icon: 'none'
  70. })
  71. } else {
  72. this.page = this.page + 1;
  73. this.getuserList(2)
  74. }
  75. },
  76. onPullDownRefresh: function() {
  77. this.page = 1;
  78. this.getuserList(2)
  79. },
  80. methods: {
  81. //重置筛选条件
  82. close(){
  83. this.fuliList.map(item=>{
  84. item.se = false
  85. })
  86. this.selectList = []
  87. this.show = false
  88. this.page = 1;
  89. this.getuserList(2)
  90. },
  91. //确认筛选
  92. submit(){
  93. this.selectList = []
  94. console.log(this.fuliList)
  95. this.fuliList.map(item=>{
  96. if(item.se == true){
  97. this.selectList.push(item.value)
  98. }
  99. })
  100. this.show = false
  101. //调用接口进行筛选
  102. this.page = 1;
  103. this.getuserList(2)
  104. //更新视图
  105. this.$forceUpdate()
  106. },
  107. //选择福利
  108. selectFuli(item,index){
  109. if(item.se==false){
  110. let num = 0
  111. this.fuliList.map(item=>{
  112. if(item.se==true){
  113. num +=1
  114. }
  115. })
  116. if(num==3){
  117. uni.showToast({
  118. title:'最多只能选择三个条件',
  119. icon:'none'
  120. })
  121. }else{
  122. item.se = !item.se
  123. }
  124. }else{
  125. item.se = !item.se
  126. }
  127. },
  128. //福利列表
  129. getFuLi(){
  130. this.$Request.get('/app/dict/list', {
  131. type: '项目福利'
  132. }).then(res => {
  133. if (res.code == 0) {
  134. let arr = res.data
  135. arr.map(item=>{
  136. item.se = false
  137. })
  138. this.fuliList = [...this.fuliList, ...arr]
  139. }
  140. })
  141. },
  142. //详情
  143. clickItems(item, index) {
  144. uni.navigateTo({
  145. url: '/pages/index/game/order?postPushId=' + item.item.postPushId
  146. })
  147. },
  148. //获取数据
  149. getuserList(stauts) {
  150. let userId = uni.getStorageSync('userId')
  151. let data = {
  152. page: this.page,
  153. limit: this.limit,
  154. status: stauts,
  155. classify: 2,
  156. projectAward:this.selectList.join(','),//项目福利
  157. }
  158. this.$Request.get("/app/postPush/selectPostPushList", data).then(res => {
  159. uni.hideLoading();
  160. if (res.code == 0) {
  161. this.count = res.data.total
  162. if (this.page == 1) {
  163. this.lists = res.data.records
  164. for (var i = 0; i < this.lists.length; i++) {
  165. this.lists[i].projectType = this.lists[i].projectType.split(',')
  166. }
  167. } else {
  168. this.lists = [...this.lists, ...res.data.records]
  169. for (var i = 0; i < this.lists.length; i++) {
  170. this.lists[i].projectType = this.lists[i].projectType.split(',')
  171. }
  172. }
  173. }
  174. uni.stopPullDownRefresh();
  175. })
  176. },
  177. },
  178. }
  179. </script>
  180. <style lang="less">
  181. page {
  182. background: #F2F2F7;
  183. }
  184. .activeFuli{
  185. background-color: #82a9fe !important;
  186. color: #ffffff;
  187. }
  188. .fuli{
  189. width: 100%;
  190. height: auto;
  191. .fuli-box{
  192. width: 90%;
  193. height: 100%;
  194. .btn1{
  195. width: 46%;
  196. height: 70rpx;
  197. border-radius: 10rpx;
  198. background-color: #cdcdcd;
  199. }
  200. .btn2{
  201. width: 46%;
  202. height: 70rpx;
  203. border-radius: 10rpx;
  204. background-color: #82a9fe;
  205. color: #ffffff;
  206. }
  207. .fuli-box-item{
  208. width: 46%;
  209. // height: 60rpx;
  210. padding: 20rpx;
  211. background-color: #cdcdcd;
  212. margin-top: 20rpx;
  213. display: flex;
  214. justify-content: center;
  215. align-items: center;
  216. border-radius: 10rpx;
  217. // color: #ffffff;
  218. }
  219. }
  220. }
  221. .shaixuan {
  222. width: 100%;
  223. margin-top: 20rpx;
  224. .shaixuan-box {
  225. width: 686rpx;
  226. height: auto;
  227. // background-color: red;
  228. }
  229. }
  230. .headTop {
  231. background: #ffffff;
  232. position: fixed;
  233. /* #ifndef H5 */
  234. top: 0upx;
  235. /* #endif */
  236. /* #ifdef H5 */
  237. top: 80upx;
  238. /* #endif */
  239. left: 0;
  240. right: 0;
  241. z-index: 999;
  242. }
  243. .navs {
  244. background: #ffffff !important;
  245. }
  246. .listbox {
  247. background: #FFFFFF;
  248. border-radius: 24upx;
  249. margin: 20upx 30upx;
  250. padding: 30upx;
  251. }
  252. .argrtn {
  253. background: #F6F6F6;
  254. color: #666666;
  255. font-size: 24upx;
  256. border-radius: 8upx;
  257. padding: 5upx 20upx;
  258. margin-right: 20upx;
  259. }
  260. </style>