index.vue 4.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182
  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" :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. export default {
  34. data() {
  35. return {
  36. status: 'loading',
  37. noDataText: '暂无活动',
  38. // 查询条件
  39. pageNo: 1,
  40. pageSize: 10,
  41. list: [],
  42. total: 0,
  43. }
  44. },
  45. computed: {
  46. ...mapState(['hasLogin','vuex_vinScanNums','vuex_scanMaxNums','vuex_tabBarList','vuex_videoTypeList']),
  47. userInfo(){
  48. return this.$store.state.vuex_userInfo
  49. },
  50. tabList(){
  51. return this.$store.state.vuex_videoTypeList
  52. }
  53. },
  54. onLoad() {
  55. this.pageInit()
  56. },
  57. methods: {
  58. pageInit(){
  59. this.total = 0
  60. this.pageNo = 1
  61. this.list = []
  62. this.getRow()
  63. },
  64. // scroll-view到底部加载更多
  65. onreachBottom() {
  66. if(this.list.length < this.total){
  67. this.pageNo += 1
  68. this.getRow()
  69. }else{
  70. this.status = "nomore"
  71. }
  72. },
  73. // 查询列表
  74. getRow (pageNo) {
  75. let _this = this
  76. if (pageNo) {
  77. this.pageNo = pageNo
  78. }
  79. let params = {
  80. pageNo: this.pageNo,
  81. pageSize: this.pageSize,
  82. queryWord: this.queryWord
  83. }
  84. const storeShelf = this.$store.state.vuex_storeShelf
  85. this.status = "loading"
  86. promoTerminalListByPage(params).then(res => {
  87. if (res.code == 200 || res.status == 204 || res.status == 200) {
  88. const list = res.data.list.filter(item => item.content.indexOf("pagesB/promoDetail") >= 0)
  89. if(_this.pageNo>1){
  90. _this.list = _this.list.concat(list)
  91. }else{
  92. _this.list = list
  93. }
  94. _this.total = res.data.count || 0
  95. } else {
  96. _this.list = []
  97. _this.total = 0
  98. _this.noDataText = res.message
  99. }
  100. _this.status = _this.total>=_this.list.length ? "nomore" : 'loadmore'
  101. })
  102. },
  103. // 促销活动产品列表页
  104. viewRow(item){
  105. uni.navigateTo({
  106. url: '/pagesB/promoDetail?promoActiveSn='+item.promoActiveSn+'&title='+item.title
  107. })
  108. },
  109. // 扫描vin
  110. beforeSwitch(index){
  111. const row = this.$store.state.vuex_tabBarList[index]
  112. if(row.text == '扫描VIN'){
  113. this.openCamera()
  114. }else{
  115. return true
  116. }
  117. },
  118. // 去扫描
  119. openCamera(){
  120. if(this.hasLogin){
  121. if(this.userInfo.sysUserFlag == '0'){
  122. if(this.vuex_vinScanNums < this.vuex_scanMaxNums){
  123. uni.navigateTo({
  124. url: "/pages/scan-frame/scan-frame"
  125. })
  126. }else{
  127. uni.showModal({
  128. title: '提示',
  129. content: '个人用户扫描VIN仅限10次,您的次数已用完!',
  130. confirmText: '好的',
  131. showCancel: false,
  132. success(res) {}
  133. })
  134. }
  135. }else{
  136. uni.navigateTo({
  137. url: "/pages/scan-frame/scan-frame"
  138. })
  139. }
  140. }else{
  141. uni.navigateTo({
  142. url: '/pages/login/login'
  143. })
  144. }
  145. },
  146. }
  147. }
  148. </script>
  149. <style lang="less">
  150. page{
  151. height: 100vh;
  152. }
  153. .video-pagesCons{
  154. height: 100%;
  155. display: flex;
  156. flex-direction: column;
  157. .tab-body{
  158. height: 100vh;
  159. .check-order-list{
  160. background: #ffffff;
  161. padding: 20upx;
  162. margin: 25upx;
  163. border-radius: 10upx;
  164. box-shadow: 1px 1px 3px #EEEEEE;
  165. .video-item{
  166. > view{
  167. &:first-child{
  168. position: relative;
  169. }
  170. &:last-child{
  171. text-align: center;
  172. font-size: 36rpx;
  173. margin: 20rpx 0 0;
  174. }
  175. }
  176. }
  177. }
  178. }
  179. }
  180. </style>