Jelajahi Sumber

fix: 报价信息

lxf 2 minggu lalu
induk
melakukan
5e8fd0c1e1

+ 1 - 1
src/components/popup/priceSheetPopup.vue

@@ -27,7 +27,7 @@
                         </div>
                         <div class="info-item">
                             <span class="info-label">执行时间</span>
-                            <span class="info-value">{{ quotationData?.executeDate || '--' }}</span>
+                            <span class="info-value">{{ priceData?.executeDate || quotationData?.executeDate || '--' }}</span>
                         </div>
                         <div class="info-item catalog-label">
                             <span class="info-label">报价目录</span>

+ 1 - 1
src/views/old_mini/farm_manage/components/demandHall.vue

@@ -64,7 +64,7 @@
                                         <!-- <div class="btn second">
                                             转发给客户
                                         </div> -->
-                                        <div class="btn primary" @click="showPriceSheetPopup(item)">确认并报价</div>
+                                        <div class="btn primary" @click="showPriceSheetPopup(item)">确认并报价</div>
                                     </div>
                                 </div>
                             </template>

+ 3 - 3
src/views/old_mini/mine/pages/serviceDetail.vue

@@ -85,9 +85,9 @@ const serviceStatsData = ref([]);
 const getFarmPastServiceCost = () => {
     VE_API.user.getFarmPastServiceCost({ farmId: farmIdVal.value }).then(({ data }) => {
         serviceStatsData.value = [
-            { value: data.totalCost, unit: "元", desc: "总收益" },
-            { value: data.totalCost, unit: "元", desc: "投入成本" },
-            { value: data.serviceCount, unit: "次", desc: "服务次数" },
+            { value: data?.totalCost, unit: "元", desc: "总收益" },
+            { value: data?.totalCost, unit: "元", desc: "投入成本" },
+            { value: data?.serviceCount, unit: "次", desc: "服务次数" },
         ];
     });
 };

+ 1 - 1
src/views/old_mini/modify_work/reviewWork.vue

@@ -9,7 +9,7 @@
                 </div>
                 <div class="info-box">
                     <div class="info-l">
-                        <img class="farm-img" src="@/assets/img/gallery/farm-img.png" alt="" />
+                        <img class="farm-img" src="@/assets/img/home/farm.png" alt="" />
                     </div>
                     <div class="info-r">
                         <div class="farm-name">{{ workItem.farmName }}</div>

+ 20 - 8
src/views/old_mini/price_detail/index.vue

@@ -167,7 +167,7 @@ onActivated(() => {
     priceData.value = JSON.parse(query?.priceData || '{}');
     
     // 从 priceData 中匹配价格和品牌到对应的药肥
-    if (priceData.value.itemsList && detailData.value.prescriptionList) {
+    if (priceData.value?.itemsList && detailData.value?.prescriptionList) {
         executionMethod.value = priceData.value.executionMethod;
         if (detailData.value.usageMode === "根部施") {
             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;
     }
 });
@@ -282,19 +282,31 @@ const confirmPrice = () => {
         return;
     }
     
-    // 检查是否所有药肥都有价格
+    // 检查是否所有药肥都有价格和品牌
     if (detailData.value?.prescriptionList) {
-        const emptyPriceItems = [];
+        const emptyItems = [];
         detailData.value.prescriptionList.forEach(prescription => {
             (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;
         }
     }

+ 1 - 1
src/views/old_mini/task_condition/components/task.vue

@@ -103,7 +103,7 @@
         </div>
     </popup>
     <!-- 服务报价单 -->
-    <price-sheet-popup ref="priceSheetPopupRef"></price-sheet-popup>
+    <price-sheet-popup :key="activeIndex" ref="priceSheetPopupRef"></price-sheet-popup>
 </template>
 
 <script setup>

+ 3 - 3
src/views/old_mini/user/farmDetails.vue

@@ -215,9 +215,9 @@ const getFutureFarmWorkList = () => {
 const getFarmPastServiceCost = () => {
     VE_API.user.getFarmPastServiceCost({ farmId: farmIdVal.value }).then(({ data }) => {
         serviceStatsData.value = [
-            { value: data.totalCost, unit: "元", desc: "总收益" },
-            { value: data.totalCost, unit: "元", desc: "投入成本" },
-            { value: data.serviceCount, unit: "次", desc: "服务次数" },
+            { value: data?.totalCost, unit: "元", desc: "总收益" },
+            { value: data?.totalCost, unit: "元", desc: "投入成本" },
+            { value: data?.serviceCount, unit: "次", desc: "服务次数" },
         ];
     });
 };