Funny 3 anni fa
parent
commit
90f0f073ed

+ 23 - 0
src/api/setting.js

@@ -2,4 +2,27 @@ import { get, post, postJson } from './http.js';
 
 export const getSoundMsg = (params) => {
   return get('app/message/getSoundMsg', params)
+}
+
+// 获取配置
+export const getConfig = (params) => {
+  return get('app/member/detail', params)
+}
+
+// 修改配置
+export const updateConfig = (params) => {
+  return post('app/member/config', params)
+}
+
+// 消息推送语音提示查询
+export const queryPushMessageStatus = (params) => {
+  return get('app/message/queryPushMessageStatus', params)
+}
+// 消息推送语音提示修改
+export const updateSavePushMessageStatus = (params) => {
+  return postJson('app/message/updateSavePushMessageStatus', params)
+}
+// 获取运力推荐、屏蔽
+export const getDeliveryFloorList = (params) => {
+  return get('app/delivery/floor/list', params)
 }

+ 74 - 64
src/components/settingComponents/deliverySetting.vue

@@ -6,89 +6,94 @@
     <div class="recommend">
       <div class="title">
         <!-- <el-button type="primary" @click.stop="toPay">发起支付</el-button> -->
-        <span>推荐运力</span>
+        <span>推荐/屏蔽运力</span>
         <span>用户选择非聚合配送发单时,优先选中的运力置顶显示,提高您的下单效率</span>
       </div>
       <div class="delivery-list">
-        <div class="item" v-for="count in 12" :key="count">
-          <img src="../../../static/image/delivery-icon.png" class="icon" />
+        <div class="item" v-for="(v,i) in list" :key="i">
+          <img :src="v.pcLogo" class="icon" />
+          <div class="mantle"></div>
         </div>
       </div>
     </div>
-    <div class="recommend">
+    <!-- <div class="recommend">
       <div class="title">
-        <!-- <el-button type="primary" @click.stop="toPay">发起支付</el-button> -->
         <span>屏蔽运力</span>
         <span>用户选择非聚合配送发单时,优先选中的运力置顶显示,提高您的下单效率</span>
       </div>
       <div class="delivery-list">
-        <div class="item item-opcity" v-for="count in 12" :key="count">
-          <img src="../../../static/image/delivery-icon.png" class="icon" />
+        <div class="item item-opcity" v-for="v in list" :key="v">
+          <img :src="v.pcLogo" class="icon" />
         </div>
       </div>
-    </div>
-    <!-- <div id="qrcode"></div> -->
+    </div> -->
   </div>
 </template>
 
 <script>
-  import QRCode from "qrcodejs2"
-  export default {
-    data() {
-      return {
-        form: '',
-        link: 'https://qr.alipay.com/bax06037qiyd8v6h0q7f0009'
-      }
-    },
-    mounted() {
-      // this.$nextTick(()=>{
-      //   this.qrcode();
-      // })
+import {
+  getDeliveryFloorList,
+  getConfig,
+  updateConfig,
+} from "../../api/setting.js";
+export default {
+  data() {
+    return {
+      form: "",
+      list: [],
+      billDeliveryIds: "", // 推荐运力ID
+      shieldDeliveryIds: "", // 屏蔽运力ID
+    };
+  },
+  created() {
+    this.getDeliveryFloorList();
+    this.getConfig();
+  },
+  mounted() {},
+  methods: {
+    getDeliveryFloorList() {
+      getDeliveryFloorList().then((res) => {
+        if (res.code === 200) {
+          this.list = res.data;
+        } else {
+          this.$message({
+            type: "error",
+            message: res.msg,
+          });
+        }
+      });
     },
-    components: {
-      QRCode
+    getConfig() {
+      getConfig().then((res) => {
+        if (res.code === 200) {
+          this.billDeliveryIds = res.data.billDeliveryIds;
+          this.shieldDeliveryIds = res.data.shieldDeliveryIds;
+        } else {
+          this.$message({
+            type: "error",
+            message: res.msg,
+          });
+        }
+      });
     },
-    methods: {
-      //  生成二维码
-      qrcode() {
-        let that = this;
-        let qrcode = new QRCode('qrcode', {
-          width: 124,
-          height: 124, // 高度
-          text: this.link, // 二维码内容
-          // render: 'canvas' ,   // 设置渲染方式(有两种方式 table和canvas,默认是canvas)
-          // background: '#f0f',   // 背景色
-          // foreground: '#ff0'    // 前景色
-        })
-      },
-      toPay() {
-        fetch(
-          'http://121.4.100.145:8082/app/pay/getPayCode?amount=10.89&body=测试下单&orderNo=210915133735016908&token=cedebb6e872f539bef8c3f919874e9d7', {
-            methods: 'GET'
-          }).then(res => {
-          return res.json()
-        }).then(result => {
-          console.log(result);
-          if (result.code == 200) {
-            let divForm = document.getElementsByTagName('divform')
-            if (divForm.length) {
-              document.body.removeChild(divForm[0])
-            }
-            const div = document.createElement('divform')
-            div.innerHTML = result.data // res.data就是sb支付宝返回给你的form
-            document.body.appendChild(div)
-            // document.forms[0].setAttribute('target', '_blank') // 加了_blank可能出问题所以我注释了
-            document.forms[0].submit()
-          } else {
-            return this.$message({
-              message: result.msg,
-              type: 'error'
-            })
-          }
-        })
+  },
+  updateConfig() {
+    updateConfig().then((res) => {
+      if (res.code === 200) {
+        this.$message({
+          type: "success",
+          message: "修改成功!",
+        });
+        this.getConfig();
+      } else {
+        this.$message({
+          type: "error",
+          message: res.msg,
+        });
       }
-    }
-  }
+    });
+  },
+};
 </script>
 
 <style lang="scss" scoped>
@@ -110,7 +115,7 @@
         font-size: 14px;
         font-family: PingFang SC;
         font-weight: 400;
-        color: #B1B1B1;
+        color: #b1b1b1;
       }
     }
     .delivery-list {
@@ -118,6 +123,7 @@
       flex-wrap: wrap;
       padding: 30px 18px 0;
       .item {
+        position: relative;
         font-size: 0;
         width: 166px;
         height: 50px;
@@ -125,6 +131,10 @@
         overflow: hidden;
         margin-right: 50px;
         margin-bottom: 30px;
+        .mantle{
+          position: absolute;
+            
+        }
         .icon {
           width: 100%;
           height: 100%;

+ 150 - 24
src/components/settingComponents/voiceSetting.vue

@@ -3,11 +3,28 @@
     <div class="top-set">
       <div class="t-left">
         自动接单
-        <span>[时长设置]</span>
       </div>
       <div class="t-right">
-        <span>默认下单5分钟后</span>
-        <el-switch />
+        <el-switch @change="updateConfig" v-model="openAutoorder" :active-value="1" :inactive-value="0" />
+      </div>
+    </div>
+    <div class="top-set">
+      <div class="t-left">
+        自动配送(暂不支持预约单)
+        <span @click="open">[时长设置]</span>
+      </div>
+      <div class="t-right">
+        <span>默认下单{{autodeliveryOrderTime}}分钟后</span>
+        <el-switch @change="updateConfig" v-model="openAutodelivery" :active-value="1" :inactive-value="0" />
+      </div>
+    </div>
+    <div class="top-set">
+      <div class="t-left">
+        自动打印
+        <span>(开启后将为您自动打印小票)</span>
+      </div>
+      <div class="t-right">
+        <el-switch @change="updateConfig" v-model="openPrintSwitch" :active-value="1" :inactive-value="0" />
       </div>
     </div>
     <div class="voice-content">
@@ -17,7 +34,7 @@
         </div>
         <div class="t-right">
           <span>一键开启</span>
-          <el-switch />
+          <el-switch @change="changeMessageStatus" v-model="msasterSwitch" :active-value="1" :inactive-value="0" />
         </div>
       </div>
       <div class="voice-list">
@@ -29,7 +46,7 @@
                 <span>{{ item.name }}</span>
               </div>
               <div class="right">
-                <el-switch />
+                <el-switch @change="updateSavePushMessageStatus" v-model="item.msasterSwitch" :active-value="1" :inactive-value="0" />
               </div>
             </div>
           </el-col>
@@ -40,26 +57,135 @@
 </template>
 
 <script>
-  export default {
-    data() {
-      return {
-        voiceList: [
-          { id: 1, name: '新订单提醒', url: '' },
-          { id: 2, name: '配送5分钟无人接单提醒', url: '' },
-          { id: 3, name: '骑手接单提醒', url: '' },
-          { id: 4, name: '骑手取消配送提醒', url: '' },
-          { id: 5, name: '配送超时自动取消提醒', url: '' },
-          { id: 6, name: '配送取消提醒', url: '' },
-          { id: 7, name: '顾客取消订单提醒', url: '' },
-          { id: 8, name: '账户余额不足100元提醒', url: '' },
-          { id: 9, name: '账户余额不足50元提醒', url: '' }
-        ]
+import {
+  getConfig,
+  updateConfig,
+  queryPushMessageStatus,
+  updateSavePushMessageStatus,
+} from "../../api/setting.js";
+export default {
+  data() {
+    return {
+      voiceList: [],
+      openAutodelivery: 0,
+      openAutoorder: 0,
+      openPrintSwitch: 0,
+      autodeliveryOrderTime: 0,
+      msasterSwitch: 0,
+    };
+  },
+  created() {
+    this.getConfig();
+    this.queryPushMessageStatus();
+  },
+  methods: {
+    changeMessageStatus() {
+      this.voiceList = this.voiceList.map((v) => {
+        v.msasterSwitch = this.msasterSwitch;
+        return v;
+      });
+      this.updateSavePushMessageStatus();
+    },
+    getConfig() {
+      getConfig().then((res) => {
+        if (res.code === 200) {
+          this.autodeliveryOrderTime = res.data.autodeliveryOrderTime / 60;
+          this.openAutodelivery = res.data.openAutodelivery;
+          this.openAutoorder = res.data.openAutoorder;
+          this.openPrintSwitch = res.data.openPrintSwitch;
+        } else {
+          this.$message({
+            type: "error",
+            message: res.msg,
+          });
+        }
+      });
+    },
+    queryPushMessageStatus() {
+      queryPushMessageStatus().then((res) => {
+        if (res.code === 200) {
+          this.voiceList = res.data;
+          let msasterSwitchList = res.data.map((v) => {
+            return v.msasterSwitch;
+          });
+          let msasterSwitch = [...new Set(msasterSwitchList)];
+          this.msasterSwitch =
+            msasterSwitch.length === 1 && msasterSwitch[0] === 1 ? 1 : 0;
+        } else {
+          this.$message({
+            type: "error",
+            message: res.msg,
+          });
+        }
+      });
+    },
+    updateSavePushMessageStatus() {
+      updateSavePushMessageStatus({ orderPushMessages: this.voiceList }).then(
+        (res) => {
+          if (res.code === 200) {
+            this.$message({
+              type: "success",
+              message: "修改成功!",
+            });
+            this.queryPushMessageStatus();
+          } else {
+            this.$message({
+              type: "error",
+              message: res.msg,
+            });
+          }
+        }
+      );
+    },
+    updateConfig(time) {
+      let params = {};
+      if (time) {
+        params = {
+          autodeliveryOrderTime: time * 60,
+          openAutodelivery: this.openAutodelivery,
+          openAutoorder: this.openAutoorder,
+          openPrintSwitch: this.openPrintSwitch,
+        };
+      } else {
+        params = {
+          openAutodelivery: this.openAutodelivery,
+          openAutoorder: this.openAutoorder,
+          openPrintSwitch: this.openPrintSwitch,
+        };
       }
+      updateConfig(params).then((res) => {
+        if (res.code === 200) {
+          this.$message({
+            type: "success",
+            message: "修改成功!",
+          });
+          this.getConfig();
+        } else {
+          this.$message({
+            type: "error",
+            message: res.msg,
+          });
+        }
+      });
     },
-    methods: {
-
-    }
-  }
+    open() {
+      this.$prompt("请设置时长(分钟)", "开启自动配送", {
+        confirmButtonText: "确定",
+        cancelButtonText: "取消",
+        inputValue: this.autodeliveryOrderTime,
+      })
+        .then(({ value }) => {
+          this.updateConfig(value);
+        })
+        .catch(() => {
+          this.$message({
+            type: "info",
+            message: "取消输入",
+          });
+        });
+    },
+  },
+};
 </script>
 
 <style lang="scss" scoped>
@@ -87,7 +213,7 @@
       font-size: 14px;
       font-family: PingFang SC;
       font-weight: 400;
-      color: #B1B1B1;
+      color: #b1b1b1;
     }
   }
   .voice-content {