Explorar o código

feat:对接农户农事管理功能

wangsisi hai 2 semanas
pai
achega
9b768d2301

+ 7 - 0
src/components/pageComponents/PlanList.vue

@@ -100,6 +100,13 @@ watch(() => props.farmId, (newVal) => {
 });
 
 
+onMounted(() => {
+    if(props.farmId){
+        getPlanWorkList();
+    }
+});
+
+
 const getFarmTypeText = (type) => {
     const value = typeof type === "string" ? type.trim() : type;
     if (value === 0 || value === "0") return "预警农事";

+ 65 - 49
src/components/recordItem.vue

@@ -5,10 +5,16 @@
             <div v-if="titleMode === 'default'" class="box-title">
                 <div class="title-l">
                     {{ recordItemData.farmWorkName || recordItemData.name }}
-                    <span class="parent-text" v-if="recordItemData.type || recordItemData.farmWorkType"> {{ getFarmTypeText(recordItemData.type || recordItemData.farmWorkType) }} </span>
+                    <span class="parent-text" v-if="recordItemData.type || recordItemData.farmWorkType">
+                        {{ getFarmTypeText(recordItemData.type || recordItemData.farmWorkType) }}
+                    </span>
                 </div>
                 <!-- 按钮样式 -->
-                <div v-if="titleRightText && titleRightType !== 'dot'" class="title-r title-r-button" @click.stop="handleTitleRightClick(recordItemData)">
+                <div
+                    v-if="titleRightText && titleRightType !== 'dot'"
+                    class="title-r title-r-button"
+                    @click.stop="handleTitleRightClick(recordItemData)"
+                >
                     {{ titleRightText }}
                 </div>
                 <!-- 点样式 -->
@@ -29,7 +35,10 @@
                 <div class="review-title info-line">
                     复核成效
                     <div class="info-val">
-                        {{ recordItemData.reCheckText || '促进分蘖芽萌发、加快分蘖生长,同时补充氮素等关键养分,增强植株长势,为形成足够穗数、提高群体产量打基础。' }}
+                        {{
+                            recordItemData.reCheckText ||
+                            "促进分蘖芽萌发、加快分蘖生长,同时补充氮素等关键养分,增强植株长势,为形成足够穗数、提高群体产量打基础。"
+                        }}
                     </div>
                 </div>
                 <div class="review-image" v-if="showFarmImage">
@@ -39,7 +48,10 @@
                     </div>
                     <div class="image-wrapper" v-if="recordItemData.reviewImage && recordItemData.reviewImage.length">
                         <span class="image-label">农事后</span>
-                        <img :src="base_img_url2 + recordItemData.reviewImage[recordItemData.reviewImage.length - 1]" alt="" />
+                        <img
+                            :src="base_img_url2 + recordItemData.reviewImage[recordItemData.reviewImage.length - 1]"
+                            alt=""
+                        />
                     </div>
                 </div>
             </div>
@@ -50,7 +62,7 @@
         <div class="record-content" v-else>
             <div class="info-item">
                 推荐时间:
-                <span class="info-val">{{ recordItemData?.executeDate || '--' }}</span>
+                <span class="info-val">{{ recordItemData?.executeDate || "--" }}</span>
             </div>
             <div
                 class="info-item recipe-name"
@@ -60,7 +72,7 @@
                 <div class="rescription info-val">
                     <span v-for="(fertilizer, fertilizerI) in recordItemData.prescriptionList" :key="fertilizerI">
                         <span v-for="(pest, pestI) in fertilizer.pesticideFertilizerList" :key="'sub' + pestI">
-                            {{ pest.defaultName }}
+                            {{ pest.defaultName || pest.pesticideFertilizerName }}
                             <span
                                 v-if="
                                     pestI !== fertilizer.pesticideFertilizerList.length - 1 ||
@@ -90,14 +102,6 @@
                             <div class="td">配比</div>
                             <div class="td">方式</div>
                         </div>
-                        <!-- <div v-for="(prescriptionItem, prescriptionI) in recordItemData.farmWorkDetail.prescription" :key="prescriptionI">
-                            <div class="tr" v-for="(subP, subI) in prescriptionItem.pesticideFertilizerList" :key="subI">
-                                <div class="td">{{ subP.typeName }}</div>
-                                <div class="td width">{{ subP.name }}</div>
-                                <div class="td">{{ subP.ratio }}</div>
-                                <div class="td">人工</div>
-                            </div>
-                        </div> -->
                         <div>
                             <div
                                 class="tr"
@@ -122,15 +126,19 @@
             </div>
             <div class="info-item">
                 触发条件:
-                <span class="info-val">{{ recordItemData?.farmWorkDetail?.condition || recordItemData?.condition || '暂无触发条件' }}</span>
+                <span class="info-val">{{
+                    recordItemData?.farmWorkDetail?.condition || recordItemData?.condition || "暂无触发条件"
+                }}</span>
             </div>
             <div class="info-item one-text">
                 农事编号:
-                <span class="info-val">{{ recordItemData?.farmWorkDetail?.code ||recordItemData.farmWorkCode || recordItemData.code }}</span>
+                <span class="info-val">{{
+                    recordItemData?.farmWorkDetail?.code || recordItemData.farmWorkCode || recordItemData.code
+                }}</span>
             </div>
             <div class="info-item" v-if="recordItemData?.attention">
                 巡园提醒:
-                <span class="info-val">{{ recordItemData?.attention || '暂无巡园提醒' }}</span>
+                <span class="info-val">{{ recordItemData?.attention || "暂无巡园提醒" }}</span>
             </div>
         </div>
         <slot name="footer"></slot>
@@ -138,9 +146,9 @@
 </template>
 
 <script setup>
-import { ref, computed, watch } from 'vue';
-import { base_img_url2 } from '@/api/config';
-const emit = defineEmits(['titleRightClick']);
+import { ref, computed, watch } from "vue";
+import { base_img_url2 } from "@/api/config";
+const emit = defineEmits(["titleRightClick"]);
 const props = defineProps({
     onlyRecipeName: {
         type: Boolean,
@@ -187,7 +195,7 @@ const getPrescriptionInfo = (section) => {
     // 将 prescriptionList 中所有 pesticideFertilizerName 用 + 连接
     if (section && Array.isArray(section.prescriptionList)) {
         const names = section.prescriptionList
-            .flatMap((item) => Array.isArray(item?.pesticideFertilizerList) ? item.pesticideFertilizerList : [])
+            .flatMap((item) => (Array.isArray(item?.pesticideFertilizerList) ? item.pesticideFertilizerList : []))
             .map((sub) => sub?.pesticideFertilizerName)
             .filter((name) => typeof name === "string" && name.trim().length > 0);
         if (names.length > 0) {
@@ -216,32 +224,36 @@ const fetchImageUrl = (id) => {
     if (!id || loadingIds.value.has(id)) {
         return;
     }
-    
+
     // 如果已经有缓存的 URL,直接返回
     if (imageUrlMap.value[id]) {
         return;
     }
-    
+
     // 标记为加载中
     loadingIds.value.add(id);
-    
+
     // 发起异步请求获取图片 URL
-    VE_API.z_farm_work_record.getTriggerImg({ farmWorkRecordId: id }).then(({ data }) => {
-        if(data && data.length > 0){
-            const url = base_img_url2 + data[data.length - 1].cloudFilename;
-            // 更新响应式数据,这样模板会自动更新
-            imageUrlMap.value[id] = url;
-        } else {
-            imageUrlMap.value[id] = '';
-        }
-    }).catch(() => {
-        // 请求失败时,设置为空字符串避免重复请求
-        imageUrlMap.value[id] = '';
-    }).finally(() => {
-        // 清除加载标记
-        loadingIds.value.delete(id);
-    });
-}
+    VE_API.z_farm_work_record
+        .getTriggerImg({ farmWorkRecordId: id })
+        .then(({ data }) => {
+            if (data && data.length > 0) {
+                const url = base_img_url2 + data[data.length - 1].cloudFilename;
+                // 更新响应式数据,这样模板会自动更新
+                imageUrlMap.value[id] = url;
+            } else {
+                imageUrlMap.value[id] = "";
+            }
+        })
+        .catch(() => {
+            // 请求失败时,设置为空字符串避免重复请求
+            imageUrlMap.value[id] = "";
+        })
+        .finally(() => {
+            // 清除加载标记
+            loadingIds.value.delete(id);
+        });
+};
 
 // 计算属性:根据 recordItemData.id 获取图片 URL(响应式)
 const currentImageUrl = computed(() => {
@@ -250,22 +262,26 @@ const currentImageUrl = computed(() => {
         // 触发获取图片 URL(如果还没有获取过)
         fetchImageUrl(id);
         // 直接返回响应式数据,Vue 会自动追踪变化
-        return imageUrlMap.value[id] || '';
+        return imageUrlMap.value[id] || "";
     }
-    return '';
+    return "";
 });
 
 // 监听 recordItemData.id 的变化,确保 ID 变化时重新获取
-watch(() => props.recordItemData?.id, (newId) => {
-    if(props.showFarmImage){
-        if (newId && !imageUrlMap.value[newId] && !loadingIds.value.has(newId)) {
-            fetchImageUrl(newId);
+watch(
+    () => props.recordItemData?.id,
+    (newId) => {
+        if (props.showFarmImage) {
+            if (newId && !imageUrlMap.value[newId] && !loadingIds.value.has(newId)) {
+                fetchImageUrl(newId);
+            }
         }
-    }
-}, { immediate: true });
+    },
+    { immediate: true }
+);
 
 const handleTitleRightClick = (recordItemData) => {
-    emit('titleRightClick', recordItemData);
+    emit("titleRightClick", recordItemData);
 };
 </script>
 

+ 174 - 78
src/views/old_mini/agri_services/components/farmDynamics.vue

@@ -15,39 +15,63 @@
                     <record-item
                         :record-item-data="section"
                         title-mode="default"
-                        title-right-type="dot"
-                        title-right-dot-text="2区"
+                        onlyRecipeName
+                        titleRightDotText="全区"
+                        titleRightType="dot"
                         class="recipe-item"
-                        :showFarmImage="activePlanIndex == 5?true:false"
-                        :content-mode="activePlanIndex == 5?'serviceDetail':''"
+                        :showFarmImage="activePlanIndex == 5 ? true : false"
+                        :content-mode="activePlanIndex == 5 ? 'serviceDetail' : ''"
                         @click="handleClick(section)"
                     >
                         <template #footer>
-                            <div class="action-group" v-if="activePlanIndex === 4">
+                            <div class="action-group">
                                 <div class="action-l">查看详情</div>
-                                <!-- <div class="action-r" v-if="section.orderStatus === 0">
-                                    <div class="action-item second-item">拍照识别</div>
-                                    <div class="action-item primary-item">去确认</div>
-                                </div> -->
-                                <!-- <div class="action-r" v-if="activePlanIndex === 4">
+                                <div class="action-r" v-if="section.farmWorkDetail?.flowStatus === 1">
+                                    <div class="action-item warning-item" @click.stop="handleApply(section)">
+                                        发起需求
+                                    </div>
+                                    <div class="action-item primary-item">我已完成</div>
+                                </div>
+                                <div class="action-r" v-else-if="section.farmWorkDetail?.flowStatus === 2">
                                     <div
-                                        class="action-item warning-item"
-                                        :class="{ 'has-applied': section.hasApplied }"
-                                        @click="handleApply(section, index)"
+                                        class="action-item second-item"
+                                        @click.stop="handleOperation(section, 'cancel')"
                                     >
-                                        {{ section.hasApplied ? "已发起需求" : "发起需求" }}
+                                        取消发起
+                                    </div>
+                                </div>
+                                <div class="action-r" v-else-if="section.farmWorkDetail?.flowStatus === 4">
+                                    <div class="action-item warning-item has-applied">已锁单</div>
+                                    <div
+                                        v-if="section.executeEvidence?.length"
+                                        class="action-item primary-item"
+                                        @click.stop="handleOperation(section, 'confirmComplete')"
+                                    >
+                                        确认执行完成
                                     </div>
-                                    <div class="action-item primary-item">确认完成</div>
-                                </div> -->
-                                <div class="action-r" v-if="activePlanIndex === 1">
                                     <div
+                                        v-else
+                                        class="action-item primary-item"
+                                        @click.stop="handleApply(section, 'remindExecute')"
+                                    >
+                                        提醒对方执行
+                                    </div>
+                                </div>
+                                <div class="action-r" v-else-if="activePlanIndex == 5">
+                                    <!-- <div
                                         class="action-item warning-item"
                                         :class="{ 'has-applied': section.hasApplied }"
                                         @click="handleApply(section, index)"
                                     >
                                         {{ section.hasApplied ? "已发起需求" : "发起需求" }}
+                                    </div> -->
+                                    <div
+                                        class="action-item primary-item"
+                                        v-if="!section.farmWorkDetail?.reviewImage?.length"
+                                        @click.stop="handleUploadPhoto(section)"
+                                    >
+                                        上传照片
                                     </div>
-                                    <div class="action-item primary-item">上传照片</div>
                                 </div>
                             </div>
                         </template>
@@ -57,20 +81,99 @@
         </div>
     </div>
     <!-- 需求发送成功弹窗 -->
-    <popup v-model:show="showApplyPopup" round class="apply-popup">
-        <img class="check-icon" src="@/assets/img/home/right.png" alt="" />
-        <div class="apply-text">需求发送成功</div>
-        <div class="apply-btn" @click="showApplyPopup = false">我知道了</div>
-    </popup>
+    <tip-popup v-model:show="showApplyPopup" type="success" text="需求发送成功" />
+    <!-- 发起需求成功弹窗 -->
+    <fn-share-sheet class="share-sheet" v-model:show="showShare" @select="onSelect" :options="options" />
+    <!-- 提醒对方执行弹窗 -->
+    <upload-execute ref="uploadExecuteRef" onlyShare />
+    <!-- 上传照片弹窗 -->
+    <review-upload-popup v-model="showUpload" :record-id="sectionId" @success="getContentData" />
 </template>
 <script setup>
 import { ref, onMounted } from "vue";
 import recordItem from "@/components/recordItem.vue";
 import tabList from "@/components/pageComponents/TabList.vue";
-import { Popup ,Empty} from "vant";
+import { Popup, Empty } from "vant";
 import { useRouter } from "vue-router";
+import wx from "weixin-js-sdk";
+import uploadExecute from "@/views/old_mini/task_condition/components/uploadExecute.vue";
+import tipPopup from "@/components/popup/tipPopup.vue";
+import FnShareSheet from "@/components/pageComponents/FnShareSheet.vue";
+import { ElMessageBox } from "element-plus";
+import { base_img_url2 } from "@/api/config";
+import reviewUploadPopup from "@/components/popup/reviewUploadPopup.vue";
 const router = useRouter();
+
 const showApplyPopup = ref(false);
+const uploadExecuteRef = ref(null);
+
+const showShare = ref(false);
+const options = ref([
+    {
+        name: "需求大厅",
+        icon: "https://birdseye-img.sysuimars.com/birdseye-look-mini/xuqiu-icon.png",
+        type: "demandHall",
+    },
+    { name: "微信", icon: "wechat", type: "wechat" },
+]);
+
+// 获取触发图片
+const triggerImg = ref([]);
+const getTriggerImg = async () => {
+    const { data } = await VE_API.z_farm_work_record.getTriggerImg({ farmWorkRecordId: currentSection.value.id });
+    triggerImg.value = data || [];
+}
+
+const onSelect = async (option) => {
+    if (option.type === "wechat") {
+        await getTriggerImg();
+        const query = {
+            askInfo: { title: "农事需求", content: "是否分享该农事需求给好友" },
+            shareText: `发起了 ${currentSection.value.farmWorkName} 的接单需求 请查看!`,
+            id: currentSection.value.id,
+            farmWorkOrderId: currentSection.value.orderId,
+            postImg: triggerImg.value.length ? base_img_url2 + triggerImg.value[triggerImg.value.length - 1].cloudFilename : ''
+        };
+        wx.miniProgram.navigateTo({
+            url: `/pages/subPages/share_page/index?pageParams=${JSON.stringify(query)}&type=priceSheet`,
+        });
+    } else {
+        updateFlowStatus(2);
+    }
+};
+
+const updateFlowStatus = (targetFlowStatus) => {
+    return VE_API.z_farm_work_record.updateFlowStatus({ id: currentSection.value.id, targetFlowStatus }).then((res) => {
+        if (res.code === 0) {
+            if (targetFlowStatus === 2) {
+                showApplyPopup.value = true;
+            }
+            getContentData();
+        }
+    });
+};
+
+// 取消发起需求/确认执行完成
+const handleOperation = (section, type) => {
+    currentSection.value = section;
+    ElMessageBox.confirm(type === "cancel" ? "确认取消发起需求吗?" : "确认执行完成吗?", "提示", {
+        confirmButtonText: "确认",
+        cancelButtonText: "取消",
+        type: "warning",
+    })
+        .then(() => {
+            updateFlowStatus(type === "cancel" ? 1 : 5);
+        })
+        .catch(() => {});
+};
+
+const showUpload = ref(false);
+const sectionId = ref(null);
+// 上传照片处理函数
+const handleUploadPhoto = ({ id }) => {
+    showUpload.value = true;
+    sectionId.value = id;
+};
 
 const filterType = ref([
     {
@@ -94,37 +197,60 @@ onMounted(() => {
 });
 
 const contentData = ref([]);
-const getContentData = () => {
-    VE_API.z_farm_work_record
-        .getSimpleList({
-            role: localStorage.getItem("SET_USER_CUR_ROLE"),
-            status: activePlanIndex.value === 4 ? "1,2,3,4" : activePlanIndex.value,
-        })
-        .then((res) => {
-            contentData.value = res.data;
+const getContentData = async () => {
+    const res = await VE_API.z_farm_work_record.getSimpleList({
+        role: localStorage.getItem("SET_USER_CUR_ROLE"),
+        flowStatus: activePlanIndex.value === 4 ? "1,2,3,4" : activePlanIndex.value,
+    });
+    contentData.value = res.data;
+
+    // 遍历数组,获取每一项的详情并合并
+    if (res.data && res.data.length > 0) {
+        const detailPromises = res.data.map((item) => getItemDetail(item.id));
+        const detailResults = await Promise.all(detailPromises);
+
+        // 将详情数据合并到对应的数组项中
+        contentData.value = res.data.map((item, index) => {
+            return {
+                ...item,
+                farmWorkDetail: detailResults[index][0],
+                prescriptionList: detailResults[index][0]?.prescriptionList,
+                reviewImage: detailResults[index][0]?.reviewImage,
+            };
         });
+    }
 };
 
-const handleApply = (section, index) => {
-    // 更新当前项的发起需求状态
-    // showApplyPopup.value = true;
-    // section.hasApplied = true;
-};
+async function getItemDetail(id) {
+    const { data } = await VE_API.z_farm_work_record.getDetail({ id });
+    return data || {};
+}
 
-const hasUploadedPhotos = (section) => {
-    // 检查是否上传了图片,通过confirmPicture和executeEvidence字段判断
-    const hasConfirmPictures = section.confirmPicture && section.confirmPicture.length > 0;
-    const hasExecuteEvidence = section.executeEvidence && section.executeEvidence.length > 0;
-    return hasConfirmPictures || hasExecuteEvidence;
+const currentSection = ref({});
+const handleApply = (section, type) => {
+    currentSection.value = section;
+    if (type === "remindExecute") {
+        const params = {
+            id: section.id,
+            farmMiniUserId: section.farmWorkDetail?.users[0]?.userId,
+            farmWorkOrderId: section?.orderId,
+            farmId: section?.farmId,
+            farmWorkName: section?.farmWorkName,
+            type: "remindExecute",
+        };
+        uploadExecuteRef.value.showPopup(params);
+    } else {
+        showShare.value = true;
+    }
 };
 
 const handleClick = (section) => {
-    if(activePlanIndex.value == 5){
-        router.push(`/review_work?json=${JSON.stringify({id:section.id, goBack: true})}`);
-    }else{
+    if (activePlanIndex.value == 5) {
+        router.push(`/review_work?json=${JSON.stringify({ id: section.id, goBack: true })}`);
+    } else {
         router.push({
             path: "/completed_work",
-            query: { json: JSON.stringify({ id: section.id }) }
+            query: { json: JSON.stringify({ id: section.id }) },
         });
     }
 };
@@ -267,8 +393,8 @@ const handleClick = (section) => {
                         border-radius: 20px;
                         font-size: 12px;
                         &.second-item {
-                            border: 1px solid #2199f8;
-                            color: #2199f8;
+                            background: rgba(137, 137, 137, 0.1);
+                            color: #898989;
                         }
                         &.primary-item {
                             background: #2199f8;
@@ -280,7 +406,6 @@ const handleClick = (section) => {
                             &.has-applied {
                                 background: transparent;
                                 color: #afafaf;
-                                pointer-events: none;
                             }
                         }
                         &.cancel-item {
@@ -303,33 +428,4 @@ const handleClick = (section) => {
         }
     }
 }
-.apply-popup {
-    width: 75%;
-    padding: 28px 28px 20px;
-    display: flex;
-    flex-direction: column;
-    align-items: center;
-    justify-content: center;
-    .check-icon {
-        width: 68px;
-        height: 68px;
-        margin-bottom: 12px;
-    }
-    .apply-text {
-        font-size: 24px;
-        font-weight: 500;
-        margin-bottom: 32px;
-        text-align: center;
-    }
-    .apply-btn {
-        width: 100%;
-        box-sizing: border-box;
-        padding: 8px;
-        border-radius: 25px;
-        font-size: 16px;
-        background: #2199f8;
-        color: #fff;
-        text-align: center;
-    }
-}
 </style>

+ 3 - 1
src/views/old_mini/create_farm/editMap.vue

@@ -137,7 +137,9 @@ const confirm = () => {
     store.commit("home/SET_FARM_POLYGON", polygonData);
     
     if (type.value !== 'edit') {
-        router.replace(`/create_farm?from=${route.query.from}&type=${route.query.type}`)
+        // 添加时间戳确保路由更新,触发 onActivated
+        const timestamp = Date.now();
+        router.replace(`/create_farm?from=${route.query.from}&type=${route.query.type}&_t=${timestamp}`)
     }else{
         router.back()
     }

+ 38 - 11
src/views/old_mini/create_farm/index.vue

@@ -150,7 +150,7 @@ import customHeader from "@/components/customHeader.vue";
 import IndexMap from "./map/index.js";
 import { useRoute, useRouter } from "vue-router";
 import { mapLocation } from "./map/index.js";
-import { onMounted, ref, reactive, watch, onActivated } from "vue";
+import { onMounted, ref, reactive, watch, onActivated, nextTick } from "vue";
 import { useStore } from "vuex";
 import { convertPointToArray } from "@/utils/index";
 import { ElMessage } from "element-plus";
@@ -290,6 +290,29 @@ const paramsType = ref(null);
 onActivated(() => {
     paramsType.value = route.query.type;
     
+    // 确保地图已初始化,使用 nextTick 等待 DOM 更新
+    nextTick(() => {
+        // 检查地图实例是否已初始化
+        if (!indexMap.kmap) {
+            // 如果地图未初始化,重新初始化
+            if (mapContainer.value) {
+                centerPoint.value = store.state.home.miniUserLocationPoint;
+                const arr = convertPointToArray(centerPoint.value);
+                indexMap.initMap(centerPoint.value, mapContainer.value);
+            }
+            // 等待地图初始化完成后再继续
+            setTimeout(() => {
+                handleMapUpdate();
+            }, 100);
+            return;
+        }
+        
+        handleMapUpdate();
+    });
+});
+
+// 处理地图更新的逻辑
+function handleMapUpdate() {
     if (route.query.isReload) {
         // 清除旧的地块数据
         store.commit("home/SET_FARM_POLYGON", null);
@@ -312,15 +335,11 @@ onActivated(() => {
         return; // 直接返回,不执行下面的逻辑
     }
     
-    // 如果是编辑模式,回填数据
-    if (route.query.type === 'edit' && store.state.home.editFarmData) {
-        populateEditData();
-        return;
-    }
-    
     indexMap.clearLayer();
     // 绘制勾画范围(从edit_map返回的情况)
     const polygonData = store.state.home.polygonData;
+    
+    // 优先处理从编辑地图页面返回的数据
     if (polygonData) {
         // 检查地块数据是否有效(数组存在且不为空)
         const hasValidGeometry = polygonData.geometryArr && 
@@ -339,7 +358,10 @@ onActivated(() => {
                 isFromEditMap.value = false;
                 // 面积输入框保持之前的值,不更新
             }
-            indexMap.setAreaGeometry(polygonData.geometryArr);
+            // 使用 nextTick 确保地图渲染完成后再设置地块
+            nextTick(() => {
+                indexMap.setAreaGeometry(polygonData.geometryArr);
+            });
             polygonArr.value = polygonData.geometryArr;
             // 有地块数据时,标记已创建默认地块
             hasDefaultPolygon.value = true;
@@ -352,15 +374,20 @@ onActivated(() => {
             hasDefaultPolygon.value = false;
             ruleForm.defaultFarm = false;
         }
+    } else if (route.query.type === 'edit' && store.state.home.editFarmData) {
+        // 如果是编辑模式且没有从编辑地图返回的数据,回填原始编辑数据
+        populateEditData();
     } else if (centerPoint.value && polygonArr.value) {
         // 没有新的编辑数据,保持当前地块
         // 同样需要检查数据有效性
         if (Array.isArray(polygonArr.value) && polygonArr.value.length > 0) {
-            indexMap.setAreaGeometry(polygonArr.value);
+            nextTick(() => {
+                indexMap.setAreaGeometry(polygonArr.value);
+            });
             // 保持 hasDefaultPolygon 状态
         }
     }
-});
+}
 
 // 搜索
 const MAP_KEY = "CZLBZ-LJICQ-R4A5J-BN62X-YXCRJ-GNBUT";
@@ -601,7 +628,7 @@ function toSubPage() {
     }
     
     router.push(
-        `/edit_map?mapCenter=${centerPoint.value}&pointName=${ruleForm.address}&pointAddress=${pointAddress.value}&from=${route.query.from}&type=client`
+        `/edit_map?mapCenter=${centerPoint.value}&pointName=${ruleForm.address}&pointAddress=${pointAddress.value}&from=${route.query.from}&type=${route.query.type}`
     );
 }
 

+ 9 - 3
src/views/old_mini/create_farm/map/editMap.js

@@ -99,10 +99,16 @@ class EditMap {
     const features = this.kmap.getLayerFeatures()
     let geometryArr = []
     let area = 0
-    // 获取图层上的Polygon,转成geoJson用于回显
+    const format = new WKT()
+    // 获取图层上的Polygon,转成WKT用于回显
     features.forEach(item => {
-      geometryArr.push(new WKT().writeFeature(item))
-      let geom = item.getGeometry().clone()
+      // 使用 writeGeometry 而不是 writeFeature,因为 setLayerWkt 期望的是几何体的 WKT
+      const geometry = item.getGeometry()
+      geometryArr.push(format.writeGeometry(geometry, {
+        dataProjection: 'EPSG:4326',
+        featureProjection: this.kmap.map.getView().getProjection()
+      }))
+      let geom = geometry.clone()
       geom.transform(proj.get("EPSG:4326"), proj.get("EPSG:38572"))
       let areaItem = getArea(geom)
       areaItem = (areaItem + areaItem / 2) / 1000;

+ 35 - 10
src/views/old_mini/modify_work/completedWork.vue

@@ -101,8 +101,8 @@
                                                 </div>
                                                 <div class="info-c">
                                                     亩单价<span class="main-text">{{
-                                                        quotationData.farmWorkServiceCost || manualServicePrice
-                                                            ? (quotationData.farmWorkServiceCost || manualServicePrice) + "元/亩"
+                                                        quotationData.farmWorkServiceCost || quotationData.manualServicePrice
+                                                            ? (quotationData.farmWorkServiceCost || quotationData.manualServicePrice) + "元/亩"
                                                             : "--"
                                                     }}</span>
                                                 </div>
@@ -397,6 +397,8 @@
 
     <!-- 上传执行照片 -->
     <upload-execute ref="uploadExecuteRef" :onlyShare="onlyShare" />
+    <!-- 发起需求成功弹窗 -->
+    <fn-share-sheet v-model:show="showDemandShare" @select="onDemandSelect" :options="demandOptions" />
 </template>
 
 <script setup>
@@ -414,6 +416,8 @@ import uploadExecute from "@/views/old_mini/task_condition/components/uploadExec
 import { base_img_url2 } from "@/api/config";
 import { ElMessage } from "element-plus";
 import { formatArea } from "@/common/commonFun";
+import wx from "weixin-js-sdk";
+import FnShareSheet from "@/components/pageComponents/FnShareSheet.vue";
 
 const router = useRouter();
 const store = useStore();
@@ -444,16 +448,37 @@ const handleOk = () => {
 
 const successText = ref("");
 const taskPopupActionType = ref(0);
+const showDemandShare = ref(false);
+const demandOptions = ref([
+    { name: "需求大厅", icon: "https://birdseye-img.sysuimars.com/birdseye-look-mini/xuqiu-icon.png", type: "demandHall" },
+    { name: "微信", icon: "wechat", type: "wechat" },
+]);
+const onDemandSelect = (option) => {
+    if (option.type === "wechat") {
+        const query = {
+            askInfo: { title: "农事需求", content: "是否分享该农事需求给好友" },
+            shareText: `发起了 ${detailData.value.farmWorkName} 的接单需求 请查看!`,
+            id: detailData.value.id,
+            farmWorkOrderId: detailData.value.orderId,
+            postImg: triggerImg.value.length ? base_img_url2 + triggerImg.value[triggerImg.value.length - 1].cloudFilename : ''
+        };
+        wx.miniProgram.navigateTo({
+            url: `/pages/subPages/share_page/index?pageParams=${JSON.stringify(query)}&type=priceSheet`,
+        });
+    }else{
+        VE_API.z_farm_work_record.updateFlowStatus({ id: query.value.id, targetFlowStatus: 2 }).then((res) => {
+            if (res.code === 0) {
+                taskPopupType.value = "success";
+                successText.value = "需求已发送成功";
+                taskPopupActionType.value = 0;
+                showTaskPopup.value = true;
+            }
+        });
+    }
+};
 const handleDemand = () => {
     // router.push("/share_page");
-    VE_API.z_farm_work_record.updateFlowStatus({ id: query.value.id, targetFlowStatus: 2 }).then((res) => {
-        if (res.code === 0) {
-            taskPopupType.value = "success";
-            successText.value = "需求已发送成功";
-            taskPopupActionType.value = 0;
-            showTaskPopup.value = true;
-        }
-    });
+    showDemandShare.value = true;
 };
 
 const showTaskPopup = ref(false);

+ 2 - 1
src/views/old_mini/monitor/index.vue

@@ -65,7 +65,7 @@
                 finished-text="暂无更多播报"
                 @load="onLoad"
                 class="broadcast-list"
-                :style="{ height: !isHeaderShow ? 'calc(100vh - 460px)' : 'calc(100vh - 510px)' }"
+                :style="{ height: !isHeaderShow ? 'calc(100vh - 460px)' : 'calc(100vh - 535px)' }"
             >
                 <div v-for="(item, index) in broadcastList" :key="index" class="broadcast-item">
                     <div class="item-content">
@@ -668,6 +668,7 @@ function handlePage(url) {
 }
 .custom-bottom-fixed-btns {
     z-index: 99999;
+    padding: 15px 12px 30px 12px;
     .primary-btn {
         background: rgba(33, 153, 248, 0.1);
         color: #2199f8;

+ 2 - 2
src/views/old_mini/monitor/subPages/reviewResults.vue

@@ -18,9 +18,9 @@
                                 :record-item-data="section"
                                 content-mode="serviceDetail"
                                 title-mode="default"
-                                title-right-type="dot"
-                                title-right-dot-text="2区"
                                 class="recipe-item"
+                                titleRightDotText="全区"
+                                titleRightType="dot"
                                 showFarmImage
                                 @click="handleClick(section, index)"
                             >