Просмотр исходного кода

权益套餐、单品选择交互优化

@dongkboy 2 недель назад
Родитель
Сommit
0284e81476

+ 37 - 11
src/views/insurancePolicy/modules/Equities.vue

@@ -211,7 +211,7 @@
 <script lang='ts' setup>
 import { ref, reactive, computed, onBeforeMount, watch } from 'vue'
 import api from '@/api'
-import { ElMessage, DrawerProps } from 'element-plus'
+import { ElMessage, DrawerProps, ElMessageBox } from 'element-plus'
 import Decimal from 'decimal.js'
 import EquitiesItem from './EquitiesItem.vue' // 权益单品模块
 import EquitiesPage from './EquitiesPage.vue' // 权益套餐模块
@@ -417,21 +417,47 @@ const provinceChange = (value: any) => {
 }
 const PackageBenefits = () => {
   if (insOrderRightsList.value.length > 0) {
-    return ElMessage({
-      type: 'warning',
-      message: '套餐和单品只能选择其中1种',
-      plain: true,
-    })
+    // 已选单品权益,提醒二选一,确认后清空单品再选套餐
+    ElMessageBox.confirm(
+      '您已选择单品权益,套餐和单品只能二选一。是否清空已选单品权益,继续选择套餐?',
+      '提示',
+      {
+        confirmButtonText: '清空并选择套餐',
+        cancelButtonText: '取消',
+        type: 'warning',
+        center: true,
+      }
+    )
+      .then(() => {
+        insOrderRightsList.value = [] // 清空已选单品权益
+        equitiesPageShow.value = true
+      })
+      .catch(() => {
+      })
+    return
   }
   equitiesPageShow.value = true;
 }
 const RightsBenefits = () => {
   if (insOrderRightsPackageList.value.length > 0) {
-    return ElMessage({
-      type: 'warning',
-      message: '套餐和单品只能选择其中1种',
-      plain: true,
-    })
+    // 已选套餐权益,提醒二选一,确认后清空套餐再选单品
+    ElMessageBox.confirm(
+      '您已选择套餐权益,套餐和单品只能二选一。是否清空已选套餐权益,继续选择单品?',
+      '提示',
+      {
+        confirmButtonText: '清空并选择单品',
+        cancelButtonText: '取消',
+        type: 'warning',
+        center: true,
+      }
+    )
+      .then(() => {
+        insOrderRightsPackageList.value = [] // 清空已选套餐权益
+        equitiesItemShow.value = true
+      })
+      .catch(() => {
+      })
+    return
   }
   equitiesItemShow.value = true;
 }

+ 1 - 1
src/views/insurancePolicy/modules/EquitiesPage.vue

@@ -232,7 +232,7 @@ watch(() => props.recipientInfo, (newVal) => {
 onBeforeMount(async () => {
   await queryTreeQuery();
   await getBenefitPackageList();
-  provinceoptions.value = ['110000', '110100', '110101']
+  provinceoptions.value = []
 
 });
 const queryInfo = ref({