Browse Source

bug修改

15591641157 2 months ago
parent
commit
3e7b2c6af4

+ 13 - 0
packages/app/src/core/libs/requests.ts

@@ -631,6 +631,16 @@ export const deleteMessage = (id: string) =>
 export const updateMessage = (data: Partial<Message>) =>
   httpPut('/app-api/member/message-manage/update', data)
 /**
+ * 获取未读数量
+ */
+export const readCount = () =>
+  httpGet('/app-api/member/message-manage/readCount')
+/**
+ * 批量修改为已读
+ */
+export const updateReadByMessageType = (data:{messageType: number,messageSubType: number}) =>
+  httpPut('/app-api/member/message-manage/updateReadByMessageType',data)
+/**
  * 积分订单取消
  */
 export const orderPointsCancel = (query: { id: string; cancelReason: string }) =>
@@ -641,6 +651,9 @@ export const orderPointsCancel = (query: { id: string; cancelReason: string }) =
 export const orderPointsSubmit = (data: { id: number; userId: number; couponUserId: number }) =>
   httpPost('/app-api/member/points-details/confirm', data)
 /**
+ * 确认消息/已读
+ */
+/**
  * 获取Banner
  */
 export const getBanner = (id) => httpGet<Banner>('/app-api/member/banner/get-by-id', { id })

+ 5 - 4
packages/app/src/pages/home/mall/detail/index.vue

@@ -114,13 +114,14 @@ onShareTimeline(() => ({
           class="w-[66px] text-black/30 text-xs font-normal font-['PingFang_SC'] leading-3"
         >
           <!-- ¥60 -->
-          ¥{{ data?.productPrice }}
+          <span style="text-decoration: line-through;">¥{{ data?.productPrice }}</span>
         </div>
         <div class="flex-1"></div>
-        <div class="text-[#999999] text-xs font-normal font-['PingFang_SC']">
-          <!-- 已售5件 -->
-          库存:{{ data?.productRepertory || 0 }}
+        <template v-if="String(data?.needPoints) !== '1'" >
+         <div  class="text-[#999999] text-xs font-normal font-['PingFang_SC']">
+           {{ data?.isRestrict === 0 ? '不限库存' : `库存:${data?.productRepertory || 0}` }}
         </div>
+        </template>
       </div>
       <div class="text-black text-xl font-normal font-['PingFang_SC']">
         <!-- 阿芙佳朵 -->

+ 25 - 9
packages/app/src/pages/messages/components/message-card.vue

@@ -5,7 +5,7 @@ import { integral, interact, message, system } from '../../../core/libs/svgs'
 import { beforeNow } from '../../../utils/date-util'
 import dayjs from 'dayjs'
 import { MessageType, PointStatus } from '../../../core/libs/enums'
-import { getPointsCoupons } from '../../../core/libs/requests'
+import {getPointsCoupons, updateReadByMessageType} from '../../../core/libs/requests'
 import { getMessageType } from '../../../core/libs/message-types'
 import { useRouter } from '../../../core/utils/router'
 import ButtonEvo from '@/components/button-evo.vue'
@@ -54,6 +54,8 @@ const init = async () => {
   }
 }
 const handleJump = () => {
+
+
   if ((props.options.linkUrl ?? '') !== '') {
     return router.push(props.options.linkUrl)
   }
@@ -82,14 +84,17 @@ watch(
 onMounted(async () => {
   await init()
 })
+
 </script>
 <template>
   <Card>
     <div class="grid items-center grid-cols-[38px_auto_100px]">
+
       <div class="row-start-1 col-start-1">
         <div
           class="w-[30px] h-[30px] bg-neutral-100 rounded-full mr-2 flex items-center justify-center"
         >
+
           <wd-img
             width="18"
             height="18"
@@ -101,20 +106,31 @@ onMounted(async () => {
               }[options.messageType]
             "
           ></wd-img>
+
         </div>
       </div>
-      <div class="row-start-1 col-start-2 text-start">
+
+      <div class="row-start-1 col-start-2 text-start relative">
         <div class="text-black/90 text-base font-normal font-['PingFang_SC'] leading-[30px]">
-          {{
-            String(options.messageSubType) === '5'
-              ? getMessageType(options.messageSubType)?.desc
-              : options.title
-          }}
+<!--          {{-->
+<!--            String(options.messageSubType) === '5'-->
+<!--              ? getMessageType(options.messageSubType)?.desc-->
+<!--              : options.title-->
+<!--          }}-->
+          {{options.title}}
         </div>
       </div>
-      <div class="row-start-1 col-start-3 text-end">
-        <div class="text-black/30 text-sm font-normal font-['PingFang_SC'] leading-[10.18px]">
+
+      <div class="row-start-1 col-start-3 text-end" style="white-space: nowrap">
+        <div class="text-black/30 text-sm font-normal font-['PingFang_SC'] leading-[8.18px] ">
+          <template v-if="options.messageType !== MessageType.Integral && String(options.isRead) === '0'">
+             <wd-img width="16" height="16" src="/static/svgs/red.svg"></wd-img>
+          </template>
           {{ beforeNow(dayjs(options.createTime).toDate()) }}
+<!--          <div class="absolute top-[2px] right-[50px] z-10">-->
+<!--            <wd-img width="16" height="20" src="/static/svgs/red.svg"></wd-img>-->
+<!--          </div>-->
+<!--          <wd-img width="16" height="10" src="/static/svgs/red.svg"></wd-img>-->
         </div>
       </div>
       <div class="row-start-2 col-start-2 col-end-4">

+ 75 - 32
packages/app/src/pages/messages/index.vue

@@ -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>

+ 23 - 0
packages/app/src/pages/mine/orders/detail/index.vue

@@ -136,6 +136,29 @@ onLoad((query: { id: string }) => {
       <SectionHeading title="返还积分" size="sm" :end-text="`${data?.payPoints}`"></SectionHeading>
       <SectionHeading title="取消人" size="sm" :end-text="data?.cancelUser"></SectionHeading>
     </template>
+    <template v-if="data?.orderStatus === '1'">
+    <div
+      class="text-left text-black text-base font-normal font-['PingFang_SC'] leading-normal mt-[24px]"
+    >
+      完成记录
+    </div>
+    <div class="flex mt-[5px] items-center justify-between">
+      <div class="text-black/60 text-sm font-normal font-['PingFang_SC'] leading-normal">
+        完成时间
+      </div>
+      <div class="text-black/90 text-sm font-normal font-['PingFang_SC'] leading-normal">
+        {{ dayjs(data?.completeTime).format('YYYY-MM-DD HH:mm') }}
+      </div>
+    </div>
+    <div class="flex mt-[5px] items-center justify-between">
+      <div class="text-black/60 text-sm font-normal font-['PingFang_SC'] leading-normal">
+        操作人
+      </div>
+      <div class="text-black/90 text-sm font-normal font-['PingFang_SC'] leading-normal">
+        {{ data?.verificationUserName }}
+      </div>
+    </div>
+</template>
     <div class="flex-1"></div>
     <BottomAppBar fixed>
       <div>

+ 3 - 0
packages/app/src/static/svgs/red.svg

@@ -0,0 +1,3 @@
+<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 10">
+  <circle cx="5" cy="5" r="5" fill="red"/>
+</svg>