Browse Source

feat 自动配送弹窗

Funny 3 years ago
parent
commit
e6a9dbb368
1 changed files with 54 additions and 2 deletions
  1. 54 2
      src/components/settingComponents/voiceSetting.vue

+ 54 - 2
src/components/settingComponents/voiceSetting.vue

@@ -15,7 +15,7 @@
       </div>
       <div class="t-right">
         <span>默认下单{{autodeliveryOrderTime}}分钟后</span>
-        <el-switch @change="updateConfig" v-model="openAutodelivery" :active-value="1" :inactive-value="0" />
+        <el-switch @change="autodelivery" v-model="openAutodelivery" :active-value="1" :inactive-value="0" />
       </div>
     </div>
     <div class="top-set">
@@ -53,6 +53,18 @@
         </el-row>
       </div>
     </div>
+    <!-- // 选择自动配送运力 -->
+    <el-dialog title="自动配送设置" :visible.sync="centerDialogVisible" width="800px" center>
+      <el-input placeholder="请输入自动配送时长" v-model="input" clearable>
+      </el-input>
+      <div class="delivery-list">
+        <div class="delivery" v-for="(v,i) in deliveryList" :key="i">{{v.name}}</div>
+      </div>
+      <span slot="footer" class="dialog-footer">
+        <el-button size="mideum" @click="centerDialogVisible = false">取 消</el-button>
+        <el-button type="primary" @click="centerDialogVisible = false">确 定</el-button>
+      </span>
+    </el-dialog>
   </div>
 </template>
 
@@ -63,6 +75,7 @@ import {
   queryPushMessageStatus,
   updateSavePushMessageStatus,
 } from "../../api/setting.js";
+import { floorListDelivery } from '../../api/shop.js'
 export default {
   data() {
     return {
@@ -70,15 +83,32 @@ export default {
       openAutodelivery: 0,
       openAutoorder: 0,
       openPrintSwitch: 0,
+      input: 300,
       autodeliveryOrderTime: 0,
       msasterSwitch: 0,
+      centerDialogVisible: false,
+      autodeliveryIds: [],
+      deliveryList: [], // 运力列表
     };
   },
   created() {
     this.getConfig();
     this.queryPushMessageStatus();
+    this.floorListDelivery()
   },
   methods: {
+    floorListDelivery(){
+      floorListDelivery().then(res=>{
+        if(res.code === 200){
+          this.deliveryList = res.data
+        }else{
+          this.$message({
+            type: 'error',
+            message: res.msg
+          })
+        }
+      })
+    },
     changeMessageStatus() {
       this.voiceList = this.voiceList.map((v) => {
         v.msasterSwitch = this.msasterSwitch;
@@ -93,6 +123,7 @@ export default {
           this.openAutodelivery = res.data.openAutodelivery;
           this.openAutoorder = res.data.openAutoorder;
           this.openPrintSwitch = res.data.openPrintSwitch;
+          this.autodeliveryIds = res.data.autodeliveryIds.split(',')
         } else {
           this.$message({
             type: "error",
@@ -137,7 +168,12 @@ export default {
         }
       );
     },
-    updateConfig(time) {
+    autodelivery() {
+      if (this.openAutodelivery === 1) {
+        this.centerDialogVisible = true;
+      }
+    },
+    updateConfig() {
       let params = {};
       if (time) {
         params = {
@@ -244,5 +280,21 @@ export default {
       }
     }
   }
+  .delivery-list {
+    display: flex;
+    flex-wrap: wrap;
+    margin-top: 20px;
+    .delivery {
+      margin: 0 20px 20px 0;
+      width: 100px;
+      height: 30px;
+      line-height: 30px;
+      text-align: center;
+      border-radius: 25px;
+      border: 1px solid #999;
+      color: #999999;
+      cursor: pointer;
+    }
+  }
 }
 </style>