Przeglądaj źródła

提交相关代码

Lijy 1 rok temu
rodzic
commit
a1df5ec128

+ 3 - 3
fhKeeper/formulahousekeeper/customerBuler-crm/src/components/relatedProducts/relatedProducts.vue

@@ -127,7 +127,7 @@ function returnData() {
     let jsonstr = JSON.stringify(productTable.value)
     let json = '[{"index":0}]'
     if (jsonstr == json) {
-        return false
+        return []
     }
 
     const list = productTable.value.filter((item: any) => item.productId)
@@ -142,10 +142,10 @@ function returnData() {
         return false;
     }
 
-    productTable.value.forEach((item: any) => {
+    list.forEach((item: any) => {
         delete item.index
     });
-    return productTable.value || []
+    return list || []
 }
 
 const selectedQuantity = computed(() => {

+ 2 - 0
fhKeeper/formulahousekeeper/customerBuler-crm/src/pages/business/index.vue

@@ -253,9 +253,11 @@ const productTableListValue = ref([])
 function editBusiness(visibles: boolean) {
   businessTemplateRef.value?.getData().then((res: any) => {
     let productTableListData = relatedProductsRef?.value?.returnData()
+    console.log(!productTableListData, judgmentaAmounteEqual({...businessTemplateValue.value, ...res}, productTableListData))
     if(!productTableListData || judgmentaAmounteEqual({...businessTemplateValue.value, ...res}, productTableListData)) {
       return
     }
+
     productTableListData.forEach((item: any) => {
       delete item.id
     })

+ 7 - 4
fhKeeper/formulahousekeeper/customerBuler-crm/src/utils/tools.ts

@@ -271,19 +271,22 @@ export function setTemplateDataDisable(list: Array<any>, fieldList: Array<any>)
  * @param arr 相关产品
  * @returns Boolean
  */
-export function judgmentaAmounteEqual(mob: any, arr: any[] = []) {
-  let flag = true;
+export function judgmentaAmounteEqual(mob: any, arr: any) {
+  if(!arr || arr.length <= 0) {
+    return false;
+  }
+  let flag = false;
   const amounte = mob.amountOfMoney || 0;
   const totalAmounte = arr.reduce((pre: number, cur: any) => pre + (cur.totalPrice || 0), 0);
 
-  if (amounte !== totalAmounte) {
+  if (amounte != totalAmounte) {
     ElNotification.closeAll();
     ElNotification({
       title: '提示',
       message: `商机金额${amounte > totalAmounte ? '大于' : '小于'}产品总金额,请修改`,
       type: 'warning',
     });
-    flag = false;
+    flag = true;
   }
 
   return flag;