Ver código fonte

feat 外卖设置

Funny 3 anos atrás
pai
commit
ca973eff8b

+ 5 - 4
src/common/sider.vue

@@ -9,7 +9,6 @@
           <template v-if="item.children">
             <el-submenu :index="item.path" :key="item.path">
               <template slot="title">
-                <!-- <i :class="[item.icon,'aliFamily']"></i> -->
                 <img v-if="item.icon" class="side-bar-icon" :src="item.icon" />
                 <span slot="title">{{ item.title }}</span>
               </template>
@@ -25,7 +24,6 @@
           </template>
           <template v-else>
             <el-menu-item :index="item.path" :key="item.path">
-              <!-- <i :class="[item.icon,'aliFamily']"></i> -->
               <img :src="item.icon" class="side-bar-icon" v-if="item.icon" />
               <span slot="title">{{ item.title }}</span>
             </el-menu-item>
@@ -97,7 +95,7 @@ export default {
             {
               path: "/account/walletDetail",
               name: "walletDetail",
-              title: "消费明细",
+              title: "收支明细",
             },
             {
               path: "/account/coupon",
@@ -114,7 +112,7 @@ export default {
             {
               path: "/platform/bindTakeOut",
               name: "bindTakeOut",
-              title: "定外卖平台",
+              title: "定外卖平台",
             },
             {
               path: "/platform/bindDelivery",
@@ -223,6 +221,9 @@ export default {
   background-color: #0c2b47 !important;
   border-right: 4px solid #fc7200;
 }
+/deep/ .el-submenu .el-submenu__title {
+  font-size: 15px !important;
+}
 .sidebar {
   display: block;
   position: absolute;

+ 1 - 1
src/components/manualCreate.vue

@@ -155,7 +155,7 @@
 </template>
 <script>
 import orderMap from "./orderComponents/orderAMap.vue";
-import addressManagement from "./addressManagement.vue";
+import addressManagement from "./waimaiComponents/addressManagement.vue";
 import { getProductList } from "../api/shop.js";
 import { getConfig } from "../api/setting.js";
 import {

+ 137 - 28
src/components/waimai.vue

@@ -1,39 +1,148 @@
 <template>
-  <div>这是外卖设置</div>
+  <div class="shopInfo">
+    <el-row class="order_tab">
+      <el-col :span="24">
+        <div class="tabList">
+          <div class="tab_item" @click="changeTabs(i)" :class="{'tab_item_ac':tabNum==i?true:false}" v-for="(item,i) in tabList" :key="i">
+            <span class="item" v-if="!item.children">{{item.name}}</span>
+            <el-dropdown v-else @command="chooseCoupon">
+              <span class="el-dropdown-link item">
+                {{item.name}}<i class="el-icon-arrow-down el-icon--right"></i>
+              </span>
+              <el-dropdown-menu slot="dropdown">
+                <el-dropdown-item :command="v.command" v-for="(v,index) in item.children" :key="index">{{v.name}}</el-dropdown-item>
+              </el-dropdown-menu>
+            </el-dropdown>
+            <div class="tab_line"></div>
+          </div>
+        </div>
+      </el-col>
+    </el-row>
+    <el-row class="content">
+      <component v-if="renderComponent" :is="activeName"></component>
+    </el-row>
+  </div>
 </template>
 
 <script>
+import printerList from "./shopCompoents/bindPrinter.vue";
+import usbPrinter from "./shopCompoents/bindUsbPrint.vue";
+import pictureManagement from "./waimaiComponents/pictureManagement.vue";
+import addressManagement from "./waimaiComponents/addressManagement.vue";
+import deliverySetting from "./waimaiComponents/deliverySetting.vue";
+import voiceSetting from "./waimaiComponents/voiceSetting.vue";
 export default {
   name: "waimai",
+  components: {
+    printerList,
+    usbPrinter,
+    pictureManagement,
+    addressManagement,
+    deliverySetting,
+    voiceSetting,
+  },
   data() {
-    return {};
+    return {
+      activeName: "deliverySetting",
+      tabList: [
+        { name: "配送设置", index: 0, activeName: "deliverySetting" },
+        { name: "语音设置", index: 1, activeName: "voiceSetting" },
+        {
+          name: "打印机管理",
+          index: 2,
+          activeName: "printerList",
+          children: [
+            { name: "云打印机", command: "printerList" },
+            { name: "USB打印机", command: "usbPrinter" },
+          ],
+        },
+        { name: "商品管理", index: 3, activeName: "pictureManagement" },
+        { name: "常用地址", index: 4, activeName: "addressManagement" },
+      ],
+      tabNum: 0,
+      renderComponent: true,
+    };
+  },
+  created() {
+    this.changeTabs(0);
+  },
+  methods: {
+    chooseCoupon(e) {
+      this.tabNum = 2;
+      this.activeName = e;
+    },
+    forceRerender() {
+      // 从 DOM 中删除 my-component 组件
+      this.renderComponent = false;
+      this.$nextTick(() => {
+        // 在 DOM 中添加 my-component 组件
+        this.renderComponent = true;
+      });
+    },
+    changeTabs(i) {
+      if (i === this.tabNum) {
+        this.forceRerender();
+        return;
+      }
+      this.tabNum = i;
+      this.activeName = this.tabList[i].activeName;
+    },
   },
-  // 监听属性 类似于data概念
-  computed: {},
-  // 监控data中的数据变化
-  watch: {},
-  // 方法集合
-  methods: {},
-  // 生命周期 - 创建完成(可以访问当前this实例)
-  created() {},
-  // 生命周期 - 挂载完成(可以访问DOM元素)
-  mounted() {},
-  // 生命周期 - 创建之前
-  beforeCreate() {},
-  // 生命周期 - 挂载之前
-  beforeMount() {},
-  // 生命周期 - 更新之前
-  beforeUpdate() {},
-  // 生命周期 - 更新之后
-  updated() {},
-  // 生命周期 - 销毁之前
-  beforeDestroy() {},
-  // 生命周期 - 销毁完成
-  destroyed() {},
-  // 如果页面有keep-alive缓存功能,这个函数会触发
-  activated() {},
 };
 </script>
 
-<style lang="scss" scoped  type="text/css">
-</style>
+<!-- Add "scoped" attribute to limit CSS to this component only -->
+<style scoped lang="scss">
+.shopInfo {
+  .order_tab {
+    width: 100%;
+    height: 74px;
+    background: #fff;
+
+    .tabList {
+      width: 100%;
+      height: 74px;
+      padding-top: 20px;
+      padding-left: 36px;
+      box-sizing: border-box;
+      display: flex;
+
+      .tab_item {
+        min-width: 58px;
+        margin-right: 56px;
+        .item {
+          font-size: 16px;
+          font-weight: 500;
+          color: #b1b1b1;
+          position: relative;
+          text-align: center;
+          cursor: pointer;
+        }
+        .tab_line {
+          width: 58px;
+          height: 6px;
+          background: #fff;
+          border-radius: 3px;
+          margin: 15px auto 0;
+        }
+      }
+
+      .tab_item_ac {
+        color: #fc7200;
+
+        .tab_line {
+          background: #fc7200;
+        }
+      }
+    }
+  }
+
+  .content {
+    width: 100%;
+    margin-top: 10px;
+    padding: 20px;
+    box-sizing: border-box;
+    background: #fff;
+  }
+}
+</style>

+ 3 - 3
src/components/addressManagement.vue

@@ -24,7 +24,7 @@
       <el-form ref="form" :model="form" label-width="100px" label-position="left" size="small">
         <el-form-item label="位置" required>
           <el-input v-model="form.address" placeholder="请选择位置!" disabled>
-            <img @click="showMap" slot="append" class="map" src="../../static/image/icon_map.png" />
+            <img @click="showMap" slot="append" class="map" src="../../../static/image/icon_map.png" />
           </el-input>
         </el-form-item>
         <el-form-item label="门牌号">
@@ -51,7 +51,7 @@
 </template>
 
 <script>
-import orderMap from "./orderComponents/orderAMap.vue";
+import orderMap from "../orderComponents/orderAMap.vue";
 import {
   getAddressList,
   deleteAddress,
@@ -59,7 +59,7 @@ import {
   updateAddress,
   getAddressDetail,
   defaultAddress,
-} from "../api/setting.js";
+} from "../../api/setting.js";
 export default {
   name: "addressManagement",
   data() {

+ 39 - 0
src/components/waimaiComponents/deliverySetting.vue

@@ -0,0 +1,39 @@
+<template>
+  <div>deliverySetting</div>
+</template>
+
+<script>
+export default {
+  name: "deliverySetting",
+  data() {
+    return {};
+  },
+  // 监听属性 类似于data概念
+  computed: {},
+  // 监控data中的数据变化
+  watch: {},
+  // 方法集合
+  methods: {},
+  // 生命周期 - 创建完成(可以访问当前this实例)
+  created() {},
+  // 生命周期 - 挂载完成(可以访问DOM元素)
+  mounted() {},
+  // 生命周期 - 创建之前
+  beforeCreate() {},
+  // 生命周期 - 挂载之前
+  beforeMount() {},
+  // 生命周期 - 更新之前
+  beforeUpdate() {},
+  // 生命周期 - 更新之后
+  updated() {},
+  // 生命周期 - 销毁之前
+  beforeDestroy() {},
+  // 生命周期 - 销毁完成
+  destroyed() {},
+  // 如果页面有keep-alive缓存功能,这个函数会触发
+  activated() {},
+};
+</script>
+
+<style lang="scss" scoped  type="text/css">
+</style>

+ 2 - 2
src/components/pictureManagement.vue

@@ -5,7 +5,7 @@
         <div class="name">同步商品图片</div>
         <div class="tips">(同步后显示最新的商品图片)</div>
       </div>
-      <img @click="syncFoodImg" class="img" src="../../static/image/update.png" alt="">
+      <img @click="syncFoodImg" class="img" src="../../../static/image/update.png" alt="">
     </div>
     <div class="set">
       <div class="title">
@@ -19,7 +19,7 @@
 </template>
 
 <script>
-import { getConfig, updateConfig, syncFoodImg } from "../api/setting.js";
+import { getConfig, updateConfig, syncFoodImg } from "../../api/setting.js";
 export default {
   name: "pictureManagement",
   data() {

+ 39 - 0
src/components/waimaiComponents/voiceSetting.vue

@@ -0,0 +1,39 @@
+<template>
+  <div>voiceSetting</div>
+</template>
+
+<script>
+export default {
+  name: "voiceSetting",
+  data() {
+    return {};
+  },
+  // 监听属性 类似于data概念
+  computed: {},
+  // 监控data中的数据变化
+  watch: {},
+  // 方法集合
+  methods: {},
+  // 生命周期 - 创建完成(可以访问当前this实例)
+  created() {},
+  // 生命周期 - 挂载完成(可以访问DOM元素)
+  mounted() {},
+  // 生命周期 - 创建之前
+  beforeCreate() {},
+  // 生命周期 - 挂载之前
+  beforeMount() {},
+  // 生命周期 - 更新之前
+  beforeUpdate() {},
+  // 生命周期 - 更新之后
+  updated() {},
+  // 生命周期 - 销毁之前
+  beforeDestroy() {},
+  // 生命周期 - 销毁完成
+  destroyed() {},
+  // 如果页面有keep-alive缓存功能,这个函数会触发
+  activated() {},
+};
+</script>
+
+<style lang="scss" scoped  type="text/css">
+</style>

+ 1 - 1
src/router/index.js

@@ -76,7 +76,7 @@ const router = new Router({
         {
           path: '/account/walletDetail',
           name: 'walletDetail',
-          title: '消费明细',
+          title: '收支明细',
           component: () => import('../components/shopAccount.vue')
         },
         {