Explorar o código

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

caiyuqin hai 11 meses
pai
achega
9816269508

+ 3 - 9
src/layouts/components/DrivingType/index.vue

@@ -152,8 +152,7 @@ const handleDel = (item, index) => {
 
 // 编辑
 let editIndex = ref(0)
-// isCode为新增加参数,为的是不破坏原有逻辑
-const initEditData = (data, index, id, isCode = false) => {
+const initEditData = (data, index, id) => {
   console.log('驾意险回显', data)
   editIndex.value = index
   // JYXList.value.forEach(item => {
@@ -180,13 +179,8 @@ const initEditData = (data, index, id, isCode = false) => {
         //   return obj || a
         // })
         // selectedList.value = JYXList.value.filter(a => a.checked)
-        if(!isCode) {
-          selectedList.value = JSON.parse(JSON.stringify(data))
-          selectedKeys.value = selectedList.value.map(a => a.drivingIntentionId)
-        } else {
-          selectedList.value = res.data.filter((item: any) => data.indexOf(item.productCode) !== -1).map((item: any) => item);
-          selectedKeys.value = res.data.filter((item: any) => data.indexOf(item.productCode) !== -1).map((item: any) => item.id);
-        }
+        selectedList.value = JSON.parse(JSON.stringify(data))
+        selectedKeys.value = selectedList.value.map(a => a.drivingIntentionId)
       }
     } else {
       ElMessage({

+ 93 - 8
src/views/additionalOrder/order/index.vue

@@ -85,7 +85,7 @@
             <template #default="scope">
               <el-button link type="primary">审核</el-button>
               <el-button link type="primary" @click="handleEdit(scope.row)">编辑</el-button>
-              <el-button link type="primary" @click="handleDel(scope.row)">删除</el-button>
+              <el-button link type="danger" @click="handleDel(scope.row)">删除</el-button>
             </template>
           </el-table-column>
         </el-table>
@@ -154,7 +154,14 @@
                 />
               </el-form-item>
             </el-col>
-            <el-col :span="24" style="display: flex; justify-content: flex-end">
+            <el-col :span="8">
+              <el-form-item label="批改状态">
+                <el-select v-model="form.adjustStatus" placeholder="请选择">
+                  <el-option v-for="item in dictData.ADJUST_STATUSDATA" :key="item.value" :value="item.value" :label="item.label"></el-option>
+                </el-select>
+              </el-form-item>
+            </el-col>
+            <el-col :span="16" style="display: flex; justify-content: flex-end">
               <el-button type="primary" @click="search">查询</el-button>
               <el-button plain type="primary" @click="reset">重置</el-button>
             </el-col>
@@ -178,14 +185,47 @@
           <el-table-column label="车船税" prop="taxPremium" width="120"></el-table-column>
           <el-table-column label="商业险保费" prop="syPremium" width="120"></el-table-column>
           <el-table-column label="驾意险保费" prop="jyPremium" width="120"></el-table-column>
-          <el-table-column label="保费总额" prop="sumPremium" width="120"></el-table-column>
+          <el-table-column label="保费总额" prop="sumPremium" width="120">
+            <template #default="scope">
+              <el-tooltip
+                effect="dark"
+                content="红色保费是订单批改后的保费"
+                placement="top"
+                :disabled="!scope.row.adjustPremium"
+              >
+                <span :style="{
+                  color: !scope.row.adjustPremium ? 'inherit' : '#F56C6C'
+                }">{{ scope.row.adjustPremium || scope.row.sumPremium }}</span>
+              </el-tooltip>
+            </template>
+          </el-table-column>
+          <el-table-column label="批改状态" prop="status" width="200">
+            <template #default="scope">
+              <el-link type="primary" v-if="scope.row.adjustStatus" @click="openDetail(scope.row)">{{ getStateText(dictData.ADJUST_STATUSDATA, scope.row.adjustStatus) }}</el-link>
+              <span v-else>{{ getStateText(dictData.ADJUST_STATUSDATA, scope.row.adjustStatus) }}</span>
+            </template>
+          </el-table-column>
           <el-table-column label="录单时间" prop="createTime" width="150"></el-table-column>
           <el-table-column label="录单人" prop="createBy" width="100"></el-table-column>
           <el-table-column label="操作" fixed="right" width="200">
             <template #default="scope">
               <el-button link type="primary">审核</el-button>
               <el-button link type="primary" @click="handleEdit(scope.row)">编辑</el-button>
-              <el-button link type="primary" @click="handleDel(scope.row)">删除</el-button>
+              <el-button link type="danger" @click="handleDel(scope.row)">删除</el-button>
+              <el-dropdown trigger="click" class="ml-[12px] align-middle" v-if="scope.row.orderStatus === '5'">
+                <el-button link type="primary">
+                  订单批改
+                  <el-icon class="el-icon--right">
+                    <arrow-down />
+                  </el-icon>
+                </el-button>
+                <template #dropdown>
+                  <el-dropdown-menu>
+                    <el-dropdown-item @click="onClick(1, scope.row)">险种批改</el-dropdown-item>
+                    <el-dropdown-item @click="onClick(0, scope.row)">整单退保</el-dropdown-item>
+                  </el-dropdown-menu>
+                </template>
+              </el-dropdown>
             </template>
           </el-table-column>
         </el-table>
@@ -302,15 +342,24 @@
         </div>
       </el-tab-pane>
     </el-tabs>
+    <!-- 批改 -->
+    <DialogInsuranceEdit v-model="isEditVisible" :data="formData" />
+    <DialogInsuranceCancel v-model="isCancelVisible" :data="formData" />
   </div>
 </template>
 
 <script setup lang="ts">
-import { useRouter } from 'vue-router'
-import api from '@/api'
+import api from '@/api';
+import DialogInsuranceEdit from '@/views/insurancePolicy/modules/DialogInsuranceEdit.vue';
+import DialogInsuranceCancel from '@/views/insurancePolicy/modules/DialogInsuranceCancel.vue';
+import { useRouter } from 'vue-router';
+import { dictData } from '@/views/localDict/index';
 import { ElMessage, ElMessageBox } from "element-plus";
 
 const myRouter = useRouter()
+const formData = ref({})
+const isEditVisible = ref(false)
+const isCancelVisible = ref(false)
 
 let activeName = ref('first')
 let type = ref('first')
@@ -332,7 +381,7 @@ const handleClick = (e) => {
   }
 }
 
-let form = ref({})
+let form = ref<any>({})
 const tableProps = ref({
   value: "id",
   label: "name",
@@ -482,13 +531,49 @@ const initCompany = () => {
     })
 }
 
+// 订单批改
+const onClick = (type: any, row: any) => {
+  api.insurancePolicyApi.adjustAdd({
+    type: type,
+    orderNo: row.orderNo,
+  }).then((res: any) => {
+    if(res.code == 200) {
+      formData.value = {
+        ...row,
+        adjustId: res.data.id,
+        tableList: type === 1 ? res.data.changeInfoVosList : res.data.infoVosList
+      };
+      if (type === 1) {
+        isEditVisible.value = true;
+      }
+      if (type === 0) {
+        isCancelVisible.value = true;
+      }
+    } else {
+      ElMessage({
+        message: res.msg,
+        type: 'warning'
+      })
+    }
+  });
+}
+
+const getStateText = (d: any, v: any) => {
+	let label = d.find((item: any) => item.value == v)?.label;
+	return label || '--';
+};
+
+// 批改记录
+const openDetail = (e: any) => {
+  window.open(`/#/insurancePolicy/record?orderNo=${e.orderNo}`, '_blank');
+};
+
 onMounted(() => {
     initData(0);
     initData(1);
     initData(2);
     initCompany();
 })
-
 </script>
 
 <style scoped lang="scss">

+ 0 - 0
src/views/insurancePolicy/DialogInsuranceCancel.vue → src/views/insurancePolicy/modules/DialogInsuranceCancel.vue


+ 148 - 44
src/views/insurancePolicy/DialogInsuranceEdit.vue → src/views/insurancePolicy/modules/DialogInsuranceEdit.vue

@@ -25,7 +25,7 @@
 									:style="{
 										'--el-select-disabled-color': row.type !== 1 ? '#a8abb2' : '#F56C6C' 
 									}">
-									<el-option :label="row.amount" :value="row.amount" />
+									<el-option :label="getValAlias(row.kindCode, row.amount)" :value="row.amount" />
 								</el-select>
 							</template>
 						</el-table-column>
@@ -77,7 +77,7 @@
 						<el-table-column prop="kindName" label="产品名称" width="250" />
 						<el-table-column prop="amount" label="份数" width="150">
 							<template #default="{ row }">
-								<el-input-number :disabled="row.type !== 3" 
+								<el-input-number :disabled="true" 
 									class="w-full" controls-position="right"
 									v-model="row.amount" :min="1">
 									<template #suffix>
@@ -146,7 +146,7 @@
 
 			<template v-if="formData.formtype === 1 && formData.kindType !== 2">
 				<el-form-item label="保额" prop="afterAmount">
-					<el-select v-model="formData.afterAmount" placeholder="请选择保额" class="w-full">
+					<el-select v-model="formData.afterAmount" placeholder="请选择保额" class="w-full" @change="formData.tmoney = ''">
 						<el-option 
 							v-for="item in insuranceData" :key="item.value" 
 							:label="item.label" :value="item.value" 
@@ -202,17 +202,42 @@
 		</el-form>
 		<template #footer>
 			<el-button @click="isMainVisible = false">取 消</el-button>
-			<el-button type="primary" @click="handleAddSubmit($event, 'main')">确 定</el-button>
+			<el-button type="primary" @click="handleAddSubmit('main')">确 定</el-button>
 		</template>
 	</el-dialog>
 	<!-- 选择驾意险 -->
     <el-dialog
-		width="700"
+		width="500"
 		title="选择驾意险"
 		append-to-body
 		v-model="isDrivingVisible"
 	>
-		<Driving ref="drivingTypeRef" @close="handleAddSubmit($event, 'driver')" />
+		<el-form ref="formRef" :model="formData" :rules="rules" label-width="120px" label-position="top">
+			<el-form-item label="驾意险产品" prop="kindCode">
+				<el-select v-model="formData.kindCode" placeholder="请选择"
+					@change="handleDriverChange">
+					<el-option v-for="(item, i) in driverAllData" :key="i" 
+						:value="item.productCode" :label="item.productName"
+						:disabled="item.disabled"
+					></el-option>
+				</el-select>
+			</el-form-item>
+			<el-form-item label="批改类型" prop="formtype">
+				<el-select v-model="formData.formtype" disabled placeholder="请选择">
+					<el-option :value="3" label="批增"></el-option>
+				</el-select>
+			</el-form-item>
+			<el-form-item label="份数" prop="quantity">
+				<el-input v-model="formData.quantity" type="number" placeholder="请输入份数" />
+			</el-form-item>
+			<el-form-item label="补缴保费(元)" prop="tmoney">
+				<el-input v-model="formData.tmoney" type="number" placeholder="请输入金额" />
+			</el-form-item>
+		</el-form>
+		<template #footer>
+			<el-button @click="isDrivingVisible = false">取 消</el-button>
+			<el-button type="primary" @click="handleAddSubmit('driver')">确 定</el-button>
+		</template>
 	</el-dialog>
 </template>
 
@@ -220,7 +245,6 @@
 import api from '@/api';
 import { ElMessage } from 'element-plus';
 import type { FormInstance, FormRules } from 'element-plus';
-import Driving from '@/layouts/components/DrivingType/index.vue';
 
 // 组件属性与事件
 const props = defineProps({
@@ -243,6 +267,7 @@ const emits = defineEmits(['complete']);
 const isSubmit = ref(false);
 const tableData = ref<any>([]);
 const insuranceData = ref<any>([]);
+const driverAllData = ref<any>([]);
 const insuranceAllData = ref<any>([]);
 const mainInsuranceProducts = ref<any>([]);
 const driverAccidentProducts = ref<any>([]);
@@ -256,16 +281,23 @@ watch(() => props.data.tableList, (val) => {
 		// 对筛选后的元素进行处理,返回新对象
 		return {
 			...item,
+			// 批增数据被返回时会带着数据,所以清空
+			type: '',
+			// 投保数据被返回时是null,所以修改
 			amount: !item.amount ? '投保' : item.amount,
 			// state: 0 退保 
 			state: item.kindType === 0 || (item.kindCode === 'A' || item.kindCode === 'SY_WBDWGZ') ? 0 : 1
 		}
 	});
-	const b = val.filter((item: any) => item.kindType === 2);
+	const b = val.filter((item: any) => item.kindType === 2).map((item: any) => {
+		return {
+			...item,
+			type: '',
+		}
+	});
 	mainInsuranceProducts.value = [...a];
 	driverAccidentProducts.value = [...b];
 	tableData.value = [...a, ...b];
-	console.log(tableData.value)
 }, {
 	immediate: false,
 });
@@ -313,6 +345,16 @@ const rules = reactive<FormRules>({
 			pattern: /^([1-9]\d?|99)$/, 
 			message: '请输入1-99之间的整数',
 			trigger: ['blur', 'change']
+		},
+		{ 
+            validator(rule, value, callback) {
+				if (formData.value.key === 'tu' && value > formData.value.amount) {
+					callback(new Error(`数量不能超过${formData.value.amount}份`))
+				} else {
+					callback()
+				}
+            },
+            trigger: ['blur', 'change']
 		}
 	],
 	premium: [
@@ -328,7 +370,7 @@ const rules = reactive<FormRules>({
 					callback(new Error('请输入0-99999.99之间的数字'));
 				} else {
 					// 检查小数位数是否超过2位
-					const decimalPart = value.toString().split('.')[1];
+					const decimalPart = value && value.toString().split('.')[1];
 					if (decimalPart && decimalPart.length > 2) {
 						callback(new Error('最多支持两位小数'));
 					} else {
@@ -352,11 +394,15 @@ const rules = reactive<FormRules>({
 					callback(new Error('请输入0-99999.99之间的数字'));
 				} else {
 					// 检查小数位数是否超过2位
-					const decimalPart = value.toString().split('.')[1];
+					const decimalPart = value && value.toString().split('.')[1];
 					if (decimalPart && decimalPart.length > 2) {
 						callback(new Error('最多支持两位小数'));
 					} else {
-						callback();
+						if (formData.value.key === 'tu' && value > formData.value.premium) {
+							callback(new Error(`金额不能超过¥${formData.value.premium}`))
+						} else {
+							callback()
+						}
 					}
 				}
 			},
@@ -375,6 +421,7 @@ const getItemShow = (data: any, key: string) => {
 	if (key === 'bu') {
 		flag = data.formtype === 1 && data.amount < data[feild];
 	}
+	formData.value.key = data.formtype === 2 || (data.formtype === 1 && (data[feild] && data.amount > data[feild])) ? 'tu' : '';
 	return flag;
 };
 
@@ -391,12 +438,34 @@ const clearData = () => {
 	mainInsuranceProducts.value = [];
 	driverAccidentProducts.value = [];
 };
+const resetForm = () => {
+	// 重置数据
+	formData.value = {};
+	formRef.value && formRef.value.resetFields();
+};
+// 获取计算值
+const handleCompute = (a: any, b: any, operator: '+' | '-' = '-') => {
+  // 将输入转为数字
+  const numA = Number(a) || 0;
+  const numB = Number(b) || 0;
+
+  let val;
+  if (operator === '+') {
+    val = ((numA * 100) + (numB * 100)) / 100;
+  } else {
+    val = ((numA * 100) - (numB * 100)) / 100;
+  }
+
+  return val || 0;
+};
 
 // 批增操作
 const isMainVisible = ref(false);
 const isDrivingVisible = ref(false);
-const drivingTypeRef: any = ref(null);
-const handleAddInsurance = (type: 'main' | 'driver', item?: any) => {
+const handleDriverChange = (val: any) => {
+	formData.value.kindName = driverAllData.value.find((opt: any) => opt.productCode === val).productName;
+};
+const handleAddInsurance = (type: 'main' | 'driver') => {
 	if (type === 'main') {
 		api.projectApi.getBusinessInsurance().then((res: any) => {
 			if(res.code == 200) {
@@ -413,15 +482,24 @@ const handleAddInsurance = (type: 'main' | 'driver', item?: any) => {
 		isMainVisible.value = true;
 	}
 	if (type === 'driver') {
-		isDrivingVisible.value = true;
-		nextTick(()=>{
-			let arr = driverAccidentProducts.value.map((item: any) => item.kindCode);
-			// 参数:当前值, 索引, props.data.companyId
-			drivingTypeRef.value.initEditData(arr, 0, '1738811735599347566', true);
+		// props.data.companyId
+		let id = '1738811735599347566';
+		api.projectApi.jyxList({
+			company: id
+		}).then((res: any) => {
+			if(res.code == 200) {
+				let arr = driverAccidentProducts.value.map((item: any) => item.kindCode);
+				driverAllData.value = res.data.map((item: any) => ({
+					...item,
+					disabled: arr.indexOf(item.productCode) !== -1
+				}));
+			}
 		});
+		formData.value.formtype = 3;
+		isDrivingVisible.value = true;
 	}
 };
-const handleAddSubmit = async (e: any, type: 'main' | 'driver') => {
+const handleAddSubmit = async (type: 'main' | 'driver') => {
 	if (type === 'main') {
 		if (!formRef.value) return
 		await formRef.value.validate((valid) => {
@@ -440,33 +518,43 @@ const handleAddSubmit = async (e: any, type: 'main' | 'driver') => {
 					type: 3,
 				});
 				isMainVisible.value = false;
+				// 重置数据
+				resetForm();
 			}
 		});
 	}
 	
 	if (type === 'driver') {
-		console.log('add', e);
-		const data = e.list;
-		if (data.length > 0) {
-			let arr = driverAccidentProducts.value.map((item: any) => item.kindCode);
-			let newData = data.filter((item: any) => arr.indexOf(item.productCode) === -1);
-			newData.map((item: any) => {
+		if (!formRef.value) return
+		await formRef.value.validate((valid) => {
+			if (valid) {
+				// push数据
 				driverAccidentProducts.value.push({
-					id: item.id, 
-					kindCode: item.productCode,
-					kindName: item.productName,
+					id: Date.now(), 
+					kindCode: formData.value.kindCode,
+					kindName: formData.value.kindName,
 					// 险种类型 0.交强 1.商业 2.非车
 					kindType: 2,
-					amount: 1,
-					premium: item.premium - 0,
+					amount: formData.value.quantity - 0,
+					premium: formData.value.tmoney,
 					type: 3,
 				});
-			});
-		}
-		isDrivingVisible.value = false;
+				isDrivingVisible.value = false;
+				// 重置数据
+				resetForm();
+			}
+		});
 	}
 };
 
+// 换取对应保额的别名
+const getValAlias = (code: any, val: any) => {
+    let data = insuranceAllData.value;
+    // 特殊处理,null转为投保的值
+    if (val === null) val = '1';
+    let objs = data.find((item: any) => item.kindCode === code)?.options.find((item: any) => item.value == val);
+    return objs ? objs.label : '';
+};
 // 获取state文本
 const getStateText = (field: string, item?: any) => {
 	let text = '--';
@@ -484,6 +572,8 @@ const getStateText = (field: string, item?: any) => {
 };
 // 批改操作
 const openFormDialog = (type: 'main' | 'driver', item?: any) => {
+	// 重置数据
+	resetForm();
 	form.type = type;
 	if (item) {
 		form.isEditing = true;
@@ -491,11 +581,11 @@ const openFormDialog = (type: 'main' | 'driver', item?: any) => {
 		form.title = type === 'main' ? '批改险种' : '批改驾意险';
 		formData.value = { 
 			...item,
+			afterAmount: '',
 		}; 
 		if (item.kindType === 2) {
 			formData.value.quantity = item.amount;
 		}
-		console.log(item, formData.value)
 	}
 	isFormDialogVisible.value = true;
 };
@@ -503,7 +593,6 @@ const handleChange = (e: any) => {
 	// 重置数据
 	formRef.value && formRef.value.resetFields();
 	const selectedItem = mainInsuranceProducts.value.find((option: any) => option.kindCode === e);
-	console.log(e, selectedItem)
 	formData.value = {
 		...formData.value,
 		...selectedItem,
@@ -517,6 +606,10 @@ const handleChange = (e: any) => {
 	}
 };
 const handleTypeChange = (e: any) => {
+	// 清空金额
+	formData.value.tmoney = '';
+	formRef.value && formRef.value.clearValidate();
+	// 获取保额数据
 	if (e === 1 && formData.value.kindType !== 2) {
 		getInsuranceData(formData.value)
 	}
@@ -536,7 +629,6 @@ const handleFormSubmit = async () => {
 	if (!formRef.value) return
 	await formRef.value.validate((valid, fields) => {
 		if (valid) {
-			console.log('submit!')
 			const data = formData.value;
 			if (form.isEditing) {
 				// 更新逻辑
@@ -549,12 +641,11 @@ const handleFormSubmit = async () => {
 						type: data.formtype
 					};
 				}
-				console.log(targetArray[itemIndex])
 			}
 			isFormDialogVisible.value = false;
 			ElMessage.success(form.isEditing ? '修改成功' : '新增成功');
 			// 重置数据
-			formRef.value && formRef.value.resetFields();
+			resetForm();
 		} else {
 			console.log('error submit!', fields)
 		}
@@ -600,19 +691,20 @@ const handleSubmit = () => {
 		// 三种批改方式的字段再计算
 		if (item.type === 2 || (item.type === 1 && (item[feild] && item.amount > item[feild]))) {
 			adjustType = 1;
-			afterPremium = item.premium - item.tmoney;
+			afterPremium = handleCompute(item.premium, item.tmoney, '-');
 		} else if (item.amount < item[feild] && item.type === 1) {
 			adjustType = 0;
-			afterPremium = item.premium + (item.tmoney - 0);
+			afterPremium = handleCompute(item.premium, item.tmoney, '+');
 		}
 		if (item.type === 3) {
 			adjustType = 0;
 			curItem.afterAmount = item.amount;
-			afterPremium = item.premium - 0;
-			curItem.tmoney = item.kindType === 2 ? item.amount * item.premium : item.premium;
+			curItem.tmoney = afterPremium = item.premium - 0;
+			// 置为0,是因为table展示是这俩字段
 			curItem.amount = 0;
 			curItem.premium = 0;
 		}
+		// 非批增且为驾意险,因为驾意险使用字段不一样
 		if (item.type !== 3 && item.kindType === 2) {
 			curItem.afterAmount = item.quantity;
 		}
@@ -627,7 +719,7 @@ const handleSubmit = () => {
 			// 保费
 			premium: curItem.premium,
 			// 批改类型 0.未批改 1.保额批改 2.退保 3.批增
-			type: curItem.type,
+			type: curItem.type || 0,
 			// 调整类型 0.补缴 1.退款
 			adjustType: adjustType,
 			// 调整金额
@@ -657,6 +749,18 @@ const handleSubmit = () => {
 	});
 };
 
+onBeforeMount(() => {
+	api.projectApi.getBusinessInsurance().then((res: any) => {
+		if(res.code == 200) {
+			insuranceAllData.value = res.data.map((item: any) => ({
+				...item,
+				label: item.kindName,
+				value: item.kindCode,
+			}));
+		}
+	});
+});
+
 onUnmounted(() => {
 	if (isDialogVisible.value) {
 		console.log('处理页面刷新时,单子没关闭')

+ 5 - 9
src/views/insurancePolicy/order.vue

@@ -65,7 +65,7 @@
           >
             <span :style="{
               color: !scope.row.adjustPremium ? 'inherit' : '#F56C6C'
-            }">{{ scope.row.sumPremium }}</span>
+            }">{{ scope.row.adjustPremium || scope.row.sumPremium }}</span>
           </el-tooltip>
         </template>
       </el-table-column>
@@ -104,7 +104,7 @@
           <el-button link type="primary" v-if="scope.row.orderStatus === '5'">查看电子保单</el-button>
           <el-button link type="primary" v-if="scope.row.orderStatus === '4'" @click="payCode(scope)">支付码</el-button>
           <el-button link type="danger" v-if="scope.row.orderStatus === '6' || scope.row.orderStatus === '8'">删除订单</el-button>
-          <el-dropdown trigger="click" class="dropdownBtn" v-if="scope.row.orderStatus === '5'">
+          <el-dropdown trigger="click" class="ml-[12px] align-middle" v-if="scope.row.orderStatus === '5'">
             <el-button link type="primary">
               订单批改
               <el-icon class="el-icon--right">
@@ -153,8 +153,8 @@
 
 <script setup lang="ts">
 import api from '@/api';
-import DialogInsuranceEdit from './DialogInsuranceEdit.vue';
-import DialogInsuranceCancel from './DialogInsuranceCancel.vue';
+import DialogInsuranceEdit from './modules/DialogInsuranceEdit.vue';
+import DialogInsuranceCancel from './modules/DialogInsuranceCancel.vue';
 import { dictData } from '@/views/localDict/index';
 import { ElMessage } from "element-plus";
 import { useRouter } from 'vue-router';
@@ -166,7 +166,7 @@ const isEditVisible = ref(false)
 const isCancelVisible = ref(false)
 
 let initialForm = {
-  orderNo: '1966320579920617472',
+  orderNo: '',
   licenseNo: '',
   range: [],
   adjustStatus: ''
@@ -334,10 +334,6 @@ const openDetail = (e: any) => {
     height: 140px;
     margin: 10px auto;
   }
-  .dropdownBtn {
-    margin-left: 12px;
-    vertical-align: middle; 
-  }
 }
 :deep(.el-dialog__body) {
 	height: 500px;

+ 61 - 23
src/views/insurancePolicy/orderDetail.vue

@@ -251,6 +251,20 @@
                         >
                             <el-table-column label="险种" prop="kindName" align="center"></el-table-column>
                             <el-table-column label="保额" align="center">
+                                <template #default="scope">
+                                    <el-tooltip
+                                        effect="dark"
+                                        content="红色保额是订单批改后的保额"
+                                        placement="top"
+                                        :disabled="!scope.row.afterAmount"
+                                    >
+                                        <span :style="{
+                                            color: !scope.row.type || !scope.row.afterAmount ? 'inherit' : '#F56C6C'
+                                        }">{{ getValAlias(scope.row.kindCode, scope.row.amount) }}</span>
+                                    </el-tooltip>
+                                </template>
+                            </el-table-column>
+                            <el-table-column label="保费" prop="unitAmount" align="center">
                                 <template #default="scope">
                                     <el-tooltip
                                         effect="dark"
@@ -259,15 +273,15 @@
                                         :disabled="!scope.row.afterPremium"
                                     >
                                         <span :style="{
-                                            color: !scope.row.afterPremium ? 'inherit' : '#F56C6C'
-                                        }">{{ scope.row.amount }}</span>
+                                            color: !scope.row.type || !scope.row.afterPremium ? 'inherit' : '#F56C6C'
+                                        }">{{ scope.row.unitAmount }}</span>
                                     </el-tooltip>
                                 </template>
                             </el-table-column>
-                            <el-table-column label="保费" prop="unitAmount" align="center"></el-table-column>
                             <el-table-column label="状态" prop="type" align="center" v-if="detailData?.insOrderAdjustVo">
                                 <template #default="scope">
-                                    <el-link type="primary" @click="openDetail">{{ getStateText('type', scope.row) }}</el-link>
+                                    <span v-if="!scope.row.type">--</span>
+                                    <el-link type="primary" v-else @click="openDetail">{{ getStateText('type', scope.row) }}</el-link>
                                 </template>
                             </el-table-column>
                         </el-table>
@@ -279,8 +293,8 @@
                             height="300"
                         >
                             <el-table-column label="产品名称" prop="productName" align="center">
-                                <template #default="props">
-                                    <el-button link type="primary" @click="getJYXDetail(props.row)">{{ props.row.productName }}</el-button>
+                                <template #default="scope">
+                                    <el-button link type="primary" v-if="scope.row.drivingIntentionId" @click="getJYXDetail(scope.row)">{{ scope.row.productName }}</el-button>
                                 </template>
                             </el-table-column>
                             <el-table-column label="数量" align="center">
@@ -291,7 +305,8 @@
                             <el-table-column label="保费" prop="premium" align="center"></el-table-column>
                             <el-table-column label="状态" prop="type" align="center" v-if="detailData?.insOrderAdjustVo">
                                 <template #default="scope">
-                                    <el-link type="primary" @click="openDetail">{{ getStateText('type', scope.row) }}</el-link>
+                                    <span v-if="!scope.row.type">--</span>
+                                    <el-link type="primary" v-else @click="openDetail">{{ getStateText('type', scope.row) }}</el-link>
                                 </template>
                             </el-table-column>
                         </el-table>
@@ -952,7 +967,7 @@
             <el-button type="primary" @click="handleQuote" v-if="detailData?.order?.orderStatus === '6'">计算保费</el-button>
             <el-button type="primary" plain @click="handleUnderWriting" v-if="detailData?.order?.orderStatus === '1' || detailData?.order?.orderStatus === '7'">提交核保</el-button>
             <el-button type="primary" plain v-if="detailData?.order?.orderStatus === '3' || detailData?.order?.orderStatus === '4' || detailData?.order?.orderStatus === '7'">同步订单</el-button>
-            <el-dropdown trigger="click" class="ml-[12px]" v-if="detailData?.insOrderAdjustVo.status === 2">
+            <el-dropdown trigger="click" class="ml-[12px]" v-if="detailData?.insOrderAdjustVo && detailData?.insOrderAdjustVo.status === 2">
                 <el-button plain type="primary">
                     订单批改
                     <el-icon class="el-icon--right">
@@ -961,8 +976,8 @@
                 </el-button>
                 <template #dropdown>
                     <el-dropdown-menu>
-                        <el-dropdown-item @click="onClick(0)">险种批改</el-dropdown-item>
-                        <el-dropdown-item @click="onClick(1)">整单退保</el-dropdown-item>
+                        <el-dropdown-item @click="onClick(1)">险种批改</el-dropdown-item>
+                        <el-dropdown-item @click="onClick(0)">整单退保</el-dropdown-item>
                     </el-dropdown-menu>
                 </template>
             </el-dropdown>
@@ -990,8 +1005,8 @@
         </el-drawer>
 
         <!-- 批改 -->
-        <DialogInsuranceEdit v-model="isEditVisible" :data="formData" />
-        <DialogInsuranceCancel v-model="isCancelVisible" :data="formData" />
+        <DialogInsuranceEdit v-model="isEditVisible" :data="formData" @complete="onComplete" />
+        <DialogInsuranceCancel v-model="isCancelVisible" :data="formData" @complete="onComplete" />
     </div>
 </template>
 
@@ -1018,11 +1033,12 @@ import { useRoute, useRouter } from 'vue-router'
 import { ElMessage } from "element-plus";
 
 import QrcodeVue from 'qrcode.vue';
-import DialogInsuranceEdit from './DialogInsuranceEdit.vue';
-import DialogInsuranceCancel from './DialogInsuranceCancel.vue';
+import DialogInsuranceEdit from './modules/DialogInsuranceEdit.vue';
+import DialogInsuranceCancel from './modules/DialogInsuranceCancel.vue';
 
 const myRoute = useRoute()
 const myRouter = useRouter()
+const insuranceAllData = ref<any>([])
 // 订单批改
 const formData = ref({})
 const isEditVisible = ref(false)
@@ -1636,18 +1652,18 @@ const initDetail = () => {
             // 投保方案-右侧
             drivingData.value = detailData.value.accidentalDrivings
             // 批改数据的判断
-            if (detailData.value.insOrderAdjustVo && detailData.value.insOrderAdjustVo.adjustInfoList.length > 0) {
-                console.log(123)
+            if (detailData.value.insOrderAdjustVo && detailData.value.insOrderAdjustVo.adjustInfoList?.length > 0) {
+                console.log('有批改数据')
                 let adjustInfoList = detailData.value.insOrderAdjustVo.adjustInfoList;
-                insuranceData.value = adjustInfoList.filter((item: any) => item.kindType !== 2).map((item: any) => ({
+                insuranceData.value = adjustInfoList.filter((item: any) => item.kindType !== 2 && item.isHide !== 1).map((item: any) => ({
                     ...item,
-                    amount: item.afterAmount,
-                    unitAmount: item.afterPremium
+                    amount: !item.type ? item.amount : item.afterAmount,
+                    unitAmount: !item.type ? item.premium : item.afterPremium
                 }));
-                drivingData.value = adjustInfoList.filter((item: any) => item.kindType === 2).map((item: any) => ({
+                drivingData.value = adjustInfoList.filter((item: any) => item.kindType === 2 && item.isHide !== 1).map((item: any) => ({
                     ...item,
-                    premium: item.afterPremium,
-                    quantity: item.afterAmount,
+                    premium: !item.type ? item.premium : item.afterPremium,
+                    quantity: !item.type ? item.amount : item.afterAmount,
                     productName: item.kindName,
                 }));
             }
@@ -1860,9 +1876,31 @@ const onClick = (type: any) => {
             })
         }
     });
-}
+};
+// 重新批改后续操作
+const onComplete = () => {
+    initDetail();
+    initTrack();
+};
+// 换取对应保额的别名
+const getValAlias = (code: any, val: any) => {
+    let data = insuranceAllData.value;
+    // 特殊处理,null转为投保的值
+    if (val === null) val = '1';
+    let objs = data.find((item: any) => item.kindCode === code)?.options.find((item: any) => item.value == val);
+    return objs ? objs.label : '';
+};
+// 获取全部保险数据
+const initData = () => {
+    api.projectApi.getBusinessInsurance().then((res: any) => {
+        if(res.code == 200) {
+            insuranceAllData.value = res.data;
+        }
+    });
+};
 
 onMounted(() => {
+    initData();
     initDetail();
     initOption();
     initTrack();

+ 3 - 1
src/views/insurancePolicy/record.vue

@@ -68,6 +68,9 @@ const columns = [
 	{ 
 		prop: "changePremium", label: "保费变化", width: 150,
 		formatter: (row: any) => {
+			if (!row.afterPremium) {
+				return '--';
+			}
 			let val = (((row.premium * 100) - (row.afterPremium * 100)) / 100);
 			return val > 0 ? `-¥${val}` : `¥${Math.abs(val)}`;
 		}
@@ -109,7 +112,6 @@ const fields = computed(() => {
 		{
 			label: "批改时间", model: "time", type: "date", dateType: "datetimerange", startplaceholder: "开始时间", endplaceholder: "结束时间",
 			onChange: (value: any) => {
-				console.log(value)
 				if (value) {
 					formInline.value.endDate = value[1];
 					formInline.value.startDate = value[0];

+ 32 - 12
src/views/insurancePolicy/recordDetail.vue

@@ -1,6 +1,7 @@
 <script setup lang="ts">
 import api from '@/api';
-import DialogInsuranceEdit from './DialogInsuranceEdit.vue';
+import DialogInsuranceEdit from './modules/DialogInsuranceEdit.vue';
+import DialogInsuranceCancel from './modules/DialogInsuranceCancel.vue';
 import { dictData } from '@/views/localDict/index';
 import { useRoute, useRouter } from 'vue-router';
 import { ElMessage } from 'element-plus';
@@ -35,6 +36,7 @@ const isEditVisible = ref(false);
 const isCancelVisible = ref(false);
 // data
 const recordData = ref<any>({});
+const insuranceAllData = ref<any>([]);
 // table
 const mTableData = ref<any>([]);
 const dTableData = ref<any>([]);
@@ -60,8 +62,8 @@ const getData = () => {
 	}).then((res: any) => {
 		if (res.code == '200') {
 			recordData.value = res.data.orderAdjustVo;
-			mTableData.value = res.data.adjustInfos.filter((item: any) => item.kindType !== 2 && item.type !== 0);
-			dTableData.value = res.data.adjustInfos.filter((item: any) => item.kindType === 2 && item.type !== 0);
+			mTableData.value = res.data.adjustInfos.filter((item: any) => item.kindType !== 2 && item.type !== 0 && item.isHide !== 1);
+			dTableData.value = res.data.adjustInfos.filter((item: any) => item.kindType === 2 && item.type !== 0 && item.isHide !== 1);
 		}
 	});
 };
@@ -75,12 +77,23 @@ const getTrackData = () => {
 		}
 	});
 };
+// 获取全部保险数据
+const getInsuranceAllData = () => {
+    api.projectApi.getBusinessInsurance().then((res: any) => {
+        if(res.code == 200) {
+            insuranceAllData.value = res.data;
+        }
+    });
+};
 const initData = () => {
 	// 订单数据
 	getData();
 	// 轨迹数据
 	getTrackData();
+	// 全部保险数据
+	getInsuranceAllData();
 };
+// 获取状态label
 const getReviewText = () => {
 	let text = '订单批改审核中,请等待';
 	if (recordData.value.status === 2) {
@@ -96,6 +109,14 @@ const getStateText = (d: any, v: any) => {
 	let label = d.find((item: any) => item.value == v)?.label;
 	return label || '--';
 };
+// 换取对应保额的别名
+const getValAlias = (code: any, val: any) => {
+    let data = insuranceAllData.value;
+    // 特殊处理,null转为投保的值
+    if (val === null) val = '1';
+    let objs = data.find((item: any) => item.kindCode === code)?.options.find((item: any) => item.value == val);
+    return objs ? objs.label : '';
+};
 // 提交操作
 const submitForm = async (formEl: FormInstance | undefined, status: any, popover: any) => {
 	if (!formEl) {
@@ -105,7 +126,6 @@ const submitForm = async (formEl: FormInstance | undefined, status: any, popover
 				// 审核状态 2.审核通过 3.退回修改 4.拒绝批改
 				status: status,
 			};
-			console.log('submit', params)
 			netAudit(params, popover);
 		}
 		return;
@@ -116,9 +136,8 @@ const submitForm = async (formEl: FormInstance | undefined, status: any, popover
 				id: route.query.id,
 				// 审核状态 2.审核通过 3.退回修改 4.拒绝批改
 				status: status,
-				refuse: form.desc,
+				refuse: status === 4 ? form.mark : form.desc,
 			};
-			console.log('submit', params)
 			netAudit(params, popover);
 		} else {
 			console.log('error submit', fields)
@@ -226,16 +245,16 @@ defineOptions({
 						<el-table-column prop="kindName" label="险种" />
 						<el-table-column prop="amount" label="批改前">
 							<template #default="scope">
-								<span v-if="scope.row.type !== 3">{{ scope.row.amount ? scope.row.amount : '投保' }}</span>
+								<span v-if="scope.row.type !== 3">{{ getValAlias(scope.row.kindCode, scope.row.amount) }}</span>
 								<span v-if="scope.row.type === 3">不投保</span>
 							</template>
 						</el-table-column>
 						<el-table-column prop="adjustAmount" label="批改后">
 							<template #default="scope">
-								<span v-if="scope.row.type === 1">{{ `保额变更为${ scope.row.afterAmount },补缴保费 ¥${ scope.row.adjustAmount }` }}</span>
+								<span v-if="scope.row.type === 1 && recordData.type === 1">{{ `保额变更为${ getValAlias(scope.row.kindCode, scope.row.afterAmount) },补缴保费 ¥${ scope.row.adjustAmount || '--' }` }}</span>
 								<span v-if="scope.row.type === 2 && recordData.type === 0">退保</span>
-								<span v-if="scope.row.type === 2 && recordData.type === 1">退保,退款金额 ¥{{ scope.row.adjustAmount }}</span>
-								<span v-if="scope.row.type === 3">投保,补缴保费 ¥{{ scope.row.adjustAmount }}</span>
+								<span v-if="scope.row.type === 2 && recordData.type === 1">退保,退款金额 ¥{{ scope.row.adjustAmount || '--' }}</span>
+								<span v-if="scope.row.type === 3 && recordData.type === 1">投保,补缴保费 ¥{{ scope.row.adjustAmount || '--' }}</span>
 							</template>
 						</el-table-column>
 					</el-table>
@@ -250,8 +269,8 @@ defineOptions({
 						<el-table-column prop="adjustAmount" label="批改后">
 							<template #default="scope">
 								<span v-if="scope.row.type === 2 && recordData.type === 0">退保</span>
-								<span v-if="scope.row.type === 2 && recordData.type === 1">{{ `退保${ scope.row.afterAmount || '--' }份,退款金额 ¥${ scope.row.adjustAmount }` }}</span>
-								<span v-if="scope.row.type !== 2">{{ `投保${ scope.row.afterAmount || '--' }份,补缴金额 ¥${ scope.row.adjustAmount }` }}</span>
+								<span v-if="scope.row.type === 2 && recordData.type === 1">{{ `退保${ scope.row.afterAmount || '--' }份,退款金额 ¥${ scope.row.adjustAmount || '--' }` }}</span>
+								<span v-if="scope.row.type !== 2 && recordData.type === 1">{{ `投保${ scope.row.afterAmount || '--' }份,补缴金额 ¥${ scope.row.adjustAmount || '--' }` }}</span>
 							</template>
 						</el-table-column>
 					</el-table>
@@ -383,6 +402,7 @@ defineOptions({
 		</FixedActionBar>
 		<!-- 重新批改 -->
 		<DialogInsuranceEdit v-model="isEditVisible" :data="formData" @complete="onComplete" />
+        <DialogInsuranceCancel v-model="isCancelVisible" :data="formData" @complete="onComplete" />
 	</div>
 </template>