Funny 3 år sedan
förälder
incheckning
62d1416ac2
2 ändrade filer med 116 tillägg och 41 borttagningar
  1. 3 1
      src/App.vue
  2. 113 40
      src/components/Home.vue

+ 3 - 1
src/App.vue

@@ -63,7 +63,9 @@ export default {
   destroyed() {},
   methods: {
     getSoundMsg() {
-      getSoundMsg().then((res) => {
+      getSoundMsg({
+        searchShopIdStr: localStorage.getItem("searchShopIdStr"),
+      }).then((res) => {
         if (res.code === 200) {
           if (res.data) {
             let name = res.data.slice(0, res.data.indexOf("."));

+ 113 - 40
src/components/Home.vue

@@ -12,19 +12,30 @@
       </el-col>
       <el-col :span="12" class="search">
         <div class="header_serch">
-            <el-input size="small" class="inp" placeholder="请输入内容" v-model="input3">
-              
-            </el-input>
-            <el-input size="small" class="inp" v-model="searchKey" placeholder="选择手机号/姓名/地址/订单编号/流水号" @keydown.enter.native="seachEnterFun" clearable>
-              <el-select v-model="select" 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="3"></el-option>
-                <el-option label="流水号" value="3"></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>
+          <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> -->
         </div>
@@ -52,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() {
@@ -95,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,
       },
@@ -109,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);
@@ -144,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;
@@ -166,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;
@@ -188,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();
@@ -222,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) {
@@ -257,6 +306,7 @@ export default {
       let params = {
         orderIds: orderIds,
         status: this.tabList[this.tabNum].status,
+        searchShopIdStr: this.params.searchShopIdStr,
       };
       getRefreshOrder(params).then((res) => {
         if (res.code === 200) {
@@ -382,6 +432,29 @@ export default {
         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;