Browse Source

feat(points): 添加积分状态枚举及积分详情接口,优化消息卡片逻辑

EvilDragon 3 months ago
parent
commit
9b178e3f39

+ 19 - 0
packages/app/src/core/libs/enums.ts

@@ -26,3 +26,22 @@ export enum QrCodeBusinessType {
    */
   InStoreClockIn = 'ISCI',
 }
+export enum PointStatus {
+  // 状态(待确认1,已完成2,已驳回3,已撤销4)
+  /**
+   * 待确认
+   */
+  PendingConfirmation = 1,
+  /**
+   * 已完成
+   */
+  Completed = 2,
+  /**
+   * 已驳回
+   */
+  Rejected = 3,
+  /**
+   * 已撤销
+   */
+  Revoked = 4,
+}

+ 41 - 0
packages/app/src/core/libs/models.ts

@@ -491,6 +491,7 @@ export interface Message {
   createTime: number
   viewCount: any
   viewTime: any
+  pointsDetail?: PointsDetail
 }
 export interface Coupon {
   id: number
@@ -527,6 +528,46 @@ export interface Coupon {
   materialName: string
   couponImgUrl: string
 }
+export interface PointsDetail {
+  id: number
+  pointsType: string
+  typeName: string
+  pointsCategory: string
+  categoryName: string
+  sourceId: any
+  name: string
+  pointsStauts: number
+  points: number
+  couponPoints: any
+  orderMoney: string
+  materialsId: number
+  materialsName: any
+  materialsBrand: string
+  stylistId: number
+  brokerId: number
+  stylistName: string
+  brokerName: string
+  generateTime: number
+  verifyTime?: number
+  completeTime?: number
+  turnDownTime: any
+  cancelTime: any
+  cancelReason: any
+  turnDownReason: any
+  remark: any
+  couponId: any
+  orderNo: any
+  createTime: number
+  businessType: any
+  customerName: string
+  customerPhone: string
+  orderImgUrl: any
+  pointsRate: any
+  commission: number
+  creator: string
+  creatorName: any
+}
+
 export enum DictType {
   /**
    *  擅长空间类型

+ 2 - 2
packages/app/src/pages/home/spread/index.vue

@@ -1,5 +1,5 @@
-<route lang="json5">
-{ style: { navigationBarTitleText: '设计传播', navigationBarBackgroundColor: '#fff' } }
+<route lang="json">
+{ "style": { "navigationBarTitleText": "设计传播", "navigationBarBackgroundColor": "#fff" } }
 </route>
 
 <script setup lang="ts">

+ 14 - 7
packages/app/src/pages/messages/components/message-card.vue

@@ -4,7 +4,7 @@ import Card from '@/components/card.vue'
 import { integral, interact, message, system } from '../../../core/libs/svgs'
 import { beforeNow } from '../../../utils/date-util'
 import dayjs from 'dayjs'
-import { MessageType } from '../../../core/libs/enums'
+import { MessageType, PointStatus } from '../../../core/libs/enums'
 import { getPointsCoupons } from '../../../core/libs/requests'
 
 const props = withDefaults(defineProps<{ options?: Message }>(), {})
@@ -107,7 +107,8 @@ onMounted(async () => {
             v-if="
               [MessageType.Integral].includes(Number(options.messageType)) &&
               options.messageSubType === 31 &&
-              options.isRead !== '1'
+              options.isRead !== '1' &&
+              options.pointsDetail?.pointsStauts === PointStatus.PendingConfirmation
             "
           >
             <span class="text-black/40">
@@ -116,12 +117,17 @@ onMounted(async () => {
           </template>
           <template
             v-else-if="
-              [MessageType.Integral].includes(Number(options.messageType)) && options.isRead === '1'
+              [MessageType.Integral].includes(Number(options.messageType)) &&
+              options.messageSubType === 31 &&
+              options.isRead === '1'
             "
           >
-            <span class="text-black/40">
-              <!-- 确认积分后,即刻到账,如有问题请驳回,联系材料商修改积分后再次确认 -->
-            </span>
+            <template v-if="options.pointsDetail?.pointsStauts === PointStatus.Rejected">
+              <span class="text-black/40">
+                <!-- 确认积分后,即刻到账,如有问题请驳回,联系材料商修改积分后再次确认 -->
+                驳回原因:{{ options.pointsDetail?.cancelReason }}
+              </span>
+            </template>
           </template>
           <template
             v-else-if="
@@ -144,7 +150,8 @@ onMounted(async () => {
         v-if="
           [MessageType.Integral].includes(Number(options.messageType)) &&
           options.messageSubType === 31 &&
-          options.isRead !== '1'
+          options.isRead !== '1' &&
+          options.pointsDetail?.pointsStauts === PointStatus.PendingConfirmation
         "
       >
         <div class="flex gap-4">