|
|
@@ -1,489 +1,490 @@
|
|
|
-<template>
|
|
|
- <nav class="site-navbar" :class="'site-navbar--' + navbarLayoutType">
|
|
|
- <div class="site-navbar__header">
|
|
|
- <h1 class="site-navbar__brand" @click="$router.push({ name: 'home' })">
|
|
|
- <a class="site-navbar__brand-lg" href="javascript:;">墨轩云商商户管理平台</a>
|
|
|
- <a class="site-navbar__brand-mini" href="javascript:;">
|
|
|
- <img src="~@/assets/img/avatar.png" style="width: 25px;border-radius: 50%;">
|
|
|
- </a>
|
|
|
- </h1>
|
|
|
- </div>
|
|
|
- <div class="site-navbar__body clearfix">
|
|
|
- <el-menu class="site-navbar__menu" mode="horizontal">
|
|
|
- <el-menu-item class="site-navbar__switch" index="0" @click="sidebarFold = !sidebarFold">
|
|
|
- <icon-svg name="zhedie"></icon-svg>
|
|
|
- </el-menu-item>
|
|
|
- </el-menu>
|
|
|
- <el-menu class="site-navbar__menu site-navbar__menu--right" mode="horizontal">
|
|
|
- <!-- <el-menu-item index="1" style="position: relative;" @click="$router.push({ name: 'missionSm' })" v-if="show">
|
|
|
- <template slot="title">
|
|
|
- <span class="left-number" v-if="chatNum">{{chatNum}}</span>
|
|
|
- <icon-svg name="xiaoxi" class="el-icon-setting" style="font-size: 28px;"></icon-svg>
|
|
|
- <audio id="audio1" autoplay="autoplay" v-if="chatNum>0"
|
|
|
- src="https://pw.xianmxkj.com/file/uploadPath/2022/01/12/01beb0bc15549b9aa4d18027a7751bae.mp3" ref='audio'
|
|
|
- controls hidden></audio>
|
|
|
- </template>
|
|
|
- </el-menu-item> -->
|
|
|
- <el-menu-item index="1" style="position: relative;" @click="$router.push({ name: 'vueMchat' })">
|
|
|
- <template slot="title">
|
|
|
- <span class="left-number" v-if="chatNum2">{{chatNum2}}</span>
|
|
|
- <icon-svg name="xiaoxi" class="el-icon-setting" style="font-size: 28px;"></icon-svg>
|
|
|
- <!-- 消息提示 -->
|
|
|
- <audio id="audio" preload="auto">
|
|
|
- <!-- 消息 -->
|
|
|
- <source src="https://pw.xianmxkj.com/file/uploadPath/2022/01/19/0753211f78d718d44ee6372e33eae9ee.mp3"
|
|
|
- type="audio/mpeg">
|
|
|
- </audio>
|
|
|
- <!-- 订单提示 -->
|
|
|
- <audio id="audios" preload="auto" >
|
|
|
- <source
|
|
|
- src="https://pw.xianmxkj.com/file/uploadPath/2022/01/12/01beb0bc15549b9aa4d18027a7751bae.mp3"
|
|
|
- type="audio/mpeg">
|
|
|
- </audio>
|
|
|
- </template>
|
|
|
- </el-menu-item>
|
|
|
- <!-- <el-menu-item index="1" @click="$router.push({ name: 'theme' })">
|
|
|
- <template slot="title">
|
|
|
- <el-badge value="new">
|
|
|
- <icon-svg name="shezhi" class="el-icon-setting"></icon-svg>
|
|
|
- </el-badge>
|
|
|
- </template>
|
|
|
- </el-menu-item> -->
|
|
|
- <el-menu-item class="site-navbar__avatar" index="3">
|
|
|
- <el-dropdown :show-timeout="0" placement="bottom">
|
|
|
- <span class="el-dropdown-link">
|
|
|
- <img :src="shopDetails.shopCover" :alt="shopDetails.shopName">
|
|
|
- <!-- <img src="~@/assets/img/avatar.png" :alt="shopDetails.shopName">-->{{ shopDetails.shopName }}
|
|
|
- </span>
|
|
|
- <el-dropdown-menu slot="dropdown">
|
|
|
- <el-dropdown-item @click.native="updatePasswordHandle()">修改密码</el-dropdown-item>
|
|
|
- <el-dropdown-item @click.native="logoutHandle()">退出</el-dropdown-item>
|
|
|
- </el-dropdown-menu>
|
|
|
- </el-dropdown>
|
|
|
- </el-menu-item>
|
|
|
- </el-menu>
|
|
|
- </div>
|
|
|
- <!-- 弹窗, 修改密码 -->
|
|
|
- <update-password v-if="updatePassowrdVisible" ref="updatePassowrd"></update-password>
|
|
|
- </nav>
|
|
|
-</template>
|
|
|
-
|
|
|
-<script>
|
|
|
- import UpdatePassword from './main-navbar-update-password'
|
|
|
- import {
|
|
|
- clearLoginInfo
|
|
|
- } from '@/utils'
|
|
|
- export default {
|
|
|
- data() {
|
|
|
- return {
|
|
|
- updatePassowrdVisible: false,
|
|
|
- chatNum: 0,
|
|
|
- chatNum2: 0,
|
|
|
- intervalId: 0,
|
|
|
- errCount: 0,
|
|
|
- errCount2:0,
|
|
|
- shopIds: [],
|
|
|
- show: false,
|
|
|
- storeId: 0,
|
|
|
- shopDetails: {},
|
|
|
- lodNum:0,
|
|
|
- lodNums:0,
|
|
|
- ordersOkMessage:0,
|
|
|
- ordersClaneMessage:0,
|
|
|
-
|
|
|
- }
|
|
|
- },
|
|
|
- components: {
|
|
|
- UpdatePassword
|
|
|
- },
|
|
|
- computed: {
|
|
|
- navbarLayoutType: {
|
|
|
- get() {
|
|
|
- return this.$store.state.common.navbarLayoutType
|
|
|
- }
|
|
|
- },
|
|
|
- sidebarFold: {
|
|
|
- get() {
|
|
|
- return this.$store.state.common.sidebarFold
|
|
|
- },
|
|
|
- set(val) {
|
|
|
- this.$store.commit('common/updateSidebarFold', val)
|
|
|
- }
|
|
|
- },
|
|
|
- mainTabs: {
|
|
|
- get() {
|
|
|
- return this.$store.state.common.mainTabs
|
|
|
- },
|
|
|
- set(val) {
|
|
|
- this.$store.commit('common/updateMainTabs', val)
|
|
|
- }
|
|
|
- },
|
|
|
- userName: {
|
|
|
- get() {
|
|
|
- return this.$store.state.user.name
|
|
|
- }
|
|
|
- }
|
|
|
- },
|
|
|
- mounted() {
|
|
|
- // this.chatSelect()
|
|
|
- var userId = this.$cookie.get('userId')
|
|
|
- var shopDel = this.$cookie.get('shopDel')
|
|
|
- this.shopDetails = JSON.parse(shopDel)
|
|
|
- console.log('shopDel', JSON.parse(shopDel))
|
|
|
- this.$http({
|
|
|
- url: this.$http.adornUrl(`/sys/user/info`),
|
|
|
- method: 'get',
|
|
|
- params: this.$http.adornParams()
|
|
|
- }).then(({
|
|
|
- data
|
|
|
- }) => {
|
|
|
- if (data && data.code === 0) {
|
|
|
- var shows = 1
|
|
|
- for (var i in data.user.roleIdList) {
|
|
|
- if (data.user.roleIdList[i] == 12) {
|
|
|
- shows = 2
|
|
|
- } else {
|
|
|
- shows = 1
|
|
|
- }
|
|
|
- }
|
|
|
- console.log('shows', shows)
|
|
|
- if (shows == 2) {
|
|
|
- this.show = true
|
|
|
- }
|
|
|
- if (shows == 1) {
|
|
|
- this.show = false
|
|
|
- }
|
|
|
-
|
|
|
- if (this.show == true) {
|
|
|
- this.dataSelect()
|
|
|
- }
|
|
|
- }
|
|
|
- })
|
|
|
-
|
|
|
-
|
|
|
- },
|
|
|
- methods: {
|
|
|
- // 修改密码
|
|
|
- updatePasswordHandle() {
|
|
|
- this.updatePassowrdVisible = true
|
|
|
- this.$nextTick(() => {
|
|
|
- this.$refs.updatePassowrd.init()
|
|
|
- })
|
|
|
- },
|
|
|
- // 退出
|
|
|
- logoutHandle() {
|
|
|
- this.$confirm(`确定进行[退出]操作?`, '提示', {
|
|
|
- confirmButtonText: '确定',
|
|
|
- cancelButtonText: '取消',
|
|
|
- type: 'warning'
|
|
|
- }).then(() => {
|
|
|
- this.$http({
|
|
|
- url: this.$http.adornUrl('/sys/logout'),
|
|
|
- method: 'post',
|
|
|
- data: this.$http.adornData()
|
|
|
- }).then(({
|
|
|
- data
|
|
|
- }) => {
|
|
|
- if (data && data.code === 0) {
|
|
|
- clearLoginInfo()
|
|
|
- this.$cookie.set('token', '')
|
|
|
- sessionStorage.clear()
|
|
|
- clearInterval(this.chatNum)
|
|
|
- clearInterval(this.chatNum2)
|
|
|
- this.$router.push({
|
|
|
- name: 'login'
|
|
|
- })
|
|
|
- }
|
|
|
- })
|
|
|
- }).catch(() => {})
|
|
|
- },
|
|
|
- // 订单消息提醒
|
|
|
- newsSelect() {
|
|
|
- if(this.ordersOkMessage==0){
|
|
|
- this.ordersOkMessage=1
|
|
|
- }else{
|
|
|
- return
|
|
|
- }
|
|
|
- var _this = this
|
|
|
- var shopId = this.$cookie.get('shopId')
|
|
|
- this.$http({
|
|
|
- url: this.$http.adornUrl('admin/ordermessage/selectReadFlagCount'),
|
|
|
- method: 'post',
|
|
|
- params: this.$http.adornParams({
|
|
|
- 'shopIds': shopId
|
|
|
- })
|
|
|
- }).then(({
|
|
|
- data
|
|
|
- }) => {
|
|
|
- if (data.code == 0) {
|
|
|
- if (data.data > 0) {
|
|
|
- /* if (this.errCount != data.data) {
|
|
|
-
|
|
|
- }
|
|
|
- this.ordersOkMessage=0 */
|
|
|
- this.lodNums = 1
|
|
|
- this.lodNum = 0
|
|
|
- this.$notify.info({
|
|
|
- title: '消息',
|
|
|
- dangerouslyUseHTMLString: true,
|
|
|
- message: '有' + data.data + '条订单,请前往订单中心处理。',
|
|
|
- offset: 80,
|
|
|
- duration: 0,
|
|
|
- type: "warning",
|
|
|
- onClose() {
|
|
|
- _this.defineCallBack();
|
|
|
- }
|
|
|
- });
|
|
|
- this.errCount = data.data
|
|
|
- this.chatNum = data.data
|
|
|
-
|
|
|
- this.aplayAudio()
|
|
|
- this.quxiaoSocket(2)
|
|
|
- } else {
|
|
|
- this.ordersOkMessage=0
|
|
|
- this.lodNums = 0
|
|
|
- this.errCount = 0
|
|
|
- this.chatNum = 0
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
- })
|
|
|
- },
|
|
|
- // 取消订单消息提醒
|
|
|
- newsSelectQx() {
|
|
|
- if(this.ordersClaneMessage==0){
|
|
|
- this.ordersClaneMessage=1
|
|
|
- }else{
|
|
|
- return
|
|
|
- }
|
|
|
- var _this = this
|
|
|
- var shopId = this.$cookie.get('shopId')
|
|
|
- this.$http({
|
|
|
- url: this.$http.adornUrl('admin/ordermessage/selectReadFlagCount'),
|
|
|
- method: 'post',
|
|
|
- params: this.$http.adornParams({
|
|
|
- 'shopIds': shopId,
|
|
|
- 'orderType':1
|
|
|
- })
|
|
|
- }).then(({
|
|
|
- data
|
|
|
- }) => {
|
|
|
- if (data.code == 0) {
|
|
|
- if (data.data > 0) {
|
|
|
- /* if (this.errCount != data.data) {
|
|
|
-
|
|
|
- } */
|
|
|
- this.lodNums = 1
|
|
|
- this.lodNum = 0
|
|
|
- this.$notify.info({
|
|
|
- title: '消息',
|
|
|
- dangerouslyUseHTMLString: true,
|
|
|
- message: '有' + data.data + '条订单已取消,请前往订单中心查看。',
|
|
|
- offset: 80,
|
|
|
- duration: 0,
|
|
|
- type: "warning",
|
|
|
- onClose() {
|
|
|
- _this.defineCallBack();
|
|
|
- }
|
|
|
- });
|
|
|
-
|
|
|
- this.errCount = data.data
|
|
|
- this.chatNum = data.data
|
|
|
- this.aplayAudio()
|
|
|
- this.quxiaoSocket(1)
|
|
|
- } else {
|
|
|
- this.ordersClaneMessage=0
|
|
|
- this.lodNums = 0
|
|
|
- this.errCount = 0
|
|
|
- this.chatNum = 0
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
- })
|
|
|
- },
|
|
|
- quxiaoSocket(orderType){
|
|
|
- var shopId = this.$cookie.get('shopId')
|
|
|
- this.$http({
|
|
|
- url: this.$http.adornUrl('admin/ordermessage/allcheckOrderMessage'),
|
|
|
- method: 'post',
|
|
|
- params: this.$http.adornParams({
|
|
|
- 'shopIds': shopId,
|
|
|
- 'orderType':orderType
|
|
|
- })
|
|
|
- }).then(({
|
|
|
- data
|
|
|
- }) => {
|
|
|
- if(orderType==1){
|
|
|
- this.ordersClaneMessage=0
|
|
|
- }else{
|
|
|
- this.ordersOkMessage=0
|
|
|
- }
|
|
|
- console.log('清空消息',data)
|
|
|
- })
|
|
|
- },
|
|
|
- defineCallBack() {
|
|
|
- // this.$http({
|
|
|
- // url: this.$http.adornUrl('admin/ordermessage/allcheckOrderMessage'),
|
|
|
- // method: 'post',
|
|
|
- // params: this.$http.adornParams({
|
|
|
- // 'shopIds': this.shopIds.toString()
|
|
|
- // })
|
|
|
- // }).then(({
|
|
|
- // data
|
|
|
- // }) => {
|
|
|
- // if (data.code === 0) {
|
|
|
- // this.errCount = 0
|
|
|
- // this.chatNum = 0
|
|
|
- // this.$router.replace({
|
|
|
- // name: 'missionSm'
|
|
|
- // })
|
|
|
- // }
|
|
|
- // console.log('清空请求', data.data)
|
|
|
- // })
|
|
|
- this.$router.replace({
|
|
|
- name: 'missionSm'
|
|
|
- })
|
|
|
- // this.quxiaoSocket()
|
|
|
-
|
|
|
- },
|
|
|
- aplayAudio() {
|
|
|
- if(this.lodNum > 0){
|
|
|
- document.getElementById('audio').play()
|
|
|
- }
|
|
|
- if(this.lodNums > 0){
|
|
|
- document.getElementById('audios').play()
|
|
|
- }
|
|
|
- console.log('语音提示');
|
|
|
- console.log('语音提示')
|
|
|
- },
|
|
|
- // 获取店铺数据
|
|
|
- dataSelect() {
|
|
|
- this.tableDataLoading = true
|
|
|
- this.$http({
|
|
|
- url: this.$http.adornUrl('admin/goods/selectAllShop'),
|
|
|
- method: 'get',
|
|
|
- params: this.$http.adornParams({
|
|
|
- 'page': 1,
|
|
|
- 'limit': 10,
|
|
|
- 'shopName': ''
|
|
|
- })
|
|
|
- }).then(({
|
|
|
- data
|
|
|
- }) => {
|
|
|
- this.tableDataLoading = false
|
|
|
- var arr = []
|
|
|
- for (var i in data.data.list) {
|
|
|
- if (data.data.list[i].shopId) {
|
|
|
- arr.push(data.data.list[i].shopId)
|
|
|
- }
|
|
|
- }
|
|
|
- let returnData = data.data
|
|
|
- this.shopIds = arr
|
|
|
- /* this.newsSelect()
|
|
|
- this.newsSelectQx() */
|
|
|
- })
|
|
|
- },
|
|
|
- // 获取聊天消息
|
|
|
- chatSelect() {
|
|
|
- var shopId = this.$cookie.get('shopId')
|
|
|
- console.log('shopId--------------',shopId)
|
|
|
- this.$http({
|
|
|
- url: this.$http.adornUrl('shop/ordersChat/selectShopAllUnreadCount'),
|
|
|
- method: 'get',
|
|
|
- params: this.$http.adornParams({
|
|
|
- 'shopId': shopId
|
|
|
- })
|
|
|
- }).then(({
|
|
|
- data
|
|
|
- }) => {
|
|
|
- this.code = data.code
|
|
|
-
|
|
|
- if (data.data > 0) {
|
|
|
- if (this.errCount2 != data.data) {
|
|
|
- this.$notify.info({
|
|
|
- title: '消息',
|
|
|
- dangerouslyUseHTMLString: true,
|
|
|
- message: '您有' + data.data + '条未读消息。',
|
|
|
- offset: 80,
|
|
|
- duration: 2500,
|
|
|
- type: "warning"
|
|
|
- });
|
|
|
- this.chatNum2 = data.data
|
|
|
- this.errCount2 = data.data
|
|
|
- this.lodNum = 1
|
|
|
- this.lodNums = 0
|
|
|
- this.aplayAudio()
|
|
|
- }
|
|
|
- } else {
|
|
|
- console.log('this.chatNum2', this.chatNum2)
|
|
|
- this.chatNum2 = 0
|
|
|
- this.errCount2 = 0
|
|
|
- this.lodNum = 0
|
|
|
- this.lodNums = 0
|
|
|
- }
|
|
|
- if (this.chatNum == 0) {
|
|
|
- this.isshow = false
|
|
|
- } else {
|
|
|
- this.isshow = true
|
|
|
- }
|
|
|
-
|
|
|
- })
|
|
|
- },
|
|
|
- },
|
|
|
- created() {
|
|
|
- console.log('this.show', this.show)
|
|
|
- this.chatNum = setInterval(() => {
|
|
|
- var token = this.$cookie.get('token')
|
|
|
- if (token !== '') {
|
|
|
- this.newsSelect()
|
|
|
- this.newsSelectQx()
|
|
|
- } else {
|
|
|
- clearInterval(this.chatNum2)
|
|
|
- }
|
|
|
- }, 5000)
|
|
|
- this.chatNum2 = setInterval(() => {
|
|
|
- var token = this.$cookie.get('token')
|
|
|
- if (token !== '') {
|
|
|
- this.chatSelect()
|
|
|
- } else {
|
|
|
- clearInterval(this.chatNum2)
|
|
|
- }
|
|
|
- }, 6000)
|
|
|
-
|
|
|
- },
|
|
|
- beforeDestroy() {
|
|
|
- clearInterval(this.chatNum)
|
|
|
- },
|
|
|
- watch: {
|
|
|
- // 'chatNum': function() {
|
|
|
- // this.newsSelect()
|
|
|
- // this.newsSelectQx()
|
|
|
- // },
|
|
|
- // 'chatNum2': function() {
|
|
|
- // this.chatSelect()
|
|
|
- // }
|
|
|
- }
|
|
|
- }
|
|
|
-</script>
|
|
|
-<style scoped="scoped">
|
|
|
- .site-navbar__avatar .el-dropdown-link>img {
|
|
|
- height: 36px;
|
|
|
- }
|
|
|
-
|
|
|
- .left-number {
|
|
|
- position: absolute;
|
|
|
- top: 0;
|
|
|
- right: 20px;
|
|
|
- width: 18px;
|
|
|
- height: 18px;
|
|
|
- line-height: 18px;
|
|
|
- border-radius: 50%;
|
|
|
- background: #ff4949;
|
|
|
- color: #ffffff;
|
|
|
- text-align: center;
|
|
|
- font-size: 10px;
|
|
|
- font-family: PingFang SC, PingFang SC-Regular;
|
|
|
- font-weight: 400;
|
|
|
- margin-top: 5px;
|
|
|
- }
|
|
|
-</style>
|
|
|
+<template>
|
|
|
+ <nav class="site-navbar" :class="'site-navbar--' + navbarLayoutType">
|
|
|
+ <div class="site-navbar__header">
|
|
|
+ <h1 class="site-navbar__brand" @click="$router.push({ name: 'home' })">
|
|
|
+ <a class="site-navbar__brand-lg" href="javascript:;">墨轩云商商户管理平台</a>
|
|
|
+ <a class="site-navbar__brand-mini" href="javascript:;">
|
|
|
+ <img src="~@/assets/img/avatar.png" style="width: 25px;border-radius: 50%;">
|
|
|
+ </a>
|
|
|
+ </h1>
|
|
|
+ </div>
|
|
|
+ <div class="site-navbar__body clearfix">
|
|
|
+ <el-menu class="site-navbar__menu" mode="horizontal">
|
|
|
+ <el-menu-item class="site-navbar__switch" index="0" @click="sidebarFold = !sidebarFold">
|
|
|
+ <icon-svg name="zhedie"></icon-svg>
|
|
|
+ </el-menu-item>
|
|
|
+ </el-menu>
|
|
|
+ <el-menu class="site-navbar__menu site-navbar__menu--right" mode="horizontal">
|
|
|
+ <!-- <el-menu-item index="1" style="position: relative;" @click="$router.push({ name: 'missionSm' })" v-if="show">
|
|
|
+ <template slot="title">
|
|
|
+ <span class="left-number" v-if="chatNum">{{chatNum}}</span>
|
|
|
+ <icon-svg name="xiaoxi" class="el-icon-setting" style="font-size: 28px;"></icon-svg>
|
|
|
+ <audio id="audio1" autoplay="autoplay" v-if="chatNum>0"
|
|
|
+ src="https://pw.xianmxkj.com/file/uploadPath/2022/01/12/01beb0bc15549b9aa4d18027a7751bae.mp3" ref='audio'
|
|
|
+ controls hidden></audio>
|
|
|
+ </template>
|
|
|
+ </el-menu-item> -->
|
|
|
+ <el-menu-item index="1" style="position: relative;" @click="$router.push({ name: 'vueMchat' })">
|
|
|
+ <template slot="title">
|
|
|
+ <span class="left-number" v-if="chatNum2">{{chatNum2}}</span>
|
|
|
+ <icon-svg name="xiaoxi" class="el-icon-setting" style="font-size: 28px;"></icon-svg>
|
|
|
+ <!-- 消息提示 -->
|
|
|
+ <audio id="audio" preload="auto">
|
|
|
+ <!-- 消息 -->
|
|
|
+ <source src="https://pw.xianmxkj.com/file/uploadPath/2022/01/19/0753211f78d718d44ee6372e33eae9ee.mp3"
|
|
|
+ type="audio/mpeg">
|
|
|
+ </audio>
|
|
|
+ <!-- 订单提示 -->
|
|
|
+ <audio id="audios" preload="auto" >
|
|
|
+ <source
|
|
|
+ src="https://pw.xianmxkj.com/file/uploadPath/2022/01/12/01beb0bc15549b9aa4d18027a7751bae.mp3"
|
|
|
+ type="audio/mpeg">
|
|
|
+ </audio>
|
|
|
+ </template>
|
|
|
+ </el-menu-item>
|
|
|
+ <!-- <el-menu-item index="1" @click="$router.push({ name: 'theme' })">
|
|
|
+ <template slot="title">
|
|
|
+ <el-badge value="new">
|
|
|
+ <icon-svg name="shezhi" class="el-icon-setting"></icon-svg>
|
|
|
+ </el-badge>
|
|
|
+ </template>
|
|
|
+ </el-menu-item> -->
|
|
|
+ <el-menu-item class="site-navbar__avatar" index="3">
|
|
|
+ <el-dropdown :show-timeout="0" placement="bottom">
|
|
|
+ <span class="el-dropdown-link">
|
|
|
+ <img :src="shopDetails.shopCover" :alt="shopDetails.shopName">
|
|
|
+ <!-- <img src="~@/assets/img/avatar.png" :alt="shopDetails.shopName">-->{{ shopDetails.shopName }}
|
|
|
+ </span>
|
|
|
+ <el-dropdown-menu slot="dropdown">
|
|
|
+ <el-dropdown-item @click.native="updatePasswordHandle()">修改密码</el-dropdown-item>
|
|
|
+ <el-dropdown-item @click.native="logoutHandle()">退出</el-dropdown-item>
|
|
|
+ </el-dropdown-menu>
|
|
|
+ </el-dropdown>
|
|
|
+ </el-menu-item>
|
|
|
+ </el-menu>
|
|
|
+ </div>
|
|
|
+ <!-- 弹窗, 修改密码 -->
|
|
|
+ <update-password v-if="updatePassowrdVisible" ref="updatePassowrd"></update-password>
|
|
|
+ </nav>
|
|
|
+</template>
|
|
|
+
|
|
|
+<script>
|
|
|
+ import UpdatePassword from './main-navbar-update-password'
|
|
|
+ import {
|
|
|
+ clearLoginInfo
|
|
|
+ } from '@/utils'
|
|
|
+ export default {
|
|
|
+ data() {
|
|
|
+ return {
|
|
|
+ updatePassowrdVisible: false,
|
|
|
+ chatNum: 0,
|
|
|
+ chatNum2: 0,
|
|
|
+ intervalId: 0,
|
|
|
+ errCount: 0,
|
|
|
+ errCount2:0,
|
|
|
+ shopIds: [],
|
|
|
+ show: false,
|
|
|
+ storeId: 0,
|
|
|
+ shopDetails: {},
|
|
|
+ lodNum:0,
|
|
|
+ lodNums:0,
|
|
|
+ ordersOkMessage:0,
|
|
|
+ ordersClaneMessage:0,
|
|
|
+
|
|
|
+ }
|
|
|
+ },
|
|
|
+ components: {
|
|
|
+ UpdatePassword
|
|
|
+ },
|
|
|
+ computed: {
|
|
|
+ navbarLayoutType: {
|
|
|
+ get() {
|
|
|
+ return this.$store.state.common.navbarLayoutType
|
|
|
+ }
|
|
|
+ },
|
|
|
+ sidebarFold: {
|
|
|
+ get() {
|
|
|
+ return this.$store.state.common.sidebarFold
|
|
|
+ },
|
|
|
+ set(val) {
|
|
|
+ this.$store.commit('common/updateSidebarFold', val)
|
|
|
+ }
|
|
|
+ },
|
|
|
+ mainTabs: {
|
|
|
+ get() {
|
|
|
+ return this.$store.state.common.mainTabs
|
|
|
+ },
|
|
|
+ set(val) {
|
|
|
+ this.$store.commit('common/updateMainTabs', val)
|
|
|
+ }
|
|
|
+ },
|
|
|
+ userName: {
|
|
|
+ get() {
|
|
|
+ return this.$store.state.user.name
|
|
|
+ }
|
|
|
+ }
|
|
|
+ },
|
|
|
+ mounted() {
|
|
|
+ // this.chatSelect()
|
|
|
+ var userId = this.$cookie.get('userId')
|
|
|
+ var shopDel = this.$cookie.get('shopDel')
|
|
|
+ this.shopDetails = JSON.parse(shopDel)
|
|
|
+ console.log('shopDel', JSON.parse(shopDel))
|
|
|
+ this.$http({
|
|
|
+ url: this.$http.adornUrl(`/sys/user/info`),
|
|
|
+ method: 'get',
|
|
|
+ params: this.$http.adornParams()
|
|
|
+ }).then(({
|
|
|
+ data
|
|
|
+ }) => {
|
|
|
+ if (data && data.code === 0) {
|
|
|
+ this.$cookie.set('shopName', data.user.shopList[0].shopName)
|
|
|
+ var shows = 1
|
|
|
+ for (var i in data.user.roleIdList) {
|
|
|
+ if (data.user.roleIdList[i] == 12) {
|
|
|
+ shows = 2
|
|
|
+ } else {
|
|
|
+ shows = 1
|
|
|
+ }
|
|
|
+ }
|
|
|
+ console.log('shows', shows)
|
|
|
+ if (shows == 2) {
|
|
|
+ this.show = true
|
|
|
+ }
|
|
|
+ if (shows == 1) {
|
|
|
+ this.show = false
|
|
|
+ }
|
|
|
+
|
|
|
+ if (this.show == true) {
|
|
|
+ this.dataSelect()
|
|
|
+ }
|
|
|
+ }
|
|
|
+ })
|
|
|
+
|
|
|
+
|
|
|
+ },
|
|
|
+ methods: {
|
|
|
+ // 修改密码
|
|
|
+ updatePasswordHandle() {
|
|
|
+ this.updatePassowrdVisible = true
|
|
|
+ this.$nextTick(() => {
|
|
|
+ this.$refs.updatePassowrd.init()
|
|
|
+ })
|
|
|
+ },
|
|
|
+ // 退出
|
|
|
+ logoutHandle() {
|
|
|
+ this.$confirm(`确定进行[退出]操作?`, '提示', {
|
|
|
+ confirmButtonText: '确定',
|
|
|
+ cancelButtonText: '取消',
|
|
|
+ type: 'warning'
|
|
|
+ }).then(() => {
|
|
|
+ this.$http({
|
|
|
+ url: this.$http.adornUrl('/sys/logout'),
|
|
|
+ method: 'post',
|
|
|
+ data: this.$http.adornData()
|
|
|
+ }).then(({
|
|
|
+ data
|
|
|
+ }) => {
|
|
|
+ if (data && data.code === 0) {
|
|
|
+ clearLoginInfo()
|
|
|
+ this.$cookie.set('token', '')
|
|
|
+ sessionStorage.clear()
|
|
|
+ clearInterval(this.chatNum)
|
|
|
+ clearInterval(this.chatNum2)
|
|
|
+ this.$router.push({
|
|
|
+ name: 'login'
|
|
|
+ })
|
|
|
+ }
|
|
|
+ })
|
|
|
+ }).catch(() => {})
|
|
|
+ },
|
|
|
+ // 订单消息提醒
|
|
|
+ newsSelect() {
|
|
|
+ if(this.ordersOkMessage==0){
|
|
|
+ this.ordersOkMessage=1
|
|
|
+ }else{
|
|
|
+ return
|
|
|
+ }
|
|
|
+ var _this = this
|
|
|
+ var shopId = this.$cookie.get('shopId')
|
|
|
+ this.$http({
|
|
|
+ url: this.$http.adornUrl('admin/ordermessage/selectReadFlagCount'),
|
|
|
+ method: 'post',
|
|
|
+ params: this.$http.adornParams({
|
|
|
+ 'shopIds': shopId
|
|
|
+ })
|
|
|
+ }).then(({
|
|
|
+ data
|
|
|
+ }) => {
|
|
|
+ if (data.code == 0) {
|
|
|
+ if (data.data > 0) {
|
|
|
+ /* if (this.errCount != data.data) {
|
|
|
+
|
|
|
+ }
|
|
|
+ this.ordersOkMessage=0 */
|
|
|
+ this.lodNums = 1
|
|
|
+ this.lodNum = 0
|
|
|
+ this.$notify.info({
|
|
|
+ title: '消息',
|
|
|
+ dangerouslyUseHTMLString: true,
|
|
|
+ message: '有' + data.data + '条订单,请前往订单中心处理。',
|
|
|
+ offset: 80,
|
|
|
+ duration: 0,
|
|
|
+ type: "warning",
|
|
|
+ onClose() {
|
|
|
+ _this.defineCallBack();
|
|
|
+ }
|
|
|
+ });
|
|
|
+ this.errCount = data.data
|
|
|
+ this.chatNum = data.data
|
|
|
+
|
|
|
+ this.aplayAudio()
|
|
|
+ this.quxiaoSocket(2)
|
|
|
+ } else {
|
|
|
+ this.ordersOkMessage=0
|
|
|
+ this.lodNums = 0
|
|
|
+ this.errCount = 0
|
|
|
+ this.chatNum = 0
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ })
|
|
|
+ },
|
|
|
+ // 取消订单消息提醒
|
|
|
+ newsSelectQx() {
|
|
|
+ if(this.ordersClaneMessage==0){
|
|
|
+ this.ordersClaneMessage=1
|
|
|
+ }else{
|
|
|
+ return
|
|
|
+ }
|
|
|
+ var _this = this
|
|
|
+ var shopId = this.$cookie.get('shopId')
|
|
|
+ this.$http({
|
|
|
+ url: this.$http.adornUrl('admin/ordermessage/selectReadFlagCount'),
|
|
|
+ method: 'post',
|
|
|
+ params: this.$http.adornParams({
|
|
|
+ 'shopIds': shopId,
|
|
|
+ 'orderType':1
|
|
|
+ })
|
|
|
+ }).then(({
|
|
|
+ data
|
|
|
+ }) => {
|
|
|
+ if (data.code == 0) {
|
|
|
+ if (data.data > 0) {
|
|
|
+ /* if (this.errCount != data.data) {
|
|
|
+
|
|
|
+ } */
|
|
|
+ this.lodNums = 1
|
|
|
+ this.lodNum = 0
|
|
|
+ this.$notify.info({
|
|
|
+ title: '消息',
|
|
|
+ dangerouslyUseHTMLString: true,
|
|
|
+ message: '有' + data.data + '条订单已取消,请前往订单中心查看。',
|
|
|
+ offset: 80,
|
|
|
+ duration: 0,
|
|
|
+ type: "warning",
|
|
|
+ onClose() {
|
|
|
+ _this.defineCallBack();
|
|
|
+ }
|
|
|
+ });
|
|
|
+
|
|
|
+ this.errCount = data.data
|
|
|
+ this.chatNum = data.data
|
|
|
+ this.aplayAudio()
|
|
|
+ this.quxiaoSocket(1)
|
|
|
+ } else {
|
|
|
+ this.ordersClaneMessage=0
|
|
|
+ this.lodNums = 0
|
|
|
+ this.errCount = 0
|
|
|
+ this.chatNum = 0
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ })
|
|
|
+ },
|
|
|
+ quxiaoSocket(orderType){
|
|
|
+ var shopId = this.$cookie.get('shopId')
|
|
|
+ this.$http({
|
|
|
+ url: this.$http.adornUrl('admin/ordermessage/allcheckOrderMessage'),
|
|
|
+ method: 'post',
|
|
|
+ params: this.$http.adornParams({
|
|
|
+ 'shopIds': shopId,
|
|
|
+ 'orderType':orderType
|
|
|
+ })
|
|
|
+ }).then(({
|
|
|
+ data
|
|
|
+ }) => {
|
|
|
+ if(orderType==1){
|
|
|
+ this.ordersClaneMessage=0
|
|
|
+ }else{
|
|
|
+ this.ordersOkMessage=0
|
|
|
+ }
|
|
|
+ console.log('清空消息',data)
|
|
|
+ })
|
|
|
+ },
|
|
|
+ defineCallBack() {
|
|
|
+ // this.$http({
|
|
|
+ // url: this.$http.adornUrl('admin/ordermessage/allcheckOrderMessage'),
|
|
|
+ // method: 'post',
|
|
|
+ // params: this.$http.adornParams({
|
|
|
+ // 'shopIds': this.shopIds.toString()
|
|
|
+ // })
|
|
|
+ // }).then(({
|
|
|
+ // data
|
|
|
+ // }) => {
|
|
|
+ // if (data.code === 0) {
|
|
|
+ // this.errCount = 0
|
|
|
+ // this.chatNum = 0
|
|
|
+ // this.$router.replace({
|
|
|
+ // name: 'missionSm'
|
|
|
+ // })
|
|
|
+ // }
|
|
|
+ // console.log('清空请求', data.data)
|
|
|
+ // })
|
|
|
+ this.$router.replace({
|
|
|
+ name: 'missionSm'
|
|
|
+ })
|
|
|
+ // this.quxiaoSocket()
|
|
|
+
|
|
|
+ },
|
|
|
+ aplayAudio() {
|
|
|
+ if(this.lodNum > 0){
|
|
|
+ document.getElementById('audio').play()
|
|
|
+ }
|
|
|
+ if(this.lodNums > 0){
|
|
|
+ document.getElementById('audios').play()
|
|
|
+ }
|
|
|
+ console.log('语音提示');
|
|
|
+ console.log('语音提示')
|
|
|
+ },
|
|
|
+ // 获取店铺数据
|
|
|
+ dataSelect() {
|
|
|
+ this.tableDataLoading = true
|
|
|
+ this.$http({
|
|
|
+ url: this.$http.adornUrl('admin/goods/selectAllShop'),
|
|
|
+ method: 'get',
|
|
|
+ params: this.$http.adornParams({
|
|
|
+ 'page': 1,
|
|
|
+ 'limit': 10,
|
|
|
+ 'shopName': ''
|
|
|
+ })
|
|
|
+ }).then(({
|
|
|
+ data
|
|
|
+ }) => {
|
|
|
+ this.tableDataLoading = false
|
|
|
+ var arr = []
|
|
|
+ for (var i in data.data.list) {
|
|
|
+ if (data.data.list[i].shopId) {
|
|
|
+ arr.push(data.data.list[i].shopId)
|
|
|
+ }
|
|
|
+ }
|
|
|
+ let returnData = data.data
|
|
|
+ this.shopIds = arr
|
|
|
+ /* this.newsSelect()
|
|
|
+ this.newsSelectQx() */
|
|
|
+ })
|
|
|
+ },
|
|
|
+ // 获取聊天消息
|
|
|
+ chatSelect() {
|
|
|
+ var shopId = this.$cookie.get('shopId')
|
|
|
+ console.log('shopId--------------',shopId)
|
|
|
+ this.$http({
|
|
|
+ url: this.$http.adornUrl('shop/ordersChat/selectShopAllUnreadCount'),
|
|
|
+ method: 'get',
|
|
|
+ params: this.$http.adornParams({
|
|
|
+ 'shopId': shopId
|
|
|
+ })
|
|
|
+ }).then(({
|
|
|
+ data
|
|
|
+ }) => {
|
|
|
+ this.code = data.code
|
|
|
+
|
|
|
+ if (data.data > 0) {
|
|
|
+ if (this.errCount2 != data.data) {
|
|
|
+ this.$notify.info({
|
|
|
+ title: '消息',
|
|
|
+ dangerouslyUseHTMLString: true,
|
|
|
+ message: '您有' + data.data + '条未读消息。',
|
|
|
+ offset: 80,
|
|
|
+ duration: 2500,
|
|
|
+ type: "warning"
|
|
|
+ });
|
|
|
+ this.chatNum2 = data.data
|
|
|
+ this.errCount2 = data.data
|
|
|
+ this.lodNum = 1
|
|
|
+ this.lodNums = 0
|
|
|
+ this.aplayAudio()
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ console.log('this.chatNum2', this.chatNum2)
|
|
|
+ this.chatNum2 = 0
|
|
|
+ this.errCount2 = 0
|
|
|
+ this.lodNum = 0
|
|
|
+ this.lodNums = 0
|
|
|
+ }
|
|
|
+ if (this.chatNum == 0) {
|
|
|
+ this.isshow = false
|
|
|
+ } else {
|
|
|
+ this.isshow = true
|
|
|
+ }
|
|
|
+
|
|
|
+ })
|
|
|
+ },
|
|
|
+ },
|
|
|
+ created() {
|
|
|
+ console.log('this.show', this.show)
|
|
|
+ this.chatNum = setInterval(() => {
|
|
|
+ var token = this.$cookie.get('token')
|
|
|
+ if (token !== '') {
|
|
|
+ this.newsSelect()
|
|
|
+ this.newsSelectQx()
|
|
|
+ } else {
|
|
|
+ clearInterval(this.chatNum2)
|
|
|
+ }
|
|
|
+ }, 5000)
|
|
|
+ this.chatNum2 = setInterval(() => {
|
|
|
+ var token = this.$cookie.get('token')
|
|
|
+ if (token !== '') {
|
|
|
+ this.chatSelect()
|
|
|
+ } else {
|
|
|
+ clearInterval(this.chatNum2)
|
|
|
+ }
|
|
|
+ }, 6000)
|
|
|
+
|
|
|
+ },
|
|
|
+ beforeDestroy() {
|
|
|
+ clearInterval(this.chatNum)
|
|
|
+ },
|
|
|
+ watch: {
|
|
|
+ // 'chatNum': function() {
|
|
|
+ // this.newsSelect()
|
|
|
+ // this.newsSelectQx()
|
|
|
+ // },
|
|
|
+ // 'chatNum2': function() {
|
|
|
+ // this.chatSelect()
|
|
|
+ // }
|
|
|
+ }
|
|
|
+ }
|
|
|
+</script>
|
|
|
+<style scoped="scoped">
|
|
|
+ .site-navbar__avatar .el-dropdown-link>img {
|
|
|
+ height: 36px;
|
|
|
+ }
|
|
|
+
|
|
|
+ .left-number {
|
|
|
+ position: absolute;
|
|
|
+ top: 0;
|
|
|
+ right: 20px;
|
|
|
+ width: 18px;
|
|
|
+ height: 18px;
|
|
|
+ line-height: 18px;
|
|
|
+ border-radius: 50%;
|
|
|
+ background: #ff4949;
|
|
|
+ color: #ffffff;
|
|
|
+ text-align: center;
|
|
|
+ font-size: 10px;
|
|
|
+ font-family: PingFang SC, PingFang SC-Regular;
|
|
|
+ font-weight: 400;
|
|
|
+ margin-top: 5px;
|
|
|
+ }
|
|
|
+</style>
|