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

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

@ -42,3 +42,36 @@ export function delNews(id) {
method: 'delete' 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= TEST_LOGIN:"https://t-jn-development-manager.jsszkd.com/login", // ?clientId=
// baseUrl: "https://t-jn-bjh-admin-server.jsszkd.com", // baseUrl: "https://t-jn-bjh-admin-server.jsszkd.com",
baseUrl: "https://bjh.jndz.cn/bjh-admin-server", baseUrl: "https://bjh.jndz.cn/bjh-admin-server",
// baseUrl: "http://192.168.0.108:9037",
// 应用信息 // 应用信息
appInfo: { appInfo: {

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

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

Loading…
Cancel
Save