|
@@ -167,7 +167,7 @@ onActivated(() => {
|
|
|
priceData.value = JSON.parse(query?.priceData || '{}');
|
|
priceData.value = JSON.parse(query?.priceData || '{}');
|
|
|
|
|
|
|
|
// 从 priceData 中匹配价格和品牌到对应的药肥
|
|
// 从 priceData 中匹配价格和品牌到对应的药肥
|
|
|
- if (priceData.value.itemsList && detailData.value.prescriptionList) {
|
|
|
|
|
|
|
+ if (priceData.value?.itemsList && detailData.value?.prescriptionList) {
|
|
|
executionMethod.value = priceData.value.executionMethod;
|
|
executionMethod.value = priceData.value.executionMethod;
|
|
|
if (detailData.value.usageMode === "根部施") {
|
|
if (detailData.value.usageMode === "根部施") {
|
|
|
executionMethod.value = 2;
|
|
executionMethod.value = 2;
|
|
@@ -191,7 +191,7 @@ onActivated(() => {
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
// 初始化服务费用
|
|
// 初始化服务费用
|
|
|
- if (priceData.value.farmWorkServiceCost && detailData.value.area) {
|
|
|
|
|
|
|
+ if (priceData.value?.farmWorkServiceCost && detailData.value?.area) {
|
|
|
servicePricePerMu.value = priceData.value.farmWorkServiceCost || null;
|
|
servicePricePerMu.value = priceData.value.farmWorkServiceCost || null;
|
|
|
}
|
|
}
|
|
|
});
|
|
});
|
|
@@ -282,19 +282,31 @@ const confirmPrice = () => {
|
|
|
return;
|
|
return;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- // 检查是否所有药肥都有价格
|
|
|
|
|
|
|
+ // 检查是否所有药肥都有价格和品牌
|
|
|
if (detailData.value?.prescriptionList) {
|
|
if (detailData.value?.prescriptionList) {
|
|
|
- const emptyPriceItems = [];
|
|
|
|
|
|
|
+ const emptyItems = [];
|
|
|
detailData.value.prescriptionList.forEach(prescription => {
|
|
detailData.value.prescriptionList.forEach(prescription => {
|
|
|
(prescription.pesticideFertilizerList || []).forEach(pesticide => {
|
|
(prescription.pesticideFertilizerList || []).forEach(pesticide => {
|
|
|
- if (!pesticide.price || pesticide.price <= 0) {
|
|
|
|
|
- emptyPriceItems.push(pesticide.pesticideFertilizerName || '药肥');
|
|
|
|
|
|
|
+ const pesticideName = pesticide.pesticideFertilizerName || '药肥';
|
|
|
|
|
+ const hasPrice = pesticide.price && pesticide.price > 0;
|
|
|
|
|
+ const hasBrand = pesticide.brand && pesticide.brand.trim() !== '';
|
|
|
|
|
+
|
|
|
|
|
+ if (!hasPrice || !hasBrand) {
|
|
|
|
|
+ let errorMsg = '';
|
|
|
|
|
+ if (!hasPrice && !hasBrand) {
|
|
|
|
|
+ errorMsg = `${pesticideName}的品牌和单价`;
|
|
|
|
|
+ } else if (!hasPrice) {
|
|
|
|
|
+ errorMsg = `${pesticideName}的单价`;
|
|
|
|
|
+ } else if (!hasBrand) {
|
|
|
|
|
+ errorMsg = `${pesticideName}的品牌`;
|
|
|
|
|
+ }
|
|
|
|
|
+ emptyItems.push(errorMsg);
|
|
|
}
|
|
}
|
|
|
});
|
|
});
|
|
|
});
|
|
});
|
|
|
|
|
|
|
|
- if (emptyPriceItems.length > 0) {
|
|
|
|
|
- ElMessage.error(`请填写${emptyPriceItems[0]}的价格`);
|
|
|
|
|
|
|
+ if (emptyItems.length > 0) {
|
|
|
|
|
+ ElMessage.error(`请填写${emptyItems[0]}`);
|
|
|
return;
|
|
return;
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|