|
@@ -1,10 +1,10 @@
|
|
|
<route lang="json">
|
|
|
{
|
|
|
-"layout": "tabbar",
|
|
|
-"style": {
|
|
|
-"navigationBarTitleText": "消息",
|
|
|
-"navigationBarBackgroundColor": "#fff"
|
|
|
-}
|
|
|
+ "layout": "tabbar",
|
|
|
+ "style": {
|
|
|
+ "navigationBarTitleText": "消息",
|
|
|
+ "navigationBarBackgroundColor": "#fff"
|
|
|
+ }
|
|
|
}
|
|
|
</route>
|
|
|
|
|
@@ -13,59 +13,73 @@ import PageHelper from '@/components/page-helper.vue'
|
|
|
import {
|
|
|
getMessages,
|
|
|
orderPointsCancel,
|
|
|
- orderPointsSubmit, readCount,
|
|
|
- updateMessage, updateReadByMessageType,
|
|
|
+ orderPointsSubmit,
|
|
|
+ readCount,
|
|
|
+ updateMessage,
|
|
|
+ updateReadByMessageType,
|
|
|
} from '../../core/libs/requests'
|
|
|
-import {MessageType} from '../../core/libs/enums'
|
|
|
-import {ComponentExposed} from 'vue-component-type-helpers'
|
|
|
-import {Coupon, Message} from '../../core/libs/models'
|
|
|
-import {requestToast} from '../../core/utils/common'
|
|
|
-import {useUserStore} from '../../store'
|
|
|
-import {storeToRefs} from 'pinia'
|
|
|
+import { MessageType } from '../../core/libs/enums'
|
|
|
+import { ComponentExposed } from 'vue-component-type-helpers'
|
|
|
+import { Coupon, Message } from '../../core/libs/models'
|
|
|
+import { requestToast } from '../../core/utils/common'
|
|
|
+import { useUserStore } from '../../store'
|
|
|
+import { storeToRefs } from 'pinia'
|
|
|
import MessageCard from './components/message-card.vue'
|
|
|
-import {useMessage} from 'wot-design-uni'
|
|
|
+import { useMessage } from 'wot-design-uni'
|
|
|
import CouponsSelector from '../common/components/coupons-selector.vue'
|
|
|
-import {handleClickInstruction} from '../../core/libs/actions'
|
|
|
+import { handleClickInstruction } from '../../core/libs/actions'
|
|
|
import PageHelperEvo from '@/components/page-helper-evo.vue'
|
|
|
|
|
|
const pageHelperRef = ref<ComponentExposed<typeof PageHelper>>()
|
|
|
const userStore = useUserStore()
|
|
|
-const {userInfo} = storeToRefs(userStore)
|
|
|
+const { userInfo } = storeToRefs(userStore)
|
|
|
const show = ref(false)
|
|
|
const tab = ref(0)
|
|
|
const tabs = ref([
|
|
|
- {label: '积分消息', value: MessageType.Integral,badgeProps: {
|
|
|
+ {
|
|
|
+ label: '积分消息',
|
|
|
+ value: MessageType.Integral,
|
|
|
+ badgeProps: {
|
|
|
isDot: true,
|
|
|
right: '-8px',
|
|
|
- hidden: false
|
|
|
- }},
|
|
|
- {label: '系统消息', value: MessageType.System,badgeProps: {
|
|
|
+ hidden: false,
|
|
|
+ },
|
|
|
+ },
|
|
|
+ {
|
|
|
+ label: '系统消息',
|
|
|
+ value: MessageType.System,
|
|
|
+ badgeProps: {
|
|
|
isDot: true,
|
|
|
right: '-8px',
|
|
|
- hidden:false
|
|
|
- }},
|
|
|
- {label: '互动消息', value: MessageType.Interact,badgeProps: {
|
|
|
+ hidden: false,
|
|
|
+ },
|
|
|
+ },
|
|
|
+ {
|
|
|
+ label: '互动消息',
|
|
|
+ value: MessageType.Interact,
|
|
|
+ badgeProps: {
|
|
|
isDot: true,
|
|
|
right: '-8px',
|
|
|
- hidden:false
|
|
|
- }},
|
|
|
+ hidden: false,
|
|
|
+ },
|
|
|
+ },
|
|
|
])
|
|
|
const selectedCoupons = ref<Coupon[]>([])
|
|
|
const coupons = ref<Coupon[]>([])
|
|
|
const cancelReason = ref('')
|
|
|
const currentMessage = ref<Message>()
|
|
|
-const {alert, confirm} = useMessage()
|
|
|
-const {confirm: rejectConfirm} = useMessage('wd-message-box-slot')
|
|
|
+const { alert, confirm } = useMessage()
|
|
|
+const { confirm: rejectConfirm } = useMessage('wd-message-box-slot')
|
|
|
|
|
|
-const query = computed(() => ({messageType: tabs.value[tab.value]?.value}))
|
|
|
+const query = computed(() => ({ messageType: tabs.value[tab.value]?.value }))
|
|
|
|
|
|
const handleCancel = async (message: Message) => {
|
|
|
await rejectConfirm({
|
|
|
title: '驳回',
|
|
|
- beforeConfirm: async ({resolve}) => {
|
|
|
+ beforeConfirm: async ({ resolve }) => {
|
|
|
if (!cancelReason.value) {
|
|
|
resolve(false)
|
|
|
- await uni.showToast({title: '请输入驳回原因', icon: 'none'})
|
|
|
+ await uni.showToast({ title: '请输入驳回原因', icon: 'none' })
|
|
|
return
|
|
|
}
|
|
|
await requestToast(
|
|
@@ -74,23 +88,23 @@ const handleCancel = async (message: Message) => {
|
|
|
id: message.businessId.toString(),
|
|
|
cancelReason: cancelReason.value,
|
|
|
}),
|
|
|
- {success: true, successTitle: '积分确认已驳回'},
|
|
|
+ { success: true, successTitle: '积分确认已驳回' },
|
|
|
)
|
|
|
resolve(true)
|
|
|
},
|
|
|
})
|
|
|
// await deleteMessage(message.id.toString())
|
|
|
- await updateMessage({id: message.id, isRead: '1'})
|
|
|
+ await updateMessage({ id: message.id, isRead: '1' })
|
|
|
await pageHelperRef.value?.refresh()
|
|
|
}
|
|
|
-const handleChange = async (value) =>{
|
|
|
- let tab1 = tabs.value[value.index];
|
|
|
+const handleChange = async (value) => {
|
|
|
+ let tab1 = tabs.value[value.index]
|
|
|
await getReadCount()
|
|
|
- if (tab1.value == MessageType.Integral){
|
|
|
- await updateReadByMessageType({messageType:MessageType.System,messageSubType:null})
|
|
|
+ if (tab1.value == MessageType.Integral) {
|
|
|
+ await updateReadByMessageType({ messageType: MessageType.System, messageSubType: null })
|
|
|
}
|
|
|
- if (tab1.value == MessageType.System){
|
|
|
- await updateReadByMessageType({messageType:MessageType.System,messageSubType:4})
|
|
|
+ if (tab1.value == MessageType.System) {
|
|
|
+ await updateReadByMessageType({ messageType: MessageType.System, messageSubType: 4 })
|
|
|
}
|
|
|
}
|
|
|
const handleSubmit = async (message: Message, coupons: Coupon[]) => {
|
|
@@ -123,27 +137,29 @@ const handleSubmit = async (message: Message, coupons: Coupon[]) => {
|
|
|
},
|
|
|
)
|
|
|
// await deleteMessage(message.id.toString())
|
|
|
- await updateMessage({id: message.id, isRead: '1'})
|
|
|
+ await updateMessage({ id: message.id, isRead: '1' })
|
|
|
await pageHelperRef.value?.refresh()
|
|
|
selectedCoupons.value = []
|
|
|
}
|
|
|
|
|
|
const getReadCount = async () => {
|
|
|
- await readCount().then(x =>{
|
|
|
- x.data.forEach(c =>{
|
|
|
- const matchedTab = tabs.value.find(a => a.value === c.messageType);
|
|
|
- if (matchedTab != undefined && c.quantity != 0){
|
|
|
- console.log(matchedTab.value,"messageType")
|
|
|
- tabs.value.forEach(b =>{
|
|
|
- console.log(b.value,"111")
|
|
|
- if (b.value == matchedTab.value){
|
|
|
- b.badgeProps.hidden = true
|
|
|
- }
|
|
|
- })
|
|
|
- }
|
|
|
- })
|
|
|
-
|
|
|
- });
|
|
|
+ await readCount().then(({ data }) => {
|
|
|
+ // x.data.forEach(c =>{
|
|
|
+ // const matchedTab = tabs.value.find(a => a.value === c.messageType);
|
|
|
+ // if (matchedTab != undefined && c.quantity != 0){
|
|
|
+ // console.log(matchedTab.value,"messageType")
|
|
|
+ // tabs.value.forEach(b =>{
|
|
|
+ // console.log(b.value,"111")
|
|
|
+ // if (b.value == matchedTab.value){
|
|
|
+ // b.badgeProps.hidden = true
|
|
|
+ // }
|
|
|
+ // })
|
|
|
+ // }
|
|
|
+ // })
|
|
|
+ tabs.value = tabs.value.map((a, i) => {
|
|
|
+ return { ...a, badgeProps: { isDot: true, right: '-8px', hidden: data[i]?.quantity == 0 } }
|
|
|
+ })
|
|
|
+ })
|
|
|
}
|
|
|
const handleQ = async (msg, res) => {
|
|
|
currentMessage.value = msg
|
|
@@ -156,8 +172,6 @@ onShow(async () => {
|
|
|
await nextTick(() => {
|
|
|
pageHelperRef.value?.reload()
|
|
|
})
|
|
|
-
|
|
|
-
|
|
|
})
|
|
|
</script>
|
|
|
|
|
@@ -172,9 +186,8 @@ onShow(async () => {
|
|
|
>
|
|
|
<template #top>
|
|
|
<wd-tabs v-model="tab" @change="handleChange">
|
|
|
- <block v-for="({ label, badgeProps }, i) in tabs" :key="i" >
|
|
|
- <wd-tab :title="`${label}`" class="relative" :badge-props="badgeProps">
|
|
|
- </wd-tab>
|
|
|
+ <block v-for="({ label, badgeProps }, i) in tabs" :key="i">
|
|
|
+ <wd-tab :title="`${label}`" class="relative" :badge-props="badgeProps"></wd-tab>
|
|
|
</block>
|
|
|
</wd-tabs>
|
|
|
</template>
|