From b3fedd4221b807a07058be9d5d5d8ba8998adbcb Mon Sep 17 00:00:00 2001
From: Bang Hu <hu_bang@hotmail.com>
Date: 星期四, 11 九月 2025 21:35:31 +0800
Subject: [PATCH] Bug修改代码提交

---
 src/views/productManage/productPriceViewer/index.vue |  174 +++++++++++++++++++++++++++++----------------------------
 1 files changed, 89 insertions(+), 85 deletions(-)

diff --git a/src/views/productManage/productPriceViewer/index.vue b/src/views/productManage/productPriceViewer/index.vue
index 3c9e4fa..4caf97c 100644
--- a/src/views/productManage/productPriceViewer/index.vue
+++ b/src/views/productManage/productPriceViewer/index.vue
@@ -77,15 +77,7 @@
                       :colspan="getColspan(priceItem)"
                       class="feature-value"
                     >
-                      <div class="order-methods">
-                        <span 
-                          v-for="method in priceItem.priceSettings" 
-                          :key="method"
-                          class="method-item"
-                        >
-                          鉁� {{ getPriceSettingText(method) }}
-                        </span>
-                      </div>
+                      {{ priceItem.priceSettings.map((m:any) => getPriceSettingText(m)).join('銆�') }}
                     </td>
                   </tr>
                   <tr>
@@ -96,42 +88,7 @@
                       :colspan="getColspan(priceItem)"
                       class="feature-value"
                     >
-                      <div class="price-info">
-                        <div 
-                          v-if="priceItem.priceSettings.includes('POINTS') && priceItem.pointsAmount > 0"
-                          class="price-item"
-                        >
-                         <div class="price-lable-icon">
-                          <el-icon class="price-icon points"><Coin /></el-icon>
-                          <span class="price-label">绉垎</span>
-                         </div>
-                          <span class="price-value points">{{ formatNumber(priceItem.pointsAmount) }} / {{ getPriceUnitText(priceItem.priceUnit) }}</span>
-                        </div>
-                                                 <div 
-                           v-if="priceItem.priceSettings.includes('CURRENCY') && priceItem.currencyAmount > 0"
-                           class="price-item"
-                         >
-                          <div class="price-lable-icon">
-                           <span class="price-icon currency">楼</span>
-                           <span class="price-label">璐у竵</span>
-                           </div>
-                           <span class="price-value currency">{{ formatNumber(priceItem.currencyAmount) }} / {{ getPriceUnitText(priceItem.priceUnit) }}</span>
-                         </div>
-                        <div 
-                          v-if="priceItem.priceSettings.includes('FREE')"
-                          class="price-item"
-                        >
-                          <span class="price-label">璐圭敤</span>
-                          <span class="price-value free">鍏嶈垂</span>
-                        </div>
-                                                 <div 
-                           v-if="priceItem.priceSettings.includes('AGREEMENT')"
-                           class="price-item"
-                         >
-                           <span class="price-label">鍗忚:</span>
-                           <span class="price-value agreement">姣弡{ getPriceUnitText(priceItem.priceUnit) }}</span>
-                         </div>
-                       </div>
+                      {{ renderPrice(priceItem) }}
                      </td>
                    </tr>
                    <tr>
@@ -305,23 +262,26 @@
           <table class="order-info-table">
             <tbody>
               <tr>
-                <td class="label">璁㈠崟缂栧彿锛�</td>
-                <td class="value">{{ orderStatus.id }}</td>
-                <td class="label">鐢宠鏃堕棿锛�</td>
+                <td class="label">璁㈠崟缂栧彿</td>
+                <td class="value">
+                  {{ orderStatus.id }}
+                  <el-link type="primary" @click="goBuyerCenter" style="margin-left: 8px">鐐瑰嚮鏌ョ湅</el-link>
+                </td>
+                <td class="label">鐢宠鏃堕棿</td>
                 <td class="value">{{ orderStatus.applyTime }}</td>
               </tr>
               <tr>
-                <td class="label">浜у搧鍚嶇О锛�</td>
+                <td class="label">浜у搧鍚嶇О</td>
                 <td class="value">{{ orderStatus.productName }}</td>
-                <td class="label">鎻愪緵鑰咃細</td>
+                <td class="label">鎻愪緵鑰�</td>
                 <td class="value">{{ orderStatus.provider }}</td>
               </tr>
               <tr>
-                <td class="label">璁㈠崟鐘舵�侊細</td>
+                <td class="label">璁㈠崟鐘舵��</td>
                 <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 +297,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>
@@ -348,6 +308,7 @@
 
 <script setup lang="ts">
 import { ref, watch, computed, onMounted } from 'vue'
+import { useRouter } from 'vue-router'
 import { ElMessage } from 'element-plus'
 import { useRoute } from 'vue-router'
 import productPricingApi from '@/api/productPricingApi'
@@ -359,6 +320,7 @@
 import workFlowApi from '@/api/workFlowApi'
 
 const route = useRoute()
+const router = useRouter()
 
 interface PriceItem {
   id: number
@@ -476,6 +438,10 @@
 const viewOrder = () => {
   window.alert('杩欓噷鍙烦杞埌璁㈠崟璇︽儏椤碉紙绀轰緥锛�')
 }
+
+const goBuyerCenter = () => {
+  router.push({ name: 'tradeBuyerCenter', query: { t: String(Date.now()) } })
+}
  
 const selectedCount = computed(() => orderSuites.value.filter(s => s.selected).length)
 const totalByType = computed(() => {
@@ -548,6 +514,7 @@
   try {
     await removeFromCart(String(suite.id))
     orderSuites.value.splice(index, 1)
+    selectedSuiteIds.value.delete(suite.id)
   } catch (e) {
   }
 }
@@ -639,7 +606,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 +763,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 +787,7 @@
     providerId: productHeader.value.createUserId,
     paymentType: paymentType,
     buyerRemarks: '',
+    processdefId: processdefId,
     items: items.map(it => ({
       pricingId: it.id,
       productId: it.productId,
@@ -839,34 +822,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 +903,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 +915,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 +939,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 || []
       // 灏嗚喘鐗╄溅鏁版嵁杞崲涓鸿鍗曞浠舵牸寮�
@@ -1021,7 +1005,9 @@
     PRIVATE_INCREMENT: '绉佹湁澧為噺鍖�',
     PUBLIC_INCREMENT: '鍏湁澧為噺鍖�',
     OTA: 'OTA鏈嶅姟',
-    CLOUD: '浜戞湇鍔�'
+    CLOUD: '浜戞湇鍔�',
+    RESOURCE_PACKAGE: '璧勬簮鍖�',
+    PERSONAL: '涓汉'
   }
   return map[salesForm] || salesForm
 }
@@ -1097,6 +1083,24 @@
   return map[unit] || unit
 }
 
+// 缁熶竴娓叉煋浠锋牸锛氬幓闄も�滅Н鍒�/璐у竵/璐圭敤/鍗忚鈥濈瓑绫诲瀷鍓嶇紑锛屼粎杈撳嚭绾环鏍兼枃鏈�
+const renderPrice = (priceItem: PriceItem) => {
+  const segments: string[] = []
+  if (priceItem.priceSettings.includes('POINTS') && priceItem.pointsAmount > 0) {
+    segments.push(`${formatNumber(priceItem.pointsAmount)} / ${getPriceUnitText(priceItem.priceUnit)}`)
+  }
+  if (priceItem.priceSettings.includes('CURRENCY') && priceItem.currencyAmount > 0) {
+    segments.push(`${formatNumber(priceItem.currencyAmount)} / ${getPriceUnitText(priceItem.priceUnit)}`)
+  }
+  if (priceItem.priceSettings.includes('FREE')) {
+    segments.push('鍏嶈垂')
+  }
+  if (priceItem.priceSettings.includes('AGREEMENT')) {
+    segments.push(`姣�${getPriceUnitText(priceItem.priceUnit)}`)
+  }
+  return segments.join('锛�')
+}
+
 // 鑾峰彇鍒嗙粍鍚庣殑琛ㄥご鏁版嵁
 const getGroupedHeaders = (tabData: PriceItem[]) => {
   const groups: Record<string, { count: number; productSuite: string }> = {}

--
Gitblit v1.8.0