Эх сурвалжийг харах

refactor(create-order): 优化订单详情页面的大会员服务列表展示

- 修改 OrderDetailCardProductList 和 SelectOrderDetailCard 组件中的服务列表展示逻辑
- 增加对自定义产品中大服务名称的处理和展示
- 优化赠送类产品的时间展示逻辑,只显示赠送时长和合计时长

Signed-off-by: tangshizhe <48740614+tangshizhe@users.noreply.github.com>
tangshizhe 1 сар өмнө
parent
commit
9bb8cb654b

+ 12 - 6
src/views/create-order/components/order-detail-submodule/OrderDetailCardProductList.vue

@@ -130,7 +130,7 @@ export default {
         { label: '报告份数', key: 'reportNumber', span: 1, condition: (product) => this.reportType.includes(product.product_type)},
         { label: '剑鱼币个数', key: 'coinCount', span: 1, condition: (product) => product.product_type && product.product_type === '剑鱼币'},
         { label: '购买产品', key: 'buyProductName', span: 1, condition: (product) => product.product_type && product.product_type === '结构化数据'},
-        { label: '服务列表', key: 'bigServiceNames', span: 1, condition: (product) => product.productName && product.productName.includes('自定义') &&  product.product_code === 'dyh001'},
+        { label: '服务列表', key: 'bigServiceNamesPro', span: 1, condition: (product) => product.productName && product.productName.includes('自定义') &&  product.product_code === 'dyh001'},
         { label: '数据条数', key: 'data_count', span: 1, condition: (product) => product.data_count && product.data_count !== '-'},
         { label: '有效周期', key: 'validity_period', span: 1, condition: (product) => product.validity_period && product.validity_period !== '-' },
         { label: '合同金额', key: 'final_price', span: 3},
@@ -242,9 +242,10 @@ export default {
               const parsedFilter = this.parseProductFilter(product);
               const serviceIds = parsedFilter.serviceIds || [];
               const supServiceIdsOrigin = parsedFilter.supServiceIds || [];
+              const bigServiceNames = parsedFilter.bigServiceNames || '';
               // 等待异步方法完成
               const supServiceIds = this.buildSupServiceIds(parsedFilter || []);
-              const bigServiceNames = product.product_type === '大会员' ? await this.buildBigServiceNames(serviceIds, supServiceIdsOrigin) : '';
+              const bigServiceNamesPro = product.product_type === '大会员' ? await this.buildBigServiceNames(serviceIds, supServiceIdsOrigin, bigServiceNames) : '';
               const rate = this.calculateDiscountRate(product);
               const validityPeriod = this.calculateValidityPeriod(
                 parsedFilter,
@@ -318,7 +319,7 @@ export default {
                 mainAccountCount,
                 linkedOrder,
                 supServiceIds,
-                bigServiceNames,
+                bigServiceNamesPro,
                 email,
                 final_price: finalPrice,
                 sale_final_price: finalPrice,
@@ -370,7 +371,7 @@ export default {
       }
       return upgradeContent.length ? upgradeContent.join('、') : '-'
     },
-    buildBigServiceNames(serviceIds, supServiceIds) {
+    buildBigServiceNames(serviceIds, supServiceIds, bigServiceNames) {
       return new Promise((resolve) => {
         if (!serviceIds || serviceIds.length === 0) {
           resolve('');
@@ -380,6 +381,7 @@ export default {
         // 避免修改原始数组,创建新的整型数组
         const numericServiceIds = serviceIds.map(id => parseInt(id));
         let sameValues = [], differentValues = [];
+        const hasBigServiceNames = bigServiceNames ? `、${bigServiceNames}` : ''
         this.$nextTick(() => {
           try {
             
@@ -420,14 +422,14 @@ export default {
               // 如果有补充服务,就拼接,如果没有补充服务,就不拼接,直接返回原已购服务名连接字符串
               const supplement = resSupServiceData ? `【补充服务】:${resSupServiceData}` : ''
               // 最终服务字符串:补充服务名称;原已购服务名称
-              const serviceStr = `${supplement};【原已购服务】:${baseServiceData}`
+              const serviceStr = `${supplement};【原已购服务】:${baseServiceData}${hasBigServiceNames}`
               resolve(serviceStr);
             } else {
               if(numericServiceIds.length === 0) {
                 console.warn('numericServiceIds为空')
               }
               const res = serviceListRef.calcAlreadyBuyServiceNamesArr(numericServiceIds);
-              const serviceData = Array.isArray(res) ? res.join('、') : '';
+              const serviceData = Array.isArray(res) ? res.join('、') + hasBigServiceNames : '';
               resolve(serviceData);
             }
           } catch (error) {
@@ -629,6 +631,10 @@ export default {
         giveResultText = giveResult.text ? `销售赠${giveResult.text},` : '';
         return `付费${buyResult.text},活动赠${activityGiveResult.text},${giveResultText}合计<span class="color_main">${totalText}</span>${returned_opens}`; 
       }
+      // 如果是赠送类产品,则只显示赠送时长和合计时长, 不显示付费时长
+      if(product.tactics === '2') {
+        return `${giveResultText}合计<span class="color_main">${totalText}</span>${returned_opens}`
+      }
       return `付费${buyResult.text},${giveResultText}合计<span class="color_main">${totalText}</span>${returned_opens}`;
     },
     getValidityPeriodHtml(product, item) {

+ 12 - 6
src/views/create-order/components/order-detail-submodule/SelectOrderDetailCard.vue

@@ -227,7 +227,7 @@ export default {
         { label: '付费类型', key: 'service_type', filter: 'orderServiceType', span: 3},
         { label: '升级内容', key: 'supServiceIds', span: 3, condition: (product) => product.service_type === 3 },
         { label: '产品规格', key: 'productName', span: 3},
-        { label: '服务列表', key: 'bigServiceNames', span: 1, condition: (product) => product.productName && product.productName.includes('自定义') &&  product.product_code === 'dyh001'},
+        { label: '服务列表', key: 'bigServiceNamesPro', span: 1, condition: (product) => product.productName && product.productName.includes('自定义') &&  product.product_code === 'dyh001'},
         { label: '数据条数', key: 'data_count', span: 1, condition: (product) => product.data_count && product.data_count !== '-'},
         { label: '有效周期', key: 'validity_period', span: 1},
         { label: '合同金额', key: 'final_price', span: 3},
@@ -410,9 +410,10 @@ export default {
                 const parsedFilter = this.parseProductFilter(product);
                   const serviceIds = parsedFilter.serviceIds || [];
               const supServiceIdsOrigin = parsedFilter.supServiceIds || [];
+              const bigServiceNames = parsedFilter.bigServiceNames || '';
               const supServiceIds = this.buildSupServiceIds(parsedFilter || []);
                   // 等待异步方法完成
-              const bigServiceNames = product.product_type === '大会员' ? await this.buildBigServiceNames(serviceIds, supServiceIdsOrigin) : '';
+              const bigServiceNamesPro = product.product_type === '大会员' ? await this.buildBigServiceNames(serviceIds, supServiceIdsOrigin, bigServiceNames) : '';
                 const rate = this.calculateDiscountRate(product);
                 const validityPeriod = this.calculateValidityPeriod(
                 parsedFilter,
@@ -477,7 +478,7 @@ export default {
                   mainAccountCount,
                   linkedOrder,
                   supServiceIds,
-                    bigServiceNames,
+                    bigServiceNamesPro,
                   final_price: finalPrice,
                 sale_final_price: finalPrice,
                 original_price: originalPrice,
@@ -547,7 +548,7 @@ export default {
       }
       return upgradeContent.length ? upgradeContent.join('、') : '-'
     },
-    buildBigServiceNames(serviceIds, supServiceIds) {
+    buildBigServiceNames(serviceIds, supServiceIds, bigServiceNames) {
       return new Promise((resolve) => {
         if (!serviceIds || serviceIds.length === 0) {
           resolve('');
@@ -557,6 +558,7 @@ export default {
         // 避免修改原始数组,创建新的整型数组
         const numericServiceIds = serviceIds.map(id => parseInt(id));
         let sameValues = [], differentValues = [];
+        const hasBigServiceNames = bigServiceNames ? `、${bigServiceNames}` : ''
         this.$nextTick(() => {
           try {
             const serviceListRef = this.$refs.serviceListRef;
@@ -590,11 +592,11 @@ export default {
               // 如果有补充服务,就拼接,如果没有补充服务,就不拼接,直接返回原已购服务名连接字符串
               const supplement = resSupServiceData ? `【补充服务】:${resSupServiceData}` : ''
               // 最终服务字符串:补充服务名称;原已购服务名称
-              const serviceStr = `${supplement};【原已购服务】:${baseServiceData}`
+              const serviceStr = `${supplement};【原已购服务】:${baseServiceData}${hasBigServiceNames}`
               resolve(serviceStr);
             } else {
             const res = serviceListRef.calcAlreadyBuyServiceNamesArr(numericServiceIds);
-            const serviceData = Array.isArray(res) ? res.join('、') : '';
+            const serviceData = Array.isArray(res) ? res.join('、') + hasBigServiceNames : '';
             resolve(serviceData);
             }
           } catch (error) {
@@ -805,6 +807,10 @@ export default {
         giveResultText = giveResult.text ? `销售赠${giveResult.text},` : '';
         return `付费${buyResult.text},活动赠${activityGiveResult.text},${giveResultText}合计<span class="color_main">${totalText}</span>${returned_opens}`; 
       }
+      // 如果是赠送类产品,则只显示赠送时长和合计时长, 不显示付费时长
+      if(product.tactics === '2') {
+        return `${giveResultText}合计<span class="color_main">${totalText}</span>${returned_opens}`
+      }
       return `付费${buyResult.text},${giveResultText}合计<span class="color_main">${totalText}</span>${returned_opens}`;
     },