leftMenu.vue 6.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212
  1. <template>
  2. <el-menu
  3. :collapse="isCollapse"
  4. background-color="#FA7D22"
  5. text-color="#FFFFFF"
  6. active-text-color="#FA7D22"
  7. :default-active="$route.path"
  8. style="width: 115px"
  9. router
  10. >
  11. <div class="logo">
  12. <img
  13. src="https://we-spa.oss-cn-shenzhen.aliyuncs.com/pad_clerk/home/new_logo.jpg"
  14. alt=""
  15. />
  16. </div>
  17. <div v-for="(item, index1) in menu" :key="index1">
  18. <!-- <el-submenu :index="index1+'a'" v-if="item.children && item.children.length > 0">-->
  19. <!-- <template slot="title">-->
  20. <!-- <i :class="item.icon"></i>-->
  21. <!-- <span v-show="!isCollapse" slot="title">{{ item.name }}</span>-->
  22. <!-- </template>-->
  23. <!-- <div v-for="(child,index2) in item.children" :key="'second'+index2">-->
  24. <!-- <el-menu-item :index="child.path">-->
  25. <!-- <i :class="child.icon"></i>-->
  26. <!-- <span slot="title">{{ child.name }}</span>-->
  27. <!-- </el-menu-item>-->
  28. <!-- </div>-->
  29. <!-- </el-submenu>-->
  30. <div
  31. class="el-menu-item"
  32. @click="handleSelect(index1, item)"
  33. :index="item.path"
  34. :class="index1 == nowIndex ? 'active' : ''"
  35. :style="
  36. index1 + 1 == nowIndex
  37. ? 'padding-bottom:0px'
  38. : index1 - 1 == nowIndex
  39. ? 'padding-top:0px'
  40. : ''
  41. "
  42. >
  43. <img :src="index1 == nowIndex ? item.icon : item.unicon" /><span
  44. slot="title"
  45. >{{ item.name }}</span
  46. >
  47. </div>
  48. </div>
  49. </el-menu>
  50. </template>
  51. <script>
  52. // import memberLogic from '@/server/memberLogic.js'
  53. export default {
  54. props: ["isCollapse"],
  55. data() {
  56. return {
  57. menu: [
  58. {
  59. name: "首页",
  60. path: "/home",
  61. unicon:
  62. "https://we-spa.oss-cn-shenzhen.aliyuncs.com/pad_clerk/icon/slices/unhome.png",
  63. icon: "https://we-spa.oss-cn-shenzhen.aliyuncs.com/pad_clerk/icon/slices/home.png",
  64. },
  65. {
  66. name: "测肤记录",
  67. path: "/testSkin",
  68. unicon:
  69. "https://we-spa.oss-cn-shenzhen.aliyuncs.com/pad_clerk/icon/slices/unskin.png",
  70. icon: "https://we-spa.oss-cn-shenzhen.aliyuncs.com/pad_clerk/icon/slices/Skin.png",
  71. },
  72. {
  73. name: "发券中心",
  74. path: "/coupon",
  75. unicon:
  76. "https://we-spa.oss-cn-shenzhen.aliyuncs.com/pad_clerk/icon/slices/uncoupon.png",
  77. icon: "https://we-spa.oss-cn-shenzhen.aliyuncs.com/pad_clerk/icon/slices/coupon.png",
  78. },
  79. {
  80. name: "订单中心",
  81. path: "/orderCenter",
  82. unicon:
  83. "https://we-spa.oss-cn-shenzhen.aliyuncs.com/pad_clerk/icon/slices/unhistory.png",
  84. icon: "https://we-spa.oss-cn-shenzhen.aliyuncs.com/pad_clerk/icon/slices/history.png",
  85. },
  86. {
  87. name: "确定订单",
  88. path: "/confirmOrder",
  89. unicon:
  90. "https://we-spa.oss-cn-shenzhen.aliyuncs.com/pad_clerk/icon/slices/unconfirmOrder.png",
  91. icon: "https://we-spa.oss-cn-shenzhen.aliyuncs.com/pad_clerk/icon/slices/confirmOrder.png",
  92. },
  93. {
  94. name: "客户管理",
  95. path: "/customerMan",
  96. unicon:
  97. "https://we-spa.oss-cn-shenzhen.aliyuncs.com/pad_clerk/icon/slices/%E7%94%A8%E6%88%B7%E7%B1%BB.png",
  98. icon: "https://we-spa.oss-cn-shenzhen.aliyuncs.com/pad_clerk/icon/slices/%E7%94%A8%E6%88%B7%E7%B1%BB%20%281%29.png",
  99. },
  100. {
  101. name: "付费客户",
  102. path: "/payUser",
  103. unicon:
  104. "https://we-spa.oss-cn-shenzhen.aliyuncs.com/pad_clerk/icon/slices/%E6%96%B0%E5%A2%9E%E4%BB%98%E8%B4%B9%E4%BA%BA%E6%95%B0%20%281%29.png",
  105. icon: "https://we-spa.oss-cn-shenzhen.aliyuncs.com/pad_clerk/icon/slices/%E6%96%B0%E5%A2%9E%E4%BB%98%E8%B4%B9%E4%BA%BA%E6%95%B0.png",
  106. },
  107. {
  108. name: "店铺排班",
  109. path: "/schedulingDetail",
  110. unicon:
  111. "https://we-spa.oss-cn-shenzhen.aliyuncs.com/pad_clerk/icon/slices/%E6%8E%92%E7%8F%AD%E6%A8%A1%E5%9D%97%20%281%29.png",
  112. icon: "https://we-spa.oss-cn-shenzhen.aliyuncs.com/pad_clerk/icon/slices/%E6%8E%92%E7%8F%AD%E6%A8%A1%E5%9D%97.png",
  113. },
  114. {
  115. name: "营收管理",
  116. path: "/revenueManage",
  117. unicon:
  118. "https://we-spa.oss-cn-shenzhen.aliyuncs.com/pad_clerk/icon/slices/%E8%B5%84%E4%BA%A7%E6%B8%85%E5%8D%95%20%281%29.png",
  119. icon: "https://we-spa.oss-cn-shenzhen.aliyuncs.com/pad_clerk/icon/slices/%E8%B5%84%E4%BA%A7%E6%B8%85%E5%8D%95.png",
  120. },
  121. ],
  122. nowIndex: 0,
  123. };
  124. },
  125. watch: {
  126. $route(to, from) {
  127. // console.log(to, "tootototo");
  128. let patname = `/${to.path.split("/")[1]}`;
  129. // console.log(window.location, "window.location.pathname", to);
  130. this.$emit("changeIsBack", to.meta.isback);
  131. this.menu.forEach((item, index) => {
  132. if (patname == item.path) {
  133. this.nowIndex = index;
  134. this.$emit("changeMenu", index);
  135. }
  136. });
  137. // 客户管理详情跳转测肤记录修改返回键显示
  138. if (to.path == "/testSkin") {
  139. this.$emit("changeIsBack", this.$route.query.isback);
  140. }
  141. },
  142. },
  143. mounted() {
  144. let patname = `/${window.location.hash.substr(1).split("/")[1]}`;
  145. // console.log(window.location, "window.location.pathname", patname);
  146. this.menu.forEach((item, index) => {
  147. if (patname == item.path) {
  148. this.nowIndex = index;
  149. this.$emit("changeMenu", index);
  150. }
  151. });
  152. },
  153. methods: {
  154. handleSelect(index, item) {
  155. this.nowIndex = index;
  156. this.$router.push({
  157. path: item.path,
  158. });
  159. this.$emit("changeMenu", index);
  160. },
  161. },
  162. };
  163. </script>
  164. <style lang="less" scoped>
  165. .logo {
  166. margin-top: 22px;
  167. text-align: center;
  168. img {
  169. width: 50px;
  170. height: 50px;
  171. border-radius: 8px;
  172. }
  173. }
  174. .active {
  175. line-height: 46px !important;
  176. background: url("https://we-spa.oss-cn-shenzhen.aliyuncs.com/pad_clerk/home/select_icon.png")
  177. no-repeat;
  178. margin-right: -2px;
  179. background-size: 100% 100%;
  180. background-color: #fa7d22 !important;
  181. color: #fa7d22 !important;
  182. }
  183. .el-menu-item {
  184. margin-left: 8px;
  185. padding-left: 9px !important;
  186. height: auto;
  187. line-height: initial;
  188. padding: 13px 0;
  189. cursor: none;
  190. color: #ffffff;
  191. img {
  192. width: 20px;
  193. height: 20px;
  194. margin-right: 2px;
  195. }
  196. }
  197. /deep/ .el-menu-item:focus {
  198. background-color: transparent;
  199. }
  200. /deep/ .el-menu-item:hover {
  201. background-color: transparent;
  202. }
  203. </style>