From 80ca024e9ae633df0dc9f4e8f533f33b526afb3d Mon Sep 17 00:00:00 2001
From: p-honggang.li <p-honggang.li@pcitc.com>
Date: 星期一, 08 九月 2025 16:24:38 +0800
Subject: [PATCH] 修复文件上传获取不到用户信息的BUG

---
 src/views/productManage/productPriceViewer/index.vue |   83 +++++++++++++++++++++++++----------------
 1 files changed, 50 insertions(+), 33 deletions(-)

diff --git a/src/views/productManage/productPriceViewer/index.vue b/src/views/productManage/productPriceViewer/index.vue
index 3c9e4fa..2d9b05c 100644
--- a/src/views/productManage/productPriceViewer/index.vue
+++ b/src/views/productManage/productPriceViewer/index.vue
@@ -321,7 +321,7 @@
                 <td class="value">{{ statusText(orderStatus.status) }}</td>
                 <td></td>
                 <td class="value link">
-                  <el-link type="primary" @click="viewOrder">鏌ョ湅璁㈠崟淇℃伅</el-link>
+<!--                  <el-link type="primary" @click="viewOrder">鏌ョ湅璁㈠崟淇℃伅</el-link>-->
                 </td>
               </tr>
             </tbody>
@@ -337,7 +337,7 @@
     <div class="footer" v-if="showPricePanel">
      <el-button type="primary" @click="handleOrder">绔嬪嵆璁㈣喘</el-button>
     </div>
-    <div class="footer" v-else>
+    <div class="footer" v-if="showOrderPanel">
       <el-button @click="returnPricePanel">杩斿洖浠锋牸瀵规瘮</el-button>
       <el-button type="primary" @click="submitOrder">鎻愪氦鐢宠</el-button>
     </div>
@@ -639,7 +639,7 @@
 
   loading.value = true
   try {
-    // 鍙煡璇竴璧风敤鐨勫畾浠�
+    // 鍙煡璇㈠凡鍚敤鐨勫畾浠�
     const res: any = await productPricingApi.listBycondition({ productId: productId,isActive: true })
     if (res?.code === 200) {
       const list = Array.isArray(res.data) ? res.data : []
@@ -796,6 +796,21 @@
   }else{
      paymentType = '鍗忚'
   }
+     let processdefId: string = ''
+     const type = hasAGREEMENT ? 'trade_agreement' : 'trade_point';
+     // 鑾峰彇宸ヤ綔娴佸弬鏁�
+     const  wkParamsRes: any = await workFlowApi.getWorkFlowParams({
+      type: type,
+      // unitId: '1',
+      businessKey: type
+    })
+  if(wkParamsRes?.code === 200 && wkParamsRes.data?.processTemplateId){
+    processdefId = wkParamsRes.data.processTemplateId
+  }else {
+    ElMessage.error('鑾峰彇宸ヤ綔娴佸弬鏁板け璐�!')
+    return
+  }
+
   // 缁勮鍒涘缓璁㈠崟鍙傛暟锛圕reateOrderDTO锛�
   const payload = {
     userId: currentUserId.value,
@@ -805,6 +820,7 @@
     providerId: productHeader.value.createUserId,
     paymentType: paymentType,
     buyerRemarks: '',
+    processdefId: processdefId,
     items: items.map(it => ({
       pricingId: it.id,
       productId: it.productId,
@@ -839,34 +855,35 @@
         applyTime: data.applyTime ? String(data.applyTime) : new Date().toLocaleString()
       }
       // 璋冪敤宸ヤ綔娴佹帴鍙e彂璧峰鎵规祦绋嬶紝鎷垮埌娴佺▼瀹炰緥ID鍚庡洖鍐欒鍗晈orkflow_id
-      try {
-        // 鏍规嵁鏄惁鍖呭惈鍗忚鏄庣粏锛岄厤缃笉鍚屾祦绋嬪畾涔変笌涓氬姟Key锛堝厛鐢ㄩ潤鎬佸�煎崰浣嶏級
-        // const processdefId = hasAGREEMENT ? 'Process_Agreement_Static' : 'Process_Points_Static'
-        const businessKey = hasAGREEMENT ? 'agreement_biz_key' : 'points_biz_key'
-        const type = hasAGREEMENT ? 'trade_agreement' : 'trade_point';
-        // 鑾峰彇宸ヤ綔娴佸弬鏁�
-        const  wkParamsRes: any = await workFlowApi.getWorkFlowParams({
-          type: type,
-          unitId: '1'
-        })
-        if(wkParamsRes?.code === 200 && wkParamsRes.data?.processTemplateId){
-          const wfRes: any = await workFlowApi.startWorkflowAndComplete({
-            processdefId: wkParamsRes.data.processTemplateId,
-            userid: String(currentUserId.value || ''),
-            businessKey: businessKey
-          })
-          if (wfRes?.code === 200 && wfRes.data?.processinstId) {
-            await orderApi.updateWorkflowId(data.orderId, wfRes.data.processinstId)
-          }
-        }
-
-      } catch (e) {
-        console.warn('鍚姩宸ヤ綔娴佸け璐ユ垨鏇存柊workflow_id澶辫触', e)
-      }
+      // 鏀惧悗绔鐞�
+      // try {
+      //   // 鏍规嵁鏄惁鍖呭惈鍗忚鏄庣粏锛岄厤缃笉鍚屾祦绋嬪畾涔変笌涓氬姟Key锛堝厛鐢ㄩ潤鎬佸�煎崰浣嶏級
+      //   // const processdefId = hasAGREEMENT ? 'Process_Agreement_Static' : 'Process_Points_Static'
+      //   const businessKey = hasAGREEMENT ? 'agreement_biz_key' : 'points_biz_key'
+      //   const type = hasAGREEMENT ? 'trade_agreement' : 'trade_point';
+      //   // 鑾峰彇宸ヤ綔娴佸弬鏁�
+      //   const  wkParamsRes: any = await workFlowApi.getWorkFlowParams({
+      //     type: type,
+      //     unitId: '1'
+      //   })
+      //   if(wkParamsRes?.code === 200 && wkParamsRes.data?.processTemplateId){
+      //     const wfRes: any = await workFlowApi.startWorkflowAndComplete({
+      //       processdefId: wkParamsRes.data.processTemplateId,
+      //       userid: String(currentUserId.value || ''),
+      //       businessKey: businessKey
+      //     })
+      //     if (wfRes?.code === 200 && wfRes.data?.processinstId) {
+      //       await orderApi.updateWorkflowId(data.orderId, wfRes.data.processinstId)
+      //     }
+      //   }
+      //
+      // } catch (e) {
+      //   console.warn('鍚姩宸ヤ綔娴佸け璐ユ垨鏇存柊workflow_id澶辫触', e)
+      // }
 
       // 娓呯┖璐墿杞︼紙鍚庣 + 鏈湴鐘舵�侊級
       try {
-        const clearRes: any = await cartApi.clearCart(currentUserId.value, currentUnitId.value,currentProductId.value)
+        const clearRes: any = await cartApi.clearCart(currentUserId.value, currentUnitId.value,currentProductId.value ? currentProductId.value : '')
         if (clearRes?.code === 200) {
           cartItems.value = []
           orderSuites.value = []
@@ -919,7 +936,7 @@
 
 const removeFromCart = async (pricingId: string) => {
   try {
-    const res: any = await cartApi.removeFromCart(currentUserId.value, currentUnitId.value, currentProductId.value,pricingId)
+    const res: any = await cartApi.removeFromCart(currentUserId.value, currentUnitId.value, currentProductId.value? currentProductId.value : '',pricingId)
     if (res?.code === 200) {
       ElMessage.success('宸蹭粠璐墿杞︾Щ闄�')
     } else {
@@ -931,15 +948,15 @@
   }
 }
 
-const updateCartItem = async (pricingId: number, quantity: number, duration: number) => {
+const updateCartItem = async (pricingId: number, quantity: number | null, duration: number | null) => {
   try {
     // 杩欓噷闇�瑕佹牴鎹疄闄呮帴鍙h皟鏁达紝鍙兘闇�瑕佷紶閫掓洿澶氬弬鏁�
     let res: any = {}
     if(quantity){
-      res = await cartApi.updateCartItem(currentUserId.value, currentUnitId.value, currentProductId.value, pricingId, quantity)
+      res = await cartApi.updateCartItem(currentUserId.value, currentUnitId.value, currentProductId.value? currentProductId.value : '', pricingId, quantity)
     }
     if(duration){
-      res = await cartApi.updateCartItemDuration(currentUserId.value, currentUnitId.value, currentProductId.value, pricingId, duration)
+      res = await cartApi.updateCartItemDuration(currentUserId.value, currentUnitId.value, currentProductId.value? currentProductId.value : '', pricingId, duration)
     }
     if (res?.code === 200) {
       ElMessage.success('璐墿杞﹀凡鏇存柊')
@@ -955,7 +972,7 @@
 const fetchCartItems = async () => {
   cartLoading.value = true
   try {
-    const res: any = await cartApi.getCartItems(currentUserId.value, currentUnitId.value, currentProductId.value)
+    const res: any = await cartApi.getCartItems(currentUserId.value, currentUnitId.value, currentProductId.value? currentProductId.value : '')
     if (res?.code === 200) {
       cartItems.value = res.data || []
       // 灏嗚喘鐗╄溅鏁版嵁杞崲涓鸿鍗曞浠舵牸寮�

--
Gitblit v1.8.0