Commit bfcc3779 by 胡悦

提交服务中心代码

1 parent 91549652
...@@ -369,5 +369,13 @@ module.exports = { ...@@ -369,5 +369,13 @@ module.exports = {
projectName: 'pad', projectName: 'pad',
...data ...data
}) })
},
// 服务中心-消息汇总
getMessageSummary(data) {
return http.post({
method: 'dj.pad.api.page.script.sop.message.summary.list',
projectName: 'pad',
...data
})
} }
} }

2.44 MB | W: | H:

2.44 MB | W: | H:

assets/images/sprite.png
assets/images/sprite.png
assets/images/sprite.png
assets/images/sprite.png
  • 2-up
  • Swipe
  • Onion skin
...@@ -318,14 +318,14 @@ export default { ...@@ -318,14 +318,14 @@ export default {
} }
}, },
// 消息中心未读总数 // 消息中心未读总数
async getMessageCount () { // async getMessageCount () {
const { sceneType } = uni.$storage.get("userInfo") // const { sceneType } = uni.$storage.get("userInfo")
const res = await uni.$api.commonApi.getMessageCount({ // const res = await uni.$api.commonApi.getMessageCount({
status: 0, // 待查看,未读 // status: 0, // 待查看,未读
businessType: sceneType // businessType: sceneType
}) // })
this.messageTotal = res // this.messageTotal = res
}, // },
// 学习中心消息弹窗,优先级高于有修改话术弹窗 // 学习中心消息弹窗,优先级高于有修改话术弹窗
async getMessagePop () { async getMessagePop () {
// 获取今天日期字符串 // 获取今天日期字符串
...@@ -375,8 +375,9 @@ export default { ...@@ -375,8 +375,9 @@ export default {
}) })
}, },
getMessageInfo () { getMessageInfo () {
console.log(111111, 'getMessageInfo')
// this.getMessage() // this.getMessage()
this.getMessageCount() // this.getMessageCount()
this.getMessagePop() this.getMessagePop()
}, },
jumpPersonCenter () { jumpPersonCenter () {
......
...@@ -140,9 +140,6 @@ export default { ...@@ -140,9 +140,6 @@ export default {
console.log(error) console.log(error)
this.back() this.back()
} }
// if (type == 'read') this.$emit("backHome")
// else if (type == 'view') this.back('MessageList', {firstIndex: 1, tagIndex: this.tagIndex})
// this.back('MessageList', {firstIndex: 1, tagIndex: this.tagIndex})
}, },
back() { back() {
uni.navigateTo({ uni.navigateTo({
...@@ -175,22 +172,14 @@ export default { ...@@ -175,22 +172,14 @@ export default {
const res = await uni.$api.commonApi.updateMessageStatus({ const res = await uni.$api.commonApi.updateMessageStatus({
idList idList
}) })
// this.backPage()
// if (res) {
// this.backPage()
// } else {
// console.log('接口返回结果为空,可能存在问题')
// }
} catch (error) { } catch (error) {
// this.backPage()
console.error('更新消息状态时出现错误:', error) console.error('更新消息状态时出现错误:', error)
} finally { } finally {
this.isProcessing = false; // 处理完成,将标志位设为 false this.isProcessing = false; // 处理完成,将标志位设为 false
this.backPage() this.backPage()
} }
} }
}, }
} }
} }
</script> </script>
......
<template> <template>
<view> <view>
<ServiceList :topListProp="topList" @handleClick="handleClick" /> <ServiceList :messageList="messageList" :topListProp="topList" @handleClick="handleClick" />
</view> </view>
</template> </template>
<script> <script>
import ServiceList from '../../../../pages/common/serviceDetail/components/ServiceList.vue'; import ServiceList from '../../../../pages/common/serviceDetail/components/ServiceList.vue';
import { getMessageSummary } from '../../../../api/module/common'
export default { export default {
name: 'MessageIndex', name: 'MessageIndex',
components: { components: {
...@@ -12,7 +13,8 @@ export default { ...@@ -12,7 +13,8 @@ export default {
}, },
data() { data() {
return { return {
topList: [] topList: [],
messageList: []
} }
}, },
created() { created() {
...@@ -20,7 +22,18 @@ export default { ...@@ -20,7 +22,18 @@ export default {
this.topList = topList this.topList = topList
}) })
}, },
mounted() {
console.log('消息')
this.getMessageSummary()
},
methods: { methods: {
// 获取服务中心列表
async getMessageSummary() {
const userInfo = uni.$storage.get('userInfo')
const res = await getMessageSummary({businessType: userInfo.sceneType})
console.log(res, '===')
this.messageList = res
},
handleClick(item) { handleClick(item) {
const { moduleType } = item const { moduleType } = item
uni.navigateTo({ uni.navigateTo({
......
...@@ -56,7 +56,7 @@ ...@@ -56,7 +56,7 @@
<view class="content-right box-class"> <view class="content-right box-class">
<view class="common-title">服务中心</view> <view class="common-title">服务中心</view>
<view class="content-box"> <view class="content-box">
<MessageIndex /> <MessageIndex class="message-box" ref="messageRef" />
</view> </view>
</view> </view>
</view> </view>
...@@ -239,6 +239,7 @@ export default { ...@@ -239,6 +239,7 @@ export default {
}, },
methods: { methods: {
async changeTab ({ item, jumpUrl, index }) { async changeTab ({ item, jumpUrl, index }) {
if (index == 0) this.$refs.messageRef.getMessageSummary()
this.previewOff = index != 0 this.previewOff = index != 0
this.$emit('changeTab', index) this.$emit('changeTab', index)
this.showBeisen = false this.showBeisen = false
...@@ -535,6 +536,9 @@ export default { ...@@ -535,6 +536,9 @@ export default {
position: relative; position: relative;
width: 100%; width: 100%;
height: calc(100% - #{toRpx(120)}); height: calc(100% - #{toRpx(120)});
.message-box {
height: 100%;
}
.developing { .developing {
height: 100%; height: 100%;
flex-direction: column; flex-direction: column;
......
...@@ -24,7 +24,7 @@ ...@@ -24,7 +24,7 @@
`${countdown}s` : `${countdown}s` :
'' }}</view> '' }}</view>
</template> </template>
<template v-if="pageType == 'service'"> <template v-if="pageType == 'service' && messageInfo.status == 1">
<view class="btn blue more-script" @click="handleMoreScript">更多话术</view> <view class="btn blue more-script" @click="handleMoreScript">更多话术</view>
</template> </template>
</view> </view>
...@@ -61,6 +61,7 @@ export default { ...@@ -61,6 +61,7 @@ export default {
// 获取mock配置的时间 // 获取mock配置的时间
this.MOCKDATA = uni.$storage.get('mock_data') this.MOCKDATA = uni.$storage.get('mock_data')
this.countTime = this.MOCKDATA.timer || countTimer this.countTime = this.MOCKDATA.timer || countTimer
// this.countTime = 0.1
this.countdown = this.countTime * 60 - 1 this.countdown = this.countTime * 60 - 1
}, },
onLoad(options) { onLoad(options) {
...@@ -102,7 +103,11 @@ export default { ...@@ -102,7 +103,11 @@ export default {
startTime: this.enterTime, startTime: this.enterTime,
endTime: dayjs(new Date()).format("YYYY-MM-DD HH:mm:ss") endTime: dayjs(new Date()).format("YYYY-MM-DD HH:mm:ss")
}) })
if (ids) {
this.back(ids) this.back(ids)
} else {
this.handleMoreScript()
}
// if (type == 'read') this.$emit("backHome") // if (type == 'read') this.$emit("backHome")
// else if (type == 'view') this.back('MessageList', {firstIndex: 1}) // else if (type == 'view') this.back('MessageList', {firstIndex: 1})
// this.back('MessageList', {firstIndex: 1, tagIndex: this.tagIndex}) // this.back('MessageList', {firstIndex: 1, tagIndex: this.tagIndex})
...@@ -129,22 +134,16 @@ export default { ...@@ -129,22 +134,16 @@ export default {
scriptId = [this.messageInfo.scriptId] scriptId = [this.messageInfo.scriptId]
try { try {
this.isProcessing = true; this.isProcessing = true;
// this.back(idList)
// 接口调用 // 接口调用
const res = await uni.$api.commonApi.updateMessageStatus({ const res = await uni.$api.commonApi.updateMessageStatus({
idList idList
}) })
// if (res) {
// this.backPage(scriptId, idList)
// } else {
// console.log('接口返回结果为空,可能存在问题')
// }
} catch (error) { } catch (error) {
// this.backPage(scriptId, idList) // this.backPage(scriptId, idList)
console.error('更新消息状态时出现错误:', error) console.error('更新消息状态时出现错误:', error)
} finally { } finally {
this.isProcessing = false; // 处理完成,将标志位设为 false this.isProcessing = false; // 处理完成,将标志位设为 false
this.backPage(scriptId, idList) this.backPage(scriptId)
} }
} }
}, },
......
...@@ -54,7 +54,8 @@ export default { ...@@ -54,7 +54,8 @@ export default {
pageSize: PAGE_SIZE, pageSize: PAGE_SIZE,
tagList: [], tagList: [],
tagIndex: '', tagIndex: '',
scrollTop: 0 scrollTop: 0,
type: ''
} }
}, },
computed: { computed: {
...@@ -75,6 +76,7 @@ export default { ...@@ -75,6 +76,7 @@ export default {
}, },
onLoad(options) { onLoad(options) {
console.log(options) console.log(options)
if (options.type) this.type = options.type
// this.init() // this.init()
}, },
methods: { methods: {
...@@ -92,9 +94,13 @@ export default { ...@@ -92,9 +94,13 @@ export default {
}); });
}, },
back() { back() {
let pageNum = 2
if (this.type == 'read') {
pageNum = 1
}
uni.$emit('pageBack') uni.$emit('pageBack')
uni.navigateBack({ uni.navigateBack({
delta: 2, delta: pageNum,
animationType: 'pop-out', animationType: 'pop-out',
animationDuration: 100 animationDuration: 100
}) })
......
<template> <template>
<scroll-view scroll-y class="service-list">
<view class="message-index-box"> <view class="message-index-box">
<view class="message-list" v-if="getTopList.length > 0"> <view class="message-list" v-if="getTopList.length > 0">
<view :class="['message-item', moduleType == i.moduleType ? 'active' : '']" v-for="(i, ind) in getTopList" :key="ind" @click.stop="handleClick(i)"> <view :class="['message-item', moduleType == i.moduleType ? 'active' : '']" v-for="(i, ind) in getTopList"
:key="ind" @click.stop="handleClick(i)">
<view class="message-item-icon"> <view class="message-item-icon">
<view :class="['sprite-icon', `icon-${moduleIconEnum[i.moduleType]}`]"></view> <view :class="['sprite-icon', `icon-${moduleIconEnum[i.moduleType]}`]"></view>
<view class="message-item-icon-num" v-if="i.count > 0">{{ i.count > 99 ? 99 : i.count }}</view> <view class="message-item-icon-num" v-if="i.count > 0">{{ i.count > 99 ? 99 : i.count }}</view>
</view> </view>
<view class="message-item-content"> <view class="message-item-content">
<view class="message-item-title">{{ moduleTypeEnum[i.moduleType] }}</view> <view class="message-item-title">{{ moduleTypeEnum[i.moduleType] }}</view>
<view class="message-item-desc">{{ moduleContentEnum[i.moduleType] ? moduleContentEnum[i.moduleType] : i.title }}</view> <view class="message-item-desc">{{ moduleContentEnum[i.moduleType] ? moduleContentEnum[i.moduleType] :
i.title }}</view>
</view> </view>
<view class="message-item-time-box"> <view class="message-item-time-box">
<view class="message-item-time">{{ formatTime(i.createdTime) }}</view> <view class="message-item-time">{{ formatTime(i.createdTime) }}</view>
...@@ -20,14 +24,16 @@ ...@@ -20,14 +24,16 @@
<view class="message-group" v-for="(item, index) in getList" :key="index"> <view class="message-group" v-for="(item, index) in getList" :key="index">
<view class="message-date">{{ item.date }}</view> <view class="message-date">{{ item.date }}</view>
<view class="message-list"> <view class="message-list">
<view :class="['message-item', moduleType == i.moduleType ? 'active' : '']" v-for="(i, ind) in item.msgList" :key="ind" @click.stop="handleClick(i)"> <view :class="['message-item', moduleType == i.moduleType ? 'active' : '']"
v-for="(i, ind) in item.msgList" :key="ind" @click.stop="handleClick(i)">
<view class="message-item-icon"> <view class="message-item-icon">
<view :class="['sprite-icon', `icon-${moduleIconEnum[i.moduleType]}`]"></view> <view :class="['sprite-icon', `icon-${moduleIconEnum[i.moduleType]}`]"></view>
<view class="message-item-icon-num" v-if="i.count > 0">{{ i.count > 99 ? 99 : i.count }}</view> <view class="message-item-icon-num" v-if="i.count > 0">{{ i.count > 99 ? 99 : i.count }}</view>
</view> </view>
<view class="message-item-content"> <view class="message-item-content">
<view class="message-item-title">{{ moduleTypeEnum[i.moduleType] }}</view> <view class="message-item-title">{{ moduleTypeEnum[i.moduleType] }}</view>
<view class="message-item-desc">{{ moduleContentEnum[i.moduleType] ? moduleContentEnum[i.moduleType] : i.title }}</view> <view class="message-item-desc">{{ moduleContentEnum[i.moduleType] ? moduleContentEnum[i.moduleType] :
i.title }}</view>
</view> </view>
<view class="message-item-time">{{ formatTime(i.createdTime) }}</view> <view class="message-item-time">{{ formatTime(i.createdTime) }}</view>
</view> </view>
...@@ -36,15 +42,13 @@ ...@@ -36,15 +42,13 @@
</template> </template>
<template v-else> <template v-else>
<view class="message-empty"> <view class="message-empty">
<image <image class="message-empty-img" src="../../../../assets//images/home/notice-nothing.webp"
class="message-empty-img" mode="scaleToFill" />
src="../../../../assets//images/home/notice-nothing.webp"
mode="scaleToFill"
/>
<view class="message-empty-text">暂无消息</view> <view class="message-empty-text">暂无消息</view>
</view> </view>
</template> </template>
</view> </view>
</scroll-view>
</template> </template>
<script> <script>
import dayjs from 'dayjs'; import dayjs from 'dayjs';
...@@ -59,6 +63,10 @@ export default { ...@@ -59,6 +63,10 @@ export default {
topListProp: { topListProp: {
type: Array, type: Array,
default: () => [] default: () => []
},
messageList: {
type: Array,
default: () => []
} }
}, },
data() { data() {
...@@ -107,6 +115,12 @@ export default { ...@@ -107,6 +115,12 @@ export default {
} }
}, },
watch: { watch: {
messageList: {
handler(newVal) {
this.msgList = newVal
},
immediate: true
},
topListProp: { topListProp: {
handler(newVal) { handler(newVal) {
this.topList = newVal this.topList = newVal
...@@ -132,10 +146,10 @@ export default { ...@@ -132,10 +146,10 @@ export default {
// 根据date进行分组 // 根据date进行分组
const groupedByDate = {}; const groupedByDate = {};
filteredList.forEach(item => { filteredList.forEach(item => {
if (!groupedByDate[item.strdate]) { if (!groupedByDate[item.strDate]) {
groupedByDate[item.strdate] = []; groupedByDate[item.strDate] = [];
} }
groupedByDate[item.strdate].push(item); groupedByDate[item.strDate].push(item);
}); });
// 转换为数组格式,并按date降序排列 // 转换为数组格式,并按date降序排列
...@@ -152,7 +166,7 @@ export default { ...@@ -152,7 +166,7 @@ export default {
}, },
methods: { methods: {
getTopInfo() { getTopInfo() {
const {phone, shopMerchantId, sceneType} = uni.$storage.get('userInfo') const { phone, shopMerchantId, sceneType } = uni.$storage.get('userInfo')
const _topInfo = uni.$storage.get('noticeTopInfo') || {} const _topInfo = uni.$storage.get('noticeTopInfo') || {}
const key = `${phone}-${shopMerchantId}-${sceneType}` const key = `${phone}-${shopMerchantId}-${sceneType}`
this.topList = _topInfo[key] || [] this.topList = _topInfo[key] || []
...@@ -170,6 +184,9 @@ export default { ...@@ -170,6 +184,9 @@ export default {
} }
</script> </script>
<style scoped lang="scss"> <style scoped lang="scss">
.service-list {
height: 100%;
}
.message-index-box { .message-index-box {
margin: 0 toRpx(32); margin: 0 toRpx(32);
height: 100%; height: 100%;
...@@ -193,6 +210,7 @@ export default { ...@@ -193,6 +210,7 @@ export default {
background: #ffffff; background: #ffffff;
border-radius: toRpx(24); border-radius: toRpx(24);
padding: toRpx(24); padding: toRpx(24);
&.active { &.active {
background: #4673ff1a; background: #4673ff1a;
} }
...@@ -237,16 +255,19 @@ export default { ...@@ -237,16 +255,19 @@ export default {
word-break: break-all; word-break: break-all;
} }
} }
.message-item-time { .message-item-time {
color: #999999; color: #999999;
font-size: toRpx(24); font-size: toRpx(24);
margin-left: auto; margin-left: auto;
} }
.message-item-time-box { .message-item-time-box {
display: flex; display: flex;
flex-direction: column; flex-direction: column;
align-items: center; align-items: center;
margin-left: auto; margin-left: auto;
.icon-stick-top { .icon-stick-top {
margin-top: toRpx(4); margin-top: toRpx(4);
} }
...@@ -254,16 +275,19 @@ export default { ...@@ -254,16 +275,19 @@ export default {
} }
} }
} }
.message-empty { .message-empty {
display: flex; display: flex;
flex-direction: column; flex-direction: column;
align-items: center; align-items: center;
justify-content: center; justify-content: center;
padding-top: toRpx(144); padding-top: toRpx(144);
&-img { &-img {
width: toRpx(496); width: toRpx(496);
height: toRpx(208); height: toRpx(208);
} }
&-text { &-text {
color: #999999; color: #999999;
font-size: toRpx(20); font-size: toRpx(20);
......
<template> <template>
<view class="detail-box"> <view class="detail-box">
<view class="nav-bar"> <view class="nav-bar">
<view class="back" @click="backPage(null)"> <view class="back" @click="backPage">
<uni-icons type="left" :size="20" color="#000"></uni-icons> <uni-icons type="left" :size="20" color="#000"></uni-icons>
</view> </view>
<view class="title">服务中心</view> <view class="title">服务中心</view>
</view> </view>
<view class="detail-content"> <view class="detail-content">
<view class="detail-left"> <view class="detail-left">
<ServiceList :moduleType="moduleType" :topListProp="topList" @handleClick="handleClick" /> <ServiceList :moduleType="moduleType" :messageList="messageList" :topListProp="topList" @handleClick="handleClick" />
</view> </view>
<view class="detail-right"> <view class="detail-right">
<view class="common-title"> <view class="common-title">
...@@ -41,9 +41,9 @@ ...@@ -41,9 +41,9 @@
</view> </view>
</view> </view>
<uni-transition :show="noticeTips" mode="slide-top"> <uni-transition :show="noticeTips" mode="slide-top">
<view class="notice-tips blue" > <view class="notice-tips" >
<view class="sprite-icon icon-notice-success"></view> <!-- <view class="sprite-icon icon-notice-success"></view> -->
<view>{{ topList.includes(Number(moduleType)) ? '置顶' : '取消置顶' }}成功</view> <view>{{ topList.includes(Number(moduleType)) ? '置顶成功' : '取消置顶' }}</view>
</view> </view>
</uni-transition> </uni-transition>
</view> </view>
...@@ -55,6 +55,7 @@ let timer = null ...@@ -55,6 +55,7 @@ let timer = null
import dayjs from 'dayjs' import dayjs from 'dayjs'
import { moduleTypeEnum, moduleContentEnum } from './components/contant' import { moduleTypeEnum, moduleContentEnum } from './components/contant'
import ServiceList from './components/ServiceList.vue'; import ServiceList from './components/ServiceList.vue';
import {getMessageSummary} from '../../../api/module/common'
export default { export default {
name: 'ServiceDetail', name: 'ServiceDetail',
components: { components: {
...@@ -76,7 +77,8 @@ export default { ...@@ -76,7 +77,8 @@ export default {
scrollTop: 0, scrollTop: 0,
isLoading: false, isLoading: false,
userInfo: {}, userInfo: {},
noticeTips: false noticeTips: false,
messageList: []
} }
}, },
computed: { computed: {
...@@ -119,9 +121,17 @@ export default { ...@@ -119,9 +121,17 @@ export default {
// this.handleClick({moduleType: this.moduleType}) // this.handleClick({moduleType: this.moduleType})
}, },
methods: { methods: {
// 获取服务中心列表
async getMessageSummary(sceneType) {
// const userInfo = uni.$storage.get('userInfo')
const res = await getMessageSummary({businessType: sceneType})
console.log(res, '===')
this.messageList = res
},
// 获取缓存中置顶的列表 // 获取缓存中置顶的列表
getTopInfo() { getTopInfo() {
const {phone, shopMerchantId, sceneType} = this.userInfo const {phone, shopMerchantId, sceneType} = this.userInfo
this.getMessageSummary(sceneType)
const _topInfo = uni.$storage.get('noticeTopInfo') || {} const _topInfo = uni.$storage.get('noticeTopInfo') || {}
const key = `${phone}-${shopMerchantId}-${sceneType}` const key = `${phone}-${shopMerchantId}-${sceneType}`
this.topList = _topInfo[key] || [] this.topList = _topInfo[key] || []
...@@ -129,6 +139,7 @@ export default { ...@@ -129,6 +139,7 @@ export default {
backPage() { backPage() {
uni.navigateBack({ uni.navigateBack({
success: (res) => { success: (res) => {
this.getMessageSummary(this.userInfo.sceneType)
uni.$emit('messageBackHome', this.topList) uni.$emit('messageBackHome', this.topList)
} }
}); });
...@@ -504,22 +515,18 @@ export default { ...@@ -504,22 +515,18 @@ export default {
} }
.notice-tips { .notice-tips {
position: fixed; position: fixed;
top: toRpx(160); top: toRpx(150);
width: toRpx(400);
left: 50%; left: 50%;
transform: translateX(-50%); transform: translateX(-50%);
display: flex; display: flex;
align-items: center; align-items: center;
justify-content: center; justify-content: center;
color: #4673ff; color: #FFFFFF;
font-size: toRpx(28); font-size: toRpx(28);
padding: toRpx(16) toRpx(24); padding: toRpx(16) toRpx(24);
border-radius: toRpx(8); border-radius: toRpx(8);
z-index: 1; z-index: 1;
&.blue { background-color: #000000cc;
background: #4673ff1a;
}
.icon-notice-success {
margin-right: toRpx(16);
}
} }
</style> </style>
\ No newline at end of file \ No newline at end of file
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!