Pārlūkot izejas kodu

Merge branch 'dev' of http://39.101.143.165:8090/dong_k/tenant-Platform into dev

@dongkboy 2 mēneši atpakaļ
vecāks
revīzija
d83f15dc09

+ 8 - 8
src/views/insurancePolicy/index.vue

@@ -1247,8 +1247,9 @@
                     @click="handleSubmit(InsurancePolicyRefs, scope.row)">计算保费</el-button>
                   <el-button v-if="scope.row.quoteCode == 200" link type="primary"
                     @click="handleShare(scope.row.quoteResult.ordersNo)">分享</el-button>
-                  <el-button v-if="scope.row.quoteCode == 200" link type="primary" :loading="scope.row.loading"
-                    @click="handleUnderwriting(scope)">核保</el-button>
+                  <el-button
+                    v-if="scope.row.quoteCode == 200 && !(scope.row.quoteResult?.quoteStatus == 4 || scope.row.quoteResult?.order?.orderStatus == 4)"
+                    link type="primary" :loading="scope.row.loading" @click="handleUnderwriting(scope)">核保</el-button>
                   <el-button
                     v-if="scope.row.quoteResult?.quoteStatus == 4 || scope.row.quoteResult?.order?.orderStatus == 4"
                     link type="primary" @click="handlePayment(scope.row.quoteResult.ordersNo)">支付码</el-button>
@@ -1433,7 +1434,7 @@
     <el-dialog :close-on-click-modal="false" title="提交核保" width="1100" v-model="underwritingShow">
       <underwriting v-if="underwritingShow" ref="UnderwritingRefs" :insOrderRightsInfoDto="insOrderRightsInfoDto"
         :availableAmount="availableAmount" :recipientInfo="[owerFormInfo, policyHolderInfo, insuredPersonInfo]"
-        @close="handleUnderwritingClose"></underwriting>
+        @close="handleUnderwritingClose" @initDetail="initDetail"></underwriting>
     </el-dialog>
     <el-dialog :close-on-click-modal="false" title="证件识别" width="800" v-model="imageShow">
       <recognition ref="RecognitionRefs" :option="optionObj.car_type_code" @close="handleImageClose"></recognition>
@@ -1602,6 +1603,8 @@ const inParkingDataFocus = (e: string, data: any) => {
  * 从路由参数获取订单号,请求订单详情并填充表单
  */
 const initDetail = () => {
+  if (!myRoute.query.orderNo) return
+
   // 请求订单详情
   api.insurancePolicyApi.getOrderDetail(myRoute.query.orderNo).then((res: any) => {
     if (res.code == 200) {
@@ -2258,7 +2261,6 @@ const licenseNoDataCancel = () => {
 const licenseNoDataSubmit = () => {
   if (selectRowData.value && 'ratedPassengerCapacity' in selectRowData.value) {
     const carData = selectRowData.value as CarInfo;
-    console.log("🚀 ~ licenseNoDataSubmit ~ carData:", carData)
     insurancePolicyForm.value.seatCount = carData.ratedPassengerCapacity
     insurancePolicyForm.value.brandName = carData.modelName
     insurancePolicyForm.value.carModelNo = carData.modelCode
@@ -3046,7 +3048,6 @@ const handlePayment = (scope: any) => {
 // 优惠测算
 let calculatingShow = ref(false)
 const handleCount = (scope: any) => {
-  console.log("🚀 ~ handleCount ~ scope:", scope)
   calculatingShow.value = true
   discounts.value = scope.row.discounts
 }
@@ -3924,9 +3925,8 @@ onMounted(() => {
   getAreaList()    // 获取地区列表
   initDept()       // 初始化部门数据
   initOption()     // 初始化下拉选项
-  if (myRoute.query.orderNo) {
-    initDetail()   // 如果有订单号,初始化详情
-  }
+  initDetail()   // 如果有订单号,初始化详情
+
 })
 
 </script>

+ 3 - 5
src/views/insurancePolicy/modules/underwriting.vue

@@ -160,7 +160,7 @@ const usedMoney = ref(0)//已使用金额
 const lastMoney = ref(0)//剩余金额
 const ImageTypeSelect = ref()
 const loading = ref(false)//提交loading
-const emit = defineEmits(['close'])
+const emit = defineEmits(['close','initDetail'])
 let images = ref([])
 watch(() => props.insOrderRightsInfoDto, (newVal) => {
   console.log('权益信息', newVal)
@@ -360,15 +360,13 @@ const handleSubmit = (bool) => {
     api.insurancePolicyApi.imagesUpload(data).then((res1: any) => {
       if (res1.code === 200) {
         api.insurancePolicyApi.underwriting(params).then((res: any) => {
-          loading.value = false
           emit('close', res, {
             equitiesData: equitiesData.value.length,
             totalPriceCount: totalPriceCount.value
           })
-
-        })
+        }).finally(()=>(loading.value = false,emit('initDetail')))
       }
-    })
+    }).catch(()=>loading.value = false)
   } else {
     emit('close', false)
   }

+ 1 - 1
src/views/insurancePolicy/order.vue

@@ -123,7 +123,7 @@
           <el-button link type="primary"
             v-if="scope.row.orderStatus != '7' && scope.row.orderStatus != '7' && scope.row.orderStatus != '8'"
             @click="toEdit(scope.row)">编辑</el-button>
-          <el-button link type="primary" v-if="scope.row.orderStatus === '7' || scope.row.orderStatus === '1'"
+          <el-button link type="primary" v-if="scope.row.orderStatus === '1'"
             @click="toEdit(scope.row)">提交核保</el-button>
           <el-button link type="primary" v-if="scope.row.orderStatus === '3'">取消核保</el-button>
           <el-button link type="primary" v-if="scope.row.orderStatus === '7' || scope.row.orderStatus === '4'"

+ 18 - 14
src/views/quoteConfig/agreement/agreementDetails.vue

@@ -257,7 +257,7 @@
         </el-form-item>
       </el-form>
       <template #footer>
-        <el-button size="small" type="primary" @click="costitemCopy">确定</el-button>
+        <el-button type="primary" @click="costitemCopy">确定</el-button>
       </template>
     </el-dialog>
     <el-dialog :close-on-click-modal="false" v-model="copyDialog1" title="复制" width="500">
@@ -270,7 +270,7 @@
         </el-form-item>
       </el-form>
       <template #footer>
-        <el-button size="small" type="primary" @click="submitCopy">确定</el-button>
+        <autoLoadingButton type="primary" :on-click="submitCopy">确定</autoLoadingButton>
       </template>
     </el-dialog>
   </div>
@@ -288,6 +288,7 @@ import { Fileonload, formatFileSize, processFileName } from '@/utils/composables
 import authDrawer from "./components/agreementAuth.vue";
 import ruleFeeDialog from "./components/ruleFeeDialog.vue";
 import ruleFeeDialogEdit from "./components/ruleFeeDialogEdit.vue";
+import autoLoadingButton from "./components/autoLoadingButton.vue";
 import { Delete, Edit, CopyDocument } from '@element-plus/icons-vue'
 interface Agreement {
   [key: string]: string | number; // 协议名称
@@ -707,18 +708,21 @@ const ruleCopy = (id: string) => {
   copyDialog1.value = true
 }
 //复制规则
-const submitCopy = () => {
-  api.agreementApi.rulesCopy(agreementId.value, ruleId.value).then((res: any) => {
-    if (res.code == '200') {
-      agreementRulesList();
-      copyDialog1.value = false
-      ElMessage({
-        type: 'success',
-        message: res.msg,
-        plain: true,
-      })
-    }
-  });
+const submitCopy = async () => {
+  if(!agreementId.value){
+    ElMessage.error('请选择协议')
+    return
+  }
+  const res = await api.agreementApi.rulesCopy(agreementId.value, ruleId.value)
+  if (res.code == '200') {
+    agreementRulesList();
+    copyDialog1.value = false
+    ElMessage({
+      type: 'success',
+      message: '操作成功',
+      plain: true,
+    })
+  }
 }
 //添加费用
 const ruleFeeVisible = ref(false);//规则费用弹窗

+ 66 - 0
src/views/quoteConfig/agreement/components/autoLoadingButton.vue

@@ -0,0 +1,66 @@
+<template>
+  <el-button
+    v-bind="$attrs"
+    :loading="isLoading"
+    :disabled="isLoading || disabled"
+    @click="handleClick"
+  >
+    <slot />
+  </el-button>
+</template>
+
+<script setup>
+
+const props = defineProps({
+  // 允许外部手动控制 loading(可选)
+  loading: {
+    type: Boolean,
+    default: undefined
+  },
+  // 允许外部禁用按钮
+  disabled: {
+    type: Boolean,
+    default: false
+  },
+  // 核心:传入一个返回 Promise 的异步函数
+  onClick: {
+    type: Function,
+    default: null
+  }
+})
+
+const emit = defineEmits(['update:loading', 'success', 'error'])
+
+const internalLoading = ref(false)
+
+// 优先使用外部 loading,否则用内部状态
+const isLoading = ref(false)
+watch(() => props.loading, (val) => {
+  isLoading.value = val
+}, { immediate: true })
+
+watch(internalLoading, (val) => {
+  if (props.loading === undefined) {
+    isLoading.value = val
+  }
+  emit('update:loading', val)
+})
+
+const handleClick = async () => {
+  if (isLoading.value) return // 防重复点击
+
+  // 如果有传入 onClick,才触发异步流程
+  if (typeof props.onClick === 'function') {
+    internalLoading.value = true
+    try {
+      const result = await props.onClick()
+      emit('success', result)
+    } catch (error) {
+      emit('error', error)
+      throw error // 保留异常,方便上层继续处理
+    } finally {
+      internalLoading.value = false
+    }
+  }
+}
+</script>