Browse Source

feat(delivery): 更新配送类型字段并优化订单展示

- 将 `dvyType` 字段在 API 类型定义中设为必填
- 在订单列表和详情页中增加配送类型的展示逻辑
- 引入 `dvyStatus` 枚举用于显示配送方式名称
- 调整表格列宽与移动端样式以提升用户体验
- 统一“及时配送”为“即时配送”的表述
zhangtao 4 weeks ago
parent
commit
47725bc384

+ 7 - 1
src/typings/api.d.ts

@@ -1077,7 +1077,7 @@ declare namespace Api {
       /**
        * 配送类型(1:快递 2:自提 3:及时配送)
        */
-      dvyType?: number;
+      dvyType: number;
       /**
        * 完成时间
        */
@@ -1441,6 +1441,12 @@ declare namespace Api {
       cancel: number;
     }
     interface OrderRefund {
+      /**
+       * dvyType
+       *
+       * 1:快递 2:自提 3:无需快递
+       */
+      dvyType: number;
       /**
        * 退款单总分销金额
        */

+ 12 - 3
src/views/delivery/after-sales-order/index.vue

@@ -8,7 +8,7 @@ import { copyTextToClipboard } from '@/utils/zt';
 import { $t } from '@/locales';
 import { useForm } from '@/components/zt/Form/hooks/useForm';
 import NormalMoadl from '../normal-order/component/normal-modal.vue';
-import { orderStatus } from '../normal-order/normal-order';
+import { dvyStatus, orderStatus } from '../normal-order/normal-order';
 import { SearchForm, TypeText, refundEnum, refundStatus } from './after-sales-order';
 import OrderModal from './order-modal.vue';
 const appStore = useAppStore();
@@ -163,6 +163,15 @@ const { columns, data, loading, getData, mobilePagination } = useNaivePaginatedT
         );
       }
     },
+    {
+      key: 'dvyType',
+      title: '订单类型',
+      align: 'center',
+      width: 220,
+      render: row => {
+        return <NTag class={'mt7'}>{dvyStatus[row.dvyType as keyof typeof dvyStatus] || '未知类型'}</NTag>;
+      }
+    },
     {
       key: 'status',
       title: '订单状态',
@@ -189,7 +198,7 @@ const { columns, data, loading, getData, mobilePagination } = useNaivePaginatedT
       key: 'operate',
       title: $t('common.operate'),
       align: 'center',
-      width: 130,
+      width: 160,
       fixed: 'right',
       render: row => {
         return (
@@ -199,7 +208,7 @@ const { columns, data, loading, getData, mobilePagination } = useNaivePaginatedT
             </n-button>
             <n-button
               size="small"
-              class={'ml2'}
+              class={appStore.isMobile ? ' mt2' : 'ml2'}
               type="primary"
               ghost
               onClick={() => AfterSalesModal.value?.handleOpenOrder(row.refundId)}

+ 5 - 1
src/views/delivery/after-sales-order/order-modal.vue

@@ -4,6 +4,7 @@ import { fetchGetAfterSalesOrderDetail } from '@/service/api/delivery/after-sale
 import { useAppStore } from '@/store/modules/app';
 import { copyTextToClipboard } from '@/utils/zt';
 import { useModal } from '@/components/zt/Modal/hooks/useModal';
+import { dvyStatus } from '../normal-order/normal-order';
 import { TypeText, orderColumns, refundEnum, refundStatus, refundTime, refundTimeEnum } from './after-sales-order';
 const [registerModal, { openModal, setModalLoading }] = useModal({
   title: '处理退款',
@@ -93,7 +94,10 @@ function getImgFils() {
         </NDescriptionsItem>
         <NDescriptionsItem label="购买信息">
           <div>商品总额: {{ goodsMoney || '---' }}</div>
-          <div>配送费(快递): {{ orderInfo.freightAmount || '---' }}元</div>
+          <div>
+            配送费({{ dvyStatus[orderInfo.dvyType as keyof typeof dvyStatus]||'--' }}):
+            {{ orderInfo.freightAmount || '---' }}元
+          </div>
           <div>积分抵扣: {{ (orderInfo.orderOffsetPoints / 100).toFixed(2) || '---' }}元</div>
           <div>实际付款: {{ orderInfo.actualTotal || '---' }}元</div>
         </NDescriptionsItem>

+ 17 - 2
src/views/delivery/normal-order/index.vue

@@ -7,7 +7,7 @@ import { defaultTransform, useNaivePaginatedTable } from '@/hooks/common/table';
 import { copyTextToClipboard } from '@/utils/zt';
 import { $t } from '@/locales';
 import { useForm } from '@/components/zt/Form/hooks/useForm';
-import { SearchForm, ShippingButton, orderStatus, refundStatus } from './normal-order';
+import { SearchForm, ShippingButton, dvyStatus, orderStatus, refundStatus } from './normal-order';
 import DeliveryModal from './component/delivery-modal.vue';
 import NormalMoadl from './component/normal-modal.vue';
 const appStore = useAppStore();
@@ -139,6 +139,15 @@ const { columns, data, loading, getData, mobilePagination } = useNaivePaginatedT
         );
       }
     },
+    {
+      key: 'dvyType',
+      title: '订单类型',
+      align: 'center',
+      width: 120,
+      render: row => {
+        return <NTag class={'mt7'}>{dvyStatus[row.dvyType as keyof typeof dvyStatus] || '未知类型'}</NTag>;
+      }
+    },
     {
       key: 'status',
       title: '订单状态',
@@ -174,7 +183,13 @@ const { columns, data, loading, getData, mobilePagination } = useNaivePaginatedT
               查看订单
             </n-button>
             {ShippingButton.includes(row.hbOrderStatus) && (
-              <n-button size="small" class={'ml2'} type="primary" ghost onClick={() => handleDeivery(row)}>
+              <n-button
+                size="small"
+                class={appStore.isMobile ? ' mt2' : 'ml2'}
+                type="primary"
+                ghost
+                onClick={() => handleDeivery(row)}
+              >
                 {row.dvyFlowId ? '修改物流' : '发货'}
               </n-button>
             )}

+ 1 - 1
src/views/delivery/normal-order/normal-order.ts

@@ -148,7 +148,7 @@ export const refundStatus = {
 export const dvyStatus = {
   1: '快递',
   2: '自提',
-  3: '时配送'
+  3: '时配送'
 };
 
 export const orderColumns: NaiveUI.TableColumn<Api.delivery.OrderItemElement>[] = [