张田田 1 month ago
parent
commit
0b9c5ecaa8

+ 21 - 0
src/model/order.model.ts

@@ -177,4 +177,25 @@ export interface ApplyRecordModel{
   pieTime: string; // 派单时间
   operateTime: string; // 操作时间
   status: string; // 服务状态
+}
+
+export interface LogisticsModel{
+  trailUrl:string;
+  arrivalTime:string;
+  totalTime:string;
+  remainTime:string;
+  tracks:[
+    {
+      time:string;
+      context:string;
+      ftime:string;
+      areaCode:string;
+      areaName:string;
+      status:string;
+      areaCenter:string;
+      areaPinYin:string;
+      statusCode:string;
+      location:string;
+    }
+  ]
 }

+ 6 - 21
src/order/EditShipment.vue

@@ -31,33 +31,18 @@ const formData = ref<ShipmentForm>({
   expressType: '',
   expressNo: '',
 });
-
-// 快递类型选项
-const expressTypeOptionsList = [
-  { label: '邮政速递', value: '0' },
-  { label: '顺丰速运', value: '1' },
-  { label: '京东快递', value: '2' },
-  { label: '中通快递', value: '3' },
-  { label: '圆通速递', value: '4' },
-  { label: '申通快递', value: '5' },
-  { label: '韵达快递', value: '6' },
-  { label: '极兔速递', value: '7' },
-];
-
 onBeforeMount(async () => {
   try {
-    const res = await getDictionaryMethod('logistics_company').catch(() => null);
+    const res = await getDictionaryMethod('express_type').catch(() => null);
+    console.log(res,"获取数据")
     if (res && Array.isArray(res) && res.length > 0) {
       expressTypeOptions.value = res;
-    } else {
-      // 如果没有字典数据,使用默认选项
-      expressTypeOptions.value = expressTypeOptionsList;
+     
     }
   } catch (error) {
     // 使用默认数据
-    expressTypeOptions.value = expressTypeOptionsList;
+   console.log(error)
   }
-
   if (props.data) {
     formData.value.receiptType = props.data.receiptType || '1';
     formData.value.expressType = props.data.expressType || '';
@@ -114,8 +99,8 @@ const handleSubmit = async () => {
     id,
     conditioningProgramSupplierId: props.data?.conditioningProgramSupplierId,
     receiptType,
-    expressType : expressType || '',
-    expressNo : expressNo || '',
+    expressType: expressType || '',
+    expressNo: expressNo || '',
   } as any;
   try {
     await submit(submitData);

+ 2 - 1
src/pages/index/order/shipment.vue

@@ -354,7 +354,8 @@ function disabledPayEndDate(current: any) {
           <div>{{ row.receiptType === '0' ? '配送' : row.receiptType === '1' ? '线下取货' : '' }}</div>
         </template>
         <template #action="{ row }">
-          <vxe-button mode="text" status="primary" @click="goShipment(row)">
+          <vxe-button mode="text" status="primary" @click="goShipment(row)"
+            :disabled="row.isShowButton === false && row.receiptStatus === '1'">
             {{ row.receiptStatus === '1' ? '修改' : row.receiptStatus === '0' ? '去发货' : '' }}
           </vxe-button>
         </template>

+ 13 - 2
src/request/api/order.api.ts

@@ -3,7 +3,7 @@ import type {
   OrderQuery,
   OrderModel, OrderLiaisonListModel, ShipmentModel, ShipmentQuery, 
   PieOrderCountModel, RevenueSharingDetailModel, RevenueSharingDetailQuery,
-   EvaluateDetailModel, ApplyRecordModel
+   EvaluateDetailModel, ApplyRecordModel,LogisticsModel
 } from '@/model/order.model';
 import request from '@/request/alova';
 
@@ -191,4 +191,15 @@ export function getApplyRecordMethod(id: string) {
       hitSource: /order$/, // 匹配失效源
     }
   );
-} 
+} 
+
+// 获取物流信息 id患者调理方案ID
+export function getLogisticsMethod(id: string) {
+  return request.Post<LogisticsModel[]>(
+    `/fdhb-pc/patientCrManage/getLogistics/${id}`,
+    {},
+    {
+      hitSource: /order$/, // 匹配失效源
+    }
+  );
+} 

+ 30 - 70
src/service/SingleItemDetail.vue

@@ -8,7 +8,7 @@ import VxeUI from 'vxe-table';
 import ReviewMediaPreview from '@/service/ReviewMediaPreview.vue';
 import type { MediaItem } from '@/service/ReviewMediaPreview.vue';
 import seeEvaluate from '@/service/seeEvaluate.vue';
-import { getEvaluateDetailMethod, getApplyRecordMethod } from '@/request/api/order.api';
+import { getEvaluateDetailMethod, getApplyRecordMethod, getLogisticsMethod } from '@/request/api/order.api';
 
 const props = defineProps<{
   data: SystemCwModel['items'][number];
@@ -49,74 +49,24 @@ const mockSplitAccountList = computed(() => {
 const mockLogisticsData = computed(() => {
   console.log('props.data===', props.data);
   return {
-    trackingNumber: `${expressTypeText[props.data.expressType || '']} ${props.data.expressNo || ''}`,
+    expressName:`${expressTypeText[props.data.expressType || '']}`,
+    trackingNumber: `${props.data.expressNo || ''}`,
     recipientName: props.data.liaison ? props.data.liaison + ', ' : '',
     recipientPhone: props.data.phone ? props.data.phone + ', ' : '',
     recipientAddress: (props.data.provinceName !== null ? props.data.provinceName + ' ' : '') + (props.data.cityName !== null ? props.data.cityName + ' ' : '') + (props.data.areaName !== null ? props.data.areaName + ' ' : '') + (props.data.detailAddress !== null ? props.data.detailAddress : '')
   };
 });
 type LogisticsTimelineItem = {
-  title: string;
+  status: string;
   time: string;
-  detail: string;
+  context: string;
 };
 
 const showAllLogistics = ref(false);
-const mockLogisticsTimeline: LogisticsTimelineItem[] = [
-  {
-    title: '已签收',
-    time: '01-09 19:15',
-    detail: '您已在杭州金成花园15幢4号后完成取件,感谢使用菜鸟驿站,期待再次为您服务。',
-  },
-  {
-    title: '待取件',
-    time: '01-09 16:11',
-    detail: '您的快件已暂存在杭州金成花园15幢4号店菜鸟驿站,请凭取货码及时领取。如有疑问请联系15067159925',
-  },
-  {
-    title: '运输中',
-    time: '01-09 13:26',
-    detail: '快件离开杭州分拨中心,正在发往目的地站点。',
-  },
-  {
-    title: '包裹已揽收',
-    time: '01-09 09:42',
-    detail: '快递员已揽收您的包裹,正在安排发出。',
-  },
-];
-
-function normalizeLogisticsItem(item: any): LogisticsTimelineItem | null {
-  if (!item || typeof item !== 'object') return null;
-  const time = String(item.time ?? item.acceptTime ?? item.ftime ?? item.createTime ?? item.updateTime ?? '').trim();
-  const title = String(item.title ?? item.status ?? item.statusName ?? item.statusDesc ?? '').trim();
-  const detail = String(item.content ?? item.context ?? item.remark ?? item.description ?? item.message ?? '').trim();
-  const fallbackTitle = detail || title;
-  if (!time && !fallbackTitle && !detail) return null;
-  return {
-    title: fallbackTitle || '-',
-    time,
-    detail: detail && detail !== fallbackTitle ? detail : '',
-  };
-}
+let mockLogisticsTimeline = ref<string[]>([]);
 
 const logisticsTimeline = computed<LogisticsTimelineItem[]>(() => {
-  const source = props.data as any;
-  const listCandidate =
-    source?.expressDetails ??
-    source?.logisticsDetails ??
-    source?.logisticsList ??
-    source?.expressRouteList ??
-    source?.expressRoutes ??
-    source?.traces ??
-    source?.traceList ??
-    source?.routeList ??
-    source?.tracks ??
-    [];
-  if (!Array.isArray(listCandidate)) return mockLogisticsTimeline;
-  const normalizedList = listCandidate
-    .map((item: any) => normalizeLogisticsItem(item))
-    .filter((item): item is LogisticsTimelineItem => Boolean(item));
-  return normalizedList.length > 0 ? normalizedList : mockLogisticsTimeline;
+  return mockLogisticsTimeline.value
 });
 
 const visibleLogisticsTimeline = computed(() => {
@@ -226,9 +176,15 @@ async function getApplyRecord() {
   if (!id) return;
   const res = await getApplyRecordMethod(id);
   if (!res) return;
-  console.log(res, "获取预约");
   applyRecordList.value = res ?? [];
-  console.log(applyRecordList.value, "applyRecordList");
+}
+// 获取物流信息
+async function getLogistics() {
+  const id = (props.data as any)?.id;
+  if (!id) return;
+  const res = await getLogisticsMethod(id);
+  if (!res) return;
+  mockLogisticsTimeline.value = res?.tracks
 }
 const REVIEW_PREVIEW_MODAL_ID = 'review-media-preview-modal';
 //预览图片/视频
@@ -254,6 +210,7 @@ function openPreview(list: MediaItem[], index: number) {
 onMounted(async () => {
   await getEvaluateDetail();
   await getApplyRecord();
+  await getLogistics()
 });
 </script>
 
@@ -358,27 +315,30 @@ onMounted(async () => {
         <div class="logistics-content" v-if="data.receiptType === '0'">
           <template v-if="mockPackageItems.length > 0">
             <div class="flex align-items-center justify-between">
-            <div class="logistics-tracking">
-              <span class="tracking-number">{{ mockLogisticsData.trackingNumber }}</span>
-              <a @click="handleCopyTracking" class="copy-link">复制</a>
+              <div class="logistics-tracking">
+                <span class="tracking-number">{{ mockLogisticsData.expressName }}</span>
+                <span class="tracking-number">{{ mockLogisticsData.trackingNumber }}</span>
+                <a @click="handleCopyTracking" class="copy-link">复制</a>
+              </div>
+              <!-- <div class="text-gray-500">联系电话:9554</div> -->
             </div>
-            <div class="text-gray-500">联系电话:9554</div>
-          </div>
             <!-- 物流详情 -->
             <div class="logistics-detail">
               <template v-if="logisticsTimeline.length > 0">
                 <div class="logistics-timeline">
-                  <div class="timeline-item" v-for="(item, index) in visibleLogisticsTimeline" :key="`${item.time}-${index}`">
+                  <div class="timeline-item" v-for="(item, index) in visibleLogisticsTimeline"
+                    :key="`${item.time}-${index}`">
                     <div class="timeline-dot-wrap">
                       <span class="timeline-dot" :class="{ active: index === 0 }" />
-                      <span class="timeline-line" v-if="index !== visibleLogisticsTimeline.length - 1 || canExpandLogistics" />
+                      <span class="timeline-line"
+                        v-if="index !== visibleLogisticsTimeline.length - 1 || canExpandLogistics" />
                     </div>
                     <div class="timeline-content">
                       <div class="timeline-head">
-                        <span class="timeline-title" :class="{ active: index === 0 }">{{ item.title || '-' }}</span>
+                        <span class="timeline-title" :class="{ active: index === 0 }">{{ item.status || '-' }}</span>
                         <span class="timeline-time" :class="{ active: index === 0 }">{{ item.time || '-' }}</span>
                       </div>
-                      <div class="timeline-detail" v-if="item.detail">{{ item.detail }}</div>
+                      <div class="timeline-detail" v-if="item.context">{{ item.context }}</div>
                     </div>
                   </div>
                   <div class="timeline-item timeline-expand-item" v-if="canExpandLogistics">
@@ -475,7 +435,7 @@ onMounted(async () => {
       <h3 class="info-title">
         服务记录
         <span class="title-count">({{ data?.patientConditioningOfflines?.length || 0 }}/{{ data?.totalMeasure || 0
-          }})</span>
+        }})</span>
       </h3>
       <vxe-table :data="data?.patientConditioningOfflines" border>
         <vxe-column type="seq" title="序号" width="60" align="center" />
@@ -1046,7 +1006,7 @@ onMounted(async () => {
 
   .recipient-info {
     color: #333;
-    font-weight: 400;
+    font-weight: 500;
     flex: 1;
   }