|
@@ -1,10 +1,10 @@
|
|
|
<route lang="json">
|
|
|
{
|
|
|
- "layout": "tabbar",
|
|
|
- "style": {
|
|
|
- "navigationBarTitleText": "消息",
|
|
|
- "navigationBarBackgroundColor": "#fff"
|
|
|
- }
|
|
|
+"layout": "tabbar",
|
|
|
+"style": {
|
|
|
+"navigationBarTitleText": "消息",
|
|
|
+"navigationBarBackgroundColor": "#fff"
|
|
|
+}
|
|
|
}
|
|
|
</route>
|
|
|
|
|
@@ -13,47 +13,59 @@ import PageHelper from '@/components/page-helper.vue'
|
|
|
import {
|
|
|
getMessages,
|
|
|
orderPointsCancel,
|
|
|
- orderPointsSubmit,
|
|
|
- updateMessage,
|
|
|
+ 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 },
|
|
|
- { label: '系统消息', value: MessageType.System },
|
|
|
- { label: '互动消息', value: MessageType.Interact },
|
|
|
+ {label: '积分消息', value: MessageType.Integral,badgeProps: {
|
|
|
+ isDot: true,
|
|
|
+ right: '-8px',
|
|
|
+ hidden: false
|
|
|
+ }},
|
|
|
+ {label: '系统消息', value: MessageType.System,badgeProps: {
|
|
|
+ isDot: true,
|
|
|
+ right: '-8px',
|
|
|
+ hidden:false
|
|
|
+ }},
|
|
|
+ {label: '互动消息', value: MessageType.Interact,badgeProps: {
|
|
|
+ isDot: true,
|
|
|
+ right: '-8px',
|
|
|
+ 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(
|
|
@@ -62,15 +74,25 @@ 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];
|
|
|
+ await getReadCount()
|
|
|
+ if (tab1.value == MessageType.Integral){
|
|
|
+ await updateReadByMessageType({messageType:MessageType.System,messageSubType:null})
|
|
|
+ }
|
|
|
+ if (tab1.value == MessageType.System){
|
|
|
+ await updateReadByMessageType({messageType:MessageType.System,messageSubType:4})
|
|
|
+ }
|
|
|
+}
|
|
|
const handleSubmit = async (message: Message, coupons: Coupon[]) => {
|
|
|
console.log(
|
|
|
Number(message.pointsDetail?.points) + Number(selectedCoupons.value.at(0)?.brandPoints ?? 0),
|
|
@@ -84,8 +106,6 @@ const handleSubmit = async (message: Message, coupons: Coupon[]) => {
|
|
|
return false
|
|
|
}
|
|
|
}
|
|
|
- console.log(11111)
|
|
|
-
|
|
|
// return;
|
|
|
// if (!selectedCoupons.value.length) {
|
|
|
//
|
|
@@ -103,19 +123,41 @@ 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
|
|
|
+ }
|
|
|
+ })
|
|
|
+ }
|
|
|
+ })
|
|
|
+
|
|
|
+ });
|
|
|
+}
|
|
|
const handleQ = async (msg, res) => {
|
|
|
currentMessage.value = msg
|
|
|
coupons.value = res
|
|
|
show.value = true
|
|
|
}
|
|
|
+
|
|
|
onShow(async () => {
|
|
|
+ await getReadCount()
|
|
|
await nextTick(() => {
|
|
|
pageHelperRef.value?.reload()
|
|
|
})
|
|
|
+
|
|
|
+
|
|
|
})
|
|
|
</script>
|
|
|
|
|
@@ -129,9 +171,10 @@ onShow(async () => {
|
|
|
:automatic="false"
|
|
|
>
|
|
|
<template #top>
|
|
|
- <wd-tabs v-model="tab">
|
|
|
- <block v-for="({ label }, i) in tabs" :key="i">
|
|
|
- <wd-tab :title="`${label}`"></wd-tab>
|
|
|
+ <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>
|
|
|
</wd-tabs>
|
|
|
</template>
|