Selaa lähdekoodia

feat: 更新订单管理表单,新增优惠券ID处理,优化购机者和证件附件相关逻辑

laiqi 11 kuukautta sitten
vanhempi
commit
98e5446ea8
1 muutettua tiedostoa jossa 26 lisäystä ja 19 poistoa
  1. 26 19
      apps/web-ele/src/views/order-manage/form.vue

+ 26 - 19
apps/web-ele/src/views/order-manage/form.vue

@@ -28,6 +28,7 @@ const getTitle = computed(() => titleMap[formType.value]);
 const invoiceDataList = ref<any[]>([{}]);
 const certificateDataList = ref<any[]>([]);
 const buyerPhotoDataList = ref<any[]>([]);
+const coupon2sid = ref(''); // 优惠券id
 
 const [BaseForm, baseFormApi] = useVbenForm({
   showDefaultActions: false,
@@ -247,11 +248,15 @@ const [Modal, modalApi] = useVbenModal({
         });
 
         const filePrefix = await getFilePrefix();
+
+        // 先执行获取订单详情
+        await getOrderDetail(data.value.row.ordersid, baseFormApi);
+
+        // 订单详情获取完成后,再并行执行剩余3个函数
         const results = await Promise.allSettled([
-          getOrderDetail(data.value.row.ordersid, baseFormApi),
           getOrderInvoice(data.value.row.ordersid, filePrefix),
-          getOrderCertificate(data.value.row.ordersid, filePrefix),
-          getOrderBuyerPhoto(data.value.row.ordersid, filePrefix),
+          getOrderCertificate(coupon2sid.value, filePrefix),
+          getOrderBuyerPhoto(coupon2sid.value, filePrefix),
         ]);
 
         // 更新schema
@@ -272,7 +277,7 @@ const [Modal, modalApi] = useVbenModal({
           (item) => item.fieldName === 'buyerPhotoAttachments',
         );
 
-        // 首先添加购买人照片
+        // 首先添加购机者照片
         // 如果不存在,则添加购买人自拍附件字段
         if (!hasBuyerPhotoAttachments && buyerPhotoDataList.value.length > 0) {
           baseFormApi.setState({
@@ -296,7 +301,7 @@ const [Modal, modalApi] = useVbenModal({
                   }),
                 ),
                 fieldName: 'buyerPhotoAttachments',
-                label: '购买人照片',
+                label: '购机者照片',
                 // formItemClass: 'lg:col-span-2',
               },
             ],
@@ -315,15 +320,15 @@ const [Modal, modalApi] = useVbenModal({
                   '暂无',
                 ),
                 fieldName: 'buyerPhotoAttachments',
-                label: '购买人照片',
+                label: '购机者照片',
                 // formItemClass: 'lg:col-span-2',
               },
             ],
           });
         }
 
-        // 然后添加证附件
-        // 如果不存在,则添加证附件字段
+        // 然后添加证附件
+        // 如果不存在,则添加证附件字段
         if (
           !hasCertificateAttachments &&
           certificateDataList.value.length > 0
@@ -349,7 +354,7 @@ const [Modal, modalApi] = useVbenModal({
                   }),
                 ),
                 fieldName: 'certificateAttachments',
-                label: '证附件',
+                label: '证附件',
                 // formItemClass: 'lg:col-span-2',
               },
             ],
@@ -368,7 +373,7 @@ const [Modal, modalApi] = useVbenModal({
                   '暂无',
                 ),
                 fieldName: 'certificateAttachments',
-                label: '证附件',
+                label: '证附件',
                 // formItemClass: 'lg:col-span-2',
               },
             ],
@@ -568,9 +573,11 @@ const getOrderDetail = async (ordersid: string, formApi: ExtendedFormApi) => {
   });
 
   formApi.setValues(detailData);
+
+  coupon2sid.value = detailData.coupon2sid;
 };
 
-// 获取订单发票附件
+// 获取发票附件
 const getOrderInvoice = async (ordersid: string, filePrefix: string) => {
   const invoiceData = await getAttachmentListApi({
     attlsh: ordersid,
@@ -588,11 +595,11 @@ const getOrderInvoice = async (ordersid: string, filePrefix: string) => {
   invoiceDataList.value = invoiceData.Data;
 };
 
-// 获取订单证件附件
-const getOrderCertificate = async (ordersid: string, filePrefix: string) => {
+// 获取购机者证件附件
+const getOrderCertificate = async (coupon2sid: string, filePrefix: string) => {
   const certificateData = await getAttachmentListApi({
-    attlsh: ordersid,
-    attmodel: 'orders_identity',
+    attlsh: coupon2sid,
+    attmodel: 'coupon_identity',
     pageindex: 1,
     rows: 10,
   });
@@ -606,11 +613,11 @@ const getOrderCertificate = async (ordersid: string, filePrefix: string) => {
   certificateDataList.value = certificateData.Data;
 };
 
-// 获取购买人自拍附件
-const getOrderBuyerPhoto = async (ordersid: string, filePrefix: string) => {
+// 获取购机者自拍附件
+const getOrderBuyerPhoto = async (coupon2sid: string, filePrefix: string) => {
   const buyerPhotoData = await getAttachmentListApi({
-    attlsh: ordersid,
-    attmodel: 'orders_buyer',
+    attlsh: coupon2sid,
+    attmodel: 'coupon_buyer',
     pageindex: 1,
     rows: 10,
   });