Browse Source

Merge branch 'dev_electron' into dev

Funny 3 years ago
parent
commit
f88151d8a2
5 changed files with 121 additions and 43 deletions
  1. BIN
      dist.zip
  2. 1 1
      src/common/sider.vue
  3. 118 41
      src/components/Home.vue
  4. 1 1
      src/router/index.js
  5. 1 0
      vue.config.js

BIN
dist.zip


+ 1 - 1
src/common/sider.vue

@@ -125,7 +125,7 @@ export default {
     };
   },
   created() {
-    console.log(router.options.routes);
+    // console.log(router.options.routes);
     //this.items = [...router.options.routes];
     // 通过 Event Bus 进行组件间通信,来折叠侧边栏
     bus.$on("collapse", (msg) => {

+ 118 - 41
src/components/Home.vue

@@ -1,7 +1,7 @@
 <template>
   <div class="mainContent">
     <el-row class="order_tab">
-      <el-col :span="15">
+      <el-col :span="12">
         <div class="tabList">
           <div class="tab_item" @click="changeTab(i, item.status)" :class="{ tab_item_ac: tabNum == i ? true : false }" v-for="(item, i) in tabList" :key="i">
             <div class="point" v-show="item.num">{{ item.num }}</div>
@@ -10,14 +10,34 @@
           </div>
         </div>
       </el-col>
-      <el-col :span="9" class="search">
+      <el-col :span="12" class="search">
         <div class="header_serch">
-          <div class="search_inp">
-            <el-input size="small" class="inp" v-model="searchKey" placeholder="手机号/姓名/地址/订单编号" @keydown.enter.native="seachEnterFun" clearable></el-input>
-            <el-button size="small" style="background: #0D1E40;color:#fff" type="info" @click.stop="search" slot="append" icon="el-icon-search"></el-button>
+          <div class="inp-content">
+            <span>门店</span>
+            <el-select size="small" @change="changeShopIds" v-model="searchShopIdStr" multiple collapse-tags filterable clearable placeholder="默认全部门店">
+              <el-option v-for="i in shopList" :key="i.id" :label="i.name" :value="i.id"></el-option>
+            </el-select>
           </div>
+          <!-- <div class="inp-content">
+            <span>订单来源</span>
+            <el-select size="small" v-model="form.searchKeyType" slot="prepend" placeholder="请选择关键字">
+              <el-option label="流水号" value="1"></el-option>
+            </el-select>
+          </div> -->
+
+          <el-input size="small" class="inp input-with-select" v-model="params.searchKey" placeholder="请输入关键字" @keydown.enter.native="seachEnterFun" clearable>
+            <el-select v-model="params.searchKeyType" slot="prepend" placeholder="请选择关键字">
+              <el-option label="流水号" value="1"></el-option>
+              <el-option label="手机号" value="2"></el-option>
+              <el-option label="姓名" value="3"></el-option>
+              <el-option label="地址" value="4"></el-option>
+              <el-option label="订单号" value="5"></el-option>
+              <el-option label="外卖订单号" value="6"></el-option>
+            </el-select>
+          </el-input>
+          <el-button size="small" style="background: #0D1E40;color:#fff" type="info" @click.stop="search" slot="append" icon="el-icon-search"></el-button>
           <!-- 1.0.0版本暂不开发该功能 -->
-          <el-button class="btn" size='small' @click="$router.push({path:'/manualCreate'})">手动发单</el-button>
+          <!-- <el-button class="btn" size='small' @click="$router.push({path:'/manualCreate'})">手动发单</el-button> -->
         </div>
       </el-col>
     </el-row>
@@ -43,6 +63,7 @@ import bus from "../common/bus.js";
 import sendOrderPopup from "./orderComponents/sendOrderPopup.vue";
 import OrderList from "./orderComponents/orderList.vue";
 import { getOrderList, getOrderMarker, getRefreshOrder } from "../api/order.js";
+import { getShopList } from "../api/shop";
 export default {
   name: "HomeIndex",
   data() {
@@ -86,13 +107,21 @@ export default {
           num: 0,
           status: -1,
         },
+        {
+          name: "近三日订单",
+          num: 0,
+          status: 94,
+        },
       ],
       tabNum: 0,
       needTrack: false,
       orderDetailStutus: 1,
+      searchShopIdStr: [],
       params: {
         status: 0,
         searchType: 0,
+        searchKey: "",
+        searchKeyType: "1",
         pageNum: 1,
         pageSize: 10,
       },
@@ -100,14 +129,24 @@ export default {
       clickBool: false,
       timer: null,
       timer2: null,
-      searchKey: "",
+      shopList: [],
     };
   },
   components: {
     sendOrderPopup,
     OrderList,
   },
-
+  watch: {
+    "$store.state.userInfo": {
+      handler(newVal, oldVal) {
+        if (newVal.memberType !== 1) {
+          this.getShopList();
+        }
+      },
+      deep: true,
+      immediate: true,
+    },
+  },
   created() {
     if (this.$route.params.tabNum === 2) {
       this.changeTab(2, 1);
@@ -135,6 +174,22 @@ export default {
     bus.$off("refreshData");
   },
   methods: {
+    changeShopIds() {
+      this.params.searchShopIdStr = String(this.searchShopIdStr);
+      localStorage.setItem("searchShopIdStr", this.params.searchShopIdStr);
+    },
+    getShopList() {
+      getShopList().then((res) => {
+        if (res.code === 200) {
+          this.shopList = res.data;
+        } else {
+          this.$message({
+            type: "error",
+            message: res.msg,
+          });
+        }
+      });
+    },
     init() {
       bus.$on("pullData", (index) => {
         this.tabNum = index;
@@ -157,15 +212,15 @@ export default {
       }
     },
     search() {
-      this.$router.push({
-        path: "/orderSearch",
-        query: {
-          searchKey: this.searchKey,
-        },
-      });
-      // this.params.pageNum = 1;
-      // this.orderList = [];
-      // this.getOrder();
+      // this.$router.push({
+      //   path: "/orderSearch",
+      //   query: {
+      //     searchKey: this.searchKey,
+      //   },
+      // });
+      this.params.pageNum = 1;
+      this.orderList = [];
+      this.getOrder();
     },
     handleSizeChange(val) {
       this.params.pageNum = 1;
@@ -179,23 +234,25 @@ export default {
       this.getOrder();
     },
     getMarker() {
-      getOrderMarker().then((res) => {
-        if (res.code === 200) {
-          this.markerNum = res.data;
-          this.tabList[0].num = res.data.toBeBillNum;
-          this.tabList[1].num = res.data.appointNum;
-          this.tabList[2].num = res.data.toBeReceivedNum;
-          this.tabList[3].num = res.data.toBePickedNum;
-          this.tabList[4].num = res.data.inDeliveryNum;
-          this.tabList[5].num = res.data.exceptionNum;
-          this.tabList[6].num = res.data.cancelNum;
-        } else {
-          this.$message({
-            type: "error",
-            message: res.msg,
-          });
+      getOrderMarker({ searchShopIdStr: this.params.searchShopIdStr }).then(
+        (res) => {
+          if (res.code === 200) {
+            this.markerNum = res.data;
+            this.tabList[0].num = res.data.toBeBillNum;
+            this.tabList[1].num = res.data.appointNum;
+            this.tabList[2].num = res.data.toBeReceivedNum;
+            this.tabList[3].num = res.data.toBePickedNum;
+            this.tabList[4].num = res.data.inDeliveryNum;
+            this.tabList[5].num = res.data.exceptionNum;
+            this.tabList[6].num = res.data.cancelNum;
+          } else {
+            this.$message({
+              type: "error",
+              message: res.msg,
+            });
+          }
         }
-      });
+      );
     },
     sendOrder() {
       this.$refs.sendOrderPopup.init();
@@ -213,6 +270,7 @@ export default {
       var hour = minute * 60;
       var day = hour * 24;
       this.isLoading = true;
+      this.params.searchShopIdStr = String(this.searchShopIdStr);
       getOrderList(this.params).then((res) => {
         this.isLoading = false;
         if (res.code == 200) {
@@ -242,12 +300,16 @@ export default {
       });
     },
     getRefreshOrder() {
+      if(this.params.status === 94){
+        return
+      }
       let orderIds = this.orderList.map((v) => {
         return v.id;
       });
       let params = {
         orderIds: orderIds,
         status: this.tabList[this.tabNum].status,
+        searchShopIdStr: this.params.searchShopIdStr,
       };
       getRefreshOrder(params).then((res) => {
         if (res.code === 200) {
@@ -367,14 +429,35 @@ export default {
       display: flex;
       justify-content: flex-end;
       .header_serch {
-        width: 80%;
         height: 74px;
         padding-right: 25px;
         box-sizing: border-box;
         display: flex;
         align-items: center;
         justify-content: flex-end;
-
+        .inp-content {
+          display: flex;
+          align-items: center;
+          font-size: 15px;
+          color: #999;
+          span {
+            flex-shrink: 0;
+            margin-right: 5px;
+          }
+        }
+        .inp {
+          width: 120px;
+          margin-left: 15px;
+          /deep/ .el-input-group__prepend {
+            background: #fff;
+            .el-input__inner {
+              width: 114px;
+            }
+          }
+          /deep/ .el-input__inner {
+            width: 200px;
+          }
+        }
         .Manual {
           width: 118px;
           height: 44px;
@@ -400,12 +483,6 @@ export default {
           align-items: center;
           position: relative;
 
-          .inp {
-            width: 100%;
-            // height: 44px;
-            border: none;
-          }
-
           .btn {
             font-size: 22px;
             position: absolute;

+ 1 - 1
src/router/index.js

@@ -14,7 +14,7 @@ const router = new Router({
   routes: [
     {
       path: '/',
-      name: 'home',
+      // name: 'home',
       component: () => import('../views/home.vue'),
       title: '一键发单',
       icon: '/static/image/order-icon.png',

+ 1 - 0
vue.config.js

@@ -17,6 +17,7 @@ module.exports = {
         path.resolve(__dirname, './src/assets/styles/*.scss')      //你的.scss文件所在目录
       ]
     },
+    // 桌面应用打包配置
     electronBuilder: {
       builderOptions: {
         // build配置在此处