tabs-column.vue 2.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140
  1. <template>
  2. <view class="avw">
  3. <view style="position: relative;overflow: hidden;" class="height1">
  4. <v-tabs-column :height="tabheight" :tabs="tabs" :is-tabbar="false" position="left" active-color="#3296FA" inactive-color="#1F1F1F"
  5. bg-color="rgb(247,247,247)" :newCurrent='current' active-bg-color="rgb(255,255,255)" v-model="current" padding="30rpx 20rpx" bold="bold"
  6. @change="changeTab">
  7. <view :style="{backgroundColor:'white',height:tabheight,overflow:'scroll'}" class="p" v-for="(item,index) in list" :key="index" v-show="index==current">
  8. <view>
  9. <appitem ref="appitem" :curNowdata="curNowdata" :openType="openType" :current='current' :listdata="item"></appitem>
  10. </view>
  11. </view>
  12. </v-tabs-column>
  13. </view>
  14. <view v-if="openType == 'commodity'" class="btnbox">
  15. <view @click="getType()" class="btn">
  16. 确定
  17. </view>
  18. </view>
  19. </view>
  20. </template>
  21. <script>
  22. import appitem from './appitem.vue'
  23. export default {
  24. props:{
  25. openType:{
  26. type: String,
  27. default: '',
  28. },
  29. tabsList:{
  30. type:Array,
  31. default:[]
  32. },
  33. tabsItem:{
  34. type:Array,
  35. default:[]
  36. },
  37. curNowdata:{
  38. type:Object
  39. }
  40. },
  41. watch:{
  42. tabsList:{
  43. immediate: true,
  44. handler(val) {
  45. if (val && val.length>0) {
  46. this.list = val
  47. let current = this.list.findIndex(v => {
  48. return v?.check == true
  49. })
  50. if (current > 0) {
  51. this.changeTab(current)
  52. }
  53. }
  54. }
  55. },
  56. tabsItem:{
  57. immediate: true,
  58. handler(val) {
  59. this.tabs = val
  60. }
  61. }
  62. },
  63. data() {
  64. return {
  65. list: [],
  66. current: 0,
  67. tabs: [],
  68. tabheight:"calc(100vh - 222rpx)"
  69. }
  70. },
  71. components: {
  72. appitem,
  73. },
  74. onLoad(e) {
  75. },
  76. onShow() {
  77. },
  78. methods: {
  79. changeTab(index) {
  80. console.log(index);
  81. this.current = index;
  82. let curNowdata = uni.getStorageSync('curNowdata')
  83. if (curNowdata&&curNowdata!='') {
  84. curNowdata = JSON.parse(curNowdata)
  85. curNowdata['curNowid'] = this.tabsList[index].id
  86. uni.setStorageSync('curNowdata',JSON.stringify(curNowdata) );
  87. }
  88. },
  89. getType(){
  90. //获取商品类型
  91. console.log(this.$refs.appitem[this.current]);
  92. },
  93. }
  94. }
  95. </script>
  96. <style lang="scss">
  97. .height1{
  98. height: calc(100% - 326rpx);
  99. }
  100. .avw {
  101. width: 100%;
  102. height: 100%;
  103. background-color: rgb(255, 255, 255);
  104. .headSearch {
  105. background-color: #FFFFFF;
  106. width: 100%;
  107. }
  108. }
  109. .btnbox{
  110. position: fixed;
  111. bottom: 20rpx;
  112. left:24rpx;
  113. }
  114. .btn{
  115. width: 702rpx;
  116. height: 80rpx;
  117. background: #46A6FF;
  118. border-radius: 64rpx 64rpx 64rpx 64rpx;
  119. opacity: 1;
  120. font-size: 28rpx;
  121. font-weight: 500;
  122. color: #FFFFFF;
  123. line-height: 80rpx;
  124. text-align: center;
  125. }
  126. </style>