index.vue 4.4 KB

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