lion 3 years ago
parent ef0137c3be
commit 9b1455c22d

@ -0,0 +1,17 @@
import request from "@/utils/request";
export function getNotice(params){
return request({
url:'/api/merchant/home/get-notice',
method:'get',
params
})
}
export function toggleRead(data){
return request({
url:'/api/admin/merchant/toggle-read',
method:"post",
data
})
}

@ -1,140 +1,312 @@
<template> <template>
<div class="navbar"> <div class="navbar">
<hamburger :is-active="sidebar.opened" class="hamburger-container" @toggleClick="toggleSideBar" /> <hamburger
:is-active="sidebar.opened"
<breadcrumb class="breadcrumb-container" /> class="hamburger-container"
@toggleClick="toggleSideBar"
<div class="right-menu"> />
<el-dropdown class="avatar-container" trigger="click">
<div class="avatar-wrapper"> <breadcrumb class="breadcrumb-container" />
<img src="../../assets/face.jpg" class="user-avatar">
<i class="el-icon-caret-bottom" /> <div class="right-menu">
</div> <el-dropdown
<el-dropdown-menu slot="dropdown" class="user-dropdown"> class="message-container"
<router-link to="/"> trigger="click"
<el-dropdown-item> :hide-on-click="false"
系统首页 >
</el-dropdown-item> <div class="message-wrapper">
</router-link> <i class="el-icon-chat-dot-square" />
<router-link to="/info/password"> <span>消息中心</span>
<el-dropdown-item> </div>
个人信息 <template v-slot:dropdown>
</el-dropdown-item> <el-dropdown-menu class="message-dropdown">
</router-link> <!-- <el-dropdown-item>
<el-dropdown-item divided @click.native="logout"> <Button
<span style="display:block;">退出</span> :ghost="messageStatus !== 2"
</el-dropdown-item> type="error"
</el-dropdown-menu> size="small"
</el-dropdown> shape="circle"
</div> icon="ios-close"
</div> @click.native="messageStatus = 2,getNotice()"
</template> >未读</Button
>
<script> <Button
import { :ghost="messageStatus !== 1"
mapGetters type="success"
} from 'vuex' size="small"
import Breadcrumb from '@/components/Breadcrumb' shape="circle"
import Hamburger from '@/components/Hamburger' icon="ios-checkmark"
style="margin-left: 10px"
export default { @click.native="messageStatus = 1,getNotice()"
components: { >已读</Button
Breadcrumb, >
Hamburger </el-dropdown-item> -->
}, <template v-if="noticeData.length > 0">
computed: { <template v-for="(item, index) in noticeData">
...mapGetters([ <el-dropdown-item :divided="!index">
'sidebar', <div style="display: flex; align-items: center">
'avatar' <div v-for="(value, key) in item.data">
]) {{item.created_at}} {{ key }} : {{ value }}
}, </div>
methods: { <Button
toggleSideBar() { style="margin-left: 10px;"
this.$store.dispatch('app/toggleSideBar') size="small"
}, :type="item.read_at ? 'success' : 'primary'"
async logout() { :icon="item.read_at ? 'md-checkmark' : 'ios-create-outline'"
await this.$store.dispatch('user/logout') @click="toggleMessage(item)"
this.$router.push(`/login?redirect=${this.$route.fullPath}`) >{{ item.read_at ? "已读" : "标为已读" }}</Button
} >
} </div>
} </el-dropdown-item>
</script> </template>
</template>
<style lang="scss" scoped> <template v-else>
.navbar { <div style="min-width:200px;text-align: center;color: rgb(140,140,140);padding: 10px 0;">暂无通知</div>
height: 50px; </template>
overflow: hidden; </el-dropdown-menu>
position: relative; </template>
background: #fff; </el-dropdown>
box-shadow: 0 1px 4px rgba(0, 21, 41, .08);
<el-dropdown class="avatar-container" trigger="click">
.hamburger-container { <div class="avatar-wrapper">
line-height: 46px; <img src="../../assets/face.jpg" class="user-avatar" />
height: 100%; <i class="el-icon-caret-bottom" />
float: left; </div>
cursor: pointer; <el-dropdown-menu slot="dropdown" class="user-dropdown">
transition: background .3s; <router-link to="/">
-webkit-tap-highlight-color: transparent; <el-dropdown-item> 系统首页 </el-dropdown-item>
</router-link>
&:hover { <el-dropdown-item divided @click.native="logout">
background: rgba(0, 0, 0, .025) <span style="display: block">退出</span>
} </el-dropdown-item>
} </el-dropdown-menu>
</el-dropdown>
.breadcrumb-container { </div>
float: left;
} <!-- <el-drawer-->
<!-- size="36%"-->
.right-menu { <!-- append-to-body-->
float: right; <!-- :visible.sync="showDrawer"-->
height: 100%; <!-- direction="rtl">-->
line-height: 50px; <!-- <Table size="small" :loading="isLoading" :columns="columns" :data="noticeData"></Table>-->
<!-- </el-drawer>-->
&:focus { </div>
outline: none; </template>
}
<script>
.right-menu-item { import { mapGetters } from "vuex";
display: inline-block; import Breadcrumb from "@/components/Breadcrumb";
padding: 0 8px; import Hamburger from "@/components/Hamburger";
height: 100%;
font-size: 18px; import { getNotice, toggleRead } from "@/api/notice";
color: #5a5e66; export default {
vertical-align: text-bottom; components: {
Breadcrumb,
&.hover-effect { Hamburger,
cursor: pointer; },
transition: background .3s; data() {
return {
&:hover { // showDrawer:false,
background: rgba(0, 0, 0, .025) // // messageType:'',
} // message: {
} // : "MerchantBalance",
} // : "OrderItemMemberCancel",
// 48退: "OrderItemMerchantAutoRecover",
.avatar-container { // : "OrderItemMerchantCancel",
margin-right: 30px; // 退: "OrderItemMerchantReturn",
// },
.avatar-wrapper {
margin-top: 5px; //isLoading:false,
position: relative; noticeData: [],
messageStatus: 2,
.user-avatar { // columns:[
cursor: pointer; // {
width: 40px; // width: 160,
height: 40px; // title:"",
border-radius: 10px; // key:"read_at"
} // },
// {
.el-icon-caret-bottom { // title:"",
cursor: pointer; // render:(h,{row,column,index}) => {
position: absolute; // let getContent = () => {
right: -20px; // let keys = []
top: 25px; // if(row?.data && typeof row.data === 'object') keys = Object.keys(row?.data)
font-size: 12px; // return keys.map(item => {
} // return h('span',{},`${item}:${row.data[item]}`)
} // })
} // console.log(keys)
} // }
} // return h('div',{},getContent())
// }
// },
// {
// title:"",
// width:120,
// render:(h,{row,column,index}) => {
// return h('Button',{
// props:row?.read_at ? {
// size:"small",
// type:'success',
// icon:'md-checkmark'
// } : {
// size:"small",
// type:'primary',
// icon:'ios-create-outline'
// },
// on:{
// ['click']:async () => {
// if(row?.read_at) return
//
// const res = await toggleRead({
// id:row.id
// })
// this.$message({
// type:'success',
// message:res?.msg || ""
// })
// this.messageClick(this.messageType)
// }
// }
// },row?.read_at ? '' : '')
// }
// },
// ]
};
},
computed: {
...mapGetters(["sidebar", "avatar"]),
},
methods: {
toggleMessage(item){
if(item.read_at) return
toggleRead({
id:item.id
}).then(res => {
this.$message({
type:'success',
message:res?.msg || "成功"
})
this.getNotice()
})
},
async getNotice() {
let res = await getNotice({
// read_state: this.messageStatus,
type:"MerchantBalance"
});
console.log(res);
this.noticeData = res.data;
},
toggleSideBar() {
this.$store.dispatch("app/toggleSideBar");
},
async logout() {
await this.$store.dispatch("user/logout");
this.$router.push(`/login?redirect=${this.$route.fullPath}`);
},
},
mounted() {
this.getNotice();
},
};
</script>
<style lang="scss" scoped>
.navbar {
height: 50px;
overflow: hidden;
position: relative;
background: #fff;
box-shadow: 0 1px 4px rgba(0, 21, 41, 0.08);
.hamburger-container {
line-height: 46px;
height: 100%;
float: left;
cursor: pointer;
transition: background 0.3s;
-webkit-tap-highlight-color: transparent;
&:hover {
background: rgba(0, 0, 0, 0.025);
}
}
.breadcrumb-container {
float: left;
}
.right-menu {
display: flex;
justify-content: flex-end;
height: 100%;
line-height: 50px;
&:focus {
outline: none;
}
.right-menu-item {
display: inline-block;
padding: 0 8px;
height: 100%;
font-size: 18px;
color: #5a5e66;
vertical-align: text-bottom;
&.hover-effect {
cursor: pointer;
transition: background 0.3s;
&:hover {
background: rgba(0, 0, 0, 0.025);
}
}
}
.avatar-container {
margin-right: 30px;
.avatar-wrapper {
margin-top: 5px;
position: relative;
.user-avatar {
cursor: pointer;
width: 40px;
height: 40px;
border-radius: 10px;
}
.el-icon-caret-bottom {
cursor: pointer;
position: absolute;
right: -20px;
top: 25px;
font-size: 12px;
}
}
}
.message-container {
margin-right: 20px;
.message-wrapper {
height: 100%;
padding: 0 6px;
& > i {
font-weight: 600;
}
& > span {
font-weight: 600;
padding-left: 6px;
}
}
}
}
}
</style> </style>

@ -111,8 +111,11 @@
page:1, page:1,
rows:10, rows:10,
show_history:0, show_history:0,
state:'pending', state:'assigned',
keyword:'' keyword:'',
not_state:["pending"],
sort_name:"updated_at",
sort_type:"desc"
}, },
total:0, total:0,
data:[], data:[],

@ -90,7 +90,7 @@ export default {
// sortable:false // sortable:false
// }, // },
{ {
label:'相关子订单号', label:'订单号',
prop:'order.serial', prop:'order.serial',
sortable: false sortable: false
} }
@ -117,7 +117,7 @@ export default {
let map = new Map([ let map = new Map([
['balance','余额'], ['balance','余额'],
['recharges','充值'], ['recharges','充值'],
['refunds','退款'], ['refunds','款'],
['fees','佣金'] ['fees','佣金']
]) ])
return map.get(key) return map.get(key)

@ -6,10 +6,10 @@
<div slot="content"></div> <div slot="content"></div>
<slot> <slot>
<div style="display: flex;align-items: center;"> <div style="display: flex;align-items: center;">
<div style="margin-right: 10px;">是否包含历史记录</div> <!-- <div style="margin-right: 10px;">是否包含历史记录</div>
<el-switch v-model="select.show_history" :active-value="1" :inactive-value="0" style="margin-right: 10px;"></el-switch> <el-switch v-model="select.show_history" :active-value="1" :inactive-value="0" style="margin-right: 10px;"></el-switch>
-->
<div style="margin-right: 10px;">订单状态</div> <div style="margin-right: 10px;">订单状态</div>
<el-select size="mini" placeholder="请选择状态" v-model="select.state" style="width: 140px;margin-right: 10px;"> <el-select size="mini" placeholder="请选择状态" v-model="select.state" style="width: 140px;margin-right: 10px;">
@ -70,7 +70,7 @@ export default {
page:1, page:1,
rows:10, rows:10,
show_history:0, show_history:0,
state:'', state:'finished',
keyword:'', keyword:'',
not_state:["pending"], not_state:["pending"],
sort_name:"updated_at", sort_name:"updated_at",

Loading…
Cancel
Save