leftMenu.vue 5.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202
  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/logo.png"
  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: "/historicalOrder",
  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: "/storeDetection",
  96. // icon: 'https://we-spa.oss-cn-shenzhen.aliyuncs.com/pad_clerk/icon/slices/testing.png',
  97. // unicon: 'https://we-spa.oss-cn-shenzhen.aliyuncs.com/pad_clerk/icon/slices/untesting.png'
  98. // },
  99. {
  100. name: "客户管理",
  101. path: "/customerMan",
  102. unicon:
  103. "https://we-spa.oss-cn-shenzhen.aliyuncs.com/pad_clerk/icon/slices/unskin.png",
  104. icon: "https://we-spa.oss-cn-shenzhen.aliyuncs.com/pad_clerk/icon/slices/Skin.png",
  105. },
  106. {
  107. name: "付费客户",
  108. path: "/payUser",
  109. unicon:
  110. "https://we-spa.oss-cn-shenzhen.aliyuncs.com/pad_clerk/icon/slices/unskin.png",
  111. icon: "https://we-spa.oss-cn-shenzhen.aliyuncs.com/pad_clerk/icon/slices/Skin.png",
  112. },
  113. ],
  114. nowIndex: 0,
  115. };
  116. },
  117. watch: {
  118. $route(to, from) {
  119. console.log(to, "tootototo");
  120. let patname = `/${to.path.split("/")[1]}`;
  121. console.log(window.location, "window.location.pathname", to);
  122. this.$emit("changeIsBack", to.meta.isback);
  123. this.menu.forEach((item, index) => {
  124. if (patname == item.path) {
  125. this.nowIndex = index;
  126. this.$emit("changeMenu", index);
  127. }
  128. });
  129. // 客户管理详情跳转测肤记录修改返回键显示
  130. if (from.path == "/payUser/details") {
  131. this.$emit("changeIsBack", this.$route.query.isback);
  132. }
  133. },
  134. },
  135. mounted() {
  136. let patname = `/${window.location.hash.substr(1).split("/")[1]}`;
  137. console.log(window.location, "window.location.pathname", patname);
  138. this.menu.forEach((item, index) => {
  139. if (patname == item.path) {
  140. this.nowIndex = index;
  141. this.$emit("changeMenu", index);
  142. }
  143. });
  144. },
  145. methods: {
  146. handleSelect(index, item) {
  147. this.nowIndex = index;
  148. this.$router.push({
  149. path: item.path,
  150. });
  151. this.$emit("changeMenu", index);
  152. },
  153. },
  154. };
  155. </script>
  156. <style lang="less" scoped>
  157. .logo {
  158. margin-top: 22px;
  159. text-align: center;
  160. img {
  161. width: 60px;
  162. height: 60px;
  163. }
  164. }
  165. .active {
  166. line-height: 46px !important;
  167. background: url("https://we-spa.oss-cn-shenzhen.aliyuncs.com/pad_clerk/home/select_icon.png")
  168. no-repeat;
  169. margin-right: -2px;
  170. background-size: 100% 100%;
  171. background-color: #fa7d22 !important;
  172. color: #fa7d22 !important;
  173. }
  174. .el-menu-item {
  175. margin-left: 8px;
  176. padding-left: 9px !important;
  177. height: auto;
  178. line-height: initial;
  179. padding: 13px 0;
  180. cursor: none;
  181. color: #ffffff;
  182. img {
  183. width: 20px;
  184. height: 20px;
  185. }
  186. }
  187. /deep/ .el-menu-item:focus {
  188. background-color: transparent;
  189. }
  190. /deep/ .el-menu-item:hover {
  191. background-color: transparent;
  192. }
  193. </style>