|
@@ -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 {
|