数据定价对接计算接口
Showing
1 changed file
with
6 additions
and
6 deletions
| ... | @@ -905,16 +905,15 @@ const getCalculateParams = (baseConfigFormObj, baseConfigFormInfo) => { | ... | @@ -905,16 +905,15 @@ const getCalculateParams = (baseConfigFormObj, baseConfigFormInfo) => { |
| 905 | const getCalculatPrice = async (params) => { | 905 | const getCalculatPrice = async (params) => { |
| 906 | try { | 906 | try { |
| 907 | const res: any = await calculatPrice(params); | 907 | const res: any = await calculatPrice(params); |
| 908 | loading.value = false; | ||
| 909 | if (res.code === proxy.$passCode) { | 908 | if (res.code === proxy.$passCode) { |
| 910 | const data = res.data || {}; | 909 | const data = res.data || {}; |
| 911 | return data; // 返回计算结果以便后续使用 | 910 | return data; // 返回计算结果以便后续使用 |
| 912 | } else { | 911 | } else { |
| 913 | proxy.$ElMessage.error(res.msg); | 912 | proxy.$ElMessage.error(res.msg); |
| 913 | loading.value = false; | ||
| 914 | throw new Error(res.msg); // 抛出错误以便 catch 捕获 | 914 | throw new Error(res.msg); // 抛出错误以便 catch 捕获 |
| 915 | } | 915 | } |
| 916 | } catch (error) { | 916 | } catch (error) { |
| 917 | console.error('计算价格失败:', error); | ||
| 918 | loading.value = false; | 917 | loading.value = false; |
| 919 | throw error; // 重新抛出错误 | 918 | throw error; // 重新抛出错误 |
| 920 | } | 919 | } |
| ... | @@ -933,8 +932,10 @@ const checkForm = (type) => { | ... | @@ -933,8 +932,10 @@ const checkForm = (type) => { |
| 933 | const priceData = await getCalculatPrice(paramsInfo); | 932 | const priceData = await getCalculatPrice(paramsInfo); |
| 934 | // 显示结果 | 933 | // 显示结果 |
| 935 | dataTransactionPrice.value = priceData.transactionPrice.toFixed(2); | 934 | dataTransactionPrice.value = priceData.transactionPrice.toFixed(2); |
| 936 | if (type == 'export') { | 935 | |
| 937 | loading.value = true; | 936 | if (type == 'calculate') { |
| 937 | loading.value = false; | ||
| 938 | } else if (type == 'export') { | ||
| 938 | const exportOut = { | 939 | const exportOut = { |
| 939 | one: priceData.one, | 940 | one: priceData.one, |
| 940 | two: priceData.two, | 941 | two: priceData.two, |
| ... | @@ -958,12 +959,11 @@ const checkForm = (type) => { | ... | @@ -958,12 +959,11 @@ const checkForm = (type) => { |
| 958 | message: '下载报告请求失败', | 959 | message: '下载报告请求失败', |
| 959 | }); | 960 | }); |
| 960 | }) | 961 | }) |
| 961 | } else if (type == 'submit') { | 962 | } else { |
| 962 | let params = { | 963 | let params = { |
| 963 | ...paramsInfo, | 964 | ...paramsInfo, |
| 964 | dataTransactionPrice: dataTransactionPrice.value, | 965 | dataTransactionPrice: dataTransactionPrice.value, |
| 965 | } | 966 | } |
| 966 | loading.value = true; | ||
| 967 | savePrice(params).then((res: any) => { | 967 | savePrice(params).then((res: any) => { |
| 968 | loading.value = false; | 968 | loading.value = false; |
| 969 | if (res.code == proxy.$passCode) { | 969 | if (res.code == proxy.$passCode) { | ... | ... |
-
Please register or sign in to post a comment