Browse Source

fix: 操作

lxf 7 giờ trước cách đây
mục cha
commit
09a3765b9a

+ 5 - 0
src/api/modules/monitor.js

@@ -73,4 +73,9 @@ module.exports = {
         url: config.base_dev_url + "container_farm_work_scheme/renameScheme?schemeId={schemeId}&name={name}",
         type: "post",
     },
+    // 验证农事卡片药肥价格完整的接口
+    validatePesticideFertilizerQuotes: {
+        url: config.base_dev_url + "z_farm_work_lib/validatePesticideFertilizerQuotes ",
+        type: "get",
+    }
 }

+ 15 - 3
src/components/pageComponents/AgriculturalInteractionCard.vue

@@ -14,9 +14,10 @@
                 </div>
                 <div class="text">
                     预计报价<span class="price">{{ timelineItem.estimatedCost }}元</span>
-                    <span class="action-detail" @click="showPriceSheetPopup(timelineItem.farmWorkId, item)"
-                        >查看报价单</span
-                    >
+                    <!-- <span class="action-detail" @click="toDetail(timelineItem, item)"
+                        >查看详情</span
+                    > -->
+                    <span class="action-detail" @click="showPriceSheetPopup(timelineItem.farmWorkId, item)">查看报价单</span>
                 </div>
             </div>
             <div class="timeline-action" @click="handleTimelineAction(timelineItem, item.farmId)">转入农事任务</div>
@@ -46,6 +47,9 @@ import activeUploadPopup from "@/components/popup/activeUploadPopup.vue";
 import priceSheetPopup from "@/components/popup/priceSheetPopup.vue";
 import { computed, onMounted, ref } from "vue";
 import { ElMessage } from "element-plus";
+import { useRouter } from "vue-router";
+
+const router = useRouter();
 
 const props = defineProps({
     item: {
@@ -105,6 +109,14 @@ const handleUploadSuccess = async () => {
     emits("updateList");
 };
 
+const toDetail = (timelineItem, item) => {
+    console.log(timelineItem, item);
+    // router.push({
+    //     path: "/completed_work",
+    //     query: { miniJson: JSON.stringify({ id: item.id }) },
+    // });
+};
+
 // 忽略农事库
 const currentTask = ref(null);
 const showTaskPopup = ref(false);

+ 9 - 0
src/components/popup/activeUploadPopup.vue

@@ -110,7 +110,9 @@ import { onMounted, onUnmounted, ref } from "vue";
 import upload from "@/components/upload";
 import eventBus from "@/api/eventBus";
 import { ElMessage } from "element-plus";
+import { useRouter } from "vue-router";
 
+const router = useRouter();
 const show = ref(false);
 const gardenId = ref(null);
 const images = ref([]);
@@ -178,6 +180,13 @@ function handleShow({
     isUploading.value = false;
 
     // 如果没有报价信息,则跳转去完善报价信息
+    VE_API.monitor.validatePesticideFertilizerQuotes({ id: gardenId.value }).then((res) => {
+        if (res.code === 0) {
+            if (res.data.length === 0) {
+                router.push(`/modify?farmWorkId=${gardenId.value}&onlyPrice=true`);
+            }
+        }
+    });
 }
 
 function handleSuccess() {

+ 27 - 62
src/views/old_mini/modify_work/completedWork.vue

@@ -10,25 +10,10 @@
                 :class="{ warning: query.status === 'warning' }"
                 v-if="currentStep !== 0 || query.status === 'warning'"
             >
-                <div class="status-l" v-if="status === 0">
+                <div class="status-l">
                     <div class="stauts-text">{{ query.status === "warning" ? "已过期" : "待完成" }}</div>
-                    <div class="stauts-sub-text" v-if="query.status !== 'warning' && detailData?.executeDate">
-                        <template v-if="daysDiff > 0">
-                            距离预计执行时间还差 <span class="time-text">{{ daysDiff }}</span> 天
-                        </template>
-                        <template v-else-if="daysDiff < 0">
-                            距离预计执行时间已经过去了 <span class="time-text">{{ Math.abs(daysDiff) }}</span> 天
-                        </template>
-                        <template v-else>
-                            预计执行时间为今天
-                        </template>
-                    </div>
-                    <div class="stauts-sub-text" v-else-if="query.status === 'warning'">该农事触发但未执行</div>
-                </div>
-                <div class="status-l" v-if="status === 1">
-                    <div class="stauts-text">
-                        <el-icon color="#2199F8" size="16" class="status-icon"><Select /></el-icon>
-                        该农事已完成
+                    <div class="stauts-sub-text" v-if="detailData?.executeDeadlineDate">
+                        截止到 <span class="time-text">{{ detailData?.executeDeadlineDate }}</span>
                     </div>
                 </div>
                 <!-- <template v-if="query.status !== 'warning'">
@@ -250,13 +235,16 @@
             <div class="fixed-btn-wrap center" v-if="curRole == 2 && !detailData?.expectedExecuteDate">
                 <div class="fixed-btn orange" @click="selectExecuteTime">确认执行时间</div>
             </div>
+            <div class="fixed-btn-wrap center" v-if="curRole == 2 && detailData?.expectedExecuteDate">
+                <div class="fixed-btn orange" @click="showOfferPopup(detailData)">上传照片</div>
+            </div>
 
 
             <!-- 农资,步骤:农事已确认 -->
-            <div class="fixed-btn-wrap" v-if="curRole == 2 && detailData?.expectedExecuteDate">
+            <!-- <div class="fixed-btn-wrap" v-if="curRole == 2 && detailData?.expectedExecuteDate">
                 <div class="fixed-btn second" @click="showPriceSheetPopup">生成报价单</div>
                 <div class="fixed-btn" @click="handleTimelineAction(detailData)">转入农事任务</div>
-            </div>
+            </div> -->
         </div>
     </div>
     <!-- 报价弹窗 -->
@@ -302,6 +290,8 @@
     
     <!-- 新增:激活上传弹窗 -->
     <active-upload-popup ref="activeUploadPopupRef" @handleUploadSuccess="handleUploadSuccess"></active-upload-popup>
+
+    <offer-popup ref="offerPopupRef" @uploadSuccess="handleUploadSuccess"></offer-popup>
 </template>
 
 <script setup>
@@ -442,6 +432,13 @@ const showPriceSheetPopup = () => {
     priceSheetPopupRef.value.handleShowPopup(detailData.value);
 };
 
+const offerPopupRef = ref(null);
+const isGoBack = ref(false);
+const showOfferPopup = (item) => {
+    isGoBack.value = true;
+    offerPopupRef.value.openPopup(item);
+};
+
 
 const executorList = ref([{
     id: 1,
@@ -464,52 +461,15 @@ function handleTimelineAction(item) {
 }
 
 
-const showIgnore = () => {
-    taskPopupType.value = "warningIgnore";
-    showTaskPopup.value = true;
-};
-
-const handleConfirmExecute = () => {
-    VE_API.z_farm_work_record_cost
-        .selectQuote({ farmWorkRecordId: query.value.id, agriculturalId: quotationData.value.agriculturalId })
-        .then((res) => {
-            if (res.code === 0) {
-                taskPopupType.value = "success";
-                successText.value = "农事已锁单成功";
-                taskPopupActionType.value = 0;
-                showTaskPopup.value = true;
-            }
-        });
-};
-
-const handleConfirmComplete = () => {
-    VE_API.z_farm_work_record.updateFlowStatus({ id: query.value.id, targetFlowStatus: 5 }).then((res) => {
-        if (res.code === 0) {
-            taskPopupType.value = "success";
-            successText.value = "农事已经执行结束,请按照时间复核";
-            taskPopupActionType.value = 1;
-            showTaskPopup.value = true;
-        }
-    });
-};
-
-const handleRemindExecute = () => {
-    onlyShare.value = true;
-    parmasPage.value.farmMiniUserId = orderObj.value.agriculturalUserId;
-    setTimeout(() => {
-        uploadExecuteRef.value.showPopup({ ...parmasPage.value, type: "remindExecute" });
-    }, 10);
-};
-
 const showCalendar = ref(false);
 const maxDate = ref(new Date());
 const minDate = new Date(2010, 0, 1);
 const selectExecuteTime = () => {
+    console.log("detailData.value", detailData.value.executeDeadlineDate);
     maxDate.value = new Date(detailData.value.executeDeadlineDate);
     showCalendar.value = true;
 };
 
-
 const onConfirmExecuteTime = (date) => {
     showCalendar.value = false;
     VE_API.z_farm_work_record.updateExpectedExecuteDate({ recordId: query.value.id, expectedExecuteDate: formatDate(date) }).then((res) => {
@@ -550,7 +510,12 @@ const showUploadExecutePopup = () => {
 };
 
 const handleUploadSuccess = () => {
-    getDetail(query.value.id);
+    if (isGoBack.value) {
+        isGoBack.value = false;
+        router.back();
+    } else {
+        getDetail(query.value.id);
+    }
 };
 // 地图
 // const areaRef = ref(null);
@@ -626,7 +591,7 @@ onActivated(async () => {
 
                                 return {
                                     ...pesticide,
-                                    brand: priceInfo.brand || "--",
+                                    brand: pesticide.brand || "--",
                                     totalPrice: priceInfo.totalPrice,
                                     // 格式化字段供 price-table 组件使用
                                     price: price > 0 ? `${price}元/${unit}` : "--", // 格式化单价显示
@@ -699,7 +664,6 @@ onActivated(async () => {
         }
     }
 
-    console.log("quotationData.value", quotationData.value);
     // const point = store.state.home.miniUserLocationPoint;
     // if (areaRef.value) {
     //     newFarmMap.initMap(point, areaRef.value, false);
@@ -749,6 +713,7 @@ const getDetail = async (id) => {
     const { data } = await VE_API.z_farm_work_record.getDetail({ id });
     if (data && data.length > 0) {
         detailData.value = data[0];
+        console.log("detailData.value", detailData.value.executeDeadlineDate);
         // maxDate.value = new Date(detailData.value.executeDate);
         currentStep.value = getCurrentStep(detailData.value.flowStatus);
         parmasPage.value = {
@@ -1045,7 +1010,7 @@ const changeRegion = (e) => {
                     }
                 }
                 .stauts-sub-text {
-                    color: rgba(255, 255, 255, 0.51);
+                    // color: rgba(255, 255, 255, 0.51);
                     font-size: 14px;
                 }
                 .time-text {

+ 7 - 2
src/views/old_mini/modify_work/modify.vue

@@ -21,7 +21,7 @@
                             :value="item.value"
                             />
                         </el-select>
-                        <div class="edit-tag tag-text" v-else>托管农事</div>
+                        <div class="edit-tag tag-text" v-else>{{ statusMap[detailData?.flowStatus] }}</div>
                         <!-- <el-tooltip
                             effect="dark"
                             placement="left"
@@ -378,7 +378,7 @@
                         </div>
                     </div>
 
-                    <div class="submit-btn">
+                    <div class="submit-btn" :class="{ 'center-btn': onlyPrice }">
                         <div v-if="!onlyPrice" class="btn second" @click.prevent="cancelEdit">取消编辑</div>
                         <div class="btn" @click.prevent="submitForm(formRef)">保存</div>
                     </div>
@@ -595,6 +595,11 @@ const showPriceSheetPopup = () => {
     priceSheetPopupRef.value.handleShowPopup(detailData.value);
 };
 
+const statusMap = ref({
+    0: "取消关注",
+    1: "特别关注",
+    2: "托管农事",
+});
 const detailData = ref({});
 const getDetail = async () => {
     const { data, code } = await VE_API.farm.getFarmWorkLib({ id: route.query.farmWorkId, farmId: route.query.farmId, agriculturalId: route.query.agriculturalStoreId });

+ 5 - 1
src/views/old_mini/task_condition/components/interact.vue

@@ -106,7 +106,7 @@
 </template>
 
 <script setup>
-import { computed, nextTick, onMounted, ref, watch } from "vue";
+import { computed, nextTick, onActivated, onMounted, ref, watch } from "vue";
 import { useStore } from "vuex";
 import { List as VanList } from "vant";
 import IndexMap from "../../farm_manage/map/index";
@@ -200,6 +200,10 @@ onMounted(() => {
     });
 });
 
+onActivated(() => {
+    resetAndLoad();
+});
+
 // 监听 activeIndex 变化,重新加载数据
 watch(activeIndex, () => {
     resetAndLoad();

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

@@ -102,7 +102,7 @@
 </template>
 
 <script setup>
-import { computed, nextTick, onMounted, ref, watch } from "vue";
+import { computed, nextTick, onActivated, onMounted, ref, watch } from "vue";
 import { useStore } from "vuex";
 import { Popup, Calendar } from "vant";
 import IndexMap from "../../farm_manage/map/index";
@@ -242,6 +242,10 @@ onMounted(() => {
     });
 });
 
+onActivated(() => {
+    getSimpleList();
+});
+
 // 标记是否正在通过日期选择切换筛选(避免 watch 清除日期筛选)
 const isDateSelecting = ref(false);