消息列表显示已读未读、消息详情展示、搜索功能

lijinlong
吕天方 8 months ago
parent 4842173222
commit 60dcdec97d

@ -42,3 +42,36 @@ export function delNews(id) {
method: 'delete'
})
}
// 根据商家id清空该商家所有的消息
export function deleteShopId(id) {
return request({
url: '/jn/news/deleteShopId/' + id,
method: 'get'
})
}
// 根据商家id查询该商家所有的消息
export function shopIdlist(params) {
return request({
url: '/jn/news/shopIdlist',
method: 'get',
params
})
}
// 某条商家端消息进行已读
export function getInfoShop(id) {
return request({
url: '/jn/news/getInfoShop/' + id,
method: 'get'
})
}
// 根据商家id查询未读消息个数
export function isLookCount(id) {
return request({
url: '/jn/news/isLookCount/' + id,
method: 'get'
})
}

@ -4,6 +4,7 @@ module.exports = {
TEST_LOGIN:"https://t-jn-development-manager.jsszkd.com/login", // ?clientId=
// baseUrl: "https://t-jn-bjh-admin-server.jsszkd.com",
baseUrl: "https://bjh.jndz.cn/bjh-admin-server",
// baseUrl: "http://192.168.0.108:9037",
// 应用信息
appInfo: {

@ -15,13 +15,13 @@
:clearabled="true"
class="view-global"
bgColor="#fff"
@search="onSearch"
@clear="onClear"
@change="ListMsg"
></u-search>
<view class="msg-list">
<view
class="msg-item view-global"
v-for="(item, index) in listMsgs"
@click="getMesInfo(item)"
:key="index"
>
<view class="msg-icon" style="background-color: #367bef">
@ -29,7 +29,7 @@
<u-badge
bgColor="#FE3434"
max="99"
:isDot="item.isLook == 1 ? false : true"
:absolute="true"
:offset="[0, 0]"
></u-badge>
@ -77,68 +77,70 @@
<view class="msg-date">19:18</view>
</view> -->
</view>
<u-modal :show="show" :title="msgInfo.title" :content='msgInfo.content' @confirm="confirm"></u-modal>
</view>
</template>
<script>
import { listNews, delNews } from "../../api/jn/news";
import { shopIdlist, deleteShopId, getInfoShop, isLookCount } from "../../api/jn/news";
export default {
data() {
return {
listMsgs: [],
//
queryParams: {
pageNum: 1,
pageSize: 10,
title: "",
status: 0
id:'',
},
show: false,
msgInfo: {
title:"",
content:""
},
};
},
onLoad() {
},
onShow() {
this.ListMsg();
const launchOptions = uni.getLaunchOptionsSync();
const { query } = launchOptions;
// console.log(query,"query");
if(query.storeId) {
this.queryParams.id = query.storeId;
this.ListMsg();
} else {
uni.$u.toast('店铺id为空')
}
},
methods: {
onAllclear() {
this.$modal.confirm('确定删除所有消息吗?').then(() => {
let ids = [];
this.listMsgs.forEach(element => {
ids.push(element.id);
});
if(ids.length == 0) {
return;
} else {
delNews(ids).then((res) => {
console.log(JSON.stringify(res),"删除接口");
if(res.code == 200) {
this.ListMsg();
}
});
}
})
},
onSearch() {
this.ListMsg();
},
onClear() {
this.queryParams.title = "";
this.ListMsg();
deleteShopId(15).then((res) => {
if(res.code == 200) {
uni.showToast({ title: "删除成功", icon: 'success' })
this.ListMsg();
}
})
})
},
getMesInfo(item) {
this.show = true;
this.msgInfo = item;
getInfoShop(item.id).then(res=>{})
},
ListMsg() {
listNews(this.queryParams).then((res) => {
// console.log(res);
this.listMsgs = res.rows;
if(res.code == 200) {
uni.setTabBarBadge({
//
index: 1, //tabbar
text: res.total + '', //
});
}
shopIdlist(this.queryParams).then((res) => {
this.listMsgs = res.data;
// if(res.code == 200) {
// uni.setTabBarBadge({
// //
// index: 1, //tabbar
// text: res.total + '', //
// });
// }
});
},
confirm(){
this.show = false
this.ListMsg();
},
},
};
</script>
@ -161,7 +163,11 @@ export default {
display: flex;
align-items: center;
justify-content: center;
.u-badge {
width: 10px;
height: 10px;
left: 0px;
}
image {
height: 44rpx;
width: 44rpx;

@ -85,12 +85,12 @@
const {
query
} = launchOptions;
console.log(query, "query");
console.log(Object.keys(query).length, "query.lengh");
// console.log(query, "query");
// console.log(Object.keys(query).length, "query.lengh");
if (Object.keys(query).length != 0) {
// 3 4 5绿 sbLevel shopName
jnshop(query.storeId).then((item) => {
console.log(item);
// console.log(item);
if (item.code == 200 && item.data) {
this.titleObj.sbLevel = item.data.sbLevel
this.titleObj.shopName = item.data.shopName
@ -109,7 +109,7 @@
},
getList() {
listraterule(this.queryParams).then((res) => {
console.log(res);
// console.log(res);
if (res.rows.length != 0) {
this.levelList = res.rows;

Loading…
Cancel
Save