Ver Fonte

feat: 企业超级订阅全国升级禁用补充服务

cuiyalong há 2 meses atrás
pai
commit
ff7a6ed77d

+ 1 - 0
src/views/create-order/components/product-info-submodule/ServiceList.vue

@@ -619,6 +619,7 @@ export default {
       if (names_str.includes('业主分析') && !idArr.includes(5)) {
         idArr.push(5) // 添加基础服务
       }
+      console.log(`serviceList选中服务: `, idArr.sort((a, b) => a - b), nameArr)
       return {
         idArr: [...new Set(idArr)], // 数组去重
         nameArr,

+ 1 - 1
src/views/create-order/components/schema-form/params.js

@@ -193,7 +193,7 @@ export function createOrderParams(payload = {}) {
     emptyPhone: pageForm.noPhoneValue.join('') - 0, // 无手机号
     userPhone: pageForm.accountTel, // 开通服务手机号
     contractMoney: mul(pageTotalMoney.contract, 100), // 合同金额总计(单位,分)
-    order_money: pageTotalMoney.standard > 0 ? mul(pageTotalMoney.standard, 100) : undefined, // 标准售价总计(单位,分)
+    order_money: pageTotalMoney.actualStandard >= 0 ? mul(pageTotalMoney.actualStandard, 100) : undefined, // 标准售价总计(单位,分)
     channelCommission: channelCommission ? mul(channelCommission, 100) : channelCommission - 0, // 佣金(单位,分)
     zeroOrderType: orderMoney0Type ? pageForm.orderMoney0Type : undefined, // 0元订单类型
     // emptyPhone: 0, // 无手机号

+ 26 - 1
src/views/create-order/components/schema-form/schema-form.vue

@@ -569,7 +569,7 @@ export default {
 
             // 个人身份、超级订阅特殊判断。全国则禁用升级
             const personal = this.pageForm.buySubject === 1
-            if (personal && this.productType === productKeyMap.cjdy && currentProductTypeList[0]?.provinceCount < 0) {
+            if (personal && this.utilCheckIsSvipMaxSpec(currentProductTypeList[0])) {
               stMap.canUpgrade = false
               stMap.personalMaxSpec = true
             }
@@ -828,6 +828,27 @@ export default {
         // if (uc.props.options.length === 1) {
         //   this.refreshValue({ [schemaKeyMap.upgradeContent]: [uc.props.options[0].value] })
         // }
+
+        // 选项禁用: 补充权益置灰(超级订阅全国升级)
+        const ent = this.pageForm.buySubject === 2
+        // 1. 判断是否符合禁用条件
+        // (首先需要展示最少2个选项)企业身份、超级订阅特殊判断。购买全国,不能点击增购服务
+        if (uc.props.options.length > 1 && ent && this.utilCheckIsSvipMaxSpec(this.selectedRelatedOrder)) {
+          uc.props.options.forEach(c => {
+            if (c.addBenefits) {
+              c.disabled = true
+            }
+          })
+          const enableValue = uc.props.options.filter(c => !c.disabled)
+          if (enableValue.length > 0) {
+            this.refreshValue({ [schemaKeyMap.upgradeContent]: [enableValue[0].value] })
+          }
+        } else {
+          // 解除禁用
+          uc.props.options.forEach(c => {
+            c.disabled = false
+          })
+        }
       }
     },
     // 账号数量、主账号/子账号数量
@@ -1216,6 +1237,10 @@ export default {
         }
       }
     },
+    // 工具:判断是否超级订阅全国
+    utilCheckIsSvipMaxSpec(relatedOrdersInfo = {}) {
+      return this.productType === productKeyMap.cjdy && relatedOrdersInfo?.provinceCount < 0
+    },
     cjdyChangeSpecificationSchema(hide = false) {
       // 有“补充服务”或为空:仅可选择不低于关联订单的产品规格
       const ma = this.getSchemaItemWithKey(schemaKeyMap.specification)

+ 3 - 0
src/views/create-order/hooks/utils.js

@@ -175,6 +175,7 @@ export function getCardTotalAmount(moneyList) {
   let hasContract = false
   let contract = 0
   let standard = 0
+  let actualStandard = 0 // 所有非负standard之和
   let rate = ''
   moneyList.forEach(item => {
     let hc = item?.contractMoney
@@ -188,6 +189,7 @@ export function getCardTotalAmount(moneyList) {
     }
     if (s > 0) {
       standard = add(standard, s)
+      actualStandard = add(actualStandard, s)
     }
   })
 
@@ -211,6 +213,7 @@ export function getCardTotalAmount(moneyList) {
     hasContract,
     contract,
     standard,
+    actualStandard,
     rate,
     // channelCommission, // 销售费用
   }