Prechádzať zdrojové kódy

fix(create-order): 修复产品有效期计算逻辑

- 在 OrderDetailCardProductList 和 SelectOrderDetailCard 组件中添加 totalPeriod 字段
- 修改 calculateValidityPeriod 方法,优先使用 totalPeriod 计算有效期
- 解决了产品有效期显示不正确的问题

Signed-off-by: tangshizhe <48740614+tangshizhe@users.noreply.github.com>
tangshizhe 3 týždňov pred
rodič
commit
a3124f6ec2

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

@@ -568,7 +568,7 @@ export default {
     },
     calculateValidityPeriod(parsedFilter, product) {
       const { buy_cycle, buy_type, give_cycle, give_type, validYear, activity_give_cycle, activity_give_type } = parsedFilter;
-      const { product_type, returned_open } = product;
+      const { product_type, returned_open, totalPeriod } = product;
       const returned_opens = returned_open === 1 ? '(全额回款当日开通)' : '';
       if (product_type === '数据流量包') {
         // 数据流量包默认2年
@@ -663,13 +663,13 @@ export default {
       let giveResultText = giveResult.text ? `赠送${giveResult.text},` : '';
       if(activityGiveResult) {
         giveResultText = giveResult.text ? `销售赠${giveResult.text},` : '';
-        return `付费${buyResult.text},活动赠${activityGiveResult.text},${giveResultText}合计<span class="color_main">${totalText}</span>${returned_opens}`; 
+        return `付费${buyResult.text},活动赠${activityGiveResult.text},${giveResultText}合计<span class="color_main">${totalPeriod || totalText}</span>${returned_opens}`; 
       }
       // 如果是赠送类产品,则只显示赠送时长和合计时长, 不显示付费时长
       if(product.tactics === '2') {
-        return `${giveResultText}合计<span class="color_main">${totalText}</span>${returned_opens}`
+        return `${giveResultText}合计<span class="color_main">${totalPeriod || totalText}</span>${returned_opens}`
       }
-      return `付费${buyResult.text},${giveResultText}合计<span class="color_main">${totalText}</span>${returned_opens}`;
+      return `付费${buyResult.text},${giveResultText}合计<span class="color_main">${totalPeriod || totalText}</span>${returned_opens}`;
     },
     getValidityPeriodHtml(product, item) {
       const label = item.label;

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

@@ -818,7 +818,7 @@ export default {
     },
     calculateValidityPeriod(parsedFilter, product) {
       const { buy_cycle, buy_type, give_cycle, give_type, validYear, activity_give_cycle, activity_give_type } = parsedFilter;
-      const { product_type, returned_open } = product;
+      const { product_type, returned_open, totalPeriod } = product;
       const returned_opens = returned_open === 1 ? '(全额回款当日开通)' : '';
       if (product_type === '数据流量包') {
         // 数据流量包默认2年
@@ -914,13 +914,13 @@ export default {
       let giveResultText = giveResult.text ? `赠送${giveResult.text},` : '';
       if(activityGiveResult) {
         giveResultText = giveResult.text ? `销售赠${giveResult.text},` : '';
-        return `付费${buyResult.text},活动赠${activityGiveResult.text},${giveResultText}合计<span class="color_main">${totalText}</span>${returned_opens}`; 
+        return `付费${buyResult.text},活动赠${activityGiveResult.text},${giveResultText}合计<span class="color_main">${totalPeriod || totalText}</span>${returned_opens}`; 
       }
       // 如果是赠送类产品,则只显示赠送时长和合计时长, 不显示付费时长
       if(product.tactics === '2') {
-        return `${giveResultText}合计<span class="color_main">${totalText}</span>${returned_opens}`
+        return `${giveResultText}合计<span class="color_main">${totalPeriod || totalText}</span>${returned_opens}`
       }
-      return `付费${buyResult.text},${giveResultText}合计<span class="color_main">${totalText}</span>${returned_opens}`;
+      return `付费${buyResult.text},${giveResultText}合计<span class="color_main">${totalPeriod || totalText}</span>${returned_opens}`;
     },
 
     getValidityPeriodHtml(product, item) {