فهرست منبع

feat: 优化优惠券详情展示

laiqi 11 ماه پیش
والد
کامیت
35cc2df7c2

+ 113 - 63
apps/web-ele/src/views/examine-manage/examine-coupon/detail.vue

@@ -13,7 +13,8 @@ const loading = ref(false);
 // 申请人信息
 const applicantInfo = computed(() => {
   if (!data.value) return [];
-  return [
+
+  const baseInfo = [
     { label: '姓名', value: data.value.usersname },
     { label: '手机号', value: data.value.usersphone },
     { label: '身份证号', value: data.value.usersidcardnumber },
@@ -21,11 +22,20 @@ const applicantInfo = computed(() => {
     { label: '用户性质', value: data.value.usersnature },
     { label: '邮箱', value: data.value.usersemail },
     { label: '地址', value: data.value.usersaddress },
-    { label: '注册时间', value: data.value.usersdate },
+    // { label: '注册时间', value: data.value.usersdate },
     { label: '银行名称', value: data.value.usersbankname },
     { label: '银行账号', value: data.value.usersbanknumber },
-    { label: '社会统一信用代码', value: data.value.usersshtyxydm },
   ];
+
+  // 如果用户类型不是"个人",显示社会统一信用代码
+  if (data.value.userstype !== '个人') {
+    baseInfo.push({
+      label: '社会统一信用代码',
+      value: data.value.usersshtyxydm,
+    });
+  }
+
+  return baseInfo;
 });
 
 // 产品信息
@@ -49,18 +59,18 @@ const productInfo = computed(() => {
       value: data.value.productszybt ? `¥${data.value.productszybt}` : '',
     },
     { label: '产品序列号', value: data.value.productssn },
-    { label: '发动机编号', value: data.value.productsfdbh },
-    { label: '发动机名称', value: data.value.productsfdmc },
+    { label: '分档编号', value: data.value.productsfdbh },
+    { label: '分档名称', value: data.value.productsfdmc },
     { label: '生产企业', value: data.value.scqyinfomc },
     { label: '企业地址', value: data.value.scqyinfoaddress },
-    { label: '法人姓名', value: data.value.scqyinfofrmc },
-    { label: '销售姓名', value: data.value.scqyinfoxsmc },
-    { label: '销售电话', value: data.value.scqyinfoxsphone },
-    { label: '统一社会信用代码', value: data.value.scqyinfoshtydm },
-    {
-      label: '注册资本',
-      value: data.value.scqyinfozczb ? `¥${data.value.scqyinfozczb}` : '',
-    },
+    // { label: '法人姓名', value: data.value.scqyinfofrmc },
+    // { label: '销售姓名', value: data.value.scqyinfoxsmc },
+    // { label: '销售电话', value: data.value.scqyinfoxsphone },
+    // { label: '统一社会信用代码', value: data.value.scqyinfoshtydm },
+    // {
+    //   label: '注册资本',
+    //   value: data.value.scqyinfozczb ? `¥${data.value.scqyinfozczb}` : '',
+    // },
   ];
 });
 
@@ -97,46 +107,53 @@ const getUsedStatusTag = (status: number) => {
 const couponInfo = computed(() => {
   if (!data.value) return [];
 
-  return [
-    { label: '优惠券ID', value: data.value.coupon2sid },
+  const baseInfo = [
+    // { label: '优惠券ID', value: data.value.coupon2sid },
     { label: '优惠券代码', value: data.value.coupon2code },
     { label: '优惠券名称', value: data.value.coupon2mc },
     { label: '申请时间', value: data.value.coupon2adddatetime },
     { label: '审核时间', value: data.value.coupon2reviewdatetime || '未审核' },
     {
-      label: '优惠券状态',
-      value: data.value.coupon2sype,
-      isTag: true,
-      tagType: 'couponStatus',
-    },
-    {
       label: '使用状态',
       value: data.value.coupon2isused,
       isTag: true,
       tagType: 'usedStatus',
     },
-    // { label: '可用产品ID', value: data.value.coupon2productids },
-    // { label: '关联主券ID', value: data.value.coupon2coupon1id },
-    { label: '订单编号', value: data.value.ordersnumber },
-    {
-      label: '订单总价',
-      value: data.value.orderstotalprice
-        ? `¥${data.value.orderstotalprice}`
-        : '',
-    },
-    {
-      label: '优惠价格',
-      value: data.value.ordersyhprice ? `¥${data.value.ordersyhprice}` : '',
-    },
     {
-      label: '折扣价格',
-      value: data.value.ordersdiscountprice
-        ? `¥${data.value.ordersdiscountprice}`
-        : '',
+      label: '优惠券状态',
+      value: data.value.coupon2sype,
+      isTag: true,
+      tagType: 'couponStatus',
     },
-    { label: '下单时间', value: data.value.ordersorderdate },
-    { label: '经销商名称', value: data.value.jxsname },
+    // { label: '可用产品ID', value: data.value.coupon2productids },
+    // { label: '关联主券ID', value: data.value.coupon2coupon1id },
+    // { label: '订单编号', value: data.value.ordersnumber },
+    // {
+    //   label: '订单总价',
+    //   value: data.value.orderstotalprice
+    //     ? `¥${data.value.orderstotalprice}`
+    //     : '',
+    // },
+    // {
+    //   label: '优惠价格',
+    //   value: data.value.ordersyhprice ? `¥${data.value.ordersyhprice}` : '',
+    // },
+    // {
+    //   label: '折扣价格',
+    //   value: data.value.ordersdiscountprice
+    //     ? `¥${data.value.ordersdiscountprice}`
+    //     : '',
+    // },
+    // { label: '下单时间', value: data.value.ordersorderdate },
+    // { label: '经销商名称', value: data.value.jxsname },
   ];
+
+  // 如果优惠券状态为2(审核不通过),显示审核备注
+  if (data.value.coupon2sype === 2) {
+    baseInfo.push({ label: '审核备注', value: data.value.coupon2shbz });
+  }
+
+  return baseInfo;
 });
 
 const [Modal, modalApi] = useVbenModal({
@@ -183,19 +200,41 @@ defineExpose({
 <template>
   <Modal>
     <div v-loading="loading" class="space-y-6 p-4">
-      <!-- 申请人信息 -->
+      <!-- 优惠券信息 -->
       <div>
         <el-divider content-position="left">
-          <span class="text-lg font-semibold text-gray-800">申请人信息</span>
+          <span class="text-lg font-semibold text-gray-800">优惠券信息</span>
         </el-divider>
         <el-descriptions :column="3" border class="mb-4" label-width="120px">
           <el-descriptions-item
-            v-for="item in applicantInfo"
+            v-for="item in couponInfo"
             :key="item.label"
             :label="item.label"
             width="20%"
           >
-            {{ item.value || '-' }}
+            <!-- 优惠券状态标签 -->
+            <ElTag
+              v-if="item.isTag && item.tagType === 'couponStatus'"
+              :type="getCouponStatusTag(item.value).type"
+            >
+              {{ getCouponStatusTag(item.value).text }}
+            </ElTag>
+            <!-- 使用状态标签 -->
+            <ElTag
+              v-else-if="item.isTag && item.tagType === 'usedStatus'"
+              :type="getUsedStatusTag(item.value).type"
+            >
+              {{ getUsedStatusTag(item.value).text }}
+            </ElTag>
+            <!-- 审核备注特殊显示 -->
+            <div v-else-if="item.label === '审核备注'" class="reject-reason">
+              <ElTag type="danger" effect="dark" size="default">
+                <i class="el-icon-warning-outline mr-1"></i>
+                {{ item.value || '暂无备注' }}
+              </ElTag>
+            </div>
+            <!-- 普通文本 -->
+            <span v-else>{{ item.value || '-' }}</span>
           </el-descriptions-item>
         </el-descriptions>
       </div>
@@ -217,37 +256,48 @@ defineExpose({
         </el-descriptions>
       </div>
 
-      <!-- 优惠券信息 -->
+      <!-- 申请人信息 -->
       <div>
         <el-divider content-position="left">
-          <span class="text-lg font-semibold text-gray-800">优惠券信息</span>
+          <span class="text-lg font-semibold text-gray-800">申请人信息</span>
         </el-divider>
         <el-descriptions :column="3" border class="mb-4" label-width="120px">
           <el-descriptions-item
-            v-for="item in couponInfo"
+            v-for="item in applicantInfo"
             :key="item.label"
             :label="item.label"
             width="20%"
           >
-            <!-- 优惠券状态标签 -->
-            <ElTag
-              v-if="item.isTag && item.tagType === 'couponStatus'"
-              :type="getCouponStatusTag(item.value).type"
-            >
-              {{ getCouponStatusTag(item.value).text }}
-            </ElTag>
-            <!-- 使用状态标签 -->
-            <ElTag
-              v-else-if="item.isTag && item.tagType === 'usedStatus'"
-              :type="getUsedStatusTag(item.value).type"
-            >
-              {{ getUsedStatusTag(item.value).text }}
-            </ElTag>
-            <!-- 普通文本 -->
-            <span v-else>{{ item.value || '-' }}</span>
+            {{ item.value || '-' }}
           </el-descriptions-item>
         </el-descriptions>
       </div>
     </div>
   </Modal>
 </template>
+
+<style scoped>
+.reject-reason {
+  animation: pulse 2s infinite;
+}
+
+.reject-reason .el-tag {
+  font-weight: bold;
+  border: 2px solid #f56c6c;
+  box-shadow: 0 2px 8px rgb(245 108 108 / 30%);
+}
+
+@keyframes pulse {
+  0% {
+    transform: scale(1);
+  }
+
+  50% {
+    transform: scale(1.02);
+  }
+
+  100% {
+    transform: scale(1);
+  }
+}
+</style>

+ 17 - 2
apps/web-ele/src/views/examine-manage/examine-coupon/index.vue

@@ -7,6 +7,7 @@ import { h, ref } from 'vue';
 
 import { Page } from '@vben/common-ui';
 import { MdiCheckboxMultipleMarked, MdiDetail, MdiPlus } from '@vben/icons';
+import { useUserStore } from '@vben/stores';
 
 import { ElMessage, ElMessageBox, ElTag } from 'element-plus';
 
@@ -19,6 +20,11 @@ import DetailForm from './detail.vue';
 import OrderCouponForm from './order-coupon-form.vue';
 import ReceiveCouponForm from './receive-coupon-form.vue';
 
+const userStore = useUserStore();
+
+// 判断是否为代理商且非管理员
+const isDLSNotAdmin = userStore.isDLS && !userStore.isSuperAdmin;
+
 const receiveCouponFormRef = ref<InstanceType<typeof ReceiveCouponForm> | null>(
   null,
 );
@@ -81,11 +87,19 @@ const gridOptions: VxeGridProps<any> = {
     },
     ajax: {
       query: async ({ page }, formValues) => {
-        return await getCoupon2AuditListApi({
+        // 构建查询参数
+        const queryParams: any = {
           pageindex: page.currentPage,
           rows: page.pageSize,
           ...formValues,
-        });
+        };
+
+        // 如果是代理商且非管理员,添加商户id查询条件
+        if (isDLSNotAdmin && userStore.userInfo?.workeruserid) {
+          queryParams.coupon2merchantid = userStore.userInfo.workeruserid;
+        }
+
+        return await getCoupon2AuditListApi(queryParams);
       },
     },
   },
@@ -255,6 +269,7 @@ function handleOrderSuccess({ orderId }: { orderId: string }) {
           effect="dark"
           content="审核"
           placement="top"
+          v-if="userStore.isSuperAdmin"
         >
           <el-button
             round