index.vue 3.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159
  1. <template>
  2. <view class="video-pagesCons">
  3. <view class="tab-body">
  4. <scroll-view scroll-y style="height: 100%;width: 100%;overflow: auto;" @scrolltolower="onreachBottom">
  5. <view
  6. class="check-order-list"
  7. v-for="(item,index) in list"
  8. :key="item.id"
  9. @click="viewRow(item)"
  10. >
  11. <view class="video-item">
  12. <view>
  13. <u-image :src="item.imageSet[0]" height="160px" width="100%"></u-image>
  14. </view>
  15. <view class="ellipsis-two">{{item.title}}</view>
  16. </view>
  17. </view>
  18. <view style="padding: 20upx;">
  19. <u-empty :src="`/static/nodata.png`" icon-size="180" :text="noDataText" img-width="120" v-if="list.length==0 && status!='loading'" mode="list"></u-empty>
  20. <u-loadmore v-if="(total>=list.length&&list.length)||status=='loading'" :status="status" />
  21. </view>
  22. </scroll-view>
  23. </view>
  24. <u-tabbar :list="vuex_tabBarList" :mid-button-size="80" :before-switch="beforeSwitch" :midButton="vuex_tabBarList.length==5"></u-tabbar>
  25. </view>
  26. </template>
  27. <script>
  28. import {
  29. mapState,
  30. mapMutations,
  31. } from 'vuex'
  32. import { promoTerminalListByPage } from '@/api/video.js'
  33. import { clickTab } from "@/utils/index.js"
  34. export default {
  35. data() {
  36. return {
  37. status: 'loading',
  38. noDataText: '暂无活动',
  39. // 查询条件
  40. pageNo: 1,
  41. pageSize: 10,
  42. list: [],
  43. total: 0,
  44. }
  45. },
  46. computed: {
  47. ...mapState(['hasLogin','vuex_vinScanNums','vuex_scanMaxNums','vuex_tabBarList','vuex_videoTypeList']),
  48. userInfo(){
  49. return this.$store.state.vuex_userInfo
  50. },
  51. tabList(){
  52. return this.$store.state.vuex_videoTypeList
  53. }
  54. },
  55. onLoad() {
  56. this.pageInit()
  57. uni.$on("refashProm",()=>{
  58. this.pageInit()
  59. })
  60. },
  61. // 页面卸载
  62. onUnload() {
  63. uni.$off('refashProm')
  64. },
  65. methods: {
  66. pageInit(){
  67. this.total = 0
  68. this.pageNo = 1
  69. this.list = []
  70. this.getRow()
  71. },
  72. // scroll-view到底部加载更多
  73. onreachBottom() {
  74. if(this.list.length < this.total){
  75. this.pageNo += 1
  76. this.getRow()
  77. }else{
  78. this.status = "nomore"
  79. }
  80. },
  81. // 查询列表
  82. getRow (pageNo) {
  83. let _this = this
  84. if (pageNo) {
  85. this.pageNo = pageNo
  86. }
  87. let params = {
  88. pageNo: this.pageNo,
  89. pageSize: this.pageSize,
  90. queryWord: this.queryWord
  91. }
  92. const storeShelf = this.$store.state.vuex_storeShelf
  93. this.status = "loading"
  94. promoTerminalListByPage(params).then(res => {
  95. if (res.code == 200 || res.status == 204 || res.status == 200) {
  96. const list = res.data.list.filter(item => item.content.indexOf("pagesB/promoDetail") >= 0)
  97. if(_this.pageNo>1){
  98. _this.list = _this.list.concat(list)
  99. }else{
  100. _this.list = list
  101. }
  102. _this.total = res.data.count || 0
  103. } else {
  104. _this.list = []
  105. _this.total = 0
  106. _this.noDataText = res.message
  107. }
  108. _this.status = _this.total>=_this.list.length ? "nomore" : 'loadmore'
  109. })
  110. },
  111. // 促销活动产品列表页
  112. viewRow(item){
  113. uni.navigateTo({
  114. url: '/pagesB/promoProduct?promoActiveSn='+item.promoActiveSn+'&title='+item.title
  115. })
  116. },
  117. // tab单击
  118. beforeSwitch(index){
  119. const row = this.$store.state.vuex_tabBarList[index] // 当前tab
  120. const isNoAuth = this.userInfo ? this.userInfo.sysUserFlag == '0' : false // 是否认证门店
  121. return clickTab(row,this.hasLogin,isNoAuth,this.vuex_vinScanNums < this.vuex_scanMaxNums)
  122. },
  123. }
  124. }
  125. </script>
  126. <style lang="less">
  127. page{
  128. height: 100vh;
  129. }
  130. .video-pagesCons{
  131. height: 100%;
  132. display: flex;
  133. flex-direction: column;
  134. .tab-body{
  135. height: 100vh;
  136. .check-order-list{
  137. background: #ffffff;
  138. padding: 20upx;
  139. margin: 25upx;
  140. border-radius: 10upx;
  141. box-shadow: 1px 1px 3px #EEEEEE;
  142. .video-item{
  143. > view{
  144. &:first-child{
  145. position: relative;
  146. }
  147. &:last-child{
  148. text-align: center;
  149. font-size: 36rpx;
  150. margin: 20rpx 0 0;
  151. }
  152. }
  153. }
  154. }
  155. }
  156. }
  157. </style>