index.vue 2.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697
  1. <template>
  2. <div class="lakala-container">
  3. <el-header height="60px">
  4. <el-menu
  5. :default-active="activeMenu"
  6. mode="horizontal"
  7. @select="handleMenuSelect"
  8. class="el-menu-horizontal"
  9. >
  10. <el-menu-item index="profitShareReceiver">
  11. <span>分账接收方申请</span>
  12. </el-menu-item>
  13. <el-menu-item index="profitShareOrder">
  14. <span>分帐申请</span>
  15. </el-menu-item>
  16. <el-menu-item index="tradeOrder">
  17. <span>拉卡拉交易记录</span>
  18. </el-menu-item>
  19. </el-menu>
  20. </el-header>
  21. <el-main>
  22. <component :is="currentComponent" />
  23. </el-main>
  24. </div>
  25. </template>
  26. <script>
  27. import ProfitShareReceiver from './views/ProfitShareReceiver.vue'
  28. import ProfitShareOrder from './views/ProfitShareOrder.vue'
  29. import TradeOrder from './views/TradeOrder.vue'
  30. const componentMap = {
  31. profitShareReceiver: ProfitShareReceiver,
  32. profitShareOrder: ProfitShareOrder,
  33. tradeOrder: TradeOrder
  34. }
  35. export default {
  36. name: 'LakalaIndex',
  37. components: {
  38. ProfitShareReceiver,
  39. ProfitShareOrder,
  40. TradeOrder
  41. },
  42. data() {
  43. return {
  44. activeMenu: this.$route.query.tab || 'profitShareReceiver'
  45. }
  46. },
  47. computed: {
  48. currentComponent() {
  49. return componentMap[this.activeMenu] || ProfitShareReceiver
  50. }
  51. },
  52. watch: {
  53. '$route.query.tab'(val) {
  54. if (val && componentMap[val]) {
  55. this.activeMenu = val
  56. }
  57. }
  58. },
  59. methods: {
  60. handleMenuSelect(index) {
  61. this.activeMenu = index
  62. this.$router.replace({ query: { tab: index } })
  63. }
  64. }
  65. }
  66. </script>
  67. <style scoped>
  68. .lakala-container {
  69. padding: 0;
  70. height: calc(100vh - 120px);
  71. }
  72. .el-header {
  73. padding: 0;
  74. background-color: #fff;
  75. box-shadow: 0 2px 12px 0 rgba(0, 0, 0, 0.1);
  76. }
  77. .el-menu-horizontal {
  78. height: 60px;
  79. font-size: 16px;
  80. }
  81. .el-main {
  82. padding: 30px;
  83. background: #fff;
  84. margin: 20px;
  85. border-radius: 8px;
  86. box-shadow: 0 2px 12px 0 rgba(0, 0, 0, 0.1);
  87. flex: 1;
  88. }
  89. </style>