This commit is contained in:
faiz 2024-08-19 19:48:02 +08:00
parent 195a076a37
commit 4f2bfadbfb
3 changed files with 218 additions and 154 deletions

View File

@ -1,16 +1,37 @@
<template> <template>
<div v-if="!item.hidden"> <div v-if="!item.hidden">
<template v-if="hasOneShowingChild(item.children,item) && (!onlyOneChild.children||onlyOneChild.noShowingChildren)&&!item.alwaysShow"> <template
v-if="
hasOneShowingChild(item.children, item) &&
(!onlyOneChild.children || onlyOneChild.noShowingChildren) &&
!item.alwaysShow
"
>
<app-link v-if="onlyOneChild.meta" :to="resolvePath(onlyOneChild.path)"> <app-link v-if="onlyOneChild.meta" :to="resolvePath(onlyOneChild.path)">
<el-menu-item :index="resolvePath(onlyOneChild.path)" :class="{'submenu-title-noDropdown':!isNest}"> <el-menu-item
<item :icon="onlyOneChild.meta.icon||(item.meta&&item.meta.icon)" :title="onlyOneChild.meta.title" /> :index="resolvePath(onlyOneChild.path)"
:class="{ 'submenu-title-noDropdown': !isNest }"
>
<item
:icon="onlyOneChild.meta.icon || (item.meta && item.meta.icon)"
:title="onlyOneChild.meta.title"
/>
</el-menu-item> </el-menu-item>
</app-link> </app-link>
</template> </template>
<el-submenu v-else ref="subMenu" :index="resolvePath(item.path)" popper-append-to-body> <el-submenu
v-else
ref="subMenu"
:index="resolvePath(item.path)"
popper-append-to-body
>
<template slot="title"> <template slot="title">
<item v-if="item.meta" :icon="item.meta && item.meta.icon" :title="item.meta.title" /> <item
v-if="item.meta"
:icon="item.meta && item.meta.icon"
:title="item.meta.title"
/>
</template> </template>
<sidebar-item <sidebar-item
v-for="child in item.children" v-for="child in item.children"
@ -25,71 +46,72 @@
</template> </template>
<script> <script>
import path from 'path' import path from "path";
import { isExternal } from '@/utils/validate' import { isExternal } from "@/utils/validate";
import Item from './Item' import Item from "./Item";
import AppLink from './Link' import AppLink from "./Link";
import FixiOSBug from './FixiOSBug' import FixiOSBug from "./FixiOSBug";
export default { export default {
name: 'SidebarItem', name: "SidebarItem",
components: { Item, AppLink }, components: { Item, AppLink },
mixins: [FixiOSBug], mixins: [FixiOSBug],
props: { props: {
// route object // route object
item: { item: {
type: Object, type: Object,
required: true required: true,
}, },
isNest: { isNest: {
type: Boolean, type: Boolean,
default: false default: false,
}, },
basePath: { basePath: {
type: String, type: String,
default: '' default: "",
} },
}, },
data() { data() {
// To fix https://github.com/PanJiaChen/vue-admin-template/issues/237 // To fix https://github.com/PanJiaChen/vue-admin-template/issues/237
// TODO: refactor with render function // TODO: refactor with render function
this.onlyOneChild = null this.onlyOneChild = null;
return {} return {};
}, },
methods: { methods: {
hasOneShowingChild(children = [], parent) { hasOneShowingChild(children = [], parent) {
const showingChildren = children.filter(item => { const showingChildren = children.filter((item) => {
if (item.hidden) { if (item.hidden) {
return false return false;
} else { } else {
// Temp set(will be used if only has one showing child) // Temp set(will be used if only has one showing child)
this.onlyOneChild = item this.onlyOneChild = item;
return true return true;
} }
}) });
// When there is only one child router, the child router is displayed by default // When there is only one child router, the child router is displayed by default
if (showingChildren.length === 1) { if (showingChildren.length === 1) {
return true return true;
} }
// Show parent if there are no child router to display // Show parent if there are no child router to display
if (showingChildren.length === 0) { if (showingChildren.length === 0) {
this.onlyOneChild = { ... parent, path: '', noShowingChildren: true } this.onlyOneChild = { ...parent, path: "", noShowingChildren: true };
return true return true;
} }
return false return false;
}, },
resolvePath(routePath) { resolvePath(routePath) {
routePath = routePath.replace(/\/:[a-zA-Z]+/g, "");
if (isExternal(routePath)) { if (isExternal(routePath)) {
return routePath return routePath;
} }
if (isExternal(this.basePath)) { if (isExternal(this.basePath)) {
return this.basePath return this.basePath;
} }
return path.resolve(this.basePath, routePath) return path.resolve(this.basePath, routePath);
} },
} },
} };
</script> </script>

View File

@ -1,9 +1,13 @@
<template> <template>
<div :class="classObj" class="app-wrapper"> <div :class="classObj" class="app-wrapper">
<div v-if="device==='mobile'&&sidebar.opened" class="drawer-bg" @click="handleClickOutside" /> <div
v-if="device === 'mobile' && sidebar.opened"
class="drawer-bg"
@click="handleClickOutside"
/>
<sidebar class="sidebar-container" /> <sidebar class="sidebar-container" />
<div :class="{hasTagsView:needTagsView}" class="main-container"> <div :class="{ hasTagsView: needTagsView }" class="main-container">
<div :class="{'fixed-header':fixedHeader}"> <div :class="{ 'fixed-header': fixedHeader }">
<navbar /> <navbar />
<tags-view v-if="needTagsView" /> <tags-view v-if="needTagsView" />
</div> </div>
@ -16,104 +20,129 @@
</template> </template>
<script> <script>
import RightPanel from '@/components/RightPanel' import RightPanel from "@/components/RightPanel";
import { AppMain, Navbar, Settings, Sidebar, TagsView } from './components' import { AppMain, Navbar, Settings, Sidebar, TagsView } from "./components";
import ResizeMixin from './mixin/ResizeHandler' import ResizeMixin from "./mixin/ResizeHandler";
import { mapState } from 'vuex' import { mapState } from "vuex";
import { getToken } from '@/utils/auth' import { getToken } from "@/utils/auth";
export default { export default {
name: 'Layout', name: "Layout",
components: { components: {
AppMain, AppMain,
Navbar, Navbar,
RightPanel, RightPanel,
Settings, Settings,
Sidebar, Sidebar,
TagsView TagsView,
}, },
mixins: [ResizeMixin], mixins: [ResizeMixin],
computed: { computed: {
...mapState({ ...mapState({
sidebar: state => state.app.sidebar, sidebar: (state) => state.app.sidebar,
device: state => state.app.device, device: (state) => state.app.device,
showSettings: state => state.settings.showSettings, showSettings: (state) => state.settings.showSettings,
needTagsView: state => state.settings.tagsView, needTagsView: (state) => state.settings.tagsView,
fixedHeader: state => state.settings.fixedHeader fixedHeader: (state) => state.settings.fixedHeader,
}), }),
classObj() { classObj() {
return { return {
hideSidebar: !this.sidebar.opened, hideSidebar: !this.sidebar.opened,
openSidebar: this.sidebar.opened, openSidebar: this.sidebar.opened,
withoutAnimation: this.sidebar.withoutAnimation, withoutAnimation: this.sidebar.withoutAnimation,
mobile: this.device === 'mobile' mobile: this.device === "mobile",
} };
} },
}, },
data(){ data() {
return { return {
iswork:null iswork: null,
} };
}, },
created(){ created() {
this.iswork = setInterval(()=>{ this.iswork = setInterval(() => {
let toke = getToken() let toke = getToken();
if(!toke || toke.length <= 0) return; if (!toke || toke.length <= 0) return;
this.$axios.get('/admin/index/iswork').then(res=>{ this.$axios
if(res && res.data.new > 0) { .get("/admin/index/iswork")
this.$notify({ .then((res) => {
title: '新的订单提醒', if (res && res.data.new > 0) {
duration: 0, this.$notify({
dangerouslyUseHTMLString: true, title: "新的订单提醒",
message: '<strong>你有('+res.data.new+')个新的订单,需要处理</strong>' duration: 0,
}); dangerouslyUseHTMLString: true,
} message:
if(res && res.data.follow > 0) { "<strong>你有(" +
this.$notify({ res.data.new +
title: '新的跟进提醒', ")个新的订单,需要处理</strong>",
duration: 10000, });
dangerouslyUseHTMLString: true, }
message: '<strong>你有('+res.data.follow+')个跟进订单,需要处理</strong>' if (res && res.data.follow > 0) {
}); this.$notify({
} title: "新的跟进提醒",
if(res && res.data.back > 0) { duration: 10000,
this.$notify({ dangerouslyUseHTMLString: true,
title: '转单申请', message:
duration: 10000, "<strong>你有(" +
dangerouslyUseHTMLString: true, res.data.follow +
message: '<strong>你有('+res.data.back+')个转单订单,需要处理</strong>' ")个跟进订单,需要处理</strong>",
}); });
} }
if(res && res.data.order_write_off > 0) { if (res && res.data.back > 0) {
this.$notify({ this.$notify({
title: '订单核销', title: "转单申请",
duration: 10000, duration: 10000,
dangerouslyUseHTMLString: true, dangerouslyUseHTMLString: true,
message: '<strong>你有('+res.data.order_write_off+')个核销订单</strong>' message:
}); "<strong>你有(" +
} res.data.back +
if(res && res.data.follow_message > 0) { ")个转单订单,需要处理</strong>",
this.$notify({ });
// res.data.follow_order_id }
title: '跟进提醒', if (res && res.data.order_write_off > 0) {
duration: 50000, this.$notify({
dangerouslyUseHTMLString: true, title: "订单核销",
message: '<strong>你有('+res.data.follow_message+')个跟进提醒</strong>', duration: 10000,
onClick: this.followDetail(res.orderId) dangerouslyUseHTMLString: true,
}); message:
} "<strong>你有(" +
}).catch(err=>{ res.data.order_write_off +
console.log(err) ")个核销订单</strong>",
}) });
},3000); }
if (res && res.data.follow_message > 0) {
this.$notify({
// res.data.follow_order_id
title: "跟进提醒",
duration: 50000,
dangerouslyUseHTMLString: true,
message:
"<strong>你有(" +
res.data.follow_message +
")个跟进提醒</strong>",
onClick: () => {
this.$router.push({
path: "/order/index/",
query: { id: res.data.follow_order_id },
});
},
});
}
})
.catch((err) => {
console.log(err);
});
}, 30000);
}, },
methods: { methods: {
handleClickOutside() { handleClickOutside() {
this.$store.dispatch('app/closeSideBar', { withoutAnimation: false }) this.$store.dispatch("app/closeSideBar", { withoutAnimation: false });
}, },
followDetail(orderId) { followDetail(orderId) {
console.log(orderId);
},onInfo(item) { // this.$router.push({ path: "/order/index/" + orderId });
},
onInfo(item) {
this.value = null; this.value = null;
this.next_follow = null; this.next_follow = null;
this.$set(item, "next_follow", null); this.$set(item, "next_follow", null);
@ -126,51 +155,51 @@ export default {
this.dialogVisible = true; this.dialogVisible = true;
}) })
.catch((err) => {}); .catch((err) => {});
} },
} },
} };
</script> </script>
<style lang="scss" scoped> <style lang="scss" scoped>
@import "~@/styles/mixin.scss"; @import "~@/styles/mixin.scss";
@import "~@/styles/variables.scss"; @import "~@/styles/variables.scss";
.app-wrapper { .app-wrapper {
@include clearfix; @include clearfix;
position: relative; position: relative;
height: 100%; height: 100%;
width: 100%; width: 100%;
&.mobile.openSidebar { &.mobile.openSidebar {
position: fixed;
top: 0;
}
}
.drawer-bg {
background: #000;
opacity: 0.3;
width: 100%;
top: 0;
height: 100%;
position: absolute;
z-index: 999;
}
.fixed-header {
position: fixed; position: fixed;
top: 0; top: 0;
right: 0;
z-index: 9;
width: calc(100% - #{$sideBarWidth});
transition: width 0.28s;
} }
}
.hideSidebar .fixed-header { .drawer-bg {
width: calc(100% - 54px) background: #000;
} opacity: 0.3;
width: 100%;
top: 0;
height: 100%;
position: absolute;
z-index: 999;
}
.mobile .fixed-header { .fixed-header {
width: 100%; position: fixed;
} top: 0;
right: 0;
z-index: 9;
width: calc(100% - #{$sideBarWidth});
transition: width 0.28s;
}
.hideSidebar .fixed-header {
width: calc(100% - 54px);
}
.mobile .fixed-header {
width: 100%;
}
</style> </style>

View File

@ -181,7 +181,11 @@
<el-table-column align="center" fixed label="电话" width="140"> <el-table-column align="center" fixed label="电话" width="140">
<template slot-scope="scope"> <template slot-scope="scope">
<span>{{ scope.row.mobile }}</span> <span>{{ scope.row.mobile }}</span>
<span style="display:block;font-size: 12px;">{{ scope.row.mobileInfo.area }}-{{ scope.row.mobileInfo.originalIsp }}</span> <span style="display: block; font-size: 12px"
>{{ scope.row.mobileInfo.area }}-{{
scope.row.mobileInfo.originalIsp
}}</span
>
</template> </template>
</el-table-column> </el-table-column>
@ -234,7 +238,7 @@
}" }"
type="primary" type="primary"
> >
{{ scope.row.appointment_status == 1 ? '已预约' : '未预约' }} {{ scope.row.appointment_status == 1 ? "已预约" : "未预约" }}
</div> </div>
</template> </template>
</el-table-column> </el-table-column>
@ -643,7 +647,7 @@ export default {
zhubo: null, zhubo: null,
os_status: [], os_status: [],
}, },
item: { next_follow: "", personnel: {} }, item: { next_follow: "", personnel: { adult: "" } },
follow: [], follow: [],
dialogVisible: false, dialogVisible: false,
@ -657,7 +661,7 @@ export default {
flowObj: "", flowObj: "",
os: null, // 12 3 os: null, // 12 3
}, },
os_arr: { 1: "美团", 2: "快手", 3: "抖音(甄选)", 5:"抖音(新国旅)" }, os_arr: { 1: "美团", 2: "快手", 3: "抖音(甄选)", 5: "抖音(新国旅)" },
adminList: [], adminList: [],
form: {}, form: {},
rules: { rules: {
@ -673,19 +677,28 @@ export default {
if (this.$route.query.start && this.$route.query.end) { if (this.$route.query.start && this.$route.query.end) {
this.listQuery.times = [this.$route.query.start, this.$route.query.end]; this.listQuery.times = [this.$route.query.start, this.$route.query.end];
} }
// console.log(typeof this.$route.params.id);
this.setQuery("status"); this.setQuery("status");
this.setQuery("os_status"); this.setQuery("os_status");
this.setQuery("times"); this.setQuery("times");
await this.getList(); await this.getList();
await this.setOneClickRepair(); if (!this.$route.query.id) {
await this.getList(); await this.setOneClickRepair();
await this.getList();
}
this.getShortcutContent(); this.getShortcutContent();
this.getAdminList(); this.getAdminList();
}, },
mounted() {
console.log(this.$route.query.id);
if (this.$route.query.id) {
this.onInfo({ id: this.$route.query.id });
}
},
computed: { computed: {
tableMaxHeight() { tableMaxHeight() {
return window.innerHeight - 320 + 'px'; return window.innerHeight - 320 + "px";
} },
}, },
methods: { methods: {
setQuery(key) { setQuery(key) {
@ -759,10 +772,10 @@ export default {
resetForm(formName) { resetForm(formName) {
this.$refs[formName].resetFields(); this.$refs[formName].resetFields();
}, },
getAdminList(typeDesc = '') { getAdminList(typeDesc = "") {
this.$axios this.$axios
.get("/admin/admin/index", { .get("/admin/admin/index", {
params: { limit: 100, status: 1, is_order: 1, type_desc:typeDesc }, params: { limit: 100, status: 1, is_order: 1, type_desc: typeDesc },
}) })
.then((response) => { .then((response) => {
this.adminList = response.data.data; this.adminList = response.data.data;