فهرست منبع

fix: 首页和详情页操作

lxf 9 ساعت پیش
والد
کامیت
e612db4a22

+ 12 - 1
src/common/commonFun.js

@@ -182,4 +182,15 @@ function convertImage(imgUrl) {
     });
 }
 
-export { deepClone, extractCoordinates, throttle, downloadImage, convertImage, detectRuntimeEnvironment, formatArea };
+// 格式化日期函数(与 calendar 组件保持一致)
+function formatDate(date) {
+    if (typeof date === "string") {
+        date = new Date(date);
+    }
+    return `${date.getFullYear()}-${String(date.getMonth() + 1).padStart(2, "0")}-${String(date.getDate()).padStart(
+        2,
+        "0"
+    )}`;
+}
+
+export { deepClone, extractCoordinates, throttle, downloadImage, convertImage, detectRuntimeEnvironment, formatArea, formatDate };

+ 2 - 1
src/components/popup/activeUploadPopup.vue

@@ -176,6 +176,8 @@ function handleShow({
     phenologyList.value = phenologyListVal;
     // 重置上传状态
     isUploading.value = false;
+
+    // 如果没有报价信息,则跳转去完善报价信息
 }
 
 function handleSuccess() {
@@ -219,7 +221,6 @@ function triggerFarmWork(paramsObj, showSuccess) {
 
     // 设置上传状态为 true
     isUploading.value = true;
-    console.log("paramsObj", paramsObj);
 
     VE_API.monitor
         .triggerFarmWork(paramsObj)

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

@@ -19,7 +19,7 @@
                     <div class="quotation-info">
                         <div class="info-item">
                             <span class="info-label">报价组织</span>
-                            <span class="info-value">{{ priceData.serviceMain || '--' }}</span>
+                            <span class="info-value">{{ priceData.agriculturalName || '--' }}</span>
                         </div>
                         <div class="info-item">
                             <span class="info-label">报价农事</span>
@@ -143,7 +143,7 @@ const quotationData = ref({});
 const priceData = ref({});
 
 onActivated(() => {
-    fetchPriceData()
+    getDetail()
 })
 
 const getTotal = (item) => {

+ 1 - 1
src/router/globalRoutes.js

@@ -137,7 +137,7 @@ export default [
     {
         path: "/user",
         name: "User",
-        meta: { showTabbar: true },
+        meta: { showTabbar: true, keepAlive: true },
         component: () => import("@/views/old_mini/user/index.vue"),
     },
     // 用户管理详情

+ 2 - 2
src/views/old_mini/achievement_report/index.vue

@@ -39,12 +39,12 @@
                     </div>
                 </div>
 
-                <div class="report-box">
+                <!-- <div class="report-box">
                     <div class="box-title">精准施治,智慧护航</div>
                     <div class="box-text">
                         {{ reportData?.resultInfo || "--" }}
                     </div>
-                </div>
+                </div> -->
 
                 <div class="report-excute" v-for="(item, index) in workItem?.executeEvidence" :key="index">
                     <div class="tag-label">执行照片</div>

+ 59 - 12
src/views/old_mini/home/components/AgriculturalDynamics.vue

@@ -6,12 +6,16 @@
                 <div class="task-content">
                     <div class="task-header">
                         <div class="task-status-tag">待完成</div>
-                        <div class="task-title">{{ task.title }}</div>
+                        <div class="task-title">{{ task.farmWorkName }}</div>
                     </div>
-                    <div class="task-time">执行时间 {{ task.executionTime }}</div>
+                    <div class="task-time" v-if="task.expectedExecuteDate">执行时间 {{ task.expectedExecuteDate }}</div>
+                    <div class="task-time deadline" v-else>截止时间 {{ task.executeDeadlineDate }}</div>
                 </div>
-                <div class="task-action" @click="handleTaskAction(task)" :class="{ orange: index === 1 }">
-                    {{ index === 0 ? "上传照片" : "确认执行时间" }}
+                <div v-if="task.expectedExecuteDate" class="task-action" @click="handleTaskAction(task)">
+                    上传照片
+                </div>
+                <div v-else class="task-action orange" @click="selectExecuteTime(task)">
+                    确认执行时间
                 </div>
             </div>
         </div>
@@ -41,24 +45,33 @@
                     ></div>
 
                     <!-- 时间轴组件,只负责时间轴区域 -->
-                    <AgriculturalInteractionCard :item="item" @updateList="getUnansweredFarms" />
+                    <AgriculturalInteractionCard :item="item" @updateList="updateAllData" />
                 </div>
             </template>
         </div>
     </div>
     <offer-popup ref="offerPopupRef"></offer-popup>
+
+    <!-- 确认执行时间 -->
+    <calendar
+        teleport="#app"
+        v-model:show="showCalendar"
+        @confirm="onConfirmExecuteTime"
+        :min-date="minDate"
+        :max-date="maxDate"
+    />
 </template>
 
 <script setup>
 import router from "@/router";
-import { ref, onMounted } from "vue";
+import { ref, onMounted, onActivated } from "vue";
+import { Calendar } from "vant";
+import { ElMessage } from "element-plus";
 import offerPopup from "@/components/popup/offerPopup.vue";
 import AgriculturalInteractionCard from "@/components/pageComponents/AgriculturalInteractionCard.vue";
+import { formatDate } from "@/common/commonFun";
 // 任务列表数据
-const taskList = ref([
-    { id: 1, title: "梢期杀虫", executionTime: "2025.05.06", status: "pending" },
-    { id: 2, title: "梢期杀虫", executionTime: "2025.05.06", status: "pending" },
-]);
+const taskList = ref([]);
 
 const offerPopupRef = ref(null);
 const handleTaskAction = (item) => {
@@ -89,15 +102,46 @@ const handleTaskAction = (item) => {
     offerPopupRef.value.openPopup(data);
 };
 
+const showCalendar = ref(false);
+const maxDate = ref();
+const minDate = new Date(2010, 0, 1);
+const executeItem = ref(null);
+const selectExecuteTime = (item) => {
+    executeItem.value = item;
+    maxDate.value = new Date(item.executeDeadlineDate);
+    showCalendar.value = true;
+};
+
+const onConfirmExecuteTime = (date) => {
+    showCalendar.value = false;
+    VE_API.z_farm_work_record
+        .updateExpectedExecuteDate({ recordId: executeItem.value.id, expectedExecuteDate: formatDate(date) })
+        .then((res) => {
+            if (res.code === 0) {
+                ElMessage.success("操作成功");
+                getTaskList();
+            }
+        });
+};
+
 const handleRemind = (item) => {
     router.push(`/remind_customer?farmId=${item.farmId}`);
 };
 
-onMounted(() => {
-    getUnansweredFarms();
+onActivated(() => {
+    updateAllData();
 });
 
+const updateAllData = () => {
+    getUnansweredFarms();
+    getTaskList();
+};
 //农情互动的农场列表接口(分页)
+const getTaskList = async () => {
+    const res = await VE_API.z_farm_work_record.getSimpleList({ role: 2, flowStatus: 4 });
+    taskList.value = res.data || [];
+};
+
 const unansweredList = ref([]);
 const getUnansweredFarms = async () => {
     const params = {
@@ -178,6 +222,9 @@ const getFutureFarmWorkWarning = async (item) => {
                 .task-time {
                     font-size: 12px;
                     color: rgba(78, 89, 105, 0.5);
+                    &.deadline {
+                        color: rgba(255, 85, 85, 0.7);
+                    }
                 }
             }
 

+ 15 - 77
src/views/old_mini/modify_work/completedWork.vue

@@ -31,11 +31,11 @@
                         该农事已完成
                     </div>
                 </div>
-                <template v-if="query.status !== 'warning'">
+                <!-- <template v-if="query.status !== 'warning'">
                     <div class="status-r" v-if="curRole == 0">{{ status === 0 ? "设置提醒" : "去评价" }}</div>
                     <div class="status-r" v-if="curRole == 1">{{ status === 0 ? "提醒执行" : "提醒复核" }}</div>
                     <div class="status-r" v-if="curRole == 2">{{ status === 0 ? "提醒执行" : "提醒复核" }}</div>
-                </template>
+                </template> -->
             </div>
             <div class="work-wrap" v-if="query?.farmWorkOrderId || detailData?.flowStatus === 4">
                 <div class="box-wrap executor-info" v-if="query.status === 'warning' || curRole == 0 || curRole == 2">
@@ -174,7 +174,7 @@
                         </div>
                         <div class="form-item">
                             <div class="item-name">执行时间</div>
-                            <div class="item-text">{{ detailData?.executeDate }}</div>
+                            <div class="item-text">{{ detailData?.executeDate || detailData?.expectedExecuteDate || detailData?.executeDate }}</div>
                         </div>
                     </div>
                 </div>
@@ -245,84 +245,18 @@
                     </div>
                 </div> -->
             </div>
-            <div
-                class="fixed-btn-wrap"
-                :class="{
-                    center:
-                        (currentStep == 0 && detailData?.isPublic) ||
-                        (detailData?.flowStatus == 3 && curRole == 0) ||
-                        (detailData?.flowStatus == 4 && curRole == 2) ||
-                        (detailData?.flowStatus == 2 && curRole == 0) ||
-                        (detailData?.flowStatus == 4 && curRole == 0),
-                }"
-                v-if="query.status !== 'warning'"
-            >
-                <!-- <div class="fixed-btn expert">提醒农事确认</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"
-                    @click="handleRemindExecute"
-                >
-                    提醒对方执行
-                </div>
-                <div
-                    class="fixed-btn orange"
-                    v-if="detailData?.flowStatus == 0 && curRole == 0 && !query?.isAssign && !detailData?.isPublic"
-                    @click="handleDemand"
-                >
-                    发起需求
-                </div>
-                <div
-                    class="fixed-btn orange"
-                    v-if="detailData?.flowStatus == 0 && !query?.farmWorkOrderId && curRole == 0 && detailData?.isPublic"
-                    @click="cancelDemand"
-                >
-                    取消发起
-                </div>
-                <div
-                    class="fixed-btn"
-                    v-if="detailData?.flowStatus == 0 && curRole == 0 && !query?.isAssign && !detailData?.isPublic"
-                    @click="handleUploadPhoto({ id: detailData.id })"
-                >
-                    确认并完成
-                </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>
 
-            <!-- 农资,步骤:农事已确认 -->
-            <div class="fixed-btn-wrap" v-if="curRole == 2 && currentStep == 0">
-                <div class="fixed-btn second" @click="showIgnore">忽略</div>
-                <div class="fixed-btn" @click="showPriceSheetPopup">确认并报价</div>
-            </div>
             <!-- 农资,步骤:农资已执行,请求确认 -->
-            <div class="fixed-btn-wrap center" v-if="curRole == 2 && currentStep == 2">
+            <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" v-if="curRole == 2 && currentStep == 2">
+            <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>
     <!-- 报价弹窗 -->
@@ -384,7 +318,7 @@ import priceSheetPopup from "@/components/popup/priceSheetPopup.vue";
 import uploadExecute from "@/views/old_mini/task_condition/components/uploadExecute.vue";
 import { base_img_url2 } from "@/api/config";
 import { ElMessage } from "element-plus";
-import { formatArea } from "@/common/commonFun";
+import { formatArea, formatDate } from "@/common/commonFun";
 import wx from "weixin-js-sdk";
 import reviewUploadPopup from "@/components/popup/reviewUploadPopup.vue";
 import FnShareSheet from "@/components/pageComponents/FnShareSheet.vue";
@@ -568,17 +502,21 @@ const handleRemindExecute = () => {
 };
 
 const showCalendar = ref(false);
-const maxDate = ref(new Date(2025, 12, 25));
+const maxDate = ref(new Date());
 const minDate = new Date(2010, 0, 1);
 const selectExecuteTime = () => {
+    maxDate.value = new Date(detailData.value.executeDeadlineDate);
     showCalendar.value = true;
 };
 
-const formatDate = (date) => `${date.getFullYear()}-${date.getMonth() + 1}-${date.getDate()}`;
 
 const onConfirmExecuteTime = (date) => {
-    console.log("date", formatDate(date));
     showCalendar.value = false;
+    VE_API.z_farm_work_record.updateExpectedExecuteDate({ recordId: query.value.id, expectedExecuteDate: formatDate(date) }).then((res) => {
+        if (res.code === 0) {
+            getDetail(query.value.id);
+        }
+    });
 };
 
 const handleForward = () => {
@@ -811,7 +749,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];
-        maxDate.value = new Date(detailData.value.executeDate);
+        // maxDate.value = new Date(detailData.value.executeDate);
         currentStep.value = getCurrentStep(detailData.value.flowStatus);
         parmasPage.value = {
             ...detailData.value,

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

@@ -1,6 +1,6 @@
 <template>
     <div class="new-farming-page" ref="pageRef">
-        <custom-header :name="isEdit ? '编辑方案' : '查看详情'"></custom-header>
+        <custom-header :name="isEdit ? (onlyPrice ? '编辑报价' : '编辑方案') : '查看详情'"></custom-header>
         <div class="new-farming-content" :class="{ 'no-permission': !hasPlanPermission }">
             <el-form
                 ref="formRef"
@@ -379,8 +379,8 @@
                     </div>
 
                     <div class="submit-btn">
-                        <div class="btn second" @click.prevent="cancelEdit">取消编辑</div>
-                        <div class="btn" @click.prevent="submitForm(formRef)">保存方案</div>
+                        <div v-if="!onlyPrice" class="btn second" @click.prevent="cancelEdit">取消编辑</div>
+                        <div class="btn" @click.prevent="submitForm(formRef)">保存</div>
                     </div>
                 </template>
 
@@ -1032,6 +1032,10 @@ const submit = () => {
         if (res.code === 0) {
             await getDetail();
             ElMessage.success("保存成功");
+            if (onlyPrice.value) {
+                router.back();
+                return;
+            }
             isEdit.value = false;
             nextTick(() => {
                 if (pageRef.value) {

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

@@ -113,6 +113,7 @@ import uploadExecute from "./uploadExecute.vue";
 import priceSheetPopup from "@/components/popup/priceSheetPopup.vue";
 import { ElMessage } from "element-plus";
 import offerPopup from "@/components/popup/offerPopup.vue";
+import { formatDate } from "@/common/commonFun";
 
 const store = useStore();
 const router = useRouter();
@@ -333,17 +334,6 @@ function getSimpleList() {
         });
 }
 
-// 格式化日期函数(与 calendar 组件保持一致)
-function formatDate(date) {
-    if (typeof date === "string") {
-        date = new Date(date);
-    }
-    return `${date.getFullYear()}-${String(date.getMonth() + 1).padStart(2, "0")}-${String(date.getDate()).padStart(
-        2,
-        "0"
-    )}`;
-}
-
 // 处理日历日期选择
 const handleDateSelect = (date) => {
     if (date) {

+ 5 - 2
src/views/old_mini/user/index.vue

@@ -82,7 +82,7 @@
 
 <script setup>
 import { Collapse, CollapseItem } from "vant";
-import { ref, onMounted, computed, nextTick } from "vue";
+import { ref, onMounted, computed, nextTick, onActivated } from "vue";
 import wx from "weixin-js-sdk";
 import { useRouter } from "vue-router";
 import addPopup from "./components/addPopup.vue";
@@ -100,12 +100,15 @@ const mapContainer = ref(null);
 
 onMounted(() => {
     const point = store.state.home.miniUserLocationPoint;
-    getUserList();
     nextTick(() => {
         indexMap.initMap(point, mapContainer.value, true);
     });
 });
 
+onActivated(() => {
+    getUserList();
+});
+
 const activeNames = ref([1]);
 const dataList = ref([
     {