Pane.vue 4.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181
  1. <template>
  2. <view style="margin-top: 24upx;">
  3. <view>
  4. <view v-for="menu in specialPane" :key="menu.name" style="margin-bottom: 24upx;">
  5. </view>
  6. </view>
  7. <view class="pane-wrapper">
  8. <view class="title-wrapper">
  9. <view class="left">
  10. <view class="title">{{ title }}</view>
  11. <slot name="title"></slot>
  12. </view>
  13. <view class="right">
  14. <slot name="right"></slot>
  15. </view>
  16. </view>
  17. <view class="row-wrapper">
  18. <view v-for="menu in renderMenu" :key="menu.name" class="item" @click="$emit('menu-click', menu)">
  19. <BeeIcon
  20. v-if="menu.iconUrl || menu.icon" :size="28"
  21. :src="menu.iconUrl ? common.seamingImgUrl(menu.iconUrl) : menu.icon"
  22. ></BeeIcon>
  23. <text class="menu-name">{{ menu.name }}</text>
  24. <tui-badge
  25. v-show="menu.name === '购物车' && $store.getters.shopCarNumber" type="danger" right="50rpx" absolute
  26. :scale-ratio="0.8" translate-x="40%" top="-8rpx"
  27. >
  28. {{ $store.getters.shopCarNumber || 0 }}
  29. </tui-badge>
  30. </view>
  31. <view v-for="menu in specialPane.filter(item => item.name === '股东看板')" :key="menu.name" class="item" @click="$emit('menu-click', menu)">
  32. <BeeIcon
  33. v-if="menu.iconUrl || menu.icon" :size="28"
  34. :src="menu.iconUrl ? common.seamingImgUrl(menu.iconUrl) : menu.icon"
  35. ></BeeIcon>
  36. <text class="menu-name">{{ menu.name }}</text>
  37. </view>
  38. </view>
  39. <view style="display: flex;flex-wrap: wrap;">
  40. <view v-for="menu in specialPane" :key="menu.name" @click="$emit('menu-click', menu)">
  41. </view>
  42. </view>
  43. </view>
  44. </view>
  45. </template>
  46. <script>
  47. export default {
  48. name: 'Pane',
  49. props: {
  50. title: {
  51. type: String,
  52. required: true
  53. },
  54. menuData: {
  55. type: Array
  56. }
  57. // permissionData: {
  58. // type: Array
  59. // },
  60. },
  61. data() {
  62. return {
  63. specialPane: [],
  64. renderMenu: []
  65. }
  66. },
  67. computed: {
  68. },
  69. watch: {
  70. 'menuData': {
  71. handler(newVal) {
  72. const renderMenuArr = []
  73. newVal.forEach((item) => {
  74. if (item.showRole) {
  75. if (item.showRole.includes('shop') && this.$store.state.auth.identityInfo.type.includes(9)) renderMenuArr.push(item)
  76. if (item.showRole.includes('merchantStaff') && this.$store.state.auth.identityInfo.type.includes(8)) renderMenuArr.push(item)
  77. if (item.showRole.includes('franchisee') && this.$store.state.auth.identityInfo.type.includes(1)) renderMenuArr.push(item)
  78. } else {
  79. renderMenuArr.push(item)
  80. }
  81. this.renderMenu = renderMenuArr
  82. })
  83. },
  84. immediate: true,
  85. deep: true
  86. },
  87. '$store.state.auth.identityInfo.type': {
  88. handler(newVal) {
  89. const renderMenuArr = []
  90. this.menuData.forEach((item) => {
  91. if (item.showRole) {
  92. if (item.showRole.includes('shop') && newVal.includes(9)) renderMenuArr.push(item)
  93. if (item.showRole.includes('merchantStaff') && newVal.includes(8)) renderMenuArr.push(item)
  94. if (item.showRole.includes('franchisee') && newVal.includes(1)) renderMenuArr.push(item)
  95. } else {
  96. renderMenuArr.push(item)
  97. }
  98. })
  99. this.renderMenu = renderMenuArr
  100. },
  101. immediate: true,
  102. deep: true
  103. }
  104. },
  105. beforeMount() {
  106. // console.log(this.menuData)
  107. },
  108. created() {
  109. }
  110. }
  111. </script>
  112. <style lang="less" scoped>
  113. .pane-wrapper {
  114. padding: 30upx 24upx 40upx;
  115. width: 100%;
  116. box-sizing: border-box;
  117. background-color: #ffffff;
  118. border-radius: 24rpx;
  119. .title-wrapper {
  120. display: flex;
  121. align-items: center;
  122. justify-content: space-between;
  123. padding-bottom: 24upx;
  124. border-bottom: 1upx solid #f1f1f0;
  125. .left {
  126. display: flex;
  127. align-items: center;
  128. .title {
  129. font-size: 28rpx;
  130. // font-weight: bold;
  131. color: #141000;
  132. }
  133. }
  134. }
  135. .row-wrapper {
  136. display: flex;
  137. align-items: center;
  138. justify-content: flex-start;
  139. flex-wrap: wrap;
  140. width: 100%;
  141. .item {
  142. position: relative;
  143. display: flex;
  144. align-items: center;
  145. justify-content: center;
  146. flex-direction: column;
  147. width: 25%;
  148. margin-top: 28upx;
  149. transition: 350ms all;
  150. border-radius: 4px;
  151. &:active {
  152. background-color: #f0f0f0;
  153. }
  154. .menu-name {
  155. margin-top: 10upx;
  156. font-size: 28rpx;
  157. line-height: 51rpx;
  158. color: #2A2B23;
  159. }
  160. }
  161. }
  162. }
  163. </style>