leftMenu.vue 5.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170
  1. <template>
  2. <el-menu :collapse="isCollapse"
  3. background-color="#FA7D22"
  4. text-color="#FFFFFF"
  5. active-text-color="#FA7D22"
  6. :default-active="$route.path"
  7. style="width: 115px;"
  8. router>
  9. <div class="logo">
  10. <img src="https://we-spa.oss-cn-shenzhen.aliyuncs.com/pad_clerk/home/logo.png"
  11. alt="">
  12. </div>
  13. <div v-for="(item,index1) in menu"
  14. :key="index1">
  15. <!-- <el-submenu :index="index1+'a'" v-if="item.children && item.children.length > 0">-->
  16. <!-- <template slot="title">-->
  17. <!-- <i :class="item.icon"></i>-->
  18. <!-- <span v-show="!isCollapse" slot="title">{{ item.name }}</span>-->
  19. <!-- </template>-->
  20. <!-- <div v-for="(child,index2) in item.children" :key="'second'+index2">-->
  21. <!-- <el-menu-item :index="child.path">-->
  22. <!-- <i :class="child.icon"></i>-->
  23. <!-- <span slot="title">{{ child.name }}</span>-->
  24. <!-- </el-menu-item>-->
  25. <!-- </div>-->
  26. <!-- </el-submenu>-->
  27. <div class="el-menu-item"
  28. @click="handleSelect(index1,item)"
  29. :index="item.path"
  30. :class="index1==nowIndex?'active':''"
  31. :style="index1+1==nowIndex?'padding-bottom:0px':index1-1==nowIndex?'padding-top:0px':''">
  32. <img :src="index1==nowIndex?item.icon:item.unicon"><span slot="title">{{ item.name }}</span>
  33. </div>
  34. </div>
  35. </el-menu>
  36. </template>
  37. <script>
  38. // import memberLogic from '@/server/memberLogic.js'
  39. export default {
  40. props: ['isCollapse'],
  41. data () {
  42. return {
  43. menu: [
  44. {
  45. name: "首页",
  46. path: "/home",
  47. unicon: 'https://we-spa.oss-cn-shenzhen.aliyuncs.com/pad_clerk/icon/slices/unhome.png',
  48. icon: 'https://we-spa.oss-cn-shenzhen.aliyuncs.com/pad_clerk/icon/slices/home.png'
  49. },
  50. {
  51. name: "测肤记录",
  52. path: "/testSkin",
  53. unicon: 'https://we-spa.oss-cn-shenzhen.aliyuncs.com/pad_clerk/icon/slices/unskin.png',
  54. icon: 'https://we-spa.oss-cn-shenzhen.aliyuncs.com/pad_clerk/icon/slices/Skin.png',
  55. },
  56. {
  57. name: "发券中心",
  58. path: "/coupon",
  59. unicon: 'https://we-spa.oss-cn-shenzhen.aliyuncs.com/pad_clerk/icon/slices/uncoupon.png',
  60. icon: 'https://we-spa.oss-cn-shenzhen.aliyuncs.com/pad_clerk/icon/slices/coupon.png',
  61. }, {
  62. name: "历史订单",
  63. path: "/historicalOrder",
  64. unicon: 'https://we-spa.oss-cn-shenzhen.aliyuncs.com/pad_clerk/icon/slices/unhistory.png',
  65. icon: 'https://we-spa.oss-cn-shenzhen.aliyuncs.com/pad_clerk/icon/slices/history.png',
  66. }, {
  67. name: "确定订单",
  68. path: "/confirmOrder",
  69. unicon: 'https://we-spa.oss-cn-shenzhen.aliyuncs.com/pad_clerk/icon/slices/unconfirmOrder.png',
  70. icon: 'https://we-spa.oss-cn-shenzhen.aliyuncs.com/pad_clerk/icon/slices/confirmOrder.png'
  71. },
  72. // {
  73. // name: "门店检测",
  74. // path: "/storeDetection",
  75. // icon: 'https://we-spa.oss-cn-shenzhen.aliyuncs.com/pad_clerk/icon/slices/testing.png',
  76. // unicon: 'https://we-spa.oss-cn-shenzhen.aliyuncs.com/pad_clerk/icon/slices/untesting.png'
  77. // },
  78. {
  79. name: "客户管理",
  80. path: "/customerMan",
  81. unicon: 'https://we-spa.oss-cn-shenzhen.aliyuncs.com/pad_clerk/icon/slices/unskin.png',
  82. icon: 'https://we-spa.oss-cn-shenzhen.aliyuncs.com/pad_clerk/icon/slices/Skin.png',
  83. }
  84. ],
  85. nowIndex: 0
  86. }
  87. },
  88. watch: {
  89. $route (to, from) {
  90. let patname = `/${to.path.split('/')[1]}`
  91. console.log(window.location, 'window.location.pathname', to);
  92. this.$emit('changeIsBack', to.meta.isback)
  93. this.menu.forEach((item, index) => {
  94. if (patname == item.path) {
  95. this.nowIndex = index
  96. this.$emit('changeMenu', index)
  97. }
  98. })
  99. }
  100. },
  101. mounted () {
  102. let patname = `/${window.location.hash.substr(1).split('/')[1]}`
  103. console.log(window.location, 'window.location.pathname', patname);
  104. this.menu.forEach((item, index) => {
  105. if (patname == item.path) {
  106. this.nowIndex = index
  107. this.$emit('changeMenu', index)
  108. }
  109. })
  110. },
  111. methods: {
  112. handleSelect (index, item) {
  113. this.nowIndex = index
  114. this.$router.push({
  115. path: item.path
  116. })
  117. this.$emit('changeMenu', index)
  118. }
  119. }
  120. }
  121. </script>
  122. <style lang="less" scoped>
  123. .logo {
  124. margin-top: 22px;
  125. text-align: center;
  126. img {
  127. width: 60px;
  128. height: 60px;
  129. }
  130. }
  131. .active {
  132. line-height: 46px !important;
  133. background: url("https://we-spa.oss-cn-shenzhen.aliyuncs.com/pad_clerk/home/select_icon.png")
  134. no-repeat;
  135. margin-right: -2px;
  136. background-size: 100% 100%;
  137. background-color: #fa7d22 !important;
  138. color: #fa7d22 !important;
  139. }
  140. .el-menu-item {
  141. margin-left: 8px;
  142. padding-left: 9px !important;
  143. height: auto;
  144. line-height: initial;
  145. padding: 13px 0;
  146. cursor: none;
  147. color: #ffffff;
  148. img {
  149. width: 20px;
  150. height: 20px;
  151. }
  152. }
  153. /deep/ .el-menu-item:focus {
  154. background-color: transparent;
  155. }
  156. /deep/ .el-menu-item:hover {
  157. background-color: transparent;
  158. }
  159. </style>