handbook.vue 3.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197
  1. <template>
  2. <view class="content">
  3. <scroll-view scroll-y="true" scroll-x="true" :scroll-top="scrollTop" :scroll-left="scrollTop" @scroll="scroll">
  4. <!-- 内容 -->
  5. <view class="teamContent" :style="{width:HN_width}">
  6. <view v-for="(itemRow,indexRow) in itemData" :key="indexRow">
  7. <view class="row" :class="{grayColor:indexRow==0}">
  8. <view v-for="(itemCol,indexCol) in itemRow" :key="indexCol" class="colBg" :class="{grayColor:indexCol==0}">
  9. <view class="col" v-if="indexCol==0">{{itemCol}}</view>
  10. <view class="col" v-else-if="indexRow==0">{{itemCol}}</view>
  11. <view class="redCol" v-else-if="indexRow!=0 && indexCol!=0 && itemCol==1"></view>
  12. <view class="grayCol" v-else-if="indexRow!=0 && indexCol!=0 && itemCol==0"></view>
  13. </view>
  14. </view>
  15. </view>
  16. </view>
  17. </scroll-view>
  18. <view class="leftView">
  19. <view v-for="(item,index) in leftData" :key="index" class="leftTitleBg">
  20. <view class="leftTitle" :class="{firstRow:index==0}">{{item}}</view>
  21. </view>
  22. </view>
  23. <!-- 无数据空白页 -->
  24. <nodata v-if="itemData.length==0"></nodata>
  25. </view>
  26. </template>
  27. <script>
  28. import nodata from '../../components/nodata/nodata.vue'
  29. export default {
  30. components: {
  31. nodata,
  32. },
  33. data() {
  34. return {
  35. itemData:[],
  36. noMoreShow: false,
  37. mileage: '',
  38. liyangId: '',
  39. scrollTop: 0,
  40. old: {
  41. scrollTop: 0
  42. },
  43. leftData:[],
  44. }
  45. },
  46. onLoad(opt) {
  47. this.mileage = opt.mileage
  48. this.liyangId = opt.liyangId
  49. this.getData()
  50. },
  51. computed: {
  52. HN_width() {
  53. var MaxLength = 2;
  54. var Row_Materials = this.itemData[0];
  55. if (Row_Materials != null && Row_Materials.length > 0) {
  56. MaxLength = Row_Materials.length * (180 + 40)
  57. }
  58. return MaxLength + 'rpx';
  59. },
  60. },
  61. methods: {
  62. scroll: function(e) {
  63. this.old.scrollTop = e.detail.scrollTop
  64. },
  65. getData() {
  66. uni.showLoading({
  67. title: '加载中'
  68. })
  69. let url = 'openweiXinCardInfoController/queryPlan',
  70. params = {
  71. mileage: this.mileage,
  72. liyangId: this.liyangId,
  73. }
  74. this.$http(url, params, 'GET').then(res => {
  75. uni.hideLoading()
  76. this.itemData = res.data
  77. // 首列数据
  78. for (var i = 0; i < res.data.length; i++) {
  79. var leftArr = res.data[i]
  80. this.leftData.push(leftArr[0])
  81. }
  82. })
  83. }
  84. },
  85. }
  86. </script>
  87. <style scoped>
  88. .content {
  89. background: #FFFFFF;
  90. min-height: 100vh;
  91. }
  92. .scroll-view {
  93. white-space: nowrap;
  94. height: 1000;
  95. }
  96. .teamContent {
  97. width: 100%;
  98. align-items: center;
  99. }
  100. .row {
  101. display: flex;
  102. justify-content: space-around;
  103. width: 100%;
  104. }
  105. .colBg{
  106. display: flex;
  107. align-items: center;
  108. justify-content: center;
  109. padding: 20rpx;
  110. width: 180rpx;
  111. border: 1rpx #EEEEEE solid;
  112. }
  113. .col {
  114. color: #333333;
  115. font-size: 28rpx;
  116. }
  117. .redCol,
  118. .grayCol{
  119. width: 24rpx;
  120. height: 24rpx;
  121. background-color: #FF4F00;
  122. border-radius: 12rpx;
  123. }
  124. .grayCol{
  125. background-color: #DDDDDD;
  126. }
  127. .grayColor{
  128. background-color: #F7F7F7;
  129. }
  130. .leftView{
  131. display: flex;
  132. justify-content: space-around;
  133. flex-flow: column;
  134. position: absolute;
  135. left: 0rpx;
  136. top: 0rpx;
  137. background-color: #FFFFFF;
  138. z-index: 99;
  139. }
  140. .leftTitleBg{
  141. padding: 20rpx;
  142. width: 180rpx;
  143. background-color: #F7F7F7;
  144. border: 1rpx #EEEEEE solid;
  145. }
  146. .leftTitle{
  147. color: #333333;
  148. font-size: 28rpx;
  149. }
  150. .firstRow{
  151. height: 80rpx;
  152. }
  153. </style>