Forráskód Böngészése

fix: 对接农事详情数据

lxf 20 órája
szülő
commit
8edac5b77a

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

@@ -209,7 +209,7 @@ const handleWechat = () => {
     console.log("handleWechat");
     router.push({
         path: "/completed_work",
-        query: { id: quotationData.value.id, farmWorkOrderId: quotationData.value.orderId },
+        query: { id: quotationData.value.id, farmWorkOrderId: quotationData.value.orderId, isAssign: true },
     });
 };
 

+ 66 - 12
src/views/old_mini/modify_work/completedWork.vue

@@ -43,12 +43,25 @@
                             <div class="executor-details">
                                 <div class="org-name">
                                     <span class="name">{{ quotationData.agriculturalStoreName || '--' }}</span>
-                                    <span class="rating">5.0分</span>
+                                    <span class="rating">{{ quotationData.score ? (quotationData.score + '分') : '--' }}</span>
                                 </div>
                                 <div class="service-info">
-                                    <div class="service-item">服务品种: <span>荔枝、龙眼</span></div>
+                                    <div class="service-item">服务品种:
+                                        <span v-if="speciesList.length">
+                                            <span v-for="(sp, sIdx) in speciesList" :key="sIdx">
+                                                {{ sp }}<template v-if="sIdx < speciesList.length - 1">、</template>
+                                            </span>
+                                        </span>
+                                        <span v-else>--</span>
+                                    </div>
                                     <div class="service-item">
-                                        服务设备: <span>无人机、水肥一体机、水肥一体机水肥</span>
+                                        服务设备:
+                                        <span v-if="equipmentList.length">
+                                            <span v-for="(eq, eIdx) in equipmentList" :key="eIdx">
+                                                {{ eq }}<template v-if="eIdx < equipmentList.length - 1">、</template>
+                                            </span>
+                                        </span>
+                                        <span v-else>--</span>
                                     </div>
                                 </div>
                             </div>
@@ -245,12 +258,20 @@
                 v-if="query.status !== 'warning'"
             >
                 <!-- <div class="fixed-btn expert">提醒农事确认</div> -->
-                <div class="fixed-btn expert excute" v-if="detailData?.flowStatus == 2 && query?.farmWorkOrderId && curRole == 0" @click="handleConfirmExecute">确认对方执行</div>
-                <div class="fixed-btn expert" v-if="detailData?.flowStatus == 5 && curRole == 0">确认对方完成</div>
-                <div class="fixed-btn expert" v-if="detailData?.flowStatus == 4 && curRole == 0">提醒对方执行</div>
-                <div class="fixed-btn orange" v-if="detailData?.flowStatus == 1 && curRole == 0" @click="handleDemand">发起需求</div>
+                
+                <div class="fixed-btn expert" v-if="detailData?.flowStatus == 4 && curRole == 0 && detailData?.executeEvidence?.length" @click="handleConfirmComplete">确认对方完成</div>
+                <div class="fixed-btn expert" v-if="detailData?.flowStatus == 4 && curRole == 0 && !detailData?.executeEvidence?.length">提醒对方执行</div>
+                <div class="fixed-btn orange" v-if="detailData?.flowStatus == 1 && curRole == 0 && !query?.isAssign" @click="handleDemand">发起需求</div>
                 <div class="fixed-btn orange" v-if="detailData?.flowStatus == 2 && !(query?.farmWorkOrderId) && curRole == 0" @click="cancelDemand">取消发起</div>
-                <div class="fixed-btn" v-if="detailData?.flowStatus == 1 && curRole == 0" @click="handleOk">我已完成</div>
+                <div class="fixed-btn" v-if="detailData?.flowStatus == 1 && curRole == 0 && !query?.isAssign" @click="handleOk">我已完成</div>
+            </div>
+
+            <!-- 农户,步骤:农资已生成报价,农户要确认对方执行 -->
+            <div
+                class="fixed-btn-wrap center"
+                v-if="(detailData?.flowStatus == 2 && query?.farmWorkOrderId && curRole == 0) || (query?.isAssign && curRole == 0 && detailData?.flowStatus < 4)"
+            >
+            <div class="fixed-btn expert excute" @click="handleConfirmExecute">确认对方执行</div>
             </div>
 
             <!-- 农资,步骤:农事已确认 -->
@@ -296,7 +317,7 @@
 
 <script setup>
 import customHeader from "@/components/customHeader.vue";
-import { onMounted, ref } from "vue";
+import { onMounted, ref, computed } from "vue";
 // import NewFarmMap from "./newFarmMap";
 import { useStore } from "vuex";
 import { Popup } from "vant";
@@ -336,12 +357,14 @@ const handleOk = () => {
 };
 
 const successText = ref('');
+const taskPopupActionType = ref(0);
 const handleDemand = () => {
     // router.push("/share_page");
     VE_API.z_farm_work_record.updateFlowStatus({ id: query.id, targetFlowStatus: 2 }).then((res) => {
         if (res.code === 0) {
             taskPopupType.value = 'success';
             successText.value = '需求已发送成功';
+            taskPopupActionType.value = 0;
             showTaskPopup.value = true;
         }
     })
@@ -360,8 +383,17 @@ const handlePopupBtn = () => {
             }
         })
     } else {
-        getDetail(query.id);
-        currentStep.value = 2
+        if (taskPopupActionType.value === 0) {
+            getDetail(query.id);
+            currentStep.value = 2
+        } else {
+            router.replace({
+                path: "/review_work",
+                query: {
+                    id: query.id,
+                },
+            });
+        }
     }
 }
 
@@ -380,11 +412,23 @@ const handleConfirmExecute = () => {
     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.id, targetFlowStatus: 5 }).then((res) => {
+        if (res.code === 0) {
+            taskPopupType.value = 'success';
+            successText.value = '农事已经执行结束,请按照时间复核';
+            taskPopupActionType.value = 1;
+            showTaskPopup.value = true;
+        }
+    })
+};
+
 const onlyShare = ref(false);
 const handleShare = () => {
     onlyShare.value = true;
@@ -393,7 +437,11 @@ const handleShare = () => {
     }, 10);
 };
 const showUploadExecutePopup = () => {
-    onlyShare.value = false;
+    if (detailData.value?.executeEvidence.length) {
+        onlyShare.value = true;
+    } else {
+        onlyShare.value = false;
+    }
     setTimeout(() => {
         uploadExecuteRef.value.showPopup(query.id);
     }, 10);
@@ -402,6 +450,12 @@ const showUploadExecutePopup = () => {
 // const areaRef = ref(null);
 // let newFarmMap = new NewFarmMap();
 const quotationData = ref({});
+const toList = (val) => {
+    if (!val) return [];
+    return JSON.parse(val);
+};
+const speciesList = computed(() => toList(quotationData.value.serviceSpecies));
+const equipmentList = computed(() => toList(quotationData.value.serviceEquipment));
 onMounted(async () => {
     const id = query.id;
     if (id) {

+ 7 - 0
src/views/old_mini/modify_work/index.vue

@@ -497,6 +497,13 @@ function handlePopupBtn() {
     showTaskPopup.value = false;
     if (taskPopupType.value === 'warning') {
         // 确认忽略
+    } else {
+        router.push({
+            path: "/completed_work",
+            query: {
+                id: route.query.id,
+            },
+        });
     }
 }
 

+ 5 - 4
src/views/old_mini/task_condition/components/calendar.vue

@@ -2,7 +2,7 @@
     <div class="calendar">
         <div class="header-wrap">
             <div class="header-l">
-                <div class="top-l">
+                <div class="top-l" v-if="expiredCounts">
                     <el-icon class="icon icon-l" color="#999999" size="11" @click="prevPeriod"><ArrowLeftBold /></el-icon>
                     <span class="top-tag red">{{ expiredCounts }}过期</span>
                 </div>
@@ -11,7 +11,7 @@
                         {{ dateRange.start }} <span class="center-line">-</span> {{ dateRange.end }}
                     </span>
                 </div>
-                <div class="top-r">
+                <div class="top-r" v-if="completedCounts">
                     <span class="top-tag orange">{{ completedCounts }}待完成</span>
                     <el-icon class="icon icon-r" color="#999999" size="11" @click="nextPeriod"><ArrowRightBold /></el-icon>
                 </div>
@@ -136,9 +136,10 @@ function setSolarTerm(taskList) {
 const expiredCounts = ref(0);
 const completedCounts = ref(0);
 function setCounts(index, counts) {
-    if (index === 1) {
+    console.log('sssset', index, counts);
+    if (index === 2) {
         completedCounts.value = counts;
-    } else if (index === 2) {
+    } else if (index === 3) {
         expiredCounts.value = counts;
     }
 }

+ 14 - 4
src/views/old_mini/task_condition/components/task.vue

@@ -168,6 +168,12 @@ function getTaskCount(flowStatus, index) {
     return VE_API.z_farm_work_record.getSimpleList({ role: 2, location, flowStatus }).then(({data}) => {
         if (Array.isArray(data)) {
             taskCounts.value[index] = data.length;
+            calendarRef.value && calendarRef.value.setCounts(index, taskCounts.value[index])
+            
+            if (index === 1) {
+                calendarRef.value && calendarRef.value.setSolarTerm(data)
+                indexMap.initData(data)
+            }
         } else if (data?.total !== undefined) {
             taskCounts.value[index] = data.total;
         } else {
@@ -216,11 +222,11 @@ function getSimpleList() {
         loading.value = false;
         // 假设返回的数据结构是 { list: [], total: 0 } 或者直接是数组
         if (Array.isArray(data) && data.length > 0) {
+            console.log('ssssget', data);
             taskList.value = data;
             // 更新当前状态的数量
             taskCounts.value[activeIndex.value] = data.length;
-            calendarRef.value && calendarRef.value.setCounts(activeIndex.value, taskCounts.value[activeIndex.value])
-            if (activeIndex.value === 0) {
+            if (activeIndex.value === 1) {
                 calendarRef.value && calendarRef.value.setSolarTerm(taskList.value)
                 indexMap.initData(taskList.value)
             }
@@ -245,8 +251,12 @@ function handleActiveFilter(i) {
 
 function toPage(item) {
     // router.push("/servicZes_agri")
-    if (activeIndex.value === 1) {
-        onlyShare.value = false;
+    if (activeIndex.value === 2) {
+        if (item?.executeEvidence?.length) {
+            onlyShare.value = true;
+        } else {
+            onlyShare.value = false;
+        }
         setTimeout(() => {
             uploadExecuteRef.value.showPopup(item.id,'share-sheet');
         }, 10);