index.vue 4.3 KB

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